12 #include "G4LogicalVolumeStore.hh" 29 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudget initialized for " << detTypes.size() <<
" detector types";
31 for (
unsigned int ii = 0;
ii < detTypes.size(); ++
ii) {
32 edm::LogInfo(
"MaterialBudget") <<
"Type[" <<
ii <<
"] : " << detTypes[
ii] <<
" with " << constituents[
ii]
33 <<
", order " << stackOrder[
ii] <<
" constituents --> ";
34 for (
int kk = 0;
kk < constituents[
ii]; ++
kk) {
37 if (nc < detNames.size()) {
39 level = detLevels[nc];
42 edm::LogInfo(
"MaterialBudget") <<
" Constituent[" <<
kk <<
"]: " << name <<
" at level " <<
level;
45 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudget Stop condition for " << etaRegions.size() <<
" eta regions";
46 for (
unsigned int ii = 0;
ii < etaRegions.size(); ++
ii) {
47 edm::LogInfo(
"MaterialBudget") <<
"Region[" <<
ii <<
"] : Eta < " << etaRegions[
ii] <<
" boundary type " 48 << regionTypes[
ii] <<
" limit " << boundaries[
ii];
56 const G4LogicalVolumeStore* lvs = G4LogicalVolumeStore::GetInstance();
57 std::vector<G4LogicalVolume*>::const_iterator lvcite;
59 unsigned int kount =
detNames.size();
60 for (
unsigned int ii = 0;
ii < kount; ++
ii)
63 for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) {
65 if (strcmp(
detNames[
ii].c_str(), (*lvcite)->GetName().c_str()) == 0) {
99 const G4Track* aTrack = (*trk)();
100 const G4ThreeVector& mom = aTrack->GetMomentum();
101 if (mom.theta() != 0) {
110 double theEnergy = aTrack->GetTotalEnergy();
111 int theID = (
int)(aTrack->GetDefinition()->GetPDGEncoding());
112 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudgetHcalHistos: Track " << aTrack->GetTrackID() <<
" Code " << theID
113 <<
" Energy " << theEnergy /
CLHEP::GeV <<
" GeV; Eta " <<
eta_ <<
" Phi " 114 <<
phi_ / CLHEP::deg <<
" PT " << mom.perp() /
CLHEP::GeV <<
" GeV *****";
120 G4Material* material = aStep->GetPreStepPoint()->GetMaterial();
121 double step = aStep->GetStepLength();
122 double radl = material->GetRadlen();
123 double intl = material->GetNuclearInterLength();
125 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
126 unsigned int indx =
detTypes.size();
130 if (
detLevels[nc +
kk] <= (
int)((touch->GetHistoryDepth()) + 1)) {
132 if ((touch->GetVolume(jj)->GetLogicalVolume()) ==
logVolumes[nc +
kk]) {
138 nc += (
unsigned int)(constituents[
ii]);
145 radLen[indx] += (step / radl);
146 intLen[indx] += (step / intl);
148 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudget::Step in " << touch->GetVolume(0)->GetLogicalVolume()->GetName()
149 <<
" Index " << indx <<
" Step " << step <<
" RadL " << step / radl <<
" IntL " 154 G4Track*
track = aStep->GetTrack();
155 track->SetTrackStatus(fStopAndKill);
192 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudget::Volume[" << ii <<
"]: " << name <<
" eta " <<
eta_ <<
" == Step " 204 <<
"please add it to config file";
211 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudget: Booking user " 212 <<
"histos === with " << binEta <<
" bins " 213 <<
"in eta from " << minEta <<
" to " << maxEta <<
" and " << binPhi <<
" bins " 214 <<
"in phi from " << -maxPhi <<
" to " <<
maxPhi;
218 for (
unsigned int i = 0;
i <=
detTypes.size();
i++) {
223 sprintf(name,
"%d",
i + 100);
224 sprintf(title,
"MB(X0) prof Eta in %s", named.c_str());
225 me100.push_back(tfile->
make<TProfile>(name, title, binEta, minEta, maxEta));
226 sprintf(name,
"%d",
i + 200);
227 sprintf(title,
"MB(L0) prof Eta in %s", named.c_str());
228 me200.push_back(tfile->
make<TProfile>(name, title, binEta, minEta, maxEta));
229 sprintf(name,
"%d",
i + 300);
230 sprintf(title,
"MB(Step) prof Eta in %s", named.c_str());
231 me300.push_back(tfile->
make<TProfile>(name, title, binEta, minEta, maxEta));
232 sprintf(name,
"%d",
i + 400);
233 sprintf(title,
"MB(X0) prof Phi in %s", named.c_str());
234 me400.push_back(tfile->
make<TProfile>(name, title, binPhi, -maxPhi, maxPhi));
235 sprintf(name,
"%d",
i + 500);
236 sprintf(title,
"MB(L0) prof Phi in %s", named.c_str());
237 me500.push_back(tfile->
make<TProfile>(name, title, binPhi, -maxPhi, maxPhi));
238 sprintf(name,
"%d",
i + 600);
239 sprintf(title,
"MB(Step) prof Phi in %s", named.c_str());
240 me600.push_back(tfile->
make<TProfile>(name, title, binPhi, -maxPhi, maxPhi));
243 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudget: Booking user " 244 <<
"histos done ===";
248 G4ThreeVector hitPoint = aStep->GetPreStepPoint()->GetPosition();
249 if (aStep->GetPostStepPoint() !=
nullptr)
250 hitPoint = aStep->GetPostStepPoint()->GetPosition();
251 double rr = hitPoint.perp();
257 edm::LogInfo(
"MaterialBudget") <<
" MaterialBudget::Eta " <<
eta_ <<
" in Region[" <<
ii <<
"] with " 262 if (rr >= boundaries[ii] - 0.001)
265 if (zz >= boundaries[ii] - 0.001)
270 edm::LogInfo(
"MaterialBudget") <<
" MaterialBudget::Stop after R = " << rr <<
" and Z = " <<
zz;
276 edm::LogInfo(
"MaterialBudget") <<
" MaterialBudget:: R = " << rr <<
" and Z = " << zz <<
" Flag " <<
flag;
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::vector< TProfile * > me300
std::vector< int > detLevels
std::vector< double > intLen
std::vector< std::string > detNames
T * make(const Args &...args) const
make new ROOT object
std::vector< int > regionTypes
std::vector< double > stepLen
~MaterialBudget() override
MaterialBudget(const edm::ParameterSet &)
std::vector< TProfile * > me600
std::vector< TProfile * > me100
void book(const edm::ParameterSet &)
void update(const BeginOfRun *) override
This routine will be called when the appropriate signal arrives.
Abs< T >::type abs(const T &t)
bool stopAfter(const G4Step *)
std::vector< TProfile * > me400
std::vector< TProfile * > me200
std::vector< TProfile * > me500
std::vector< double > boundaries
std::vector< std::string > detTypes
std::vector< double > etaRegions
std::vector< int > stackOrder
std::vector< double > radLen
std::vector< G4LogicalVolume * > logVolumes
std::vector< int > constituents