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