diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/CMakeLists.txt b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/CMakeLists.txt index 413eb3383422bbaeafe95b134acf7b5becd48424..0ae7cd4c62957f2f2d2c0c77107df897482adcbc 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/CMakeLists.txt +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/CMakeLists.txt @@ -18,6 +18,7 @@ atlas_depends_on_subdirs( # External dependencies: find_package( CLHEP ) +find_package( HepPDT ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO Matrix Physics ) # Remove the --as-needed linker flags: @@ -70,14 +71,15 @@ atlas_add_root_dictionary( ISF_FastCaloSimEvent _dictSource ISF_FastCaloSimEvent/TFCSExtrapolationState.h ISF_FastCaloSimEvent/TFCSSimulationState.h ISF_FastCaloSimEvent/TFCSTruthState.h - ISF_FastCaloSimEvent/LinkDef.h ) + ISF_FastCaloSimEvent/LinkDef.h + EXTERNAL_PACKAGES HepPDT) atlas_add_library( ISF_FastCaloSimEvent ISF_FastCaloSimEvent/*.h ${_dictSource} src/*.cxx PUBLIC_HEADERS ISF_FastCaloSimEvent - INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} + INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} DEFINITIONS ${CLHEP_DEFINITIONS} - LINK_LIBRARIES ${CLHEP_LIBRARIES} ${ROOT_LIBRARIES} AthContainers SGTools + LINK_LIBRARIES ${CLHEP_LIBRARIES} ${HEPPDT_LIBRARIES} ${ROOT_LIBRARIES} AthContainers SGTools CaloGeoHelpers TileSimEvent PRIVATE_LINK_LIBRARIES GaudiKernel ) diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSHistoLateralShapeParametrization.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSHistoLateralShapeParametrization.h index 1f6f406bef02dafcd73a74633f24b04d704c7d53..f6ecbe2e4f6c615bb1aca035083733e7e6e00a85 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSHistoLateralShapeParametrization.h +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSHistoLateralShapeParametrization.h @@ -7,6 +7,7 @@ #include "ISF_FastCaloSimEvent/TFCSLateralShapeParametrizationHitBase.h" #include "ISF_FastCaloSimEvent/TFCS2DFunctionHistogram.h" +#include "ISF_FastCaloSimEvent/TFCSTruthState.h" class TH2; diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSHistoLateralShapeParametrizationFCal.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSHistoLateralShapeParametrizationFCal.h index 46e934939c9b51d535779854824223658f1abd0f..f14f8b703dc3e22f28249e481311a564d40a8e17 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSHistoLateralShapeParametrizationFCal.h +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSHistoLateralShapeParametrizationFCal.h @@ -7,6 +7,7 @@ #include "ISF_FastCaloSimEvent/TFCSHistoLateralShapeParametrization.h" #include "ISF_FastCaloSimEvent/TFCS2DFunctionHistogram.h" +#include "ISF_FastCaloSimEvent/TFCSTruthState.h" class TH2; diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSHistoLateralShapeParametrization.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSHistoLateralShapeParametrization.cxx index 4a5db9df5f08b96acbe38fbe26ae80a0576f596a..5741c0f168e3a6e4aa7def787b97c9fa497ddaef 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSHistoLateralShapeParametrization.cxx +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSHistoLateralShapeParametrization.cxx @@ -14,6 +14,8 @@ #include "TMath.h" #include "TH2.h" +#include "HepPDT/ParticleData.hh" +#include "HepPDT/ParticleDataTable.hh" //============================================= //======= TFCSHistoLateralShapeParametrization ========= @@ -43,11 +45,14 @@ void TFCSHistoLateralShapeParametrization::set_number_of_hits(float nhits) m_nhits=nhits; } -FCSReturnCode TFCSHistoLateralShapeParametrization::simulate_hit(Hit &hit, TFCSSimulationState &simulstate, const TFCSTruthState* /*truth*/, const TFCSExtrapolationState* extrapol) +FCSReturnCode TFCSHistoLateralShapeParametrization::simulate_hit(Hit &hit, TFCSSimulationState &simulstate, const TFCSTruthState* truth, const TFCSExtrapolationState* extrapol) { if (!simulstate.randomEngine()) { return FCSFatal; } + + const int pdgId = truth->pdgid(); + const double charge = HepPDT::ParticleID(pdgId).charge(); const int cs=calosample(); const double center_eta=0.5*( extrapol->eta(cs, CaloSubPos::SUBPOS_ENT) + extrapol->eta(cs, CaloSubPos::SUBPOS_EXT) ); @@ -84,8 +89,14 @@ FCSReturnCode TFCSHistoLateralShapeParametrization::simulate_hit(Hit &hit, TFCSS return FCSFatal; } - const float delta_eta_mm = r * cos(alpha); - const float delta_phi_mm = r * sin(alpha); + + float delta_eta_mm = r * cos(alpha); + float delta_phi_mm = r * sin(alpha); + + // Particles with negative eta are expected to have the same shape as those with positive eta after transformation: delta_eta --> -delta_eta + if(center_eta<0.)delta_eta_mm = -delta_eta_mm; + // Particle with negative charge are expected to have the same shape as positively charged particles after transformation: delta_phi --> -delta_phi + if(charge < 0.) delta_phi_mm = -delta_phi_mm; const float dist000 = TMath::Sqrt(center_r * center_r + center_z * center_z); const float eta_jakobi = TMath::Abs(2.0 * TMath::Exp(-center_eta) / (1.0 + TMath::Exp(-2 * center_eta))); diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSHistoLateralShapeParametrizationFCal.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSHistoLateralShapeParametrizationFCal.cxx index 430377069720f24e18a2df59e446d5fbe1e25ae0..19e521ca818ce91dbf0a5db56c6e9c680a0f98b0 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSHistoLateralShapeParametrizationFCal.cxx +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSHistoLateralShapeParametrizationFCal.cxx @@ -11,6 +11,9 @@ #include "TMath.h" +#include "HepPDT/ParticleData.hh" +#include "HepPDT/ParticleDataTable.hh" + //============================================= //======= TFCSHistoLateralShapeParametrizationFCal ========= @@ -25,19 +28,19 @@ TFCSHistoLateralShapeParametrizationFCal::~TFCSHistoLateralShapeParametrizationF { } -FCSReturnCode TFCSHistoLateralShapeParametrizationFCal::simulate_hit(Hit &hit, TFCSSimulationState &simulstate, const TFCSTruthState* /*truth*/, const TFCSExtrapolationState* extrapol) +FCSReturnCode TFCSHistoLateralShapeParametrizationFCal::simulate_hit(Hit &hit, TFCSSimulationState &simulstate, const TFCSTruthState* truth, const TFCSExtrapolationState* extrapol) { if (!simulstate.randomEngine()) { return FCSFatal; } + const int pdgId = truth->pdgid(); + const double charge = HepPDT::ParticleID(pdgId).charge(); + const int cs=calosample(); const double center_phi=0.5*( extrapol->phi(cs, CaloSubPos::SUBPOS_ENT) + extrapol->phi(cs, CaloSubPos::SUBPOS_EXT) ); const double center_r=0.5*( extrapol->r(cs, CaloSubPos::SUBPOS_ENT) + extrapol->r(cs, CaloSubPos::SUBPOS_EXT) ); const double center_z=0.5*( extrapol->z(cs, CaloSubPos::SUBPOS_ENT) + extrapol->z(cs, CaloSubPos::SUBPOS_EXT) ); - - const double center_x=center_r*cos(center_phi); - const double center_y=center_r*sin(center_phi); float alpha, r, rnd1, rnd2; rnd1 = CLHEP::RandFlat::shoot(simulstate.randomEngine()); @@ -64,10 +67,13 @@ FCSReturnCode TFCSHistoLateralShapeParametrizationFCal::simulate_hit(Hit &hit, T return FCSFatal; } - const float delta_x = r * cos(alpha); - const float delta_y = r * sin(alpha); + const float hit_r = r*cos(alpha) + center_r; + float delta_phi = r*sin(alpha)/center_r; + // Particle with negative charge are expected to have the same shape as positively charged particles after transformation: delta_phi --> -delta_phi + if(charge < 0.) delta_phi = -delta_phi; + const float hit_phi= delta_phi + center_phi; - hit.setXYZE(center_x+delta_x,center_y+delta_y,center_z,hit.E()); + hit.setXYZE(hit_r*cos(hit_phi),hit_r*sin(hit_phi),center_z,hit.E()); ATH_MSG_DEBUG("HIT: E="<<hit.E()<<" cs="<<cs<<" x="<<hit.x()<<" y="<<hit.y()<<" z="<<hit.z()<<" r=" << r <<" alpha="<<alpha);