Execute method.
482{
483
485
487 {
489 return StatusCode::FAILURE;
490 }
491
492 SG::ReadCondHandle<ILArfSampl> fSamplHdl(
m_fSamplKey,ctx);
493 const ILArfSampl* fSampl=*fSamplHdl;
494
496 ATH_CHECK( tileSamplingFraction.isValid() );
497
498
499
500 TVector3 vectest;
501 vectest.SetPtEtaPhi(1.,1.,1.);
537
538
539 std::map<Long64_t, FCS_cell>
cells;
540 std::map<Long64_t, std::vector<FCS_g4hit> > g4hits;
541 std::map<Long64_t, std::vector<FCS_hit> >
hits;
542
544 g4hits.clear();
546
547 FCS_cell one_cell{};
548 FCS_g4hit one_g4hit{};
549 FCS_hit one_hit{};
550 FCS_matchedcell one_matchedcell;
551
556
581
582
591
592
593
594 SG::ReadCondHandle<CaloDetDescrManager> caloMgrHandle{
m_caloMgrKey,ctx};
596 const CaloDetDescrManager* calo_dd_man = *caloMgrHandle;
597
598
599 const ISF_FCS_Parametrization::FCS_StepInfoCollection* eventStepsES;
601 if (
sc.isFailure()) {
603
604 } else {
607 m_hit_x->push_back( (*it)->x() );
608 m_hit_y->push_back( (*it)->y() );
609 m_hit_z->push_back( (*it)->z() );
612
613
614 bool larbarrel=false;
615 bool larendcap=false;
616 bool larhec=false;
617 bool larfcal=false;
619 int sampling=-1;
620 double sampfrac=0.0;
621
622 Identifier id = (*it)->identify();
623 Identifier cell_id = (*it)->identify();
624
628 } else {
630 }
631
636 int drawerIdx =
m_tileHWID->drawerIdx(channel_id);
637 sampfrac = tileSamplingFraction->getSamplingFraction(drawerIdx, channel);
638 }
640
641 if (
m_larEmID->is_em_barrel(
id)) larbarrel=
true;
642 else if(
m_larEmID->is_em_endcap(
id)) larendcap=
true;
644
645 larhec = true;
647
648 larfcal = true;
649 }
else if (
m_tileID->is_tile_aux(
id)) {
650
653 sampling = CaloCell_ID::TileGap3;
655
658 Int_t tile_sampling = -1;
661 }
662 if(tile_sampling!= -1) sampling = tile_sampling;
663 } else {
665 }
666
669
677
678 }
679 }
680
681
682
684 sc =
evtStore()->retrieve(mcEvent,
"TruthEvent");
687 } else {
688 if(mcEvent) {
689
690 if(!mcEvent->
empty()) {
691 int particleIndex=0;
693 int particles_size=(*mcEvent->
begin())->particles_size();
694 if(loopEnd==-1) {
695 loopEnd = particles_size;
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;
704
705
706
707 TFCSTruthState truth(
part->momentum().px(),
part->momentum().py(),
part->momentum().pz(),
part->momentum().e(),
part->pdg_id());
708
709
710 TVector3 moment;
711 moment.SetXYZ(
part->momentum().px(),
part->momentum().py(),
part->momentum().pz());
713
714
715
717
719 } else {
720
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 {
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 ) {
733 ATH_MSG_WARNING(
"but VERTEX from hepmc: x "<<truth.vertex().X()<<
" y "<<truth.vertex().Y()<<
" z "<<truth.vertex().Z());
734 }
735
736 TFCSExtrapolationState
result;
738
739
740
747
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
802 }
803
822
829
830 }
831 }
832 }
833 }
834
835
837 sc =
evtStore()->retrieve(MuonEntry,
"MuonEntryLayer");
839 {
841
842 }
843 else{
844 for ( const TrackRecord &record : *MuonEntry){
853 }
854 }
855
856
857
859 std::string clusterContainerName = "CaloCalTopoClusters";
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 }
867 for ( ; itrClus!=itrLastClus; ++itrClus){
873
874 const CaloClusterCellLink* cellLinks = cluster->
getCellLinks();
875 if (!cellLinks) {
877 continue;
878 }
879
881 if (!cellCont) {
883 continue;
884 }
885 unsigned cellcount = 0;
886 std::vector<Long64_t> cellIDs_in_cluster;
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();
895 }
898 }
899
900
901 const CaloCellContainer *cellColl = nullptr;
902 sc =
evtStore()->retrieve(cellColl,
"AllCalo");
903
905 {
907 }
908 else
909 {
913 for ( ; itrCell!=itrLastCell; ++itrCell)
914 {
917 if (
m_tileID->is_tile_aux((*itrCell)->ID())) {
918
920 }
921 else if (calo_dd_man->
get_element((*itrCell)->ID()))
922 {
923
926 }
927 else
929 }
930 }
931
932
933 std::string lArKey [4] = {"LArHitEMB", "LArHitEMEC", "LArHitFCAL", "LArHitHEC"};
934 for (
unsigned int i=0;
i<4;
i++)
935 {
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();
951
952 float larsampfrac=fSampl->
FSAMPL(larhitid);
959 }
960 }
961 ATH_MSG_INFO(
"Read "<<hitnumber<<
" G4Hits from "<<lArKey[i]);
962 }
963 else
964 {
966 }
967
968 }
969
972 {
973 int hitnumber = 0;
975 {
976 hitnumber++;
977 Identifier pmt_id = (*i_hit).identify();
978 Identifier cell_id =
m_tileID->cell_id(pmt_id);
979
982
985 int drawerIdx =
m_tileHWID->drawerIdx(channel_id);
986 float tilesampfrac = tileSamplingFraction->getSamplingFraction(drawerIdx, channel);
987
988
989 for (int tilesubhit_i = 0; tilesubhit_i<(*i_hit).size(); tilesubhit_i++)
990 {
997 }
998 }
999 }
1000 ATH_MSG_INFO(
"Read "<<hitnumber<<
" G4Hits from TileHitVec");
1001 }
1002
1003
1004
1006
1007
1011 one_cell.
sampling = (*m_cell_sampling)[cell_i];
1012 one_cell.
energy = (*m_cell_energy)[cell_i];
1017 }
1018 else
1019 {
1020
1022 }
1023 }
1024
1025
1028 {
1030 {
1032 continue;
1033 }
1034
1036 {
1037
1038 one_g4hit.
identifier = (*m_g4hit_identifier)[g4hit_i];
1040 one_g4hit.
sampling = (*m_g4hit_sampling)[g4hit_i];
1041 one_g4hit.
hit_time = (*m_g4hit_time)[g4hit_i];
1042
1044 {
1046 {
1047 one_g4hit.
hit_energy = (*m_g4hit_energy)[g4hit_i] * (*m_g4hit_samplingfraction)[g4hit_i];
1048 }
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
1060 one_g4hit.
identifier = (*m_g4hit_identifier)[g4hit_i];
1062 one_g4hit.
sampling = (*m_g4hit_sampling)[g4hit_i];
1063 one_g4hit.
hit_time = (*m_g4hit_time)[g4hit_i];
1065 {
1067 {
1068 one_g4hit.
hit_energy = (*m_g4hit_energy)[g4hit_i] * (*m_g4hit_samplingfraction)[g4hit_i];
1069 }
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
1083 {
1085 {
1087 continue;
1088 }
1090 {
1091
1092 one_hit.
identifier = (*m_hit_identifier)[hit_i];
1094 one_hit.
sampling = (*m_hit_sampling)[hit_i];
1095
1097 {
1099 {
1100 one_hit.
hit_energy = (*m_hit_energy)[hit_i] * (*m_hit_samplingfraction)[hit_i];
1101 }
1103 }
1104 else
1105 {
1106 one_hit.
hit_energy = (*m_hit_energy)[hit_i] / (*m_hit_samplingfraction)[hit_i];
1107 }
1108
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
1118 one_hit.
identifier = (*m_hit_identifier)[hit_i];
1120 one_hit.
sampling = (*m_hit_sampling)[hit_i];
1121
1123 {
1125 {
1126 one_hit.
hit_energy = (*m_hit_energy)[hit_i] * (*m_hit_samplingfraction)[hit_i];
1127 }
1129 }
1130 else
1131 {
1132 one_hit.
hit_energy = (*m_hit_energy)[hit_i] / (*m_hit_samplingfraction)[hit_i];
1133 }
1134
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
1144 for (std::map<Long64_t, FCS_cell>::iterator it =
cells.begin(); it !=
cells.end(); )
1145 {
1146 one_matchedcell.
clear();
1147
1148 one_matchedcell.
cell =
it->second;
1149
1150 std::map<Long64_t, std::vector<FCS_hit> >::iterator it2 =
hits.find(
it->first);
1151 if (it2 !=
hits.end())
1152 {
1153
1154 one_matchedcell.
hit = it2->second;
1156 }
1157 else
1158 {
1159
1160 one_matchedcell.
hit.clear();
1161 }
1162
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
1172 one_matchedcell.
g4hit.clear();
1173 }
1175
1177 }
1178
1179
1180
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();
1187
1188 if (!
it->second.empty())
1189 {
1191 }
1192 else
1193 {
1195
1197 }
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
1212 one_matchedcell.
g4hit.clear();
1213 }
1216
1217 }
1218
1219
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();
1225 if (!
it->second.empty())
1226 {
1228 }
1229 else
1230 {
1232
1234 }
1239 one_matchedcell.
g4hit =
it->second;
1240 one_matchedcell.
hit.clear();
1241 g4hits.erase(it++);
1243 }
1244
1245
1249
1251 {
1253 }
1254
1255
1258 {
1262
1263 for (
unsigned int cellindex = 0; cellindex <
m_layercells[
i]->size(); cellindex++)
1264 {
1266 {
1269 }
1270 else
1271 {
1272
1274 }
1275
1276
1277 for (
unsigned int j = 0;
j <
m_layercells[
i]->m_vector.at(cellindex).hit.size(); j++)
1278 {
1280 {
1283 }
1284 else
1285 {
1286
1288 }
1289 }
1290
1291
1292 for (
unsigned int j = 0;
j <
m_layercells[
i]->m_vector.at(cellindex).g4hit.size(); j++)
1293 {
1295 {
1298 }
1299 else
1300 {
1301
1303 }
1304 }
1305 }
1306 }
1307
1308
1312
1316
1317
1319
1320 return StatusCode::SUCCESS;
1321
1322}
#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