ATLAS Offline Software
Loading...
Searching...
No Matches
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
9
10#include "TString.h"
11#include "TTree.h"
12
13#include <algorithm>
14#include <cmath>
15#include <iostream>
16#include <functional>
17
18SCT_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() );
97 ATH_CHECK( m_inputTruthKey.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();
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){
355 m_h_TruthMatchedRDOs->Fill(1.5);
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);
370 m_h_TruthMatchedRDOs->Fill(2.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);
496 m_h_charge->Fill(charge);
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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
double charge(const T &p)
Definition AtlasPID.h:997
This is an Identifier helper class for the SCT subdetector.
InDetRawDataCollection< SCT_RDORawData > SCT_RDO_Collection
Handle class for reading from StoreGate.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
const ServiceHandle< StoreGateSvc > & detStore() const
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
const_iterator end() const noexcept
const_iterator begin() const noexcept
value_type get_compact() const
Get the compact id.
int word() const
const std::vector< Deposit > & getdeposits() const
std::vector< std::vector< float > > * m_charge_vec
std::vector< int > * m_side
std::vector< std::vector< int > > * m_eventIndex_vec
std::vector< int > * m_phiModule_sdo
StringProperty m_path
std::vector< int > * m_barrelEndcap
SG::ReadHandleKey< McEventCollection > m_inputMcEventCollectionKey
std::vector< int > * m_strip_sdo
StringProperty m_ntupleDirName
std::vector< int > * m_groupSize
virtual StatusCode execute() override final
std::vector< int > * m_eventIndex
std::vector< int > * m_layerDisk
std::vector< int > * m_side_sdo
std::vector< unsigned int > * m_rdoWord
std::vector< unsigned long long > * m_rdoID
ServiceHandle< ITHistSvc > m_thistSvc
std::vector< bool > * m_noise
std::vector< int > * m_phiModule
std::vector< int > * m_barrelEndcap_sdo
std::vector< int > * m_strip
std::vector< bool > * m_belowThresh
StringProperty m_ntupleTreeName
std::vector< std::vector< int > > * m_barcode_vec
const SCT_ID * m_sctID
SG::ReadHandleKey< SCT_RDO_Container > m_inputKey
std::vector< int > * m_layerDisk_sdo
StringProperty m_ntupleFileName
std::vector< int > * m_etaModule_sdo
std::vector< unsigned long long > * m_sdoID
std::vector< float > * m_charge
std::vector< int > * m_etaModule
SG::ReadHandleKey< InDetSimDataCollection > m_inputTruthKey
virtual StatusCode finalize() override final
std::vector< bool > * m_disabled
SCT_RDOAnalysis(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode initialize() override final
std::vector< int > * m_sdoWord
std::vector< int > * m_barcode
static bool isNoise(const InDetSimData &sdo)
static bool isBelowThreshold(const InDetSimData &sdo)
static bool isDisabled(const InDetSimData &sdo)
virtual bool isValid() override final
Can the handle be successfully dereferenced?
int barcode(const T *p)
Definition Barcode.h:16
const GenParticle * ConstGenParticlePtr
Definition GenParticle.h:38