75 ATH_MSG_DEBUG(
"Constructing list of expected chamber layers" );
79 const std::vector<Identifier> & ids =
m_idHelperSvc->cscIdHelper().idVector();
82 for(
const auto & thisChamberId:ids)
85 m_idHelperSvc->cscIdHelper().get_module_hash(thisChamberId,chamberHash);
89 std::vector<Identifier> stripVect;
90 m_idHelperSvc->cscIdHelper().idChannels(thisChamberId,stripVect);
91 for(
const auto & thisStrip:stripVect)
94 m_idHelperSvc->cscIdHelper().get_channel_hash(thisStrip,stripHash);
95 bool measuresPhi =
m_idHelperSvc->cscIdHelper().measuresPhi(thisStrip);
101 == (
unsigned int)
m_idHelperSvc->cscIdHelper().chamberLayer(thisStrip)
107 ATH_MSG_VERBOSE(
"hash " << (
int)stripHash <<
" is prec and expected" );
112 ATH_MSG_VERBOSE(
"hash " << (
int)stripHash <<
" is NOT expected (Not a bug, just populating list)." );
118 for(
unsigned int chanItr =0; chanItr <=
m_maxHashId; chanItr++)
126 return StatusCode::SUCCESS;
134 return ManagedMonitorToolBase::finalize();
139 const std::string & dataTypeName,
const std::string & dataTypeTitle,
const std::string & categoryName,
const std::string & categoryTitle,
140 const std::string & axisLabel,
int numBins,
float lowBound,
float highBound,
const std::string & parDir,
156 std::string endDir =
"";
158 endDir =
"/" + parDir;
161 std::string allChambersDirectory =
"/GeneralCscHists";
175 std::string nameStart = dataTypeName;
176 if(categoryName !=
"" )
177 nameStart +=
"_" + categoryName;
179 std::string titleStart = categoryTitle +
" " + dataTypeTitle;
180 std::string yaxis=
"", xaxis =
"";
182 ATH_MSG_DEBUG(
"In bookHistCollection for " << nameStart <<
" series." );
184 if(!((toSkip>>6) &0x1)){
186 for(
int measuresPhi =0; measuresPhi <=1; measuresPhi++) {
187 std::string name =
"h_" + nameStart+
"_" + (measuresPhi ?
"phi" :
"eta") +
"_spectrum" ;
188 std::string title = titleStart +
" " + (measuresPhi ?
"Phi Strips" :
"Eta Strips") +
" spectrum";
189 TH1F * specHist =
new TH1F(name.c_str(), title.c_str(), numBins, lowBound, highBound);
190 specHist->GetYaxis()->SetTitle(
"Counts");
191 specHist->GetXaxis()->SetTitle(axisLabel.c_str());
194 StatusCode
sc = monGroup.regHist(specHist);
212 std::string name =
"h_" + nameStart +
"_" +
m_hashName;
213 std::string title = categoryTitle +
" " + dataTypeTitle +
" " +
m_hashTitle;
215 xaxis =
"Channel Hash ID";
217 hashHist->GetXaxis()->SetTitle(xaxis.c_str());
218 hashHist->GetYaxis()->SetTitle(yaxis.c_str());
224 if (!monGroup.regHist(hashHist).isSuccess())
238 std::string title = categoryTitle +
" " + dataTypeTitle +
" " +
m_allChan1dTitle;
245 TH1F * allChan1dHistX =
new TH1F((name+
"X").c_str(), (title+
" - Precision strips").c_str(),
247 allChan1dHistX->GetXaxis()->SetTitle(xaxis.c_str());
248 allChan1dHistX->GetYaxis()->SetTitle(yaxis.c_str());
253 if (!monGroup.regHist(allChan1dHistX).isSuccess())
263 TH1F * allChan1dHistY =
new TH1F((name+
"Y").c_str(), (title +
" - Transverse strips").c_str(),
265 allChan1dHistY->GetXaxis()->SetTitle(xaxis.c_str());
266 allChan1dHistY->GetYaxis()->SetTitle(yaxis.c_str());
269 if (!monGroup.regHist(allChan1dHistY).isSuccess())
285 std::string title = categoryTitle +
" " + dataTypeTitle +
" " +
m_allChan2dTitle;
287 yaxis =
"Sector/Layer";
288 xaxis =
"Strip Number (Negative for Transverse Strips)";
313 TH2F * allChan2dHist =
new TH2F(name.c_str(), title.c_str(),
314 nxbins,nxmin,nxmax,nybins,nymin,nymax);
315 allChan2dHist->GetXaxis()->SetTitle(xaxis.c_str());
316 allChan2dHist->GetYaxis()->SetTitle(yaxis.c_str());
321 if (!monGroup.regHist(allChan2dHist).isSuccess())
335 yaxis =
"Average " + axisLabel;
336 xaxis =
"Sector * eta";
338 TProfile * chamProf=
new TProfile(name.c_str(), title.c_str(),
339 numSectors + 1, -16, 17);
340 chamProf->GetXaxis()->SetTitle(xaxis.c_str());
341 chamProf->GetYaxis()->SetTitle(yaxis.c_str());
346 if (!monGroup.regHist(chamProf).isSuccess())
361 ATH_MSG_DEBUG(
"Registering set with prefix" << namePrefix );
366 ATH_MSG_ERROR(
"failed to register " << namePrefix <<
" (layer histograms) " );
378 ATH_MSG_DEBUG(
"Registering set with prefix" << namePrefix );
381 false,
histCollection->ignoreY,numBins,lowBound,highBound).isSuccess())
384 <<
" (chamber summary histograms) " );
396 ATH_MSG_DEBUG(
"Registering set with prefix" << namePrefix );
402 <<
" (chamber summary histograms) " );
414 ATH_MSG_DEBUG(
"Registering set with prefix" << namePrefix );
417 namePrefix, titlePrefix, xaxis,yaxis,
418 false,
histCollection->ignoreY,numBins,lowBound,highBound).isSuccess())
420 ATH_MSG_ERROR(
" Failed to register " << namePrefix <<
" (Layer summary hists) " );
425 return StatusCode::SUCCESS;
427 return StatusCode::FAILURE;
432 std::vector<TH1F*> & histVector,
const std::string & namePrefix,
const std::string & titlePrefix,
433 const std::string & xaxis,
const std::string & yaxis,
434 bool chanView,
bool ignoreY,
unsigned int numBins,
435 float lowBound,
float highBound)
442 int stationSize, stationPhi, stationEta, sector;
443 std::string stationName;
444 std::string orientationName =
"prec";
445 std::string orientationTitle =
"Precision Direction";
447 int numHists = 32 * ( (ignoreY) ? 4 : 8);
448 histVector.resize(numHists,
nullptr);
450 ATH_MSG_DEBUG(
"Allocated space for " << numHists <<
" histograms" );
452 const std::vector<Identifier> & ids =
m_idHelperSvc->cscIdHelper().idVector();
453 for(
const auto & thisChamberId:ids)
456 m_idHelperSvc->cscIdHelper().get_module_hash(thisChamberId,chamHash);
457 ATH_MSG_DEBUG(
"Booking histograms for chamber with hash " << (
int)chamHash );
459 stationSize =
m_idHelperSvc->cscIdHelper().stationName(thisChamberId);
460 stationName =
m_idHelperSvc->cscIdHelper().stationNameString(stationSize);
461 stationPhi =
m_idHelperSvc->cscIdHelper().stationPhi(thisChamberId);
462 stationEta =
m_idHelperSvc->cscIdHelper().stationEta(thisChamberId);
463 sector =
getSector(stationPhi,stationSize);
464 for(
unsigned int orientationItr = 0; orientationItr < 2; orientationItr++)
466 if(orientationItr ==1)
476 orientationName =
"trans";
477 orientationTitle =
"Transverse Direction";
487 orientationName =
"prec";
488 orientationTitle =
"Precision Direction";
491 for(
unsigned int layItr = 1; layItr <= 4; layItr++)
494 <<
" With highbound/lowbound/nbins "
495 << highBound <<
"/" << lowBound <<
"/" << numBins );
497 std::stringstream nameStream;
498 nameStream.setf(std::ios::right, std::ios::adjustfield);
499 nameStream << namePrefix;
500 nameStream <<
"_" << orientationName <<
"_eta_";
501 nameStream << ((stationEta == 1) ?
"1" :
"0");
502 nameStream <<
"_sector_" << std::setw(2) << std::setfill(
'0') << sector;
503 nameStream <<
"_layer_" << layItr;
505 std::stringstream titleStream;
506 titleStream << titlePrefix <<
", " << orientationTitle;
507 titleStream <<
", Sector " << sector;
508 titleStream <<
", Eta " << stationEta;
509 titleStream <<
", Layer " << layItr;
512 << titleStream.str() <<
"On orientation " << orientationItr <<
" With highbound/lowbound/nbins " << highBound <<
"/" << lowBound <<
"/" << numBins );
514 TH1F* hist =
new TH1F(nameStream.str().c_str(), titleStream.str().c_str(),
515 numBins, lowBound, highBound);
516 hist->GetXaxis()->SetTitle(xaxis.c_str());
517 hist->GetYaxis()->SetTitle(yaxis.c_str());
520 int layIndex =
getLayIndex(orientationItr,stationEta,sector,layItr);
523 std::string geoPath =
getGeoPath(stationEta, sector, layItr, orientationItr);
524 std::string path =
getFullPath(geoPath, histTypeDir, parDir);
528 if(!monGroup.regHist(hist).isSuccess())
531 <<
" with layIndex" << layIndex );
532 return StatusCode::FAILURE;
536 ATH_MSG_DEBUG(
"Succesfully registered histogram with layIndex "
537 << layIndex <<
" and name " << hist->GetName() );
538 histVector[layIndex] = hist;
543 return StatusCode::SUCCESS;
548 const std::string & namePrefix,
const std::string & titlePrefix,
549 const std::string & xaxis,
const std::string & yaxis,
bool chanView,
550 bool ignoreY,
unsigned int numBins,
551 float lowBound,
float highBound)
555 static const int chanViewNBinsX = 800;
556 static const double chanViewLowBoundX = .5;
557 static const double chanViewHighBoundX = 800.5;
559 static const int chanViewNBinsY = 200;
560 static const double chanViewLowBoundY = .5;
561 static const double chanViewHighBoundY = 200.5;
566 int stationSize, stationPhi, stationEta, sector;
567 std::string stationName;
568 std::string orientationName =
"prec";
569 std::string orientationTitle =
"Precision Direction";
571 int numHists = (ignoreY) ? 32 : 64;
572 histVector.resize(numHists,
nullptr);
574 const std::vector<Identifier> & ids =
m_idHelperSvc->cscIdHelper().idVector();
576 for(
const auto & thisChamberId:ids)
579 m_idHelperSvc->cscIdHelper().get_module_hash(thisChamberId,chamHash);
580 ATH_MSG_DEBUG(
"Booking histograms for chamber with hash " << (
int)chamHash );
582 stationSize =
m_idHelperSvc->cscIdHelper().stationName(thisChamberId);
583 stationPhi =
m_idHelperSvc->cscIdHelper().stationPhi(thisChamberId);
584 stationEta =
m_idHelperSvc->cscIdHelper().stationEta(thisChamberId);
585 sector =
getSector(stationPhi,stationSize);
587 for(
unsigned int orientationItr = 0; orientationItr < 2; orientationItr++)
589 if(orientationItr ==1)
593 orientationName =
"trans";
594 orientationTitle =
"Transverse Direction";
596 numBins = chanViewNBinsY;
597 lowBound = chanViewLowBoundY;
598 highBound = chanViewHighBoundY;
603 orientationName =
"prec";
604 orientationTitle =
"Precision Direction";
606 numBins = chanViewNBinsX;
607 lowBound = chanViewLowBoundX;
608 highBound = chanViewHighBoundX;
612 std::stringstream nameStream;
613 nameStream.setf(std::ios::right, std::ios::adjustfield);
614 nameStream << namePrefix <<
"_" << orientationName <<
"_eta_"
615 << ((stationEta == 1) ?
"1" :
"0") <<
"_sector_"
616 << std::setw(2) << std::setfill(
'0')
619 std::stringstream titleStream;
621 titleStream << titlePrefix <<
", " << orientationTitle
622 <<
", Eta " << stationEta
623 <<
", Sector " << sector;
625 TH1F* hist =
new TH1F(nameStream.str().c_str(), titleStream.str().c_str()
626 ,numBins, lowBound, highBound);
627 hist->GetXaxis()->SetTitle(xaxis.c_str());
628 hist->GetYaxis()->SetTitle(yaxis.c_str());
631 int chamIndex =
getChamIndex(orientationItr,stationEta,sector);
634 << hist->GetName() <<
" and chamIndex " << chamIndex );
636 histVector[chamIndex] = hist;
641 if (!monGroup.regHist(hist).isSuccess())
648 return StatusCode::SUCCESS;
666 std::string statDbName =
"stat_cool";
667 std::string statDbTitle =
"Status Word Value From COOL";
668 std::string statDbAxisLabel =
"Stat Word Value";
669 unsigned int statDbNumBins = 8;
670 float statDbMin = -0.5;
671 float statDbMax = 7.5;
672 std::string statDbSubDir =
"StatCool";
675 statDbAxisLabel, statDbNumBins, statDbMin, statDbMax, statDbSubDir);
681 for(
unsigned int chanItr = 0; chanItr <=
m_maxHashId; chanItr++){
697 return StatusCode::SUCCESS;
703 ATH_MSG_DEBUG(
"CscCalibMonToolBase :: in fillHistograms()" );
705 return StatusCode::SUCCESS;
712 ATH_MSG_DEBUG(
"CscCalibMonToolBase : in procHistograms()" );
720 return StatusCode::RECOVERABLE;
723 ATH_MSG_DEBUG(
"There are " << calibContainer->
size() <<
" parameters to monitor" );
730 return StatusCode::SUCCESS;
741 return StatusCode::SUCCESS;
750 return StatusCode::SUCCESS;
757 ATH_MSG_DEBUG(
"CscCalibMonToolBase : in preProcParameter" );
758 return StatusCode::SUCCESS;
775 if (procParameterInput->
doChi2)
786 int numFailures = 0, maxFailures = 10;
789 const int hashId = chan->hashId();
790 const float val = chan->value();
791 const float error = chan->error();
795 missingChannels.erase(hashId);
798 if(procParameterInput->
dbName !=
"")
805 <<
" for channel " << hashId
806 <<
" from COOL database. Continuing with COOL value = 0"
808 if(numFailures==maxFailures)
811 << maxFailures <<
" failed retrievals. Quiting. " );
812 return StatusCode::FAILURE;
822 float diff = val - oldVal;
828 <<
" measurement of " << val <<
" varies by " <<
diff
829 <<
" from expected value of " << oldVal <<
" on channel with hash Id "
830 << hashId <<
". Specified maximum variance is " << procParameterInput->
maxDiff );
832 procParameterInput->
badHist->Fill(procParameterInput->
badBin);
836 if(procParameterInput->
doChi2)
838 chi2_ndf = chan->chi2()/chan->ndf();
856 (*procParameterInput->
vals)[hashId] = val;
857 if((procParameterInput->
errors->size()))
859 if(procParameterInput->
oldVals)
860 (*procParameterInput->
oldVals)[hashId] = oldVal;
861 if(procParameterInput->
diffs)
862 (*procParameterInput->
diffs)[hashId] =
diff;
863 if(procParameterInput->
doChi2)
868 if(missingChannels.size() !=0)
870 for(
const auto & thisChan: missingChannels)
876 if(!procParameterInput->
missingChans->GetBinContent(thisChan+1))
884 return StatusCode::SUCCESS;
906 ATH_MSG_DEBUG(
"Copying data to hist collection, doing: All Channels (hash view):"
908 <<
"All Channels (1d view) " << (
int)doHash
909 <<
"All Channels (2d view) " << (
int)doHash
910 <<
" layer overview " << (
int)doLayChan
911 <<
" layer spectrum " << (
int)doLaySummary
912 <<
" sector prof " << (
int)doChamAvg
913 <<
" chamber overview " << (
int)doChamChan
914 <<
" chamber spectrum " << (
int)doChamSummary
922 const std::vector<Identifier> & ids =
m_idHelperSvc->cscIdHelper().idVector();
923 for(
const auto & thisChamberId:ids)
926 m_idHelperSvc->cscIdHelper().get_module_hash(thisChamberId,chamHash);
927 ATH_MSG_DEBUG(
"Copying data to histograms for chamber with hash" << (
int)chamHash );
929 unsigned int stationSize =
m_idHelperSvc->cscIdHelper().stationName(thisChamberId);
931 unsigned int stationPhi =
m_idHelperSvc->cscIdHelper().stationPhi(thisChamberId);
932 int stationEta =
m_idHelperSvc->cscIdHelper().stationEta(thisChamberId);
933 unsigned int sector =
getSector(stationPhi,stationSize);
934 int sectorIndex = sector * stationEta;
938 std::vector<Identifier> stripVect;
939 m_idHelperSvc->cscIdHelper().idChannels(thisChamberId,stripVect);
941 for(
const auto & thisStrip:stripVect)
943 unsigned int chamberLayer =
m_idHelperSvc->cscIdHelper().chamberLayer(thisStrip);
944 if(chamberLayer != 2)
946 int measuresPhi =
m_idHelperSvc->cscIdHelper().measuresPhi(thisStrip);
951 m_idHelperSvc->cscIdHelper().get_channel_hash(thisStrip,stripHash);
952 unsigned int layer =
m_idHelperSvc->cscIdHelper().wireLayer(thisStrip);
954 float secLayer = (((float)stationEta*sector) + 0.2 * ((float)layer - 1) + 0.1);
955 float datum =
data.at(stripHash);
958 <<
"\tlayer: " << layer <<
"\tstationEta: " << stationEta
959 <<
"\tsecLayer: " << secLayer
960 <<
"\tdata: " << datum );
974 <<
"\tlayer: " << layer <<
"\tstationEta: " << stationEta
975 <<
"\tsecLayer: " << secLayer
976 <<
"\tdata: " << datum );
979 double modifiedStripNum =
982 + ((
strip-1) * .25 /(48))
988 modifiedStripNum, datum);
990 double modifiedStripNum =
993 + ((
strip-1) * .25 /(192 ))
998 modifiedStripNum, datum);
1005 <<
"\tlayer: " << layer <<
"\tstationEta: " << stationEta
1006 <<
"\tsecLayer: " << secLayer
1007 <<
"\tdata: " << datum );
1010 int modifiedStripNum =
static_cast<int>(
strip) * (measuresPhi ? -1 : 1);
1012 modifiedStripNum, secLayer, std::abs(datum));
1015 int layIndex =
getLayIndex(measuresPhi,stationEta,sector,layer);
1016 int chamIndex =
getChamIndex(measuresPhi,stationEta,sector);
1042 int shiftedStrip =
strip + (layer-1)*( measuresPhi ? 50 : 200);
1044 histCollection->chamHistVect[chamIndex]->SetBinContent(shiftedStrip,datum);
1046 histCollection->chamHistVect[chamIndex]->SetBinError(shiftedStrip,errors.at(stripHash));
1053 return StatusCode::SUCCESS;
1058 int layIndex = measuresPhi*32*4
1059 + ((stationEta ==1) ? 16*4 : 0)
1067 int chamIndex = measuresPhi*32
1068 + ((stationEta ==1) ? 16 : 0)
1080 return(2*stationPhi + 50 - stationSize);
1100 std::stringstream
ss;
1102 static const std::string histStr =
"/_hists";
1103 static const std::string errorDir =
"/ERROR";
1105 ss << std::setfill(
'0');
1110 ss <<
"/CscOverview";
1115 if(endCap ==
"ERROR")
1121 ss <<
"/EndCap" << endCap;
1129 if(sector <1 || sector > 16)
1135 ss <<
"/Sector" << std::setw(2) << sector;
1137 if(wireLayer == -9999)
1143 if(wireLayer < 1 || wireLayer > 4)
1145 ATH_MSG_ERROR(
"WireLayer " << wireLayer <<
" is invalid." );
1149 ss <<
"/Layer" << wireLayer;
1151 if(measuresPhi == -9999)
1157 if(measuresPhi < 0 || measuresPhi > 1)
1159 ATH_MSG_ERROR(
"MeasuresPhi " << measuresPhi <<
" is invalid." );
1163 ss << (measuresPhi ?
"/Phi" :
"/Eta");
1164 if(channel == -9999)
1171 if( channel < 1 || (measuresPhi && channel > 48) || (!measuresPhi && channel > 192))
1173 ATH_MSG_ERROR(
"Channel " << channel <<
" is invalid for a " << (measuresPhi ?
"phi layers" :
"eta layer") );
1178 ss <<
"/Channel" << std::setw( measuresPhi ? 2 : 3 ) << channel;
1187 std::stringstream
ss;
1191 if(histTypeDir !=
"")
1192 ss <<
"/" << histTypeDir;
1194 if(parTypeDir !=
"")
1195 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 is a "hash" representation of an Identifier.