ATLAS Offline Software
Loading...
Searching...
No Matches
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"
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
18PixelRDOAnalysis::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)
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)
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)
53 , m_charge_vec(0)
54 , m_h_rdoID(0)
55 , m_h_rdoWord(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)
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)
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() );
108 ATH_CHECK( m_inputTruthKey.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();
222
223 m_h_brlEtaIndex = new TH1F("h_brlEtaIndex", "Barrel eta index", 100, 0, 225);
224 m_h_brlEtaIndex->StatOverflows();
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();
258
259 m_h_ecEtaIndex = new TH1F("h_ecEtaIndex", "Endcap eta index", 100, 0, 225);
260 m_h_ecEtaIndex->StatOverflows();
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();
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){
392 m_h_TruthMatchedRDOs->Fill(1.5);
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);
407 m_h_TruthMatchedRDOs->Fill(2.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);
544 m_h_charge->Fill(charge);
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}
#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
InDetRawDataCollection< PixelRDORawData > PixelRDO_Collection
Handle class for reading from StoreGate.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
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< int > * m_etaModule
ServiceHandle< ITHistSvc > m_thistSvc
std::vector< int > * m_phiModule
PixelRDOAnalysis(const std::string &name, ISvcLocator *pSvcLocator)
std::vector< int > * m_phiIndex
std::vector< int > * m_phiModule_sdo
std::string m_ntupleFileName
std::vector< int > * m_barrelEndcap_sdo
std::vector< bool > * m_belowThresh
std::vector< int > * m_layerDisk_sdo
std::vector< int > * m_etaIndex
std::vector< int > * m_BCID
const PixelID * m_pixelID
std::vector< int > * m_barrelEndcap
SG::ReadHandleKey< PixelRDO_Container > m_inputKey
virtual StatusCode execute() override final
std::vector< int > * m_etaModule_sdo
std::vector< int > * m_LVL1A
std::vector< int > * m_phiIndex_sdo
std::vector< std::vector< int > > * m_eventIndex_vec
std::vector< int > * m_barcode
std::vector< int > * m_etaIndex_sdo
std::vector< int > * m_charge
std::vector< int > * m_sdoWord
std::vector< unsigned long long > * m_rdoID
std::vector< unsigned long long > * m_sdoID
std::vector< unsigned int > * m_rdoWord
virtual StatusCode initialize() override final
std::vector< int > * m_ToT
std::string m_ntupleTreeName
SG::ReadHandleKey< McEventCollection > m_inputMcEventCollectionKey
std::string m_ntupleDirName
std::vector< std::vector< int > > * m_barcode_vec
virtual StatusCode finalize() override final
std::vector< int > * m_eventIndex
SG::ReadHandleKey< InDetSimDataCollection > m_inputTruthKey
std::vector< bool > * m_noise
std::vector< std::vector< float > > * m_charge_vec
std::vector< bool > * m_badTOT
std::vector< int > * m_LVL1ID
std::vector< bool > * m_disabled
std::vector< int > * m_layerDisk
static bool isBelowThreshold(const InDetSimData &sdo)
static bool hasBadTOT(const InDetSimData &sdo)
static bool isNoise(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