ATLAS Offline Software
Loading...
Searching...
No Matches
ISF_HitAnalysis.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 "./ISF_HitAnalysis.h"
6
9
10// Section of includes for LAr calo tests
12#include "CaloDetDescr/CaloDetDescrElement.h"
14
15// Section of includes for tile calo tests
21
27
28//Track Record
30
31//CaloCell
36
37
39
40// For MC Truth information:
42
43//####################
52#include "HepPDT/ParticleData.hh"
53//#########################
54
55#include "TTree.h"
56#include "TFile.h"
57#include "TString.h"
58#include "TVector3.h"
59#include <sstream>
60#include <algorithm>
61#include <cmath>
62#include <functional>
63#include <iostream>
64
65ISF_HitAnalysis::ISF_HitAnalysis(const std::string& name, ISvcLocator* pSvcLocator)
66: AthAlgorithm(name, pSvcLocator)
67 //Note that m_xxx are pointers to vectors set to 0, not set to empty vector! see note around TBranch
68{
69 m_surfacelist.resize(0);
75}
76
78= default;
79
80StatusCode ISF_HitAnalysis::initialize ATLAS_NOT_THREAD_SAFE ()
81{
82 ATH_MSG_VERBOSE( "Initializing ISF_HitAnalysis" );
83 //
84 // Register the callback(s):
85 //
86 ATH_CHECK(m_geoModel.retrieve());
87 ATH_CHECK(detStore()->retrieve(m_tileMgr));
88 ATH_CHECK(detStore()->retrieve(m_tileID));
89
90 const CaloIdManager* caloIdManager{nullptr};
91 ATH_CHECK(detStore()->retrieve(caloIdManager));
92 m_larEmID=caloIdManager->getEM_ID();
93 if(m_larEmID==nullptr)
94 throw std::runtime_error("ISF_HitAnalysis: Invalid LAr EM ID helper");
95 m_larFcalID=caloIdManager->getFCAL_ID();
96 if(m_larFcalID==nullptr)
97 throw std::runtime_error("ISF_HitAnalysis: Invalid FCAL ID helper");
98 m_larHecID=caloIdManager->getHEC_ID();
99 if(m_larHecID==nullptr)
100 throw std::runtime_error("ISF_HitAnalysis: Invalid HEC ID helper");
101 m_tileID=caloIdManager->getTileID();
102 if(m_tileID==nullptr)
103 throw std::runtime_error("ISF_HitAnalysis: Invalid Tile ID helper");
104
105 ATH_CHECK( m_fSamplKey.initialize() );
106
107 ATH_CHECK(detStore()->retrieve(m_tileHWID));
108 ATH_CHECK( m_tileSamplingFractionKey.initialize() );
109
110 ATH_CHECK( m_tileCablingSvc.retrieve() );
111 m_tileCabling = m_tileCablingSvc->cablingService();
112
113 ATH_CHECK(m_caloMgrKey.initialize());
114
115 // Get TimedExtrapolator ***************************************************************************************************
116 if (!m_extrapolator.empty() && m_extrapolator.retrieve().isFailure()) {
117 return StatusCode::FAILURE;
118 }
119 ATH_MSG_DEBUG("Extrapolator retrieved "<< m_extrapolator);
120
121 ATH_CHECK(m_calo_tb_coord.retrieve());
122 ATH_MSG_VERBOSE("retrieved " << m_calo_tb_coord);
123
124
125 // Get FastCaloSimCaloExtrapolation
126 ATH_CHECK (m_FastCaloSimCaloExtrapolation.retrieve());
127
128 // Grab the Ntuple and histogramming service for the tree
129 ATH_CHECK(m_thistSvc.retrieve());
130
131 //#########################
132 ATH_CHECK(m_partPropSvc.retrieve());
133
134 m_particleDataTable = (HepPDT::ParticleDataTable*) m_partPropSvc->PDT();
135 if(m_particleDataTable == nullptr) {
136 ATH_MSG_ERROR("PDG table not found");
137 return StatusCode::FAILURE;
138 }
139 //#########################
140 std::unique_ptr<TFile> dummyFile = std::unique_ptr<TFile>(TFile::Open("dummyFile.root", "RECREATE")); //This is added to suppress the error messages about memory-resident trees
141 m_tree = new TTree("FCS_ParametrizationInput", "FCS_ParametrizationInput");
142 std::string fullNtupleName = "/"+m_ntupleFileName+"/"+m_ntupleTreeName;
143 StatusCode sc = m_thistSvc->regTree(fullNtupleName, m_tree);
144 if (sc.isFailure() || !m_tree )
145 {
146 ATH_MSG_ERROR("Unable to register TTree: " << fullNtupleName);
147 return StatusCode::FAILURE;
148 }
149
151 if (m_tree)
152 {
153 ATH_MSG_INFO("Successfull registered TTree: " << fullNtupleName);
154 //initialize the variables before creating the branches
155 m_hit_x = new std::vector<float>;
156 m_hit_y = new std::vector<float>;
157 m_hit_z = new std::vector<float>;
158 m_hit_energy = new std::vector<float>;
159 m_hit_time = new std::vector<float>;
160 m_hit_identifier = new std::vector<Long64_t>;
161 m_hit_cellidentifier = new std::vector<Long64_t>;
162 m_islarbarrel = new std::vector<bool>;
163 m_islarendcap = new std::vector<bool>;
164 m_islarhec = new std::vector<bool>;
165 m_islarfcal = new std::vector<bool>;
166 m_istile = new std::vector<bool>;
167 m_hit_sampling = new std::vector<int>;
168 m_hit_samplingfraction = new std::vector<float>;
169
170 m_truth_energy = new std::vector<float>;
171 m_truth_px = new std::vector<float>;
172 m_truth_py = new std::vector<float>;
173 m_truth_pz = new std::vector<float>;
174 m_truth_pdg = new std::vector<int>;
175 m_truth_barcode = new std::vector<int>;
176 m_truth_vtxbarcode = new std::vector<int>;
177
178 m_cluster_energy = new std::vector<float>;
179 m_cluster_eta = new std::vector<float>;
180 m_cluster_phi = new std::vector<float>;
181 m_cluster_size = new std::vector<unsigned>;
182 m_cluster_cellID = new std::vector<std::vector<Long64_t > >;
183
184 m_cell_identifier = new std::vector<Long64_t>;
185 m_cell_energy = new std::vector<float>;
186 m_cell_sampling = new std::vector<int>;
187
188 m_g4hit_energy = new std::vector<float>;
189 m_g4hit_time = new std::vector<float>;
190 m_g4hit_identifier = new std::vector<Long64_t>;
191 m_g4hit_cellidentifier = new std::vector<Long64_t>;
192 m_g4hit_samplingfraction = new std::vector<float>;
193 m_g4hit_sampling = new std::vector<int>;
194
195 m_total_cell_e = 0;
196 m_total_hit_e = 0;
197 m_total_g4hit_e = 0;
198
199 m_final_cell_energy = new std::vector<Float_t>;
200 m_final_hit_energy = new std::vector<Float_t>;
201 m_final_g4hit_energy = new std::vector<Float_t>;
202
203 m_newTTC_entrance_eta = new std::vector<std::vector<float> >;
204 m_newTTC_entrance_phi = new std::vector<std::vector<float> >;
205 m_newTTC_entrance_r = new std::vector<std::vector<float> >;
206 m_newTTC_entrance_z = new std::vector<std::vector<float> >;
207 m_newTTC_entrance_detaBorder = new std::vector<std::vector<float> >;
208 m_newTTC_entrance_OK = new std::vector<std::vector<bool> >;
209 m_newTTC_back_eta = new std::vector<std::vector<float> >;
210 m_newTTC_back_phi = new std::vector<std::vector<float> >;
211 m_newTTC_back_r = new std::vector<std::vector<float> >;
212 m_newTTC_back_z = new std::vector<std::vector<float> >;
213 m_newTTC_back_detaBorder = new std::vector<std::vector<float> >;
214 m_newTTC_back_OK = new std::vector<std::vector<bool> >;
215 m_newTTC_mid_eta = new std::vector<std::vector<float> >;
216 m_newTTC_mid_phi = new std::vector<std::vector<float> >;
217 m_newTTC_mid_r = new std::vector<std::vector<float> >;
218 m_newTTC_mid_z = new std::vector<std::vector<float> >;
219 m_newTTC_mid_detaBorder = new std::vector<std::vector<float> >;
220 m_newTTC_mid_OK = new std::vector<std::vector<bool> >;
221 m_newTTC_IDCaloBoundary_eta = new std::vector<float>;
222 m_newTTC_IDCaloBoundary_phi = new std::vector<float>;
223 m_newTTC_IDCaloBoundary_r = new std::vector<float>;
224 m_newTTC_IDCaloBoundary_z = new std::vector<float>;
225 m_newTTC_Angle3D = new std::vector<float>;
226 m_newTTC_AngleEta = new std::vector<float>;
227
228 m_MuonEntryLayer_E = new std::vector<float>;
229 m_MuonEntryLayer_px = new std::vector<float>;
230 m_MuonEntryLayer_py = new std::vector<float>;
231 m_MuonEntryLayer_pz = new std::vector<float>;
232 m_MuonEntryLayer_x = new std::vector<float>;
233 m_MuonEntryLayer_y = new std::vector<float>;
234 m_MuonEntryLayer_z = new std::vector<float>;
235 m_MuonEntryLayer_pdg = new std::vector<int>;
236
237 // Optional branches
238 if(m_saveAllBranches){
239 m_tree->Branch("HitX", &m_hit_x);
240 m_tree->Branch("HitY", &m_hit_y);
241 m_tree->Branch("HitZ", &m_hit_z);
242 m_tree->Branch("HitE", &m_hit_energy);
243 m_tree->Branch("HitT", &m_hit_time);
244 m_tree->Branch("HitIdentifier", &m_hit_identifier);
245 m_tree->Branch("HitCellIdentifier", &m_hit_cellidentifier);
246 m_tree->Branch("HitIsLArBarrel", &m_islarbarrel);
247 m_tree->Branch("HitIsLArEndCap", &m_islarendcap);
248 m_tree->Branch("HitIsHEC", &m_islarhec);
249 m_tree->Branch("HitIsFCAL", &m_islarfcal);
250 m_tree->Branch("HitIsTile", &m_istile);
251 m_tree->Branch("HitSampling", &m_hit_sampling);
252 m_tree->Branch("HitSamplingFraction", &m_hit_samplingfraction);
253
254 m_tree->Branch("CellIdentifier", &m_cell_identifier);
255 m_tree->Branch("CellE", &m_cell_energy);
256 m_tree->Branch("CellSampling", &m_cell_sampling);
257
258 m_tree->Branch("G4HitE", &m_g4hit_energy);
259 m_tree->Branch("G4HitT", &m_g4hit_time);
260 m_tree->Branch("G4HitIdentifier", &m_g4hit_identifier);
261 m_tree->Branch("G4HitCellIdentifier", &m_g4hit_cellidentifier);
262 m_tree->Branch("G4HitSamplingFraction",&m_g4hit_samplingfraction);
263 m_tree->Branch("G4HitSampling", &m_g4hit_sampling);
264 }
265
266 //CaloHitAna output variables
267 m_tree->Branch("TruthE", &m_truth_energy);
268 m_tree->Branch("TruthPx", &m_truth_px);
269 m_tree->Branch("TruthPy", &m_truth_py);
270 m_tree->Branch("TruthPz", &m_truth_pz);
271 m_tree->Branch("TruthPDG", &m_truth_pdg);
272 m_tree->Branch("TruthBarcode", &m_truth_barcode);
273 m_tree->Branch("TruthVtxBarcode", &m_truth_vtxbarcode);
274
275 if(m_doClusterInfo){
276 m_tree->Branch("ClusterE", &m_cluster_energy);
277 m_tree->Branch("ClusterEta", &m_cluster_eta);
278 m_tree->Branch("ClusterPhi", &m_cluster_phi);
279 m_tree->Branch("ClusterSize", &m_cluster_size);
280 m_tree->Branch("ClusterCellID", &m_cluster_cellID);
281 }
282
283 m_oneeventcells = new FCS_matchedcellvector;
284 if(m_doAllCells){
285 m_tree->Branch("AllCells", &m_oneeventcells);
286 }
287
288 //write cells per layer
289 if(m_doLayers){
290 for (Int_t i = 0; i < MAX_LAYER; i++)
291 {
292 TString branchname = "Sampling_";
293 branchname += i;
294 m_layercells[i] = new FCS_matchedcellvector;
295 m_tree->Branch(branchname, &m_layercells[i]);
296 }
297 }
298
299 if(m_doLayerSums){
300 //write also energies per layer:
301 m_tree->Branch("cell_energy", &m_final_cell_energy);
302 m_tree->Branch("hit_energy", &m_final_hit_energy);
303 m_tree->Branch("g4hit_energy", &m_final_g4hit_energy);
304
305 //This is a duplicate of cell_energy[25]
306 m_tree->Branch("total_cell_energy", &m_total_cell_e);
307 m_tree->Branch("total_hit_energy", &m_total_hit_e);
308 m_tree->Branch("total_g4hit_energy", &m_total_g4hit_e);
309 }
310
311 m_tree->Branch("newTTC_back_eta",&m_newTTC_back_eta);
312 m_tree->Branch("newTTC_back_phi",&m_newTTC_back_phi);
313 m_tree->Branch("newTTC_back_r",&m_newTTC_back_r);
314 m_tree->Branch("newTTC_back_z",&m_newTTC_back_z);
315 m_tree->Branch("newTTC_back_detaBorder",&m_newTTC_back_detaBorder);
316 m_tree->Branch("newTTC_back_OK",&m_newTTC_back_OK);
317 m_tree->Branch("newTTC_entrance_eta",&m_newTTC_entrance_eta);
318 m_tree->Branch("newTTC_entrance_phi",&m_newTTC_entrance_phi);
319 m_tree->Branch("newTTC_entrance_r",&m_newTTC_entrance_r);
320 m_tree->Branch("newTTC_entrance_z",&m_newTTC_entrance_z);
321 m_tree->Branch("newTTC_entrance_detaBorder",&m_newTTC_entrance_detaBorder);
322 m_tree->Branch("newTTC_entrance_OK",&m_newTTC_entrance_OK);
323 m_tree->Branch("newTTC_mid_eta",&m_newTTC_mid_eta);
324 m_tree->Branch("newTTC_mid_phi",&m_newTTC_mid_phi);
325 m_tree->Branch("newTTC_mid_r",&m_newTTC_mid_r);
326 m_tree->Branch("newTTC_mid_z",&m_newTTC_mid_z);
327 m_tree->Branch("newTTC_mid_detaBorder",&m_newTTC_mid_detaBorder);
328 m_tree->Branch("newTTC_mid_OK",&m_newTTC_mid_OK);
329 m_tree->Branch("newTTC_IDCaloBoundary_eta",&m_newTTC_IDCaloBoundary_eta);
330 m_tree->Branch("newTTC_IDCaloBoundary_phi",&m_newTTC_IDCaloBoundary_phi);
331 m_tree->Branch("newTTC_IDCaloBoundary_r",&m_newTTC_IDCaloBoundary_r);
332 m_tree->Branch("newTTC_IDCaloBoundary_z",&m_newTTC_IDCaloBoundary_z);
333 m_tree->Branch("newTTC_Angle3D",&m_newTTC_Angle3D);
334 m_tree->Branch("newTTC_AngleEta",&m_newTTC_AngleEta);
335
336 m_tree->Branch("MuonEntryLayer_E",&m_MuonEntryLayer_E);
337 m_tree->Branch("MuonEntryLayer_px",&m_MuonEntryLayer_px);
338 m_tree->Branch("MuonEntryLayer_py",&m_MuonEntryLayer_py);
339 m_tree->Branch("MuonEntryLayer_pz",&m_MuonEntryLayer_pz);
340 m_tree->Branch("MuonEntryLayer_x",&m_MuonEntryLayer_x);
341 m_tree->Branch("MuonEntryLayer_y",&m_MuonEntryLayer_y);
342 m_tree->Branch("MuonEntryLayer_z",&m_MuonEntryLayer_z);
343 m_tree->Branch("MuonEntryLayer_pdg",&m_MuonEntryLayer_pdg);
344 }
345 dummyFile->Close();
346 return StatusCode::SUCCESS;
347} //initialize
348
349StatusCode ISF_HitAnalysis::finalize ATLAS_NOT_THREAD_SAFE ()
350{
351
352 ATH_MSG_VERBOSE( "doing finalize()" );
353
354
355 const AthenaAttributeList* simParam = nullptr;
356 if (detStore()->retrieve(simParam, m_MC_SIM_PARAM).isFailure()) {
357 ATH_MSG_ERROR("Could not retrieve Simulation parameters");
358 return StatusCode::FAILURE;
359 } else {
360 ATH_MSG_DEBUG("Retrieved Simulation parameters");
361 for (auto attrItr = simParam->begin(); attrItr != simParam->end();
362 ++attrItr) {
363 std::stringstream outstr;
364 attrItr->toOutputStream(outstr);
365 ATH_MSG_INFO("Simulation MetaData: " << outstr.str());
366 }
367 }
368
369 const AthenaAttributeList* digiParam = nullptr;
370 if (detStore()->retrieve(digiParam, m_MC_DIGI_PARAM).isFailure()) {
371 ATH_MSG_ERROR("Could not retrieve Digitization parameters");
372 return StatusCode::FAILURE;
373 } else {
374 ATH_MSG_DEBUG("Retrieved Digitization parameters");
375 for (auto attrItr = digiParam->begin(); attrItr != digiParam->end();
376 ++attrItr) {
377 std::stringstream outstr;
378 attrItr->toOutputStream(outstr);
379 ATH_MSG_INFO("Digitization MetaData: " << outstr.str());
380 }
381 }
382 std::unique_ptr<TFile> dummyGeoFile = std::unique_ptr<TFile>(TFile::Open("dummyGeoFile.root", "RECREATE")); //This is added to suppress the error messages about memory-resident trees
383 TTree* geo = new TTree( m_geoModel->atlasVersion().c_str() , m_geoModel->atlasVersion().c_str() );
384 std::string fullNtupleName = "/"+m_geoFileName+"/"+m_geoModel->atlasVersion();
385 StatusCode sc = m_thistSvc->regTree(fullNtupleName, geo);
386 if(sc.isFailure() || !geo )
387 {
388 ATH_MSG_ERROR("Unable to register TTree: " << fullNtupleName);
389 return StatusCode::FAILURE;
390 }
391
393
394 using GEOCELL = struct
395 {
396 Long64_t identifier;
397 Int_t calosample;
398 float eta,phi,r,eta_raw,phi_raw,r_raw,x,y,z,x_raw,y_raw,z_raw;
399 float deta,dphi,dr,dx,dy,dz;
400 };
401
402 static GEOCELL geocell;
403
404 if(geo)
405 {
406 ATH_MSG_INFO("Successfull registered TTree: " << fullNtupleName);
407 //this actually creates the vector itself! And only if it succeeds! Note that the result is not checked! And the code is probably leaking memory in the end
408 //geo->Branch("cells", &geocell,"identifier/L:eta,phi,r,eta_raw,phi_raw,r_raw,x,y,z,x_raw,y_raw,z_raw/F:Deta,Dphi,Dr,Dx,Dy,Dz/F");
409 geo->Branch("identifier", &geocell.identifier,"identifier/L");
410 geo->Branch("calosample", &geocell.calosample,"calosample/I");
411
412 geo->Branch("eta", &geocell.eta,"eta/F");
413 geo->Branch("phi", &geocell.phi,"phi/F");
414 geo->Branch("r", &geocell.r,"r/F");
415 geo->Branch("eta_raw", &geocell.eta_raw,"eta_raw/F");
416 geo->Branch("phi_raw", &geocell.phi_raw,"phi_raw/F");
417 geo->Branch("r_raw", &geocell.r_raw,"r_raw/F");
418
419 geo->Branch("x", &geocell.x,"x/F");
420 geo->Branch("y", &geocell.y,"y/F");
421 geo->Branch("z", &geocell.z,"z/F");
422 geo->Branch("x_raw", &geocell.x_raw,"x_raw/F");
423 geo->Branch("y_raw", &geocell.y_raw,"y_raw/F");
424 geo->Branch("z_raw", &geocell.z_raw,"z_raw/F");
425
426 geo->Branch("deta", &geocell.deta,"deta/F");
427 geo->Branch("dphi", &geocell.dphi,"dphi/F");
428 geo->Branch("dr", &geocell.dr,"dr/F");
429 geo->Branch("dx", &geocell.dx,"dx/F");
430 geo->Branch("dy", &geocell.dy,"dy/F");
431 geo->Branch("dz", &geocell.dz,"dz/F");
432 }
433
434 SG::ReadCondHandle<CaloDetDescrManager> caloMgrHandle{m_caloMgrKey,Gaudi::Hive::currentContext()};
435 ATH_CHECK(caloMgrHandle.isValid());
436 const CaloDetDescrManager* calo_dd_man = *caloMgrHandle;
437
438 int ncells=0;
439 for (const CaloDetDescrElement* theDDE : calo_dd_man->element_range())
440 {
441 if(theDDE)
442 {
443 CaloCell_ID::CaloSample sample=theDDE->getSampling();
444 //CaloCell_ID::SUBCALO calo=theDDE->getSubCalo();
445 ++ncells;
446 if(geo)
447 {
448 geocell.identifier=theDDE->identify().get_compact();
449 geocell.calosample=sample;
450 geocell.eta=theDDE->eta();
451 geocell.phi=theDDE->phi();
452 geocell.r=theDDE->r();
453 geocell.eta_raw=theDDE->eta_raw();
454 geocell.phi_raw=theDDE->phi_raw();
455 geocell.r_raw=theDDE->r_raw();
456 geocell.x=theDDE->x();
457 geocell.y=theDDE->y();
458 geocell.z=theDDE->z();
459 geocell.x_raw=theDDE->x_raw();
460 geocell.y_raw=theDDE->y_raw();
461 geocell.z_raw=theDDE->z_raw();
462 geocell.deta=theDDE->deta();
463 geocell.dphi=theDDE->dphi();
464 geocell.dr=theDDE->dr();
465 geocell.dx=theDDE->dx();
466 geocell.dy=theDDE->dy();
467 geocell.dz=theDDE->dz();
468
469 geo->Fill();
470 }
471 }
472 }
473
474 ATH_MSG_INFO( ncells<<" cells found" );
475
476 dummyGeoFile->Close();
477 return StatusCode::SUCCESS;
478} //finalize
479
480
481StatusCode ISF_HitAnalysis::execute(const EventContext& ctx)
482{
483
484 ATH_MSG_DEBUG( "In ISF_HitAnalysis::execute()" );
485
486 if (! m_tree)
487 {
488 ATH_MSG_ERROR( "tree not registered" );
489 return StatusCode::FAILURE;
490 }
491
493 const ILArfSampl* fSampl=*fSamplHdl;
494
496 ATH_CHECK( tileSamplingFraction.isValid() );
497
498
499 //now if the branches were created correctly, the pointers point to something and it is possible to clear the vectors
500 TVector3 vectest;
501 vectest.SetPtEtaPhi(1.,1.,1.);
502 m_hit_x->clear();
503 m_hit_y->clear();
504 m_hit_z->clear();
505 m_hit_energy->clear();
506 m_hit_time->clear();
507 m_hit_identifier->clear();
508 m_hit_cellidentifier->clear();
509 m_islarbarrel->clear();
510 m_islarendcap->clear();
511 m_islarhec->clear();
512 m_islarfcal->clear();
513 m_istile->clear();
514 m_hit_sampling->clear();
515 m_hit_samplingfraction->clear();
516 m_truth_energy->clear();
517 m_truth_px->clear();
518 m_truth_py->clear();
519 m_truth_pz->clear();
520 m_truth_pdg->clear();
521 m_truth_barcode->clear();
522 m_truth_vtxbarcode->clear();
523 m_cluster_energy->clear();
524 m_cluster_eta->clear();
525 m_cluster_phi->clear();
526 m_cluster_size->clear();
527 m_cluster_cellID->clear();
528 m_cell_identifier->clear();
529 m_cell_energy->clear();
530 m_cell_sampling->clear();
531 m_g4hit_energy->clear();
532 m_g4hit_time->clear();
533 m_g4hit_identifier->clear();
534 m_g4hit_cellidentifier->clear();
535 m_g4hit_sampling->clear();
537 //which fails for this one!!
538 //m_matched_cells->clear();
539 std::map<Long64_t, FCS_cell> cells; //read all objects and collect them by identifier (Long64_t)
540 std::map<Long64_t, std::vector<FCS_g4hit> > g4hits;
541 std::map<Long64_t, std::vector<FCS_hit> > hits;
542
543 cells.clear();
544 g4hits.clear();
545 hits.clear();
546
547 FCS_cell one_cell{}; //note that this is not extra safe if I don't have a clear method!
548 FCS_g4hit one_g4hit{};
549 FCS_hit one_hit{};
550 FCS_matchedcell one_matchedcell;
551
552 m_oneeventcells->m_vector.clear();
553 m_final_g4hit_energy->clear();
554 m_final_hit_energy->clear();
555 m_final_cell_energy->clear();
556
557 m_newTTC_back_eta->clear();
558 m_newTTC_back_phi->clear();
559 m_newTTC_back_r->clear();
560 m_newTTC_back_z->clear();
562 m_newTTC_back_OK->clear();
563 m_newTTC_entrance_eta->clear();
564 m_newTTC_entrance_phi->clear();
565 m_newTTC_entrance_r->clear();
566 m_newTTC_entrance_z->clear();
568 m_newTTC_entrance_OK->clear();
569 m_newTTC_mid_eta->clear();
570 m_newTTC_mid_phi->clear();
571 m_newTTC_mid_r->clear();
572 m_newTTC_mid_z->clear();
574 m_newTTC_mid_OK->clear();
579 m_newTTC_Angle3D->clear();
580 m_newTTC_AngleEta->clear();
581
582
583 m_MuonEntryLayer_E->clear();
584 m_MuonEntryLayer_x->clear();
585 m_MuonEntryLayer_y->clear();
586 m_MuonEntryLayer_z->clear();
587 m_MuonEntryLayer_px->clear();
588 m_MuonEntryLayer_py->clear();
589 m_MuonEntryLayer_pz->clear();
590 m_MuonEntryLayer_pdg->clear();
591
592 //##########################
593
595 ATH_CHECK(caloMgrHandle.isValid());
596 const CaloDetDescrManager* calo_dd_man = *caloMgrHandle;
597
598 //Get the FastCaloSim step info collection from store
600 StatusCode sc = evtStore()->retrieve(eventStepsES, "MergedEventSteps");
601 if (sc.isFailure()) {
602 ATH_MSG_WARNING( "No FastCaloSim steps read from StoreGate?" );
603 //return StatusCode::FAILURE;
604 } else {
605 ATH_MSG_INFO("Read: "<<eventStepsES->size()<<" position hits");
606 for (ISF_FCS_Parametrization::FCS_StepInfoCollection::const_iterator it = eventStepsES->begin(); it != eventStepsES->end(); ++it) {
607 m_hit_x->push_back( (*it)->x() );
608 m_hit_y->push_back( (*it)->y() );
609 m_hit_z->push_back( (*it)->z() );
610 m_hit_energy->push_back( (*it)->energy() );
611 m_hit_time->push_back( (*it)->time());
612
613 //Try to get the samplings, sampling fractions from identifiers
614 bool larbarrel=false;
615 bool larendcap=false;
616 bool larhec=false;
617 bool larfcal=false;
618 bool tile=false;
619 int sampling=-1;
620 double sampfrac=0.0;
621
622 Identifier id = (*it)->identify();
623 Identifier cell_id = (*it)->identify(); //to be replaced by cell_id in tile
624
625 if(calo_dd_man->get_element(id)) {
626 CaloCell_ID::CaloSample layer = calo_dd_man->get_element(id)->getSampling();
627 sampling = layer; //use CaloCell layer immediately
628 } else {
629 ATH_MSG_WARNING( "Warning no sampling info for "<<id.getString());
630 }
631
632 if(m_larEmID->is_lar_em(id) || m_larHecID->is_lar_hec(id) || m_larFcalID->is_lar_fcal(id)) sampfrac=fSampl->FSAMPL(id);
633 if (m_tileID->is_tile(id)) {
634 HWIdentifier channel_id = m_tileCabling->s2h_channel_id(id);
635 int channel = m_tileHWID->channel(channel_id);
636 int drawerIdx = m_tileHWID->drawerIdx(channel_id);
637 sampfrac = tileSamplingFraction->getSamplingFraction(drawerIdx, channel);
638 }
639 if(m_larEmID->is_lar_em(id)) {
640 //LAr EM cells
641 if (m_larEmID->is_em_barrel(id)) larbarrel=true;
642 else if(m_larEmID->is_em_endcap(id)) larendcap=true;
643 } else if(m_larHecID->is_lar_hec(id)) {
644 //LAr HEC cells
645 larhec = true;
646 } else if(m_larFcalID->is_lar_fcal(id)) {
647 //LAr FCal cells
648 larfcal = true;
649 } else if (m_tileID->is_tile_aux(id)) {
650 // special case for E4'
651 tile = true;
652 cell_id = m_tileID->cell_id(id);
653 sampling = CaloCell_ID::TileGap3;
654 } else if(m_tileID->is_tile_barrel(id) || m_tileID->is_tile_extbarrel(id) || m_tileID->is_tile_gap(id)) {
655 // all other Tile cells
656 tile = true;
657 cell_id = m_tileID->cell_id(id);
658 Int_t tile_sampling = -1;
659 if(calo_dd_man->get_element(cell_id)) {
660 tile_sampling = calo_dd_man->get_element(cell_id)->getSampling();
661 }
662 if(tile_sampling!= -1) sampling = tile_sampling; //calo_dd_man needs to be called with cell_id not pmt_id!!
663 } else {
664 ATH_MSG_WARNING( "This hit is somewhere. Please check!");
665 }
666
667 m_hit_identifier->push_back(id.get_compact());
668 m_hit_cellidentifier->push_back(cell_id.get_compact());
669 //push things into vectors:
670 m_islarbarrel->push_back(larbarrel);
671 m_islarendcap->push_back(larendcap);
672 m_islarhec->push_back(larhec);
673 m_islarfcal->push_back(larfcal);
674 m_istile->push_back(tile);
675 m_hit_sampling->push_back(sampling);
676 m_hit_samplingfraction->push_back(sampfrac);
677
678 } //event steps
679 }//event steps read correctly
680
681 //Get truth particle info
682 //Note that there can be more truth particles, the first one is usually the one we need.
683 const McEventCollection* mcEvent;
684 sc = evtStore()->retrieve(mcEvent,"TruthEvent");
685 if(sc.isFailure()) {
686 ATH_MSG_WARNING( "No truth event!");
687 } else {
688 if(mcEvent) {
689 //std::cout<<"ISF_HitAnalysis: MC event size: "<<mcEvent->size()<<std::endl;
690 if(!mcEvent->empty()) {
691 int particleIndex=0;
692 int loopEnd = m_NtruthParticles;
693 int particles_size=(*mcEvent->begin())->particles_size();
694 if(loopEnd==-1) {
695 loopEnd = particles_size; //is this the correct thing?
696 }
697 for (const auto& part: *(*mcEvent->begin()))
698 {
699
700 ATH_MSG_DEBUG("Number truth particles="<<particles_size<<" loopEnd="<<loopEnd);
701 particleIndex++;
702
703 if (particleIndex>loopEnd) break; //enough particles
704
705 //UPDATE EXTRAPOLATION WITH ALGTOOL***********************************************
706
707 TFCSTruthState truth(part->momentum().px(),part->momentum().py(),part->momentum().pz(),part->momentum().e(),part->pdg_id());
708
709 //calculate the vertex
710 TVector3 moment;
711 moment.SetXYZ(part->momentum().px(),part->momentum().py(),part->momentum().pz());
712 TVector3 direction=moment.Unit();
713
714 //does it hit the barrel or the EC?
715
716 if(std::abs(direction.Z())/m_CaloBoundaryZ < direction.Perp()/m_CaloBoundaryR) {
717 //BARREL
718 direction*=m_CaloBoundaryR/direction.Perp();
719 } else {
720 //EC
721 direction*=m_CaloBoundaryZ/abs(direction.Z());
722 }
723
724 if((part)->production_vertex()) {
725 truth.set_vertex((part)->production_vertex()->position().x(), (part)->production_vertex()->position().y(), (part)->production_vertex()->position().z());
726 } else {
727 truth.set_vertex(direction.X(),direction.Y(),direction.Z());
728 ATH_MSG_WARNING("No particle production vetext, use VERTEX from direction: x "<<direction.X()<<" y "<<direction.Y()<<" z "<<direction.Z());
729 }
730
731 if( std::abs(direction.X()-truth.vertex().X())>0.1 || std::abs(direction.Y()-truth.vertex().Y())>0.1 || std::abs(direction.Z()-truth.vertex().Z())>0.1 ) {
732 ATH_MSG_WARNING("VERTEX from direction: x "<<direction.X()<<" y "<<direction.Y()<<" z "<<direction.Z());
733 ATH_MSG_WARNING("but VERTEX from hepmc: x "<<truth.vertex().X()<<" y "<<truth.vertex().Y()<<" z "<<truth.vertex().Z());
734 }
735
737 m_FastCaloSimCaloExtrapolation->extrapolate(result,&truth);
738
739 //write the result into the ntuple variables:
740
741 ATH_MSG_DEBUG("IDCaloBoundary_eta() "<<result.IDCaloBoundary_eta());
742 ATH_MSG_DEBUG("IDCaloBoundary_phi() "<<result.IDCaloBoundary_phi());
743 ATH_MSG_DEBUG("IDCaloBoundary_r() "<<result.IDCaloBoundary_r());
744 ATH_MSG_DEBUG("IDCaloBoundary_z() "<<result.IDCaloBoundary_z());
745 ATH_MSG_DEBUG("AngleEta "<<result.IDCaloBoundary_AngleEta());
746 ATH_MSG_DEBUG("Angle3D "<<result.IDCaloBoundary_Angle3D());
747
748 m_newTTC_IDCaloBoundary_eta->push_back(float(result.IDCaloBoundary_eta()));
749 m_newTTC_IDCaloBoundary_phi->push_back(float(result.IDCaloBoundary_phi()));
750 m_newTTC_IDCaloBoundary_r->push_back(float(result.IDCaloBoundary_r()));
751 m_newTTC_IDCaloBoundary_z->push_back(float(result.IDCaloBoundary_z()));
752 m_newTTC_Angle3D ->push_back(float(result.IDCaloBoundary_Angle3D()));
753 m_newTTC_AngleEta->push_back(float(result.IDCaloBoundary_AngleEta()));
754
755 std::vector<float> eta_vec_ENT;
756 std::vector<float> phi_vec_ENT;
757 std::vector<float> r_vec_ENT;
758 std::vector<float> z_vec_ENT;
759 std::vector<float> detaBorder_vec_ENT;
760 std::vector<bool> OK_vec_ENT;
761
762 std::vector<float> eta_vec_EXT;
763 std::vector<float> phi_vec_EXT;
764 std::vector<float> r_vec_EXT;
765 std::vector<float> z_vec_EXT;
766 std::vector<float> detaBorder_vec_EXT;
767 std::vector<bool> OK_vec_EXT;
768
769 std::vector<float> eta_vec_MID;
770 std::vector<float> phi_vec_MID;
771 std::vector<float> r_vec_MID;
772 std::vector<float> z_vec_MID;
773 std::vector<float> detaBorder_vec_MID;
774 std::vector<bool> OK_vec_MID;
775
776 for(int sample=CaloCell_ID_FCS::FirstSample;sample<CaloCell_ID_FCS::MaxSample;++sample) {
777 ATH_MSG_DEBUG("sample "<<sample);
778 ATH_MSG_DEBUG(" eta ENT "<<result.eta(sample,1)<<" eta EXT "<<result.eta(sample,2));
779 ATH_MSG_DEBUG(" phi ENT "<<result.phi(sample,1)<<" phi EXT "<<result.phi(sample,2));
780 ATH_MSG_DEBUG(" r ENT "<<result.r(sample,1) <<" r EXT "<<result.r(sample,2) );
781 ATH_MSG_DEBUG(" z ENT "<<result.z(sample,1) <<" z EXT "<<result.z(sample,2) );
782 ATH_MSG_DEBUG(" detaBorder ENT "<<result.detaBorder(sample,1) <<" detaBorder EXT "<<result.detaBorder(sample,2) );
783 ATH_MSG_DEBUG(" OK ENT "<<result.OK(sample,1) <<" OK EXT "<<result.OK(sample,2) );
784 eta_vec_ENT.push_back(float(result.eta(sample,TFCSExtrapolationState::SUBPOS_ENT)));
785 eta_vec_EXT.push_back(float(result.eta(sample,TFCSExtrapolationState::SUBPOS_EXT)));
786 eta_vec_MID.push_back(float(result.eta(sample,TFCSExtrapolationState::SUBPOS_MID)));
787 phi_vec_ENT.push_back(float(result.phi(sample,TFCSExtrapolationState::SUBPOS_ENT)));
788 phi_vec_EXT.push_back(float(result.phi(sample,TFCSExtrapolationState::SUBPOS_EXT)));
789 phi_vec_MID.push_back(float(result.phi(sample,TFCSExtrapolationState::SUBPOS_MID)));
790 r_vec_ENT.push_back(float(result.r(sample,TFCSExtrapolationState::SUBPOS_ENT)));
791 r_vec_EXT.push_back(float(result.r(sample,TFCSExtrapolationState::SUBPOS_EXT)));
792 r_vec_MID.push_back(float(result.r(sample,TFCSExtrapolationState::SUBPOS_MID)));
793 z_vec_ENT.push_back(float(result.z(sample,TFCSExtrapolationState::SUBPOS_ENT)));
794 z_vec_EXT.push_back(float(result.z(sample,TFCSExtrapolationState::SUBPOS_EXT)));
795 z_vec_MID.push_back(float(result.z(sample,TFCSExtrapolationState::SUBPOS_MID)));
796 detaBorder_vec_ENT.push_back(float(result.detaBorder(sample,TFCSExtrapolationState::SUBPOS_ENT)));
797 detaBorder_vec_EXT.push_back(float(result.detaBorder(sample,TFCSExtrapolationState::SUBPOS_EXT)));
798 detaBorder_vec_MID.push_back(float(result.detaBorder(sample,TFCSExtrapolationState::SUBPOS_MID)));
799 OK_vec_ENT.push_back(result.OK(sample,TFCSExtrapolationState::SUBPOS_ENT));
800 OK_vec_EXT.push_back(result.OK(sample,TFCSExtrapolationState::SUBPOS_EXT));
801 OK_vec_MID.push_back(result.OK(sample,TFCSExtrapolationState::SUBPOS_MID));
802 }
803
804 m_newTTC_back_eta->push_back(eta_vec_EXT);
805 m_newTTC_back_phi->push_back(phi_vec_EXT);
806 m_newTTC_back_r ->push_back(r_vec_EXT);
807 m_newTTC_back_z ->push_back(z_vec_EXT);
808 m_newTTC_back_detaBorder ->push_back(detaBorder_vec_EXT);
809 m_newTTC_back_OK ->push_back(OK_vec_EXT);
810 m_newTTC_entrance_eta->push_back(eta_vec_ENT);
811 m_newTTC_entrance_phi->push_back(phi_vec_ENT);
812 m_newTTC_entrance_r ->push_back(r_vec_ENT);
813 m_newTTC_entrance_z ->push_back(z_vec_ENT);
814 m_newTTC_entrance_detaBorder ->push_back(detaBorder_vec_ENT);
815 m_newTTC_entrance_OK ->push_back(OK_vec_ENT);
816 m_newTTC_mid_eta->push_back(eta_vec_MID);
817 m_newTTC_mid_phi->push_back(phi_vec_MID);
818 m_newTTC_mid_r ->push_back(r_vec_MID);
819 m_newTTC_mid_z ->push_back(z_vec_MID);
820 m_newTTC_mid_detaBorder ->push_back(detaBorder_vec_MID);
821 m_newTTC_mid_OK ->push_back(OK_vec_MID);
822
823 m_truth_energy->push_back((part)->momentum().e());
824 m_truth_px->push_back((part)->momentum().px());
825 m_truth_py->push_back((part)->momentum().py());
826 m_truth_pz->push_back((part)->momentum().pz());
827 m_truth_pdg->push_back((part)->pdg_id());
828 m_truth_barcode->push_back(HepMC::barcode(part));
829
830 } //for mcevent
831 } //mcevent size
832 } //mcEvent
833 }//truth event
834
835 //Retrieve and save MuonEntryLayer information
836 const TrackRecordCollection *MuonEntry = nullptr;
837 sc = evtStore()->retrieve(MuonEntry, "MuonEntryLayer");
838 if (sc.isFailure())
839 {
840 ATH_MSG_WARNING( "Couldn't read MuonEntry from StoreGate");
841 //return NULL;
842 }
843 else{
844 for ( const TrackRecord &record : *MuonEntry){
845 m_MuonEntryLayer_E->push_back((record).GetEnergy());
846 m_MuonEntryLayer_px->push_back((record).GetMomentum().getX());
847 m_MuonEntryLayer_py->push_back((record).GetMomentum().getY());
848 m_MuonEntryLayer_pz->push_back((record).GetMomentum().getZ());
849 m_MuonEntryLayer_x->push_back((record).GetPosition().getX());
850 m_MuonEntryLayer_y->push_back((record).GetPosition().getY());
851 m_MuonEntryLayer_z->push_back((record).GetPosition().getZ());
852 m_MuonEntryLayer_pdg->push_back((record).GetPDGCode());
853 }
854 }
855
856 // Get the reco clusters if available
857// retreiving cluster container
858 const xAOD::CaloClusterContainer* theClusters;
859 std::string clusterContainerName = "CaloCalTopoClusters"; //Local hadron calibrated Topo-clusters , raw is the EM scale
860 sc = evtStore()->retrieve(theClusters, clusterContainerName);
861 if (sc.isFailure()) {
862 ATH_MSG_WARNING(" Couldn't get cluster container '" << clusterContainerName << "'");
863 return StatusCode::SUCCESS;
864 }
865 xAOD::CaloClusterContainer::const_iterator itrClus = theClusters->begin();
866 xAOD::CaloClusterContainer::const_iterator itrLastClus = theClusters->end();
867 for ( ; itrClus!=itrLastClus; ++itrClus){
868 const xAOD::CaloCluster *cluster =(*itrClus);
869 m_cluster_energy->push_back(cluster->e(xAOD::CaloCluster::UNCALIBRATED)); // getRawE, cluster->e() is the Local hadron calibrated topo-clusters
872 ATH_MSG_VERBOSE("Cluster energy: " << cluster->e() << " EMscale: " << cluster->e(xAOD::CaloCluster::UNCALIBRATED) << " cells: " << " links: " << cluster->getCellLinks());
873
874 const CaloClusterCellLink* cellLinks = cluster->getCellLinks();
875 if (!cellLinks) {
876 ATH_MSG_DEBUG( "No cell links for this cluster" );
877 continue;
878 }
879
880 const CaloCellContainer* cellCont=cellLinks->getCellContainer();
881 if (!cellCont) {
882 ATH_MSG_DEBUG( "DataLink to cell container is broken" );
883 continue;
884 }
885 unsigned cellcount = 0;
886 std::vector<Long64_t> cellIDs_in_cluster;
888 xAOD::CaloCluster::const_cell_iterator cellIterEnd =cluster->cell_end();
889 for ( ;cellIter !=cellIterEnd;cellIter++) {
890 ++cellcount;
891 const CaloCell* cell= (*cellIter);
892 cellIDs_in_cluster.push_back(cell->ID().get_compact());
893 float EnergyCell=cell->energy(); //ID, time, phi, eta
894 ATH_MSG_DEBUG(" Cell energy: " << EnergyCell);
895 }// end of cells inside cluster loop
896 m_cluster_size->push_back(cellcount);
897 m_cluster_cellID->push_back(cellIDs_in_cluster);
898 }
899
900 //Get reco cells if available
901 const CaloCellContainer *cellColl = nullptr;
902 sc = evtStore()->retrieve(cellColl, "AllCalo");
903
904 if (sc.isFailure())
905 {
906 ATH_MSG_WARNING( "Couldn't read AllCalo cells from StoreGate");
907 }
908 else
909 {
910 ATH_MSG_INFO( "Found: "<<cellColl->size()<<" calorimeter cells");
911 CaloCellContainer::const_iterator itrCell = cellColl->begin();
912 CaloCellContainer::const_iterator itrLastCell = cellColl->end();
913 for ( ; itrCell!=itrLastCell; ++itrCell)
914 {
915 m_cell_energy->push_back((*itrCell)->energy());
916 m_cell_identifier->push_back((*itrCell)->ID().get_compact());
917 if (m_tileID->is_tile_aux((*itrCell)->ID())) {
918 // special case for E4'
919 m_cell_sampling->push_back(CaloCell_ID::TileGap3);
920 }
921 else if (calo_dd_man->get_element((*itrCell)->ID()))
922 {
923 // all other Tile cells
924 CaloCell_ID::CaloSample layer = calo_dd_man->get_element((*itrCell)->ID())->getSampling();
925 m_cell_sampling->push_back(layer);
926 }
927 else
928 m_cell_sampling->push_back(-1);
929 }
930 } //calorimeter cells
931
932 //Get all G4Hits (from CaloHitAnalysis)
933 std::string lArKey [4] = {"LArHitEMB", "LArHitEMEC", "LArHitFCAL", "LArHitHEC"};
934 for (unsigned int i=0;i<4;i++)
935 {
936 const LArHitContainer* iter;
937 ATH_MSG_DEBUG( "Checking G4Hits: "<<lArKey[i]);
938 if(evtStore()->retrieve(iter,lArKey[i])==StatusCode::SUCCESS)
939 {
941 int hitnumber = 0;
942 for (hi=(*iter).begin();hi!=(*iter).end();++hi) {
943 hitnumber++;
944 const LArHit* larHit = *hi;
945 const CaloDetDescrElement *hitElement = calo_dd_man->get_element(larHit->cellID());
946 if(!hitElement)
947 continue;
948 Identifier larhitid = hitElement->identify();
949 if(calo_dd_man->get_element(larhitid)) {
950 CaloCell_ID::CaloSample larlayer = calo_dd_man->get_element(larhitid)->getSampling();
951
952 float larsampfrac=fSampl->FSAMPL(larhitid);
953 m_g4hit_energy->push_back( larHit->energy() );
954 m_g4hit_time->push_back( larHit->time() );
955 m_g4hit_identifier->push_back( larhitid.get_compact() );
956 m_g4hit_cellidentifier->push_back( larhitid.get_compact() );
957 m_g4hit_sampling->push_back( larlayer);
958 m_g4hit_samplingfraction->push_back( larsampfrac );
959 }
960 } // End while LAr hits
961 ATH_MSG_INFO( "Read "<<hitnumber<<" G4Hits from "<<lArKey[i]);
962 }
963 else
964 {
965 ATH_MSG_INFO( "Can't retrieve LAr hits");
966 }// End statuscode success upon retrieval of hits
967 //std::cout <<"ZH G4Hit size: "<<m_g4hit_e->size()<<std::endl;
968 }// End detector type loop
969
970 const TileHitVector * hitVec = nullptr;
971 if (evtStore()->retrieve(hitVec,"TileHitVec")==StatusCode::SUCCESS && m_tileMgr && m_tileID )
972 {
973 int hitnumber = 0;
974 for(TileHitVecConstIterator i_hit=hitVec->begin() ; i_hit!=hitVec->end() ; ++i_hit)
975 {
976 hitnumber++;
977 Identifier pmt_id = (*i_hit).identify();
978 Identifier cell_id = m_tileID->cell_id(pmt_id);
979
980 if (calo_dd_man->get_element(cell_id)){
981 CaloCell_ID::CaloSample layer = calo_dd_man->get_element(cell_id)->getSampling();
982
983 HWIdentifier channel_id = m_tileCabling->s2h_channel_id(pmt_id);
984 int channel = m_tileHWID->channel(channel_id);
985 int drawerIdx = m_tileHWID->drawerIdx(channel_id);
986 float tilesampfrac = tileSamplingFraction->getSamplingFraction(drawerIdx, channel);
987
988 //could there be more subhits??
989 for (int tilesubhit_i = 0; tilesubhit_i<(*i_hit).size(); tilesubhit_i++)
990 {
991 m_g4hit_energy->push_back( (*i_hit).energy(tilesubhit_i) );
992 m_g4hit_time->push_back( (*i_hit).time(tilesubhit_i) );
993 m_g4hit_identifier->push_back( pmt_id.get_compact() );
994 m_g4hit_cellidentifier->push_back( cell_id.get_compact() );
995 m_g4hit_sampling->push_back( layer );
996 m_g4hit_samplingfraction->push_back( tilesampfrac );
997 }
998 }
999 }
1000 ATH_MSG_INFO( "Read "<<hitnumber<<" G4Hits from TileHitVec");
1001 }
1002
1003
1004 // CaloHitAna
1005 ATH_MSG_DEBUG("CaloHitAna begin!");
1006
1007 //cells
1008 for (unsigned int cell_i = 0; cell_i < m_cell_identifier->size(); cell_i++){
1009 if (cells.find((*m_cell_identifier)[cell_i]) == cells.end()) { //doesn't exist
1010 one_cell.cell_identifier = (*m_cell_identifier)[cell_i];
1011 one_cell.sampling = (*m_cell_sampling)[cell_i];
1012 one_cell.energy = (*m_cell_energy)[cell_i];
1013 one_cell.center_x = 0.0; //for now
1014 one_cell.center_y = 0.0;
1015 one_cell.center_z = 0.0;
1016 cells.insert(std::pair<Long64_t, FCS_cell>(one_cell.cell_identifier, one_cell));
1017 }
1018 else
1019 {
1020 //there shouldn't be a cell with the same identifier in this event
1021 ATH_MSG_DEBUG("ISF_HitAnalysis: Same cell???? ERROR");
1022 }
1023 }
1024
1025 // g4 hits
1026 if(m_doG4Hits){
1027 for (unsigned int g4hit_i = 0; g4hit_i < m_g4hit_identifier->size(); g4hit_i++)
1028 {
1029 if ((*m_g4hit_sampling)[g4hit_i] >= 0 && (*m_g4hit_sampling)[g4hit_i] <= 25 && (*m_g4hit_time)[g4hit_i] > m_TimingCut)
1030 {
1031 ATH_MSG_DEBUG("Ignoring G4hit, time too large: " << g4hit_i << " time: " << (*m_g4hit_time)[g4hit_i]);
1032 continue;
1033 }
1034
1035 if (g4hits.find((*m_g4hit_cellidentifier)[g4hit_i]) == g4hits.end())
1036 {
1037 //this G4 hit doesn't exist yet
1038 one_g4hit.identifier = (*m_g4hit_identifier)[g4hit_i];
1039 one_g4hit.cell_identifier = (*m_g4hit_cellidentifier)[g4hit_i];
1040 one_g4hit.sampling = (*m_g4hit_sampling)[g4hit_i];
1041 one_g4hit.hit_time = (*m_g4hit_time)[g4hit_i];
1042 //scale the hit energy with the sampling fraction
1043 if (one_g4hit.sampling >= 12 && one_g4hit.sampling <= 20)
1044 { //tile
1045 if ((*m_g4hit_samplingfraction)[g4hit_i])
1046 {
1047 one_g4hit.hit_energy = (*m_g4hit_energy)[g4hit_i] * (*m_g4hit_samplingfraction)[g4hit_i];
1048 }
1049 else one_g4hit.hit_energy = 0.;
1050 }
1051 else
1052 {
1053 one_g4hit.hit_energy = (*m_g4hit_energy)[g4hit_i] / (*m_g4hit_samplingfraction)[g4hit_i];
1054 }
1055 g4hits.insert(std::pair<Long64_t, std::vector<FCS_g4hit> >(one_g4hit.cell_identifier, std::vector<FCS_g4hit>(1, one_g4hit)));
1056 }
1057 else
1058 {
1059 //G4 hit exists in this identifier -> push_back new to the vector //FCS_g4hit one_g4hit;
1060 one_g4hit.identifier = (*m_g4hit_identifier)[g4hit_i];
1061 one_g4hit.cell_identifier = (*m_g4hit_cellidentifier)[g4hit_i];
1062 one_g4hit.sampling = (*m_g4hit_sampling)[g4hit_i];
1063 one_g4hit.hit_time = (*m_g4hit_time)[g4hit_i];
1064 if (one_g4hit.sampling >= 12 && one_g4hit.sampling <= 20)
1065 { //tile
1066 if ((*m_g4hit_samplingfraction)[g4hit_i])
1067 {
1068 one_g4hit.hit_energy = (*m_g4hit_energy)[g4hit_i] * (*m_g4hit_samplingfraction)[g4hit_i];
1069 }
1070 else one_g4hit.hit_energy = 0.;
1071 }
1072 else
1073 {
1074 one_g4hit.hit_energy = (*m_g4hit_energy)[g4hit_i] / (*m_g4hit_samplingfraction)[g4hit_i];
1075 }
1076 g4hits[(*m_g4hit_cellidentifier)[g4hit_i]].push_back(one_g4hit);
1077 }
1078 }
1079 }
1080
1081 //hits
1082 for (unsigned int hit_i = 0; hit_i < m_hit_identifier->size(); hit_i++)
1083 {
1084 if ((*m_hit_sampling)[hit_i] >= 0 && (*m_hit_sampling)[hit_i] <= 25 && (*m_hit_time)[hit_i] > m_TimingCut)
1085 {
1086 ATH_MSG_DEBUG("Ignoring FCS hit, time too large: " << hit_i << " time: " << (*m_hit_time)[hit_i]);
1087 continue;
1088 }
1089 if (hits.find((*m_hit_cellidentifier)[hit_i]) == hits.end())
1090 {
1091 //Detailed hit doesn't exist yet
1092 one_hit.identifier = (*m_hit_identifier)[hit_i];
1093 one_hit.cell_identifier = (*m_hit_cellidentifier)[hit_i];
1094 one_hit.sampling = (*m_hit_sampling)[hit_i];
1095
1096 if (one_hit.sampling >= 12 && one_hit.sampling <= 20)
1097 { //tile
1098 if ((*m_hit_samplingfraction)[hit_i])
1099 {
1100 one_hit.hit_energy = (*m_hit_energy)[hit_i] * (*m_hit_samplingfraction)[hit_i];
1101 }
1102 else one_hit.hit_energy = 0.;
1103 }
1104 else
1105 {
1106 one_hit.hit_energy = (*m_hit_energy)[hit_i] / (*m_hit_samplingfraction)[hit_i];
1107 }
1108 //one_hit.hit_sampfrac = (*m_hit_samplingfraction)[hit_i];
1109 one_hit.hit_time = (*m_hit_time)[hit_i];
1110 one_hit.hit_x = (*m_hit_x)[hit_i];
1111 one_hit.hit_y = (*m_hit_y)[hit_i];
1112 one_hit.hit_z = (*m_hit_z)[hit_i];
1113 hits.insert(std::pair<Long64_t, std::vector<FCS_hit> >(one_hit.cell_identifier, std::vector<FCS_hit>(1, one_hit)));
1114 }
1115 else
1116 {
1117 //Detailed hit exists in this identifier -> push_back new to the vector
1118 one_hit.identifier = (*m_hit_identifier)[hit_i];
1119 one_hit.cell_identifier = (*m_hit_cellidentifier)[hit_i];
1120 one_hit.sampling = (*m_hit_sampling)[hit_i];
1121 //one_hit.hit_energy = (*m_hit_energy)[hit_i];
1122 if (one_hit.sampling >= 12 && one_hit.sampling <= 20)
1123 { //tile
1124 if ((*m_hit_samplingfraction)[hit_i])
1125 {
1126 one_hit.hit_energy = (*m_hit_energy)[hit_i] * (*m_hit_samplingfraction)[hit_i];
1127 }
1128 else one_hit.hit_energy = 0.;
1129 }
1130 else
1131 {
1132 one_hit.hit_energy = (*m_hit_energy)[hit_i] / (*m_hit_samplingfraction)[hit_i];
1133 }
1134 //one_hit.hit_sampfrac = (*m_hit_samplingfraction)[hit_i];
1135 one_hit.hit_time = (*m_hit_time)[hit_i];
1136 one_hit.hit_x = (*m_hit_x)[hit_i];
1137 one_hit.hit_y = (*m_hit_y)[hit_i];
1138 one_hit.hit_z = (*m_hit_z)[hit_i];
1139 hits[(*m_hit_cellidentifier)[hit_i]].push_back(one_hit);
1140 }
1141 }
1142
1143 //Start matching:
1144 for (std::map<Long64_t, FCS_cell>::iterator it = cells.begin(); it != cells.end(); )
1145 {
1146 one_matchedcell.clear(); //maybe not completely necessery, as we're not pushing_back into vectors
1147 //set the cell part
1148 one_matchedcell.cell = it->second;
1149 //now look for FCS detailed hits in this cell
1150 std::map<Long64_t, std::vector<FCS_hit> >::iterator it2 = hits.find(it->first);
1151 if (it2 != hits.end())
1152 {
1153 //std::cout <<"FCS hits found in this cell"<<std::endl;
1154 one_matchedcell.hit = it2->second;
1155 hits.erase(it2); //remove it
1156 }
1157 else
1158 {
1159 //no hit found for this cell
1160 one_matchedcell.hit.clear(); //important!
1161 }
1162 //now look for G4hits in this cell
1163 std::map<Long64_t, std::vector<FCS_g4hit> >::iterator it3 = g4hits.find(it->first);
1164 if (it3 != g4hits.end())
1165 {
1166 one_matchedcell.g4hit = it3->second;
1167 g4hits.erase(it3);
1168 }
1169 else
1170 {
1171 //no g4hit found for this cell
1172 one_matchedcell.g4hit.clear();//important!
1173 }
1174 cells.erase(it++);
1175 //push_back matched cell for event jentry
1176 m_oneeventcells->push_back(one_matchedcell);
1177 }
1178
1179 //ok, cells should be empty, what about hits and g4hits?
1180 //There could be G4hits/FCS hits for which we don't have a cell ->create a dummy empty cell with 0 energy, take the cell identifier from the hit
1181 ATH_MSG_DEBUG("ISF_HitAnalysis Check after cells: " << cells.size() << " " << g4hits.size() << " " << hits.size());
1182
1183 for (std::map<Long64_t, std::vector<FCS_hit> >::iterator it = hits.begin(); it != hits.end();)
1184 {
1185 one_matchedcell.clear();
1186 one_matchedcell.cell.cell_identifier = it->first;
1187 //std::cout <<"This hit didn't exist in cell: "<<it->first<<std::endl;
1188 if (!it->second.empty())
1189 {
1190 one_matchedcell.cell.sampling = (it->second)[0].sampling;
1191 }
1192 else
1193 {
1194 one_matchedcell.cell.sampling = -1; //
1195 //ok, but you really shouldn't be here
1196 ATH_MSG_DEBUG("ERROR: You shouldn't really be here");
1197 }
1198 one_matchedcell.cell.energy = 0.;
1199 one_matchedcell.cell.center_x = 0.0;
1200 one_matchedcell.cell.center_y = 0.0;
1201 one_matchedcell.cell.center_z = 0.0;
1202 one_matchedcell.hit = it->second;
1203 std::map<Long64_t, std::vector<FCS_g4hit> >::iterator it3 = g4hits.find(it->first);
1204 if (it3 != g4hits.end())
1205 {
1206 one_matchedcell.g4hit = it3->second;
1207 g4hits.erase(it3);
1208 }
1209 else
1210 {
1211 //no g4hit found for this cell
1212 one_matchedcell.g4hit.clear(); //important!
1213 }
1214 hits.erase(it++);
1215 m_oneeventcells->push_back(one_matchedcell);
1216
1217 }
1218
1219 //ok, hits should be empty, what about g4hits?
1220 ATH_MSG_DEBUG("ISF_HitAnalysis Check after hits: " << cells.size() << " " << g4hits.size() << " " << hits.size());
1221 for (std::map<Long64_t, std::vector<FCS_g4hit> >::iterator it = g4hits.begin(); it != g4hits.end();)
1222 {
1223 one_matchedcell.clear(); //maybe not so important
1224 one_matchedcell.cell.cell_identifier = it->first;
1225 if (!it->second.empty())
1226 {
1227 one_matchedcell.cell.sampling = (it->second)[0].sampling;
1228 }
1229 else
1230 {
1231 one_matchedcell.cell.sampling = -1; //
1232 //not really
1233 ATH_MSG_DEBUG("ERROR: You shouldn't really be here");
1234 }
1235 one_matchedcell.cell.energy = 0.;
1236 one_matchedcell.cell.center_x = 0.0;
1237 one_matchedcell.cell.center_y = 0.0;
1238 one_matchedcell.cell.center_z = 0.0;
1239 one_matchedcell.g4hit = it->second;
1240 one_matchedcell.hit.clear(); //important!!
1241 g4hits.erase(it++);
1242 m_oneeventcells->push_back(one_matchedcell);
1243 }
1244
1245 //Can fill the output tree already here:
1246 m_total_cell_e = 0;
1247 m_total_hit_e = 0;
1248 m_total_g4hit_e = 0;
1249
1250 for (int j = 0; j < MAX_LAYER - 1; j++)
1251 {
1252 m_layercells[j]->m_vector = m_oneeventcells->GetLayer(j);
1253 }
1254
1255 //this is for invalid cells
1256 m_layercells[MAX_LAYER - 1]->m_vector = m_oneeventcells->GetLayer(-1);
1257 for (int i = 0; i < MAX_LAYER; i++)
1258 {
1259 m_final_cell_energy->push_back(0.0); //zero for each event!
1260 m_final_hit_energy->push_back(0.0);
1261 m_final_g4hit_energy->push_back(0.0);
1262
1263 for (unsigned int cellindex = 0; cellindex < m_layercells[i]->size(); cellindex++)
1264 {
1265 if (i != MAX_LAYER - 1)
1266 {
1267 m_final_cell_energy->at(i) += m_layercells[i]->m_vector.at(cellindex).cell.energy;
1268 m_total_cell_e += m_layercells[i]->m_vector.at(cellindex).cell.energy;
1269 }
1270 else
1271 {
1272 //don't add the energy in the invalid layer to the total energy (if there is any (shouldn't)
1273 m_final_cell_energy->at(i) += m_layercells[i]->m_vector.at(cellindex).cell.energy; //this should be here anyway
1274 }
1275
1276 //sum energy of all FCS detailed hits in this layer/cell
1277 for (unsigned int j = 0; j < m_layercells[i]->m_vector.at(cellindex).hit.size(); j++)
1278 {
1279 if (i != MAX_LAYER - 1)
1280 {
1281 m_total_hit_e += m_layercells[i]->m_vector.at(cellindex).hit[j].hit_energy;
1282 m_final_hit_energy->at(i) += m_layercells[i]->m_vector.at(cellindex).hit[j].hit_energy;
1283 }
1284 else
1285 {
1286 //again, don't add invalid layer energy to the sum
1287 m_final_hit_energy->at(i) += m_layercells[i]->m_vector.at(cellindex).hit[j].hit_energy;
1288 }
1289 }
1290
1291 //sum energy of all G4 hits in this layer/cell
1292 for (unsigned int j = 0; j < m_layercells[i]->m_vector.at(cellindex).g4hit.size(); j++)
1293 {
1294 if (i != MAX_LAYER - 1)
1295 {
1296 m_total_g4hit_e += m_layercells[i]->m_vector.at(cellindex).g4hit[j].hit_energy;
1297 m_final_g4hit_energy->at(i) += m_layercells[i]->m_vector.at(cellindex).g4hit[j].hit_energy;
1298 }
1299 else
1300 {
1301 //don't add invalied layer energy to the sum
1302 m_final_g4hit_energy->at(i) += m_layercells[i]->m_vector.at(cellindex).g4hit[j].hit_energy;
1303 }
1304 }
1305 }
1306 }
1307
1308 // push_back for total energy
1309 m_final_cell_energy->push_back(0.0);
1310 m_final_hit_energy->push_back(0.0);
1311 m_final_g4hit_energy->push_back(0.0);
1312
1316
1317 //Fill the tree and finish
1318 if (m_tree) m_tree->Fill();
1319
1320 return StatusCode::SUCCESS;
1321
1322} //execute
1323
1324std::vector<Trk::HitInfo>* ISF_HitAnalysis::caloHits(const HepMC::GenParticle& part) const
1325{
1326 // Start calo extrapolation
1327 ATH_MSG_DEBUG ("[ fastCaloSim transport ] processing particle "<<part.pdg_id() );
1328
1329 std::vector<Trk::HitInfo>* hitVector = new std::vector<Trk::HitInfo>;
1330
1331 int pdgId = part.pdg_id();
1332 double charge = HepPDT::ParticleID(pdgId).charge();
1333
1334 // particle Hypothesis for the extrapolation
1335 Trk::ParticleHypothesis pHypothesis = m_pdgToParticleHypothesis.convert(pdgId,charge);
1336
1337 ATH_MSG_DEBUG ("particle hypothesis "<< pHypothesis );
1338
1339 // geantinos not handled by PdgToParticleHypothesis - fix there
1340 if( pdgId == 999 ) pHypothesis = Trk::geantino;
1341
1342 auto vtx = part.production_vertex();
1343 Amg::Vector3D pos(0.,0.,0.); // default
1344
1345 if (vtx)
1346 {
1347 pos = Amg::Vector3D( vtx->position().x(),vtx->position().y(), vtx->position().z());
1348 }
1349
1350 Amg::Vector3D mom(part.momentum().x(),part.momentum().y(),part.momentum().z());
1351 ATH_MSG_DEBUG( "[ fastCaloSim transport ] starting transport from position eta="<<pos.eta()<<" phi="<<pos.phi()<<" d="<<pos.mag()<<" pT="<<mom.perp() );
1352
1353 // input parameters : curvilinear parameters
1354 Trk::CurvilinearParameters inputPar(pos,mom,charge);
1355
1356 // stable vs. unstable check : ADAPT for FASTCALOSIM
1357 //double freepath = ( !m_particleDecayHelper.empty()) ? m_particleDecayHelper->freePath(isp) : - 1.;
1358 double freepath = -1.;
1359 //ATH_MSG_VERBOSE( "[ fatras transport ] Particle free path : " << freepath);
1360 // path limit -> time limit ( TODO : extract life-time directly from decay helper )
1361 double tDec = freepath > 0. ? freepath : -1.;
1362 int decayProc = 0;
1363
1364 /* uncomment if unstable particles used by FastCaloSim
1365 // beta calculated here for further use in validation
1366 double mass = m_particleMasses.mass[pHypothesis];
1367 double mom = isp.momentum().mag();
1368 double beta = mom/sqrt(mom*mom+mass*mass);
1369
1370 if ( tDec>0.)
1371 {
1372 tDec = tDec/beta/CLHEP::c_light + isp.timeStamp();
1373 decayProc = 201;
1374 }
1375 */
1376
1377 Trk::TimeLimit timeLim(tDec,0.,decayProc); // TODO: set vertex time info
1378
1379 // prompt decay ( uncomment if unstable particles used )
1380 //if ( freepath>0. && freepath<0.01 ) {
1381 // if (!m_particleDecayHelper.empty()) {
1382 // ATH_MSG_VERBOSE( "[ fatras transport ] Decay is triggered for input particle.");
1383 // m_particleDecayHelper->decay(isp);
1384 // }
1385 // return 0;
1386 //}
1387
1388 // presample interactions - ADAPT FOR FASTCALOSIM
1389 Trk::PathLimit pathLim(-1.,0);
1390 //if (absPdg!=999 && pHypothesis<99) pathLim = m_samplingTool->sampleProcess(mom,isp.charge(),pHypothesis);
1391
1393
1394 // first extrapolation to reach the ID boundary
1395 ATH_MSG_DEBUG( "[ fastCaloSim transport ] before calo entrance ");
1396
1397 // get CaloEntrance if not done already
1398 if (!m_caloEntrance.get())
1399 {
1400 m_caloEntrance.set(m_extrapolator->trackingGeometry()->trackingVolume(m_caloEntranceName));
1401 if(!m_caloEntrance.get())
1402 ATH_MSG_INFO("CaloEntrance not found ");
1403 else
1404 ATH_MSG_INFO("CaloEntrance found ");
1405 }
1406
1407 ATH_MSG_DEBUG( "[ fastCaloSim transport ] after calo entrance ");
1408
1409 std::unique_ptr<const Trk::TrackParameters> caloEntry = nullptr;
1410
1411 if(m_caloEntrance.get() && m_caloEntrance.get()->inside(pos,0.001) && !m_extrapolator->trackingGeometry()->atVolumeBoundary(pos,m_caloEntrance.get(),0.001))
1412 {
1413 std::vector<Trk::HitInfo>* dummyHitVector = nullptr;
1414 if (charge == 0) {
1415 caloEntry =
1416 m_extrapolator->transportNeutralsWithPathLimit(inputPar,
1417 pathLim,
1418 timeLim,
1420 pHypothesis,
1421 dummyHitVector,
1422 nextGeoID,
1423 m_caloEntrance.get());
1424 } else {
1425 caloEntry = m_extrapolator->extrapolateWithPathLimit(inputPar,
1426 pathLim,
1427 timeLim,
1429 pHypothesis,
1430 dummyHitVector,
1431 nextGeoID,
1432 m_caloEntrance.get());
1433 }
1434 } else{
1435 caloEntry = inputPar.uniqueClone();
1436 }
1437
1438 ATH_MSG_DEBUG( "[ fastCaloSim transport ] after calo caloEntry ");
1439
1440 if(caloEntry)
1441 {
1442 std::unique_ptr<const Trk::TrackParameters> eParameters = nullptr;
1443
1444 // save Calo entry hit (fallback info)
1445 hitVector->push_back(Trk::HitInfo(caloEntry->uniqueClone(),timeLim.time,nextGeoID,0.));
1446
1447 ATH_MSG_DEBUG( "[ fastCaloSim transport ] starting Calo transport from position eta="<<caloEntry->position().eta()<<" phi="<<caloEntry->position().phi()<<" d="<<caloEntry->position().mag() );
1448
1449 if (charge == 0) {
1450 eParameters =
1451 m_extrapolator->transportNeutralsWithPathLimit(*caloEntry,
1452 pathLim,
1453 timeLim,
1455 pHypothesis,
1456 hitVector,
1457 nextGeoID);
1458 } else {
1459 eParameters = m_extrapolator->extrapolateWithPathLimit(*caloEntry,
1460 pathLim,
1461 timeLim,
1463 pHypothesis,
1464 hitVector,
1465 nextGeoID);
1466 }
1467 // save Calo exit hit (fallback info)
1468 if (eParameters) hitVector->push_back(Trk::HitInfo(std::move(eParameters),timeLim.time,nextGeoID,0.));
1469 //delete eParameters; // HitInfo took ownership
1470 }
1471
1472 if(msgLvl(MSG::DEBUG))
1473 {
1474 std::vector<Trk::HitInfo>::iterator it = hitVector->begin();
1475 while (it < hitVector->end() )
1476 {
1477 int sample=(*it).detID;
1478 Amg::Vector3D hitPos = (*it).trackParms->position();
1479 ATH_MSG_DEBUG(" HIT: layer="<<sample<<" sample="<<sample-3000<<" eta="<<hitPos.eta()<<" phi="<<hitPos.phi()<<" d="<<hitPos.mag());
1480 ++it;
1481 }
1482 }
1483
1484 return hitVector;
1485} //caloHits
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
double charge(const T &p)
Definition AtlasPID.h:997
Declaration of CaloDepthTool.
std::vector< FPGATrackSimHit > hitVector
int GetEnergy()
Definition GetEnergy.cxx:81
StatusCode ISF_HitAnalysis::initialize ATLAS_NOT_THREAD_SAFE()
Install fatal handler with default options.
static Double_t sc
AtlasHitsVector< TileHit >::const_iterator TileHitVecConstIterator
AtlasHitsVector< TileHit > TileHitVector
AtlasHitsVector< TrackRecord > TrackRecordCollection
#define y
#define x
#define z
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
bool msgLvl(const MSG::Level lvl) const
An AttributeList represents a logical row of attributes in a metadata table.
boost::transform_iterator< make_const, typename CONT::const_iterator > const_iterator
const_iterator begin() const
const_iterator end() const
Container class for CaloCell.
CaloSampling::CaloSample CaloSample
Definition CaloCell_ID.h:53
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
This class groups all DetDescr information related to a CaloCell.
CaloCell_ID::CaloSample getSampling() const
cell sampling
Identifier identify() const override final
cell identifier
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
calo_element_range element_range() const
Range over element vector.
This class provides the client interface for accessing the detector description information common to...
This class initializes the Calo (LAr and Tile) offline identifiers.
const TileID * getTileID(void) const
const LArHEC_ID * getHEC_ID(void) const
const LArFCAL_ID * getFCAL_ID(void) const
const LArEM_ID * getEM_ID(void) const
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
bool empty() const noexcept
Returns true if the collection is empty.
virtual const float & FSAMPL(const HWIdentifier &id) const =0
Class for collection of StepInfo class (G4 hits) copied and modified version to ISF.
std::vector< std::vector< bool > > * m_newTTC_entrance_OK
std::vector< std::vector< float > > * m_newTTC_back_r
std::vector< Float_t > * m_final_hit_energy
std::vector< float > * m_MuonEntryLayer_pz
std::vector< std::vector< float > > * m_newTTC_back_detaBorder
std::vector< std::vector< float > > * m_newTTC_entrance_phi
const LArHEC_ID * m_larHecID
FCS_matchedcellvector * m_oneeventcells
std::vector< std::vector< float > > * m_newTTC_mid_r
std::vector< Long64_t > * m_g4hit_cellidentifier
std::vector< bool > * m_islarhec
std::vector< std::vector< Long64_t > > * m_cluster_cellID
SG::ReadCondHandleKey< ILArfSampl > m_fSamplKey
std::vector< float > * m_newTTC_IDCaloBoundary_phi
std::vector< float > * m_MuonEntryLayer_py
std::vector< float > * m_cluster_eta
std::vector< int > * m_truth_barcode
std::vector< std::vector< float > > * m_newTTC_back_phi
std::vector< int > * m_truth_pdg
const LArFCAL_ID * m_larFcalID
std::vector< float > * m_truth_py
std::vector< std::vector< float > > * m_newTTC_mid_eta
std::vector< float > * m_MuonEntryLayer_x
virtual StatusCode execute(const EventContext &ctx) override
Execute method.
std::vector< int > * m_g4hit_sampling
std::vector< float > * m_newTTC_IDCaloBoundary_eta
StringProperty m_caloEntranceName
std::vector< float > * m_newTTC_IDCaloBoundary_z
PublicToolHandle< IFastCaloSimCaloExtrapolation > m_FastCaloSimCaloExtrapolation
The FastCaloSimCaloExtrapolation tool.
std::vector< std::vector< float > > * m_newTTC_mid_detaBorder
std::vector< std::vector< float > > * m_newTTC_entrance_z
SG::ReadCondHandleKey< TileSamplingFraction > m_tileSamplingFractionKey
Name of TileSamplingFraction in condition store.
std::vector< float > * m_hit_y
IntegerProperty m_TimingCut
std::vector< std::vector< float > > * m_newTTC_entrance_eta
std::vector< float > * m_MuonEntryLayer_z
Trk::PdgToParticleHypothesis m_pdgToParticleHypothesis
std::vector< float > * m_truth_pz
std::vector< float > * m_cluster_energy
std::vector< std::vector< float > > * m_newTTC_back_eta
std::vector< std::vector< float > > * m_newTTC_mid_z
std::vector< float > * m_hit_z
std::vector< float > * m_newTTC_AngleEta
std::vector< float > * m_truth_px
CxxUtils::CachedPointer< const Trk::TrackingVolume > m_caloEntrance
The new Extrapolator setup.
ISF_HitAnalysis(const std::string &name, ISvcLocator *pSvcLocator)
std::vector< float > * m_hit_x
Simple variables by Ketevi.
std::vector< std::vector< bool > > * m_newTTC_back_OK
const TileHWID * m_tileHWID
std::vector< float > * m_hit_time
BooleanProperty m_doG4Hits
std::vector< float > * m_cluster_phi
std::vector< std::vector< bool > > * m_newTTC_mid_OK
std::vector< float > * m_g4hit_time
std::vector< float > * m_truth_energy
std::vector< float > * m_hit_samplingfraction
std::vector< Long64_t > * m_cell_identifier
std::vector< bool > * m_islarbarrel
std::vector< int > * m_truth_vtxbarcode
PublicToolHandle< Trk::ITimedExtrapolator > m_extrapolator
std::vector< float > * m_newTTC_Angle3D
const TileID * m_tileID
std::vector< Long64_t > * m_hit_identifier
std::vector< float > * m_MuonEntryLayer_E
std::vector< std::vector< float > > * m_newTTC_entrance_r
std::vector< float > * m_hit_energy
std::vector< Trk::HitInfo > * caloHits(const HepMC::GenParticle &part) const
DoubleProperty m_CaloBoundaryR
std::vector< int > * m_MuonEntryLayer_pdg
const TileDetDescrManager * m_tileMgr
DoubleProperty m_CaloBoundaryZ
std::vector< unsigned > * m_cluster_size
std::vector< float > * m_MuonEntryLayer_y
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
std::vector< bool > * m_islarendcap
std::vector< std::vector< float > > * m_newTTC_mid_phi
std::vector< int > * m_cell_sampling
std::vector< Long64_t > * m_hit_cellidentifier
std::vector< CaloCell_ID_FCS::CaloSample > m_surfacelist
std::vector< float > * m_g4hit_samplingfraction
std::vector< float > * m_newTTC_IDCaloBoundary_r
std::vector< float > * m_cell_energy
FCS_matchedcellvector * m_layercells[MAX_LAYER]
std::vector< bool > * m_istile
std::vector< std::vector< float > > * m_newTTC_entrance_detaBorder
static const int MAX_LAYER
std::vector< std::vector< float > > * m_newTTC_back_z
const LArEM_ID * m_larEmID
std::vector< int > * m_hit_sampling
std::vector< float > * m_g4hit_energy
std::vector< Float_t > * m_final_cell_energy
std::vector< Long64_t > * m_g4hit_identifier
std::vector< float > * m_MuonEntryLayer_px
IntegerProperty m_NtruthParticles
std::vector< bool > * m_islarfcal
std::vector< Float_t > * m_final_g4hit_energy
const TileCablingService * m_tileCabling
value_type get_compact() const
Get the compact id.
Hit collection.
Class to store hit energy and time in LAr cell from G4 simulation.
Definition LArHit.h:25
double energy() const
Definition LArHit.h:113
Identifier cellID() const
Definition LArHit.h:108
double time() const
Definition LArHit.h:118
This defines the McEventCollection, which is really just an ObjectVector of McEvent objectsFile: Gene...
void set_vertex(const TLorentzVector &val)
const TLorentzVector & vertex() const
std::unique_ptr< ParametersBase< DIM, T > > uniqueClone() const
clone method for polymorphic deep copy returning unique_ptr; it is not overriden, but uses the existi...
const CaloClusterCellLink * getCellLinks() const
Get a pointer to the CaloClusterCellLink object (const version).
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual double e() const
The total energy of the particle.
CaloClusterCellLink::const_iterator const_cell_iterator
Iterator of the underlying CaloClusterCellLink (explicitly const version).
const_cell_iterator cell_end() const
virtual double phi() const
The azimuthal angle ( ) of the particle.
const_cell_iterator cell_begin() const
Iterator of the underlying CaloClusterCellLink (const version).
int r
Definition globals.cxx:22
Eigen::Matrix< double, 3, 1 > Vector3D
::StatusCode StatusCode
StatusCode definition for legacy code.
int barcode(const T *p)
Definition Barcode.h:15
@ alongMomentum
CurvilinearParametersT< TrackParametersDim, Charged, PlaneSurface > CurvilinearParameters
ParticleHypothesis
Enumeration for Particle hypothesis respecting the interaction with material.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
CaloClusterContainer_v1 CaloClusterContainer
Define the latest version of the calorimeter cluster container.
float energy
Definition FCS_Cell.h:26
float center_x
Definition FCS_Cell.h:27
int sampling
Definition FCS_Cell.h:25
float center_y
Definition FCS_Cell.h:28
Long64_t cell_identifier
Definition FCS_Cell.h:24
float center_z
Definition FCS_Cell.h:29
int sampling
Definition FCS_Cell.h:50
float hit_time
Definition FCS_Cell.h:52
Long64_t cell_identifier
Definition FCS_Cell.h:49
Long64_t identifier
Definition FCS_Cell.h:48
float hit_energy
Definition FCS_Cell.h:51
float hit_time
Definition FCS_Cell.h:39
float hit_z
Definition FCS_Cell.h:42
float hit_x
Definition FCS_Cell.h:40
Long64_t identifier
Definition FCS_Cell.h:35
float hit_y
Definition FCS_Cell.h:41
float hit_energy
Definition FCS_Cell.h:38
int sampling
Definition FCS_Cell.h:37
Long64_t cell_identifier
Definition FCS_Cell.h:36
std::vector< FCS_g4hit > g4hit
Definition FCS_Cell.h:59
std::vector< FCS_hit > hit
Definition FCS_Cell.h:60
FCS_cell cell
Definition FCS_Cell.h:58