21 #include "G4StepPoint.hh"
22 #include "G4VPhysicalVolume.hh"
23 #include "G4ThreeVector.hh"
34 namespace BarrelCryostat {
42 , m_parameters(nullptr)
43 , m_defaultCalculator(
"CalibrationDefaultCalculator",
name)
54 return StatusCode::SUCCESS;
66 std::vector<G4double> & energies,
78 for (
unsigned int i=0;
i != 4;
i++) energies.push_back( 0. );
94 constexpr
double oneOverDeta = 10.;
95 constexpr
double oneOverDphi = 32./
M_PI;
97 constexpr
double rhoMinPresamplerMother = 1385.*
CLHEP::mm;
103 constexpr
double rhoAlignmentSafety = 10.*
CLHEP::mm;
104 constexpr
double rhoInFrontOfColdWall = rhoMinPresamplerMother - rhoAlignmentSafety;
106 constexpr
double RCUT12 = 1593.9*
CLHEP::mm;
107 constexpr
double RCUT23 = 1866.1*
CLHEP::mm;
109 static const double rhoOuterAccordionWithSafety = ROUT_AC - rhoAlignmentSafety;
112 static const double zMaxAccordionWithSafety = LArEMBZmax - 10.*
CLHEP::mm;
117 G4StepPoint* pre_step_point =
step->GetPreStepPoint();
118 G4StepPoint* post_step_point =
step->GetPostStepPoint();
120 G4ThreeVector startPoint = pre_step_point->GetPosition();
121 G4ThreeVector endPoint = post_step_point->GetPosition();
122 G4ThreeVector
p = (startPoint + endPoint) * 0.5;
124 G4double
rho =
p.perp();
125 G4double eta = fabs(
p.pseudoRapidity() );
126 G4double phi =
p.phi();
127 if ( phi < 0. ) phi += 2.*
M_PI;
130 G4int subdet = (
p.z() > 0.) ? 4 : -4;
131 G4int
phiBin = (
int) ( phi * oneOverDphi );
136 G4int
type = INT_MIN;
137 G4int sampling = INT_MIN;
138 G4int region = INT_MIN;
142 if(std::fabs(
p.z())< 10 && eta < 0.1 && rho > rhoMinPresamplerMother &&
rho < ROUT_AC )
151 if (
rho < RIN_AC ) { sampling = 0; }
152 else if (
rho < RCUT12 ) { sampling = 1; }
153 else if (
rho < RCUT23 ) { sampling = 2; }
154 else { sampling = 3; }
167 if (
rho < rhoInFrontOfColdWall )
179 else if (
rho < rhoMiddlePresampler )
189 else if (
rho < rhoOuterAccordionWithSafety &&
190 fabs(
p.z()) < zMaxAccordionWithSafety )
212 etaBin = (
int) ( (eta-1.) * oneOverDeta );
216 else if ( eta < 1.6 )
220 etaBin = (
int) ( (eta-1.5) * oneOverDeta );
222 else if ( eta < 1.8 )
226 etaBin = (
int) ( (eta-1.6) * oneOverDeta );
228 else if ( eta < 3.2 )
232 etaBin = (
int) ( (eta-1.8) * oneOverDeta );
243 if (
type == INT_MIN ||
245 sampling == INT_MIN ||
249 #if defined (DEBUG_VOLUMES) || defined (DEBUG_HITS)
250 constexpr G4int messageMax = 10;
251 static std::atomic<G4int> messageCount = 0;
252 if ( messageCount++ < messageMax )
254 std::cout <<
"LArG4::BarrelCryostat::CalibrationLArCalculator::Process"
255 <<
" (error " << messageCount <<
" of " << messageMax <<
" max displayed)"
257 <<
" G4Step in LAr at unexpected place: (x,y,z) [mm] = ("
262 <<
", phi=" << phi << std::endl
263 <<
" using default calculator"
285 std::cout <<
"LArG4::BarrelCryostat::CalibrationLArCalculator::Process"
288 <<
" energies=(" << energies[0]
289 <<
"," << energies[1]
290 <<
"," << energies[2]
291 <<
"," << energies[3] <<
")"