20     m_expectedChamberLayer(2),
 
   21     m_detailedHashIds(nullptr),
 
   22     m_onlyExpectPrecisionHashIds(false),
 
   23     m_hashName(
"hash_overview"), 
 
   25     m_allChan1dName(
"all_chan_1d"),
 
   26     m_allChan1dTitle(
"(View of All Channels)"),
 
   27     m_allChan2dName(
"all_chan_2d"),
 
   28     m_allChan2dTitle(
"(View of All Channels)"),
 
   29     m_chamProfName(
"profile_all_sectors"),
 
   31     m_layHistName(
"overview"), 
 
   33     m_chamSummHistName(
"spectrum"),
 
   34     m_chamSummHistTitle(
""), 
 
   35     m_chamHistName(
"overview"),
 
   37     m_laySummHistName(
"spectrum"), 
 
   38     m_laySummHistTitle(
""), 
 
   41     m_monGroupVec(nullptr),
 
   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;
 
  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) &0
x1)){
 
  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";
 
  191       specHist->GetYaxis()->SetTitle(
"Counts");
 
  192       specHist->GetXaxis()->SetTitle(axisLabel.c_str());
 
  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())
 
  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())
 
  288     yaxis = 
"Sector/Layer";
 
  289     xaxis = 
"Strip Number (Negative for Transverse Strips)";
 
  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";
 
  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  );
 
  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,
 
  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,
 
  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); 
 
  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 "   
  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;
 
  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(), 
 
  517         hist->GetXaxis()->SetTitle(xaxis.c_str());
 
  518         hist->GetYaxis()->SetTitle(yaxis.c_str());
 
  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, 
 
  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;
 
  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); 
 
  588     for(
unsigned int orientationItr = 0; orientationItr < 2; orientationItr++)
 
  590       if(orientationItr ==1)
 
  594         orientationName = 
"trans";
 
  595         orientationTitle = 
"Transverse Direction";
 
  597           numBins = chanViewNBinsY;
 
  604         orientationName = 
"prec";
 
  605         orientationTitle = 
"Precision Direction";
 
  607           numBins = chanViewNBinsX;
 
  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 
 
  624         << 
", Sector " << sector; 
 
  626       TH1F* 
hist = 
new TH1F(nameStream.str().c_str(), titleStream.str().c_str()
 
  628       hist->GetXaxis()->SetTitle(xaxis.c_str());
 
  629       hist->GetYaxis()->SetTitle(yaxis.c_str());
 
  635                      << 
hist->GetName() << 
" and chamIndex " << chamIndex  );
 
  637       histVector[chamIndex] = 
hist;
 
  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++){
 
  685           if(!readCdo->readChannelStatus(chanItr, statWord).isSuccess()){
 
  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();
 
  796     missingChannels.erase(hashId);
 
  799     if(procParameterInput->
dbName != 
"")
 
  802       if(!(readCdo->readChannelParam(hashId, oldVal, procParameterInput->
dbName)).isSuccess())
 
  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;
 
  828       ATH_MSG_INFO( 
"CscCalibMonToolBase : Possible problem! " << parVals->parName()
 
  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();
 
  840       if(chi2_ndf > procParameterInput->
chi2Max)
 
  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)
 
  865       (*procParameterInput->
chi2s)[hashId] = chi2_ndf;
 
  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); 
 
  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);
 
  956       float datum = 
data.at(stripHash);
 
  960                        << 
"\tsecLayer: " << secLayer 
 
  961                        << 
"\tdata: " << datum  );
 
  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);
 
 1007                          << 
"\tsecLayer: " << secLayer 
 
 1008                          << 
"\tdata: " << datum  );
 
 1011         int modifiedStripNum = 
static_cast<int>(
strip) * (measuresPhi ? -1 : 1);
 
 1013             modifiedStripNum, secLayer, std::abs(datum));
 
 1043         int shiftedStrip = 
strip + (
layer-1)*( measuresPhi ? 50 : 200);
 
 1045         (*(
histCollection->chamHistVect))[chamIndex]->SetBinContent(shiftedStrip,datum);
 
 1054   return StatusCode::SUCCESS;
 
 1059   int layIndex = measuresPhi*32*4
 
 1068   int chamIndex = measuresPhi*32
 
 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");
 
 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;