ATLAS Offline Software
Loading...
Searching...
No Matches
TileCellNoiseMonTool.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//
7// NAME: TileCellNoiseMonTool.cxx
8// PACKAGE: TileMonitoring
9//
10// Produce CellNoise folder in tilemon.root for monitoring cell noise
11// Input is RAW
12// Output:
13// -- Cell noise histos for each individual cell (possibly do not keep in the final tilemon.root)
14// -- 2D map histograms per partition/gain/ for sigma1, sigma2, R, chi2, chi2prb, RMS, RMS/Sigma1
15//
16// AUTHOR: Christophe Clement largely (inspired from TileCellMonTool.cxx)
17//
18//
19// ********************************************************************
20
22#include "PairBuilder.h"
23
25
29#include "TileEvent/TileCell.h"
30
31#include "TH1F.h"
32#include "TH2F.h"
33#include "TF1.h"
34#include "TProfile.h"
35#include "TProfile2D.h"
36#include "TString.h"
37
38#include <sstream>
39#include <iomanip>
40#include <iostream>
41#include <map>
42
43
44
45/*---------------------------------------------------------*/
46TileCellNoiseMonTool::TileCellNoiseMonTool(const std::string & type, const std::string & name, const IInterface* parent)
47 : TileFatherMonTool(type, name, parent)
48 , m_tileBadChanTool("TileBadChanTool")
49 //, m_TileCellTrig(0U)
50 //, m_delta_lumiblock(0U)
51 //, m_oldLumiblock(-1)
52 , m_isFirstEvent(true)
53 , m_mapSigma1{}
54 , m_mapSigma2{}
55 , m_mapR{}
56 , m_mapChi2{}
57 , m_mapChi2prb{}
58 , m_mapRmsOsig{}
59 , m_mapRms{}
60 , m_hPartition1(0)
61 , m_hPartition2(0)
66
67
68/*---------------------------------------------------------*/
69{
70 declareInterface<IMonitorToolBase>(this);
71
72 declareProperty("cellsContainerName" , m_cellsContName="AllCalo"); //SG Cell Container
73 declareProperty("doOnline" , m_doOnline=false); //online mode
74 declareProperty("TileBadChanTool" , m_tileBadChanTool);
75 declareProperty("Xmin" , m_xMin = -1000. ); //xmin for the single cell noise histos
76 declareProperty("Xmax" , m_xMax = 1000. ); //xmax for the single cell noise histos
77
78 m_path = "/Tile/CellNoise";
79
80}
81
82/*---------------------------------------------------------*/
84/*---------------------------------------------------------*/
85{
86}
87
88/*---------------------------------------------------------*/
90/*---------------------------------------------------------*/
91
92 ATH_MSG_INFO( "in initialize()" );
93
94 //=== get TileBadChanTool
95 CHECK( m_tileBadChanTool.retrieve() );
96
97 ATH_MSG_INFO( "in TileCellNoiseMonTool::initialize (...) " );
98 ATH_MSG_INFO( " - m_path = " << m_path );
99
101}
102
103
104/*---------------------------------------------------------*/
106/*---------------------------------------------------------*/
107
108 ATH_MSG_INFO( "in bookCellNoiseHistos()" );
109 ATH_MSG_INFO( " - m_path = " << m_path );
110
111 // Create a vector of Long Barrel Cell CellName+CellID
112 const int NLBCells = 23;
113 std::string LBCellName[NLBCells] = {
114 "A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9", "A10",
115 "B1", "B2", "B3", "B4", "B5", "B6", "B7", "B8", "B9",
116 "D0", "D1", "D2", "D3"
117 };
118
119 const int NEBCells = 18;
120 std::string EBCellName[NEBCells] = {
121 "A12", "A13", "A14", "A15", "A16",
122 "B11", "B12", "B13", "B14", "B15",
123 "D4", "D5", "D6",
124 "E1", "E2", "E3", "E4", "C10"
125 };
126
127 // follows TileFatherMonTool.cxx/h m_ros2partition and m_partition2ros conventions
128 const int Npartitions = 4;
129 std::string PartitionName[Npartitions] = { "EBA", "LBA", "LBC", "EBC" };
130
131 const int Nmodules = 64;
132
133 std::string module_str;
134
135 std::string runNumStr = getRunNumStr();
136
137 char CellName[30];
138 char modName[10];
139
140 for (int imod = 0; imod < Nmodules; ++imod) {
141
142 std::ostringstream convert;
143 convert << imod + 1;
144
145 if (imod <= 8) {
146 module_str = "0" + convert.str();
147 }
148 if (imod > 8) {
149 module_str = convert.str();
150 }
151
152 // MYHISTOS
153 // ""
154 // Long barrel cells
155 for (int icell = 0; icell < NLBCells; ++icell) {
156
157 m_tileCellEne[PartLBA][imod].push_back(
158 book1F("",
159 "CellNoise_" + PartitionName[PartLBA] + module_str + "_" + LBCellName[icell],
160 "TileCellNoise - Run " + runNumStr + " " + PartitionName[PartLBA] + module_str + " "
161 + LBCellName[icell], 100, m_xMin, m_xMax));
162
163
164 m_tileCellEne[PartLBC][imod].push_back(
165 book1F("",
166 "CellNoise_" + PartitionName[PartLBC] + module_str + "_" + LBCellName[icell],
167 "TileCellNoise - Run " + runNumStr + " " + PartitionName[PartLBC] + module_str + " "
168 + LBCellName[icell], 100, m_xMin, m_xMax));
169
170 } // icell
171
172 // Extended barrel cells
173 for (int icell = 0; icell < NEBCells; ++icell) {
174
175 m_tileCellEne[PartEBA][imod].push_back(
176 book1F("",
177 "CellNoise_" + PartitionName[PartEBA] + module_str + "_" + EBCellName[icell],
178 "TileCellNoise - Run " + runNumStr + " " + PartitionName[PartEBA] + module_str + " "
179 + EBCellName[icell], 100, m_xMin, m_xMax));
180
181 m_tileCellEne[PartEBC][imod].push_back(
182 book1F("",
183 "CellNoise_" + PartitionName[PartEBC] + module_str + "_" + EBCellName[icell],
184 "TileCellNoise Run " + runNumStr + " " + PartitionName[PartEBC] + module_str + " "
185 + EBCellName[icell], 100, m_xMin, m_xMax));
186
187 } // icell
188
189 } // module
190
191 m_hPartition1 = book1F ("" , "h_partitions1","partitions1", 8, -2., 6.);
192 m_hPartition2 = book1F ("" , "h_partitions2","partitions1", 8, -2., 6.);
193 m_h2Partition0 = book2F ("" , "h2_partition0","h2_partition0", 100, -2., 2., 100, 0, 6.28);
194 m_h2Partition1 = book2F ("" , "h2_partition1","h2_partition1", 100, -2., 2., 100, 0, 6.28);
195 m_h2Partition2 = book2F ("" , "h2_partition2","h2_partition2", 100, -2., 2., 100, 0, 6.28);
196 m_h2Partition3 = book2F ("" , "h2_partition3","h2_partition3", 100, -2., 2., 100, 0, 6.28);
197
198 for (int ipart = 0; ipart < 4; ++ipart) {
199 m_mapSigma1[ipart] = book2F("", "map_sigma1_" + PartitionName[ipart]
200 , "Sigma 1 - " + PartitionName[ipart], 23, 0., 23., 65, 0., 65.);
201
202 m_mapSigma2[ipart] = book2F("", "map_sigma2_" + PartitionName[ipart]
203 , "Sigma 2 - " + PartitionName[ipart], 23, 0., 23., 65, 0., 65.);
204
205 m_mapR[ipart] = book2F("", "map_R_" + PartitionName[ipart]
206 , "R (A_{1}/A_{2})- " + PartitionName[ipart], 23, 0., 23., 65, 0., 65.);
207
208 m_mapChi2[ipart] = book2F("", "map_chi2_" + PartitionName[ipart]
209 , "chi2 - " + PartitionName[ipart], 23, 0., 23., 65, 0., 65.);
210
211 m_mapChi2prb[ipart] = book2F("", "map_chi2prb_" + PartitionName[ipart]
212 , "chi2 prob. - " + PartitionName[ipart], 23, 0., 23., 65, 0., 65.);
213
214 m_mapRmsOsig[ipart] = book2F("", "map_rmsOsig_" + PartitionName[ipart]
215 , "RMS/ Sigma1 - " + PartitionName[ipart], 23, 0., 23., 65, 0., 65.);
216
217 m_mapRms[ipart] = book2F("", "map_rms_" + PartitionName[ipart]
218 , "RMS - " + PartitionName[ipart], 23, 0., 23., 65, 0., 65.);
219
220 // Set cell Names for LB partitions
221 if (PartitionName[ipart] == "LBA" || PartitionName[ipart] == "LBC") {
222 for (int icell = 0; icell < NLBCells; ++icell) {
223
224 sprintf(CellName, "%s ", LBCellName[icell].c_str());
225 m_mapSigma1[ipart]->GetXaxis()->SetBinLabel(icell + 1, CellName);
226 m_mapSigma2[ipart]->GetXaxis()->SetBinLabel(icell + 1, CellName);
227 m_mapR[ipart]->GetXaxis()->SetBinLabel(icell + 1, CellName);
228 m_mapChi2[ipart]->GetXaxis()->SetBinLabel(icell + 1, CellName);
229 m_mapChi2prb[ipart]->GetXaxis()->SetBinLabel(icell + 1, CellName);
230 m_mapRmsOsig[ipart]->GetXaxis()->SetBinLabel(icell + 1, CellName);
231 m_mapRms[ipart]->GetXaxis()->SetBinLabel(icell + 1, CellName);
232 } // icell
233 } // if ipart is Barrel
234 if (PartitionName[ipart] == "EBA" || PartitionName[ipart] == "EBC") {
235 for (int icell = 0; icell < NEBCells; ++icell) {
236
237 sprintf(CellName, "%s ", EBCellName[icell].c_str());
238 m_mapSigma1[ipart]->GetXaxis()->SetBinLabel(icell + 1, CellName);
239 m_mapSigma2[ipart]->GetXaxis()->SetBinLabel(icell + 1, CellName);
240 m_mapR[ipart]->GetXaxis()->SetBinLabel(icell + 1, CellName);
241 m_mapChi2[ipart]->GetXaxis()->SetBinLabel(icell + 1, CellName);
242 m_mapChi2prb[ipart]->GetXaxis()->SetBinLabel(icell + 1, CellName);
243 m_mapRmsOsig[ipart]->GetXaxis()->SetBinLabel(icell + 1, CellName);
244 m_mapRms[ipart]->GetXaxis()->SetBinLabel(icell + 1, CellName);
245 } // icell
246 } // if ipart is Barrel
248 for (int imod = 1; imod < 65; imod = imod + 2) {
249 sprintf(modName, "%s%s%i ", PartitionName[ipart].c_str(), (imod < 10 ? "0" : ""), imod);
250 m_mapSigma1[ipart]->GetYaxis()->SetBinLabel(imod + 1, modName);
251 m_mapSigma2[ipart]->GetYaxis()->SetBinLabel(imod + 1, modName);
252 m_mapR[ipart]->GetYaxis()->SetBinLabel(imod + 1, modName);
253 m_mapChi2[ipart]->GetYaxis()->SetBinLabel(imod + 1, modName);
254 m_mapChi2prb[ipart]->GetYaxis()->SetBinLabel(imod + 1, modName);
255 m_mapRmsOsig[ipart]->GetYaxis()->SetBinLabel(imod + 1, modName);
256 m_mapRms[ipart]->GetYaxis()->SetBinLabel(imod + 1, modName);
257 } // imod
258
259 } // ipart
260
261 return StatusCode::SUCCESS;
262} // bookCellNoiseHistos
263
264/*---------------------------------------------------------*/
266/*---------------------------------------------------------*/
267{
268 ATH_MSG_INFO( "in bookHistograms()" );
269 ATH_MSG_INFO( "--- m_path = " << m_path );
270
271 cleanHistVec(); //necessary to avoid problems at the run, evblock, lumi blocks boundaries
272 m_isFirstEvent = true;
273
274 // Use all triggers (if needs to be done per trigger type then move the booking to the fillhisto where we check the trigger)
275
276 if (bookCellNoiseHistos().isFailure()) {
277 ATH_MSG_WARNING( "Error with bookCellNoiseHistos() " );
278 }
279
280 return StatusCode::SUCCESS;
281}
282
283/*---------------------------------------------------------*/
285/*---------------------------------------------------------*/
286
287 for (int i = 0; i < 9; i++) {
288 m_activeTrigs[i] = -1;
289 }
290
291 for (int ipart = 0; ipart < 4; ++ipart) {
292 for (int imod = 0; imod < 64; ++imod) {
293 m_tileCellEne[ipart][imod].clear();
294 } // imod
295 } // ipart
296
297} // cleanHistVec
298
299/*---------------------------------------------------------*/
301/*---------------------------------------------------------*/
302
303 ATH_MSG_VERBOSE( "in do2GFit() " );
304
305 // check there is at least one histo to fit!
306 float xmin = -1000.;
307 float xmax = 1000.;
308
309 if (m_tileCellEne[0][0].size() == 0) {
310 ATH_MSG_WARNING( "in do2GFit() - m_TileCellEne[0][0] contains zero histogram - bailing out from 2G fit section " );
311 return;
312 }
313
314 TF1 fitfunction ("total", "gaus(0)+gaus(3)", xmin, xmax);
315 fitfunction.SetLineColor(2);
316
317 double fitresults[9] = {0};
318 double R, rmsOsig;
319 for (int ipart = 0; ipart < 4; ++ipart) {
320
321 for (int imod = 0; imod < 64; ++imod) {
322 // loop over cells
323 for (unsigned int icell = 0; icell < m_tileCellEne[ipart][imod].size(); ++icell) {
324 // fit the single cell energy distributions
325
326 ATH_MSG_VERBOSE( "in do2GFit() : ipart = " << ipart
327 << " imod = " << imod
328 << " icell = " << icell );
329
330 if (m_tileCellEne[ipart][imod][icell] != 0
331 && m_tileCellEne[ipart][imod][icell]->GetEntries() > 0) {
332
333 do2GFit(m_tileCellEne[ipart][imod][icell], fitresults, &fitfunction);
334 }
335
336 // then store the fitresults into a permanent container
337 ATH_MSG_VERBOSE( "Fit results:"
338 << " sigma1 = " << fitresults[2]
339 << " sigma2 = " << fitresults[5]
340 << " amp1 = " << fitresults[0]
341 << " amp2 = " << fitresults[3]
342 << " chi2 = " << fitresults[6]
343 << " chi2prb = " << fitresults[7]
344 << " CellRMS = " << fitresults[8] );
345
346
348
350 R = (fitresults[3] != 0) ? fitresults[0] / fitresults[3] : -1;
351 m_mapSigma1[ipart]->Fill((float) icell + 0.5, (float) imod + 1.5, fitresults[2]); // sigma 1
352 m_mapSigma2[ipart]->Fill((float) icell + 0.5, (float) imod + 1.5, fitresults[5]); // sigma 2
353 m_mapR[ipart]->Fill((float) icell + 0.5, (float) imod + 1.5, R); // R = Amp1/Amp2
354 m_mapChi2[ipart]->Fill((float) icell + 0.5, (float) imod + 1.5, fitresults[6]);
355 m_mapChi2prb[ipart]->Fill((float) icell + 0.5, (float) imod + 1.5, fitresults[7]);
356 rmsOsig = (fitresults[2] != 0) ? (fitresults[8] / fitresults[2]) : -1;
357 m_mapRmsOsig[ipart]->Fill((float) icell + 0.5, (float) imod + 1.5, rmsOsig);
358 m_mapRms[ipart]->Fill((float) icell + 0.5, (float) imod + 1.5, fitresults[8]);
359
360 } // icell
361
362 } // imodule
363
364 } // partition
365
366 return;
367}
368
369/*---------------------------------------------------------*/
370void TileCellNoiseMonTool::do2GFit(TH1F* h, double * fitresults, TF1* fitfunction) {
371/*---------------------------------------------------------*/
372
373 ATH_MSG_DEBUG( "entering do2GFit(TH1F* h, double * fitresults, TF1* fitfunction) = " << h->GetName() );
374
375 double par[6];
376
377 // start values for fit parameters should be the same as in the main reconstruction
378 float nentries = h->GetEntries();
379 float rms = h->GetRMS();
380
381 ATH_MSG_DEBUG( "in do2GFit(...) : nentries = " << nentries << ", rms = " << rms );
382
383 par[0] = 0.1 * nentries;
384 par[1] = 0.;
385 par[2] = 0.7 * rms;
386
387 par[3] = 0.15 * par[0];
388 par[4] = 0.;
389 par[5] = 5. * par[2];
390
391 fitfunction->SetParameters(par);
392
393 float bin = h->GetBinWidth(0);
394 float lim1 = bin;
395 float lim2 = std::max(rms * 1.05, bin * 2.0);
396 float lim3 = std::max(rms * 10.0, bin * 20.);
397
398 // ATH_MSG_DEBUG( "in do2GFit(...) : test1 " );
399
400 fitfunction->SetParLimits(0,0.,nentries);
401 // ATH_MSG_DEBUG( "in do2GFit(...) : test2 " );
402
403 fitfunction->FixParameter(1,0.);
404 fitfunction->SetParLimits(2,lim1,lim2);
405 // ATH_MSG_DEBUG( "in do2GFit(...) : test3 " );
406
407 fitfunction->SetParLimits(3,0.,nentries);
408 // ATH_MSG_DEBUG( "in do2GFit(...) : test4 " );
409
410 fitfunction->FixParameter(4,0.);
411 fitfunction->SetParLimits(5,lim2,lim3);
412 // ATH_MSG_DEBUG( "in do2GFit(...) : test5 " );
413
414 h->Fit(fitfunction, "B");
415
416 fitresults [0] = fitfunction->GetParameter(0);
417 fitresults [1] = fitfunction->GetParameter(1);
418 fitresults [2] = fitfunction->GetParameter(2);
419 fitresults [3] = fitfunction->GetParameter(3);
420 fitresults [4] = fitfunction->GetParameter(4);
421 fitresults [5] = fitfunction->GetParameter(5);
422 fitresults [6] = fitfunction->GetChisquare();
423
424// ATH_MSG_DEBUG( "in do2GFit(...) : chi2 = " << fitfunction->GetChisquare() );
425//
426// int NDF = fitfunction->GetNDF();
427// ATH_MSG_DEBUG( "in do2GFit(...) : NDF = " << NDF );
428//
429// double chi2prob = TMath::Prob(fitfunction->GetChisquare(), NDF);
430// ATH_MSG_DEBUG( "in do2GFit(...) : chi2prob = " << chi2prob );
431
432
433 //fitresults [7] = chi2prob; // fitfunction->GetProb();
434 fitresults[7] = fitfunction->GetProb();
435 fitresults[8] = h->GetRMS();
436
437 return;
438}
439
440
441/*---------------------------------------------------------*/
443/*---------------------------------------------------------*/
444
445
446 ATH_MSG_VERBOSE( "in fillHistoPerCell() " );
447
448 // transform a channel index into a CellIndex: -1 is a channel not connected to a cell
449 int LBch2cellID[48] = {
450 19, 0, 10, 10, 0, 1, 11, 11, 1, 2, 2, 12,
451 12, 20, 20, 3, 13, 13, 3, 4, 4, 14, 14, 5,
452 21, 21, 5, 15, 15, 6, -1, -1, 6, 16, 16, 7,
453 8, 8, 7, 17, 17, 22, 18, -1, 22, 9, 9, 18
454 };
455
456
457 int EBch2cellID[48] = {
458 15, 16, 10, 10, 17, 17, 0, 0, 5, 5, 1, 1,
459 13, 14, 6, 6, 11, 11, 15, 16, 2, 2, 7, 7,
460 -1, -1, -1, -1, -1, -1, 8, 3, 3, -1, -1, 8,
461 9, 12, 12, 9, 4, 4, -1, -1, -1, -1, -1, -1
462 };
463
464
465 const int NLBCells = 23;
466 std::string LBCellName[NLBCells] = {
467 "A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9", "A10",
468 "B1", "B2", "B3", "B4", "B5", "B6", "B7", "B8", "B9",
469 "D0", "D1", "D2", "D3"
470 };
471
472 const int NEBCells = 18;
473 std::string EBCellName[NEBCells] = {
474 "A12", "A13", "A14", "A15", "A16",
475 "B11", "B12", "B13", "B14", "B15",
476 "D4", "D5", "D6",
477 "E1", "E2", "E3", "E4", "C10"
478 };
479
480 // do we need to do something for the first event?
481 if (m_isFirstEvent) {
483 }
484
485 // Pointer to a Tile cell container
486 const CaloCellContainer* cell_container;
487
488 //Retrieve Cell collection from SG
489 CHECK( evtStore()->retrieve(cell_container, m_cellsContName) );
490
491 // Loop over calorimeter cells
492 CaloCellContainer::const_iterator iCell = cell_container->begin();
493 CaloCellContainer::const_iterator lastCell = cell_container->end();
494
495 for ( ; iCell != lastCell; ++iCell) {
496
497 const CaloCell * cell_ptr = *iCell; // pointer to cell object
498 Identifier id = cell_ptr->ID();
499
500 // Continue only if this is a TileCal Cell
501 if (m_tileID->is_tile(id)) {
502
503 const TileCell* tile_cell = dynamic_cast<const TileCell*>(cell_ptr);
504 if (tile_cell == 0) continue;
505
506 short ch1 = -1;
507 short ch2 = -1; // channel number, range 0-47 or -1 for unknown
508 int partition1 = -1;
509 int partition2 = -1;
510
511 const CaloDetDescrElement * caloDDE = tile_cell->caloDDE();
512
513 // note that m_ros2partition returns 0-4 following definition in TileFatherMonTool.h
514 IdentifierHash hash1 = caloDDE->onl1();
515 if (hash1 != TileHWID::NOT_VALID_HASH) {
516 HWIdentifier hw1 = m_tileHWID->channel_id(hash1);
517 ch1 = m_tileHWID->channel(hw1);
518 partition1 = m_ros2partition[m_tileHWID->ros(hw1)];
519 }
520
521 IdentifierHash hash2 = caloDDE->onl2();
522 if (hash2 != TileHWID::NOT_VALID_HASH) {
523 HWIdentifier hw2 = m_tileHWID->channel_id(hash2);
524 ch2 = m_tileHWID->channel(hw2);
525 partition2 = m_ros2partition[m_tileHWID->ros(hw2)];
526 }
527
528
529 m_hPartition1->Fill(partition1);
530 m_hPartition2->Fill(partition2);
531
532 // just to avoid potential problems with disconnected cells
533 if (partition1 >= 4) partition1 = getPartition(cell_ptr);
534 if (partition2 >= 4) partition2 = partition1;
535
536 // something is wrong - go to next cell
537 if (partition1 >= 4) {
538 ATH_MSG_WARNING( "TileCellNoiseMonTool:fillHistoPerCell : partition1 >= 5 ! - partition = " << partition1 );
539 ATH_MSG_WARNING( "TileCellNoiseMonTool:fillHistoPerCell : skipping to next event " );
540 continue;
541 }
542
543 // note that in single PMT cell both badch1() and badch2() are changed together
544 bool badch1 = (tile_cell->badch1());
545 bool badch2 = (tile_cell->badch2());
546
547 // 0 = both PMTs are good; 1= 1 PMT is bad; 2= both PMTs are bad, or PMT is bad for single PMT cell
548 int cell_isbad = (int)badch1 + (int)badch2;
549
550 int gn1 = tile_cell->gain1(); // gain of first PMT
551 int gn2 = tile_cell->gain2(); // gain of second PMT
552
553 bool ch1Ok = (ch1>-1 && gn1 != CaloGain::INVALIDGAIN);
554 bool ch2Ok = (ch2>-1 && gn2 != CaloGain::INVALIDGAIN);
555
556 // Cell energy and position info
557 double energy = cell_ptr -> energy();
558 double eta = cell_ptr -> eta();
559 double phi = cell_ptr -> phi();
560
561 if (partition1 == 0) {
562 m_h2Partition0->Fill(eta, phi);
563 } else if (partition1 == 1) {
564 m_h2Partition1->Fill(eta, phi);
565 } else if (partition1 == 2) {
566 m_h2Partition2->Fill(eta, phi);
567 } else if (partition1 == 3) {
568 m_h2Partition3->Fill(eta, phi);
569 }
570
571 // From the channel number we need to decide which cell this is
572
573 // if LB
574 int CellID1=0, CellID2=0;
575 std::string CellName1 = "";
576 std::string CellName2 = "";
577
578 if (ch1 >= 0) {
579 if (partition1 == PartLBA || partition1 == PartLBC) {
580 CellID1 = LBch2cellID[ch1];
581 } else {
582 CellID1 = EBch2cellID[ch1];
583 }
584 }
585
586 if (ch2 >= 0) {
587 if (partition2 == PartLBA || partition2 == PartLBC) {
588 CellID2 = LBch2cellID[ch2];
589 } else {
590 CellID2 = EBch2cellID[ch2];
591 }
592 }
593
594 if (msgLvl(MSG::DEBUG) && (fabs(energy - 1.) < 0.01)) {
595 msg(MSG::DEBUG) << "ch1 = " << ch1
596 << " ch2 = " << ch2
597 << " CellID1 = " << CellID1
598 << " CellID2 = " << CellID2 << endmsg;
599
600 msg(MSG::DEBUG) << "partition1 = " << partition1 << endmsg;
601 msg(MSG::DEBUG) << "partition2 = " << partition2 << endmsg;
602 msg(MSG::DEBUG) << "m_tileID->module(id) = " << m_tileID->module(id) << endmsg;
603 msg(MSG::DEBUG) << "gain1 = " << gn1 << endmsg;
604 msg(MSG::DEBUG) << "gain2 = " << gn2 << endmsg;
605 }
606
607 if (partition1 == PartLBA || partition1 == PartLBC) {
608 CellName1 = LBCellName[CellID1];
609 } else {
610 CellName1 = EBCellName[CellID1];
611 }
612
613 if (partition2 == PartLBA || partition2 == PartLBC) {
614 CellName2 = LBCellName[CellID2];
615 } else {
616 CellName2 = EBCellName[CellID2];
617 }
618
619
620 if (msgLvl(MSG::DEBUG) && (fabs(energy - 1) < 0.01)) {
621 msg(MSG::DEBUG) << "CellName1 = " << CellName1 << endmsg;
622 msg(MSG::DEBUG) << "CellName2 = " << CellName2 << endmsg;
623 msg(MSG::DEBUG) << "Cell energy = " << energy << endmsg;
624 msg(MSG::DEBUG) << "ch1Ok = " << (ch1Ok ? 1 : 0) << " ch2Ok = " << (ch2Ok ? 1 : 0) << endmsg;
625 if (partition1 >= 0){
626 msg(MSG::DEBUG) << "HistoName = " << m_tileCellEne[partition1][m_tileID->module(id)][CellID1]->GetName() << endmsg;
627 }
628 }
629
630 ATH_MSG_DEBUG( "ch1Ok = " << ch1Ok
631 << " ch2Ok = " << ch2Ok
632 << " cell_isbad = " << cell_isbad
633 << " gn1 = " << gn1
634 << " gn2 = " << gn2
635 << " energy = " << energy );
636
638 if (ch1Ok && ch2Ok && cell_isbad == 0) {
639
640 if (gn1 == gn2) {
641 if (partition1 >= 0){
642 m_tileCellEne[partition1][m_tileID->module(id)][CellID1]->Fill(energy);
643 } else {
644 ATH_MSG_ERROR("Attempting to access m_tileCellEne at index "<<partition1);
645 }
646 }
647 //if(gn1==1 && gn2==1) m_TileCellEne[partition1][m_tileID->module(id)][CellID1]->Fill(energy);
648
649 if (CellName1 != CellName2) {
650 ATH_MSG_WARNING( " CellName1 and 2 are different : CellName1 = " << CellName1
651 << " CellName2 =" << CellName2 );
652 }
653
654 }
655
656 } // if ( m_tileID->is_tile(id)
657
658 } // Cell Loop
659
660 return StatusCode::SUCCESS;
661} // fillHistoPerCell
662
663
664
665
666/*---------------------------------------------------------*/
668/*---------------------------------------------------------*/
669
670 ATH_MSG_DEBUG( "in fillHistograms() " );
671
672 if (fillHistoPerCell().isFailure()) {
673 ATH_MSG_WARNING( "Error in fillHistoPerCell() " );
674 }
675
676 return StatusCode::SUCCESS;
677
678} // fillHistograms
679
680
681
682/*---------------------------------------------------------*/
684/*---------------------------------------------------------*/
685
686 if (endOfLumiBlockFlag() || endOfRunFlag()) {
687 ATH_MSG_INFO( "in procHistograms()" );
688 }
689
690 return StatusCode::SUCCESS;
691}
692
693
694/*---------------------------------------------------------*/
696/*---------------------------------------------------------*/
697
698 ATH_MSG_INFO( "in finalHists()" );
699 ATH_MSG_INFO( " - m_path = " << m_path );
700
701 // Call the 2G fit for all Cell energy histograms
702 do2GFit();
703
704 return StatusCode::SUCCESS;
705} // finalHists()
706
707
708
709/*---------------------------------------------------------*/
710StatusCode TileCellNoiseMonTool::checkHists(bool /* fromFinalize */) {
711/*---------------------------------------------------------*/
712 ATH_MSG_INFO( "in checkHists()" );
713 return StatusCode::SUCCESS;
714} // checkHists()
715
716
717
718
719// Operations to be done only once at the first event
720/*---------------------------------------------------------*/
722/*---------------------------------------------------------*/
723 m_isFirstEvent = false; //Set the flag
724} // FirstEvInit
725
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define endmsg
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
#define CHECK(...)
Evaluate an expression and check for errors.
Contains class declaration for PairBuilder, and overloaded "operator <<" for output of same.
TGraphErrors * GetEntries(TH2F *histo)
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< StoreGateSvc > & evtStore()
bool msgLvl(const MSG::Level lvl) const
Header file for AthHistogramAlgorithm.
Container class for CaloCell.
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
const CaloDetDescrElement * caloDDE() const
get pointer to CaloDetDescrElement (data member)
Definition CaloCell.h:321
Identifier ID() const
get ID (from cached data member) non-virtual and inline for fast access
Definition CaloCell.h:295
This class groups all DetDescr information related to a CaloCell.
IdentifierHash onl2() const
cell online identifier 2
IdentifierHash onl1() const
cell online identifier 1
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
This is a "hash" representation of an Identifier.
StatusCode finalHists()
Calls procHists( true, true, true ).
StatusCode bookHistograms()
An inheriting class should either override this function or bookHists().
std::vector< TH1F * > m_tileCellEne[4][64]
ToolHandle< ITileBadChanTool > m_tileBadChanTool
Tile Bad Channel tool.
StatusCode checkHists(bool fromFinalize)
This implementation does nothing; equivalent functionality may be provided by procHists(....
StatusCode fillHistograms()
An inheriting class should either override this function or fillHists().
virtual StatusCode initialize() final
The initialize will set some navigation variables and retrieve basic services.
TileCellNoiseMonTool(const std::string &type, const std::string &name, const IInterface *parent)
StatusCode procHistograms()
An inheriting class should either override this function or finalHists().
int gain2(void) const
get gain of second PMT
Definition TileCell.cxx:175
bool badch1(void) const
check if first PMT is in bad channel list and masked
Definition TileCell.h:209
int gain1(void) const
get gain of first PMT
Definition TileCell.cxx:168
bool badch2(void) const
check if second PMT is in bad channel list and masked
Definition TileCell.h:212
std::string getRunNumStr()
Method to get the run Number in words:
int m_ros2partition[NPartHisto]
int m_activeTrigs[9]
this array doesn't simply say if the trigger has ever fired for this run, but it also contains the po...
TileFatherMonTool(const std::string &type, const std::string &name, const IInterface *parent)
Base class for TileCal monitoring tools.
int getPartition(const CaloCell *cell)
Method to navigate from a cell to its Tile partition EBA, LBA, LBC, EBC.
virtual StatusCode initialize() override
The initialize will set some navigation variables and retrieve basic services.
@ NOT_VALID_HASH
Definition TileHWID.h:314
TH2F * book2F(const std::string &dir, const std::string &nam, const std::string &tit, int nx, double xmin, double xmax, int ny, double ymin, double ymax, Interval_t interval=run, MgmtAttr_t attribute=ATTRIB_MANAGED, const std::string &trigChain="", const std::string &mergeAlgo="")
const TileID * m_tileID
TH1F * book1F(const std::string &dir, const std::string &nam, const std::string &tit, int nx, double xmin, double xmax, Interval_t interval=run, MgmtAttr_t attribute=ATTRIB_MANAGED, const std::string &trigChain="", const std::string &mergeAlgo="")
const TileHWID * m_tileHWID
double xmax
Definition listroot.cxx:61
double xmin
Definition listroot.cxx:60
@ INVALIDGAIN
Definition CaloGain.h:18
MsgStream & msg
Definition testRead.cxx:32