#include "honlinemonhist.h" #include "honlinehistarray.h" #include "honlinetrendhist.h" #include "hcategory.h" #include "richdef.h" #include "hrichcal.h" #include "hrichhit.h" #include "hrichdirclus.h" #include "hrich700raw.h" #include "hrich700digipar.h" #include "helpers.h" #include "TList.h" #include "TString.h" #include #include using namespace std; map < TString , HOnlineMonHistAddon* > richMap; struct richP{ HOnlineMonHistAddon* hRichCalsTrend = 0; HOnlineMonHistAddon* hRichCalsTrendTemp = 0; HOnlineMonHistAddon* hRichLaserTrend = 0; HOnlineMonHistAddon* hRichLaserTrendTemp = 0; HOnlineMonHistAddon* hRichRingsTrend = 0; HOnlineMonHistAddon* hRichRingsTrendTemp = 0; HOnlineMonHistAddon* hRichCalsColRow = 0; HOnlineMonHistAddon* hRichCalsXY = 0; HOnlineMonHistAddon* hRichCalsPmtId = 0; HOnlineMonHistAddon* hRichCalsPmtXPmtY = 0; HOnlineMonHistAddon* hRichCalsSectors = 0; HOnlineMonHistAddon* hRichCalsTheta = 0; HOnlineMonHistAddon* hRichCalsPhi = 0; HOnlineMonHistAddon* hRichRawPmtPixel = 0; HOnlineMonHistAddon* hRichRawMult = 0; HOnlineMonHistAddon* hRichRawToT = 0; HOnlineMonHistAddon* hRichRawLeadingEdge = 0; HOnlineMonHistAddon* hRichRawUIDVsLeadingEdge = 0; HOnlineMonHistAddon* hRichRawUIDVsToT = 0; HOnlineMonHistAddon* hRichCalsColRowEvent = 0; HOnlineMonHistAddon* hRichNofCalsPerEvent = 0; HOnlineMonHistAddon* hRichNofRingsPerEvent = 0; HOnlineMonHistAddon* hRichNofRawMultPerEvent = 0; HOnlineMonHistAddon* hRichNofRawPerEvent = 0; HOnlineMonHistAddon* hRichNofEdgeTypes = 0; HOnlineMonHistAddon* hRichNofEdges = 0; HOnlineMonHistAddon* hRichRawUIDVsNofIncompleteHit = 0; }; richP* pR; Bool_t createHistRich(TList& histpool){ mapHolder::setMap(richMap); // make richMap currentMap //####################### USER CODE ############################################## // define monitoring hists const Char_t* hists[] = { "FORMAT#trendarray TYPE#1F NAME#hRichCalsTrend TITLE#hRichCalsTrend ACTIVE#1 RESET#0 REFRESH#500 BIN#50:0:50:0:0:0 SIZE#1:7 AXIS#Trend:Multiplicity: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#hRichCalsTrendTemp TITLE#hRichCalsTrendTemp ACTIVE#1 RESET#0 REFRESH#50000 BIN#7:0:7:0:0:0 SIZE#0:0 AXIS#Trend:Multiplicity:no DIR#no OPT#p STATS#0 LOG#0:0:0 GRID#0:1 LINE#0:0 FILL#0:0 MARKER#1:20:0.5 RANGE#-99:-99" ,"FORMAT#trendarray TYPE#1F NAME#hRichLaserTrend TITLE#hRichLaserTrend ACTIVE#1 RESET#0 REFRESH#10000 BIN#50:0:50:0:0:0 SIZE#1:7 AXIS#Trend:Multiplicity: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#hRichLaserTrendTemp TITLE#hRichLaserTrendTemp ACTIVE#1 RESET#0 REFRESH#1000000 BIN#8:0:8:0:0:0 SIZE#0:0 AXIS#Trend:Multiplicity:no DIR#no OPT#p STATS#0 LOG#0:0:0 GRID#0:1 LINE#0:0 FILL#0:0 MARKER#1:20:0.5 RANGE#-99:-99" ,"FORMAT#trendarray TYPE#1F NAME#hRichRingsTrend TITLE#hRichRingsTrend ACTIVE#1 RESET#0 REFRESH#500 BIN#50:0:50:0:0:0 SIZE#1:7 AXIS#Trend:Multiplicity: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#hRichRingsTrendTemp TITLE#hRichRingsTrendTemp ACTIVE#1 RESET#0 REFRESH#50000 BIN#7:0:7:0:0:0 SIZE#0:0 AXIS#Trend:Multiplicity:no DIR#no OPT#p 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#2D NAME#hRichCalsColRow TITLE#hRichCalsColRow ACTIVE#1 RESET#1 REFRESH#50000 BIN#194:-0.5:193.5:194:-0.5:193.5 SIZE#0:0 AXIS#Col_index:Row_index:Entries DIR#no OPT#colz STATS#0 LOG#0:0:0 GRID#1:1" ,"FORMAT#mon TYPE#2D NAME#hRichCalsXY TITLE#hRichCalsXY ACTIVE#1 RESET#1 REFRESH#50000 BIN#192:-636:636:192:-636:636 SIZE#0:0 AXIS#X_[mm]:Y_[mm]:Entries DIR#no OPT#colz STATS#0 LOG#0:0:0 GRID#1:1" ,"FORMAT#mon TYPE#1D NAME#hRichCalsPmtId TITLE#hRichCalsPmtId ACTIVE#1 RESET#1 REFRESH#5000 BIN#600:-0.5:599.5:0:0:0 SIZE#0:0 AXIS#PMT_ID:Entries:no DIR#no OPT#no STATS#0 LOG#0:0:0 GRID#1:1" ,"FORMAT#mon TYPE#2D NAME#hRichCalsPmtXPmtY TITLE#hRichCalsPmtXPmtY ACTIVE#1 RESET#1 REFRESH#50000 BIN#25:-0.5:24.5:25:-0.5:24.5 SIZE#0:0 AXIS#PMT_X:PMT_Y:Entries DIR#no OPT#colz STATS#0 LOG#0:0:0 GRID#1:1" ,"FORMAT#mon TYPE#1D NAME#hRichCalsSectors TITLE#hRichCalsSectors ACTIVE#1 RESET#1 REFRESH#5000 BIN#6:-0.5:5.5:0:0:0 SIZE#0:0 AXIS#Sector:Entries:no DIR#no OPT#no STATS#0 LOG#0:0:0 GRID#1:1" ,"FORMAT#mon TYPE#1D NAME#hRichCalsTheta TITLE#hRichCalsTheta ACTIVE#1 RESET#1 REFRESH#5000 BIN#50:0:100:0:0:0 SIZE#0:0 AXIS#Theta_[deg]:Entries:no DIR#no OPT#no STATS#0 LOG#0:0:0 GRID#1:1" ,"FORMAT#mon TYPE#1D NAME#hRichCalsPhi TITLE#hRichCalsPhi ACTIVE#1 RESET#1 REFRESH#5000 BIN#90:0:360:0:0:0 SIZE#0:0 AXIS#Phi_[deg]:Entries:no DIR#no OPT#no STATS#0 LOG#0:0:0 GRID#1:1" ,"FORMAT#mon TYPE#2D NAME#hRichRawPmtPixel TITLE#hRichRawPmtPixel ACTIVE#1 RESET#1 REFRESH#50000 BIN#600:-0.5:599.5:65:-0.5:64.5 SIZE#0:0 AXIS#PMT_ID:Pixel_ID:Entries DIR#no OPT#col STATS#0 LOG#0:0:0 GRID#1:1" ,"FORMAT#mon TYPE#1D NAME#hRichRawMult TITLE#hRichRawMult ACTIVE#1 RESET#1 REFRESH#5000 BIN#10:-0.5:9.5:0:0:0 SIZE#0:0 AXIS#Raw_hit_multiplicity:Entries:no DIR#no OPT#no STATS#0 LOG#0:0:0 GRID#1:1" ,"FORMAT#mon TYPE#1D NAME#hRichRawToT TITLE#hRichRawToT ACTIVE#1 RESET#1 REFRESH#5000 BIN#100:0:20:0:0:0 SIZE#0:0 AXIS#ToT_[ns]:Entries:no DIR#no OPT#no STATS#0 LOG#0:0:0 GRID#1:1" ,"FORMAT#mon TYPE#1D NAME#hRichRawLeadingEdge TITLE#hRichRawLeadingEdge ACTIVE#1 RESET#1 REFRESH#5000 BIN#100:-1500.:400:0:0:0 SIZE#0:0 AXIS#Leading_edge_[ns]:Entries:no DIR#no OPT#no STATS#0 LOG#0:0:0 GRID#1:1" ,"FORMAT#mon TYPE#2D NAME#hRichRawUIDVsLeadingEdge TITLE#hRichRawUIDVsLeadingEdge ACTIVE#1 RESET#1 REFRESH#50000 BIN#600:-0.5:599.5:100:-1200:400. SIZE#0:0 AXIS#PMT_ID:Leading_edge_[ns]:Entries DIR#no OPT#col STATS#0 LOG#0:0:0 GRID#1:1" ,"FORMAT#mon TYPE#2D NAME#hRichRawUIDVsToT TITLE#hRichRawUIDVsToT ACTIVE#1 RESET#1 REFRESH#50000 BIN#600:-0.5:599.5:100:0.:20. SIZE#0:0 AXIS#PMT_ID:ToT_[ns]:Entries DIR#no OPT#col STATS#0 LOG#0:0:0 GRID#1:1" ,"FORMAT#array TYPE#2D NAME#hRichCalsColRowEvent TITLE#hRichCalsColRowEvent ACTIVE#1 RESET#1 REFRESH#50000 BIN#194:-0.5:193.5:194:-0.5:193.5 SIZE#1:4 AXIS#Col_index:Row_index:Entries DIR#no OPT#colz STATS#0 LOG#0:0:0 GRID#1:1" ,"FORMAT#mon TYPE#1D NAME#hRichNofCalsPerEvent TITLE#hRichNofCalsPerEvent ACTIVE#1 RESET#1 REFRESH#5000 BIN#50:-0.5:999.5:0:0:0 SIZE#0:0 AXIS#Nof_Cals_per_event:Entries:no DIR#no OPT#no STATS#0 LOG#0:0:0 GRID#1:1" ,"FORMAT#mon TYPE#1D NAME#hRichNofRingsPerEvent TITLE#hRichNofRingsPerEvent ACTIVE#1 RESET#1 REFRESH#5000 BIN#40:-0.5:39.5:0:0:0 SIZE#0:0 AXIS#Nof_Rings_per_event:Entries:no DIR#no OPT#no STATS#0 LOG#0:0:0 GRID#1:1" ,"FORMAT#mon TYPE#1D NAME#hRichNofRawMultPerEvent TITLE#hRichNofRawMultPerEvent ACTIVE#1 RESET#1 REFRESH#5000 BIN#50:-0.5:999.5:0:0:0 SIZE#0:0 AXIS#Nof_Raws_(with_Mult)_per_event:Entries:no DIR#no OPT#no STATS#0 LOG#0:0:0 GRID#1:1" ,"FORMAT#mon TYPE#1D NAME#hRichNofRawPerEvent TITLE#hRichNofRawPerEvent ACTIVE#1 RESET#1 REFRESH#5000 BIN#50:-0.5:999.5:0:0:0 SIZE#0:0 AXIS#Nof_Raws_per_event:Entries:no DIR#no OPT#no STATS#0 LOG#0:0:0 GRID#1:1" ,"FORMAT#mon TYPE#1D NAME#hRichNofEdgeTypes TITLE#hRichNofEdgeTypes ACTIVE#1 RESET#1 REFRESH#5000 BIN#3:0.5:3.5:0:0:0 SIZE#0:0 AXIS#EdgeType_(LE_TE_both):Entries:no DIR#no OPT#no STATS#0 LOG#0:1:0 GRID#1:1" ,"FORMAT#mon TYPE#1D NAME#hRichNofEdges TITLE#hRichNofEdges ACTIVE#1 RESET#1 REFRESH#5000 BIN#16:-0.5:15.5:0:0:0 SIZE#0:0 AXIS#Nof_Edges_per_event:Entries:no DIR#no OPT#no STATS#0 LOG#0:1:0 GRID#1:1" ,"FORMAT#mon TYPE#1D NAME#hRichRawUIDVsNofIncompleteHit TITLE#hRichRawUIDVsNofIncompleteHit ACTIVE#1 RESET#1 REFRESH#5000 BIN#600:-0.5:599.5:0:0:0 SIZE#0:0 AXIS#PMT_ID:Entries DIR#no OPT#col STATS#0 LOG#0:0:0 GRID#1:1" }; //############################################################################### // create hists and add them to the pool mapHolder::createHists(sizeof(hists)/sizeof(Char_t*),hists,histpool); pR = new richP(); pR->hRichCalsTrend = get("hRichCalsTrend"); pR->hRichCalsTrendTemp = get("hRichCalsTrendTemp"); pR->hRichLaserTrend = get("hRichLaserTrend"); pR->hRichLaserTrendTemp = get("hRichLaserTrendTemp"); pR->hRichRingsTrend = get("hRichRingsTrend"); pR->hRichRingsTrendTemp = get("hRichRingsTrendTemp"); pR->hRichCalsColRow = get("hRichCalsColRow"); pR->hRichCalsXY = get("hRichCalsXY"); pR->hRichCalsPmtId = get("hRichCalsPmtId"); pR->hRichCalsPmtXPmtY = get("hRichCalsPmtXPmtY"); pR->hRichCalsSectors = get("hRichCalsSectors"); pR->hRichCalsTheta = get("hRichCalsTheta"); pR->hRichCalsPhi = get("hRichCalsPhi"); pR->hRichRawPmtPixel = get("hRichRawPmtPixel"); pR->hRichRawMult = get("hRichRawMult"); pR->hRichRawToT = get("hRichRawToT"); pR->hRichRawLeadingEdge = get("hRichRawLeadingEdge"); pR->hRichRawUIDVsLeadingEdge = get("hRichRawUIDVsLeadingEdge"); pR->hRichRawUIDVsToT = get("hRichRawUIDVsToT"); pR->hRichCalsColRowEvent = get("hRichCalsColRowEvent"); pR->hRichNofCalsPerEvent = get("hRichNofCalsPerEvent"); pR->hRichNofRingsPerEvent = get("hRichNofRingsPerEvent"); pR->hRichNofRawMultPerEvent = get("hRichNofRawMultPerEvent"); pR->hRichNofRawPerEvent = get("hRichNofRawPerEvent"); pR->hRichNofEdgeTypes = get("hRichNofEdgeTypes"); pR->hRichNofEdges = get("hRichNofEdges"); pR->hRichRawUIDVsNofIncompleteHit = get("hRichRawUIDVsNofIncompleteHit"); // [0-5] are for sectors, [6]-is total number for all sectors Int_t colorsSector[7] = {2,4,6,8,38,46, 2}; HOnlineMonHistAddon* addon = 0; if((addon = pR->hRichCalsTrend)) { for(Int_t s = 0; s < 7; s ++){ addon->getP(0,s)->SetLineColor(colorsSector[s]); addon->getP(0,s)->SetFillColor(colorsSector[s]); } } if((addon = pR->hRichRingsTrend)) { for(Int_t s = 0; s < 7; s ++){ addon->getP(0,s)->SetLineColor(colorsSector[s]); addon->getP(0,s)->SetFillColor(colorsSector[s]); } } if((addon = pR->hRichLaserTrend)) { for(Int_t s = 0; s < 7; s ++){ addon->getP(0,s)->SetLineColor(colorsSector[s]); addon->getP(0,s)->SetFillColor(colorsSector[s]); } } return kTRUE; } Bool_t fillHistRich(Int_t evtCt){ mapHolder::setMap(richMap); // make richMap currentMap HRich700DigiPar* fDigiPar = (HRich700DigiPar*) gHades->getRuntimeDb()->getContainer("Rich700DigiPar"); if(fDigiPar == NULL) { cout << "Error: Can not retrieve HRich700DigiPar" << endl; } //####################### USER CODE ############################################## HCategory* richCalCat = gHades->getCurrentEvent()->getCategory(catRichCal); HCategory* richHitCat = gHades->getCurrentEvent()->getCategory(catRichHit); HCategory* rich700RawCat = gHades->getCurrentEvent()->getCategory(catRich700Raw); HEventHeader* fCatHeader = gHades->getCurrentEvent()->getHeader(); //RICH raw if(rich700RawCat){ Int_t nofRaws = rich700RawCat->getEntries(); Int_t nofRawsMult = 0; if (pR->hRichNofRawPerEvent) pR->hRichNofRawPerEvent->getP()->Fill(nofRaws); for(Int_t i = 0; i < nofRaws; i++){ HRich700Raw* raw = (HRich700Raw*)rich700RawCat->getObject(i); if (raw == NULL) continue; Int_t pmt = raw->getPMT(); Int_t pixel = raw->getPixel(); Int_t mult = raw->getMultiplicity(); Int_t uid = pmt;// * 64 + pixel; nofRawsMult += mult; if (pR->hRichRawPmtPixel) pR->hRichRawPmtPixel->getP()->Fill(pmt, pixel); if (pR->hRichRawMult) pR->hRichRawMult->getP()->Fill(mult); Int_t edges = 0; for (Int_t iH = 0; iH < mult; iH++) { const HRich700hit_t* hit = raw->getHit(iH); if (hit == NULL) continue; if (pR->hRichNofEdgeTypes) pR->hRichNofEdgeTypes->getP()->Fill(hit->fFlag); if (hit->fFlag == 0b11) edges+=2; else { edges+=1; if (pR->hRichRawUIDVsNofIncompleteHit) pR->hRichRawUIDVsNofIncompleteHit->getP()->Fill(uid); continue; } if (pR->hRichRawToT) pR->hRichRawToT->getP()->Fill(hit->fToT); if (pR->hRichRawLeadingEdge) pR->hRichRawLeadingEdge->getP()->Fill(hit->fLeadingEdgeTime); if (pR->hRichRawUIDVsToT) pR->hRichRawUIDVsToT->getP()->Fill(uid, hit->fToT); if (pR->hRichRawUIDVsLeadingEdge) pR->hRichRawUIDVsLeadingEdge->getP()->Fill(uid, hit->fLeadingEdgeTime); // if (pR->hRichNofEdgeTypes) pR->hRichNofEdgeTypes->getP()->Fill(uid, hit->fFlag); } if (pR->hRichNofEdges) pR->hRichNofEdges->getP()->Fill(edges); } if (pR->hRichNofRawMultPerEvent) pR->hRichNofRawMultPerEvent->getP()->Fill(nofRawsMult); } // RICH cal if(richCalCat){ Bool_t isGoodSingleEvent = evtCt > 0 && pR->hRichCalsColRowEvent; if (isGoodSingleEvent) { Int_t mod = evtCt % 4; pR->hRichCalsColRowEvent->getP(0, mod)->Reset(); } Int_t nofCals = richCalCat->getEntries(); if (pR->hRichNofCalsPerEvent) pR->hRichNofCalsPerEvent->getP()->Fill(nofCals); if (pR->hRichLaserTrendTemp && ((fCatHeader->getTBit()>>17) & 0b1)==0b1) { pR->hRichLaserTrendTemp->getP()->Fill(7); // total counter for all sectors } for(Int_t i = 0; i < nofCals; i++){ HRichCal* cal = (HRichCal*)richCalCat->getObject(i); if(cal == NULL) continue; Int_t s = cal->getSector(); Int_t col = cal->getCol(); Int_t row = cal->getRow(); if (pR->hRichCalsTrendTemp) { pR->hRichCalsTrendTemp->getP()->Fill(s); pR->hRichCalsTrendTemp->getP()->Fill(6); // total counter for all sectors } if (pR->hRichLaserTrendTemp && ((fCatHeader->getTBit()>>17) & 0b1)==0b1) { pR->hRichLaserTrendTemp->getP()->Fill(s); pR->hRichLaserTrendTemp->getP()->Fill(6); // total counter for all sectors } if (isGoodSingleEvent) { Int_t mod = evtCt % 4; pR->hRichCalsColRowEvent->getP(0, mod)->Fill(col,row); } if (pR->hRichCalsColRow) pR->hRichCalsColRow->getP()->Fill(col,row); if (pR->hRichCalsSectors) pR->hRichCalsSectors->getP()->Fill(s); if (pR->hRichCalsXY && fDigiPar != NULL){ Int_t loc[3] = {s, col, row}; pair xy = fDigiPar->getXY(loc); pR->hRichCalsXY->getP()->Fill(xy.first, xy.second); } if (pR->hRichCalsPmtId && fDigiPar != NULL) { Int_t pmtId = fDigiPar->getPMTId(col, row); pR->hRichCalsPmtId->getP()->Fill(pmtId); } if (pR->hRichCalsPmtXPmtY && fDigiPar != NULL){ Int_t pmtId = fDigiPar->getPMTId(col, row); HRich700PmtData* pmtData = fDigiPar->getPMTData(pmtId); if (pmtData != NULL) { pR->hRichCalsPmtXPmtY->getP()->Fill(pmtData->fIndX, pmtData->fIndY); } } if (pR->hRichCalsPhi && pR->hRichCalsTheta && fDigiPar){ Float_t phiDeg, thetaDeg; fDigiPar->getSectorPhiThetaDegPixels(col, row, phiDeg, thetaDeg); pR->hRichCalsPhi->getP()->Fill(phiDeg); pR->hRichCalsTheta->getP()->Fill(thetaDeg); } } } if(pR->hRichCalsTrend&&pR->hRichCalsTrendTemp){ if(evtCt%pR->hRichCalsTrend->getRefreshRate() == 0 && evtCt > 0){ // [6] is for all sectors for(Int_t sec = 0; sec < 7; sec ++){ Double_t mult = pR->hRichCalsTrendTemp->getP()->GetBinContent(sec+1)/pR->hRichCalsTrend->getRefreshRate(); pR->hRichCalsTrend->fill(0, sec, mult); } pR->hRichCalsTrendTemp->getP()->Reset(); } } if(pR->hRichLaserTrend&&pR->hRichLaserTrendTemp){ if(evtCt%pR->hRichLaserTrend->getRefreshRate() == 0 && evtCt > 0){ // [6] is for all sectors for(Int_t sec = 0; sec < 7; sec ++){ Double_t mult = 0; if(pR->hRichLaserTrendTemp->getP()->GetBinContent(8)) mult = pR->hRichLaserTrendTemp->getP()->GetBinContent(sec+1)/pR->hRichLaserTrendTemp->getP()->GetBinContent(8); pR->hRichLaserTrend->fill(0, sec, mult); } pR->hRichLaserTrendTemp->getP()->Reset(); } } //RICH hit if(richHitCat){ Int_t nofRings = richHitCat->getEntries(); if (pR->hRichNofRingsPerEvent) pR->hRichNofRingsPerEvent->getP()->Fill(nofRings); for(Int_t i = 0; i < nofRings; i ++){ HRichHit* hit = (HRichHit*)richHitCat->getObject(i); if (hit == NULL) continue; Int_t s = hit->getSector(); if(pR->hRichRingsTrendTemp){ pR->hRichRingsTrendTemp->getP()->Fill(s); pR->hRichRingsTrendTemp->getP()->Fill(6); // total counter for all sectors } } } if(pR->hRichRingsTrend&&pR->hRichRingsTrendTemp){ if(evtCt%pR->hRichRingsTrend->getRefreshRate() == 0 && evtCt > 0){ //[6] is for all sectors for(Int_t sec = 0; sec < 7; sec ++){ Double_t mult = pR->hRichRingsTrendTemp->getP()->GetBinContent(sec+1)/pR->hRichRingsTrend->getRefreshRate(); pR->hRichRingsTrend->fill(0, sec, mult); } pR->hRichRingsTrendTemp->getP()->Reset(); } } //############################################################################### // do reset if needed mapHolder::resetHists(evtCt); return kTRUE; }