12 #include "G4LogicalVolumeStore.hh" 25 public Observer<const BeginOfTrack*>,
37 void update(
const G4Step*)
override;
41 int findVolume(
const G4VTouchable* touch,
bool stop)
const;
56 nList_ = listNames_.size();
58 <<
"HGCalTBMB initialized for " << nList_ <<
" volumes";
62 <<
"Stop after " << stopZ_ <<
" or reaching volume " <<
stopName_;
67 <<
"please add it to config file";
70 for (
unsigned int i = 0;
i <=
nList_;
i++) {
72 sprintf(name,
"RadL%d",
i);
73 sprintf(title,
"MB(X0) for (%s)", named.c_str());
77 sprintf(name,
"IntL%d",
i);
78 sprintf(title,
"MB(L0) for (%s)", named.c_str());
82 sprintf(name,
"StepL%d",
i);
83 sprintf(title,
"MB(Step) for (%s)", named.c_str());
95 intLen_ = std::vector<double>(nList_ + 1, 0);
96 stepLen_ = std::vector<double>(nList_ + 1, 0);
99 const G4Track* aTrack = (*trk)();
100 const G4ThreeVector& mom = aTrack->GetMomentum();
101 double theEnergy = aTrack->GetTotalEnergy();
102 int theID = (
int)(aTrack->GetDefinition()->GetPDGEncoding());
104 <<
"MaterialBudgetHcalHistos: Track " << aTrack->GetTrackID() <<
" Code " 105 << theID <<
" Energy " << theEnergy /
CLHEP::GeV <<
" GeV; Momentum " 111 G4Material* material = aStep->GetPreStepPoint()->GetMaterial();
112 double step = aStep->GetStepLength();
113 double radl = material->GetRadlen();
114 double intl = material->GetNuclearInterLength();
116 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
121 radLen_[indx] += (step / radl);
122 intLen_[indx] += (step / intl);
129 <<
"HGCalTBMB::Step in " 130 << touch->GetVolume(0)->GetLogicalVolume()->GetName() <<
" Index " << indx
131 <<
" Step " << step <<
" RadL " << step / radl <<
" IntL " << step / intl;
135 G4Track*
track = aStep->GetTrack();
136 track->SetTrackStatus(fStopAndKill);
149 <<
"HGCalTBMB::Volume[" << ii <<
"]: " << name <<
" == Step " 157 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
158 G4ThreeVector hitPoint = aStep->GetPreStepPoint()->GetPosition();
159 if (aStep->GetPostStepPoint() !=
nullptr)
160 hitPoint = aStep->GetPostStepPoint()->GetPosition();
161 double zz = hitPoint.z();
166 <<
" HGCalTBMB::Name " << touch->GetVolume(0)->GetName() <<
" z " << zz
174 int level = (touch->GetHistoryDepth()) + 1;
178 if (strcmp(name.c_str(),
stopName_.c_str()) == 0) ivol = 0;
180 for (
unsigned int k = 0;
k <
nList_; ++
k) {
181 if (strcmp(name.c_str(),
listNames_[
k].c_str()) == 0) {
187 if (ivol >= 0)
break;
T getParameter(std::string const &) const
const HGCalTBMB & operator=(const HGCalTBMB &)=delete
#define DEFINE_SIMWATCHER(type)
T * make(const Args &...args) const
make new ROOT object
int findVolume(const G4VTouchable *touch, bool stop) const
bool stopAfter(const G4Step *)
std::vector< double > intLen_
std::vector< TH1D * > me100_
std::vector< TH1D * > me300_
void update(const BeginOfTrack *) override
This routine will be called when the appropriate signal arrives.
HGCalTBMB(const edm::ParameterSet &)
std::vector< TH1D * > me200_
std::vector< double > radLen_
std::vector< std::string > listNames_
std::vector< double > stepLen_