10 #include <phparameter/PHParameters.h>
33 #include <Geant4/G4Field.hh>
34 #include <Geant4/G4FieldManager.hh>
35 #include <Geant4/G4ParticleDefinition.hh>
36 #include <Geant4/G4PropagatorInField.hh>
37 #include <Geant4/G4ReferenceCountedHandle.hh>
38 #include <Geant4/G4Step.hh>
39 #include <Geant4/G4StepPoint.hh>
40 #include <Geant4/G4StepStatus.hh>
41 #include <Geant4/G4String.hh>
42 #include <Geant4/G4SystemOfUnits.hh>
43 #include <Geant4/G4ThreeVector.hh>
44 #include <Geant4/G4TouchableHandle.hh>
45 #include <Geant4/G4Track.hh>
46 #include <Geant4/G4TrackStatus.hh>
47 #include <Geant4/G4TransportationManager.hh>
48 #include <Geant4/G4Types.hh>
49 #include <Geant4/G4VPhysicalVolume.hh>
50 #include <Geant4/G4VTouchable.hh>
51 #include <Geant4/G4VUserTrackInformation.hh>
52 #include <Geant4/G4Transform3D.hh>
70 , m_Detector(detector)
72 , m_AbsorberHits(nullptr)
74 , m_Params(parameters)
75 , m_SaveHitContainer(nullptr)
76 , m_SaveShower(nullptr)
77 , m_SaveVolPre(nullptr)
78 , m_SaveVolPost(nullptr)
80 , m_SavePreStepStatus(-1)
81 , m_SavePostStepStatus(-1)
82 , m_EnableFieldCheckerFlag(m_Params->get_int_param(
"field_check"))
83 , m_IsActiveFlag(m_Params->get_int_param(
"active"))
84 , m_IsBlackHoleFlag(m_Params->get_int_param(
"blackhole"))
85 , m_NScintiPlates(m_Params->get_int_param(PHG4HcalDefs::
scipertwr) * m_Params->get_int_param(
"n_towers"))
86 , m_LightScintModelFlag(m_Params->get_int_param(
"light_scint_model"))
111 std::ostringstream mappingfilename;
112 const char* calibroot = getenv(
"CALIBRATIONROOT");
115 mappingfilename << calibroot;
119 std::cout <<
"no CALIBRATIONROOT environment variable" << std::endl;
123 mappingfilename <<
"/HCALOUT/tilemap/oHCALMaps092021.root";
124 TFile *
f =
new TFile(mappingfilename.str().data());
125 MapCorr = (TH2F *)f->Get(
"hCombinedMap");
127 std::cout <<
"ERROR: MapCorr is NULL" << std::endl;
165 layer_id = layer_tower.first;
166 tower_id = layer_tower.second;
190 bool geantino =
false;
215 cout <<
GetName() <<
": New Hit for " << endl;
221 <<
", current trackid: " << aTrack->
GetTrackID() << endl;
222 cout <<
"phys pre vol: " << volume->
GetName()
291 cout <<
GetName() <<
": hit was not created" << endl;
297 <<
", current trackid: " << aTrack->
GetTrackID() << endl;
298 cout <<
"phys pre vol: " << volume->
GetName()
308 cout <<
GetName() <<
": hits do not belong to the same track" << endl;
310 <<
", current trackid: " << aTrack->
GetTrackID()
351 float lx = (localPosition.
x()/
cm);
352 float lz = fabs(localPosition.
z()/
cm);
356 int lcz = (
int)(2.0*lz) + 1;
357 int lcx = (
int)(2.0*(lx+42.75)) + 1;
359 if( (lcx>=1) && (lcx<=
MapCorr->GetNbinsY()) &&
360 (lcz>=1) && (lcz<=
MapCorr->GetNbinsX()) ){
362 light_yield *= (double) (
MapCorr->GetBinContent(lcz, lcx));
380 cout <<
"applying cor: " << cor << endl;
454 string absorbernodename;
467 m_Hits = findNode::getClass<PHG4HitContainer>(topNode, hitnodename.c_str());
468 m_AbsorberHits = findNode::getClass<PHG4HitContainer>(topNode, absorbernodename.c_str());
473 std::cout <<
"PHG4OuterHcalSteppingAction::SetTopNode - unable to find " << hitnodename << std::endl;
479 cout <<
"PHG4HcalSteppingAction::SetTopNode - unable to find " << absorbernodename << endl;
489 static const string h_field_name =
"hOuterHcalField";
493 TH2F*
h =
new TH2F(h_field_name.c_str(),
"Magnetic field (Tesla) in HCal;X (cm);Y (cm)", 2400,
494 -300, 300, 2400, -300, 300);
498 cout <<
"PHG4OuterHcalSteppingAction::FieldChecker - make a histograme to check outer Hcal field map."
499 <<
" Saved to Fun4AllServer Histo with name " << h_field_name << endl;
502 TH2F*
h =
dynamic_cast<TH2F*
>(se->
getHisto(h_field_name));
517 globPosVec[0] = globPosition.
x();
518 globPosVec[1] = globPosition.
y();
519 globPosVec[2] = globPosition.
z();
522 const Int_t binx = h->GetXaxis()->FindBin(globPosVec[0] /
cm);
523 const Int_t biny = h->GetYaxis()->FindBin(globPosVec[1] /
cm);
525 if (h->GetBinContent(binx, binx) == 0)
530 assert(transportMgr);
534 assert(fFieldPropagator);
545 FieldValueVec[1], FieldValueVec[2]);
547 const double B = FieldValue.
mag() /
tesla;
549 h->SetBinContent(binx, biny, B);
551 cout <<
"PHG4OuterHcalSteppingAction::FieldChecker - "
553 <<
", " << biny <<
" := " << B <<
" Tesla @ x,y = " << globPosVec[0] /
cm
554 <<
"," << globPosVec[1] /
cm <<
" cm" << endl;