Execute method.
474{
475
477
479 {
481 return StatusCode::FAILURE;
482 }
483
484 SG::ReadCondHandle<ILArfSampl> fSamplHdl(
m_fSamplKey,ctx);
485 const ILArfSampl* fSampl=*fSamplHdl;
486
488 ATH_CHECK( tileSamplingFraction.isValid() );
489
490
491
492 TVector3 vectest;
493 vectest.SetPtEtaPhi(1.,1.,1.);
529
530
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;
534
536 g4hits.clear();
538
539 FCS_cell one_cell{};
540 FCS_g4hit one_g4hit{};
541 FCS_hit one_hit{};
542 FCS_matchedcell one_matchedcell;
543
548
573
574
583
584
585
586 SG::ReadCondHandle<CaloDetDescrManager> caloMgrHandle{
m_caloMgrKey,ctx};
588 const CaloDetDescrManager* calo_dd_man = *caloMgrHandle;
589
590
591 const ISF_FCS_Parametrization::FCS_StepInfoCollection* eventStepsES;
593 if (
sc.isFailure()) {
595
596 } else {
599 m_hit_x->push_back( (*it)->x() );
600 m_hit_y->push_back( (*it)->y() );
601 m_hit_z->push_back( (*it)->z() );
604
605
606 bool larbarrel=false;
607 bool larendcap=false;
608 bool larhec=false;
609 bool larfcal=false;
611 int sampling=-1;
612 double sampfrac=0.0;
613
614 Identifier id = (*it)->identify();
615 Identifier cell_id = (*it)->identify();
616
620 } else {
622 }
623
628 int drawerIdx =
m_tileHWID->drawerIdx(channel_id);
629 sampfrac = tileSamplingFraction->getSamplingFraction(drawerIdx, channel);
630 }
632
633 if (
m_larEmID->is_em_barrel(
id)) larbarrel=
true;
634 else if(
m_larEmID->is_em_endcap(
id)) larendcap=
true;
636
637 larhec = true;
639
640 larfcal = true;
641 }
else if (
m_tileID->is_tile_aux(
id)) {
642
645 sampling = CaloCell_ID::TileGap3;
647
650 Int_t tile_sampling = -1;
653 }
654 if(tile_sampling!= -1) sampling = tile_sampling;
655 } else {
657 }
658
661
669
670 }
671 }
672
673
674
676 sc =
evtStore()->retrieve(mcEvent,
"TruthEvent");
679 } else {
680 if(mcEvent) {
681
682 if(!mcEvent->
empty()) {
683 int particleIndex=0;
685 int particles_size=(*mcEvent->
begin())->particles_size();
686 if(loopEnd==-1) {
687 loopEnd = particles_size;
688 }
689 for (
const auto& part: *(*mcEvent->
begin()))
690 {
691
692 ATH_MSG_DEBUG(
"Number truth particles="<<particles_size<<
" loopEnd="<<loopEnd);
693 particleIndex++;
694
695 if (particleIndex>loopEnd) break;
696
697
698
699 TFCSTruthState truth(
part->momentum().px(),
part->momentum().py(),
part->momentum().pz(),
part->momentum().e(),
part->pdg_id());
700
701
702 TVector3 moment;
703 moment.SetXYZ(
part->momentum().px(),
part->momentum().py(),
part->momentum().pz());
705
706
707
709
711 } else {
712
714 }
715
716 if((part)->production_vertex()) {
717 truth.set_vertex((part)->production_vertex()->
position().
x(), (part)->production_vertex()->
position().
y(), (part)->production_vertex()->
position().
z());
718 } else {
721 }
722
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 ) {
725 ATH_MSG_WARNING(
"but VERTEX from hepmc: x "<<truth.vertex().X()<<
" y "<<truth.vertex().Y()<<
" z "<<truth.vertex().Z());
726 }
727
728 TFCSExtrapolationState
result;
730
731
732
739
746
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;
753
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;
760
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;
767
794 }
795
814
821
822 }
823 }
824 }
825 }
826
827
829 sc =
evtStore()->retrieve(MuonEntry,
"MuonEntryLayer");
831 {
833
834 }
835 else{
836 for ( const TrackRecord &record : *MuonEntry){
845 }
846 }
847
848
849
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;
856 }
859 for ( ; itrClus!=itrLastClus; ++itrClus){
865
866 const CaloClusterCellLink* cellLinks = cluster->
getCellLinks();
867 if (!cellLinks) {
869 continue;
870 }
871
873 if (!cellCont) {
875 continue;
876 }
877 unsigned cellcount = 0;
878 std::vector<Long64_t> cellIDs_in_cluster;
881 for ( ;cellIter !=cellIterEnd;cellIter++) {
882 ++cellcount;
883 const CaloCell*
cell= (*cellIter);
884 cellIDs_in_cluster.push_back(
cell->ID().get_compact());
885 float EnergyCell=
cell->energy();
887 }
890 }
891
892
893 const CaloCellContainer *cellColl = nullptr;
894 sc =
evtStore()->retrieve(cellColl,
"AllCalo");
895
897 {
899 }
900 else
901 {
905 for ( ; itrCell!=itrLastCell; ++itrCell)
906 {
909 if (
m_tileID->is_tile_aux((*itrCell)->ID())) {
910
912 }
913 else if (calo_dd_man->
get_element((*itrCell)->ID()))
914 {
915
918 }
919 else
921 }
922 }
923
924
925 std::string lArKey [4] = {"LArHitEMB", "LArHitEMEC", "LArHitFCAL", "LArHitHEC"};
926 for (
unsigned int i=0;
i<4;
i++)
927 {
930 if(
evtStore()->retrieve(iter,lArKey[i])==StatusCode::SUCCESS)
931 {
933 int hitnumber = 0;
934 for (hi=(*iter).begin();hi!=(*iter).end();++hi) {
935 hitnumber++;
936 const LArHit* larHit = *hi;
937 const CaloDetDescrElement *hitElement = calo_dd_man->
get_element(larHit->
cellID());
938 if(!hitElement)
939 continue;
940 Identifier larhitid = hitElement->
identify();
943
944 float larsampfrac=fSampl->
FSAMPL(larhitid);
951 }
952 }
953 ATH_MSG_INFO(
"Read "<<hitnumber<<
" G4Hits from "<<lArKey[i]);
954 }
955 else
956 {
958 }
959
960 }
961
964 {
965 int hitnumber = 0;
967 {
968 hitnumber++;
969 Identifier pmt_id = (*i_hit).identify();
970 Identifier cell_id =
m_tileID->cell_id(pmt_id);
971
974
977 int drawerIdx =
m_tileHWID->drawerIdx(channel_id);
978 float tilesampfrac = tileSamplingFraction->getSamplingFraction(drawerIdx, channel);
979
980
981 for (int tilesubhit_i = 0; tilesubhit_i<(*i_hit).size(); tilesubhit_i++)
982 {
989 }
990 }
991 }
992 ATH_MSG_INFO(
"Read "<<hitnumber<<
" G4Hits from TileHitVec");
993 }
994
995
996
998
999
1003 one_cell.
sampling = (*m_cell_sampling)[cell_i];
1004 one_cell.
energy = (*m_cell_energy)[cell_i];
1009 }
1010 else
1011 {
1012
1014 }
1015 }
1016
1017
1020 {
1022 {
1024 continue;
1025 }
1026
1028 {
1029
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];
1034
1036 {
1038 {
1039 one_g4hit.
hit_energy = (*m_g4hit_energy)[g4hit_i] * (*m_g4hit_samplingfraction)[g4hit_i];
1040 }
1042 }
1043 else
1044 {
1045 one_g4hit.
hit_energy = (*m_g4hit_energy)[g4hit_i] / (*m_g4hit_samplingfraction)[g4hit_i];
1046 }
1047 g4hits.insert(std::pair<Long64_t, std::vector<FCS_g4hit> >(one_g4hit.
cell_identifier, std::vector<FCS_g4hit>(1, one_g4hit)));
1048 }
1049 else
1050 {
1051
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];
1057 {
1059 {
1060 one_g4hit.
hit_energy = (*m_g4hit_energy)[g4hit_i] * (*m_g4hit_samplingfraction)[g4hit_i];
1061 }
1063 }
1064 else
1065 {
1066 one_g4hit.
hit_energy = (*m_g4hit_energy)[g4hit_i] / (*m_g4hit_samplingfraction)[g4hit_i];
1067 }
1068 g4hits[(*m_g4hit_cellidentifier)[g4hit_i]].push_back(one_g4hit);
1069 }
1070 }
1071 }
1072
1073
1075 {
1077 {
1079 continue;
1080 }
1082 {
1083
1084 one_hit.
identifier = (*m_hit_identifier)[hit_i];
1086 one_hit.
sampling = (*m_hit_sampling)[hit_i];
1087
1089 {
1091 {
1092 one_hit.
hit_energy = (*m_hit_energy)[hit_i] * (*m_hit_samplingfraction)[hit_i];
1093 }
1095 }
1096 else
1097 {
1098 one_hit.
hit_energy = (*m_hit_energy)[hit_i] / (*m_hit_samplingfraction)[hit_i];
1099 }
1100
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)));
1106 }
1107 else
1108 {
1109
1110 one_hit.
identifier = (*m_hit_identifier)[hit_i];
1112 one_hit.
sampling = (*m_hit_sampling)[hit_i];
1113
1115 {
1117 {
1118 one_hit.
hit_energy = (*m_hit_energy)[hit_i] * (*m_hit_samplingfraction)[hit_i];
1119 }
1121 }
1122 else
1123 {
1124 one_hit.
hit_energy = (*m_hit_energy)[hit_i] / (*m_hit_samplingfraction)[hit_i];
1125 }
1126
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);
1132 }
1133 }
1134
1135
1136 for (std::map<Long64_t, FCS_cell>::iterator it =
cells.begin(); it !=
cells.end(); )
1137 {
1138 one_matchedcell.
clear();
1139
1140 one_matchedcell.
cell =
it->second;
1141
1142 std::map<Long64_t, std::vector<FCS_hit> >::iterator it2 =
hits.find(
it->first);
1143 if (it2 !=
hits.end())
1144 {
1145
1146 one_matchedcell.
hit = it2->second;
1148 }
1149 else
1150 {
1151
1152 one_matchedcell.
hit.clear();
1153 }
1154
1155 std::map<Long64_t, std::vector<FCS_g4hit> >::iterator it3 = g4hits.find(
it->first);
1156 if (it3 != g4hits.end())
1157 {
1158 one_matchedcell.
g4hit = it3->second;
1159 g4hits.erase(it3);
1160 }
1161 else
1162 {
1163
1164 one_matchedcell.
g4hit.clear();
1165 }
1167
1169 }
1170
1171
1172
1173 ATH_MSG_DEBUG(
"ISF_HitAnalysis Check after cells: " <<
cells.size() <<
" " << g4hits.size() <<
" " <<
hits.size());
1174
1175 for (std::map<Long64_t, std::vector<FCS_hit> >::iterator it =
hits.begin(); it !=
hits.end();)
1176 {
1177 one_matchedcell.
clear();
1179
1180 if (!
it->second.empty())
1181 {
1183 }
1184 else
1185 {
1187
1189 }
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())
1197 {
1198 one_matchedcell.
g4hit = it3->second;
1199 g4hits.erase(it3);
1200 }
1201 else
1202 {
1203
1204 one_matchedcell.
g4hit.clear();
1205 }
1208
1209 }
1210
1211
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();)
1214 {
1215 one_matchedcell.
clear();
1217 if (!
it->second.empty())
1218 {
1220 }
1221 else
1222 {
1224
1226 }
1231 one_matchedcell.
g4hit =
it->second;
1232 one_matchedcell.
hit.clear();
1233 g4hits.erase(it++);
1235 }
1236
1237
1241
1243 {
1245 }
1246
1247
1250 {
1254
1255 for (
unsigned int cellindex = 0; cellindex <
m_layercells[
i]->size(); cellindex++)
1256 {
1258 {
1261 }
1262 else
1263 {
1264
1266 }
1267
1268
1269 for (
unsigned int j = 0;
j <
m_layercells[
i]->m_vector.at(cellindex).
hit.size(); j++)
1270 {
1272 {
1275 }
1276 else
1277 {
1278
1280 }
1281 }
1282
1283
1284 for (
unsigned int j = 0;
j <
m_layercells[
i]->m_vector.at(cellindex).g4hit.size(); j++)
1285 {
1287 {
1290 }
1291 else
1292 {
1293
1295 }
1296 }
1297 }
1298 }
1299
1300
1304
1308
1309
1311
1312 return StatusCode::SUCCESS;
1313
1314}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_VERBOSE(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