75 ATH_MSG_DEBUG(
"Constructing list of expected chamber layers" );
80 const std::vector<Identifier> & ids =
m_idHelperSvc->cscIdHelper().idVector();
83 for(
const auto & thisChamberId:ids)
86 m_idHelperSvc->cscIdHelper().get_module_hash(thisChamberId,chamberHash);
90 std::vector<Identifier> stripVect;
91 m_idHelperSvc->cscIdHelper().idChannels(thisChamberId,stripVect);
92 for(
const auto & thisStrip:stripVect)
95 m_idHelperSvc->cscIdHelper().get_channel_hash(thisStrip,stripHash);
96 bool measuresPhi =
m_idHelperSvc->cscIdHelper().measuresPhi(thisStrip);
102 == (
unsigned int)
m_idHelperSvc->cscIdHelper().chamberLayer(thisStrip)
108 ATH_MSG_VERBOSE(
"hash " << (
int)stripHash <<
" is prec and expected" );
113 ATH_MSG_VERBOSE(
"hash " << (
int)stripHash <<
" is NOT expected (Not a bug, just populating list)." );
119 for(
unsigned int chanItr =0; chanItr <=
m_maxHashId; chanItr++)
127 return StatusCode::SUCCESS;
135 return ManagedMonitorToolBase::finalize();
140 const std::string & dataTypeName,
const std::string & dataTypeTitle,
const std::string & categoryName,
const std::string & categoryTitle,
141 const std::string & axisLabel,
int numBins,
float lowBound,
float highBound,
const std::string & parDir,
157 std::string endDir =
"";
159 endDir =
"/" + parDir;
162 std::string allChambersDirectory =
"/GeneralCscHists";
176 std::string nameStart = dataTypeName;
177 if(categoryName !=
"" )
178 nameStart +=
"_" + categoryName;
180 std::string titleStart = categoryTitle +
" " + dataTypeTitle;
181 std::string yaxis=
"", xaxis =
"";
183 ATH_MSG_DEBUG(
"In bookHistCollection for " << nameStart <<
" series." );
185 if(!((toSkip>>6) &0x1)){
187 for(
int measuresPhi =0; measuresPhi <=1; measuresPhi++) {
188 std::string name =
"h_" + nameStart+
"_" + (measuresPhi ?
"phi" :
"eta") +
"_spectrum" ;
189 std::string title = titleStart +
" " + (measuresPhi ?
"Phi Strips" :
"Eta Strips") +
" spectrum";
190 TH1F * specHist =
new TH1F(name.c_str(), title.c_str(), numBins, lowBound, highBound);
191 specHist->GetYaxis()->SetTitle(
"Counts");
192 specHist->GetXaxis()->SetTitle(axisLabel.c_str());
195 StatusCode
sc = monGroup.regHist(specHist);
213 std::string name =
"h_" + nameStart +
"_" +
m_hashName;
214 std::string title = categoryTitle +
" " + dataTypeTitle +
" " +
m_hashTitle;
216 xaxis =
"Channel Hash ID";
218 hashHist->GetXaxis()->SetTitle(xaxis.c_str());
219 hashHist->GetYaxis()->SetTitle(yaxis.c_str());
225 if (!monGroup.regHist(hashHist).isSuccess())
239 std::string title = categoryTitle +
" " + dataTypeTitle +
" " +
m_allChan1dTitle;
246 TH1F * allChan1dHistX =
new TH1F((name+
"X").c_str(), (title+
" - Precision strips").c_str(),
248 allChan1dHistX->GetXaxis()->SetTitle(xaxis.c_str());
249 allChan1dHistX->GetYaxis()->SetTitle(yaxis.c_str());
254 if (!monGroup.regHist(allChan1dHistX).isSuccess())
264 TH1F * allChan1dHistY =
new TH1F((name+
"Y").c_str(), (title +
" - Transverse strips").c_str(),
266 allChan1dHistY->GetXaxis()->SetTitle(xaxis.c_str());
267 allChan1dHistY->GetYaxis()->SetTitle(yaxis.c_str());
270 if (!monGroup.regHist(allChan1dHistY).isSuccess())
286 std::string title = categoryTitle +
" " + dataTypeTitle +
" " +
m_allChan2dTitle;
288 yaxis =
"Sector/Layer";
289 xaxis =
"Strip Number (Negative for Transverse Strips)";
314 TH2F * allChan2dHist =
new TH2F(name.c_str(), title.c_str(),
315 nxbins,nxmin,nxmax,nybins,nymin,nymax);
316 allChan2dHist->GetXaxis()->SetTitle(xaxis.c_str());
317 allChan2dHist->GetYaxis()->SetTitle(yaxis.c_str());
322 if (!monGroup.regHist(allChan2dHist).isSuccess())
336 yaxis =
"Average " + axisLabel;
337 xaxis =
"Sector * eta";
339 TProfile * chamProf=
new TProfile(name.c_str(), title.c_str(),
340 numSectors + 1, -16, 17);
341 chamProf->GetXaxis()->SetTitle(xaxis.c_str());
342 chamProf->GetYaxis()->SetTitle(yaxis.c_str());
347 if (!monGroup.regHist(chamProf).isSuccess())
362 ATH_MSG_DEBUG(
"Registering set with prefix" << namePrefix );
367 ATH_MSG_ERROR(
"failed to register " << namePrefix <<
" (layer histograms) " );
379 ATH_MSG_DEBUG(
"Registering set with prefix" << namePrefix );
382 false,
histCollection->ignoreY,numBins,lowBound,highBound).isSuccess())
385 <<
" (chamber summary histograms) " );
397 ATH_MSG_DEBUG(
"Registering set with prefix" << namePrefix );
403 <<
" (chamber summary histograms) " );
415 ATH_MSG_DEBUG(
"Registering set with prefix" << namePrefix );
418 namePrefix, titlePrefix, xaxis,yaxis,
419 false,
histCollection->ignoreY,numBins,lowBound,highBound).isSuccess())
421 ATH_MSG_ERROR(
" Failed to register " << namePrefix <<
" (Layer summary hists) " );
426 return StatusCode::SUCCESS;
428 return StatusCode::FAILURE;
433 std::vector<TH1F*> & histVector,
const std::string & namePrefix,
const std::string & titlePrefix,
434 const std::string & xaxis,
const std::string & yaxis,
435 bool chanView,
bool ignoreY,
unsigned int numBins,
436 float lowBound,
float highBound)
443 int stationSize, stationPhi, stationEta, sector;
444 std::string stationName;
445 std::string orientationName =
"prec";
446 std::string orientationTitle =
"Precision Direction";
448 int numHists = 32 * ( (ignoreY) ? 4 : 8);
449 histVector.resize(numHists,
nullptr);
451 ATH_MSG_DEBUG(
"Allocated space for " << numHists <<
" histograms" );
453 const std::vector<Identifier> & ids =
m_idHelperSvc->cscIdHelper().idVector();
454 for(
const auto & thisChamberId:ids)
457 m_idHelperSvc->cscIdHelper().get_module_hash(thisChamberId,chamHash);
458 ATH_MSG_DEBUG(
"Booking histograms for chamber with hash " << (
int)chamHash );
460 stationSize =
m_idHelperSvc->cscIdHelper().stationName(thisChamberId);
461 stationName =
m_idHelperSvc->cscIdHelper().stationNameString(stationSize);
462 stationPhi =
m_idHelperSvc->cscIdHelper().stationPhi(thisChamberId);
463 stationEta =
m_idHelperSvc->cscIdHelper().stationEta(thisChamberId);
464 sector =
getSector(stationPhi,stationSize);
465 for(
unsigned int orientationItr = 0; orientationItr < 2; orientationItr++)
467 if(orientationItr ==1)
477 orientationName =
"trans";
478 orientationTitle =
"Transverse Direction";
488 orientationName =
"prec";
489 orientationTitle =
"Precision Direction";
492 for(
unsigned int layItr = 1; layItr <= 4; layItr++)
495 <<
" With highbound/lowbound/nbins "
496 << highBound <<
"/" << lowBound <<
"/" << numBins );
498 std::stringstream nameStream;
499 nameStream.setf(std::ios::right, std::ios::adjustfield);
500 nameStream << namePrefix;
501 nameStream <<
"_" << orientationName <<
"_eta_";
502 nameStream << ((stationEta == 1) ?
"1" :
"0");
503 nameStream <<
"_sector_" << std::setw(2) << std::setfill(
'0') << sector;
504 nameStream <<
"_layer_" << layItr;
506 std::stringstream titleStream;
507 titleStream << titlePrefix <<
", " << orientationTitle;
508 titleStream <<
", Sector " << sector;
509 titleStream <<
", Eta " << stationEta;
510 titleStream <<
", Layer " << layItr;
513 << titleStream.str() <<
"On orientation " << orientationItr <<
" With highbound/lowbound/nbins " << highBound <<
"/" << lowBound <<
"/" << numBins );
515 TH1F* hist =
new TH1F(nameStream.str().c_str(), titleStream.str().c_str(),
516 numBins, lowBound, highBound);
517 hist->GetXaxis()->SetTitle(xaxis.c_str());
518 hist->GetYaxis()->SetTitle(yaxis.c_str());
521 int layIndex =
getLayIndex(orientationItr,stationEta,sector,layItr);
524 std::string geoPath =
getGeoPath(stationEta, sector, layItr, orientationItr);
525 std::string path =
getFullPath(geoPath, histTypeDir, parDir);
529 if(!monGroup.regHist(hist).isSuccess())
532 <<
" with layIndex" << layIndex );
533 return StatusCode::FAILURE;
537 ATH_MSG_DEBUG(
"Succesfully registered histogram with layIndex "
538 << layIndex <<
" and name " << hist->GetName() );
539 histVector[layIndex] = hist;
544 return StatusCode::SUCCESS;
549 const std::string & namePrefix,
const std::string & titlePrefix,
550 const std::string & xaxis,
const std::string & yaxis,
bool chanView,
551 bool ignoreY,
unsigned int numBins,
552 float lowBound,
float highBound)
556 static const int chanViewNBinsX = 800;
557 static const double chanViewLowBoundX = .5;
558 static const double chanViewHighBoundX = 800.5;
560 static const int chanViewNBinsY = 200;
561 static const double chanViewLowBoundY = .5;
562 static const double chanViewHighBoundY = 200.5;
567 int stationSize, stationPhi, stationEta, sector;
568 std::string stationName;
569 std::string orientationName =
"prec";
570 std::string orientationTitle =
"Precision Direction";
572 int numHists = (ignoreY) ? 32 : 64;
573 histVector.resize(numHists,
nullptr);
575 const std::vector<Identifier> & ids =
m_idHelperSvc->cscIdHelper().idVector();
577 for(
const auto & thisChamberId:ids)
580 m_idHelperSvc->cscIdHelper().get_module_hash(thisChamberId,chamHash);
581 ATH_MSG_DEBUG(
"Booking histograms for chamber with hash " << (
int)chamHash );
583 stationSize =
m_idHelperSvc->cscIdHelper().stationName(thisChamberId);
584 stationPhi =
m_idHelperSvc->cscIdHelper().stationPhi(thisChamberId);
585 stationEta =
m_idHelperSvc->cscIdHelper().stationEta(thisChamberId);
586 sector =
getSector(stationPhi,stationSize);
588 for(
unsigned int orientationItr = 0; orientationItr < 2; orientationItr++)
590 if(orientationItr ==1)
594 orientationName =
"trans";
595 orientationTitle =
"Transverse Direction";
597 numBins = chanViewNBinsY;
598 lowBound = chanViewLowBoundY;
599 highBound = chanViewHighBoundY;
604 orientationName =
"prec";
605 orientationTitle =
"Precision Direction";
607 numBins = chanViewNBinsX;
608 lowBound = chanViewLowBoundX;
609 highBound = chanViewHighBoundX;
613 std::stringstream nameStream;
614 nameStream.setf(std::ios::right, std::ios::adjustfield);
615 nameStream << namePrefix <<
"_" << orientationName <<
"_eta_"
616 << ((stationEta == 1) ?
"1" :
"0") <<
"_sector_"
617 << std::setw(2) << std::setfill(
'0')
620 std::stringstream titleStream;
622 titleStream << titlePrefix <<
", " << orientationTitle
623 <<
", Eta " << stationEta
624 <<
", Sector " << sector;
626 TH1F* hist =
new TH1F(nameStream.str().c_str(), titleStream.str().c_str()
627 ,numBins, lowBound, highBound);
628 hist->GetXaxis()->SetTitle(xaxis.c_str());
629 hist->GetYaxis()->SetTitle(yaxis.c_str());
632 int chamIndex =
getChamIndex(orientationItr,stationEta,sector);
635 << hist->GetName() <<
" and chamIndex " << chamIndex );
637 histVector[chamIndex] = hist;
642 if (!monGroup.regHist(hist).isSuccess())
649 return StatusCode::SUCCESS;
667 std::string statDbName =
"stat_cool";
668 std::string statDbTitle =
"Status Word Value From COOL";
669 std::string statDbAxisLabel =
"Stat Word Value";
670 unsigned int statDbNumBins = 8;
671 float statDbMin = -0.5;
672 float statDbMax = 7.5;
673 std::string statDbSubDir =
"StatCool";
676 statDbAxisLabel, statDbNumBins, statDbMin, statDbMax, statDbSubDir);
682 for(
unsigned int chanItr = 0; chanItr <=
m_maxHashId; chanItr++){
698 return StatusCode::SUCCESS;
704 ATH_MSG_DEBUG(
"CscCalibMonToolBase :: in fillHistograms()" );
706 return StatusCode::SUCCESS;
713 ATH_MSG_DEBUG(
"CscCalibMonToolBase : in procHistograms()" );
721 return StatusCode::RECOVERABLE;
724 ATH_MSG_DEBUG(
"There are " << calibContainer->
size() <<
" parameters to monitor" );
731 return StatusCode::SUCCESS;
742 return StatusCode::SUCCESS;
751 return StatusCode::SUCCESS;
758 ATH_MSG_DEBUG(
"CscCalibMonToolBase : in preProcParameter" );
759 return StatusCode::SUCCESS;
776 if (procParameterInput->
doChi2)
787 int numFailures = 0, maxFailures = 10;
790 const int hashId = chan->hashId();
791 const float val = chan->value();
792 const float error = chan->error();
796 missingChannels.erase(hashId);
799 if(procParameterInput->
dbName !=
"")
806 <<
" for channel " << hashId
807 <<
" from COOL database. Continuing with COOL value = 0"
809 if(numFailures==maxFailures)
812 << maxFailures <<
" failed retrievals. Quiting. " );
813 return StatusCode::FAILURE;
823 float diff = val - oldVal;
829 <<
" measurement of " << val <<
" varies by " <<
diff
830 <<
" from expected value of " << oldVal <<
" on channel with hash Id "
831 << hashId <<
". Specified maximum variance is " << procParameterInput->
maxDiff );
833 procParameterInput->
badHist->Fill(procParameterInput->
badBin);
837 if(procParameterInput->
doChi2)
839 chi2_ndf = chan->chi2()/chan->ndf();
857 (*procParameterInput->
vals)[hashId] = val;
858 if((procParameterInput->
errors->size()))
860 if(procParameterInput->
oldVals)
861 (*procParameterInput->
oldVals)[hashId] = oldVal;
862 if(procParameterInput->
diffs)
863 (*procParameterInput->
diffs)[hashId] =
diff;
864 if(procParameterInput->
doChi2)
869 if(missingChannels.size() !=0)
871 for(
const auto & thisChan: missingChannels)
877 if(!procParameterInput->
missingChans->GetBinContent(thisChan+1))
885 return StatusCode::SUCCESS;
907 ATH_MSG_DEBUG(
"Copying data to hist collection, doing: All Channels (hash view):"
909 <<
"All Channels (1d view) " << (
int)doHash
910 <<
"All Channels (2d view) " << (
int)doHash
911 <<
" layer overview " << (
int)doLayChan
912 <<
" layer spectrum " << (
int)doLaySummary
913 <<
" sector prof " << (
int)doChamAvg
914 <<
" chamber overview " << (
int)doChamChan
915 <<
" chamber spectrum " << (
int)doChamSummary
923 const std::vector<Identifier> & ids =
m_idHelperSvc->cscIdHelper().idVector();
924 for(
const auto & thisChamberId:ids)
927 m_idHelperSvc->cscIdHelper().get_module_hash(thisChamberId,chamHash);
928 ATH_MSG_DEBUG(
"Copying data to histograms for chamber with hash" << (
int)chamHash );
930 unsigned int stationSize =
m_idHelperSvc->cscIdHelper().stationName(thisChamberId);
932 unsigned int stationPhi =
m_idHelperSvc->cscIdHelper().stationPhi(thisChamberId);
933 int stationEta =
m_idHelperSvc->cscIdHelper().stationEta(thisChamberId);
934 unsigned int sector =
getSector(stationPhi,stationSize);
935 int sectorIndex = sector * stationEta;
939 std::vector<Identifier> stripVect;
940 m_idHelperSvc->cscIdHelper().idChannels(thisChamberId,stripVect);
942 for(
const auto & thisStrip:stripVect)
944 unsigned int chamberLayer =
m_idHelperSvc->cscIdHelper().chamberLayer(thisStrip);
945 if(chamberLayer != 2)
947 int measuresPhi =
m_idHelperSvc->cscIdHelper().measuresPhi(thisStrip);
952 m_idHelperSvc->cscIdHelper().get_channel_hash(thisStrip,stripHash);
953 unsigned int layer =
m_idHelperSvc->cscIdHelper().wireLayer(thisStrip);
955 float secLayer = (((float)stationEta*sector) + 0.2 * ((float)layer - 1) + 0.1);
956 float datum =
data.at(stripHash);
959 <<
"\tlayer: " << layer <<
"\tstationEta: " << stationEta
960 <<
"\tsecLayer: " << secLayer
961 <<
"\tdata: " << datum );
975 <<
"\tlayer: " << layer <<
"\tstationEta: " << stationEta
976 <<
"\tsecLayer: " << secLayer
977 <<
"\tdata: " << datum );
980 double modifiedStripNum =
983 + ((
strip-1) * .25 /(48))
989 modifiedStripNum, datum);
991 double modifiedStripNum =
994 + ((
strip-1) * .25 /(192 ))
999 modifiedStripNum, datum);
1006 <<
"\tlayer: " << layer <<
"\tstationEta: " << stationEta
1007 <<
"\tsecLayer: " << secLayer
1008 <<
"\tdata: " << datum );
1011 int modifiedStripNum =
static_cast<int>(
strip) * (measuresPhi ? -1 : 1);
1013 modifiedStripNum, secLayer, std::abs(datum));
1016 int layIndex =
getLayIndex(measuresPhi,stationEta,sector,layer);
1017 int chamIndex =
getChamIndex(measuresPhi,stationEta,sector);
1043 int shiftedStrip =
strip + (layer-1)*( measuresPhi ? 50 : 200);
1045 (*(
histCollection->chamHistVect))[chamIndex]->SetBinContent(shiftedStrip,datum);
1047 (*(
histCollection->chamHistVect))[chamIndex]->SetBinError(shiftedStrip,errors.at(stripHash));
1054 return StatusCode::SUCCESS;
1059 int layIndex = measuresPhi*32*4
1060 + ((stationEta ==1) ? 16*4 : 0)
1068 int chamIndex = measuresPhi*32
1069 + ((stationEta ==1) ? 16 : 0)
1081 return(2*stationPhi + 50 - stationSize);
1101 std::stringstream
ss;
1103 static const std::string histStr =
"/_hists";
1104 static const std::string errorDir =
"/ERROR";
1106 ss << std::setfill(
'0');
1111 ss <<
"/CscOverview";
1116 if(endCap ==
"ERROR")
1122 ss <<
"/EndCap" << endCap;
1130 if(sector <1 || sector > 16)
1136 ss <<
"/Sector" << std::setw(2) << sector;
1138 if(wireLayer == -9999)
1144 if(wireLayer < 1 || wireLayer > 4)
1146 ATH_MSG_ERROR(
"WireLayer " << wireLayer <<
" is invalid." );
1150 ss <<
"/Layer" << wireLayer;
1152 if(measuresPhi == -9999)
1158 if(measuresPhi < 0 || measuresPhi > 1)
1160 ATH_MSG_ERROR(
"MeasuresPhi " << measuresPhi <<
" is invalid." );
1164 ss << (measuresPhi ?
"/Phi" :
"/Eta");
1165 if(channel == -9999)
1172 if( channel < 1 || (measuresPhi && channel > 48) || (!measuresPhi && channel > 192))
1174 ATH_MSG_ERROR(
"Channel " << channel <<
" is invalid for a " << (measuresPhi ?
"phi layers" :
"eta layer") );
1179 ss <<
"/Channel" << std::setw( measuresPhi ? 2 : 3 ) << channel;
1188 std::stringstream
ss;
1192 if(histTypeDir !=
"")
1193 ss <<
"/" << histTypeDir;
1195 if(parTypeDir !=
"")
1196 ss <<
"/" << parTypeDir;
Scalar eta() const
pseudorapidity method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
static dqm_algorithms::Chi2Test chi2_ndf("Chi2_per_NDF")
char data[hepevt_bytes_allocation_ATLAS]
void diff(const Jet &rJet1, const Jet &rJet2, std::map< std::string, double > varDiff)
Difference between jets - Non-Class function required by trigger.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< StoreGateSvc > & evtStore()
const std::string & parName() const
the identify of this collection
StatusCode readChannelParam(IdentifierHash hash, T &val, const std::string &parName) const
StatusCode readChannelStatus(IdentifierHash, int &) const
size_type size() const noexcept
Returns the number of elements in the collection.
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
This is a "hash" representation of an Identifier.