ATLAS Offline Software
PixelRDOAnalysis.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
6 #include "PixelRDOAnalysis.h"
7 #include "StoreGate/ReadHandle.h"
8 
9 
10 #include "TTree.h"
11 #include "TString.h"
12 
13 #include <algorithm>
14 #include <math.h>
15 #include <functional>
16 #include <iostream>
17 
18 PixelRDOAnalysis::PixelRDOAnalysis(const std::string& name, ISvcLocator *pSvcLocator)
19  : AthAlgorithm(name, pSvcLocator)
20  , m_inputKey("PixelRDOs")
21  , m_inputTruthKey("PixelSDO_Map")
22  , m_inputMcEventCollectionKey("TruthEvent")
23  , m_pixelID(nullptr)
24  , m_rdoID(0)
25  , m_rdoWord(0)
26  , m_barrelEndcap(0)
27  , m_layerDisk(0)
28  , m_phiModule(0)
29  , m_etaModule(0)
30  , m_phiIndex(0)
31  , m_etaIndex(0)
32  , m_ToT(0)
33  , m_BCID(0)
34  , m_LVL1A(0)
35  , m_LVL1ID(0)
36  , m_sdoID(0)
37  , m_sdoWord(0)
38  , m_barrelEndcap_sdo(0)
39  , m_layerDisk_sdo(0)
40  , m_phiModule_sdo(0)
41  , m_etaModule_sdo(0)
42  , m_phiIndex_sdo(0)
43  , m_etaIndex_sdo(0)
44  , m_noise(0)
45  , m_belowThresh(0)
46  , m_disabled(0)
47  , m_badTOT(0)
48  , m_barcode(0)
49  , m_eventIndex(0)
50  , m_charge(0)
51  , m_barcode_vec(0)
52  , m_eventIndex_vec(0)
53  , m_charge_vec(0)
54  , m_h_rdoID(0)
55  , m_h_rdoWord(0)
56  , m_h_barrelEndcap(0)
57  , m_h_layerDisk(0)
58  , m_h_phiModule(0)
59  , m_h_etaModule(0)
60  , m_h_phiIndex(0)
61  , m_h_etaIndex(0)
62  , m_h_ToT(0)
63  , m_h_BCID(0)
64  , m_h_LVL1A(0)
65  , m_h_LVL1ID(0)
66  , m_h_brlLayer(0)
67  , m_h_brlPhiMod(0)
68  , m_h_brlEtaMod(0)
69  , m_h_brlPhiIndex(0)
70  , m_h_brlEtaIndex(0)
71  , m_h_brlToT(0)
72  , m_h_brlBCID(0)
73  , m_h_brlLVL1A(0)
74  , m_h_brlLVL1ID(0)
75  , m_h_ecDisk(0)
76  , m_h_ecPhiMod(0)
77  , m_h_ecEtaMod(0)
78  , m_h_ecPhiIndex(0)
79  , m_h_ecEtaIndex(0)
80  , m_h_ecToT(0)
81  , m_h_ecBCID(0)
82  , m_h_ecLVL1A(0)
83  , m_h_ecLVL1ID(0)
84  , m_h_TruthMatchedRDOs(nullptr)
85 
86  , m_tree(0)
87  , m_ntupleFileName("/ntuples/file1")
88  , m_ntupleDirName("/PixelRDOAnalysis/")
89  , m_ntupleTreeName("PixelRDOAna")
90  , m_path("/PixelRDOAnalysis/")
91  , m_thistSvc("THistSvc", name)
92 {
93  declareProperty("InputKey", m_inputKey);
94  declareProperty("InputTruthKey", m_inputTruthKey);
95  declareProperty("InputMcEventCollectionKey", m_inputMcEventCollectionKey);
96  declareProperty("NtupleFileName", m_ntupleFileName);
97  declareProperty("NtupleDirectoryName", m_ntupleDirName);
98  declareProperty("NtupleTreeName", m_ntupleTreeName);
99  declareProperty("HistPath", m_path);
100 }
101 
103  ATH_MSG_DEBUG( "Initializing PixelRDOAnalysis" );
104 
105  // This will check that the properties were initialized
106  // properly by job configuration.
107  ATH_CHECK( m_inputKey.initialize() );
110 
111  // Grab PixelID helper
112  ATH_CHECK(detStore()->retrieve(m_pixelID, "PixelID"));
113 
114  // Grab Ntuple and histogramming service for tree
115  ATH_CHECK(m_thistSvc.retrieve());
116 
117  m_tree = new TTree(TString(m_ntupleTreeName), "PixelRDOAna");
118  std::string fullNtupleName = m_ntupleFileName + m_ntupleDirName + m_ntupleTreeName;
119  ATH_CHECK(m_thistSvc->regTree(fullNtupleName, m_tree));
120  if (m_tree) {
121  // PIXEL RDO
122  m_tree->Branch("rdoID", &m_rdoID);
123  m_tree->Branch("rdoWord", &m_rdoWord);
124  m_tree->Branch("barrelEndcap", &m_barrelEndcap);
125  m_tree->Branch("layerDisk", &m_layerDisk);
126  m_tree->Branch("phiModule", &m_phiModule);
127  m_tree->Branch("etaModule", &m_etaModule);
128  m_tree->Branch("phiIndex", &m_phiIndex);
129  m_tree->Branch("etaIndex", &m_etaIndex);
130  m_tree->Branch("ToT", &m_ToT); // time over threshold value (0-255)
131  m_tree->Branch("BCID", &m_BCID); // beam crossing ID
132  m_tree->Branch("LVL1A", &m_LVL1A); // Level1 accept (0-15)
133  m_tree->Branch("LVL1ID", &m_LVL1ID); // ATLAS LVL1 (0-255)
134  // PIXEL SDO DEPOSITS
135  m_tree->Branch("sdoID", &m_sdoID);
136  m_tree->Branch("sdoWord", &m_sdoWord);
137  m_tree->Branch("barrelEndcap_sdo", &m_barrelEndcap_sdo);
138  m_tree->Branch("layerDisk_sdo", &m_layerDisk_sdo);
139  m_tree->Branch("phiModule_sdo", &m_phiModule_sdo);
140  m_tree->Branch("etaModule_sdo", &m_etaModule_sdo);
141  m_tree->Branch("phiIndex_sdo", &m_phiIndex_sdo);
142  m_tree->Branch("etaIndex_sdo", &m_etaIndex_sdo);
143  m_tree->Branch("noise", &m_noise);
144  m_tree->Branch("belowThresh", &m_belowThresh);
145  m_tree->Branch("disabled", &m_disabled);
146  m_tree->Branch("badTOT", &m_badTOT);
147  m_tree->Branch("barcode", &m_barcode);
148  m_tree->Branch("eventIndex", &m_eventIndex);
149  m_tree->Branch("charge", &m_charge);
150  m_tree->Branch("barcode_vec", &m_barcode_vec);
151  m_tree->Branch("eventIndex_vec", &m_eventIndex_vec);
152  m_tree->Branch("charge_vec", &m_charge_vec);
153  }
154  else {
155  ATH_MSG_ERROR("No tree found!");
156  }
157 
158  // HISTOGRAMS
159  m_h_rdoID = new TH1F("h_rdoID", "rdoID", 100, 0, 5e17);
160  m_h_rdoID->StatOverflows();
161  ATH_CHECK(m_thistSvc->regHist(m_path + m_h_rdoID->GetName(), m_h_rdoID));
162 
163  m_h_rdoWord = new TH1F("h_rdoWord", "rdoWord", 100, 0, 350);
164  m_h_rdoWord->StatOverflows();
165  ATH_CHECK(m_thistSvc->regHist(m_path + m_h_rdoWord->GetName(), m_h_rdoWord));
166 
167  m_h_barrelEndcap = new TH1F("h_barrelEndcap", "Barrel or Endcap", 100, -5, 5);
168  m_h_barrelEndcap->StatOverflows();
170 
171  m_h_layerDisk = new TH1F("h_layerDisk", "Barrel layer or Endcap disk", 100, 0, 3);
172  m_h_layerDisk->StatOverflows();
173  ATH_CHECK(m_thistSvc->regHist(m_path + m_h_layerDisk->GetName(), m_h_layerDisk));
174 
175  m_h_phiModule = new TH1F("h_phiModule", "Phi module", 100, 0, 75);
176  m_h_phiModule->StatOverflows();
177  ATH_CHECK(m_thistSvc->regHist(m_path + m_h_phiModule->GetName(), m_h_phiModule));
178 
179  m_h_etaModule = new TH1F("h_etaModule", "Eta module", 100, 0, 15);
180  m_h_etaModule->StatOverflows();
181  ATH_CHECK(m_thistSvc->regHist(m_path + m_h_etaModule->GetName(), m_h_etaModule));
182 
183  m_h_phiIndex = new TH1F("h_phiIndex", "Phi index", 100, 0, 350);
184  m_h_phiIndex->StatOverflows();
185  ATH_CHECK(m_thistSvc->regHist(m_path + m_h_phiIndex->GetName(), m_h_phiIndex));
186 
187  m_h_etaIndex = new TH1F("h_etaIndex", "Eta index", 100, 0, 225);
188  m_h_etaIndex->StatOverflows();
189  ATH_CHECK(m_thistSvc->regHist(m_path + m_h_etaIndex->GetName(), m_h_etaIndex));
190 
191  m_h_ToT = new TH1F("h_ToT", "ToT", 100, 0, 250);
192  m_h_ToT->StatOverflows();
193  ATH_CHECK(m_thistSvc->regHist(m_path + m_h_ToT->GetName(), m_h_ToT));
194 
195  m_h_BCID = new TH1F("h_BCID", "BCID", 100, -1.5, 1.5);
196  m_h_BCID->StatOverflows();
197  ATH_CHECK(m_thistSvc->regHist(m_path + m_h_BCID->GetName(), m_h_BCID));
198 
199  m_h_LVL1A = new TH1F("h_LVL1A", "LVL1A", 100, -1.5, 1.5);
200  m_h_LVL1A->StatOverflows();
201  ATH_CHECK(m_thistSvc->regHist(m_path + m_h_LVL1A->GetName(), m_h_LVL1A));
202 
203  m_h_LVL1ID = new TH1F("h_LVL1ID", "LVL1ID", 100, -1.5, 1.5);
204  m_h_LVL1ID->StatOverflows();
205  ATH_CHECK(m_thistSvc->regHist(m_path + m_h_LVL1ID->GetName(), m_h_LVL1ID));
206 
207  m_h_brlLayer = new TH1F("h_brlLayer", "Barrel layer", 100, 0, 3);
208  m_h_brlLayer->StatOverflows();
209  ATH_CHECK(m_thistSvc->regHist(m_path + m_h_brlLayer->GetName(), m_h_brlLayer));
210 
211  m_h_brlPhiMod = new TH1F("h_brlPhiMod", "Barrel phi module", 100, 0, 80);
212  m_h_brlPhiMod->StatOverflows();
213  ATH_CHECK(m_thistSvc->regHist(m_path + m_h_brlPhiMod->GetName(), m_h_brlPhiMod));
214 
215  m_h_brlEtaMod = new TH1F("h_brlEtaMod", "Barrel eta module", 100, 0, 15);
216  m_h_brlEtaMod->StatOverflows();
217  ATH_CHECK(m_thistSvc->regHist(m_path + m_h_brlEtaMod->GetName(), m_h_brlEtaMod));
218 
219  m_h_brlPhiIndex = new TH1F("h_brlPhiIndex", "Barrel phi index", 100, 0, 350);
220  m_h_brlPhiIndex->StatOverflows();
221  ATH_CHECK(m_thistSvc->regHist(m_path + m_h_brlPhiIndex->GetName(), m_h_brlPhiIndex));
222 
223  m_h_brlEtaIndex = new TH1F("h_brlEtaIndex", "Barrel eta index", 100, 0, 225);
224  m_h_brlEtaIndex->StatOverflows();
225  ATH_CHECK(m_thistSvc->regHist(m_path + m_h_brlEtaIndex->GetName(), m_h_brlEtaIndex));
226 
227  m_h_brlToT = new TH1F("h_brlToT", "Barrel ToT", 100, 0, 250);
228  m_h_brlToT->StatOverflows();
229  ATH_CHECK(m_thistSvc->regHist(m_path + m_h_brlToT->GetName(), m_h_brlToT));
230 
231  m_h_brlBCID = new TH1F("h_brlBCID", "Barrel BCID", 100, -1.5, 1.5);
232  m_h_brlBCID->StatOverflows();
233  ATH_CHECK(m_thistSvc->regHist(m_path + m_h_brlBCID->GetName(), m_h_brlBCID));
234 
235  m_h_brlLVL1A = new TH1F("h_brlLVL1A", "Barrel LVL1A", 100, -1.5, 1.5);
236  m_h_brlLVL1A->StatOverflows();
237  ATH_CHECK(m_thistSvc->regHist(m_path + m_h_brlLVL1A->GetName(), m_h_brlLVL1A));
238 
239  m_h_brlLVL1ID = new TH1F("h_brlLVL1ID", "Barrel LVL1ID", 100, -1.5, 1.5);
240  m_h_brlLVL1ID->StatOverflows();
241  ATH_CHECK(m_thistSvc->regHist(m_path + m_h_brlLVL1ID->GetName(), m_h_brlLVL1ID));
242 
243  m_h_ecDisk = new TH1F("h_ecDisk", "Endcap disk", 100, 0, 3);
244  m_h_ecDisk->StatOverflows();
245  ATH_CHECK(m_thistSvc->regHist(m_path + m_h_ecDisk->GetName(), m_h_ecDisk));
246 
247  m_h_ecPhiMod = new TH1F("h_ecPhiMod", "Endcap phi module", 100, 0, 80);
248  m_h_ecPhiMod->StatOverflows();
249  ATH_CHECK(m_thistSvc->regHist(m_path + m_h_ecPhiMod->GetName(), m_h_ecPhiMod));
250 
251  m_h_ecEtaMod = new TH1F("h_ecEtaMod", "Endcap eta module", 100, 0, 15);
252  m_h_ecEtaMod->StatOverflows();
253  ATH_CHECK(m_thistSvc->regHist(m_path + m_h_ecEtaMod->GetName(), m_h_ecEtaMod));
254 
255  m_h_ecPhiIndex = new TH1F("h_ecPhiIndex", "Endcap phi index", 100, 0, 350);
256  m_h_ecPhiIndex->StatOverflows();
257  ATH_CHECK(m_thistSvc->regHist(m_path + m_h_ecPhiIndex->GetName(), m_h_ecPhiIndex));
258 
259  m_h_ecEtaIndex = new TH1F("h_ecEtaIndex", "Endcap eta index", 100, 0, 225);
260  m_h_ecEtaIndex->StatOverflows();
261  ATH_CHECK(m_thistSvc->regHist(m_path + m_h_ecEtaIndex->GetName(), m_h_ecEtaIndex));
262 
263  m_h_ecToT = new TH1F("h_ecToT", "EndcapToT", 100, 0, 250);
264  m_h_ecToT->StatOverflows();
265  ATH_CHECK(m_thistSvc->regHist(m_path + m_h_ecToT->GetName(), m_h_ecToT));
266 
267  m_h_ecBCID = new TH1F("h_ecBCID", "Endcap BCID", 100, -1.5, 1.5);
268  m_h_ecBCID->StatOverflows();
269  ATH_CHECK(m_thistSvc->regHist(m_path + m_h_ecBCID->GetName(), m_h_ecBCID));
270 
271  m_h_ecLVL1A = new TH1F("h_ecLVL1A", "Endcap LVL1A", 100, -1.5, 1.5);
272  m_h_ecLVL1A->StatOverflows();
273  ATH_CHECK(m_thistSvc->regHist(m_path + m_h_ecLVL1A->GetName(), m_h_ecLVL1A));
274 
275  m_h_ecLVL1ID = new TH1F("h_ecLVL1ID", "Endcap LVL1ID", 100, -1.5, 1.5);
276  m_h_ecLVL1ID->StatOverflows();
277  ATH_CHECK(m_thistSvc->regHist(m_path + m_h_ecLVL1ID->GetName(), m_h_ecLVL1ID));
278 
279  m_h_sdoID = new TH1F("h_sdoID", "sdoID", 100, 0, 5e17);
280  m_h_sdoID->StatOverflows();
281  ATH_CHECK(m_thistSvc->regHist(m_path + m_h_sdoID->GetName(), m_h_sdoID));
282 
283  m_h_sdoWord = new TH1F("h_sdoWord", "sdoWord", 100, 0, 350);
284  m_h_sdoWord->StatOverflows();
285  ATH_CHECK(m_thistSvc->regHist(m_path + m_h_sdoWord->GetName(), m_h_sdoWord));
286 
287  m_h_barrelEndcap_sdo = new TH1F("h_barrelEndcap_sdo", "Barrel or Endcap (SDO)", 100, -5, 5);
288  m_h_barrelEndcap_sdo->StatOverflows();
290 
291  m_h_layerDisk_sdo = new TH1F("h_layerDisk_sdo", "Barrel layer or Endcap disk (SDO)", 100, 0, 3);
292  m_h_layerDisk_sdo->StatOverflows();
294 
295  m_h_phiModule_sdo = new TH1F("h_phiModule_sdo", "Phi module (SDO)", 100, 0, 75);
296  m_h_phiModule_sdo->StatOverflows();
298 
299  m_h_etaModule_sdo = new TH1F("h_etaModule_sdo", "Eta module (SDO)", 100, 0, 15);
300  m_h_etaModule_sdo->StatOverflows();
302 
303  m_h_phiIndex_sdo = new TH1F("h_phiIndex_sdo", "Phi index (SDO)", 100, 0, 350);
304  m_h_phiIndex_sdo->StatOverflows();
306 
307  m_h_etaIndex_sdo = new TH1F("h_etaIndex_sdo", "Eta index (SDO)", 100, 0, 350);
308  m_h_etaIndex_sdo->StatOverflows();
310 
311  m_h_barcode = new TH1F("h_barcode", "Barcode (SDO)", 100, 0, 2.2e5);
312  m_h_barcode->StatOverflows();
313  ATH_CHECK(m_thistSvc->regHist(m_path + m_h_barcode->GetName(), m_h_barcode));
314 
315  m_h_eventIndex = new TH1F("h_eventIndex", "Event Index (SDO)", 100, 0, 2);
316  m_h_eventIndex->StatOverflows();
317  ATH_CHECK(m_thistSvc->regHist(m_path + m_h_eventIndex->GetName(), m_h_eventIndex));
318 
319  m_h_charge = new TH1F("h_charge", "Charge (SDO)", 100, 0, 1e7);
320  m_h_charge->StatOverflows();
321  ATH_CHECK(m_thistSvc->regHist(m_path + m_h_charge->GetName(), m_h_charge));
322 
323  m_h_TruthMatchedRDOs = new TH1F("h_TruthMatchedPixelRDOs", "h_TruthMatchedPixelRDOs", 4, 1, 5);
324  TString truthMatchBinLables[4] = { "All RDOs", "Truth Matched", "HS Matched", "Unmatched" };
325  for(unsigned int ibin = 1; ibin < 5; ibin++) {
326  m_h_TruthMatchedRDOs->GetXaxis()->SetBinLabel(ibin, truthMatchBinLables[ibin-1]);
327  }
329 
330 
331  return StatusCode::SUCCESS;
332 }
333 
335  ATH_MSG_DEBUG(" In PixelRDOAnalysis::execute()" );
336 
337  m_rdoID->clear();
338  m_rdoWord->clear();
339  m_barrelEndcap->clear();
340  m_layerDisk->clear();
341  m_phiModule->clear();
342  m_etaModule->clear();
343  m_phiIndex->clear();
344  m_etaIndex->clear();
345  m_ToT->clear();
346  m_BCID->clear();
347  m_LVL1A->clear();
348  m_LVL1ID->clear();
349  m_sdoID->clear();
350  m_sdoWord->clear();
351  m_barrelEndcap_sdo->clear();
352  m_layerDisk_sdo->clear();
353  m_phiModule_sdo->clear();
354  m_etaModule_sdo->clear();
355  m_phiIndex_sdo->clear();
356  m_etaIndex_sdo->clear();
357  m_noise->clear();
358  m_belowThresh->clear();
359  m_disabled->clear();
360  m_badTOT->clear();
361  m_barcode->clear();
362  m_eventIndex->clear();
363  m_charge->clear();
364  m_barcode_vec->clear();
365  m_eventIndex_vec->clear();
366  m_charge_vec->clear();
367 
368  // Raw Data
370  //Adding SimMap and McEvent here for added truthMatching checks
373  bool doTruthMatching = true;
374  const HepMC::GenEvent* hardScatterEvent(nullptr);
375 
376  if ((!mcEventCollection.isValid())||mcEventCollection->size()==0){
377  ATH_MSG_WARNING("Failed to retrieve a nonzero sized truth event collection, disabling truthMatching");
378  doTruthMatching = false;
379  }
380  if(doTruthMatching) hardScatterEvent = mcEventCollection->at(0);
381 
382  if(p_pixelRDO_cont.isValid()) {
383  // loop over RDO container
384  PixelRDO_Container::const_iterator rdoCont_itr(p_pixelRDO_cont->begin());
385  const PixelRDO_Container::const_iterator rdoCont_end(p_pixelRDO_cont->end());
386  for ( ; rdoCont_itr != rdoCont_end; ++rdoCont_itr ) {
387  const PixelRDO_Collection* p_pixelRDO_coll(*rdoCont_itr);
388  PixelRDO_Collection::const_iterator rdo_itr(p_pixelRDO_coll->begin());
389  const PixelRDO_Collection::const_iterator rdo_end(p_pixelRDO_coll->end());
390  for ( ; rdo_itr != rdo_end; ++rdo_itr ) {
391  if(doTruthMatching){
393  bool findMatch = false;
394  if(simDataMapPixel.isValid()){
395  InDetSimDataCollection::const_iterator iter = (*simDataMapPixel).find((*rdo_itr)->identify());
396 
397  if ( iter != (*simDataMapPixel).end() ) {
398  const InDetSimData& sdo = iter->second;
399  const std::vector< InDetSimData::Deposit >& deposits = sdo.getdeposits();
400  std::vector< InDetSimData::Deposit >::const_iterator nextdeposit = deposits.begin();
401  std::vector< InDetSimData::Deposit >::const_iterator lastdeposit = deposits.end();
402  for( ; nextdeposit!=lastdeposit; ++nextdeposit) {
403  const HepMcParticleLink& particleLink = nextdeposit->first;
404  if(particleLink.isValid() && !findMatch){
405  HepMC::ConstGenParticlePtr genPart(particleLink.cptr());
406  if(genPart->parent_event() == hardScatterEvent) m_h_TruthMatchedRDOs->Fill(3.5);
408  findMatch = true;
409  }
410  }
411  }
412  }
413  if(!findMatch) m_h_TruthMatchedRDOs->Fill(4.5);
414  }
415  const Identifier rdoID((*rdo_itr)->identify());
416  const int pixBrlEc(m_pixelID->barrel_ec(rdoID));
417  const unsigned int rdoWord((*rdo_itr)->getWord());
418  const int pixLayerDisk(m_pixelID->layer_disk(rdoID));
419  const int pixPhiMod(m_pixelID->phi_module(rdoID));
420  const int pixEtaMod(m_pixelID->eta_module(rdoID));
421  const int pixPhiIx(m_pixelID->phi_index(rdoID));
422  const int pixEtaIx(m_pixelID->eta_index(rdoID));
423  const int pixToT((*rdo_itr)->getToT());
424  const int pixBCID((*rdo_itr)->getBCID());
425  const int pixLVL1A((*rdo_itr)->getLVL1A());
426  const int pixLVL1ID((*rdo_itr)->getLVL1ID());
427 
428  const unsigned long long rdoID_int = rdoID.get_compact();
429  m_rdoID->push_back(rdoID_int);
430  m_rdoWord->push_back(rdoWord);
431  m_barrelEndcap->push_back(pixBrlEc);
432  m_layerDisk->push_back(pixLayerDisk);
433  m_phiModule->push_back(pixPhiMod);
434  m_etaModule->push_back(pixEtaMod);
435  m_phiIndex->push_back(pixPhiIx);
436  m_etaIndex->push_back(pixEtaIx);
437  m_ToT->push_back(pixToT);
438  m_BCID->push_back(pixBCID);
439  m_LVL1A->push_back(pixLVL1A);
440  m_LVL1ID->push_back(pixLVL1ID);
441 
442  m_h_rdoID->Fill(rdoID_int);
443  m_h_rdoWord->Fill(rdoWord);
444  m_h_barrelEndcap->Fill(pixBrlEc);
445  m_h_layerDisk->Fill(pixLayerDisk);
446  m_h_phiModule->Fill(pixPhiMod);
447  m_h_etaModule->Fill(pixEtaMod);
448  m_h_phiIndex->Fill(pixPhiIx);
449  m_h_etaIndex->Fill(pixEtaIx);
450  m_h_ToT->Fill(pixToT);
451  m_h_BCID->Fill(pixBCID);
452  m_h_LVL1A->Fill(pixLVL1A);
453  m_h_LVL1ID->Fill(pixLVL1ID);
454 
455  if (pixBrlEc == 0) {
456  m_h_brlLayer->Fill(pixLayerDisk);
457  m_h_brlPhiMod->Fill(pixPhiMod);
458  m_h_brlEtaMod->Fill(pixEtaMod);
459  m_h_brlPhiIndex->Fill(pixPhiIx);
460  m_h_brlEtaIndex->Fill(pixEtaIx);
461  m_h_brlToT->Fill(pixToT);
462  m_h_brlBCID->Fill(pixBCID);
463  m_h_brlLVL1A->Fill(pixLVL1A);
464  m_h_brlLVL1ID->Fill(pixLVL1ID);
465  }
466  else if (abs(pixBrlEc) == 4) {
467  m_h_ecDisk->Fill(pixLayerDisk);
468  m_h_ecPhiMod->Fill(pixPhiMod);
469  m_h_ecEtaMod->Fill(pixEtaMod);
470  m_h_ecPhiIndex->Fill(pixPhiIx);
471  m_h_ecEtaIndex->Fill(pixEtaIx);
472  m_h_ecToT->Fill(pixToT);
473  m_h_ecBCID->Fill(pixBCID);
474  m_h_ecLVL1A->Fill(pixLVL1A);
475  m_h_ecLVL1ID->Fill(pixLVL1ID);
476  }
477  }
478  }
479  }
480 
481  // Sim Data
482  if(simDataMapPixel.isValid()) {
483  // loop over SDO container
484  InDetSimDataCollection::const_iterator sdo_itr(simDataMapPixel->begin());
485  const InDetSimDataCollection::const_iterator sdo_end(simDataMapPixel->end());
486 
487  std::vector<int> barcode_vec;
488  std::vector<int> eventIndex_vec;
489  std::vector<float> charge_vec;
490  for ( ; sdo_itr != sdo_end; ++sdo_itr ) {
491  const Identifier sdoID((*sdo_itr).first);
492  const InDetSimData& sdo((*sdo_itr).second);
493  const unsigned long long sdoID_int = sdoID.get_compact();
494  const int sdoWord(sdo.word());
495  const int pixBrlEc_sdo(m_pixelID->barrel_ec(sdoID));
496  const int pixLayerDisk_sdo(m_pixelID->layer_disk(sdoID));
497  const int pixPhiMod_sdo(m_pixelID->phi_module(sdoID));
498  const int pixEtaMod_sdo(m_pixelID->eta_module(sdoID));
499  const int pixPhiIx_sdo(m_pixelID->phi_index(sdoID));
500  const int pixEtaIx_sdo(m_pixelID->eta_index(sdoID));
501  const bool noise(PixelSimHelper::isNoise(sdo));
502  const bool belowThresh(PixelSimHelper::isBelowThreshold(sdo));
503  const bool disabled(PixelSimHelper::isDisabled(sdo));
504  const bool badTOT(PixelSimHelper::hasBadTOT(sdo));
505 
506  m_sdoID->push_back(sdoID_int);
507  m_sdoWord->push_back(sdoWord);
508  m_barrelEndcap_sdo->push_back(pixBrlEc_sdo);
509  m_layerDisk_sdo->push_back(pixLayerDisk_sdo);
510  m_phiModule_sdo->push_back(pixPhiMod_sdo);
511  m_etaModule_sdo->push_back(pixEtaMod_sdo);
512  m_phiIndex_sdo->push_back(pixPhiIx_sdo);
513  m_etaIndex_sdo->push_back(pixEtaIx_sdo);
514  m_noise->push_back(noise);
515  m_belowThresh->push_back(belowThresh);
516  m_disabled->push_back(disabled);
517  m_badTOT->push_back(badTOT);
518 
519  m_h_sdoID->Fill(sdoID_int);
520  m_h_sdoWord->Fill(sdoWord);
521  m_h_barrelEndcap_sdo->Fill(pixBrlEc_sdo);
522  m_h_layerDisk_sdo->Fill(pixLayerDisk_sdo);
523  m_h_phiModule_sdo->Fill(pixPhiMod_sdo);
524  m_h_etaModule_sdo->Fill(pixEtaMod_sdo);
525  m_h_phiIndex_sdo->Fill(pixPhiIx_sdo);
526  m_h_etaIndex_sdo->Fill(pixEtaIx_sdo);
527 
528  // loop over deposits
529  const std::vector<InDetSimData::Deposit>& deposits = sdo.getdeposits();
530  std::vector<InDetSimData::Deposit>::const_iterator dep_itr(deposits.begin());
531  const std::vector<InDetSimData::Deposit>::const_iterator dep_end(deposits.end());
532  for ( ; dep_itr != dep_end; ++dep_itr ) {
533  const HepMcParticleLink& particleLink = (*dep_itr).first;
534  const int bar(HepMC::barcode(particleLink)); // FIXME barcode-based
535  const int eventIx(particleLink.eventIndex());
536  const int charge((*dep_itr).second);
537 
538  m_barcode->push_back(bar);
539  m_eventIndex->push_back(eventIx);
540  m_charge->push_back(charge);
541 
542  m_h_barcode->Fill(bar);
543  m_h_eventIndex->Fill(eventIx);
545 
546  barcode_vec.push_back(bar);
547  eventIndex_vec.push_back(eventIx);
548  charge_vec.push_back(charge);
549  }
550  m_barcode_vec->push_back(barcode_vec);
551  m_eventIndex_vec->push_back(eventIndex_vec);
552  m_charge_vec->push_back(charge_vec);
553  barcode_vec.clear();
554  eventIndex_vec.clear();
555  charge_vec.clear();
556  }
557  }
558 
559  if (m_tree) {
560  m_tree->Fill();
561  }
562 
563  return StatusCode::SUCCESS;
564 }
565 
567  return StatusCode::SUCCESS;
568 }
PixelRDOAnalysis::m_h_eventIndex
TH1 * m_h_eventIndex
Definition: PixelRDOAnalysis.h:126
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
PixelRDOAnalysis::m_rdoID
std::vector< unsigned long long > * m_rdoID
Definition: PixelRDOAnalysis.h:45
PixelRDOAnalysis::m_h_phiModule
TH1 * m_h_phiModule
Definition: PixelRDOAnalysis.h:88
PixelRDOAnalysis::m_tree
TTree * m_tree
Definition: PixelRDOAnalysis.h:130
PixelRDOAnalysis::m_noise
std::vector< bool > * m_noise
Definition: PixelRDOAnalysis.h:71
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
PixelID::phi_index
int phi_index(const Identifier &id) const
Definition: PixelID.h:658
PixelRDOAnalysis::m_h_phiModule_sdo
TH1 * m_h_phiModule_sdo
Definition: PixelRDOAnalysis.h:121
PixelRDOAnalysis::m_h_barcode
TH1 * m_h_barcode
Definition: PixelRDOAnalysis.h:125
PixelRDOAnalysis::m_h_ecLVL1A
TH1 * m_h_ecLVL1A
Definition: PixelRDOAnalysis.h:114
PixelRDOAnalysis::m_h_ecEtaMod
TH1 * m_h_ecEtaMod
Definition: PixelRDOAnalysis.h:109
InDetSimData::getdeposits
const std::vector< Deposit > & getdeposits() const
Definition: InDetSimData.h:74
PixelRDOAnalysis::m_barcode_vec
std::vector< std::vector< int > > * m_barcode_vec
Definition: PixelRDOAnalysis.h:79
PixelRDOAnalysis::m_inputMcEventCollectionKey
SG::ReadHandleKey< McEventCollection > m_inputMcEventCollectionKey
Definition: PixelRDOAnalysis.h:42
PixelRDOAnalysis::m_rdoWord
std::vector< unsigned int > * m_rdoWord
Definition: PixelRDOAnalysis.h:46
PixelRDOAnalysis::m_h_rdoWord
TH1 * m_h_rdoWord
Definition: PixelRDOAnalysis.h:85
PixelRDOAnalysis::m_h_etaIndex
TH1 * m_h_etaIndex
Definition: PixelRDOAnalysis.h:91
PixelID::barrel_ec
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition: PixelID.h:619
PixelRDOAnalysis::m_h_barrelEndcap
TH1 * m_h_barrelEndcap
Definition: PixelRDOAnalysis.h:86
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
PixelRDOAnalysis.h
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
PixelRDOAnalysis::m_h_brlEtaIndex
TH1 * m_h_brlEtaIndex
Definition: PixelRDOAnalysis.h:101
PixelRDOAnalysis::m_h_sdoWord
TH1 * m_h_sdoWord
Definition: PixelRDOAnalysis.h:118
PixelRDOAnalysis::m_eventIndex
std::vector< int > * m_eventIndex
Definition: PixelRDOAnalysis.h:77
PixelRDOAnalysis::m_inputTruthKey
SG::ReadHandleKey< InDetSimDataCollection > m_inputTruthKey
Definition: PixelRDOAnalysis.h:41
PixelRDOAnalysis::m_h_rdoID
TH1 * m_h_rdoID
Definition: PixelRDOAnalysis.h:84
PixelRDOAnalysis::m_h_sdoID
TH1 * m_h_sdoID
Definition: PixelRDOAnalysis.h:117
PixelRDOAnalysis::m_eventIndex_vec
std::vector< std::vector< int > > * m_eventIndex_vec
Definition: PixelRDOAnalysis.h:80
PixelRDOAnalysis::m_h_charge
TH1 * m_h_charge
Definition: PixelRDOAnalysis.h:127
PixelRDOAnalysis::m_h_etaModule
TH1 * m_h_etaModule
Definition: PixelRDOAnalysis.h:89
PixelSimHelper::isNoise
static bool isNoise(const InDetSimData &sdo)
Definition: PixelSimHelper.h:109
PixelRDOAnalysis::m_h_ecPhiMod
TH1 * m_h_ecPhiMod
Definition: PixelRDOAnalysis.h:108
PixelRDOAnalysis::m_etaModule_sdo
std::vector< int > * m_etaModule_sdo
Definition: PixelRDOAnalysis.h:67
PixelRDOAnalysis::m_sdoID
std::vector< unsigned long long > * m_sdoID
Definition: PixelRDOAnalysis.h:61
PixelRDOAnalysis::m_etaModule
std::vector< int > * m_etaModule
Definition: PixelRDOAnalysis.h:51
AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
PixelRDOAnalysis::execute
virtual StatusCode execute() override final
Definition: PixelRDOAnalysis.cxx:334
PixelSimHelper::hasBadTOT
static bool hasBadTOT(const InDetSimData &sdo)
Definition: PixelSimHelper.h:124
PixelRDOAnalysis::m_h_brlEtaMod
TH1 * m_h_brlEtaMod
Definition: PixelRDOAnalysis.h:99
PixelRDOAnalysis::m_h_brlLayer
TH1 * m_h_brlLayer
Definition: PixelRDOAnalysis.h:97
PixelRDOAnalysis::m_h_ecDisk
TH1 * m_h_ecDisk
Definition: PixelRDOAnalysis.h:107
PixelRDOAnalysis::m_h_brlPhiIndex
TH1 * m_h_brlPhiIndex
Definition: PixelRDOAnalysis.h:100
PixelRDOAnalysis::m_h_ecPhiIndex
TH1 * m_h_ecPhiIndex
Definition: PixelRDOAnalysis.h:110
PixelRDOAnalysis::initialize
virtual StatusCode initialize() override final
Definition: PixelRDOAnalysis.cxx:102
PixelRDOAnalysis::m_phiModule_sdo
std::vector< int > * m_phiModule_sdo
Definition: PixelRDOAnalysis.h:66
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
PixelRDOAnalysis::m_phiIndex
std::vector< int > * m_phiIndex
Definition: PixelRDOAnalysis.h:52
PixelRDOAnalysis::m_badTOT
std::vector< bool > * m_badTOT
Definition: PixelRDOAnalysis.h:74
PixelRDOAnalysis::finalize
virtual StatusCode finalize() override final
Definition: PixelRDOAnalysis.cxx:566
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
PixelRDOAnalysis::m_ntupleDirName
std::string m_ntupleDirName
Definition: PixelRDOAnalysis.h:132
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
HepMC::barcode
int barcode(const T *p)
Definition: Barcode.h:16
PixelRDOAnalysis::m_h_brlLVL1ID
TH1 * m_h_brlLVL1ID
Definition: PixelRDOAnalysis.h:105
m_path
std::string m_path
the path being used
Definition: OutputStreamData.cxx:88
InDetSimData
Definition: InDetSimData.h:42
PixelRDOAnalysis::m_h_ecBCID
TH1 * m_h_ecBCID
Definition: PixelRDOAnalysis.h:113
InDetRawDataCollection
Definition: InDetRawDataCollection.h:31
PixelRDOAnalysis::m_barcode
std::vector< int > * m_barcode
Definition: PixelRDOAnalysis.h:76
PixelSimHelper::isBelowThreshold
static bool isBelowThreshold(const InDetSimData &sdo)
Definition: PixelSimHelper.h:114
PixelID::eta_index
int eta_index(const Identifier &id) const
Definition: PixelID.h:664
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
IdentifiableContainerMT::end
const_iterator end() const
return const_iterator for end of container
Definition: IdentifiableContainerMT.h:242
SCT_Monitoring::disabled
@ disabled
Definition: SCT_MonitoringNumbers.h:60
PixelRDOAnalysis::m_barrelEndcap
std::vector< int > * m_barrelEndcap
Definition: PixelRDOAnalysis.h:48
IdentifiableContainerMT::const_iterator
Definition: IdentifiableContainerMT.h:82
IdentifiableContainerMT::begin
const_iterator begin() const
return const_iterator for first entry
Definition: IdentifiableContainerMT.h:236
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
PixelRDOAnalysis::m_ntupleFileName
std::string m_ntupleFileName
Definition: PixelRDOAnalysis.h:131
PixelRDOAnalysis::m_etaIndex_sdo
std::vector< int > * m_etaIndex_sdo
Definition: PixelRDOAnalysis.h:69
TH1::Fill
int Fill(double)
Definition: rootspy.cxx:285
PixelRDOAnalysis::m_ToT
std::vector< int > * m_ToT
Definition: PixelRDOAnalysis.h:55
PixelRDOAnalysis::m_LVL1ID
std::vector< int > * m_LVL1ID
Definition: PixelRDOAnalysis.h:58
PixelRDOAnalysis::m_sdoWord
std::vector< int > * m_sdoWord
Definition: PixelRDOAnalysis.h:62
PixelRDOAnalysis::m_charge_vec
std::vector< std::vector< float > > * m_charge_vec
Definition: PixelRDOAnalysis.h:81
PixelRDOAnalysis::m_barrelEndcap_sdo
std::vector< int > * m_barrelEndcap_sdo
Definition: PixelRDOAnalysis.h:64
PixelRDOAnalysis::m_inputKey
SG::ReadHandleKey< PixelRDO_Container > m_inputKey
Definition: PixelRDOAnalysis.h:40
AthAlgorithm
Definition: AthAlgorithm.h:47
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
PixelRDOAnalysis::m_h_barrelEndcap_sdo
TH1 * m_h_barrelEndcap_sdo
Definition: PixelRDOAnalysis.h:119
PixelID::layer_disk
int layer_disk(const Identifier &id) const
Definition: PixelID.h:626
python.SystemOfUnits.bar
int bar
Definition: SystemOfUnits.py:188
HepMC::ConstGenParticlePtr
const GenParticle * ConstGenParticlePtr
Definition: GenParticle.h:38
PixelID::eta_module
int eta_module(const Identifier &id) const
Definition: PixelID.h:651
PixelRDOAnalysis::m_BCID
std::vector< int > * m_BCID
Definition: PixelRDOAnalysis.h:56
PixelRDOAnalysis::m_h_BCID
TH1 * m_h_BCID
Definition: PixelRDOAnalysis.h:93
PixelRDOAnalysis::m_h_LVL1ID
TH1 * m_h_LVL1ID
Definition: PixelRDOAnalysis.h:95
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
PixelRDOAnalysis::m_h_etaIndex_sdo
TH1 * m_h_etaIndex_sdo
Definition: PixelRDOAnalysis.h:124
PixelRDOAnalysis::m_h_layerDisk
TH1 * m_h_layerDisk
Definition: PixelRDOAnalysis.h:87
charge
double charge(const T &p)
Definition: AtlasPID.h:494
PixelRDOAnalysis::m_h_etaModule_sdo
TH1 * m_h_etaModule_sdo
Definition: PixelRDOAnalysis.h:122
PixelRDOAnalysis::m_h_phiIndex
TH1 * m_h_phiIndex
Definition: PixelRDOAnalysis.h:90
PixelRDOAnalysis::m_etaIndex
std::vector< int > * m_etaIndex
Definition: PixelRDOAnalysis.h:53
PixelRDOAnalysis::PixelRDOAnalysis
PixelRDOAnalysis(const std::string &name, ISvcLocator *pSvcLocator)
Definition: PixelRDOAnalysis.cxx:18
PixelRDOAnalysis::m_h_ecLVL1ID
TH1 * m_h_ecLVL1ID
Definition: PixelRDOAnalysis.h:115
PixelRDOAnalysis::m_ntupleTreeName
std::string m_ntupleTreeName
Definition: PixelRDOAnalysis.h:133
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
PixelRDOAnalysis::m_thistSvc
ServiceHandle< ITHistSvc > m_thistSvc
Definition: PixelRDOAnalysis.h:135
PixelRDOAnalysis::m_phiModule
std::vector< int > * m_phiModule
Definition: PixelRDOAnalysis.h:50
InDetSimData::word
int word() const
Definition: InDetSimData.h:69
PixelRDOAnalysis::m_h_LVL1A
TH1 * m_h_LVL1A
Definition: PixelRDOAnalysis.h:94
PixelRDOAnalysis::m_disabled
std::vector< bool > * m_disabled
Definition: PixelRDOAnalysis.h:73
Identifier::get_compact
value_type get_compact(void) const
Get the compact id.
PixelRDOAnalysis::m_h_phiIndex_sdo
TH1 * m_h_phiIndex_sdo
Definition: PixelRDOAnalysis.h:123
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
PixelRDOAnalysis::m_LVL1A
std::vector< int > * m_LVL1A
Definition: PixelRDOAnalysis.h:57
PixelRDOAnalysis::m_h_brlBCID
TH1 * m_h_brlBCID
Definition: PixelRDOAnalysis.h:103
PixelRDOAnalysis::m_h_ecEtaIndex
TH1 * m_h_ecEtaIndex
Definition: PixelRDOAnalysis.h:111
PixelRDOAnalysis::m_pixelID
const PixelID * m_pixelID
Definition: PixelRDOAnalysis.h:43
PixelSimHelper::isDisabled
static bool isDisabled(const InDetSimData &sdo)
Definition: PixelSimHelper.h:119
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24
PixelRDOAnalysis::m_h_brlPhiMod
TH1 * m_h_brlPhiMod
Definition: PixelRDOAnalysis.h:98
DataVector::at
const T * at(size_type n) const
Access an element, as an rvalue.
ReadHandle.h
Handle class for reading from StoreGate.
PixelRDOAnalysis::m_h_TruthMatchedRDOs
TH1 * m_h_TruthMatchedRDOs
Definition: PixelRDOAnalysis.h:128
PixelRDOAnalysis::m_layerDisk_sdo
std::vector< int > * m_layerDisk_sdo
Definition: PixelRDOAnalysis.h:65
PixelRDOAnalysis::m_phiIndex_sdo
std::vector< int > * m_phiIndex_sdo
Definition: PixelRDOAnalysis.h:68
PixelRDOAnalysis::m_h_ToT
TH1 * m_h_ToT
Definition: PixelRDOAnalysis.h:92
PixelRDOAnalysis::m_h_brlToT
TH1 * m_h_brlToT
Definition: PixelRDOAnalysis.h:102
PixelID::phi_module
int phi_module(const Identifier &id) const
Definition: PixelID.h:644
PixelRDOAnalysis::m_charge
std::vector< int > * m_charge
Definition: PixelRDOAnalysis.h:78
PixelRDOAnalysis::m_belowThresh
std::vector< bool > * m_belowThresh
Definition: PixelRDOAnalysis.h:72
PixelRDOAnalysis::m_layerDisk
std::vector< int > * m_layerDisk
Definition: PixelRDOAnalysis.h:49
PixelRDOAnalysis::m_path
std::string m_path
Definition: PixelRDOAnalysis.h:134
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
PixelRDOAnalysis::m_h_ecToT
TH1 * m_h_ecToT
Definition: PixelRDOAnalysis.h:112
PixelRDOAnalysis::m_h_layerDisk_sdo
TH1 * m_h_layerDisk_sdo
Definition: PixelRDOAnalysis.h:120
WriteCellNoiseToCool.noise
noise
Definition: WriteCellNoiseToCool.py:380
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
PixelRDOAnalysis::m_h_brlLVL1A
TH1 * m_h_brlLVL1A
Definition: PixelRDOAnalysis.h:104