Skip to content
Snippets Groups Projects
Commit 0c5b93bd authored by Vakhtang Tsulaia's avatar Vakhtang Tsulaia
Browse files

Merge branch 'cherry-pick-d87cba1d [formerly 02984203bb]-master' into 'master'

Sweeping !16320 from 21.0 to master.
21.0-FastCaloSim: Changed coordinates used for shower shapes simulation

See merge request atlas/athena!16599

Former-commit-id: bbcb253f
parents fc9747cf f6dab046
No related branches found
No related tags found
No related merge requests found
......@@ -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 )
......
......@@ -7,6 +7,7 @@
#include "ISF_FastCaloSimEvent/TFCSLateralShapeParametrizationHitBase.h"
#include "ISF_FastCaloSimEvent/TFCS2DFunctionHistogram.h"
#include "ISF_FastCaloSimEvent/TFCSTruthState.h"
class TH2;
......
......@@ -7,6 +7,7 @@
#include "ISF_FastCaloSimEvent/TFCSHistoLateralShapeParametrization.h"
#include "ISF_FastCaloSimEvent/TFCS2DFunctionHistogram.h"
#include "ISF_FastCaloSimEvent/TFCSTruthState.h"
class TH2;
......
......@@ -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)));
......
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment