163 G4double thisStepEnergyDeposit =
step->GetTotalEnergyDeposit() *
step->GetTrack()->GetWeight();
167 ATH_MSG_DEBUG(
"****** LArBarrelCalculator: Step energy,length "
168 << thisStepEnergyDeposit <<
" " << thisStepLength);
171 if(thisStepEnergyDeposit <= 0. || thisStepLength <= 0.)
180 G4StepPoint *thisStepPoint =
step->GetPreStepPoint();
181 G4StepPoint *thisStepBackPoint =
step->GetPostStepPoint();
182 G4ThreeVector startPoint = thisStepPoint->GetPosition();
183 G4ThreeVector endPoint = thisStepBackPoint->GetPosition();
187 << startPoint.x() <<
" " << startPoint.y() <<
" " << startPoint.z());
193 const G4NavigationHistory* g4navigation = thisStepPoint->GetTouchable()->GetHistory();
194 G4int ndep = g4navigation->GetDepth();
195 for (G4int ii=0;ii<=ndep;ii++) {
196 G4VPhysicalVolume* v1 = g4navigation->GetVolume(ii);
197 G4String vname = v1->GetName();
198 if ( vname.find(
"NegPhysical") != std::string::npos) zSide=-1;
205 const G4AffineTransform transformation =
206 thisStepPoint->GetTouchable()->GetHistory()->GetTopTransform();
208 G4ThreeVector startPointinLocal =
209 transformation.TransformPoint(startPoint);
210 G4ThreeVector endPointinLocal =
211 transformation.TransformPoint (endPoint);
215 << startPointinLocal.x() <<
" " << startPointinLocal.y() <<
" "
216 << startPointinLocal.z());
218 << endPointinLocal.x() <<
" " << endPointinLocal.y() <<
" "
219 << endPointinLocal.z());
222 G4double
energy =
step->GetTotalEnergyDeposit() *
step->GetTrack()->GetWeight();
225 const double EField = 10.;
226 const double wholeStepLengthCm =
step->GetStepLength() /
CLHEP::cm;
227 energy = (*m_birksLaw)(
energy, wholeStepLengthCm, EField);
238 G4double delta=1./((
double) nsub_step);
240 ATH_MSG_DEBUG(
" nsub_step,delta " << nsub_step <<
" " << delta);
247 for (G4int
i=0;
i<nsub_step;
i++) {
251 G4double fraction=(((G4double)
i)+0.5)*delta;
252 G4ThreeVector subinLocal=startPointinLocal*(1-fraction) + endPointinLocal*fraction;
253 G4double xloc = subinLocal.x();
254 G4double yloc = subinLocal.y();
255 G4double zloc = subinLocal.z();
256 G4double etaloc = subinLocal.pseudoRapidity();
257 G4double philoc = subinLocal.phi();
258 if(philoc<0.) philoc = philoc + 2.*
M_PI;
259 G4double radloc = sqrt( xloc*xloc + yloc*yloc );
262 << xloc <<
" " << yloc <<
" " << zloc);
275 if (currentCellData.
cellID == 0)
278 ATH_MSG_DEBUG(
"LArBarrelCalculator: Invalid hit CELLID == 0 ");
279 ATH_MSG_DEBUG(
"x,y,z local " << xloc <<
" " << yloc <<
" " << zloc);
280 ATH_MSG_DEBUG(
"radius " << radloc <<
" etaloc "<< etaloc <<
" philoc " << philoc);
284 G4int region = currentCellData.
region;
287 G4int sampling = currentCellData.
sampling;
292 if( sampling == 1 && region ==0 )
297 if( sampling == 1 && region ==1 )
309 ATH_MSG_DEBUG(
" region,side,sampling,eta,phi " << region <<
" " << zSide <<
" "
313 ATH_MSG_DEBUG(
" local coordinates " << currentCellData.
x0 <<
" " << currentCellData.
y0);
319 ATH_MSG_DEBUG(
" hit in absorber or electrode radius:" << radloc);
353 G4double Current_xt1,Current_xt2;
363 G4int nfold = currentCellData.
nfold;
364 G4double x0=currentCellData.
x0;
365 G4double y0=currentCellData.
y0;
366 if (x0<1500 || x0>1960 || y0>30 || y0<-30) {
370 G4double
rr = sqrt(x0*x0+y0*y0);
373 const CurrMap* mapOfCurrent(
nullptr);
377 x0 < m_accmap->GetXmax(nfold) &&
379 y0 < m_accmap->GetYmax(nfold) &&
380 (nfold != 13 || x0 < 1957.5) &&
381 (nfold>0 || x0 < 1504.6) ) {
385 ATH_MSG_DEBUG(
" Map for fold xmap,ymap " << nfold <<
" " << xmap <<
" " << ymap);
388 G4int sampMap = currentCellData.
sampMap;
394 ATH_MSG_WARNING(
" region,sampling,eta,fold " << region <<
" " << sampMap <<
" "
395 <<
etaMap <<
" " << nfold);
401 G4int nstraight = currentCellData.
nstraight;
402 if (nstraight%2==0)
n=22;
410 xmap = currentCellData.
xl;
413 if (nstraight==0) xmap = 0.5*(xmap+1.);
415 ATH_MSG_DEBUG(
" Map for straight xl,delec " << xmap <<
" " << ymap);
419 double current0,current1,current2;
421 mapOfCurrent->GetAll(xmap,ymap,&
gap,¤t0,¤t1,¤t2);
422 G4double gap2=std::fabs(currentCellData.
distElec)+std::fabs(currentCellData.
distAbs)
426 int ipm,ielec,ieta,iside;
429 ielec=currentCellData.
phiGap;
432 if(ielec < 0 ) ielec += 1024;
434 ieta=((
int) (etaloc*(1./0.2)));
437 if ((currentCellData.
distElec>0 && zSide==1)
438 || (currentCellData.
distElec<0 && zSide==-1) ) iside=1;
442 double hv=
m_hv[ipm][ielec][ieta][iside];
454 if (
gap>1
e-3 && gap2 >1
e-3) dgap=
gap/gap2-1;
465 if (!UseFold && std::fabs(currentCellData.
distElec)>2.1 && current0 < 0.1) {
468 <<
" str number " << currentCellData.
nstraight
469 <<
" sampling,eta " << sampling <<
" " <<
etaBin <<
" "
470 <<
" current/E " << current0);
481 if (fabs(etaloc-etaTrans) < 0.025) {
482 double x=std::fabs(zloc-radloc*sinh(etaTrans))/cosh(etaTrans);
483 double y=std::fabs(currentCellData.
distElec);
484 if ( x < m_etamap3->Xmax() ) {
487 Current = Current*resp;
498 double resp,xt0,xt1,xt2,deta;
502 &resp,&xt0,&xt1,&xt2);
504 ATH_MSG_DEBUG(
"hit in strip etaloc,etaBin,deta,delec,resp,xt0,xt1,xt2 "
505 << etaloc <<
" " <<
etaBin <<
" " << deta*1000 <<
" " << currentCellData.
distElec
506 <<
" " << resp <<
" " << xt0 <<
" " << xt1 <<
" " << xt2);
508 if (!InTrans) Current = Current*resp;
512 identifier_xt1.
clear();
513 identifier_xt1 << 4 << 1 << zSide << sampling << region << (
etaBin+1) <<
phiBin;
514 Current_xt1 = Current*xt1;
515 identifier_xt2.
clear();
516 identifier_xt2 << 4 << 1 << zSide << sampling << region << (
etaBin-1) <<
phiBin;
517 Current_xt2 = Current*xt2;
520 identifier_xt1.
clear();
521 identifier_xt1 << 4 << 1 << zSide << sampling << region << (
etaBin-1) <<
phiBin;
522 Current_xt1 = Current*xt1;
523 identifier_xt2.
clear();
524 identifier_xt2 << 4 << 1 << zSide << sampling << region << (
etaBin+1) <<
phiBin;
525 Current_xt2 = Current*xt2;
527 Current = Current*xt0;
530 else if (sampling==2 && !InTrans) {
535 ATH_MSG_DEBUG(
"hit in middle etaloc,etaBin,deta,delec,resp,xt0,xt1,xt2 "
536 << etaloc <<
" " <<
etaBin <<
" " << deta*1000 <<
" " << currentCellData.
distElec
539 Current = Current*resp;
550 for (
unsigned int i=0;
i<hdata.size();
i++) {
551 if (hdata[
i].
id==identifier2) {
552 hdata[
i].energy += Current;
553 hdata[
i].time +=
time*Current;
559 hdata.emplace_back(
LArHitData{identifier2,
time*Current, Current});
563 for (
unsigned int i=0;
i<hdata.size();
i++) {
564 if (hdata[
i].
id==identifier_xt1) {
565 hdata[
i].energy += Current_xt1;
566 hdata[
i].time +=
time*Current_xt1;
572 hdata.emplace_back(
LArHitData{identifier_xt1,
time*Current_xt1, Current_xt1});
575 for (
unsigned int i=0;
i<hdata.size();
i++) {
576 if (hdata[
i].
id==identifier_xt2) {
577 hdata[
i].energy += Current_xt2;
578 hdata[
i].time +=
time*Current_xt2;
584 hdata.emplace_back(
LArHitData{identifier_xt2,
time*Current_xt2, Current_xt2});
592 ATH_MSG_DEBUG(
"Number of hits for this step " << m_nhits <<
" "
597 for (
unsigned int i=0;
i<hdata.size();
i++) {
598 if (std::fabs(hdata[
i].
energy)>1
e-6) hdata[
i].time=hdata[
i].time/hdata[
i].energy;
599 else hdata[
i].time=0.;
606 if (hdata.size()>0)
return true;