16 #include "Identifier/Identifier.h"
26 #include "CLHEP/Units/SystemOfUnits.h"
31 #define MYDEBUG() std::cout<<__FILE__<<" "<<__func__<<" "<<__LINE__<<std::endl
42 m_calorimeterVolume(nullptr),
43 m_indetVolume(nullptr),
46 m_useCaloEnergyMeasurement(true),
47 m_useMuonCaloEnergyTool(true),
48 m_overwriteElossParam(false)
50 declareInterface<ITrkMaterialProviderTool>(
this);
73 if(m_useCaloEnergyMeasurement) {
74 ATH_CHECK(m_trackIsolationTool.retrieve());
75 if(m_useMuonCaloEnergyTool) {
76 ATH_CHECK(m_muonCaloEnergyTool.retrieve());
77 m_caloMeasTool.disable();
78 m_caloParamTool.disable();
82 m_muonCaloEnergyTool.disable();
86 m_caloMeasTool.disable();
87 m_caloParamTool.disable();
88 m_muonCaloEnergyTool.disable();
89 m_trackIsolationTool.disable();
93 ATH_CHECK( m_fieldCacheCondObjInputKey.initialize() );
98 return StatusCode::FAILURE;
101 ATH_CHECK(m_trackingVolumesSvc.retrieve());
104 if(!m_calorimeterVolume) {
105 ATH_MSG_ERROR(
"Unable to retrieve MuonSpectrometerEntryLayer volume");
106 return StatusCode::FAILURE;
111 ATH_MSG_ERROR(
"Unable to retrieve CalorimeterEntryLayer volume");
112 return StatusCode::FAILURE;
115 if (m_trackingGeometryReadKey.key().empty()) {
116 ATH_CHECK(m_trackingGeometrySvc.retrieve());
118 ATH_CHECK( m_trackingGeometryReadKey.initialize() );
120 return StatusCode::SUCCESS;
128 return StatusCode::SUCCESS;
135 ATH_MSG_VERBOSE(
"updateCaloTSOS(Trk::Track& track, const Trk::TrackParameters* startParameters)");
141 auto inputTSOS = std::make_unique<Trk::TrackStates>();
143 inputTSOS->push_back (tsos->clone());
155 for(;
it!=itEnd; ++
it) {
158 printTSOS(*
it,
"TSOS ON TRACK");
161 if(this->getVolumeByGeo(*
it)==1 && (*it)->trackParameters())
163 if(firstCALO==inputTSOS->end() && this->getVolumeByGeo(*
it)==2 && firstMS==itEnd)
165 else if(this->getVolumeByGeo(*
it)==3 && firstCALO!=inputTSOS->end()) {
168 if((*it)->trackParameters() && (*it)->trackParameters()->covariance()) {
176 if(lastIDwP != inputTSOS->end()) {
178 printTSOS(*lastIDwP,
"LAST IDwP");
180 startParameters = (*lastIDwP)->trackParameters();
183 if(lastIDwP == inputTSOS->end() && !startParameters) {
184 ATH_MSG_WARNING(
"Unable to find starting parameters for extrapolation");
188 if(firstCALO == inputTSOS->end()) {
192 if(firstMS == inputTSOS->end()) {
202 firstMSnotPerigee=firstMS+1;
207 printTSOS(*firstCALO,
"FIRST CALO");
208 printTSOS(*firstMSnotPerigee,
"FIRST MS");
211 double X0ScaleMS = 0.;
212 double ElossScaleMS = 0.;
216 (*firstMSnotPerigee)->surface(),
219 Eloss, X0ScaleMS, ElossScaleMS,
220 (firstMSwP == inputTSOS->end()) ?
nullptr : (*firstMSwP)->trackParameters(),
224 if(!caloTSOS || caloTSOS->
size()!=3) {
225 ATH_MSG_WARNING(
"Unable to retrieve Calorimeter TSOS from extrapolateM (null or <3)");
226 if(caloTSOS) deleteTSOS(caloTSOS);
232 for(
auto m : *inputTSOS) this->printTSOS(
m,
"OLD TSOS");
236 this->updateVectorMS(inputTSOS.get(),firstMS,X0ScaleMS,ElossScaleMS);
239 track.setTrackStateOnSurfaces (std::move (inputTSOS));
247 ATH_MSG_VERBOSE(
"updateCaloTSOS(Trk::Track& idTrack, Trk::Track& extrapolatedTrack)");
252 auto inputTSOS_MS = std::make_unique<Trk::TrackStates>();
254 inputTSOS_MS->push_back (tsos->clone());
263 if(this->getVolumeByGeo(*itID)==1 && (*itID)->trackParameters()) {
267 if(itID==itFront)
break;
277 for(;
it!=itEnd; ++
it) {
280 printTSOS(*
it,
"TSOS ON TRACK");
283 if(firstCALO==inputTSOS_MS->end() && this->getVolumeByGeo(*
it)==2)
285 if(this->getVolumeByGeo(*
it)==3) {
288 if((*it)->trackParameters() && (*it)->trackParameters()->covariance()) {
295 if(firstCALO == inputTSOS_MS->end()) {
299 if(lastIDwP == inputTSOS_ID->
end()) {
304 if(firstMS == inputTSOS_MS->end()) {
314 firstMSnotPerigee=firstMS+1;
319 printTSOS(*lastIDwP,
"LAST IDwP");
320 printTSOS(*firstCALO,
"FIRST CALO");
321 printTSOS(*firstMSnotPerigee,
"FIRST MS");
322 if(firstMSwP != inputTSOS_MS->end())
323 printTSOS(*firstMSwP,
"FIRST MSwP");
328 double X0ScaleMS = 0.;
329 double ElossScaleMS = 0.;
331 Trk::TrackStates* caloTSOS = this->getCaloTSOS (*(*lastIDwP)->trackParameters(),
333 (*firstMSnotPerigee)->surface(),
336 Eloss, X0ScaleMS, ElossScaleMS,
337 (firstMSwP == inputTSOS_MS->end()) ?
nullptr : (*firstMSwP)->trackParameters(),
342 if(!caloTSOS || caloTSOS->
size()!=3) {
343 ATH_MSG_WARNING(
"Unable to retrieve Calorimeter TSOS from extrapolateM (null or <3)");
344 if(caloTSOS) deleteTSOS(caloTSOS);
350 for(
auto m : *inputTSOS_ID) printTSOS(
m,
"ID TSOS");
351 ATH_MSG_VERBOSE(
"OLD-MS TSOS multiplicity : " << inputTSOS_MS->size());
352 for(
auto m : *inputTSOS_MS) printTSOS(
m,
"OLD-MS TSOS");
356 this->updateVectorMS(inputTSOS_MS.get(),firstMS,X0ScaleMS,ElossScaleMS);
368 std::vector<MaterialEffectsOnTrack>& calomeots)
const
370 ATH_MSG_VERBOSE(
"getCaloMEOT(const Trk::Track& idTrack, const Trk::Track& msTrack, std::vector<MaterialEffectsOnTrack>& calomeots)");
376 for(
auto m : *inputTSOS_ID) printTSOS(
m,
"TSOS ID TRACK");
377 for(
auto m : *inputTSOS_MS) printTSOS(
m,
"TSOS MS TRACK");
382 for (
auto it = inputTSOS_ID->rbegin();
it != inputTSOS_ID->rend(); ++
it) {
383 if(this->getVolumeByGeo(*
it)==1 && (*it)->trackParameters()) {
389 if(lastIDwP == inputTSOS_ID->rend()) {
399 for(
auto it = inputTSOS_MS->begin();
it!=itEnd ; ++
it) {
400 if(this->getVolumeByGeo(*
it)==3) {
403 if((*it)->trackParameters() && (*it)->trackParameters()->covariance()) {
410 if(firstMS == inputTSOS_MS->end()) {
419 firstMSnotPerigee=firstMS+1;
423 printTSOS(*lastIDwP,
"LAST IDwP");
424 printTSOS(*firstMSnotPerigee,
"FIRST MS");
425 if(firstMSwP != inputTSOS_MS->end())
426 printTSOS(*firstMSwP,
"FIRST MSwP");
428 ATH_MSG_WARNING(
"Unable to find first MS TSOS with Track Parameters!");
433 const EventContext& ctx = Gaudi::Hive::currentContext();
437 if (fieldCondObj ==
nullptr) {
438 ATH_MSG_ERROR(
"Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key());
441 fieldCondObj->getInitializedCache (fieldCache);
444 double X0ScaleMS = 0.;
445 double ElossScaleMS = 0.;
447 Trk::TrackStates* caloTSOS = this->getCaloTSOS (*(*lastIDwP)->trackParameters(),
449 fieldCache.
toroidOn() ? msTrack : idTrack,
450 (*firstMSnotPerigee)->surface(),
453 Eloss, X0ScaleMS, ElossScaleMS,
454 (firstMSwP == inputTSOS_MS->end()) ?
nullptr : (*firstMSwP)->trackParameters(),
458 if (!caloTSOS || caloTSOS->
size() != 3)
460 double idqOverP = std::abs(idTrack.perigeeParameters()->parameters()[
Trk::qOverP]);
463 if ((!fieldCache.
toroidOn() && idqOverP * 4000. < 1) || (fieldCache.
toroidOn() && msqOverP != 1 / 100000. && msqOverP != 0))
467 ATH_MSG_WARNING(
" Toroid off q*momentum of ID track " << 1. / idqOverP);
469 ATH_MSG_WARNING(
" Toroid on q*momentum of MS track " << 1. / msqOverP);
470 ATH_MSG_WARNING(
"Unable to retrieve Calorimeter TSOS from extrapolateM+aggregation (null or !=3)");
472 ATH_MSG_WARNING(
" Zero Calorimeter TSOS from extrapolateM+aggregation");
474 ATH_MSG_WARNING(
" nr Calorimeter TSOS from extrapolateM+aggregation not equal to 3 " << caloTSOS->
size());
478 if (caloTSOS) deleteTSOS(caloTSOS);
483 for (
auto &&
i : *caloTSOS){
486 throw std::logic_error(
"TrackStateOnSurface without material effects on track." );
489 double qoverp=
i->trackParameters()->parameters()[
Trk::qOverP];
493 std::unique_ptr<Trk::EnergyLoss> neweloss=
nullptr;
494 std::optional<Trk::ScatteringAngles> newsa= std::nullopt;
495 if (eloss) neweloss = std::make_unique<CaloEnergy>(*eloss);
498 double sigmascat = std::abs(qoverp)>0.0 ? std::sqrt(m_scattool->sigmaSquare(matprop,std::abs(1./qoverp),1.,
Trk::muon)) : 0.0;
505 i->trackParameters()->associatedSurface());
506 calomeots.push_back(newmeot);
515 std::vector<const Trk::TrackStateOnSurface*>*
519 std::vector<const Trk::TrackStateOnSurface*>* caloTSOS =
new std::vector<const Trk::TrackStateOnSurface*>();
522 const EventContext& ctx = Gaudi::Hive::currentContext();
525 if(!trackingGeometry) {
532 if( m_indetVolume->inside(parm.
position()) ) {
534 targetVolume = trackingGeometry->
trackingVolume(
"MuonSpectrometerEntrance");
536 ATH_MSG_WARNING(
"Unable to get target volume for calo material collection!");
539 ATH_MSG_VERBOSE(
"TP inside ID -> extrapolating TP "<<parm<<
" to MS entry volume "<<*targetVolume);
542 else if( !m_calorimeterVolume->inside(parm.
position()) ) {
544 targetVolume = trackingGeometry->
trackingVolume(
"InDet::Containers::InnerDetector");
546 ATH_MSG_WARNING(
"Unable to get target volume for calo material collection!");
549 ATH_MSG_VERBOSE(
"TP inside MS -> extrapolating TP "<<parm<<
" to ID exit volume "<<*targetVolume);
554 targetVolume = trackingGeometry->
trackingVolume(
"InDet::Containers::InnerDetector");
556 ATH_MSG_WARNING(
"Unable to get target volume for calo material collection!");
559 ATH_MSG_DEBUG(
"TP inside CALO or between CALO and MS -> assuming ID as target : "<<*targetVolume);
570 for(;
it!=itEnd; ++
it) {
571 if(this->getVolumeByGeo(*
it)==3)
572 if((*it)->trackParameters() && (*it)->trackParameters()->covariance()) {
573 parms = (*it)->trackParameters();
587 double X0ScaleMS = 0.;
588 double ElossScaleMS = 0.;
595 Eloss, X0ScaleMS, ElossScaleMS,
601 ATH_MSG_DEBUG(
" go to Beam Line destination surface position radius " << surface.
center().perp() <<
" z " << surface.
center().z());
604 for(
unsigned int i=0;
i<caloTSOSdv->
size(); ++
i)
605 caloTSOS->push_back(caloTSOSdv->
get(
i));
616 double Eloss_previous = 0.;
617 for (
auto& boundaryCandidate : boundaryIntersections){
621 if(!surfaceTV)
continue;
626 double X0ScaleMS = 0.;
627 double ElossScaleMS = 0.;
634 Eloss, X0ScaleMS, ElossScaleMS,
639 if(caloTSOSdv&&Eloss>Eloss_previous) {
645 ATH_MSG_DEBUG(
" getCaloTSOS: Previous solution had Eloss " << Eloss_previous <<
" latest " << Eloss);
649 for(
unsigned int i=0;
i<caloTSOSdv->
size(); ++
i)
650 caloTSOS->push_back(caloTSOSdv->
get(
i));
671 double& ElossScaleMS,
674 bool removeOoC)
const
676 const EventContext& ctx = Gaudi::Hive::currentContext();
677 bool fremoveMS =
false;
678 if(!removeOoC) fremoveMS =
true;
680 ATH_MSG_DEBUG(
"Retrieving Calorimeter TSOS from extrapolateM (dir=" <<
dir <<
") with starting parameters : "
681 << parm <<
" to surface "<<surf);
682 if(parms)
ATH_MSG_DEBUG(
"Parameters in MS provided : "<< *parms);
684 double pOri = parm.
momentum().mag();
687 std::vector<const Trk::TrackStateOnSurface*>* caloTSOS = m_muonExtrapolator->extrapolateM(ctx,
693 ATH_MSG_DEBUG(
"Retrieved " << caloTSOS->size() <<
" Calorimeter TSOS from extrapolateM, no-removal");
696 ATH_MSG_DEBUG(
"Retrieved " << caloTSOS->size() <<
" Calorimeter TSOS from extrapolateM, no-removal");
697 for(
auto m : *caloTSOS) this->printTSOS(
m,
"BEFORE-REMOVAL CALO TSOS");
703 double ElossCalo = 0.;
705 for(
const auto *
m : *caloTSOS) {
706 if(
m->materialEffectsOnTrack()) {
711 ATH_MSG_DEBUG(
" volume " << this->getVolumeByGeo(
m) <<
" Eloss from extrapolateM TG " << energyLoss->
deltaE());
713 Eloss += std::abs(energyLoss->
deltaE());
714 if(this->getVolumeByGeo(
m)==1) ElossID += std::abs(energyLoss->
deltaE());
715 if(this->getVolumeByGeo(
m)==2) ElossCalo += std::abs(energyLoss->
deltaE());
716 if(this->getVolumeByGeo(
m)==3) ElossMS += std::abs(energyLoss->
deltaE());
722 ATH_MSG_DEBUG(
"Total Eloss on TSOS from extrapolateM " << Eloss <<
" ElossID " << ElossID <<
" ElossMS " << ElossMS <<
" Elosscalo " << ElossCalo);
723 if(fremoveMS)
ATH_MSG_DEBUG(
" ID Eloss will be added to Calo Eloss " << ElossID+ElossCalo);
728 if(removeOoC && !caloTSOS->empty()) removeOutOfCalo(caloTSOS);
729 ATH_MSG_DEBUG(
"Retrieved " << caloTSOS->size() <<
" Calorimeter TSOS from extrapolateM");
731 if(fremoveMS && !caloTSOS->empty()) removeMS(caloTSOS);
732 ATH_MSG_DEBUG(
"Retrieved " << caloTSOS->size() <<
" Calorimeter TSOS from extrapolateM");
735 for(
auto m : *caloTSOS) this->printTSOS(
m,
"ORIGINAL CALO TSOS");
740 if(caloTSOS->empty() || Eloss<=0) {
742 ATH_MSG_WARNING(
"Unable to retrieve Calorimeter TSOS from extrapolateM caloTSOS->size() "<< caloTSOS->size() <<
" Eloss " << Eloss );
748 deleteTSOS(caloTSOS);
749 return finalCaloTSOS;
753 double X0ScaleCALO=1.0;
754 double ElossScaleCALO=1.0;
758 if(m_applyTGScaling) {
759 if(!tsosAtCaloExit) {
760 ATH_MSG_WARNING(
name() <<
" Unable to find Calorimeter Exit TSOS with TrackParameters! No TG Scaling applied!" );
762 m_elossupdator->getX0ElossScales(1,
765 X0ScaleCALO, ElossScaleCALO);
766 m_elossupdator->getX0ElossScales(0,
769 X0ScaleMS, ElossScaleMS);
772 ATH_MSG_DEBUG(
"Eloss/X0 scaling corrections set to : " << ElossScaleCALO <<
" " << X0ScaleCALO);
776 double pAtCaloEntry = 0;
778 double OneOverP = std::abs(parm.parameters()[
Trk::qOverP]);
780 pAtCaloEntry = 1./OneOverP;
782 pAtCaloEntry = parm.
momentum().norm();
785 if(!tsosAtCaloEntry) {
786 ATH_MSG_WARNING(
name() <<
" Unable to find Calorimeter Entry TSOS with TrackParameters! Momentum at Calo Entry not available!" );
790 pAtCaloEntry = 1./OneOverP;
800 if(!tsosAtCaloExit) {
801 ATH_MSG_DEBUG(
"Unable to find Calorimeter Exit TSOS with TrackParameters! Momentum at MS not available!" );
804 ATH_MSG_DEBUG(
"MS track parameters taken from calorimeter TSOS");
809 double pAtMuonEntryError = 0.0;
811 if( std::abs(parms->parameters()[
Trk::qOverP]) > 0.0 ) {
812 double pAtMuonEntry = std::abs(1./parms->parameters()[
Trk::qOverP]);
813 if (!parms->covariance() ||
816 "MS track parameters without covariance, using 10% relative error!");
817 pAtMuonEntryError = pAtMuonEntry*0.1;
820 pAtMuonEntryError = pAtMuonEntry*pAtMuonEntry*qOverpAtMuonEntryError;
825 ATH_MSG_DEBUG(
"Momentum Error at MS Entry : " << pAtMuonEntryError);
828 double measCaloEnergy = 0.0;
829 double measCaloEnergyError = 0.0;
830 double fsrCaloEnergy = 0.0;
833 double totalEloss=0.0;
834 double meanElossIoni=0.0;
835 double sigmaElossIoni=0.0;
836 if(m_useCaloEnergyMeasurement) {
840 this->getMopAndIoniEnergyLoss(caloTSOS,
847 double E_em_meas = 0.;
848 double E_em_exp = 0.;
849 double E_tile_meas = 0.;
850 double E_tile_exp = 0.;
851 double E_HEC_meas = 0.;
852 double E_HEC_exp = 0.;
853 double E_dead_exp = 0.;
856 if(m_useMuonCaloEnergyTool) {
861 m_muonCaloEnergyTool->calculateMuonEnergies( &muonTrack,
862 totalEloss, meanElossIoni, 0.45*sigmaElossIoni,
863 measCaloEnergy, measCaloEnergyError, fsrCaloEnergy, e_exp,
864 E_em_meas,E_em_exp,E_tile_meas,E_tile_exp,E_HEC_meas,E_HEC_exp,E_dead_exp);
867 ATH_MSG_DEBUG(
" eta " << eta <<
" Energy measurement from calorimeter: inputs totalEloss, meanElossIoni, sigmaElossIoni "
868 << totalEloss <<
" " << meanElossIoni <<
" " << sigmaElossIoni <<
" e_exp Ioni from TG " << e_exp <<
" e_exp original " << e_exp*totalEloss/(meanElossIoni+0.001));
873 measCaloEnergy = this->getCaloMeasuredEnergy(eta,
phi,
880 ATH_MSG_DEBUG(
"Final measured energy in calorimeter : " << measCaloEnergy <<
" +- " << measCaloEnergyError <<
" MeV"
881 <<
" momentum fraction " << measCaloEnergy/pAtCaloEntry);
885 bool useMeasuredEnergy = m_useCaloEnergyMeasurement;
886 if(pAtCaloEntry*
sin(parm.parameters()[
Trk::theta]) < m_paramPtCut) useMeasuredEnergy =
false;
887 if(useMeasuredEnergy && !isIsolatedTrack(eta,
phi)) useMeasuredEnergy =
false;
890 double Eloss_tot=0.0;
895 finalCaloTSOS = modifyTSOSvector(caloTSOS, X0ScaleCALO, ElossScaleCALO,
896 m_repositionTSOS, m_aggregateTSOS, m_updateTSOS,
897 measCaloEnergy, measCaloEnergyError, fsrCaloEnergy,
898 pAtCaloEntry, pAtMuonEntryError,
899 Eloss_tot, useMeasuredEnergy,
900 totalEloss, meanElossIoni, sigmaElossIoni);
902 ATH_MSG_DEBUG(
" after modifyTSOSvector X0ScaleCALO " << X0ScaleCALO <<
" ElossScaleCALO " << ElossScaleCALO <<
903 " pAtCaloEntry " << pAtCaloEntry <<
" pAtMuonEntryError " << pAtMuonEntryError <<
" total Eloss from TG through MuonEnergyTool " << Eloss_tot );
904 ATH_MSG_DEBUG(
"Aggregating and correcting TSOS down to : " << finalCaloTSOS->
size() <<
" with total Eloss " << Eloss_tot);
908 for(
auto m : *finalCaloTSOS) this->printTSOS(
m,
"FINAL CALO TSOS");
912 deleteTSOS(caloTSOS);
914 return finalCaloTSOS;
920 if(tsos->materialEffectsOnTrack()) {
937 return paramCaloEnergy;
939 return caloEnergy->
clone();
956 std::vector<const Trk::TrackStateOnSurface*>::const_reverse_iterator
it = caloTSOS->rbegin();
957 std::vector<const Trk::TrackStateOnSurface*>::const_reverse_iterator itEnd = caloTSOS->rend();
958 for(;
it!=itEnd; ++
it) {
959 if((*it)->trackParameters()) {
960 ATH_MSG_DEBUG(
"Parameters at CALO exit found : "<< *((*it)->trackParameters()));
961 tsosAtCaloExit = *
it;
962 return tsosAtCaloExit;
966 std::vector<const Trk::TrackStateOnSurface*>::const_iterator
it = caloTSOS->begin();
967 std::vector<const Trk::TrackStateOnSurface*>::const_iterator itEnd = caloTSOS->end();
968 for(;
it!=itEnd; ++
it) {
969 if((*it)->trackParameters()) {
970 ATH_MSG_DEBUG(
"Parameters at CALO exit found : "<< *((*it)->trackParameters()));
971 tsosAtCaloExit = *
it;
972 return tsosAtCaloExit;
976 return tsosAtCaloExit;
985 std::vector<const Trk::TrackStateOnSurface*>::const_iterator
it = caloTSOS->begin();
986 std::vector<const Trk::TrackStateOnSurface*>::const_iterator itEnd = caloTSOS->end();
987 for(;
it!=itEnd; ++
it) {
988 if((*it)->trackParameters()) {
989 ATH_MSG_DEBUG(
"Parameters at CALO entry found : "<< *((*it)->trackParameters()));
990 tsosAtCaloEntry = *
it;
991 return tsosAtCaloEntry;
995 std::vector<const Trk::TrackStateOnSurface*>::const_reverse_iterator
it = caloTSOS->rbegin();
996 std::vector<const Trk::TrackStateOnSurface*>::const_reverse_iterator itEnd = caloTSOS->rend();
997 for(;
it!=itEnd; ++
it) {
998 if((*it)->trackParameters()) {
999 ATH_MSG_DEBUG(
"Parameters at CALO entry found : "<< *((*it)->trackParameters()));
1000 tsosAtCaloEntry = *
it;
1001 return tsosAtCaloEntry;
1005 return tsosAtCaloEntry;
1017 caloTSOS->erase( std::remove_if(caloTSOS->begin(),
1020 if (state && this_->getVolumeByGeo(state)!=2) {
1041 caloTSOS->erase( std::remove_if(caloTSOS->begin(),
1044 if (state && this_->getVolumeByGeo(state)==3) {
1066 unsigned int ntoupdate=0;
1068 while(
it!=firstMS) {
1074 if(ntoupdate==caloTSOS->
size()) {
1079 while(
i<ntoupdate) {
1091 double X0ScaleMS,
double ElossScaleMS)
const
1098 std::bitset<Trk::MaterialEffectsBase::NumberOfMaterialEffectsTypes> meotPattern(0);
1101 std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern(0);
1105 if(X0ScaleMS<0.5||ElossScaleMS<0.5||X0ScaleMS>2.||ElossScaleMS>2.) {
1106 ATH_MSG_WARNING(
"Too large or too small X0ScaleMS " << X0ScaleMS <<
" ElossScaleMS " << ElossScaleMS);
1111 int msMatStates = 0;
1112 int msMatParStates = 0;
1116 for(;
it!= inputTSOS->
end();++
it) {
1118 if((*it)->materialEffectsOnTrack()) {
1136 double deltaE = (ElossScaleMS * energyLoss->
deltaE());
1137 double sigmaDeltaE = (ElossScaleMS * energyLoss->
sigmaDeltaE());
1138 double sigmaPlusDeltaE =
1140 double sigmaMinusDeltaE =
1142 double deltaE_ioni = (ElossScaleMS * energyLoss->
meanIoni());
1143 double sigmaDeltaE_ioni = (ElossScaleMS * energyLoss->
sigmaIoni());
1144 double deltaE_rad = (ElossScaleMS * energyLoss->
meanRad());
1145 double sigmaDeltaE_rad = (ElossScaleMS * energyLoss->
sigmaRad());
1149 std::cout <<
" updateVectorMS Old Eloss " << energyLoss->
deltaE()
1150 <<
" new Eloss " << deltaE << std::endl;
1152 auto energyLossNew = std::make_unique<Trk::EnergyLoss>(deltaE,
1163 std::make_unique<Trk::MaterialEffectsOnTrack>(X0ScaleMS * meot->
thicknessInX0(),
1165 std::move(energyLossNew),
1168 std::unique_ptr<Trk::TrackParameters>
pars{};
1169 if ((*it)->trackParameters())
1170 pars = (*it)->trackParameters()->uniqueClone();
1174 nullptr, std::move(
pars), std::move(newMeot), typePattern);
1180 delete newTSOSvector;
1189 std::cout <<
" msStates " << msStates <<
" msMatStates " << msMatStates <<
" msMatParStates " << msMatParStates << std::endl;
1192 for(
it = firstMS;
it!= inputTSOS->
end();++
it) {
1193 if((*it)->materialEffectsOnTrack()) {
1200 std::cout <<
" updateVectorMS dump NEW Eloss " << energyLoss->
deltaE() << std::endl;
1215 unsigned int vol = 0;
1220 if(m_DetID->is_indet(
id)) vol=1;
1221 else if(m_DetID->is_muon(
id)) vol=3;
1227 if(m_indetVolume->inside(
m->surface().globalReferencePoint())) vol=1;
1228 else if(m_calorimeterVolume->inside(
m->surface().globalReferencePoint())) vol=2;
1237 std::vector<const Trk::TrackStateOnSurface*>::const_iterator
it = vecTSOS->begin();
1238 std::vector<const Trk::TrackStateOnSurface*>::const_iterator itEnd = vecTSOS->end();
1239 for (;
it != itEnd; ++
it)
delete *
it;
1247 for (;
it != itEnd; ++
it)
delete *
it;
1256 unsigned int ivolGeo = getVolumeByGeo(
m);
1257 std::string volGeo=
"ID";
1258 if(ivolGeo==2) volGeo=
"CALO";
1259 else if(ivolGeo==3) volGeo=
"MS";
1261 <<
" Volume "<<std::left<<std::setw(5)<<volGeo
1262 <<
" r "<<std::left<<std::setw(10)<<
m->surface().globalReferencePoint().perp()
1263 <<
" z "<<std::left<<std::setw(10)<<
m->surface().globalReferencePoint().z());
1264 if(
m->materialEffectsOnTrack()) {
1265 ATH_MSG_VERBOSE(
" -> Material: X0 "<<std::left<<std::setw(10)<<
m->materialEffectsOnTrack()->thicknessInX0());
1270 ATH_MSG_DEBUG(
" geo " << volGeo <<
" radius " <<
m->surface().globalReferencePoint().perp() <<
" z " <<
m->surface().globalReferencePoint().z() <<
" TSOS Eloss " <<energyLoss->
deltaE());
1271 std::string
type=
"P";
1276 <<
" MopIoni "<<std::left<<std::setw(10)<<energyLoss->
meanIoni()<<
" +- "<<std::left<<std::setw(10)<<energyLoss->
sigmaIoni()
1277 <<
" MeanRad "<<std::left<<std::setw(10)<<energyLoss->
meanRad()<<
" +- "<<std::left<<std::setw(10)<<energyLoss->
sigmaRad() );
1282 " dTheta "<<std::left<<std::setw(10)<<scatAngles->
deltaTheta()<<
" +- "<<std::left<<std::setw(10)<<scatAngles->
sigmaDeltaTheta());
1286 if(
m->trackParameters()) {
1287 ATH_MSG_VERBOSE(
" -> TP: r "<<std::left<<std::setw(10)<<
m->trackParameters()->position().perp()
1288 <<
" z "<<std::left<<std::setw(10)<<
m->trackParameters()->position().z()
1289 <<
" phi0 "<<std::left<<std::setw(10)<<
m->trackParameters()->parameters()[
Trk::phi0]
1291 if(
m->trackParameters()->covariance()) {
1293 <<
" phi0 "<<std::left<<std::setw(10)<<
Amg::error(*
m->trackParameters()->covariance(),
Trk::phi0)
1308 double caloEnergyError,
1309 double fsrCaloEnergy,
1311 double momentumError,
1313 bool useMeasuredEnergy,
1314 double totalEloss,
double meanElossIoni,
double sigmaElossIoni)
const
1334 <<
" with X0, Eloss scales " << scaleX0 <<
" " << scaleEloss
1335 <<
" rep agg upd " << reposition <<
" " << aggregate <<
" " << updateEloss
1336 <<
" caloE " << caloEnergy <<
" +- " << caloEnergyError
1337 <<
" fsrCaloEnergy "<< fsrCaloEnergy
1338 <<
" p " << pCaloEntry <<
" dp " << momentumError);
1350 double sigmaDeltaPhi2_tot = 0.;
1351 double sigmaDeltaTheta2_tot = 0.;
1352 double deltaE_tot = 0.;
1353 double sigmaDeltaE_tot = 0.;
1354 double sigmaPlusDeltaE_tot = 0.;
1355 double sigmaMinusDeltaE_tot = 0.;
1356 double deltaE_ioni_tot = 0.;
1357 double sigmaDeltaE_ioni_tot=0.;
1358 double deltaE_rad_tot = 0.;
1359 double sigmaDeltaE_rad_tot =0.;
1365 double deltaEFirst = 0.;
1368 double deltaTheta = 0.;
1377 std::bitset<Trk::MaterialEffectsBase::NumberOfMaterialEffectsTypes> meotPattern(0);
1381 std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern(0);
1385 std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePatternScat(0);
1388 std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePatternDeposit(0);
1390 const auto sqrt12=std::sqrt(12.);
1391 for(
const auto *
m : *matvec) {
1393 if(!
m->trackParameters()) {
1397 if(
m->materialEffectsOnTrack()) {
1398 double X0 =
m->materialEffectsOnTrack()->thicknessInX0();
1419 X0_tot += std::abs(scaleX0 *
X0);
1425 deltaE_tot += std::abs(scaleEloss*energyLoss->
deltaE());
1426 sigmaDeltaE_tot += std::abs(scaleEloss*energyLoss->
sigmaDeltaE());
1427 sigmaPlusDeltaE_tot += std::abs(scaleEloss*energyLoss->
sigmaPlusDeltaE());
1428 sigmaMinusDeltaE_tot += std::abs(scaleEloss*energyLoss->
sigmaMinusDeltaE());
1429 deltaE_ioni_tot += std::abs(scaleEloss*energyLoss->
meanIoni());
1430 sigmaDeltaE_ioni_tot += std::abs(scaleEloss*energyLoss->
sigmaIoni());
1431 deltaE_rad_tot += std::abs(scaleEloss*energyLoss->
meanRad());
1432 sigmaDeltaE_rad_tot += std::abs(scaleEloss*energyLoss->
sigmaRad());
1448 deltaEFirst = energyLoss->
deltaE();
1456 wpos +=
w*posNew/2.;
1459 wdist2 +=
w*(pos0-posFirst).
mag2()/2.;
1460 wdist2 +=
w*(posNew-posFirst).
mag2()/2.;
1462 if (!aggregate&&!reposition) {
1466 std::sqrt(sigmaDeltaPhi2_tot),
1467 std::sqrt(sigmaDeltaTheta2_tot));
1470 sigmaMinusDeltaE_tot,
1471 sigmaPlusDeltaE_tot,
1473 sigmaDeltaE_ioni_tot,
1475 sigmaDeltaE_rad_tot,
1477 auto caloEnergyNew = std::make_unique<CaloEnergy>(energyLossNew);
1478 Eloss_tot += caloEnergyNew->deltaE();
1481 std::make_unique<Trk::MaterialEffectsOnTrack>(
1482 X0_tot, scatNew, std::move(caloEnergyNew), surf, meotPattern);
1483 auto pars =
m->trackParameters()->uniqueClone();
1487 nullptr, std::move(
pars), std::move(meotLast), typePattern);
1492 sigmaDeltaTheta2_tot = 0.;
1493 sigmaDeltaPhi2_tot = 0.;
1495 sigmaDeltaE_tot = 0;
1496 sigmaPlusDeltaE_tot = 0.;
1497 sigmaMinusDeltaE_tot = 0.;
1498 deltaE_ioni_tot = 0.;
1499 sigmaDeltaE_ioni_tot = 0.;
1500 deltaE_rad_tot = 0.;
1501 sigmaDeltaE_rad_tot = 0.;
1504 }
else if(!aggregate&&reposition) {
1506 if(std::abs(
depth)<10.) {
1513 sqrt(sigmaDeltaPhi2_tot),
1514 sqrt(sigmaDeltaTheta2_tot));
1517 sigmaMinusDeltaE_tot,
1518 sigmaPlusDeltaE_tot,
1520 sigmaDeltaE_ioni_tot,
1522 sigmaDeltaE_rad_tot,
1524 auto caloEnergyNew = std::make_unique<CaloEnergy>(energyLossNew);
1525 Eloss_tot += caloEnergyNew->deltaE();
1528 std::make_unique<Trk::MaterialEffectsOnTrack>(
1529 X0_tot, scatNew, std::move(caloEnergyNew), surf, meotPattern);
1530 auto pars =
m->trackParameters()->uniqueClone();
1534 nullptr, std::move(
pars), std::move(meotLast), typePattern);
1538 sigmaDeltaTheta2_tot = 0.;
1539 sigmaDeltaPhi2_tot = 0.;
1541 sigmaDeltaE_tot = 0;
1542 sigmaPlusDeltaE_tot = 0.;
1543 sigmaMinusDeltaE_tot = 0.;
1544 deltaE_ioni_tot = 0.;
1545 sigmaDeltaE_ioni_tot = 0.;
1546 deltaE_rad_tot = 0.;
1547 sigmaDeltaE_rad_tot = 0.;
1554 auto energyLoss0 = std::make_unique<Trk::EnergyLoss>(0.,0.,0.,0.);
1557 std::sqrt(sigmaDeltaPhi2_tot / 2.),
1558 std::sqrt(sigmaDeltaTheta2_tot / 2.));
1564 std::sqrt(sigmaDeltaPhi2_tot / 2.),
1565 std::sqrt(sigmaDeltaTheta2_tot / 2.));
1568 sigmaMinusDeltaE_tot,
1569 sigmaPlusDeltaE_tot,
1571 sigmaDeltaE_ioni_tot,
1573 sigmaDeltaE_rad_tot,
1575 auto caloEnergyNew = std::make_unique<CaloEnergy>(energyLossNew);
1576 Eloss_tot += caloEnergyNew->deltaE();
1592 std::make_unique<Trk::MaterialEffectsOnTrack>(
1593 X0_tot / 2., scatFirst, std::move(energyLoss0), surfFirst, meotPattern);
1595 std::make_unique<Trk::MaterialEffectsOnTrack>(
1596 X0_tot / 2., scatNew, std::move(caloEnergyNew), surfLast, meotPattern);
1600 double qOverP0 =
m->trackParameters()->charge()/ (
m->trackParameters()->momentum().mag()-std::abs(energyLoss->
deltaE()));
1603 std::unique_ptr<Trk::TrackParameters> parsFirst =
1605 0., 0.,
dir.phi(),
dir.theta(), qOverP0);
1607 double qOverPNew =
m->trackParameters()->charge() /
1608 m->trackParameters()->momentum().mag();
1609 std::unique_ptr<Trk::TrackParameters> parsLast =
1611 0., 0.,
dir.phi(),
dir.theta(), qOverPNew);
1616 nullptr, std::move(parsFirst), std::move(meotFirst), typePattern);
1619 nullptr, std::move(parsLast), std::move(meotLast), typePattern);
1626 sigmaDeltaTheta2_tot = 0.;
1627 sigmaDeltaPhi2_tot = 0.;
1629 sigmaDeltaE_tot = 0;
1630 sigmaPlusDeltaE_tot = 0.;
1631 sigmaMinusDeltaE_tot = 0.;
1632 deltaE_ioni_tot = 0.;
1633 sigmaDeltaE_ioni_tot = 0.;
1634 deltaE_rad_tot = 0.;
1635 sigmaDeltaE_rad_tot = 0.;
1644 if (aggregate&&reposition) {
1651 bool threePlanes =
false;
1652 if (std::abs(
pos.z()) < 6700 &&
pos.perp() < 4200)
1658 std::sqrt(sigmaDeltaPhi2_tot / 2.),
1659 std::sqrt(sigmaDeltaTheta2_tot / 2.));
1663 std::sqrt(sigmaDeltaPhi2_tot / 2.),
1664 std::sqrt(sigmaDeltaTheta2_tot / 2.));
1667 sigmaMinusDeltaE_tot,
1668 sigmaPlusDeltaE_tot,
1670 sigmaDeltaE_ioni_tot,
1672 sigmaDeltaE_rad_tot,
1676 << energyLoss2.
deltaE() <<
" meanIoni "
1677 << energyLoss2.
meanIoni() <<
" sigmaIoni "
1678 << energyLoss2.
sigmaIoni() <<
" X0_tot " << X0_tot);
1683 double calE = caloEnergy;
1684 double calEr = caloEnergyError;
1687 if (!useMeasuredEnergy)
1692 ? m_elossupdator->updateEnergyLoss(
1693 energyLoss2, calE, calEr, pCaloEntry, momentumError, elossFlag)
1696 sigmaMinusDeltaE_tot,
1697 sigmaPlusDeltaE_tot,
1699 sigmaDeltaE_ioni_tot,
1701 sigmaDeltaE_rad_tot,
1703 auto caloEnergyNew = std::make_unique<CaloEnergy>(energyLossNew);
1706 << energyLossNew.
deltaE() <<
" meanIoni "
1707 << energyLossNew.
meanIoni() <<
" sigmaIoni "
1710 caloEnergyNew->set_measEnergyLoss(caloEnergy, caloEnergyError);
1712 caloEnergyNew->set_fsrCandidateEnergy(fsrCaloEnergy);
1720 int eLossFlagTmp = 0;
1721 Trk::EnergyLoss energyLossParam = m_elossupdator->updateEnergyLoss(energyLoss2, 0.0, 0.0, pCaloEntry, 0., eLossFlagTmp);
1724 if(m_overwriteElossParam&&m_useCaloEnergyMeasurement) caloEnergyNew->set_paramEnergyLoss(totalEloss,meanElossIoni,0.45*sigmaElossIoni);
1725 ATH_MSG_DEBUG(
" modifyTSOSvector energyLossParam Eloss " << energyLossParam.
deltaE() <<
" on TSOS " << energyLossNew.
deltaE() <<
" calE " << calE);
1726 Eloss_tot += caloEnergyNew->deltaE();
1737 double halflength2 = wdist2/w_tot - (
pos-posFirst).
mag()*(
pos-posFirst).
mag();
1738 double halflength = 0.;
1739 if(halflength2>0) halflength = sqrt(halflength2);
1745 double scaleCalo = 1.;
1746 double scaleCaloNew = std::abs(pos0.z())/6700;
1747 if(scaleCaloNew>scaleCalo) scaleCalo = scaleCaloNew;
1748 scaleCaloNew = std::abs(posNew.z())/6700;
1749 if(scaleCaloNew>scaleCalo) scaleCalo = scaleCaloNew;
1750 scaleCaloNew = std::abs(pos0.perp())/4200;
1751 if(scaleCaloNew>scaleCalo) scaleCalo = scaleCaloNew;
1752 scaleCaloNew = std::abs(posNew.perp())/4200;
1753 if(scaleCaloNew>scaleCalo) scaleCalo = scaleCaloNew;
1756 pos0 = pos0/scaleCalo;
1758 posNew = posNew/scaleCalo;
1759 halflength = halflength/scaleCalo;
1760 ATH_MSG_VERBOSE(
" position scattering planes inside calo scale factor " << scaleCalo);
1772 std::unique_ptr<Trk::TrackParameters> parsFirst =
1774 0., 0.,
dir.phi(),
dir.theta(), qOverP0);
1775 std::unique_ptr<Trk::TrackParameters> parsLast =
1777 0., 0.,
dir.phi(),
dir.theta(), qOverPNew);
1786 std::make_unique<Trk::MaterialEffectsOnTrack>(X0_tot / 2.,
1794 std::make_unique<Trk::MaterialEffectsOnTrack>(X0_tot / 2.,
1796 std::move(caloEnergyNew),
1803 nullptr, std::move(parsFirst), std::move(meotFirst), typePattern);
1804 auto whichPattern = (elossFlag != 0) ? typePatternDeposit : typePattern;
1806 std::move(parsLast), std::move(meotLast), whichPattern);
1815 std::unique_ptr<Trk::TrackParameters>
pars =
1817 0., 0.,
dir.phi(),
dir.theta(), qOverPNew);
1822 std::make_unique<Trk::MaterialEffectsOnTrack>(
1823 X0_tot / 2., scatFirst,
nullptr, surfFirst, meotPattern);
1828 std::make_unique<Trk::MaterialEffectsOnTrack>(
1829 0.,std::nullopt, std::move(caloEnergyNew), surf, meotPattern);
1834 std::make_unique<Trk::MaterialEffectsOnTrack>(
1835 X0_tot / 2., scatNew,
nullptr, surfLast, meotPattern);
1840 nullptr, std::move(parsFirst), std::move(meotFirst), typePatternScat);
1842 nullptr, std::move(
pars), std::move(meot), typePatternDeposit);
1845 nullptr, std::move(parsLast), std::move(meotLast), typePatternScat);
1857 return newTSOSvector;
1866 double& meanElossIoni,
1867 double& sigmaElossIoni)
const
1876 double deltaE_tot = 0.;
1877 double sigmaDeltaE_tot = 0.;
1878 double sigmaPlusDeltaE_tot = 0.;
1879 double sigmaMinusDeltaE_tot = 0.;
1880 double deltaE_ioni_tot = 0.;
1881 double sigmaDeltaE_ioni_tot=0.;
1882 double deltaE_rad_tot = 0.;
1883 double sigmaDeltaE_rad_tot =0.;
1885 for(
const auto *
m : *matvec) {
1886 if(!
m->trackParameters()) {
1890 if(
m->materialEffectsOnTrack()) {
1903 deltaE_tot += std::abs(scaleEloss*energyLoss->
deltaE());
1904 sigmaDeltaE_tot += std::abs(scaleEloss*energyLoss->
sigmaDeltaE());
1905 sigmaPlusDeltaE_tot += std::abs(scaleEloss*energyLoss->
sigmaPlusDeltaE());
1906 sigmaMinusDeltaE_tot += std::abs(scaleEloss*energyLoss->
sigmaMinusDeltaE());
1907 deltaE_ioni_tot += std::abs(scaleEloss*energyLoss->
meanIoni());
1908 sigmaDeltaE_ioni_tot += std::abs(scaleEloss*energyLoss->
sigmaIoni());
1909 deltaE_rad_tot += std::abs(scaleEloss*energyLoss->
meanRad());
1910 sigmaDeltaE_rad_tot += std::abs(scaleEloss*energyLoss->
sigmaRad());
1912 ATH_MSG_DEBUG(
" position x " <<
m->trackParameters()->position().x() <<
" y " <<
m->trackParameters()->position().y() <<
" perp " <<
m->trackParameters()->position().perp() <<
" z " <<
m->trackParameters()->position().z() );
1913 ATH_MSG_DEBUG(
" deltaE " << (scaleEloss*energyLoss->
deltaE()) <<
" deltaE_ioni " << (scaleEloss*energyLoss->
meanIoni()) <<
" sigmaDeltaE_ioni " << (scaleEloss*energyLoss->
sigmaIoni()));
1914 ATH_MSG_DEBUG(
" deltaE_tot " << deltaE_tot <<
" deltaE_ioni_tot " << deltaE_ioni_tot <<
" sigmaDeltaE_ioni_tot " << sigmaDeltaE_ioni_tot);
1921 EnergyLoss eLoss =
EnergyLoss(deltaE_tot, sigmaDeltaE_tot, sigmaMinusDeltaE_tot, sigmaPlusDeltaE_tot,
1922 deltaE_ioni_tot, sigmaDeltaE_ioni_tot,
1923 deltaE_rad_tot, sigmaDeltaE_rad_tot, 0.) ;
1927 EnergyLoss eLoss2 ( m_elossupdator->updateEnergyLoss(eLoss, 0, 0, pCaloEntry, 0, elossFlag) );
1933 ATH_MSG_DEBUG(
"Mop Energy Loss " << totalEloss <<
" mean ionization energy loss " << meanElossIoni <<
" sigmaElossIoni " << sigmaElossIoni);
1940 std::pair<int,double> inner = m_trackIsolationTool->trackIsolation(Gaudi::Hive::currentContext(),eta,
phi);
1941 nTracks = inner.first;
1943 ATH_MSG_VERBOSE(
"Isolation : Number of tracks in cone " << nTracks <<
" cut < " << m_maxNTracksIso);
1945 return nTracks <= m_maxNTracksIso;
1951 double meanElossIoni,
1952 double& fsrCaloEnergy)
const
1955 std::unique_ptr<Rec::CaloMeas> caloMeas = m_caloMeasTool->energyMeasurement(Gaudi::Hive::currentContext(),eta,
phi,eta,
phi);
1959 double FinalMeasuredEnergy = getFinalMeasuredEnergy(caloMeas.get(), totalEloss, meanElossIoni, eta, fsrCaloEnergy);
1961 return FinalMeasuredEnergy;
1967 double meanElossIoni,
1969 double& fsrCaloEnergy)
const
1971 double MopLossCorrected = totalEloss;
1972 double MopLoss = totalEloss;
1975 fsrCaloEnergy = MopLoss*m_caloParamTool->emMopFraction(eta);
1978 const double InertMaterial = m_caloParamTool->x0mapInertMaterial(eta);
1980 const double EmMaterial = m_caloParamTool->x0mapEmMaterial(eta);
1982 const double HECMaterial = m_caloParamTool->x0mapHecMaterial(eta);
1984 double MaterialCorrection =
InertMaterial * MopLossCorrected;
1998 double ForwardHECCorrection = 0.;
2000 ForwardHECCorrection = (1. - LArHECMeasurementMaterial) * HECMaterial * MopLossCorrected;
2003 double TotalMeasuredEnergy = TileEnergy + EmEnergy + LArHECEnergy;
2006 <<
" LArHEC " << LArHECEnergy
2007 <<
" EM " << EmEnergy);
2009 <<
" HECMaterial " << HECMaterial
2010 <<
" MopLossCorrected " << MopLossCorrected );
2016 if (std::abs(eta)<1.4) {
2017 if (LArHECEnergy + TileEnergy > 0.1 * MopLoss * HECMaterial) bHEC=
true;
2019 else if (std::abs(eta)>1.8) {
2020 if (LArHECEnergy + TileEnergy > 0.2 * MopLoss * HECMaterial) bHEC=
true;
2022 if (LArHECEnergy + TileEnergy > 0.25 * MopLoss * HECMaterial) bHEC=
true;
2024 if (EmEnergy > 0.5 * MopLoss * EmMaterial) bEM =
true;
2026 double MeasCorrected = TotalMeasuredEnergy + MaterialCorrection;
2031 const double IonizationLoss = (1./1.4) * meanElossIoni;
2032 double eOverMipCorrectionEm = 0.;
2033 double eOverMipCorrectionHEC = 0.;
2037 const double emipEM = 0.78;
2038 eOverMipCorrectionEm = - (1./emipEM-1.) * IonizationLoss * EmMaterial * LArEmMeasurementMaterial;
2039 if (EmEnergy + eOverMipCorrectionEm<0.)eOverMipCorrectionEm=0.;
2042 const double emipTile = 0.86;
2043 const double emipLAr = 0.94;
2044 const double HECEnergy = TileEnergy + LArHECEnergy;
2045 const double eOverMipCorrectionTile = - (1./emipTile-1.) * TileEnergy / HECEnergy * IonizationLoss * HECMaterial * TileMeasurementMaterial;
2046 const double eOverMipCorrectionLAr = - (1./emipLAr-1.) * LArHECEnergy / HECEnergy * IonizationLoss * HECMaterial * LArHECMeasurementMaterial;
2047 eOverMipCorrectionHEC = eOverMipCorrectionTile + eOverMipCorrectionLAr;
2048 if (LArHECEnergy + TileEnergy + eOverMipCorrectionHEC < 0.0) eOverMipCorrectionHEC=0.;
2050 const double eOverMipCorrection = eOverMipCorrectionEm + eOverMipCorrectionHEC;
2069 double FinalMeasuredEnergy = MeasCorrected + eOverMipCorrection;
2071 return FinalMeasuredEnergy;
2075 std::stringstream
msg;
2076 msg <<
"Failed to get conditions data " << m_trackingGeometryReadKey.key() <<
".";
2077 throw std::runtime_error(
msg.str());