#include "honlinemonhist.h" #include "honlinehistarray.h" #include "honlinetrendhist.h" #include "haddef.h" #include "htrbnetdebuginfo.h" #include "hcategory.h" #include "hstartdef.h" #include "hstart2raw.h" #include "hstart2cal.h" #include "htboxchan.h" #include "helpers.h" #include "TList.h" #include "TString.h" #include #include using namespace std; map < TString , HOnlineMonHistAddon* > startMap; Bool_t createHistStart(TList& histpool){ mapHolder::setMap(startMap); // make startMap currentMap //####################### USER CODE ############################################## // define monitoring hists Text_t* hists[] = { "FORMAT#trendarray TYPE#1F NAME#hLatch_Trend TITLE#_hLatch_TBit ACTIVE#1 RESET#0 REFRESH#1000 BIN#50:0:50:0:0:0 SIZE#1:32 AXIS#time:counts:no DIR#no OPT#l STATS#0 LOG#0:0:0 GRID#0:1 LINE#0:0 FILL#0:0 MARKER#1:20:0.5 RANGE#-99:-99" ,"FORMAT#mon TYPE#1F NAME#hLatch_TrendTemp TITLE#_hLatch_TBit ACTIVE#1 RESET#0 REFRESH#500000 BIN#32:0:32:0:0:0 SIZE#0:0 AXIS#TBit:multiplicity:no DIR#no OPT#0 STATS#0 LOG#0:0:0 GRID#0:1 LINE#0:0 FILL#0:0 MARKER#1:20:0.5 RANGE#-99:-99" ,"FORMAT#mon TYPE#1F NAME#hLatch_Norm TITLE#_hLatch_Norm ACTIVE#1 RESET#1 REFRESH#5000 BIN#32:0:32:0:0:0 SIZE#0:0 AXIS#TBit:multiplicity:no DIR#no OPT#no STATS#0 LOG#0:0:0 GRID#0:1 LINE#0:0 FILL#1:0 MARKER#1:20:0.5 RANGE#-99:-99" ,"FORMAT#mon TYPE#1F NAME#hLatch_Mult TITLE#_hLatch_Mult ACTIVE#1 RESET#0 REFRESH#5000 BIN#10:0:10:0:0:0 SIZE#0:0 AXIS#multiplicity:counts:no DIR#no OPT#no STATS#0 LOG#0:0:0 GRID#0:1 LINE#0:0 FILL#1:0 MARKER#1:20:0.5 RANGE#-99:-99" ,"FORMAT#trendarray TYPE#1F NAME#hScalers_Trend TITLE#_hScalers_Trend ACTIVE#1 RESET#0 REFRESH#2000 BIN#50:0:50:0:0:0 SIZE#1:135 AXIS#trend:multiplicity:no DIR#no OPT#no STATS#0 LOG#0:0:0 GRID#0:1 LINE#1:0 FILL#1:0 MARKER#0:0:0 RANGE#-99:-99" ,"FORMAT#mon TYPE#1F NAME#hScalers_TrendTemp TITLE#_hScalers_Int ACTIVE#1 RESET#0 REFRESH#50000 BIN#135:0:135:0:0:0 SIZE#0:0 AXIS#scaler:multiplicity:no DIR#no OPT#0 STATS#0 LOG#0:0:0 GRID#0:1 LINE#0:0 FILL#0:0 MARKER#1:20:0.5 RANGE#-99:-99" ,"FORMAT#mon TYPE#2F NAME#hStart_Raw_Mod_Strip TITLE#hStart_Raw_Mod_Strip ACTIVE#1 RESET#1 REFRESH#5000 BIN#4:0:4:8:0:8 SIZE#0:0 AXIS#module:strip:counts DIR#no OPT#LEGO2 STATS#0 LOG#0:0:0 GRID#0:0 LINE#0:0 FILL#0:0 MARKER#0:0:0 RANGE#-99:-99" ,"FORMAT#array TYPE#1F NAME#hStart_Raw_Mult TITLE#hStart_Raw_Mult ACTIVE#1 RESET#1 REFRESH#5000 BIN#10:0:10:0:0:0 SIZE#4:8 AXIS#nr_of_times:counts:no DIR#no OPT#no STATS#0 LOG#0:0:0 GRID#0:0 LINE#0:0 FILL#0:0 MARKER#0:0:0 RANGE#-99:-99" ,"FORMAT#array TYPE#1F NAME#hStart_Raw_Mult_All TITLE#hStart_Raw_Mult_All ACTIVE#1 RESET#1 REFRESH#5000 BIN#10:0:10:0:0:0 SIZE#1:4 AXIS#nr_of_strips:counts:no DIR#no OPT#no STATS#0 LOG#0:0:0 GRID#0:0 LINE#0:0 FILL#0:0 MARKER#0:0:0 RANGE#-99:-99" ,"FORMAT#array TYPE#1F NAME#hStart_Cal_TimeDiff TITLE#_hStart_Cal_TimeDiff ACTIVE#1 RESET#1 REFRESH#5000 BIN#500:-5000:5000:0:0:0 SIZE#32:32 AXIS#timedifference:counts:no DIR#no OPT#0 STATS#0 LOG#0:0:0 GRID#0:0 LINE#0:0 FILL#0:0 MARKER#1:20:0.5 RANGE#-99:-99" ,"FORMAT#array TYPE#2F NAME#hStart_Cal_Corr TITLE#_hStart_Cal_Corr ACTIVE#1 RESET#1 REFRESH#5000 BIN#8:0:8:8:0:8 SIZE#1:6 AXIS#strip:strip:counts DIR#no OPT#LEGO2 STATS#0 LOG#0:0:0 GRID#0:0 LINE#0:0 FILL#0:0 MARKER#1:20:0.5 RANGE#-99:-99" ,"FORMAT#array TYPE#2F NAME#hStart_Cal_Eff TITLE#_hStart_Cal_Eff ACTIVE#1 RESET#1 REFRESH#5000 BIN#4:0:4:4:0:4 SIZE#1:4 AXIS#VetoY:VetoX:counts DIR#no OPT#LEGO2 STATS#0 LOG#0:0:0 GRID#0:0 LINE#0:0 FILL#0:0 MARKER#1:20:0.5 RANGE#-99:-99" ,"FORMAT#array TYPE#1F NAME#hTrbNetDebug TITLE#hTrbNetDebug ACTIVE#1 RESET#1 REFRESH#50000 BIN#32:0:32 SIZE#1:27 AXIS#Bit:counts:counts DIR#no OPT#no STATS#0 LOG#0:0:0 GRID#0:0 LINE#0:0 FILL#1:0 MARKER#1:20:0.5 RANGE#-99:-99" ,"FORMAT#array TYPE#1F NAME#hStart_Raw_Width TITLE#hStart_Raw_Width ACTIVE#1 RESET#1 REFRESH#5000 BIN#501:-10:5000:0:0:0 SIZE#4:8 AXIS#width:counts:no DIR#no OPT#no STATS#0 LOG#0:0:0 GRID#0:0 LINE#0:0 FILL#0:0 MARKER#0:0:0 RANGE#-99:-99" ,"FORMAT#array TYPE#1F NAME#hStart_Raw_Times TITLE#hStart_Raw_Times ACTIVE#1 RESET#1 REFRESH#5000 BIN#600:-40000:20000:0:0:0 SIZE#4:8 AXIS#width:counts:no DIR#no OPT#no STATS#0 LOG#0:0:0 GRID#0:0 LINE#0:0 FILL#0:0 MARKER#0:0:0 RANGE#-99:-99" ,"FORMAT#mon TYPE#2F NAME#hStart_Raw_0_XY TITLE#Start_Raw_XY ACTIVE#1 RESET#1 REFRESH#1000 BIN#4:-2:2:4:-2:2 SIZE#0:0 AXIS#X:Y:counts DIR#no OPT#COLZ STATS#0 LOG#0:0:0 GRID#0:0 LINE#0:0 FILL#0:0 MARKER#0:0:0 RANGE#-99:-99" ,"FORMAT#mon TYPE#2F NAME#hStart_Raw_1_XY TITLE#Veto_Raw_XY ACTIVE#1 RESET#1 REFRESH#1000 BIN#3:-1.5:1.5:3:-1.5:1.5 SIZE#0:0 AXIS#X:Y:counts DIR#no OPT#COLZ STATS#0 LOG#0:0:0 GRID#0:0 LINE#0:0 FILL#0:0 MARKER#0:0:0 RANGE#-99:-99" }; //############################################################################### // create hists and add them to the pool mapHolder::createHists(sizeof(hists)/sizeof(Text_t*),hists,histpool); Int_t colorsLatch[6] = {2,4,6,8}; Int_t colorsScal[70] = {2,4,6,8,20,24,38,46, 2,4,6,8,20,24,38,46, 2,4,6,8,38,46, 2,4,6,8,38,46, 2,4,6,8, 2,4, 2,4,6,8, 2,4,6,8,20,24,38,46,50}; TString titleDebug[27] = {"UNKNOWN", "START", "RICH_1", "RICH_2", "RICH_3", "inner_MDC_1", "inner_MDC_2", "inner_MDC_3", "inner_MDC_4", "inner_MDC_5", "inner_MDC_6", "outer_MDC_1", "outer_MDC_2", "outer_MDC_3", "outer_MDC_4", "outer_MDC_5", "outer_MDC_6", "Shower_1","Shower_2","Shower_3","Shower_4","Shower_5","Shower_6", "RPC_1","RPC_2","TOF","WALL"}; TString titleScaler[70] = {"Start_1","Start_2","Start_3", "Start_4","Start_5","Start_6","Start_7","Start_8", "Veto_1","Veto_2","Veto_3", "Veto_4","Veto_5","Veto_6","Veto_7","Veto_8", "TOF_1","TOF_2","TOF_3", "TOF_4","TOF_5","TOF_6", "RPC_1","RPC_2","RPC_3", "RPC_4","RPC_5","RPC_6", "PT1","PT2","PT3","PT4", "DS_Start_OR","DS_Veto_OR", "DS_Mult_TOFRPC_1","DS_Mult_TOFRPC_2","DS_Mult_TOFRPC_3","DS_Mult_TOFRPC_4","DS_Mult_TOFRPC_5", "DS_Mult_TOFRPC_6","DS_Mult_TOFRPC_7","DS_Mult_TOFRPC_8","DS_Mult_TOFRPC_9", "DS_PT1","DS_PT2","DS_PT3","DS_PT4", "DS_Start_OR","DS_Veto_OR", "ACC_Mult_TOFRPC_1","ACC_Mult_TOFRPC_2","ACC_Mult_TOFRPC_3","ACC_Mult_TOFRPC_4","ACC_Mult_TOFRPC_5", "ACC_Mult_TOFRPC_6","ACC_Mult_TOFRPC_7","ACC_Mult_TOFRPC_8","ACC_Mult_TOFRPC_9", "ACC_PT1","ACC_PT2","ACC_PT3","ACC_PT4","","","","","","","",""}; HOnlineMonHistAddon* addon = 0; if((addon = get("hLatch_Trend"))) { for(Int_t s = 0; s < 4; s ++){ addon->getP(0,s)->SetLineColor(colorsLatch[s]); addon->getP(0,s)->SetFillColor(colorsLatch[s]); addon->getP(0,s+11)->SetLineColor(colorsLatch[s]); addon->getP(0,s+11)->SetFillColor(colorsLatch[s]); } } if((addon = get("hLatch_Mult"))) { addon->getP()->SetFillColor(colorsLatch[0]); } if((addon = get("hLatch_Norm"))) { addon->getP()->SetFillColor(colorsLatch[1]); } if((addon = get("hScalers_Trend"))) { for(Int_t s = 0; s < 70; s ++){ addon->getP(0,s)->SetLineColor(2); addon->getP(0,s)->SetFillColor(4); //addon->getP(0,s)->SetLineColor(colorsScal[s]); //addon->getP(0,s)->SetFillColor(colorsScal[s]); addon->getP(0,s)->SetTitle(titleScaler[s]); } } if(NULL != (addon = get("hStart_Raw_Mult_All"))){ for(Int_t m = 0; m < 4; m ++){ addon->getP(0,m)->SetLineWidth(2); addon->getP(0,m)->SetLineColor(colorsScal[m]); } } if((addon = get("hStart_Raw_Mult"))) { for(Int_t m = 0; m < 4; m ++){ for(Int_t s = 0; s < 8; s ++){ addon->getP(m,s)->SetLineColor(colorsScal[s+16]); addon->getP(m,s)->SetFillColor(colorsScal[s+16]); } } } if((addon = get("hStart_Raw_Width"))) { for(Int_t m = 0; m < 4; m ++){ for(Int_t s = 0; s < 8; s ++){ addon->getP(m,s)->SetLineColor(colorsScal[s+16]); addon->getP(m,s)->SetFillColor(colorsScal[s+16]); } } } if((addon = get("hStart_Raw_Times"))) { for(Int_t m = 0; m < 4; m ++){ for(Int_t s = 0; s < 8; s ++){ addon->getP(m,s)->SetLineColor(colorsScal[s+16]); addon->getP(m,s)->SetFillColor(colorsScal[s+16]); } } } if((addon = get("hTrbNetDebug"))) { for(Int_t s = 0; s < 27; s ++){ addon->getP(0,s)->SetLineColor(1); addon->getP(0,s)->SetFillColor(2); addon->getP(0,s)->SetTitle(titleDebug[s]); } } return kTRUE; } Bool_t fillHistStart(Int_t evtCt){ mapHolder::setMap(startMap); // make wallMap currentMap //####################### USER CODE ############################################## // Fill Histograms // categorys to loop HCategory* startRawCat = gHades->getCurrentEvent()->getCategory(catStart2Raw); HCategory* startCalCat = gHades->getCurrentEvent()->getCategory(catStart2Cal); HCategory* tboxChanCat = gHades->getCurrentEvent()->getCategory(catTBoxChan); HCategory* trbNetCat = gHades->getCurrentEvent()->getCategory(catTrbNet); Int_t nLatchWord = 0; Int_t bScal = 0; Int_t ch, cnt; Int_t latchCnt; Int_t strip, mod, mult, width,time; Int_t strip1, mod1, strip2, mod2 ; Int_t modMin, modMax, modCorr; Int_t vetoXHit = -1; Int_t vetoYHit = -1; Int_t diaHit[3] = {0,0,0}; Float_t time1_0, time2_0 ; // TRB Net Debug Info if(trbNetCat){ HTrbNetDebugInfo* debug; Int_t add; Int_t hadd; Int_t nDebugWord; for(Int_t i = 0; i < trbNetCat->getEntries(); i ++){ debug = (HTrbNetDebugInfo*)trbNetCat->getObject(i); add = debug->getAddress(); nDebugWord = debug->getStatusWord(); if (add==0x8800) hadd = 1; else if(add==0x8300) hadd = 2; else if(add==0x8310) hadd = 3; else if(add==0x8320) hadd = 4; else if(add==0x1000) hadd = 5; else if(add==0x1010) hadd = 6; else if(add==0x1020) hadd = 7; else if(add==0x1030) hadd = 8; else if(add==0x1040) hadd = 9; else if(add==0x1050) hadd = 10; else if(add==0x1100) hadd = 11; else if(add==0x1110) hadd = 12; else if(add==0x1120) hadd = 13; else if(add==0x1130) hadd = 14; else if(add==0x1140) hadd = 15; else if(add==0x1150) hadd = 16; else if(add==0x3200) hadd = 17; else if(add==0x3210) hadd = 18; else if(add==0x3220) hadd = 19; else if(add==0x3230) hadd = 20; else if(add==0x3240) hadd = 21; else if(add==0x3250) hadd = 22; else if(add==0x8400) hadd = 23; else if(add==0x8410) hadd = 24; else if(add==0x8600) hadd = 25; else if(add==0x8700) hadd = 26; else hadd = 0; if(get("hTrbNetDebug")){ for(Int_t b = 0; b < 32; b++){ if(( nDebugWord & (1<fill(0,hadd,b); } } } } } } // LATCH data latchCnt = 0; nLatchWord = gHades->getCurrentEvent()->getHeader()->getTBit(); for(Int_t i=0;i<32;i++){ if(( nLatchWord & (1<getP()->Fill(i); if(get("hLatch_Norm")) get("hLatch_Norm")->getP()->Fill(i); latchCnt ++ ; } } if(get("hLatch_Mult")) get("hLatch_Mult")->getP()->Fill(latchCnt); if(get("hLatch_TrendTemp")&&get("hLatch_Trend")){ if(evtCt%get("hLatch_Trend")->getRefreshRate() == 0 && evtCt > 0){ for(Int_t bit = 0; bit < 32; bit ++){ get("hLatch_Trend")->fill(0,bit,get("hLatch_TrendTemp")->getP()->GetBinContent(bit+1)/get("hLatch_Trend")->getRefreshRate()); } get("hLatch_TrendTemp")->getP()->Reset(); } } //scalers data if(tboxChanCat){ HTBoxChan* scaler; for(Int_t i = 0; i < tboxChanCat->getEntries(); i ++){ bScal ++; scaler = (HTBoxChan*)tboxChanCat->getObject(i); if(scaler){ scaler -> getScalerData(ch,cnt); if(get("hScalers_TrendTemp")) get("hScalers_TrendTemp")->getP()->Fill(ch,cnt); } } } if(get("hScalers_TrendTemp")&&get("hScalers_Trend")){ if(bScal > 0 && evtCt > 0){ for(Int_t bit = 0; bit < 135; bit ++){ get("hScalers_Trend")->fill(0,bit,get("hScalers_TrendTemp")->getP()->GetBinContent(bit+1)); } get("hScalers_TrendTemp")->getP()->Reset(); } } // Start data // RAW Int_t nrStrips[4] = {0,0,0,0}; if(startRawCat){ HStart2Raw* raw; for(Int_t i = 0; i < startRawCat->getEntries(); i ++){ raw = (HStart2Raw*)startRawCat->getObject(i); if(raw){ mod = raw->getModule(); strip = raw->getStrip(); mult = raw->getMultiplicity(); width = raw->getWidth(1); time = raw->getTime(1); // avoid reference time if(raw->getTime(1) != 0 ) nrStrips[mod]++; if(get("hStart_Raw_Mod_Strip")&&raw->getTime(1) != 0) ((TH2F*)get("hStart_Raw_Mod_Strip")->getP())->Fill(mod,strip,1); if(get("hStart_Raw_Mult")) get("hStart_Raw_Mult")->getP(mod,strip)->Fill(mult); if(get("hStart_Raw_Width")) get("hStart_Raw_Width")->getP(mod,strip)->Fill(width); if(get("hStart_Raw_Times")) get("hStart_Raw_Times")->getP(mod,strip)->Fill(time); if(get("hStart_Raw_0_XY")&&raw->getTime(1) != 0 &&mod==0) { if (strip==0) ((TH2F*)get("hStart_Raw_0_XY")->getP())->Fill(-0.5,0.5,1); if (strip==1) ((TH2F*)get("hStart_Raw_0_XY")->getP())->Fill(0.5,0.5,1); if (strip==2) ((TH2F*)get("hStart_Raw_0_XY")->getP())->Fill(0.5,-0.5,1); if (strip==3) ((TH2F*)get("hStart_Raw_0_XY")->getP())->Fill(-0.5,-0.5,1); if (strip==4) { ((TH2F*)get("hStart_Raw_0_XY")->getP())->Fill(-1.5,0.5,1); ((TH2F*)get("hStart_Raw_0_XY")->getP())->Fill(-1.5,-0.5,1); } if (strip==5) { ((TH2F*)get("hStart_Raw_0_XY")->getP())->Fill(-0.5,1.5,1); ((TH2F*)get("hStart_Raw_0_XY")->getP())->Fill(0.5,1.5,1); } if (strip==6) { ((TH2F*)get("hStart_Raw_0_XY")->getP())->Fill(1.5,0.5,1); ((TH2F*)get("hStart_Raw_0_XY")->getP())->Fill(1.5,-0.5,1); } if (strip==7) { ((TH2F*)get("hStart_Raw_0_XY")->getP())->Fill(-0.5,-1.5,1); ((TH2F*)get("hStart_Raw_0_XY")->getP())->Fill(0.5,-1.5,1); } } if(get("hStart_Raw_1_XY")&&raw->getTime(1) != 0 &&mod==3) { if (strip==0) ((TH2F*)get("hStart_Raw_1_XY")->getP())->Fill(1.,-1.,1); if (strip==1) ((TH2F*)get("hStart_Raw_1_XY")->getP())->Fill(1.,0.,1); if (strip==2) ((TH2F*)get("hStart_Raw_1_XY")->getP())->Fill(1.,1.,1); if (strip==3) ((TH2F*)get("hStart_Raw_1_XY")->getP())->Fill(0.,1.,1); if (strip==4) ((TH2F*)get("hStart_Raw_1_XY")->getP())->Fill(-1.,1.,1); if (strip==5) ((TH2F*)get("hStart_Raw_1_XY")->getP())->Fill(-1.,0.,1); if (strip==6) ((TH2F*)get("hStart_Raw_1_XY")->getP())->Fill(-1.,-1.,1); if (strip==7) ((TH2F*)get("hStart_Raw_1_XY")->getP())->Fill(0.,-1.,1); } } } } for(Int_t m = 0; m < 4; m++){ if(get("hStart_Raw_Mult_All")) get("hStart_Raw_Mult_All")->fill(0,m,nrStrips[m]); } // CAL if(startCalCat){ HStart2Cal* cal1; HStart2Cal* cal2; for(Int_t i = 0; i < startCalCat->getEntries(); i ++){ cal1 = (HStart2Cal*)startCalCat->getObject(i); if(cal1){ mod1 = cal1->getModule(); strip1 = cal1->getStrip(); time1_0 = cal1->getTime(1); // Veto detector if( mod1 == 3){ if( strip1 > 3 ){ if (vetoYHit==-1) vetoYHit = strip1 - 4; else vetoYHit = - 5; } else if( strip1 > -1 && strip1 < 3 ){ if (vetoXHit==-1) vetoXHit = strip1; else vetoXHit = - 5; } } // diamonds else if(mod1 > -1){ diaHit[mod1]++; } for(Int_t j = i + 1; j < startCalCat->getEntries(); j ++){ cal2 = (HStart2Cal*)startCalCat->getObject(j); if(cal2){ mod2 = cal2->getModule(); strip2 = cal2->getStrip(); time2_0 = cal2->getTime(1); if(get("hStart_Cal_TimeDiff")) get("hStart_Cal_TimeDiff")->getP(mod1*8+strip1,mod2*8+strip2)->Fill(time1_0-time2_0); if(get("hStart_Cal_Corr")){ if(mod1!=mod2){ modMin = TMath::Min(mod1,mod2); modMax = TMath::Max(mod1,mod2); modCorr = modMin+modMax; if(modCorr == 3 && modMin == 0 ) modCorr = 0; ((TH2F*)get("hStart_Cal_Corr")->getP(0,modCorr))->Fill(strip1,strip2); } } } } } } // efficiency if( vetoXHit != -1 && vetoYHit != -1){ if(get("hStart_Cal_Eff")){ get("hStart_Cal_Eff")->getP(0,0)->Fill(vetoXHit,vetoYHit); for(Int_t i = 0; i < 3; i++){ if(diaHit[i] > 0) ((TH2F*)get("hStart_Cal_Eff")->getP(0,i+1))->Fill(vetoXHit,vetoYHit); } } } } //############################################################################### // do reset if needed mapHolder::resetHists(evtCt); return kTRUE; }