ATLAS Offline Software
SCT_RDOAnalysis.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 #include "SCT_RDOAnalysis.h"
6 
8 #include "StoreGate/ReadHandle.h"
9 
10 #include "TString.h"
11 #include "TTree.h"
12 
13 #include <algorithm>
14 #include <cmath>
15 #include <iostream>
16 #include <functional>
17 
18 SCT_RDOAnalysis::SCT_RDOAnalysis(const std::string& name, ISvcLocator *pSvcLocator)
19  : AthAlgorithm(name, pSvcLocator)
20  , m_sctID{nullptr}
21  , m_rdoID{nullptr}
22  , m_rdoWord{nullptr}
23  , m_barrelEndcap{nullptr}
24  , m_layerDisk{nullptr}
25  , m_phiModule{nullptr}
26  , m_etaModule{nullptr}
27  , m_side{nullptr}
28  , m_strip{nullptr}
29  , m_groupSize{nullptr}
30  , m_sdoID{nullptr}
31  , m_sdoWord{nullptr}
32  , m_barrelEndcap_sdo{nullptr}
33  , m_layerDisk_sdo{nullptr}
34  , m_phiModule_sdo{nullptr}
35  , m_etaModule_sdo{nullptr}
36  , m_side_sdo{nullptr}
37  , m_strip_sdo{nullptr}
38  , m_noise{nullptr}
39  , m_belowThresh{nullptr}
40  , m_disabled{nullptr}
41  , m_barcode{nullptr}
42  , m_eventIndex{nullptr}
43  , m_charge{nullptr}
44  , m_barcode_vec{nullptr}
45  , m_eventIndex_vec{nullptr}
46  , m_charge_vec{nullptr}
47 
48  , m_h_rdoID{nullptr}
49  , m_h_rdoWord{nullptr}
50  , m_h_barrelEndcap{nullptr}
51  , m_h_layerDisk{nullptr}
52  , m_h_phiModule{nullptr}
53  , m_h_etaModule{nullptr}
54  , m_h_side{nullptr}
55  , m_h_strip{nullptr}
56  , m_h_groupSize{nullptr}
57  , m_h_phi_v_eta{nullptr}
58  , m_h_brlLayer{nullptr}
59  , m_h_brlPhiMod{nullptr}
60  , m_h_brlEtaMod{nullptr}
61  , m_h_brlSide{nullptr}
62  , m_h_brlStrip{nullptr}
63  , m_h_brlGroupSize{nullptr}
64  , m_h_brl_phi_v_eta{nullptr}
65  , m_h_ecDisk{nullptr}
66  , m_h_ecPhiMod{nullptr}
67  , m_h_ecEtaMod{nullptr}
68  , m_h_ecSide{nullptr}
69  , m_h_ecStrip{nullptr}
70  , m_h_ecGroupSize{nullptr}
71  , m_h_ec_phi_v_eta{nullptr}
72  , m_h_sdoID{nullptr}
73  , m_h_sdoWord{nullptr}
74  , m_h_barrelEndcap_sdo{nullptr}
75  , m_h_layerDisk_sdo{nullptr}
76  , m_h_phiModule_sdo{nullptr}
77  , m_h_etaModule_sdo{nullptr}
78  , m_h_side_sdo{nullptr}
79  , m_h_strip_sdo{nullptr}
80  , m_h_barcode{nullptr}
81  , m_h_eventIndex{nullptr}
82  , m_h_charge{nullptr}
83  , m_h_phi_v_eta_sdo{nullptr}
84  , m_h_TruthMatchedRDOs{nullptr}
85 
86  , m_tree{nullptr}
87  , m_thistSvc("THistSvc", name)
88  {
89  }
90 
92  ATH_MSG_DEBUG( "Initializing SCT_RDOAnalysis" );
93 
94  // This will check that the properties were initialized
95  // properly by job configuration.
96  ATH_CHECK( m_inputKey.initialize() );
99 
100  // Grab SCT_ID helper
101  ATH_CHECK(detStore()->retrieve(m_sctID, "SCT_ID"));
102 
103  // Grab Ntuple and histogramming service for tree
104  ATH_CHECK(m_thistSvc.retrieve());
105 
106  m_tree = new TTree(TString(m_ntupleTreeName.value()), "SCT_RDOAna");
107  std::string fullNtupleName = m_ntupleFileName.value() + m_ntupleDirName.value() + m_ntupleTreeName.value();
108  ATH_CHECK(m_thistSvc->regTree(fullNtupleName, m_tree));
109  if (m_tree) {
110  // SCT RDO
111  m_tree->Branch("rdoID", &m_rdoID);
112  m_tree->Branch("rdoWord", &m_rdoWord);
113  m_tree->Branch("barrelEndcap", &m_barrelEndcap);
114  m_tree->Branch("layerDisk", &m_layerDisk);
115  m_tree->Branch("phiModule", &m_phiModule);
116  m_tree->Branch("etaModule", &m_etaModule);
117  m_tree->Branch("side", &m_side);
118  m_tree->Branch("strip", &m_strip);
119  m_tree->Branch("groupSize", &m_groupSize);
120  // SCT SDO deposits
121  m_tree->Branch("sdoID", &m_sdoID);
122  m_tree->Branch("sdoWord", &m_sdoWord);
123  m_tree->Branch("barrelEndcap_sdo", &m_barrelEndcap_sdo);
124  m_tree->Branch("layerDisk_sdo", &m_layerDisk_sdo);
125  m_tree->Branch("phiModule_sdo", &m_phiModule_sdo);
126  m_tree->Branch("etaModule_sdo", &m_etaModule_sdo);
127  m_tree->Branch("side_sdo", &m_side_sdo);
128  m_tree->Branch("strip_sdo", &m_strip_sdo);
129  m_tree->Branch("noise", &m_noise);
130  m_tree->Branch("belowThresh", &m_belowThresh);
131  m_tree->Branch("disabled", &m_disabled);
132  m_tree->Branch("barcode", &m_barcode);
133  m_tree->Branch("eventIndex", &m_eventIndex);
134  m_tree->Branch("charge", &m_charge);
135  m_tree->Branch("barcode_vec", &m_barcode_vec);
136  m_tree->Branch("eventIndex_vec", &m_eventIndex_vec);
137  m_tree->Branch("charge_vec", &m_charge_vec);
138  } else {
139  ATH_MSG_ERROR("No tree found!");
140  }
141 
142  // HISTOGRAMS
143  m_h_rdoID = new TH1F("h_rdoID", "rdoID", 100, 0, 1e18);
144  m_h_rdoID->StatOverflows();
145  ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_rdoID->GetName(), m_h_rdoID));
146 
147  m_h_rdoWord = new TH1F("h_rdoWord", "rdoWord", 100, 0, 1e7);
148  m_h_rdoWord->StatOverflows();
149  ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_rdoWord->GetName(), m_h_rdoWord));
150 
151  m_h_barrelEndcap = new TH1F("h_barrelEndcap", "Barrel or Endcap", 100, -3, 3);
152  m_h_barrelEndcap->StatOverflows();
153  ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_barrelEndcap->GetName(), m_h_barrelEndcap));
154 
155  m_h_layerDisk = new TH1F("h_layerDisk", "Barrel layer or Endcap disk", 100, 0, 10);
156  m_h_layerDisk->StatOverflows();
157  ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_layerDisk->GetName(), m_h_layerDisk));
158 
159  m_h_phiModule = new TH1F("h_phiModule", "Phi module", 100, 0, 60);
160  m_h_phiModule->StatOverflows();
161  ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_phiModule->GetName(), m_h_phiModule));
162 
163  m_h_etaModule = new TH1F("h_etaModule", "Eta module", 100, -7, 7);
164  m_h_etaModule->StatOverflows();
165  ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_etaModule->GetName(), m_h_etaModule));
166 
167  m_h_side = new TH1F("h_side", "Side", 100, 0, 1.5);
168  m_h_side->StatOverflows();
169  ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_side->GetName(), m_h_side));
170 
171  m_h_strip = new TH1F("h_strip", "Strip", 100, 0, 800);
172  m_h_strip->StatOverflows();
173  ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_strip->GetName(), m_h_strip));
174 
175  m_h_groupSize = new TH1F("h_groupSize", "Group size", 100, 0, 150);
176  m_h_groupSize->StatOverflows();
177  ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_groupSize->GetName(), m_h_groupSize));
178 
179  m_h_phi_v_eta = new TH2F("h_phi_v_eta", "Phi module vs eta module", 100, -7, 7, 100, 0, 60);
180  m_h_phi_v_eta->StatOverflows();
181  ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_phi_v_eta->GetName(), m_h_phi_v_eta));
182 
183  m_h_brlLayer = new TH1F("h_brlLayer", "Barrel layer", 100, 0, 10);
184  m_h_brlLayer->StatOverflows();
185  ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_brlLayer->GetName(), m_h_brlLayer));
186 
187  m_h_brlPhiMod = new TH1F("h_brlPhiMod", "Barrel phi module", 100, 0, 60);
188  m_h_brlPhiMod->StatOverflows();
189  ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_brlPhiMod->GetName(), m_h_brlPhiMod));
190 
191  m_h_brlEtaMod = new TH1F("h_brlEtaMod", "Barrel eta module", 100, -7, 7);
192  m_h_brlEtaMod->StatOverflows();
193  ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_brlEtaMod->GetName(), m_h_brlEtaMod));
194 
195  m_h_brlSide = new TH1F("h_brlSide", "Barrel side", 100, 0, 1.5);
196  m_h_brlSide->StatOverflows();
197  ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_brlSide->GetName(), m_h_brlSide));
198 
199  m_h_brlStrip = new TH1F("h_brlStrip", "Barrel strip", 100, 0, 800);
200  m_h_brlStrip->StatOverflows();
201  ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_brlStrip->GetName(), m_h_brlStrip));
202 
203  m_h_brlGroupSize = new TH1F("h_brlGroupSize", "Barrel group size", 100, 0, 150);
204  m_h_brlGroupSize->StatOverflows();
205  ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_brlGroupSize->GetName(), m_h_brlGroupSize));
206 
207  m_h_brl_phi_v_eta = new TH2F("h_brl_phi_v_eta", "Barrel phi module vs eta module", 100, -7, 7, 100, 0, 60);
208  m_h_brl_phi_v_eta->StatOverflows();
209  ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_brl_phi_v_eta->GetName(), m_h_brl_phi_v_eta));
210 
211  m_h_ecDisk = new TH1F("h_ecDisk", "Endcap disk", 100, 0, 10);
212  m_h_ecDisk->StatOverflows();
213  ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_ecDisk->GetName(), m_h_ecDisk));
214 
215  m_h_ecPhiMod = new TH1F("h_ecPhiMod", "Endcap phi module", 100, 0, 60);
216  m_h_ecPhiMod->StatOverflows();
217  ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_ecPhiMod->GetName(), m_h_ecPhiMod));
218 
219  m_h_ecEtaMod = new TH1F("h_ecEtaMod", "Endcap eta module", 100, -7, 7);
220  m_h_ecEtaMod->StatOverflows();
221  ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_ecEtaMod->GetName(), m_h_ecEtaMod));
222 
223  m_h_ecSide = new TH1F("h_ecSide", "Endcap side", 100, 0, 1.5);
224  m_h_ecSide->StatOverflows();
225  ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_ecSide->GetName(), m_h_ecSide));
226 
227  m_h_ecStrip = new TH1F("h_ecStrip", "Endcap strip", 100, 0, 800);
228  m_h_ecStrip->StatOverflows();
229  ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_ecStrip->GetName(), m_h_ecStrip));
230 
231  m_h_ecGroupSize = new TH1F("h_ecGroupSize", "Endcap group size", 100, 0, 150);
232  m_h_ecGroupSize->StatOverflows();
233  ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_ecGroupSize->GetName(), m_h_ecGroupSize));
234 
235  m_h_ec_phi_v_eta = new TH2F("h_ec_phi_v_eta", "Endcap phi module vs eta module", 100, -7.5, 7.5, 100, 0, 60);
236  m_h_ec_phi_v_eta->StatOverflows();
237  ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_ec_phi_v_eta->GetName(), m_h_ec_phi_v_eta));
238 
239  m_h_sdoID = new TH1F("h_sdoID", "sdoID", 100, 0, 1e18);
240  m_h_sdoID->StatOverflows();
241  ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_sdoID->GetName(), m_h_sdoID));
242 
243  m_h_sdoWord = new TH1F("h_sdoWord", "sdoWord", 100, 0, 1e7);
244  m_h_sdoWord->StatOverflows();
245  ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_sdoWord->GetName(), m_h_sdoWord));
246 
247  m_h_barrelEndcap_sdo = new TH1F("h_barrelEndcap_sdo", "Barrel or Endcap (SDO)", 100, -3, 3);
248  m_h_barrelEndcap_sdo->StatOverflows();
249  ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_barrelEndcap_sdo->GetName(), m_h_barrelEndcap_sdo));
250 
251  m_h_layerDisk_sdo = new TH1F("h_layerDisk_sdo", "Barrel layer or Endcap disk (SDO)", 100, 0, 10);
252  m_h_layerDisk_sdo->StatOverflows();
253  ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_layerDisk_sdo->GetName(), m_h_layerDisk_sdo));
254 
255  m_h_phiModule_sdo = new TH1F("h_phiModule_sdo", "Phi module (SDO)", 100, 0, 60);
256  m_h_phiModule_sdo->StatOverflows();
257  ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_phiModule_sdo->GetName(), m_h_phiModule_sdo));
258 
259  m_h_etaModule_sdo = new TH1F("h_etaModule_sdo", "Eta module (SDO)", 100, -7, 7);
260  m_h_etaModule_sdo->StatOverflows();
261  ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_etaModule_sdo->GetName(), m_h_etaModule_sdo));
262 
263  m_h_side_sdo = new TH1F("h_side_sdo", "Side (SDO)", 100, 0, 1.5);
264  m_h_side_sdo->StatOverflows();
265  ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_side_sdo->GetName(), m_h_side_sdo));
266 
267  m_h_strip_sdo = new TH1F("h_strip_sdo", "Strip (SDO)", 100, 0, 800);
268  m_h_strip_sdo->StatOverflows();
269  ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_strip_sdo->GetName(), m_h_strip_sdo));
270 
271  m_h_barcode = new TH1F("h_barcode", "Barcode (SDO)", 100, 0, 2.2e5);
272  m_h_barcode->StatOverflows();
273  ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_barcode->GetName(), m_h_barcode));
274 
275  m_h_eventIndex = new TH1F("h_eventIndex", "Event index (SDO)", 100, 0, 10);
276  m_h_eventIndex->StatOverflows();
277  ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_eventIndex->GetName(), m_h_eventIndex));
278 
279  m_h_charge = new TH1F("h_charge", "Charge (SDO)", 100, 0, 6e6);
280  m_h_charge->StatOverflows();
281  ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_charge->GetName(), m_h_charge));
282 
283  m_h_phi_v_eta_sdo = new TH2F("h_phi_v_eta_sdo", "Phi module vs eta module (SDO)", 100, -7, 7, 100, 0, 60);
284  m_h_phi_v_eta_sdo->StatOverflows();
285  ATH_CHECK(m_thistSvc->regHist(m_path.value() + m_h_phi_v_eta_sdo->GetName(), m_h_phi_v_eta_sdo));
286 
287  m_h_TruthMatchedRDOs = new TH1F("h_TruthMatchedSCTRDOs", "h_TruthMatchedSCTRDOs", 4, 1, 5);
288  TString truthMatchBinLables[4] = { "All RDOs", "Truth Matched", "HS Matched", "Unmatched" };
289  for(unsigned int ibin = 1; ibin < 5; ibin++) {
290  m_h_TruthMatchedRDOs->GetXaxis()->SetBinLabel(ibin, truthMatchBinLables[ibin-1]);
291  }
293 
294 
295 
296  return StatusCode::SUCCESS;
297 }
298 
300  ATH_MSG_DEBUG( "In SCT_RDOAnalysis::execute()" );
301 
302  m_rdoID->clear();
303  m_rdoWord->clear();
304  m_barrelEndcap->clear();
305  m_layerDisk->clear();
306  m_phiModule->clear();
307  m_etaModule->clear();
308  m_side->clear();
309  m_strip->clear();
310  m_groupSize->clear();
311  m_sdoID->clear();
312  m_sdoWord->clear();
313  m_barrelEndcap_sdo->clear();
314  m_layerDisk_sdo->clear();
315  m_phiModule_sdo->clear();
316  m_etaModule_sdo->clear();
317  m_side_sdo->clear();
318  m_strip_sdo->clear();
319  m_noise->clear();
320  m_belowThresh->clear();
321  m_disabled->clear();
322  m_barcode->clear();
323  m_eventIndex->clear();
324  m_charge->clear();
325  m_barcode_vec->clear();
326  m_eventIndex_vec->clear();
327  m_charge_vec->clear();
328 
329  // RawData
331  //Adding SimMap and McEvent here for added truthMatching checks
334 
335  const HepMC::GenEvent* hardScatterEvent(nullptr);
336  bool doTruthMatching = true;
337  if ((!mcEventCollection.isValid())||mcEventCollection->size()==0){
338  ATH_MSG_WARNING("Failed to retrieve a nonzero sized truth event collection, disabling truthMatching");
339  doTruthMatching = false;
340  }
341  if(doTruthMatching) hardScatterEvent = mcEventCollection->at(0);
342 
343  if(p_SCT_RDO_cont.isValid()) {
344  // loop over RDO container
345  SCT_RDO_Container::const_iterator rdoCont_itr(p_SCT_RDO_cont->begin());
346  const SCT_RDO_Container::const_iterator rdoCont_end(p_SCT_RDO_cont->end());
347 
348  for ( ; rdoCont_itr != rdoCont_end; ++rdoCont_itr ) {
349  const SCT_RDO_Collection* p_SCT_RDO_coll(*rdoCont_itr);
350  SCT_RDO_Collection::const_iterator rdo_itr(p_SCT_RDO_coll->begin());
351  const SCT_RDO_Collection::const_iterator rdo_end(p_SCT_RDO_coll->end());
352 
353  for ( ; rdo_itr != rdo_end; ++rdo_itr ) {
354  if(doTruthMatching){
356  bool findMatch = false;
357  if(simDataMapSCT.isValid()){
358  InDetSimDataCollection::const_iterator iter = (*simDataMapSCT).find((*rdo_itr)->identify());
359 
360  if ( iter != (*simDataMapSCT).end() ) {
361  const InDetSimData& sdo = iter->second;
362  const std::vector< InDetSimData::Deposit >& deposits = sdo.getdeposits();
363  std::vector< InDetSimData::Deposit >::const_iterator nextdeposit = deposits.begin();
364  std::vector< InDetSimData::Deposit >::const_iterator lastdeposit = deposits.end();
365  for( ; nextdeposit!=lastdeposit; ++nextdeposit) {
366  const HepMcParticleLink& particleLink = nextdeposit->first;
367  if(particleLink.isValid() && !findMatch){
368  HepMC::ConstGenParticlePtr genPart(particleLink.cptr());
369  if(genPart->parent_event() == hardScatterEvent) m_h_TruthMatchedRDOs->Fill(3.5);
371  findMatch = true;
372  }
373  }
374  }
375  }
376  if(!findMatch) m_h_TruthMatchedRDOs->Fill(4.5);
377  }
378  const Identifier rdoID((*rdo_itr)->identify());
379  const unsigned int rdoWord((*rdo_itr)->getWord());
380  const int sctBrlEc(m_sctID->barrel_ec(rdoID));
381  const int sctLayerDisk(m_sctID->layer_disk(rdoID));
382  const int sctPhiMod(m_sctID->phi_module(rdoID));
383  const int sctEtaMod(m_sctID->eta_module(rdoID));
384  const int sctSide(m_sctID->side(rdoID));
385  const int sctStrip(m_sctID->strip(rdoID));
386  const int sctGroupSize((*rdo_itr)->getGroupSize());
387 
388  const unsigned long long rdoID_int = rdoID.get_compact();
389  m_rdoID->push_back(rdoID_int);
390  m_rdoWord->push_back(rdoWord);
391  m_barrelEndcap->push_back(sctBrlEc);
392  m_layerDisk->push_back(sctLayerDisk);
393  m_phiModule->push_back(sctPhiMod);
394  m_etaModule->push_back(sctEtaMod);
395  m_side->push_back(sctSide);
396  m_strip->push_back(sctStrip);
397  m_groupSize->push_back(sctGroupSize);
398 
399  m_h_rdoID->Fill(rdoID_int);
400  m_h_rdoWord->Fill(rdoWord);
401  m_h_barrelEndcap->Fill(sctBrlEc);
402  m_h_layerDisk->Fill(sctLayerDisk);
403  m_h_phiModule->Fill(sctPhiMod);
404  m_h_etaModule->Fill(sctEtaMod);
405  m_h_side->Fill(sctSide);
406  m_h_strip->Fill(sctStrip);
407  m_h_groupSize->Fill(sctGroupSize);
408  m_h_phi_v_eta->Fill(sctEtaMod, sctPhiMod);
409 
410  if (sctBrlEc == 0) {
411  m_h_brlLayer->Fill(sctLayerDisk);
412  m_h_brlPhiMod->Fill(sctPhiMod);
413  m_h_brlEtaMod->Fill(sctEtaMod);
414  m_h_brlSide->Fill(sctSide);
415  m_h_brlStrip->Fill(sctStrip);
416  m_h_brlGroupSize->Fill(sctGroupSize);
417  m_h_brl_phi_v_eta->Fill(sctEtaMod, sctPhiMod);
418  }
419  else if (std::abs(sctBrlEc) == 2) {
420  m_h_ecDisk->Fill(sctLayerDisk);
421  m_h_ecPhiMod->Fill(sctPhiMod);
422  m_h_ecEtaMod->Fill(sctEtaMod);
423  m_h_ecSide->Fill(sctSide);
424  m_h_ecStrip->Fill(sctStrip);
425  m_h_ecGroupSize->Fill(sctGroupSize);
426  m_h_ec_phi_v_eta->Fill(sctEtaMod, sctPhiMod);
427  }
428  }
429  }
430  }
431 
432  // SimData
433  if (simDataMapSCT.isValid()) {
434  // loop over SDO container
435  InDetSimDataCollection::const_iterator sdo_itr(simDataMapSCT->begin());
436  const InDetSimDataCollection::const_iterator sdo_end(simDataMapSCT->end());
437 
438  std::vector<int> barcode_vec;
439  std::vector<int> eventIndex_vec;
440  std::vector<float> charge_vec;
441  for (; sdo_itr != sdo_end; ++sdo_itr) {
442  const Identifier sdoID((*sdo_itr).first);
443  const InDetSimData& sdo((*sdo_itr).second);
444  const unsigned long long sdoID_int = sdoID.get_compact();
445  const int sdoWord(sdo.word());
446  const int sctBrlEc_sdo(m_sctID->barrel_ec(sdoID));
447  const int sctLayerDisk_sdo(m_sctID->layer_disk(sdoID));
448  const int sctPhiMod_sdo(m_sctID->phi_module(sdoID));
449  const int sctEtaMod_sdo(m_sctID->eta_module(sdoID));
450  const int sctSide_sdo(m_sctID->side(sdoID));
451  const int sctStrip_sdo(m_sctID->strip(sdoID));
452  const bool noise(SCT_SimHelper::isNoise(sdo));
453  const bool belowThresh(SCT_SimHelper::isBelowThreshold(sdo));
454  const bool disabled(SCT_SimHelper::isDisabled(sdo));
455 
456  m_sdoID->push_back(sdoID_int);
457  m_sdoWord->push_back(sdoWord);
458  m_barrelEndcap_sdo->push_back(sctBrlEc_sdo);
459  m_layerDisk_sdo->push_back(sctLayerDisk_sdo);
460  m_phiModule_sdo->push_back(sctPhiMod_sdo);
461  m_etaModule_sdo->push_back(sctEtaMod_sdo);
462  m_side_sdo->push_back(sctSide_sdo);
463  m_strip_sdo->push_back(sctStrip_sdo);
464  m_noise->push_back(noise);
465  m_belowThresh->push_back(belowThresh);
466  m_disabled->push_back(disabled);
467 
468  m_h_sdoID->Fill(sdoID_int);
469  m_h_sdoWord->Fill(sdoWord);
470  m_h_barrelEndcap_sdo->Fill(sctBrlEc_sdo);
471  m_h_layerDisk_sdo->Fill(sctLayerDisk_sdo);
472  m_h_phiModule_sdo->Fill(sctPhiMod_sdo);
473  m_h_etaModule_sdo->Fill(sctEtaMod_sdo);
474  m_h_side_sdo->Fill(sctSide_sdo);
475  m_h_strip_sdo->Fill(sctStrip_sdo);
476  m_h_phi_v_eta_sdo->Fill(sctEtaMod_sdo, sctPhiMod_sdo);
477 
478  // loop over deposits
479  // InDetSimData::Deposit typedef for std::pair<HepMCParticleLink,float>
480  const std::vector<InDetSimData::Deposit>& deposits = sdo.getdeposits();
481  std::vector<InDetSimData::Deposit>::const_iterator dep_itr(deposits.begin());
482  const std::vector<InDetSimData::Deposit>::const_iterator dep_end(deposits.end());
483 
484  for (; dep_itr != dep_end; ++dep_itr) {
485  const HepMcParticleLink& particleLink = (*dep_itr).first;
486  const int bar(HepMC::barcode(particleLink)); // FIXME barcode-based
487  const int eventIx(particleLink.eventIndex());
488  const float charge((*dep_itr).second);
489 
490  m_barcode->push_back(bar);
491  m_eventIndex->push_back(eventIx);
492  m_charge->push_back(charge);
493 
494  m_h_barcode->Fill(bar);
495  m_h_eventIndex->Fill(eventIx);
497 
498  barcode_vec.push_back(bar);
499  eventIndex_vec.push_back(eventIx);
500  charge_vec.push_back(charge);
501  }
502  m_barcode_vec->push_back(barcode_vec);
503  m_eventIndex_vec->push_back(eventIndex_vec);
504  m_charge_vec->push_back(charge_vec);
505  barcode_vec.clear();
506  eventIndex_vec.clear();
507  charge_vec.clear();
508  }
509  }
510 
511  if (m_tree) {
512  m_tree->Fill();
513  }
514 
515  return StatusCode::SUCCESS;
516 }
517 
519 
520  return StatusCode::SUCCESS;
521 
522 }
SCT_RDOAnalysis::m_groupSize
std::vector< int > * m_groupSize
Definition: SCT_RDOAnalysis.h:55
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
SCT_RDOAnalysis::SCT_RDOAnalysis
SCT_RDOAnalysis(const std::string &name, ISvcLocator *pSvcLocator)
Definition: SCT_RDOAnalysis.cxx:18
TH2::Fill
int Fill(double, double)
Definition: rootspy.cxx:382
SCT_RDOAnalysis::m_rdoWord
std::vector< unsigned int > * m_rdoWord
Definition: SCT_RDOAnalysis.h:46
SCT_RDOAnalysis::m_disabled
std::vector< bool > * m_disabled
Definition: SCT_RDOAnalysis.h:69
SCT_RDOAnalysis::m_phiModule
std::vector< int > * m_phiModule
Definition: SCT_RDOAnalysis.h:50
SCT_RDOAnalysis::m_h_strip
TH1 * m_h_strip
Definition: SCT_RDOAnalysis.h:86
SCT_RDOAnalysis::m_h_ecPhiMod
TH1 * m_h_ecPhiMod
Definition: SCT_RDOAnalysis.h:99
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
SCT_ID.h
This is an Identifier helper class for the SCT subdetector. This class is a factory for creating comp...
SCT_RDOAnalysis::m_h_brlSide
TH1 * m_h_brlSide
Definition: SCT_RDOAnalysis.h:93
SCT_RDOAnalysis::m_h_barcode
TH1 * m_h_barcode
Definition: SCT_RDOAnalysis.h:114
SCT_RDOAnalysis::m_noise
std::vector< bool > * m_noise
Definition: SCT_RDOAnalysis.h:67
SCT_RDOAnalysis::m_h_brl_phi_v_eta
TH2 * m_h_brl_phi_v_eta
Definition: SCT_RDOAnalysis.h:96
SCT_RDOAnalysis::m_barcode_vec
std::vector< std::vector< int > > * m_barcode_vec
Definition: SCT_RDOAnalysis.h:74
InDetSimData::getdeposits
const std::vector< Deposit > & getdeposits() const
Definition: InDetSimData.h:74
SCT_RDOAnalysis::m_barrelEndcap_sdo
std::vector< int > * m_barrelEndcap_sdo
Definition: SCT_RDOAnalysis.h:60
SCT_SimHelper::isDisabled
static bool isDisabled(const InDetSimData &sdo)
Definition: SCT_SimHelper.h:103
SCT_RDOAnalysis::m_rdoID
std::vector< unsigned long long > * m_rdoID
Definition: SCT_RDOAnalysis.h:45
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
SCT_RDOAnalysis::m_h_etaModule
TH1 * m_h_etaModule
Definition: SCT_RDOAnalysis.h:84
SCT_RDOAnalysis::m_h_side
TH1 * m_h_side
Definition: SCT_RDOAnalysis.h:85
SCT_RDOAnalysis::m_strip_sdo
std::vector< int > * m_strip_sdo
Definition: SCT_RDOAnalysis.h:65
SCT_RDOAnalysis::m_h_barrelEndcap_sdo
TH1 * m_h_barrelEndcap_sdo
Definition: SCT_RDOAnalysis.h:108
SCT_RDOAnalysis::m_h_sdoID
TH1 * m_h_sdoID
Definition: SCT_RDOAnalysis.h:106
SCT_RDOAnalysis::m_h_phi_v_eta
TH2 * m_h_phi_v_eta
Definition: SCT_RDOAnalysis.h:88
SCT_RDOAnalysis::m_sctID
const SCT_ID * m_sctID
Definition: SCT_RDOAnalysis.h:43
SCT_RDOAnalysis::m_h_phiModule
TH1 * m_h_phiModule
Definition: SCT_RDOAnalysis.h:83
SCT_RDOAnalysis::m_thistSvc
ServiceHandle< ITHistSvc > m_thistSvc
Definition: SCT_RDOAnalysis.h:126
SCT_ID::barrel_ec
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition: SCT_ID.h:728
SCT_ID::phi_module
int phi_module(const Identifier &id) const
Definition: SCT_ID.h:740
python.TrigEgammaMonitorHelper.TH2F
def TH2F(name, title, nxbins, bins_par2, bins_par3, bins_par4, bins_par5=None, bins_par6=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:45
SCT_RDOAnalysis::m_ntupleDirName
StringProperty m_ntupleDirName
Definition: SCT_RDOAnalysis.h:123
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
SCT_RDOAnalysis::m_h_brlGroupSize
TH1 * m_h_brlGroupSize
Definition: SCT_RDOAnalysis.h:95
SCT_RDOAnalysis::m_h_ecDisk
TH1 * m_h_ecDisk
Definition: SCT_RDOAnalysis.h:98
SCT_RDOAnalysis::m_path
StringProperty m_path
Definition: SCT_RDOAnalysis.h:125
SCT_RDOAnalysis::m_h_ec_phi_v_eta
TH2 * m_h_ec_phi_v_eta
Definition: SCT_RDOAnalysis.h:104
SCT_RDOAnalysis::finalize
virtual StatusCode finalize() override final
Definition: SCT_RDOAnalysis.cxx:518
SCT_RDOAnalysis::m_h_TruthMatchedRDOs
TH1 * m_h_TruthMatchedRDOs
Definition: SCT_RDOAnalysis.h:118
SCT_RDOAnalysis::m_sdoID
std::vector< unsigned long long > * m_sdoID
Definition: SCT_RDOAnalysis.h:57
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
SCT_RDOAnalysis::m_ntupleTreeName
StringProperty m_ntupleTreeName
Definition: SCT_RDOAnalysis.h:124
SCT_RDOAnalysis::m_h_rdoWord
TH1 * m_h_rdoWord
Definition: SCT_RDOAnalysis.h:80
SCT_RDOAnalysis::m_eventIndex
std::vector< int > * m_eventIndex
Definition: SCT_RDOAnalysis.h:72
SCT_RDOAnalysis::m_h_brlLayer
TH1 * m_h_brlLayer
Definition: SCT_RDOAnalysis.h:90
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
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
SCT_RDOAnalysis::m_h_brlStrip
TH1 * m_h_brlStrip
Definition: SCT_RDOAnalysis.h:94
HepMC::barcode
int barcode(const T *p)
Definition: Barcode.h:16
SCT_RDOAnalysis::initialize
virtual StatusCode initialize() override final
Definition: SCT_RDOAnalysis.cxx:91
SCT_RDOAnalysis::m_inputMcEventCollectionKey
SG::ReadHandleKey< McEventCollection > m_inputMcEventCollectionKey
Definition: SCT_RDOAnalysis.h:42
InDetSimData
Definition: InDetSimData.h:42
SCT_RDOAnalysis::execute
virtual StatusCode execute() override final
Definition: SCT_RDOAnalysis.cxx:299
SCT_RDOAnalysis::m_h_ecGroupSize
TH1 * m_h_ecGroupSize
Definition: SCT_RDOAnalysis.h:103
SCT_RDOAnalysis::m_side
std::vector< int > * m_side
Definition: SCT_RDOAnalysis.h:52
InDetRawDataCollection
Definition: InDetRawDataCollection.h:31
SCT_RDOAnalysis::m_h_groupSize
TH1 * m_h_groupSize
Definition: SCT_RDOAnalysis.h:87
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_RDOAnalysis::m_layerDisk_sdo
std::vector< int > * m_layerDisk_sdo
Definition: SCT_RDOAnalysis.h:61
SCT_Monitoring::disabled
@ disabled
Definition: SCT_MonitoringNumbers.h:60
SCT_RDOAnalysis::m_h_barrelEndcap
TH1 * m_h_barrelEndcap
Definition: SCT_RDOAnalysis.h:81
IdentifiableContainerMT::const_iterator
Definition: IdentifiableContainerMT.h:82
SCT_RDOAnalysis::m_etaModule
std::vector< int > * m_etaModule
Definition: SCT_RDOAnalysis.h:51
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
TH1::Fill
int Fill(double)
Definition: rootspy.cxx:285
SCT_RDOAnalysis::m_h_eventIndex
TH1 * m_h_eventIndex
Definition: SCT_RDOAnalysis.h:115
SCT_RDOAnalysis::m_h_etaModule_sdo
TH1 * m_h_etaModule_sdo
Definition: SCT_RDOAnalysis.h:111
SCT_RDOAnalysis::m_h_layerDisk_sdo
TH1 * m_h_layerDisk_sdo
Definition: SCT_RDOAnalysis.h:109
AthAlgorithm
Definition: AthAlgorithm.h:47
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SCT_RDOAnalysis::m_phiModule_sdo
std::vector< int > * m_phiModule_sdo
Definition: SCT_RDOAnalysis.h:62
SCT_RDOAnalysis::m_h_sdoWord
TH1 * m_h_sdoWord
Definition: SCT_RDOAnalysis.h:107
SCT_RDOAnalysis::m_inputKey
SG::ReadHandleKey< SCT_RDO_Container > m_inputKey
Definition: SCT_RDOAnalysis.h:40
SCT_RDOAnalysis::m_side_sdo
std::vector< int > * m_side_sdo
Definition: SCT_RDOAnalysis.h:64
python.SystemOfUnits.bar
int bar
Definition: SystemOfUnits.py:188
SCT_RDOAnalysis::m_h_side_sdo
TH1 * m_h_side_sdo
Definition: SCT_RDOAnalysis.h:112
HepMC::ConstGenParticlePtr
const GenParticle * ConstGenParticlePtr
Definition: GenParticle.h:38
SCT_RDOAnalysis::m_h_ecEtaMod
TH1 * m_h_ecEtaMod
Definition: SCT_RDOAnalysis.h:100
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
SCT_RDOAnalysis::m_h_strip_sdo
TH1 * m_h_strip_sdo
Definition: SCT_RDOAnalysis.h:113
SCT_RDOAnalysis::m_barrelEndcap
std::vector< int > * m_barrelEndcap
Definition: SCT_RDOAnalysis.h:48
charge
double charge(const T &p)
Definition: AtlasPID.h:494
SCT_ID::layer_disk
int layer_disk(const Identifier &id) const
Definition: SCT_ID.h:734
SCT_RDOAnalysis::m_h_phi_v_eta_sdo
TH2 * m_h_phi_v_eta_sdo
Definition: SCT_RDOAnalysis.h:117
SCT_RDOAnalysis::m_inputTruthKey
SG::ReadHandleKey< InDetSimDataCollection > m_inputTruthKey
Definition: SCT_RDOAnalysis.h:41
SCT_RDOAnalysis::m_layerDisk
std::vector< int > * m_layerDisk
Definition: SCT_RDOAnalysis.h:49
SCT_RDOAnalysis::m_h_ecStrip
TH1 * m_h_ecStrip
Definition: SCT_RDOAnalysis.h:102
SCT_RDOAnalysis::m_h_ecSide
TH1 * m_h_ecSide
Definition: SCT_RDOAnalysis.h:101
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
SCT_SimHelper::isNoise
static bool isNoise(const InDetSimData &sdo)
Definition: SCT_SimHelper.h:93
SCT_RDOAnalysis::m_etaModule_sdo
std::vector< int > * m_etaModule_sdo
Definition: SCT_RDOAnalysis.h:63
InDetSimData::word
int word() const
Definition: InDetSimData.h:69
SCT_RDOAnalysis::m_charge
std::vector< float > * m_charge
Definition: SCT_RDOAnalysis.h:73
Identifier::get_compact
value_type get_compact(void) const
Get the compact id.
SCT_RDOAnalysis::m_h_phiModule_sdo
TH1 * m_h_phiModule_sdo
Definition: SCT_RDOAnalysis.h:110
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
SCT_ID::strip
int strip(const Identifier &id) const
Definition: SCT_ID.h:764
SCT_RDOAnalysis::m_h_brlEtaMod
TH1 * m_h_brlEtaMod
Definition: SCT_RDOAnalysis.h:92
SCT_ID::eta_module
int eta_module(const Identifier &id) const
Definition: SCT_ID.h:746
SCT_RDOAnalysis::m_h_brlPhiMod
TH1 * m_h_brlPhiMod
Definition: SCT_RDOAnalysis.h:91
SCT_RDOAnalysis.h
SCT_ID::side
int side(const Identifier &id) const
Definition: SCT_ID.h:752
SCT_RDOAnalysis::m_strip
std::vector< int > * m_strip
Definition: SCT_RDOAnalysis.h:53
SCT_RDOAnalysis::m_h_layerDisk
TH1 * m_h_layerDisk
Definition: SCT_RDOAnalysis.h:82
SCT_RDOAnalysis::m_barcode
std::vector< int > * m_barcode
Definition: SCT_RDOAnalysis.h:71
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24
DataVector::at
const T * at(size_type n) const
Access an element, as an rvalue.
ReadHandle.h
Handle class for reading from StoreGate.
SCT_RDOAnalysis::m_ntupleFileName
StringProperty m_ntupleFileName
Definition: SCT_RDOAnalysis.h:122
SCT_RDOAnalysis::m_belowThresh
std::vector< bool > * m_belowThresh
Definition: SCT_RDOAnalysis.h:68
SCT_RDOAnalysis::m_h_charge
TH1 * m_h_charge
Definition: SCT_RDOAnalysis.h:116
SCT_RDOAnalysis::m_tree
TTree * m_tree
Definition: SCT_RDOAnalysis.h:121
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
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.
SCT_RDOAnalysis::m_h_rdoID
TH1 * m_h_rdoID
Definition: SCT_RDOAnalysis.h:79
SCT_SimHelper::isBelowThreshold
static bool isBelowThreshold(const InDetSimData &sdo)
Definition: SCT_SimHelper.h:98
SCT_RDOAnalysis::m_sdoWord
std::vector< int > * m_sdoWord
Definition: SCT_RDOAnalysis.h:58
SCT_RDOAnalysis::m_charge_vec
std::vector< std::vector< float > > * m_charge_vec
Definition: SCT_RDOAnalysis.h:76
SCT_RDOAnalysis::m_eventIndex_vec
std::vector< std::vector< int > > * m_eventIndex_vec
Definition: SCT_RDOAnalysis.h:75