ATLAS Offline Software
CscCalibMonToolBase.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
6 #include "TProfile.h"
7 #include "TH1F.h"
8 #include "TH1I.h"
9 #include "TH2F.h"
10 #include <sstream>
11 #include <utility>
12 
13 #include "CscCalibMonToolBase.h"
14 
15 CscCalibMonToolBase::CscCalibMonToolBase(const std::string & type, const std::string & name, const IInterface* parent) :
17  m_maxHashId(0),
18  m_maxChamId(0),
19  m_numBad(0),
20  m_expectedChamberLayer(2),
21  m_detailedHashIds(nullptr),
22  m_onlyExpectPrecisionHashIds(false),
23  m_hashName("hash_overview"),
24  m_hashTitle(""),
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"),
30  m_chamProfTitle(""),
31  m_layHistName("overview"),
32  m_layHistTitle(""),
33  m_chamSummHistName("spectrum"),
34  m_chamSummHistTitle(""),
35  m_chamHistName("overview"),
36  m_chamHistTitle(""),
37  m_laySummHistName("spectrum"),
38  m_laySummHistTitle(""),
39  m_histCol(kAzure +1),
40  m_histColAlert(kRed),
41  m_monGroupVec(nullptr),
42  m_statDbColl(nullptr)
43 {
44 
45  declareProperty("MakeAllChanHashOverviewHists",m_makeHashHists=true); //Histograms showing a parameter for allchannels
46  declareProperty("MakeAllChan1dHists",m_makeAllChan1dHists=true); //Histograms showing a parameter for allchannels
47  declareProperty("MakeAllChan2dHists",m_makeAllChan2dHists=true); //Histograms showing a parameter for allchannels
48  declareProperty("MakeLayerOverviewHists",m_makeLayHists = true);
49  declareProperty("MakeLayerValueViewHists", m_makeLaySummHists = true);
50  declareProperty("MakeChamberProfiles", m_makeChamProfs = true);
51  declareProperty("MakeChamberValueViewHists", m_makeChamSummHists =true);
52  declareProperty("MakeChamberOverviewHists", m_makeChamHists =true);
53  declareProperty("MaxDetailedChannels",m_maxDetailedChannels = -1); //-1 = all that show problems
54  declareProperty("CscCalibResultKey", m_calibResultKey = ""); //TDS key, defaulted in derived class
55  declareProperty("GetDebugForAllChannels", m_doAllDetailed = false);
56  declareProperty("DoBadDetailed", m_doBadDetailed = false, "Store histograms for channels marked as bad");
57  declareProperty("DoStatDb", m_doStatDb = true);
58 }
59 
60 /*-----------------------------------------------------*/
62 {
63  // init message stream - Part 1: Get the messaging service, print where you are
64  ATH_MSG_INFO( "CscCalibMonToolBase : in initialize()" );
65 
66  ATH_CHECK( m_idHelperSvc.retrieve() );
68 
69  //m_generic_path_csccalibmonitoring = "Muon/MuonCalibrationMonitoring/CSC";
71 
72 
73  //Find valid hashes
74  ATH_MSG_DEBUG( "Expected chamber layer " << m_expectedChamberLayer );
75  ATH_MSG_DEBUG( "Constructing list of expected chamber layers" );
76 
77  //Loop through ids to find out what hash range we're working on, and to
78  //initialize histograms.
79  IdContext chanContext = m_idHelperSvc->cscIdHelper().channel_context();
80  const std::vector<Identifier> & ids = m_idHelperSvc->cscIdHelper().idVector();
81  m_maxHashId = 0;
82  m_maxChamId = 0;
83  for(const auto & thisChamberId:ids)
84  {
85  IdentifierHash chamberHash;
86  m_idHelperSvc->cscIdHelper().get_module_hash(thisChamberId,chamberHash);
87  if(chamberHash > m_maxChamId)
88  m_maxChamId = chamberHash;
89 
90  std::vector<Identifier> stripVect;
91  m_idHelperSvc->cscIdHelper().idChannels(thisChamberId,stripVect);
92  for(const auto & thisStrip:stripVect)
93  {
94  IdentifierHash stripHash;
95  m_idHelperSvc->cscIdHelper().get_channel_hash(thisStrip,stripHash);
96  bool measuresPhi = m_idHelperSvc->cscIdHelper().measuresPhi(thisStrip);
97  //Find maximum hash
98  if((unsigned int)stripHash > m_maxHashId)
99  m_maxHashId = (int)stripHash;
100 
102  == (unsigned int)m_idHelperSvc->cscIdHelper().chamberLayer(thisStrip)
103  )
104  {
105  ATH_MSG_VERBOSE( "hash " << (int)stripHash << " is expected" );
106  m_expectedHashIdsAll.insert(stripHash);
107  if(!measuresPhi){
108  ATH_MSG_VERBOSE( "hash " << (int)stripHash << " is prec and expected" );
109  m_expectedHashIdsPrec.insert(stripHash);
110  }
111  }
112  else
113  ATH_MSG_VERBOSE( "hash " << (int)stripHash << " is NOT expected (Not a bug, just populating list)." );
114  }//End strip loop
115  }//End chamber loop
116 
117  //m_detailedHashIds determines which hashes we're going to look at detailed histograms for.
118  m_detailedHashIds = new bool[m_maxHashId+1];
119  for(unsigned int chanItr =0; chanItr <= m_maxHashId; chanItr++)
120  m_detailedHashIds[chanItr] = false;
121 
122  //This needs to be initialized before we book any hist Collecitons
123  ATH_MSG_INFO( "Initializing ManagedMonitorToolBase" );
124  ManagedMonitorToolBase::initialize().ignore(); // Ignore the checking code;
125 
126 
127  return StatusCode::SUCCESS;
128 }//end initialize()
129 
131 {
132  delete [] m_detailedHashIds;
133  delete m_statDbColl;
134 
136 }//end finalize()
137 
138 
140  std::string dataTypeName, std::string dataTypeTitle, std::string categoryName, std::string categoryTitle,
141  std::string axisLabel, int numBins, float lowBound, float highBound, std::string parDir,
143 {
144  //toSkip bitmask:
145  //00000000 do all
146  //00000001 skip all channels hash view
147  //00000010 skip chamberAverage
148  //00000100 skip layer overview
149  //00001000 skip sector summary
150  //00010000 skip layer summary
151  //00100000 skip AllChannels 1d view
152  //00100000 skip AllChannels 2d view
153  //01000000 skip csc spectra
154  //10000000 skip sector overview
155 
156  //Make sure last character isn't a "/"
157  std::string endDir = "";
158  if(parDir != "")
159  endDir = "/" + parDir;
160 
161  //Some universal directories
162  std::string allChambersDirectory = "/GeneralCscHists";
163 
164  //Set directory structure used by CscCalibMonToolBase
165  /*
166  m_hashPath = m_generic_path_csccalibmonitoring + allChambersDirectory + "/AllChanHash" + endDir;
167  m_allChan2dPath = m_generic_path_csccalibmonitoring + allChambersDirectory + "/AllChan2d" + endDir;
168  m_chamProfPath = m_generic_path_csccalibmonitoring + allChambersDirectory + "/SectorProfiles" + endDir;
169  m_layHistPath = m_generic_path_csccalibmonitoring + "/EXPERT/" + parDir + "Layers";
170  m_chamSummHistPath = m_generic_path_csccalibmonitoring + "/EXPERT/" + parDir + "ChamberValueSpectrum";
171  m_laySummHistPath = m_generic_path_csccalibmonitoring + "/EXPERT/" + parDir + "LayerValueSpectrum";
172  */
173  bool allGood = true;
174 
175 
176  std::string nameStart = std::move(dataTypeName) ;
177  if(categoryName != "" )
178  nameStart += "_" + categoryName;
179 
180  std::string titleStart = categoryTitle + " " + dataTypeTitle;
181  std::string yaxis= "", xaxis = "";
182 
183  ATH_MSG_DEBUG( "In bookHistCollection for " << nameStart << " series." );
184 
185  if(!((toSkip>>6) &0x1)){
186  histCollection->cscSpec.resize(2,nullptr);
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());
193  std::string specPath = getFullPath( getGeoPath(), "OverviewSpectra", parDir);
194  MonGroup monGroup( this, specPath, run, ATTRIB_MANAGED);
195  StatusCode sc = monGroup.regHist(specHist);
196 
197  specHist->SetFillColor(m_histCol);
198 
199  if(!sc.isSuccess())
200  {
201  ATH_MSG_ERROR( "failed to register " << name );
202  allGood = false;
203  }
204  else
205  histCollection->cscSpec[measuresPhi] = specHist;
206  }
207 
208 
209  }
210 
211  if(m_makeHashHists && !(toSkip & 0x1))
212  {
213  std::string name = "h_" + nameStart + "_" + m_hashName;
214  std::string title = categoryTitle + " " + dataTypeTitle + " " + m_hashTitle;
215  yaxis = axisLabel;
216  xaxis = "Channel Hash ID";
217  TH1F * hashHist = new TH1F(name.c_str(), title.c_str(), m_maxHashId+1,0,m_maxHashId+1);
218  hashHist->GetXaxis()->SetTitle(xaxis.c_str());
219  hashHist->GetYaxis()->SetTitle(yaxis.c_str());
220  hashHist->SetFillColor(m_histCol);
221 
222  std::string hashPath = getFullPath( getGeoPath(), "FullViewHash", parDir);
223  MonGroup monGroup( this, hashPath, run, ATTRIB_MANAGED);
224  ATH_MSG_DEBUG( "Registering " << name );
225  if (!monGroup.regHist(hashHist).isSuccess())
226  {
227  ATH_MSG_ERROR( "failed to register " << name );
228  allGood = false;
229  }
230  else
231  histCollection->hashHist = hashHist;
232 
233  }
234  //All channels 1d view
235  if(m_makeAllChan1dHists && !((toSkip>>6) & 0x1))
236  {
237 
238  std::string name = "h_" + nameStart + "_" + m_allChan1dName;
239  std::string title = categoryTitle + " " + dataTypeTitle + " " + m_allChan1dTitle;
240  yaxis = axisLabel;
241  xaxis = "Chamber";
242  int nxbins = 26146;// 4 layers, 192 channels each, with 32 chambers + 2 "extra" chambers"
243  float nxmin = -16; // -1 (for EC)
244  float nxmax = 16; // 1 (for EA)
245 
246  TH1F * allChan1dHistX = new TH1F((name+"X").c_str(), (title+ " - Precision strips").c_str(),
247  nxbins,nxmin,nxmax);
248  allChan1dHistX->GetXaxis()->SetTitle(xaxis.c_str());
249  allChan1dHistX->GetYaxis()->SetTitle(yaxis.c_str());
250 
251  std::string allChan1dPath = getFullPath( getGeoPath(), "FullView1d", parDir);
252  MonGroup monGroup( this, allChan1dPath, run, ATTRIB_MANAGED );
253  ATH_MSG_DEBUG( "Registering " << name );
254  if (!monGroup.regHist(allChan1dHistX).isSuccess())
255  {
256  ATH_MSG_ERROR( "failed to register " << name );
257  allGood = false;
258  }
259  else
260  histCollection->allChan1dHistX = allChan1dHistX;
261 
262  nxbins = 6562;
263 
264  TH1F * allChan1dHistY = new TH1F((name+"Y").c_str(), (title + " - Transverse strips").c_str(),
265  nxbins,nxmin,nxmax);
266  allChan1dHistY->GetXaxis()->SetTitle(xaxis.c_str());
267  allChan1dHistY->GetYaxis()->SetTitle(yaxis.c_str());
268 
269  ATH_MSG_DEBUG( "Registering " << name );
270  if (!monGroup.regHist(allChan1dHistY).isSuccess())
271  {
272  ATH_MSG_ERROR( "failed to register " << name );
273  allGood = false;
274  }
275  else
276  histCollection->allChan1dHistY = allChan1dHistY;
277 
278 
279  }
280 
281  //All channels 2d view
282  if(m_makeAllChan2dHists && !((toSkip>>6) & 0x1))
283  {
284 
285  std::string name = "h_" + nameStart + "_" + m_allChan2dName;
286  std::string title = categoryTitle + " " + dataTypeTitle + " " + m_allChan2dTitle;
287  //yaxis = "sector + 0.2 * (layer - 1) + 0.1";
288  yaxis = "Sector/Layer";
289  xaxis = "Strip Number (Negative for Transverse Strips)";
290 
291  int nxbins ;
292  float nxmin;
293  float nxmax;
294  int nybins ;
295  float nymin;
296  float nymax;
297  if(histCollection->ignoreY){
298  nxbins = 193; // 192 bins for precision + 1 extra
299  nxmin = 0.; // -1 -> -48 (for transverse)
300  nxmax = 193.; // 1 -> 192 (for precision)
301  nybins = 175; // 32 chambers (16 per side x 5 layers per chamber) + 5 extra
302  nymin = -17.; //
303  nymax = 18.; //
304  }
305  else{
306  nxbins = 242; // 192 bins for precision, 48 for transverse strips + 2 extra
307  nxmin = -49.; // -1 -> -48 (for transverse)
308  nxmax = 193.; // 1 -> 192 (for precision)
309  nybins = 175; // 32 chambers (16 per side x 5 layers per chamber) + 5 extra
310  nymin = -17.; //
311  nymax = 18.; //
312  }
313 
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());
318 
319  std::string allChan2dPath = getFullPath( getGeoPath(), "FullView2d", parDir);
320  MonGroup monGroup( this, allChan2dPath, run, ATTRIB_MANAGED);
321  ATH_MSG_DEBUG( "Registering " << name );
322  if (!monGroup.regHist(allChan2dHist).isSuccess())
323  {
324  ATH_MSG_ERROR( "failed to register " << name );
325  allGood = false;
326  }
327  else
328  histCollection->allChan2dHist = allChan2dHist;
329 
330  }
331 
332  if(m_makeChamProfs && !((toSkip >> 1) & 0x1) )
333  {
334  std::string name = "h_" + nameStart + "_" + m_chamProfName;
335  std::string title = titleStart + " " + m_chamProfTitle;
336  yaxis = "Average " + axisLabel;
337  xaxis = "Sector * eta";
338  int numSectors = 16;
339  TProfile * chamProf= new TProfile(name.c_str(), title.c_str(),
340  numSectors + 1, -16, 17); //hard coding these because its annoying otherwise
341  chamProf->GetXaxis()->SetTitle(xaxis.c_str());
342  chamProf->GetYaxis()->SetTitle(yaxis.c_str());
343 
344  ATH_MSG_DEBUG( "Registering " << name );
345  std::string path = getFullPath( getGeoPath(), "Profiles", parDir);
347  if (!monGroup.regHist(chamProf).isSuccess())
348  {
349  ATH_MSG_ERROR( "failed to register " << name );
350  allGood = false;
351  }
352  else
353  histCollection->chamProf = chamProf;
354  }
355  if(m_makeLayHists && !((toSkip >> 2) & 0x1) )
356  {
357  std::string namePrefix = nameStart + "_" + m_layHistName;
358  std::string titlePrefix = titleStart + " " + m_layHistTitle;
359  yaxis = axisLabel;
360  xaxis = "Channel";
361 
362  ATH_MSG_DEBUG( "Registering set with prefix" << namePrefix );
363  histCollection->layHistVect = new std::vector<TH1F*>();
364  if (!bookLayHists("LayerView", parDir, *histCollection->layHistVect,namePrefix, titlePrefix, "Channel", xaxis
365  ,true, histCollection->ignoreY).isSuccess())
366  {
367  ATH_MSG_ERROR( "failed to register " << namePrefix << " (layer histograms) " );
368  allGood = false;
369  }
370  }
371 
372  if(m_makeChamSummHists && !((toSkip >> 3) & 0x1) )
373  {
374  std::string namePrefix = nameStart + "_" + m_chamSummHistName;
375  std::string titlePrefix = titleStart + " " + m_chamSummHistTitle;
376  yaxis = "";
377  xaxis = axisLabel;
378 
379  ATH_MSG_DEBUG( "Registering set with prefix" << namePrefix );
380  histCollection->chamSummVect = new std::vector<TH1F*>();
381  if (!bookChamHists("SecSpectrum", parDir,*histCollection->chamSummVect,namePrefix, titlePrefix, xaxis,yaxis,
382  false,histCollection->ignoreY,numBins,lowBound,highBound).isSuccess())
383  {
384  ATH_MSG_ERROR( "failed to register " << namePrefix
385  << " (chamber summary histograms) " );
386  allGood = false;
387  }
388  }
389 
390  if(m_makeChamHists && !((toSkip >> 7) & 0x1) )
391  {
392  std::string namePrefix = nameStart + "_" + m_chamHistName;
393  std::string titlePrefix = titleStart + " " + m_chamHistTitle;
394  yaxis = "";
395  xaxis = axisLabel;
396 
397  ATH_MSG_DEBUG( "Registering set with prefix" << namePrefix );
398  histCollection->chamHistVect = new std::vector<TH1F*>();
399  if (!bookChamHists("SectorView", parDir,*histCollection->chamHistVect,namePrefix, titlePrefix, xaxis,yaxis,
400  true,histCollection->ignoreY).isSuccess())
401  {
402  ATH_MSG_ERROR( "failed to register " << namePrefix
403  << " (chamber summary histograms) " );
404  allGood = false;
405  }
406  }
407 
408  if(m_makeLaySummHists && !((toSkip >> 4) & 0x1) )
409  {
410  std::string namePrefix = nameStart + "_" + m_laySummHistName;
411  std::string titlePrefix = titleStart + " " + m_laySummHistTitle;
412  yaxis = "";
413  xaxis = axisLabel;
414 
415  ATH_MSG_DEBUG( "Registering set with prefix" << namePrefix );
416  histCollection->laySummVect = new std::vector<TH1F*>();
417  if (!bookLayHists("LaySpectrum", parDir, *histCollection->laySummVect,
418  namePrefix, titlePrefix, xaxis,yaxis,
419  false,histCollection->ignoreY,numBins,lowBound,highBound).isSuccess())
420  {
421  ATH_MSG_ERROR( " Failed to register " << namePrefix << " (Layer summary hists) " );
422  allGood = false;
423  }
424  }
425  if(allGood)
426  return StatusCode::SUCCESS;
427  else
428  return StatusCode::FAILURE;
429 }//end bookHistCollection
430 
431 StatusCode CscCalibMonToolBase::bookLayHists(std::string histTypeDir, std::string parDir,/* MonGroup &monGroup,*/ std::vector<TH1F*> & histVector, std::string namePrefix, std::string titlePrefix,
432  std::string xaxis, std::string yaxis,
433  bool chanView, bool ignoreY, unsigned int numBins,
434  float lowBound, float highBound)
435 {
436  //Book a set of histograms, one for each layer.
437  //chanView = true ignores numBins and bounds and makes x-axis based on channel ids
438  //ignore Y = true skips transverse direction strips
439 
440  //unsigned int numStrips;
441  int stationSize, stationPhi, stationEta, sector;
442  std::string stationName;
443  std::string orientationName = "prec";
444  std::string orientationTitle = "Precision Direction";
445 
446  int numHists = 32 * ( (ignoreY) ? 4 : 8);
447  histVector.resize(numHists,nullptr);
448 
449  ATH_MSG_DEBUG( "Allocated space for " << numHists << " histograms" );
450 
451  const std::vector<Identifier> & ids = m_idHelperSvc->cscIdHelper().idVector();
452  for(const auto & thisChamberId:ids)
453  {
454  IdentifierHash chamHash;
455  m_idHelperSvc->cscIdHelper().get_module_hash(thisChamberId,chamHash);
456  ATH_MSG_DEBUG( "Booking histograms for chamber with hash " << (int)chamHash );
457 
458  stationSize = m_idHelperSvc->cscIdHelper().stationName(thisChamberId);
459  stationName = m_idHelperSvc->cscIdHelper().stationNameString(stationSize);
460  stationPhi = m_idHelperSvc->cscIdHelper().stationPhi(thisChamberId);
461  stationEta = m_idHelperSvc->cscIdHelper().stationEta(thisChamberId);
462  sector = getSector(stationPhi,stationSize);
463  for(unsigned int orientationItr = 0; orientationItr < 2; orientationItr++)
464  {
465  if(orientationItr ==1)
466  {
467  if(ignoreY) //skip non precision strips
468  continue;
469  if(chanView) //Base bin labels on orientation
470  {
471  numBins = 48;
472  highBound = 49;
473  lowBound = 1;
474  }
475  orientationName = "trans";
476  orientationTitle = "Transverse Direction";
477  }
478  else
479  {
480  if(chanView)
481  {
482  numBins = 192;
483  highBound = 193;
484  lowBound = 1;
485  }
486  orientationName = "prec";
487  orientationTitle = "Precision Direction";
488  }
489 
490  for(unsigned int layItr = 1; layItr <= 4; layItr++)
491  {
492  ATH_MSG_VERBOSE( "Storing a hist on orientation " << orientationItr
493  << " With highbound/lowbound/nbins "
494  << highBound << "/" << lowBound << "/" << numBins );
495 
496  std::stringstream nameStream;
497  nameStream.setf(std::ios::right, std::ios::adjustfield);
498  nameStream << namePrefix;
499  nameStream << "_" << orientationName << "_eta_";
500  nameStream << ((stationEta == 1) ? "1" : "0");
501  nameStream << "_sector_" << std::setw(2) << std::setfill('0') << sector;
502  nameStream << "_layer_" << layItr;
503 
504  std::stringstream titleStream;
505  titleStream << titlePrefix << ", " << orientationTitle;
506  titleStream << ", Sector " << sector;
507  titleStream <<", Eta " << stationEta;
508  titleStream << ", Layer " << layItr;
509 
510  ATH_MSG_VERBOSE( "Storing " << nameStream.str() << " with title "
511  << titleStream.str() << "On orientation " << orientationItr << " With highbound/lowbound/nbins " << highBound << "/" << lowBound << "/" << numBins );
512 
513  TH1F* hist = new TH1F(nameStream.str().c_str(), titleStream.str().c_str(),
514  numBins, lowBound, highBound);
515  hist->GetXaxis()->SetTitle(xaxis.c_str());
516  hist->GetYaxis()->SetTitle(yaxis.c_str());
517  hist->SetFillColor(m_histCol);
518 
519  int layIndex = getLayIndex(orientationItr,stationEta,sector,layItr);
520 
521  //Lets
522  std::string geoPath = getGeoPath(stationEta, sector, layItr, orientationItr);
523  std::string path = getFullPath(geoPath, histTypeDir, parDir);
525 
526 
527  if(!monGroup.regHist(hist).isSuccess())
528  {
529  ATH_MSG_FATAL( "Failed to register " << nameStream.str()
530  << " with layIndex" << layIndex );
531  return StatusCode::FAILURE;
532  }
533  else
534  {
535  ATH_MSG_DEBUG( "Succesfully registered histogram with layIndex "
536  << layIndex <<" and name " << hist->GetName() );
537  histVector[layIndex] = hist;
538  }
539  }//end layer loop
540  }//End orientation loop
541  }//End chamber loop
542  return StatusCode::SUCCESS;
543 }//end bookLayHists
544 
545 //NOTE: Chanview mode isn't implemented!
546 StatusCode CscCalibMonToolBase::bookChamHists(std::string histTypeDir, std::string parTypeDir, std::vector<TH1F*>& histVector,
547  std::string namePrefix, std::string titlePrefix,
548  std::string xaxis, std::string yaxis, bool chanView,
549  bool ignoreY, unsigned int numBins,
550  float lowBound, float highBound)
551 {
552  //When doing channel view (i.e. one value per channel, also refered to as SectorView)
553  //we use pre-defined nbins, lower bound, and upper bound for histograms for obvious reasons
554  static const int chanViewNBinsX = 800;
555  static const double chanViewLowBoundX = .5;
556  static const double chanViewHighBoundX = 800.5;
557 
558  static const int chanViewNBinsY = 200;
559  static const double chanViewLowBoundY = .5;
560  static const double chanViewHighBoundY = 200.5;
561 
562 
563  //Book a set of channel view histograms.
564  //unsigned int numStrips;
565  int stationSize, stationPhi, stationEta, sector;
566  std::string stationName;
567  std::string orientationName = "prec";
568  std::string orientationTitle = "Precision Direction";
569 
570  int numHists = (ignoreY) ? 32 : 64; //32 chambers, 2 orientations
571  histVector.resize(numHists,nullptr);
572 
573  const std::vector<Identifier> & ids = m_idHelperSvc->cscIdHelper().idVector();
574 
575  for(const auto & thisChamberId:ids)
576  {
577  IdentifierHash chamHash;
578  m_idHelperSvc->cscIdHelper().get_module_hash(thisChamberId,chamHash);
579  ATH_MSG_DEBUG( "Booking histograms for chamber with hash " << (int)chamHash );
580 
581  stationSize = m_idHelperSvc->cscIdHelper().stationName(thisChamberId); //50
582  stationPhi = m_idHelperSvc->cscIdHelper().stationPhi(thisChamberId);
583  stationEta = m_idHelperSvc->cscIdHelper().stationEta(thisChamberId);
584  sector = getSector(stationPhi,stationSize);
585 
586  for(unsigned int orientationItr = 0; orientationItr < 2; orientationItr++)
587  {
588  if(orientationItr ==1)
589  {
590  if(ignoreY)
591  continue; //skip non precision strips.
592  orientationName = "trans";
593  orientationTitle = "Transverse Direction";
594  if(chanView){
595  numBins = chanViewNBinsY;
596  lowBound = chanViewLowBoundY;
597  highBound = chanViewHighBoundY;
598  }
599  }
600  else
601  {
602  orientationName = "prec";
603  orientationTitle = "Precision Direction";
604  if(chanView){
605  numBins = chanViewNBinsX;
606  lowBound = chanViewLowBoundX;
607  highBound = chanViewHighBoundX;
608  }
609  }
610 
611  std::stringstream nameStream;
612  nameStream.setf(std::ios::right, std::ios::adjustfield);
613  nameStream << namePrefix << "_" << orientationName << "_eta_"
614  << ((stationEta == 1) ? "1" : "0") << "_sector_"
615  << std::setw(2) << std::setfill('0')
616  << sector ;
617 
618  std::stringstream titleStream;
619 
620  titleStream << titlePrefix << ", " << orientationTitle
621  << ", Eta " << stationEta
622  << ", Sector " << sector;
623 
624  TH1F* hist = new TH1F(nameStream.str().c_str(), titleStream.str().c_str()
625  ,numBins, lowBound, highBound);
626  hist->GetXaxis()->SetTitle(xaxis.c_str());
627  hist->GetYaxis()->SetTitle(yaxis.c_str());
628  hist->SetFillColor(m_histCol);
629 
630  int chamIndex = getChamIndex(orientationItr,stationEta,sector);
631 
632  ATH_MSG_DEBUG( "Registering histogram with name "
633  << hist->GetName() << " and chamIndex " << chamIndex );
634 
635  histVector[chamIndex] = hist;
636 
637  std::string path = getFullPath(getGeoPath(stationEta,sector), histTypeDir, parTypeDir);
638 
640  if (!monGroup.regHist(hist).isSuccess())
641  {
642  ATH_MSG_WARNING("monGroup.regHist(hist) failed for "<< path );
643  }
644  }//End orientation loop
645  }//End chamber loop
646  ATH_MSG_DEBUG( "Exiting bookChamHists" );
647  return StatusCode::SUCCESS;
648 }//end bookChamHists
649 
651 {
652  ATH_MSG_DEBUG( "CscalibMonTool : in bookHistograms()" );
653  if (newRunFlag())
654  {
655 
656  //Plot status words. This could be useful to include in all output files, so we'll put
657  //it in the base class here
658  if(m_doStatDb){
659  //This is a histogram collection both derived classes will probably like
660 
662  const CscCondDbData* readCdo{*readHandle};
663 
665  std::string statDbName = "stat_cool";
666  std::string statDbTitle = "Status Word Value From COOL";
667  std::string statDbAxisLabel = "Stat Word Value";
668  unsigned int statDbNumBins = 8;
669  float statDbMin = -0.5;
670  float statDbMax = 7.5;
671  std::string statDbSubDir = "StatCool";
672 
673  StatusCode sc = bookHistCollection(m_statDbColl, statDbName, statDbTitle, "", "",
674  statDbAxisLabel, statDbNumBins, statDbMin, statDbMax, statDbSubDir);
675  if(!sc.isSuccess()){
676  ATH_MSG_WARNING( " Failed to register db stat hists!" );
677  }
678 
679  //Loop through channels retrieving status words
680  for(unsigned int chanItr = 0; chanItr <= m_maxHashId; chanItr++){
681  if(m_expectedHashIdsAll.count(chanItr)) {
682  int statWord;
683  if(!readCdo->readChannelStatus(chanItr, statWord).isSuccess()){
684  ATH_MSG_WARNING( "Failed to retrieve statword for hashId "
685  << chanItr );
686  }
687  m_statDbColl->data[chanItr] = (float)statWord;
688  }
689  }//end chanItr llop
690  if(!copyDataToHists(m_statDbColl).isSuccess())
691  {
692  ATH_MSG_WARNING( "copyDataToHists failed in bookHistograms." );
693  }
694  }
695  }
696  return StatusCode::SUCCESS;
697 }//end bookHistograms
698 
700 {
701 
702  ATH_MSG_DEBUG( "CscCalibMonToolBase :: in fillHistograms()" );
703 
704  return StatusCode::SUCCESS;
705 }//end fillHistograms
706 
707 /*---------------------------------------------------------------------------------------------------------*/
709 {
710 
711  ATH_MSG_DEBUG( "CscCalibMonToolBase : in procHistograms()" );
712 
713  if(endOfRunFlag())
714  {
715  const CscCalibResultContainer* calibContainer;
716  if (!evtStore()->retrieve(calibContainer, m_calibResultKey).isSuccess())
717  {
718  ATH_MSG_ERROR( " Cannot retrieve container with name " << m_calibResultKey );
719  return StatusCode::RECOVERABLE;
720  }
721 
722  ATH_MSG_DEBUG( "There are " << calibContainer->size() << " parameters to monitor" );
723 
724  for(const CscCalibResultCollection* thisParameter: *calibContainer) {
725  ATH_CHECK( handleParameter(thisParameter) );
726  }
727  ATH_CHECK( postProc() );
728  }
729  return StatusCode::SUCCESS;
730 }//end procHistograms
731 
732 
733 /*--retrieve histos: Overloaded in derived classes to collect interesting histograms from calibration alg--------*/
735 {
736  ATH_MSG_DEBUG( "CscCalibMonToolBase : in postProc()" );
737 
738  //This method should be overloaded in a derived class
739 
740  return StatusCode::SUCCESS;
741 }// end postProc
742 
743 /*---------------------------------------------------------*/
745 {
746 
747  ATH_MSG_DEBUG( "CscCalibMonToolBase : in checkHists()" );
748 
749  return StatusCode::SUCCESS;
750 }
751 
752 /*--preProcParameter : should be re-defined in derived class to select what histograms and parameters
753  should go into procParameter*/
755 {
756  ATH_MSG_DEBUG( "CscCalibMonToolBase : in preProcParameter" );
757  return StatusCode::SUCCESS;
758 }
759 
760 
761 /*--procParameter : processes parameter based upon the "set" structs which will be
762  defined in the user's preProcParameter.
763 
764  The "processing" done here is simply to retrieve all the new new parameter values, retrieve their
765  corresponding last values from COOL, and find their difference. The value, the old value, and the
766  difference are all put into arrays. These arrays should be passed by the user in handleParameter to copyDataToHists.
767 
768  Also inside procParameter, we fill the badHist if we see any problems. We also report any channels missing from the input values.
769  */
771  ProcSetupInfo *procParameterInput)
772 {
773  ATH_MSG_DEBUG( "Entering proc parameter for " << parVals->parName() << ". Max diff " << procParameterInput->maxDiff << "." );
774  if (procParameterInput->doChi2)
775  ATH_MSG_DEBUG( " Will retrieve chi2 with expected max of " << procParameterInput->chi2Max );
776 
777  //Start with expected channels, remove whenever one is found, leftover are
778  //missing channels
779  std::set<int> missingChannels = procParameterInput->expectedChannels;
780 
782  const CscCondDbData* readCdo{*readHandle};
783 
784  //--Cycle through values and fill histograms
785  int numFailures = 0, maxFailures = 10;
786  for(const CscCalibResult* chan: *parVals)
787  {
788  const int hashId = chan->hashId();
789  const float val = chan->value();
790  const float error = chan->error();
791  float oldVal = 0;
792 
793  //This channel isn't missing
794  missingChannels.erase(hashId);
795 
796  //--Compare measured value with an expected value---------------------
797  if(procParameterInput->dbName != "")
798  {
799  //Get expected value from database
800  if(!(readCdo->readChannelParam(hashId, oldVal, procParameterInput->dbName)).isSuccess())
801  {
802  numFailures++;
803  ATH_MSG_WARNING( "CscCalibMonToolBase : Failed to retrieve parameter"
804  << " for channel " << hashId
805  << " from COOL database. Continuing with COOL value = 0"
806  );
807  if(numFailures==maxFailures)
808  {
809  ATH_MSG_FATAL( "CscCalibMonToolBase : "
810  << maxFailures << " failed retrievals. Quiting. " );
811  return StatusCode::FAILURE;
812  }
813  }
814  }
815  else
816  {
817  //No value in database, compare to provided expected value
818  oldVal = procParameterInput->expectedVal;
819  }
820 
821  float diff = val - oldVal;
822 
823  bool isBad = false;
824  if( std::abs(diff) > procParameterInput->maxDiff)
825  {
826  ATH_MSG_INFO( "CscCalibMonToolBase : Possible problem! " << parVals->parName()
827  << " measurement of " << val << " varies by " << diff
828  << " from expected value of " << oldVal << " on channel with hash Id "
829  << hashId << ". Specified maximum variance is " << procParameterInput->maxDiff );
830  isBad = true;
831  procParameterInput->badHist->Fill(procParameterInput->badBin); //Too high a difference
832  }
833 
834  float chi2_ndf = 0;
835  if(procParameterInput->doChi2)
836  {
837  chi2_ndf = chan->chi2()/chan->ndf();
838  if(chi2_ndf > procParameterInput->chi2Max)
839  {
840  procParameterInput->badHist->Fill(procParameterInput->chi2BadBin);
841  isBad = true;
842  }
843  }
844 
845  //If there is a bad channel, specify that we want details about it.
846  if( isBad && ( (int)m_numBad <= m_maxDetailedChannels || m_maxDetailedChannels < 0 ) )
847  {
848  if(!m_detailedHashIds[hashId])
849  {
850  m_numBad++;
851  m_detailedHashIds[hashId] = true; //Look closer at this hash id (used in derived class)
852  }
853  }
854 
855  (*procParameterInput->vals)[hashId] = val;
856  if((procParameterInput->errors->size()))
857  (*procParameterInput->errors)[hashId] = error;
858  if(procParameterInput->oldVals)
859  (*procParameterInput->oldVals)[hashId] = oldVal;
860  if(procParameterInput->diffs)
861  (*procParameterInput->diffs)[hashId] = diff;
862  if(procParameterInput->doChi2)
863  (*procParameterInput->chi2s)[hashId] = chi2_ndf;
864  //--Print out values channel-by channel sorted by Hash Id-------------------
865  }//End chanItr loop
866 
867  if(missingChannels.size() !=0)
868  {
869  for(const auto & thisChan: missingChannels)
870  {
871  if(procParameterInput->missingChans != nullptr)
872  {
873  //If we haven't already noticed that this channel is missing,
874  //increment missing bad bin in badHist.
875  if(!procParameterInput->missingChans->GetBinContent(thisChan+1))
876  procParameterInput->badHist->Fill(procParameterInput->missingBadBin);
877  //Always fill missingChans histogram
878  procParameterInput->missingChans->Fill(thisChan);
879 
880  }
881  }
882  }
883  return StatusCode::SUCCESS;
884 }
885 
886 
887 /*--makeLayHists : Takes data vector filled in procParameter and fills layer histograms
888  */
890 {
891 
892  //Determine what histograms we'll make:
893  bool doSpec = true; //(histCollection->cscSpec != NULL);
894  bool doHash = (histCollection->hashHist != nullptr && m_makeHashHists);
895  bool doAllChan1d = (histCollection->allChan1dHistX != nullptr && histCollection->allChan1dHistY != nullptr && m_makeAllChan1dHists);
896  bool doAllChan2d = (histCollection->allChan2dHist != nullptr && m_makeAllChan2dHists);
897  bool doLayChan = (histCollection->layHistVect != nullptr && m_makeLayHists);
898  bool doLaySummary = (histCollection->laySummVect != nullptr && m_makeLaySummHists);
899  bool doChamAvg = (histCollection->chamProf != nullptr && m_makeChamProfs);
900  bool doChamChan = (histCollection->chamSummVect != nullptr && m_makeChamHists);
901  bool doChamSummary = (histCollection->chamSummVect != nullptr && m_makeChamSummHists);
902  bool doErrors = (histCollection->errors.size() != 0); //Changed to a vector, so this
903  // is best way to check at moment
904 
905  ATH_MSG_DEBUG( "Copying data to hist collection, doing: All Channels (hash view):"
906  << (int)doHash
907  << "All Channels (1d view) " << (int)doHash
908  << "All Channels (2d view) " << (int)doHash
909  << " layer overview " << (int)doLayChan
910  << " layer spectrum " << (int)doLaySummary
911  << " sector prof " << (int)doChamAvg
912  << " chamber overview " << (int)doChamChan
913  << " chamber spectrum " << (int)doChamSummary
914  );
915 
916  //For shorter lines:
917  std::vector<float> & data = histCollection->data;
918  std::vector<float> & errors = histCollection->errors;
919 
920  //Loop through all channels, and copy relevant data from channel to histogram.
921  const std::vector<Identifier> & ids = m_idHelperSvc->cscIdHelper().idVector();
922  for(const auto & thisChamberId:ids)
923  {
924  IdentifierHash chamHash;
925  m_idHelperSvc->cscIdHelper().get_module_hash(thisChamberId,chamHash);
926  ATH_MSG_DEBUG( "Copying data to histograms for chamber with hash" << (int)chamHash );
927 
928  unsigned int stationSize = m_idHelperSvc->cscIdHelper().stationName(thisChamberId); //51 = large, 50 = small
929 
930  unsigned int stationPhi = m_idHelperSvc->cscIdHelper().stationPhi(thisChamberId);
931  int stationEta = m_idHelperSvc->cscIdHelper().stationEta(thisChamberId);
932  unsigned int sector = getSector(stationPhi,stationSize);
933  int sectorIndex = sector * stationEta; //Histogram will go from -16 to +16. Bin 0 ignored.
934 
935 
936 
937  std::vector<Identifier> stripVect;
938  m_idHelperSvc->cscIdHelper().idChannels(thisChamberId,stripVect);
939 
940  for(const auto & thisStrip:stripVect)
941  {
942  unsigned int chamberLayer = m_idHelperSvc->cscIdHelper().chamberLayer(thisStrip);
943  if(chamberLayer != 2)
944  continue;
945  int measuresPhi = m_idHelperSvc->cscIdHelper().measuresPhi(thisStrip);
946  if(histCollection->ignoreY && measuresPhi)
947  continue;
948 
949  IdentifierHash stripHash;
950  m_idHelperSvc->cscIdHelper().get_channel_hash(thisStrip,stripHash);
951  unsigned int layer = m_idHelperSvc->cscIdHelper().wireLayer(thisStrip);
952  unsigned int strip = m_idHelperSvc->cscIdHelper().strip(thisStrip);
953  float secLayer = (((float)stationEta*sector) + 0.2 * ((float)layer - 1) + 0.1);
954  float datum = data.at(stripHash);
955 
956  ATH_MSG_VERBOSE( "Filling all chan for sector: " << sector
957  << "\tlayer: " << layer << "\tstationEta: " << stationEta
958  << "\tsecLayer: " << secLayer
959  << "\tdata: " << datum );
960 
961  if(doSpec) {
962  histCollection->cscSpec[measuresPhi]->Fill(datum);
963  }
964  if(doHash)
965  {
966  //copy data array directly to hash histogram with all channels
967  histCollection->hashHist->Fill(stripHash,datum);
968  }
969 
970  if(doAllChan1d)
971  {
972  ATH_MSG_VERBOSE( "Filling 1d chan for sector: " << sector
973  << "\tlayer: " << layer << "\tstationEta: " << stationEta
974  << "\tsecLayer: " << secLayer
975  << "\tdata: " << datum );
976  if(measuresPhi){
977 
978  double modifiedStripNum =
979  (stationEta *sector)
980  + (layer-1)*.25
981  + ((strip-1) * .25 /(48))
982  ;
983 
984  ATH_MSG_VERBOSE( "Modified strip num: " << modifiedStripNum );
985  //copy data array directly to 1d histogram with all channels
986  histCollection->allChan1dHistY->Fill(
987  modifiedStripNum, datum);
988  } else {
989  double modifiedStripNum =
990  (stationEta *sector)
991  + (layer-1)*.25
992  + ((strip-1) * .25 /(192 ))
993  ;
994 
995  //copy data array directly to 1d histogram with all channels
996  histCollection->allChan1dHistX->Fill(
997  modifiedStripNum, datum);
998  }
999  }
1000 
1001  if(doAllChan2d)
1002  {
1003  ATH_MSG_VERBOSE( "Filling 2d chan for sector: " << sector
1004  << "\tlayer: " << layer << "\tstationEta: " << stationEta
1005  << "\tsecLayer: " << secLayer
1006  << "\tdata: " << datum );
1007 
1008  //copy data array directly to 2d histogram with all channels
1009  int modifiedStripNum = static_cast<int>(strip) * (measuresPhi ? -1 : 1);
1010  histCollection->allChan2dHist->Fill(
1011  modifiedStripNum, secLayer, std::abs(datum));
1012  }
1013 
1014  int layIndex = getLayIndex(measuresPhi,stationEta,sector,layer);
1015  int chamIndex = getChamIndex(measuresPhi,stationEta,sector);
1016  if(doLayChan)
1017  {
1018  //Copy values from data array for this layer to layer histogram
1019  (*(histCollection->layHistVect))[layIndex]->SetBinContent(strip,datum);
1020  if(doErrors)
1021  (*(histCollection->layHistVect))[layIndex]->SetBinError(strip,errors.at(stripHash));
1022  }
1023  if(doLaySummary)
1024  {
1025  //Histogram values for this layer
1026  (*(histCollection->laySummVect))[layIndex]->Fill(datum);
1027 
1028  }
1029  if(doChamAvg)
1030  {
1031  //Keeps track of average value for each chamber.
1032  histCollection->chamProf->Fill(sectorIndex,datum);
1033  }
1034  if(doChamSummary)
1035  {
1036  //histogram values for this chamber
1037  (*(histCollection->chamSummVect))[chamIndex]->Fill(datum);
1038  }
1039  if(doChamChan)
1040  {
1041  int shiftedStrip = strip + (layer-1)*( measuresPhi ? 50 : 200);
1042  //Copy values from data array for this chamber to chamber histogram
1043  (*(histCollection->chamHistVect))[chamIndex]->SetBinContent(shiftedStrip,datum);
1044  if(doErrors)
1045  (*(histCollection->chamHistVect))[chamIndex]->SetBinError(shiftedStrip,errors.at(stripHash));
1046  }
1047  }//end strip loop
1048  }//end chamber loop
1049 
1050  //probably should put this in its own function at some point
1051 
1052  return StatusCode::SUCCESS;
1053 }
1054 
1055 int CscCalibMonToolBase::getLayIndex(int measuresPhi, int stationEta, int sector, int layer)
1056 {
1057  int layIndex = measuresPhi*32*4
1058  + ((stationEta ==1) ? 16*4 : 0)
1059  + (sector-1)*4
1060  + layer -1;
1061  return layIndex;
1062 }
1063 
1064 int CscCalibMonToolBase::getChamIndex(int measuresPhi, int stationEta, int sector)
1065 {
1066  int chamIndex = measuresPhi*32
1067  + ((stationEta ==1) ? 16 : 0)
1068  + (sector-1);
1069  return( chamIndex);
1070 }
1071 
1073 {
1074  //stationSize : 50 = CSS, 51 = CSL
1075  //Sector 1 : large with athena's stationPhi = 1 (onlinePhi = 0)
1076  //Sector 2 : small with athenas stationPhi = 1 (onlinePhi = 0)
1077  //Sector 3 : large with athenas stationPhi = 2 (onlinePhi = 1)
1078  //etc...
1079  return(2*stationPhi + 50 - stationSize);
1080  //return(2*stationPhi + stationSize - 51);
1081 }
1082 
1083 
1085 {
1086  if(eta ==1)
1087  return "A";
1088  if(eta == -1)
1089  return "C";
1090  return "ERROR";
1091 }
1092 
1093 //Geo path creates a directory structure for a histogram based upon where it is in the CSC geometry.
1094 //The user fills the data down as far as they like. For example, just filling in eta and sector will provide
1095 //a path for a sector-wide histogram.
1096 //This provides a centralized location to change the layout of the root output file.
1097 std::string CscCalibMonToolBase::getGeoPath( int eta, int sector, int wireLayer, int measuresPhi, int channel )
1098 {
1099  std::stringstream ss;
1100 
1101  static const std::string histStr = "/_hists";
1102  static const std::string errorDir = "/ERROR";
1103 
1104  ss << std::setfill('0');//so we can have uniform numbers
1105 
1106 
1107  if( eta == -9999 ) //CSC Wide
1108  {
1109  ss << "/CscOverview";
1110  return ss.str();
1111  }
1112 
1113  std::string endCap = getEndCap(eta);
1114  if(endCap == "ERROR")
1115  {
1116  ATH_MSG_ERROR( "Eta " << eta << " is invalid. " );
1117  return errorDir;
1118  }
1119 
1120  ss << "/EndCap" << endCap;
1121 
1122  if(sector == -9999) //Endcap Histogram
1123  {
1124  ss << histStr;
1125  return ss.str();
1126  }
1127 
1128  if(sector <1 || sector > 16)
1129  {
1130  ATH_MSG_ERROR( "Sector " << sector << " is invalid. " );
1131  return errorDir;
1132  }
1133 
1134  ss << "/Sector" << std::setw(2) << sector;
1135 
1136  if(wireLayer == -9999)//Sector (chamber) wide histrogram
1137  {
1138  ss << histStr;
1139  return ss.str();
1140  }
1141 
1142  if(wireLayer < 1 || wireLayer > 4)
1143  {
1144  ATH_MSG_ERROR( "WireLayer " << wireLayer << " is invalid." );
1145  return errorDir;
1146  }
1147 
1148  ss << "/Layer" << wireLayer;
1149 
1150  if(measuresPhi == -9999)//Layer wide histrogram
1151  {
1152  ss << histStr;
1153  return ss.str();
1154  }
1155 
1156  if(measuresPhi < 0 || measuresPhi > 1)
1157  {
1158  ATH_MSG_ERROR( "MeasuresPhi " << measuresPhi << " is invalid." );
1159  return errorDir;
1160  }
1161 
1162  ss << (measuresPhi ? "/Phi" : "/Eta");
1163  if(channel == -9999) //LayerDirection wide histogram
1164  {
1165  /* Channel histograms don't work (too much memory used by meta data tree), so layer is now our most detailed channel. No need for histStr.
1166  ss << histStr;*/
1167  return ss.str();
1168  }
1169 
1170  if( channel < 1 || (measuresPhi && channel > 48) || (!measuresPhi && channel > 192))
1171  {
1172  ATH_MSG_ERROR( "Channel " << channel << " is invalid for a " << (measuresPhi ? "phi layers" : "eta layer") );
1173  return errorDir;
1174  }
1175 
1176 
1177  ss << "/Channel" << std::setw( measuresPhi ? 2 : 3 ) << channel;
1178 
1179  return ss.str();
1180 }//end getGeoPath
1181 
1182 
1183 //Produces a full path for a histogram to be placed.
1184 std::string CscCalibMonToolBase::getFullPath(const std::string& geoPath, const std::string& histTypeDir, const std::string& parTypeDir)
1185 {
1186  std::stringstream ss;
1187 
1188  ss << m_generic_path_csccalibmonitoring << geoPath;
1189 
1190  if(histTypeDir != "")
1191  ss << "/" << histTypeDir;
1192 
1193  if(parTypeDir != "")
1194  ss << "/" << parTypeDir;
1195 
1196  return ss.str();
1197 }
CscCalibMonToolBase::m_expectedChamberLayer
unsigned int m_expectedChamberLayer
Definition: CscCalibMonToolBase.h:116
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
CscCalibMonToolBase::CscCalibMonToolBase
CscCalibMonToolBase(const std::string &type, const std::string &name, const IInterface *parent)
constructor
Definition: CscCalibMonToolBase.cxx:15
histCollection
Definition: LArQuickHistMerge.cxx:56
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
python.TIDAMonTool.monGroup
def monGroup(analysis_chain)
Definition: TIDAMonTool.py:297
CscCalibMonToolBase::getSector
virtual int getSector(int stationPhi, int stationSize)
Produces a sector number from the phi and size of a station.
Definition: CscCalibMonToolBase.cxx:1072
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
Muon::nsw::STGTPSegments::moduleIDBits::stationPhi
constexpr uint8_t stationPhi
station Phi 1 to 8
Definition: NSWSTGTPDecodeBitmaps.h:158
python.tests.PyTestsLib.finalize
def finalize(self)
_info( "content of StoreGate..." ) self.sg.dump()
Definition: PyTestsLib.py:50
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
ChangeHistoRange.lowBound
lowBound
Definition: ChangeHistoRange.py:29
CscCalibMonToolBase::m_histCol
int m_histCol
Hist colors.
Definition: CscCalibMonToolBase.h:154
CscCalibMonToolBase::bookHistograms
virtual StatusCode bookHistograms()
Standard function for a ManagedMonitorToolBase.
Definition: CscCalibMonToolBase.cxx:650
SiliconTech::strip
@ strip
athena.path
path
python interpreter configuration --------------------------------------—
Definition: athena.py:128
CscCalibMonToolBase::handleParameter
virtual StatusCode handleParameter(const CscCalibResultCollection *parVals)
Should be written by user in derived class.
Definition: CscCalibMonToolBase.cxx:754
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
CscCalibMonToolBase::m_hashName
std::string m_hashName
Naming info.
Definition: CscCalibMonToolBase.h:136
CscCalibMonToolBase::ProcSetupInfo::chi2Max
float chi2Max
Definition: CscCalibMonToolBase.h:194
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:24
CscCalibMonToolBase::postProc
virtual StatusCode postProc()
Run after handleParameter.
Definition: CscCalibMonToolBase.cxx:734
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
CscCalibMonToolBase::ProcSetupInfo::expectedVal
float expectedVal
Definition: CscCalibMonToolBase.h:194
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
CscCalibMonToolBase::m_statDbColl
HistCollection * m_statDbColl
Definition: CscCalibMonToolBase.h:248
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
CscCalibMonToolBase.h
ManagedMonitorToolBase
Provides functionality for users to implement and save histograms, ntuples, and summary data,...
Definition: ManagedMonitorToolBase.h:73
dumpTgcDigiDeadChambers.stationName
dictionary stationName
Definition: dumpTgcDigiDeadChambers.py:30
CscCalibResult
Definition: CscCalibResult.h:19
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
ChangeHistoRange.highBound
highBound
Definition: ChangeHistoRange.py:30
CscCalibMonToolBase::HistCollection::data
std::vector< float > data
Definition: CscCalibMonToolBase.h:231
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
CscCalibMonToolBase::bookHistCollection
virtual StatusCode bookHistCollection(HistCollection *histCollection, std::string dataTypeName, std::string dataTypeTitle, std::string categoryName, std::string categoryTitle, std::string axisLabel, int numBins, float lowBound, float highBound, std::string parDir="", uint16_t toSkip=0)
Initializes the histograms in a histCollection and books them.
Definition: CscCalibMonToolBase.cxx:139
plotmaker.hist
hist
Definition: plotmaker.py:148
CscCalibMonToolBase::m_readKey
SG::ReadCondHandleKey< CscCondDbData > m_readKey
Access to COOL database.
Definition: CscCalibMonToolBase.h:171
CscCalibMonToolBase::getGeoPath
std::string getGeoPath(int eta=-9999, int sector=-9999, int wireLayer=-9999, int measuresPhi=-9999, int channel=-9999)
getGeoPath creates a directory structure for a histogram based upon where it is in the CSC geometry.
Definition: CscCalibMonToolBase.cxx:1097
CscCalibMonToolBase::fillHistograms
virtual StatusCode fillHistograms()
Standard function for a ManagedMonitorToolBase.
Definition: CscCalibMonToolBase.cxx:699
CscCalibMonToolBase::m_doStatDb
bool m_doStatDb
Definition: CscCalibMonToolBase.h:247
CscCalibMonToolBase::getChamIndex
virtual int getChamIndex(int measuresPhi, int stationEta, int sector)
Produces a unique number for every secber in the detector.
Definition: CscCalibMonToolBase.cxx:1064
CscCalibMonToolBase::m_generic_path_csccalibmonitoring
std::string m_generic_path_csccalibmonitoring
Path of histograms.
Definition: CscCalibMonToolBase.h:157
CscCalibMonToolBase::m_chamHistTitle
std::string m_chamHistTitle
Definition: CscCalibMonToolBase.h:149
CscCalibMonToolBase::m_laySummHistTitle
std::string m_laySummHistTitle
Definition: CscCalibMonToolBase.h:151
CscCalibMonToolBase::m_expectedHashIdsPrec
std::set< int > m_expectedHashIdsPrec
Definition: CscCalibMonToolBase.h:133
mc.diff
diff
Definition: mc.SFGenPy8_MuMu_DD.py:14
checkFileSG.toSkip
def toSkip(inpName)
Definition: checkFileSG.py:22
CscCalibMonToolBase::checkHists
virtual StatusCode checkHists(bool fromFinalise)
Standard function for a ManagedMonitorToolBase.
Definition: CscCalibMonToolBase.cxx:744
CscCalibMonToolBase::ProcSetupInfo::chi2s
std::vector< float > * chi2s
Definition: CscCalibMonToolBase.h:199
CscCalibMonToolBase::m_maxDetailedChannels
int m_maxDetailedChannels
To keep track of channels that should have more data printed to root file.
Definition: CscCalibMonToolBase.h:128
CscCalibMonToolBase::getFullPath
std::string getFullPath(const std::string &geoPath, const std::string &histTypeDir, const std::string &parTypeDir)
Geo path creates a directory structure for a histogram based upon its geoPath, the hist type dir (spe...
Definition: CscCalibMonToolBase.cxx:1184
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
CscCalibMonToolBase::ProcSetupInfo::badBin
int badBin
Definition: CscCalibMonToolBase.h:193
histCollection::size
size_t size()
Definition: LArQuickHistMerge.cxx:62
CscCalibMonToolBase::m_makeHashHists
bool m_makeHashHists
Data output options.
Definition: CscCalibMonToolBase.h:120
python.TrigEgammaMonitorHelper.TH2F
def TH2F(name, title, nxbins, bins_par2, bins_par3, bins_par4, bins_par5=None, bins_par6=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:45
CscCalibMonToolBase::m_makeAllChan2dHists
bool m_makeAllChan2dHists
Definition: CscCalibMonToolBase.h:120
CscCalibMonToolBase::m_chamSummHistName
std::string m_chamSummHistName
Definition: CscCalibMonToolBase.h:146
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
CscCalibMonToolBase::m_maxChamId
unsigned int m_maxChamId
Definition: CscCalibMonToolBase.h:114
CscCalibMonToolBase::m_detailedHashIds
bool * m_detailedHashIds
Definition: CscCalibMonToolBase.h:129
CscCalibMonToolBase::ProcSetupInfo::oldVals
std::vector< float > * oldVals
Definition: CscCalibMonToolBase.h:199
CscCalibMonToolBase::procParameter
virtual StatusCode procParameter(const CscCalibResultCollection *parVals, ProcSetupInfo *simpleSet)
Processors a parameter type.
Definition: CscCalibMonToolBase.cxx:770
CscCalibMonToolBase::m_makeLaySummHists
bool m_makeLaySummHists
Definition: CscCalibMonToolBase.h:121
CscCalibMonToolBase::ProcSetupInfo::expectedChannels
std::set< int > expectedChannels
Definition: CscCalibMonToolBase.h:195
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
ManagedMonitorToolBase::MonGroup
A container of information describing a monitoring object.
Definition: ManagedMonitorToolBase.h:137
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
CscCalibMonToolBase::ProcSetupInfo::vals
std::vector< float > * vals
Definition: CscCalibMonToolBase.h:199
ManagedMonitorToolBase::initialize
virtual StatusCode initialize()
Definition: ManagedMonitorToolBase.cxx:617
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
CscCalibMonToolBase::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: CscCalibMonToolBase.h:168
python.TrigEgammaMonitorHelper.TProfile
def TProfile(*args, **kwargs)
Definition: TrigEgammaMonitorHelper.py:81
ReadCellNoiseFromCool.chan
chan
Definition: ReadCellNoiseFromCool.py:52
CscCalibMonToolBase::m_expectedHashIdsAll
std::set< int > m_expectedHashIdsAll
Definition: CscCalibMonToolBase.h:133
CscCalibMonToolBase::ProcSetupInfo::missingChans
TH1F * missingChans
Definition: CscCalibMonToolBase.h:192
CscCalibMonToolBase::procHistograms
virtual StatusCode procHistograms()
At end of run this processes the calibration results and fills the histograms.
Definition: CscCalibMonToolBase.cxx:708
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
CscCalibMonToolBase::m_doAllDetailed
bool m_doAllDetailed
Definition: CscCalibMonToolBase.h:123
CscCalibMonToolBase::ProcSetupInfo::doChi2
bool doChi2
Definition: CscCalibMonToolBase.h:196
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
covarianceTool.title
title
Definition: covarianceTool.py:542
test_pyathena.parent
parent
Definition: test_pyathena.py:15
CscCalibMonToolBase::ProcSetupInfo::dbName
std::string dbName
Definition: CscCalibMonToolBase.h:197
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CscCalibMonToolBase::m_allChan2dTitle
std::string m_allChan2dTitle
Definition: CscCalibMonToolBase.h:141
CscCalibMonToolBase::HistCollection
Contains an array with data on a per-channel basis, as well as various histograms that give different...
Definition: CscCalibMonToolBase.h:205
CscCalibMonToolBase::m_hashTitle
std::string m_hashTitle
Definition: CscCalibMonToolBase.h:137
CscCalibResultCollection::parName
const std::string & parName() const
the identify of this collection
Definition: CscCalibResultCollection.cxx:11
run
Definition: run.py:1
ManagedMonitorToolBase::ATTRIB_MANAGED
@ ATTRIB_MANAGED
Definition: ManagedMonitorToolBase.h:130
CscCalibMonToolBase::m_layHistTitle
std::string m_layHistTitle
Definition: CscCalibMonToolBase.h:145
CscCalibMonToolBase::m_chamProfTitle
std::string m_chamProfTitle
Definition: CscCalibMonToolBase.h:143
CscCalibMonToolBase::m_layHistName
std::string m_layHistName
Definition: CscCalibMonToolBase.h:144
checkRpcDigits.allGood
bool allGood
Loop over the SDOs & Digits.
Definition: checkRpcDigits.py:171
CscCalibResultContainer
Definition: CscCalibResultContainer.h:22
CscCalibMonToolBase::ProcSetupInfo::badHist
TH1I * badHist
Definition: CscCalibMonToolBase.h:190
CscCalibMonToolBase::m_makeChamHists
bool m_makeChamHists
Definition: CscCalibMonToolBase.h:122
mergePhysValFiles.errors
list errors
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:43
CscCalibMonToolBase::bookLayHists
virtual StatusCode bookLayHists(std::string histTypeDir, std::string parTypeDir, std::vector< TH1F * > &vector, std::string namePrefix, std::string titlePrefix, std::string xaxis, std::string yaxis, bool chanView=true, bool ignoreY=false, unsigned int numBins=100, float lowBound=0, float highbound=100)
Books a vector of histograms where each one corresponds to a layer of the CSC secbers.
Definition: CscCalibMonToolBase.cxx:431
CscCalibMonToolBase::initialize
virtual StatusCode initialize()
initializes services, tools, etc.
Definition: CscCalibMonToolBase.cxx:61
CscCalibMonToolBase::m_allChan2dName
std::string m_allChan2dName
Definition: CscCalibMonToolBase.h:140
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
python.subdetectors.mmg.ids
ids
Definition: mmg.py:8
CscCalibMonToolBase::ProcSetupInfo::diffs
std::vector< float > * diffs
Definition: CscCalibMonToolBase.h:199
CscCalibMonToolBase::m_allChan1dTitle
std::string m_allChan1dTitle
Definition: CscCalibMonToolBase.h:139
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
CscCalibMonToolBase::ProcSetupInfo::missingBadBin
int missingBadBin
Definition: CscCalibMonToolBase.h:193
CscCalibMonToolBase::m_makeLayHists
bool m_makeLayHists
Definition: CscCalibMonToolBase.h:120
CscCalibMonToolBase::ProcSetupInfo::errors
std::vector< float > * errors
Definition: CscCalibMonToolBase.h:199
CscCalibMonToolBase::copyDataToHists
virtual StatusCode copyDataToHists(HistCollection *histCollection)
Fills the histograms in the histCollection based on the data in the std::vector in the HistCollection...
Definition: CscCalibMonToolBase.cxx:889
CscCalibMonToolBase::ProcSetupInfo
Definition: CscCalibMonToolBase.h:180
CscCalibMonToolBase::m_allChan1dName
std::string m_allChan1dName
Definition: CscCalibMonToolBase.h:138
CscCalibMonToolBase::ProcSetupInfo::chi2BadBin
int chi2BadBin
Definition: CscCalibMonToolBase.h:193
CscCalibMonToolBase::getLayIndex
virtual int getLayIndex(int measuresPhi, int stationEta, int sector, int layer)
produces a unique number for every layer in the detector
Definition: CscCalibMonToolBase.cxx:1055
CscCalibMonToolBase::m_makeChamSummHists
bool m_makeChamSummHists
Definition: CscCalibMonToolBase.h:122
CscCalibResultCollection
Definition: CscCalibResultCollection.h:24
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
CscCalibMonToolBase::m_chamHistName
std::string m_chamHistName
Definition: CscCalibMonToolBase.h:148
CscCalibMonToolBase::bookChamHists
virtual StatusCode bookChamHists(std::string histTypeDir, std::string parTypeDir, std::vector< TH1F * > &histVector, std::string namePrefix, std::string titlePrefix, std::string xaxis="", std::string yaxis="", bool chanView=true, bool ignoreY=false, unsigned int numBins=100, float lowBound=0, float highbound=100)
Books a vector of histograms where each one corresponds to a secber of the CSC secbers.
Definition: CscCalibMonToolBase.cxx:546
ManagedMonitorToolBase::endOfRunFlag
bool endOfRunFlag() const
Definition: ManagedMonitorToolBase.h:797
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
CscCalibMonToolBase::m_maxHashId
unsigned int m_maxHashId
Definition: CscCalibMonToolBase.h:113
CscCalibMonToolBase::m_makeChamProfs
bool m_makeChamProfs
Definition: CscCalibMonToolBase.h:121
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
CscCalibMonToolBase::ProcSetupInfo::maxDiff
float maxDiff
Definition: CscCalibMonToolBase.h:194
CscCalibMonToolBase::getEndCap
std::string getEndCap(int eta)
Gets the letter endcap (A or C) for a given eta index (1,-1)
Definition: CscCalibMonToolBase.cxx:1084
CscCalibMonToolBase::m_doBadDetailed
bool m_doBadDetailed
Definition: CscCalibMonToolBase.h:123
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24
Muon::nsw::STGTPSegments::moduleIDBits::stationEta
constexpr uint8_t stationEta
1 to 3
Definition: NSWSTGTPDecodeBitmaps.h:156
CscCalibMonToolBase::m_calibResultKey
std::string m_calibResultKey
Calibration result storegate key.
Definition: CscCalibMonToolBase.h:166
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
CscCalibMonToolBase::finalize
virtual StatusCode finalize()
deletes private members
Definition: CscCalibMonToolBase.cxx:130
get_generator_info.error
error
Definition: get_generator_info.py:40
error
Definition: IImpactPoint3dEstimator.h:70
IdContext
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition: IdContext.h:26
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
readCCLHist.float
float
Definition: readCCLHist.py:83
CscCalibMonToolBase::m_makeAllChan1dHists
bool m_makeAllChan1dHists
Definition: CscCalibMonToolBase.h:120
CscCalibMonToolBase::m_chamProfName
std::string m_chamProfName
Definition: CscCalibMonToolBase.h:142
CscCalibMonToolBase::m_laySummHistName
std::string m_laySummHistName
Definition: CscCalibMonToolBase.h:150
CscCondDbData
Definition: CscCondDbData.h:24
ManagedMonitorToolBase::newRunFlag
bool newRunFlag() const
Definition: ManagedMonitorToolBase.h:792
CscCalibMonToolBase::m_chamSummHistTitle
std::string m_chamSummHistTitle
Definition: CscCalibMonToolBase.h:147
CscCalibMonToolBase::m_numBad
unsigned int m_numBad
Definition: CscCalibMonToolBase.h:115