56 std::vector<double>& energies,
68 for (
unsigned int i=0; i != 4; i++) energies.push_back( 0. );
84 constexpr double oneOverDeta = 10.;
85 constexpr double oneOverDphi = 32./
M_PI;
87 constexpr double rhoMinPresamplerMother = 1385.*CLHEP::mm;
88 constexpr double rhoMiddlePresampler = (1385.*CLHEP::mm + 1447.*CLHEP::mm)/2.;
93 constexpr double rhoAlignmentSafety = 10.*CLHEP::mm;
94 constexpr double rhoInFrontOfColdWall = rhoMinPresamplerMother - rhoAlignmentSafety;
95 static const double RIN_AC =
m_parameters->GetValue(
"LArEMBRadiusInnerAccordion");
96 constexpr double RCUT12 = 1593.9*CLHEP::mm;
97 constexpr double RCUT23 = 1866.1*CLHEP::mm;
98 static const double ROUT_AC =
m_parameters->GetValue(
"LArEMBRadiusOuterAccordion");
99 static const double rhoOuterAccordionWithSafety = ROUT_AC - rhoAlignmentSafety;
100 static const double LArEMBZmax =
m_parameters->GetValue(
"LArEMBZmax");
102 static const double zMaxAccordionWithSafety = LArEMBZmax - 10.*CLHEP::mm;
107 G4StepPoint* pre_step_point = step->GetPreStepPoint();
108 G4StepPoint* post_step_point = step->GetPostStepPoint();
110 G4ThreeVector startPoint = pre_step_point->GetPosition();
111 G4ThreeVector endPoint = post_step_point->GetPosition();
112 G4ThreeVector p = (startPoint + endPoint) * 0.5;
114 G4double rho = p.perp();
115 G4double
eta = fabs( p.pseudoRapidity() );
116 G4double
phi = p.phi();
120 G4int subdet = ( p.z() > 0.) ? 4 : -4;
121 G4int phiBin = (int) (
phi * oneOverDphi );
122 if (phiBin>63) phiBin=0;
126 G4int
type = INT_MIN;
127 G4int sampling = INT_MIN;
128 G4int region = INT_MIN;
129 G4int etaBin = INT_MIN;
132 if(std::fabs(p.z())< 10 &&
eta < 0.1 && rho > rhoMinPresamplerMother && rho < ROUT_AC )
141 if ( rho < RIN_AC ) { sampling = 0; }
142 else if ( rho < RCUT12 ) { sampling = 1; }
143 else if ( rho < RCUT23 ) { sampling = 2; }
144 else { sampling = 3; }
157 if ( rho < rhoInFrontOfColdWall )
167 etaBin = (int) (
eta * oneOverDeta );
169 else if ( rho < rhoMiddlePresampler )
177 etaBin = (int) (
eta * oneOverDeta );
179 else if ( rho < rhoOuterAccordionWithSafety &&
180 fabs( p.z()) < zMaxAccordionWithSafety )
188 etaBin = (int) (
eta * oneOverDeta );
197 etaBin = (int) (
eta * oneOverDeta );
202 etaBin = (int) ( (
eta-1.) * oneOverDeta );
206 else if (
eta < 1.6 )
210 etaBin = (int) ( (
eta-1.5) * oneOverDeta );
212 else if (
eta < 1.8 )
216 etaBin = (int) ( (
eta-1.6) * oneOverDeta );
218 else if (
eta < 3.2 )
222 etaBin = (int) ( (
eta-1.8) * oneOverDeta );
233 if (
type == INT_MIN ||
235 sampling == INT_MIN ||
239#if defined (DEBUG_VOLUMES) || defined (DEBUG_HITS)
240 constexpr G4int messageMax = 10;
241 static std::atomic<G4int> messageCount = 0;
242 if ( messageCount++ < messageMax )
244 std::cout <<
"LArG4::BarrelCryostat::CalibrationLArCalculator::Process"
245 <<
" (error " << messageCount <<
" of " << messageMax <<
" max displayed)"
247 <<
" G4Step in LAr at unexpected place: (x,y,z) [mm] = ("
248 << p.x()/CLHEP::mm <<
","
249 << p.y()/CLHEP::mm <<
","
252 <<
", phi=" <<
phi << std::endl
253 <<
" using default calculator"
274 G4double energy =
accumulate(energies.begin(),energies.end(),0.);
275 std::cout <<
"LArG4::BarrelCryostat::CalibrationLArCalculator::Process"
276 <<
" ID=" << std::string(identifier)
277 <<
" energy=" << energy
278 <<
" energies=(" << energies[0]
279 <<
"," << energies[1]
280 <<
"," << energies[2]
281 <<
"," << energies[3] <<
")"