12#include "CaloDetDescr/CaloDetDescrElement.h"
87 ATH_CHECK(detStore()->retrieve(m_tileMgr));
88 ATH_CHECK(detStore()->retrieve(m_tileID));
91 ATH_CHECK(detStore()->retrieve(caloIdManager));
93 if(m_larEmID==
nullptr)
94 throw std::runtime_error(
"ISF_HitAnalysis: Invalid LAr EM ID helper");
96 if(m_larFcalID==
nullptr)
97 throw std::runtime_error(
"ISF_HitAnalysis: Invalid FCAL ID helper");
99 if(m_larHecID==
nullptr)
100 throw std::runtime_error(
"ISF_HitAnalysis: Invalid HEC ID helper");
102 if(m_tileID==
nullptr)
103 throw std::runtime_error(
"ISF_HitAnalysis: Invalid Tile ID helper");
107 ATH_CHECK(detStore()->retrieve(m_tileHWID));
108 ATH_CHECK( m_tileSamplingFractionKey.initialize() );
110 ATH_CHECK( m_tileCablingSvc.retrieve() );
111 m_tileCabling = m_tileCablingSvc->cablingService();
116 if (!m_extrapolator.empty() && m_extrapolator.retrieve().isFailure()) {
117 return StatusCode::FAILURE;
126 ATH_CHECK (m_FastCaloSimCaloExtrapolation.retrieve());
132 std::unique_ptr<TFile> dummyFile = std::unique_ptr<TFile>(TFile::Open(
"dummyFile.root",
"RECREATE"));
133 m_tree =
new TTree(
"FCS_ParametrizationInput",
"FCS_ParametrizationInput");
134 std::string fullNtupleName =
"/"+m_ntupleFileName+
"/"+m_ntupleTreeName;
135 StatusCode
sc = m_thistSvc->regTree(fullNtupleName, m_tree);
136 if (
sc.isFailure() || !m_tree )
138 ATH_MSG_ERROR(
"Unable to register TTree: " << fullNtupleName);
139 return StatusCode::FAILURE;
145 ATH_MSG_INFO(
"Successfull registered TTree: " << fullNtupleName);
147 m_hit_x =
new std::vector<float>;
148 m_hit_y =
new std::vector<float>;
149 m_hit_z =
new std::vector<float>;
150 m_hit_energy =
new std::vector<float>;
151 m_hit_time =
new std::vector<float>;
152 m_hit_identifier =
new std::vector<Long64_t>;
153 m_hit_cellidentifier =
new std::vector<Long64_t>;
154 m_islarbarrel =
new std::vector<bool>;
155 m_islarendcap =
new std::vector<bool>;
156 m_islarhec =
new std::vector<bool>;
157 m_islarfcal =
new std::vector<bool>;
158 m_istile =
new std::vector<bool>;
159 m_hit_sampling =
new std::vector<int>;
160 m_hit_samplingfraction =
new std::vector<float>;
162 m_truth_energy =
new std::vector<float>;
163 m_truth_px =
new std::vector<float>;
164 m_truth_py =
new std::vector<float>;
165 m_truth_pz =
new std::vector<float>;
166 m_truth_pdg =
new std::vector<int>;
167 m_truth_barcode =
new std::vector<int>;
168 m_truth_vtxbarcode =
new std::vector<int>;
170 m_cluster_energy =
new std::vector<float>;
171 m_cluster_eta =
new std::vector<float>;
172 m_cluster_phi =
new std::vector<float>;
173 m_cluster_size =
new std::vector<unsigned>;
174 m_cluster_cellID =
new std::vector<std::vector<Long64_t > >;
176 m_cell_identifier =
new std::vector<Long64_t>;
177 m_cell_energy =
new std::vector<float>;
178 m_cell_sampling =
new std::vector<int>;
180 m_g4hit_energy =
new std::vector<float>;
181 m_g4hit_time =
new std::vector<float>;
182 m_g4hit_identifier =
new std::vector<Long64_t>;
183 m_g4hit_cellidentifier =
new std::vector<Long64_t>;
184 m_g4hit_samplingfraction =
new std::vector<float>;
185 m_g4hit_sampling =
new std::vector<int>;
191 m_final_cell_energy =
new std::vector<Float_t>;
192 m_final_hit_energy =
new std::vector<Float_t>;
193 m_final_g4hit_energy =
new std::vector<Float_t>;
195 m_newTTC_entrance_eta =
new std::vector<std::vector<float> >;
196 m_newTTC_entrance_phi =
new std::vector<std::vector<float> >;
197 m_newTTC_entrance_r =
new std::vector<std::vector<float> >;
198 m_newTTC_entrance_z =
new std::vector<std::vector<float> >;
199 m_newTTC_entrance_detaBorder =
new std::vector<std::vector<float> >;
200 m_newTTC_entrance_OK =
new std::vector<std::vector<bool> >;
201 m_newTTC_back_eta =
new std::vector<std::vector<float> >;
202 m_newTTC_back_phi =
new std::vector<std::vector<float> >;
203 m_newTTC_back_r =
new std::vector<std::vector<float> >;
204 m_newTTC_back_z =
new std::vector<std::vector<float> >;
205 m_newTTC_back_detaBorder =
new std::vector<std::vector<float> >;
206 m_newTTC_back_OK =
new std::vector<std::vector<bool> >;
207 m_newTTC_mid_eta =
new std::vector<std::vector<float> >;
208 m_newTTC_mid_phi =
new std::vector<std::vector<float> >;
209 m_newTTC_mid_r =
new std::vector<std::vector<float> >;
210 m_newTTC_mid_z =
new std::vector<std::vector<float> >;
211 m_newTTC_mid_detaBorder =
new std::vector<std::vector<float> >;
212 m_newTTC_mid_OK =
new std::vector<std::vector<bool> >;
213 m_newTTC_IDCaloBoundary_eta =
new std::vector<float>;
214 m_newTTC_IDCaloBoundary_phi =
new std::vector<float>;
215 m_newTTC_IDCaloBoundary_r =
new std::vector<float>;
216 m_newTTC_IDCaloBoundary_z =
new std::vector<float>;
217 m_newTTC_Angle3D =
new std::vector<float>;
218 m_newTTC_AngleEta =
new std::vector<float>;
220 m_MuonEntryLayer_E =
new std::vector<float>;
221 m_MuonEntryLayer_px =
new std::vector<float>;
222 m_MuonEntryLayer_py =
new std::vector<float>;
223 m_MuonEntryLayer_pz =
new std::vector<float>;
224 m_MuonEntryLayer_x =
new std::vector<float>;
225 m_MuonEntryLayer_y =
new std::vector<float>;
226 m_MuonEntryLayer_z =
new std::vector<float>;
227 m_MuonEntryLayer_pdg =
new std::vector<int>;
230 if(m_saveAllBranches){
231 m_tree->Branch(
"HitX", &m_hit_x);
232 m_tree->Branch(
"HitY", &m_hit_y);
233 m_tree->Branch(
"HitZ", &m_hit_z);
234 m_tree->Branch(
"HitE", &m_hit_energy);
235 m_tree->Branch(
"HitT", &m_hit_time);
236 m_tree->Branch(
"HitIdentifier", &m_hit_identifier);
237 m_tree->Branch(
"HitCellIdentifier", &m_hit_cellidentifier);
238 m_tree->Branch(
"HitIsLArBarrel", &m_islarbarrel);
239 m_tree->Branch(
"HitIsLArEndCap", &m_islarendcap);
240 m_tree->Branch(
"HitIsHEC", &m_islarhec);
241 m_tree->Branch(
"HitIsFCAL", &m_islarfcal);
242 m_tree->Branch(
"HitIsTile", &m_istile);
243 m_tree->Branch(
"HitSampling", &m_hit_sampling);
244 m_tree->Branch(
"HitSamplingFraction", &m_hit_samplingfraction);
246 m_tree->Branch(
"CellIdentifier", &m_cell_identifier);
247 m_tree->Branch(
"CellE", &m_cell_energy);
248 m_tree->Branch(
"CellSampling", &m_cell_sampling);
250 m_tree->Branch(
"G4HitE", &m_g4hit_energy);
251 m_tree->Branch(
"G4HitT", &m_g4hit_time);
252 m_tree->Branch(
"G4HitIdentifier", &m_g4hit_identifier);
253 m_tree->Branch(
"G4HitCellIdentifier", &m_g4hit_cellidentifier);
254 m_tree->Branch(
"G4HitSamplingFraction",&m_g4hit_samplingfraction);
255 m_tree->Branch(
"G4HitSampling", &m_g4hit_sampling);
259 m_tree->Branch(
"TruthE", &m_truth_energy);
260 m_tree->Branch(
"TruthPx", &m_truth_px);
261 m_tree->Branch(
"TruthPy", &m_truth_py);
262 m_tree->Branch(
"TruthPz", &m_truth_pz);
263 m_tree->Branch(
"TruthPDG", &m_truth_pdg);
264 m_tree->Branch(
"TruthBarcode", &m_truth_barcode);
265 m_tree->Branch(
"TruthVtxBarcode", &m_truth_vtxbarcode);
268 m_tree->Branch(
"ClusterE", &m_cluster_energy);
269 m_tree->Branch(
"ClusterEta", &m_cluster_eta);
270 m_tree->Branch(
"ClusterPhi", &m_cluster_phi);
271 m_tree->Branch(
"ClusterSize", &m_cluster_size);
272 m_tree->Branch(
"ClusterCellID", &m_cluster_cellID);
277 m_tree->Branch(
"AllCells", &m_oneeventcells);
282 for (Int_t i = 0; i < MAX_LAYER; i++)
284 TString branchname =
"Sampling_";
287 m_tree->Branch(branchname, &m_layercells[i]);
293 m_tree->Branch(
"cell_energy", &m_final_cell_energy);
294 m_tree->Branch(
"hit_energy", &m_final_hit_energy);
295 m_tree->Branch(
"g4hit_energy", &m_final_g4hit_energy);
298 m_tree->Branch(
"total_cell_energy", &m_total_cell_e);
299 m_tree->Branch(
"total_hit_energy", &m_total_hit_e);
300 m_tree->Branch(
"total_g4hit_energy", &m_total_g4hit_e);
303 m_tree->Branch(
"newTTC_back_eta",&m_newTTC_back_eta);
304 m_tree->Branch(
"newTTC_back_phi",&m_newTTC_back_phi);
305 m_tree->Branch(
"newTTC_back_r",&m_newTTC_back_r);
306 m_tree->Branch(
"newTTC_back_z",&m_newTTC_back_z);
307 m_tree->Branch(
"newTTC_back_detaBorder",&m_newTTC_back_detaBorder);
308 m_tree->Branch(
"newTTC_back_OK",&m_newTTC_back_OK);
309 m_tree->Branch(
"newTTC_entrance_eta",&m_newTTC_entrance_eta);
310 m_tree->Branch(
"newTTC_entrance_phi",&m_newTTC_entrance_phi);
311 m_tree->Branch(
"newTTC_entrance_r",&m_newTTC_entrance_r);
312 m_tree->Branch(
"newTTC_entrance_z",&m_newTTC_entrance_z);
313 m_tree->Branch(
"newTTC_entrance_detaBorder",&m_newTTC_entrance_detaBorder);
314 m_tree->Branch(
"newTTC_entrance_OK",&m_newTTC_entrance_OK);
315 m_tree->Branch(
"newTTC_mid_eta",&m_newTTC_mid_eta);
316 m_tree->Branch(
"newTTC_mid_phi",&m_newTTC_mid_phi);
317 m_tree->Branch(
"newTTC_mid_r",&m_newTTC_mid_r);
318 m_tree->Branch(
"newTTC_mid_z",&m_newTTC_mid_z);
319 m_tree->Branch(
"newTTC_mid_detaBorder",&m_newTTC_mid_detaBorder);
320 m_tree->Branch(
"newTTC_mid_OK",&m_newTTC_mid_OK);
321 m_tree->Branch(
"newTTC_IDCaloBoundary_eta",&m_newTTC_IDCaloBoundary_eta);
322 m_tree->Branch(
"newTTC_IDCaloBoundary_phi",&m_newTTC_IDCaloBoundary_phi);
323 m_tree->Branch(
"newTTC_IDCaloBoundary_r",&m_newTTC_IDCaloBoundary_r);
324 m_tree->Branch(
"newTTC_IDCaloBoundary_z",&m_newTTC_IDCaloBoundary_z);
325 m_tree->Branch(
"newTTC_Angle3D",&m_newTTC_Angle3D);
326 m_tree->Branch(
"newTTC_AngleEta",&m_newTTC_AngleEta);
328 m_tree->Branch(
"MuonEntryLayer_E",&m_MuonEntryLayer_E);
329 m_tree->Branch(
"MuonEntryLayer_px",&m_MuonEntryLayer_px);
330 m_tree->Branch(
"MuonEntryLayer_py",&m_MuonEntryLayer_py);
331 m_tree->Branch(
"MuonEntryLayer_pz",&m_MuonEntryLayer_pz);
332 m_tree->Branch(
"MuonEntryLayer_x",&m_MuonEntryLayer_x);
333 m_tree->Branch(
"MuonEntryLayer_y",&m_MuonEntryLayer_y);
334 m_tree->Branch(
"MuonEntryLayer_z",&m_MuonEntryLayer_z);
335 m_tree->Branch(
"MuonEntryLayer_pdg",&m_MuonEntryLayer_pdg);
338 return StatusCode::SUCCESS;
348 if (detStore()->retrieve(simParam, m_MC_SIM_PARAM).isFailure()) {
350 return StatusCode::FAILURE;
353 for (
auto attrItr = simParam->begin(); attrItr != simParam->end();
355 std::stringstream outstr;
356 attrItr->toOutputStream(outstr);
362 if (detStore()->retrieve(digiParam, m_MC_DIGI_PARAM).isFailure()) {
364 return StatusCode::FAILURE;
367 for (
auto attrItr = digiParam->begin(); attrItr != digiParam->end();
369 std::stringstream outstr;
370 attrItr->toOutputStream(outstr);
371 ATH_MSG_INFO(
"Digitization MetaData: " << outstr.str());
374 std::unique_ptr<TFile> dummyGeoFile = std::unique_ptr<TFile>(TFile::Open(
"dummyGeoFile.root",
"RECREATE"));
375 TTree*
geo =
new TTree( m_geoModel->atlasVersion().c_str() , m_geoModel->atlasVersion().c_str() );
376 std::string fullNtupleName =
"/"+m_geoFileName+
"/"+m_geoModel->atlasVersion();
377 StatusCode sc = m_thistSvc->regTree(fullNtupleName, geo);
378 if(
sc.isFailure() || !geo )
380 ATH_MSG_ERROR(
"Unable to register TTree: " << fullNtupleName);
381 return StatusCode::FAILURE;
389 Int_t calosample = 0;
390 float eta = 0,
phi = 0,
r = 0,eta_raw = 0,phi_raw = 0,r_raw = 0,
x = 0,
y = 0,
z = 0,x_raw = 0,y_raw = 0,z_raw = 0;
391 float deta = 0,dphi = 0,
dr = 0,
dx = 0,
dy = 0,dz = 0;
394 static GEOCELL geocell;
398 ATH_MSG_INFO(
"Successfull registered TTree: " << fullNtupleName);
401 geo->Branch(
"identifier", &geocell.identifier,
"identifier/L");
402 geo->Branch(
"calosample", &geocell.calosample,
"calosample/I");
404 geo->Branch(
"eta", &geocell.eta,
"eta/F");
405 geo->Branch(
"phi", &geocell.phi,
"phi/F");
406 geo->Branch(
"r", &geocell.r,
"r/F");
407 geo->Branch(
"eta_raw", &geocell.eta_raw,
"eta_raw/F");
408 geo->Branch(
"phi_raw", &geocell.phi_raw,
"phi_raw/F");
409 geo->Branch(
"r_raw", &geocell.r_raw,
"r_raw/F");
411 geo->Branch(
"x", &geocell.x,
"x/F");
412 geo->Branch(
"y", &geocell.y,
"y/F");
413 geo->Branch(
"z", &geocell.z,
"z/F");
414 geo->Branch(
"x_raw", &geocell.x_raw,
"x_raw/F");
415 geo->Branch(
"y_raw", &geocell.y_raw,
"y_raw/F");
416 geo->Branch(
"z_raw", &geocell.z_raw,
"z_raw/F");
418 geo->Branch(
"deta", &geocell.deta,
"deta/F");
419 geo->Branch(
"dphi", &geocell.dphi,
"dphi/F");
420 geo->Branch(
"dr", &geocell.dr,
"dr/F");
421 geo->Branch(
"dx", &geocell.dx,
"dx/F");
422 geo->Branch(
"dy", &geocell.dy,
"dy/F");
423 geo->Branch(
"dz", &geocell.dz,
"dz/F");
440 geocell.identifier=theDDE->identify().get_compact();
441 geocell.calosample=
sample;
442 geocell.eta=theDDE->eta();
443 geocell.phi=theDDE->phi();
444 geocell.r=theDDE->r();
445 geocell.eta_raw=theDDE->eta_raw();
446 geocell.phi_raw=theDDE->phi_raw();
447 geocell.r_raw=theDDE->r_raw();
448 geocell.x=theDDE->x();
449 geocell.y=theDDE->y();
450 geocell.z=theDDE->z();
451 geocell.x_raw=theDDE->x_raw();
452 geocell.y_raw=theDDE->y_raw();
453 geocell.z_raw=theDDE->z_raw();
454 geocell.deta=theDDE->deta();
455 geocell.dphi=theDDE->dphi();
456 geocell.dr=theDDE->dr();
457 geocell.dx=theDDE->dx();
458 geocell.dy=theDDE->dy();
459 geocell.dz=theDDE->dz();
468 dummyGeoFile->Close();
469 return StatusCode::SUCCESS;
481 return StatusCode::FAILURE;
493 vectest.SetPtEtaPhi(1.,1.,1.);
531 std::map<Long64_t, FCS_cell> cells;
532 std::map<Long64_t, std::vector<FCS_g4hit> > g4hits;
533 std::map<Long64_t, std::vector<FCS_hit> > hits;
592 StatusCode
sc =
evtStore()->retrieve(eventStepsES,
"MergedEventSteps");
593 if (
sc.isFailure()) {
599 m_hit_x->push_back( (*it)->x() );
600 m_hit_y->push_back( (*it)->y() );
601 m_hit_z->push_back( (*it)->z() );
606 bool larbarrel=
false;
607 bool larendcap=
false;
627 int channel =
m_tileHWID->channel(channel_id);
628 int drawerIdx =
m_tileHWID->drawerIdx(channel_id);
629 sampfrac = tileSamplingFraction->getSamplingFraction(drawerIdx, channel);
633 if (
m_larEmID->is_em_barrel(
id)) larbarrel=
true;
634 else if(
m_larEmID->is_em_endcap(
id)) larendcap=
true;
641 }
else if (
m_tileID->is_tile_aux(
id)) {
645 sampling = CaloCell_ID::TileGap3;
650 Int_t tile_sampling = -1;
654 if(tile_sampling!= -1) sampling = tile_sampling;
676 sc =
evtStore()->retrieve(mcEvent,
"TruthEvent");
682 if(!mcEvent->
empty()) {
685 int particles_size=(*mcEvent->
begin())->particles_size();
687 loopEnd = particles_size;
689 for (
const auto& part: *(*mcEvent->
begin()))
692 ATH_MSG_DEBUG(
"Number truth particles="<<particles_size<<
" loopEnd="<<loopEnd);
695 if (particleIndex>loopEnd)
break;
699 TFCSTruthState truth(part->momentum().px(),part->momentum().py(),part->momentum().pz(),part->momentum().e(),part->pdg_id());
703 moment.SetXYZ(part->momentum().px(),part->momentum().py(),part->momentum().pz());
704 TVector3 direction=moment.Unit();
716 if((part)->production_vertex()) {
717 truth.
set_vertex((part)->production_vertex()->position().
x(), (part)->production_vertex()->position().
y(), (part)->production_vertex()->position().
z());
719 truth.
set_vertex(direction.X(),direction.Y(),direction.Z());
720 ATH_MSG_WARNING(
"No particle production vetext, use VERTEX from direction: x "<<direction.X()<<
" y "<<direction.Y()<<
" z "<<direction.Z());
723 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 ) {
724 ATH_MSG_WARNING(
"VERTEX from direction: x "<<direction.X()<<
" y "<<direction.Y()<<
" z "<<direction.Z());
733 ATH_MSG_DEBUG(
"IDCaloBoundary_eta() "<<result.IDCaloBoundary_eta());
734 ATH_MSG_DEBUG(
"IDCaloBoundary_phi() "<<result.IDCaloBoundary_phi());
735 ATH_MSG_DEBUG(
"IDCaloBoundary_r() "<<result.IDCaloBoundary_r());
736 ATH_MSG_DEBUG(
"IDCaloBoundary_z() "<<result.IDCaloBoundary_z());
737 ATH_MSG_DEBUG(
"AngleEta "<<result.IDCaloBoundary_AngleEta());
747 std::vector<float> eta_vec_ENT;
748 std::vector<float> phi_vec_ENT;
749 std::vector<float> r_vec_ENT;
750 std::vector<float> z_vec_ENT;
751 std::vector<float> detaBorder_vec_ENT;
752 std::vector<bool> OK_vec_ENT;
754 std::vector<float> eta_vec_EXT;
755 std::vector<float> phi_vec_EXT;
756 std::vector<float> r_vec_EXT;
757 std::vector<float> z_vec_EXT;
758 std::vector<float> detaBorder_vec_EXT;
759 std::vector<bool> OK_vec_EXT;
761 std::vector<float> eta_vec_MID;
762 std::vector<float> phi_vec_MID;
763 std::vector<float> r_vec_MID;
764 std::vector<float> z_vec_MID;
765 std::vector<float> detaBorder_vec_MID;
766 std::vector<bool> OK_vec_MID;
770 ATH_MSG_DEBUG(
" eta ENT "<<result.eta(sample,1)<<
" eta EXT "<<result.eta(sample,2));
771 ATH_MSG_DEBUG(
" phi ENT "<<result.phi(sample,1)<<
" phi EXT "<<result.phi(sample,2));
772 ATH_MSG_DEBUG(
" r ENT "<<result.r(sample,1) <<
" r EXT "<<result.r(sample,2) );
773 ATH_MSG_DEBUG(
" z ENT "<<result.z(sample,1) <<
" z EXT "<<result.z(sample,2) );
774 ATH_MSG_DEBUG(
" detaBorder ENT "<<result.detaBorder(sample,1) <<
" detaBorder EXT "<<result.detaBorder(sample,2) );
775 ATH_MSG_DEBUG(
" OK ENT "<<result.OK(sample,1) <<
" OK EXT "<<result.OK(sample,2) );
816 m_truth_px->push_back((part)->momentum().px());
817 m_truth_py->push_back((part)->momentum().py());
818 m_truth_pz->push_back((part)->momentum().pz());
829 sc =
evtStore()->retrieve(MuonEntry,
"MuonEntryLayer");
851 std::string clusterContainerName =
"CaloCalTopoClusters";
852 sc =
evtStore()->retrieve(theClusters, clusterContainerName);
853 if (
sc.isFailure()) {
854 ATH_MSG_WARNING(
" Couldn't get cluster container '" << clusterContainerName <<
"'");
855 return StatusCode::SUCCESS;
859 for ( ; itrClus!=itrLastClus; ++itrClus){
877 unsigned cellcount = 0;
878 std::vector<Long64_t> cellIDs_in_cluster;
881 for ( ;cellIter !=cellIterEnd;cellIter++) {
884 cellIDs_in_cluster.push_back(cell->ID().get_compact());
885 float EnergyCell=cell->energy();
894 sc =
evtStore()->retrieve(cellColl,
"AllCalo");
905 for ( ; itrCell!=itrLastCell; ++itrCell)
909 if (
m_tileID->is_tile_aux((*itrCell)->ID())) {
913 else if (calo_dd_man->
get_element((*itrCell)->ID()))
925 std::string lArKey [4] = {
"LArHitEMB",
"LArHitEMEC",
"LArHitFCAL",
"LArHitHEC"};
926 for (
unsigned int i=0;i<4;i++)
930 if(
evtStore()->retrieve(iter,lArKey[i])==StatusCode::SUCCESS)
934 for (hi=(*iter).begin();hi!=(*iter).end();++hi) {
936 const LArHit* larHit = *hi;
944 float larsampfrac=fSampl->
FSAMPL(larhitid);
953 ATH_MSG_INFO(
"Read "<<hitnumber<<
" G4Hits from "<<lArKey[i]);
976 int channel =
m_tileHWID->channel(channel_id);
977 int drawerIdx =
m_tileHWID->drawerIdx(channel_id);
978 float tilesampfrac = tileSamplingFraction->getSamplingFraction(drawerIdx, channel);
981 for (
int tilesubhit_i = 0; tilesubhit_i<(*i_hit).size(); tilesubhit_i++)
992 ATH_MSG_INFO(
"Read "<<hitnumber<<
" G4Hits from TileHitVec");
1003 one_cell.
sampling = (*m_cell_sampling)[cell_i];
1004 one_cell.
energy = (*m_cell_energy)[cell_i];
1008 cells.insert(std::pair<Long64_t, FCS_cell>(one_cell.
cell_identifier, one_cell));
1030 one_g4hit.
identifier = (*m_g4hit_identifier)[g4hit_i];
1032 one_g4hit.
sampling = (*m_g4hit_sampling)[g4hit_i];
1033 one_g4hit.
hit_time = (*m_g4hit_time)[g4hit_i];
1039 one_g4hit.
hit_energy = (*m_g4hit_energy)[g4hit_i] * (*m_g4hit_samplingfraction)[g4hit_i];
1045 one_g4hit.
hit_energy = (*m_g4hit_energy)[g4hit_i] / (*m_g4hit_samplingfraction)[g4hit_i];
1047 g4hits.insert(std::pair<Long64_t, std::vector<FCS_g4hit> >(one_g4hit.
cell_identifier, std::vector<FCS_g4hit>(1, one_g4hit)));
1052 one_g4hit.
identifier = (*m_g4hit_identifier)[g4hit_i];
1054 one_g4hit.
sampling = (*m_g4hit_sampling)[g4hit_i];
1055 one_g4hit.
hit_time = (*m_g4hit_time)[g4hit_i];
1060 one_g4hit.
hit_energy = (*m_g4hit_energy)[g4hit_i] * (*m_g4hit_samplingfraction)[g4hit_i];
1066 one_g4hit.
hit_energy = (*m_g4hit_energy)[g4hit_i] / (*m_g4hit_samplingfraction)[g4hit_i];
1068 g4hits[(*m_g4hit_cellidentifier)[g4hit_i]].push_back(one_g4hit);
1084 one_hit.
identifier = (*m_hit_identifier)[hit_i];
1086 one_hit.
sampling = (*m_hit_sampling)[hit_i];
1092 one_hit.
hit_energy = (*m_hit_energy)[hit_i] * (*m_hit_samplingfraction)[hit_i];
1098 one_hit.
hit_energy = (*m_hit_energy)[hit_i] / (*m_hit_samplingfraction)[hit_i];
1101 one_hit.
hit_time = (*m_hit_time)[hit_i];
1102 one_hit.
hit_x = (*m_hit_x)[hit_i];
1103 one_hit.
hit_y = (*m_hit_y)[hit_i];
1104 one_hit.
hit_z = (*m_hit_z)[hit_i];
1105 hits.insert(std::pair<Long64_t, std::vector<FCS_hit> >(one_hit.
cell_identifier, std::vector<FCS_hit>(1, one_hit)));
1110 one_hit.
identifier = (*m_hit_identifier)[hit_i];
1112 one_hit.
sampling = (*m_hit_sampling)[hit_i];
1118 one_hit.
hit_energy = (*m_hit_energy)[hit_i] * (*m_hit_samplingfraction)[hit_i];
1124 one_hit.
hit_energy = (*m_hit_energy)[hit_i] / (*m_hit_samplingfraction)[hit_i];
1127 one_hit.
hit_time = (*m_hit_time)[hit_i];
1128 one_hit.
hit_x = (*m_hit_x)[hit_i];
1129 one_hit.
hit_y = (*m_hit_y)[hit_i];
1130 one_hit.
hit_z = (*m_hit_z)[hit_i];
1131 hits[(*m_hit_cellidentifier)[hit_i]].push_back(one_hit);
1136 for (std::map<Long64_t, FCS_cell>::iterator it = cells.begin(); it != cells.end(); )
1138 one_matchedcell.
clear();
1140 one_matchedcell.
cell = it->second;
1142 std::map<Long64_t, std::vector<FCS_hit> >
::iterator it2 = hits.find(it->first);
1143 if (it2 != hits.end())
1146 one_matchedcell.
hit = it2->second;
1152 one_matchedcell.
hit.clear();
1155 std::map<Long64_t, std::vector<FCS_g4hit> >
::iterator it3 = g4hits.find(it->first);
1156 if (it3 != g4hits.end())
1158 one_matchedcell.
g4hit = it3->second;
1164 one_matchedcell.
g4hit.clear();
1173 ATH_MSG_DEBUG(
"ISF_HitAnalysis Check after cells: " << cells.size() <<
" " << g4hits.size() <<
" " << hits.size());
1175 for (std::map<Long64_t, std::vector<FCS_hit> >
::iterator it = hits.begin(); it != hits.end();)
1177 one_matchedcell.
clear();
1180 if (!it->second.empty())
1182 one_matchedcell.
cell.
sampling = (it->second)[0].sampling;
1194 one_matchedcell.
hit = it->second;
1195 std::map<Long64_t, std::vector<FCS_g4hit> >
::iterator it3 = g4hits.find(it->first);
1196 if (it3 != g4hits.end())
1198 one_matchedcell.
g4hit = it3->second;
1204 one_matchedcell.
g4hit.clear();
1212 ATH_MSG_DEBUG(
"ISF_HitAnalysis Check after hits: " << cells.size() <<
" " << g4hits.size() <<
" " << hits.size());
1213 for (std::map<Long64_t, std::vector<FCS_g4hit> >
::iterator it = g4hits.begin(); it != g4hits.end();)
1215 one_matchedcell.
clear();
1217 if (!it->second.empty())
1219 one_matchedcell.
cell.
sampling = (it->second)[0].sampling;
1231 one_matchedcell.
g4hit = it->second;
1232 one_matchedcell.
hit.clear();
1255 for (
unsigned int cellindex = 0; cellindex <
m_layercells[i]->size(); cellindex++)
1269 for (
unsigned int j = 0; j <
m_layercells[i]->m_vector.at(cellindex).
hit.size(); j++)
1284 for (
unsigned int j = 0; j <
m_layercells[i]->m_vector.at(cellindex).g4hit.size(); j++)
1312 return StatusCode::SUCCESS;
1319 ATH_MSG_DEBUG (
"[ fastCaloSim transport ] processing particle "<<part.pdg_id() );
1321 std::vector<Trk::HitInfo>*
hitVector =
new std::vector<Trk::HitInfo>;
1323 int pdgId = part.pdg_id();
1334 auto vtx = part.production_vertex();
1339 pos =
Amg::Vector3D( vtx->position().x(),vtx->position().y(), vtx->position().z());
1342 Amg::Vector3D mom(part.momentum().x(),part.momentum().y(),part.momentum().z());
1343 ATH_MSG_DEBUG(
"[ fastCaloSim transport ] starting transport from position eta="<<pos.eta()<<
" phi="<<pos.phi()<<
" d="<<pos.mag()<<
" pT="<<mom.perp() );
1350 double freepath = -1.;
1353 double tDec = freepath > 0. ? freepath : -1.;
1387 ATH_MSG_DEBUG(
"[ fastCaloSim transport ] before calo entrance ");
1399 ATH_MSG_DEBUG(
"[ fastCaloSim transport ] after calo entrance ");
1401 std::unique_ptr<const Trk::TrackParameters> caloEntry =
nullptr;
1405 std::vector<Trk::HitInfo>* dummyHitVector =
nullptr;
1430 ATH_MSG_DEBUG(
"[ fastCaloSim transport ] after calo caloEntry ");
1434 std::unique_ptr<const Trk::TrackParameters> eParameters =
nullptr;
1439 ATH_MSG_DEBUG(
"[ fastCaloSim transport ] starting Calo transport from position eta="<<caloEntry->position().eta()<<
" phi="<<caloEntry->position().phi()<<
" d="<<caloEntry->position().mag() );
1451 eParameters =
m_extrapolator->extrapolateWithPathLimit(*caloEntry,
1466 std::vector<Trk::HitInfo>::iterator it =
hitVector->begin();
1467 while (it < hitVector->end() )
1469 int sample=(*it).detID;
1471 ATH_MSG_DEBUG(
" HIT: layer="<<sample<<
" sample="<<sample-3000<<
" eta="<<hitPos.eta()<<
" phi="<<hitPos.phi()<<
" d="<<hitPos.mag());
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_VERBOSE(x,...)
#define ATH_MSG_INFO(x,...)
double charge(const T &p)
std::vector< FPGATrackSimHit > hitVector
ATLAS-specific HepMC functions.
StatusCode ISF_HitAnalysis::initialize ATLAS_NOT_THREAD_SAFE()
Install fatal handler with default options.
AtlasHitsVector< TileHit >::const_iterator TileHitVecConstIterator
AtlasHitsVector< TileHit > TileHitVector
AtlasHitsVector< TrackRecord > TrackRecordCollection
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
ServiceHandle< StoreGateSvc > & evtStore()
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
Data object for each calorimeter readout cell.
Bookkeeping of cells that make up a cluster Simplified replacement for CaloCellLink,...
const CaloCellContainer * getCellContainer() const
Method to access underlying cell container.
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
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
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.
Class to store hit energy and time in LAr cell from G4 simulation.
Identifier cellID() const
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).
Eigen::Matrix< double, 3, 1 > Vector3D
::StatusCode StatusCode
StatusCode definition for legacy code.
static const int GEANTINO0
double charge(const T &p)
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.
std::vector< FCS_g4hit > g4hit
std::vector< FCS_hit > hit