Execute method.
473{
474
476
478 {
480 return StatusCode::FAILURE;
481 }
482
483 SG::ReadCondHandle<ILArfSampl> fSamplHdl(
m_fSamplKey,ctx);
484 const ILArfSampl* fSampl=*fSamplHdl;
485
487 ATH_CHECK( tileSamplingFraction.isValid() );
488
489
490
491 TVector3 vectest;
492 vectest.SetPtEtaPhi(1.,1.,1.);
528
529
530 std::map<Long64_t, FCS_cell>
cells;
531 std::map<Long64_t, std::vector<FCS_g4hit> > g4hits;
532 std::map<Long64_t, std::vector<FCS_hit> >
hits;
533
535 g4hits.clear();
537
538 FCS_cell one_cell{};
539 FCS_g4hit one_g4hit{};
540 FCS_hit one_hit{};
541 FCS_matchedcell one_matchedcell;
542
547
572
573
582
583
584
585 SG::ReadCondHandle<CaloDetDescrManager> caloMgrHandle{
m_caloMgrKey,ctx};
587 const CaloDetDescrManager* calo_dd_man = *caloMgrHandle;
588
589
590 const ISF_FCS_Parametrization::FCS_StepInfoCollection* eventStepsES;
592 if (
sc.isFailure()) {
594
595 } else {
598 m_hit_x->push_back( (*it)->x() );
599 m_hit_y->push_back( (*it)->y() );
600 m_hit_z->push_back( (*it)->z() );
603
604
605 bool larbarrel=false;
606 bool larendcap=false;
607 bool larhec=false;
608 bool larfcal=false;
610 int sampling=-1;
611 double sampfrac=0.0;
612
613 Identifier id = (*it)->identify();
614 Identifier cell_id = (*it)->identify();
615
619 } else {
621 }
622
627 int drawerIdx =
m_tileHWID->drawerIdx(channel_id);
628 sampfrac = tileSamplingFraction->getSamplingFraction(drawerIdx, channel);
629 }
631
632 if (
m_larEmID->is_em_barrel(
id)) larbarrel=
true;
633 else if(
m_larEmID->is_em_endcap(
id)) larendcap=
true;
635
636 larhec = true;
638
639 larfcal = true;
640 }
else if (
m_tileID->is_tile_aux(
id)) {
641
644 sampling = CaloCell_ID::TileGap3;
646
649 Int_t tile_sampling = -1;
652 }
653 if(tile_sampling!= -1) sampling = tile_sampling;
654 } else {
656 }
657
660
668
669 }
670 }
671
672
673
675 sc =
evtStore()->retrieve(mcEvent,
"TruthEvent");
678 } else {
679 if(mcEvent) {
680
681 if(!mcEvent->
empty()) {
682 int particleIndex=0;
684 int particles_size=(*mcEvent->
begin())->particles_size();
685 if(loopEnd==-1) {
686 loopEnd = particles_size;
687 }
688 for (
const auto& part: *(*mcEvent->
begin()))
689 {
690
691 ATH_MSG_DEBUG(
"Number truth particles="<<particles_size<<
" loopEnd="<<loopEnd);
692 particleIndex++;
693
694 if (particleIndex>loopEnd) break;
695
696
697
698 TFCSTruthState truth(
part->momentum().px(),
part->momentum().py(),
part->momentum().pz(),
part->momentum().e(),
part->pdg_id());
699
700
701 TVector3 moment;
702 moment.SetXYZ(
part->momentum().px(),
part->momentum().py(),
part->momentum().pz());
704
705
706
708
710 } else {
711
713 }
714
715 if((part)->production_vertex()) {
716 truth.set_vertex((part)->production_vertex()->
position().
x(), (part)->production_vertex()->
position().
y(), (part)->production_vertex()->
position().
z());
717 } else {
720 }
721
722 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(
"but VERTEX from hepmc: x "<<truth.vertex().X()<<
" y "<<truth.vertex().Y()<<
" z "<<truth.vertex().Z());
725 }
726
727 TFCSExtrapolationState
result;
729
730
731
738
745
746 std::vector<float> eta_vec_ENT;
747 std::vector<float> phi_vec_ENT;
748 std::vector<float> r_vec_ENT;
749 std::vector<float> z_vec_ENT;
750 std::vector<float> detaBorder_vec_ENT;
751 std::vector<bool> OK_vec_ENT;
752
753 std::vector<float> eta_vec_EXT;
754 std::vector<float> phi_vec_EXT;
755 std::vector<float> r_vec_EXT;
756 std::vector<float> z_vec_EXT;
757 std::vector<float> detaBorder_vec_EXT;
758 std::vector<bool> OK_vec_EXT;
759
760 std::vector<float> eta_vec_MID;
761 std::vector<float> phi_vec_MID;
762 std::vector<float> r_vec_MID;
763 std::vector<float> z_vec_MID;
764 std::vector<float> detaBorder_vec_MID;
765 std::vector<bool> OK_vec_MID;
766
793 }
794
813
820
821 }
822 }
823 }
824 }
825
826
828 sc =
evtStore()->retrieve(MuonEntry,
"MuonEntryLayer");
830 {
832
833 }
834 else{
835 for ( const TrackRecord &record : *MuonEntry){
844 }
845 }
846
847
848
850 std::string clusterContainerName = "CaloCalTopoClusters";
851 sc =
evtStore()->retrieve(theClusters, clusterContainerName);
852 if (
sc.isFailure()) {
853 ATH_MSG_WARNING(
" Couldn't get cluster container '" << clusterContainerName <<
"'");
854 return StatusCode::SUCCESS;
855 }
858 for ( ; itrClus!=itrLastClus; ++itrClus){
864
865 const CaloClusterCellLink* cellLinks = cluster->
getCellLinks();
866 if (!cellLinks) {
868 continue;
869 }
870
872 if (!cellCont) {
874 continue;
875 }
876 unsigned cellcount = 0;
877 std::vector<Long64_t> cellIDs_in_cluster;
880 for ( ;cellIter !=cellIterEnd;cellIter++) {
881 ++cellcount;
882 const CaloCell*
cell= (*cellIter);
883 cellIDs_in_cluster.push_back(
cell->ID().get_compact());
884 float EnergyCell=
cell->energy();
886 }
889 }
890
891
892 const CaloCellContainer *cellColl = nullptr;
893 sc =
evtStore()->retrieve(cellColl,
"AllCalo");
894
896 {
898 }
899 else
900 {
904 for ( ; itrCell!=itrLastCell; ++itrCell)
905 {
908 if (
m_tileID->is_tile_aux((*itrCell)->ID())) {
909
911 }
912 else if (calo_dd_man->
get_element((*itrCell)->ID()))
913 {
914
917 }
918 else
920 }
921 }
922
923
924 std::string lArKey [4] = {"LArHitEMB", "LArHitEMEC", "LArHitFCAL", "LArHitHEC"};
925 for (
unsigned int i=0;
i<4;
i++)
926 {
929 if(
evtStore()->retrieve(iter,lArKey[i])==StatusCode::SUCCESS)
930 {
932 int hitnumber = 0;
933 for (hi=(*iter).begin();hi!=(*iter).end();++hi) {
934 hitnumber++;
935 const LArHit* larHit = *hi;
936 const CaloDetDescrElement *hitElement = calo_dd_man->
get_element(larHit->
cellID());
937 if(!hitElement)
938 continue;
939 Identifier larhitid = hitElement->
identify();
942
943 float larsampfrac=fSampl->
FSAMPL(larhitid);
950 }
951 }
952 ATH_MSG_INFO(
"Read "<<hitnumber<<
" G4Hits from "<<lArKey[i]);
953 }
954 else
955 {
957 }
958
959 }
960
963 {
964 int hitnumber = 0;
966 {
967 hitnumber++;
968 Identifier pmt_id = (*i_hit).identify();
969 Identifier cell_id =
m_tileID->cell_id(pmt_id);
970
973
976 int drawerIdx =
m_tileHWID->drawerIdx(channel_id);
977 float tilesampfrac = tileSamplingFraction->getSamplingFraction(drawerIdx, channel);
978
979
980 for (int tilesubhit_i = 0; tilesubhit_i<(*i_hit).size(); tilesubhit_i++)
981 {
988 }
989 }
990 }
991 ATH_MSG_INFO(
"Read "<<hitnumber<<
" G4Hits from TileHitVec");
992 }
993
994
995
997
998
1002 one_cell.
sampling = (*m_cell_sampling)[cell_i];
1003 one_cell.
energy = (*m_cell_energy)[cell_i];
1008 }
1009 else
1010 {
1011
1013 }
1014 }
1015
1016
1019 {
1021 {
1023 continue;
1024 }
1025
1027 {
1028
1029 one_g4hit.
identifier = (*m_g4hit_identifier)[g4hit_i];
1031 one_g4hit.
sampling = (*m_g4hit_sampling)[g4hit_i];
1032 one_g4hit.
hit_time = (*m_g4hit_time)[g4hit_i];
1033
1035 {
1037 {
1038 one_g4hit.
hit_energy = (*m_g4hit_energy)[g4hit_i] * (*m_g4hit_samplingfraction)[g4hit_i];
1039 }
1041 }
1042 else
1043 {
1044 one_g4hit.
hit_energy = (*m_g4hit_energy)[g4hit_i] / (*m_g4hit_samplingfraction)[g4hit_i];
1045 }
1046 g4hits.insert(std::pair<Long64_t, std::vector<FCS_g4hit> >(one_g4hit.
cell_identifier, std::vector<FCS_g4hit>(1, one_g4hit)));
1047 }
1048 else
1049 {
1050
1051 one_g4hit.
identifier = (*m_g4hit_identifier)[g4hit_i];
1053 one_g4hit.
sampling = (*m_g4hit_sampling)[g4hit_i];
1054 one_g4hit.
hit_time = (*m_g4hit_time)[g4hit_i];
1056 {
1058 {
1059 one_g4hit.
hit_energy = (*m_g4hit_energy)[g4hit_i] * (*m_g4hit_samplingfraction)[g4hit_i];
1060 }
1062 }
1063 else
1064 {
1065 one_g4hit.
hit_energy = (*m_g4hit_energy)[g4hit_i] / (*m_g4hit_samplingfraction)[g4hit_i];
1066 }
1067 g4hits[(*m_g4hit_cellidentifier)[g4hit_i]].push_back(one_g4hit);
1068 }
1069 }
1070 }
1071
1072
1074 {
1076 {
1078 continue;
1079 }
1081 {
1082
1083 one_hit.
identifier = (*m_hit_identifier)[hit_i];
1085 one_hit.
sampling = (*m_hit_sampling)[hit_i];
1086
1088 {
1090 {
1091 one_hit.
hit_energy = (*m_hit_energy)[hit_i] * (*m_hit_samplingfraction)[hit_i];
1092 }
1094 }
1095 else
1096 {
1097 one_hit.
hit_energy = (*m_hit_energy)[hit_i] / (*m_hit_samplingfraction)[hit_i];
1098 }
1099
1100 one_hit.
hit_time = (*m_hit_time)[hit_i];
1101 one_hit.
hit_x = (*m_hit_x)[hit_i];
1102 one_hit.
hit_y = (*m_hit_y)[hit_i];
1103 one_hit.
hit_z = (*m_hit_z)[hit_i];
1104 hits.insert(std::pair<Long64_t, std::vector<FCS_hit> >(one_hit.
cell_identifier, std::vector<FCS_hit>(1, one_hit)));
1105 }
1106 else
1107 {
1108
1109 one_hit.
identifier = (*m_hit_identifier)[hit_i];
1111 one_hit.
sampling = (*m_hit_sampling)[hit_i];
1112
1114 {
1116 {
1117 one_hit.
hit_energy = (*m_hit_energy)[hit_i] * (*m_hit_samplingfraction)[hit_i];
1118 }
1120 }
1121 else
1122 {
1123 one_hit.
hit_energy = (*m_hit_energy)[hit_i] / (*m_hit_samplingfraction)[hit_i];
1124 }
1125
1126 one_hit.
hit_time = (*m_hit_time)[hit_i];
1127 one_hit.
hit_x = (*m_hit_x)[hit_i];
1128 one_hit.
hit_y = (*m_hit_y)[hit_i];
1129 one_hit.
hit_z = (*m_hit_z)[hit_i];
1130 hits[(*m_hit_cellidentifier)[hit_i]].push_back(one_hit);
1131 }
1132 }
1133
1134
1135 for (std::map<Long64_t, FCS_cell>::iterator it =
cells.begin(); it !=
cells.end(); )
1136 {
1137 one_matchedcell.
clear();
1138
1139 one_matchedcell.
cell =
it->second;
1140
1141 std::map<Long64_t, std::vector<FCS_hit> >::iterator it2 =
hits.find(
it->first);
1142 if (it2 !=
hits.end())
1143 {
1144
1145 one_matchedcell.
hit = it2->second;
1147 }
1148 else
1149 {
1150
1151 one_matchedcell.
hit.clear();
1152 }
1153
1154 std::map<Long64_t, std::vector<FCS_g4hit> >::iterator it3 = g4hits.find(
it->first);
1155 if (it3 != g4hits.end())
1156 {
1157 one_matchedcell.
g4hit = it3->second;
1158 g4hits.erase(it3);
1159 }
1160 else
1161 {
1162
1163 one_matchedcell.
g4hit.clear();
1164 }
1166
1168 }
1169
1170
1171
1172 ATH_MSG_DEBUG(
"ISF_HitAnalysis Check after cells: " <<
cells.size() <<
" " << g4hits.size() <<
" " <<
hits.size());
1173
1174 for (std::map<Long64_t, std::vector<FCS_hit> >::iterator it =
hits.begin(); it !=
hits.end();)
1175 {
1176 one_matchedcell.
clear();
1178
1179 if (!
it->second.empty())
1180 {
1182 }
1183 else
1184 {
1186
1188 }
1193 one_matchedcell.
hit =
it->second;
1194 std::map<Long64_t, std::vector<FCS_g4hit> >::iterator it3 = g4hits.find(
it->first);
1195 if (it3 != g4hits.end())
1196 {
1197 one_matchedcell.
g4hit = it3->second;
1198 g4hits.erase(it3);
1199 }
1200 else
1201 {
1202
1203 one_matchedcell.
g4hit.clear();
1204 }
1207
1208 }
1209
1210
1211 ATH_MSG_DEBUG(
"ISF_HitAnalysis Check after hits: " <<
cells.size() <<
" " << g4hits.size() <<
" " <<
hits.size());
1212 for (std::map<Long64_t, std::vector<FCS_g4hit> >::iterator it = g4hits.begin(); it != g4hits.end();)
1213 {
1214 one_matchedcell.
clear();
1216 if (!
it->second.empty())
1217 {
1219 }
1220 else
1221 {
1223
1225 }
1230 one_matchedcell.
g4hit =
it->second;
1231 one_matchedcell.
hit.clear();
1232 g4hits.erase(it++);
1234 }
1235
1236
1240
1242 {
1244 }
1245
1246
1249 {
1253
1254 for (
unsigned int cellindex = 0; cellindex <
m_layercells[
i]->size(); cellindex++)
1255 {
1257 {
1260 }
1261 else
1262 {
1263
1265 }
1266
1267
1268 for (
unsigned int j = 0;
j <
m_layercells[
i]->m_vector.at(cellindex).hit.size(); j++)
1269 {
1271 {
1274 }
1275 else
1276 {
1277
1279 }
1280 }
1281
1282
1283 for (
unsigned int j = 0;
j <
m_layercells[
i]->m_vector.at(cellindex).g4hit.size(); j++)
1284 {
1286 {
1289 }
1290 else
1291 {
1292
1294 }
1295 }
1296 }
1297 }
1298
1299
1303
1307
1308
1310
1311 return StatusCode::SUCCESS;
1312
1313}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
AtlasHitsVector< TileHit >::const_iterator TileHitVecConstIterator
AtlasHitsVector< TileHit > TileHitVector
AtlasHitsVector< TrackRecord > TrackRecordCollection
ServiceHandle< StoreGateSvc > & evtStore()
boost::transform_iterator< make_const, typename CONT::const_iterator > const_iterator
const_iterator begin() const
const_iterator end() const
CaloSampling::CaloSample CaloSample
const CaloCellContainer * getCellContainer() const
Method to access underlying cell container.
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
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
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
std::vector< int > * m_g4hit_sampling
std::vector< float > * m_newTTC_IDCaloBoundary_eta
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
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
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
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
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< 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.
Identifier cellID() const
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).
::StatusCode StatusCode
StatusCode definition for legacy code.
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)
const Amg::Vector3D & direction() const
Method to retrieve the direction at the Intersection.
const Amg::Vector3D & position() const
Method to retrieve the position of the Intersection.
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