12 #include "G4LogicalVolumeStore.hh"
30 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudgetForward initialized for " << detTypes.size() <<
" detector types";
32 for (
unsigned int ii = 0;
ii < detTypes.size(); ++
ii) {
33 edm::LogInfo(
"MaterialBudget") <<
"Type[" <<
ii <<
"] : " << detTypes[
ii] <<
" with " << constituents[
ii]
34 <<
", order " << stackOrder[
ii] <<
" constituents --> ";
35 for (
int kk = 0;
kk < constituents[
ii]; ++
kk) {
38 if (nc < detNames.size()) {
40 level = detLevels[nc];
43 edm::LogInfo(
"MaterialBudget") <<
" Constituent[" <<
kk <<
"]: " << name <<
" at level " <<
level;
46 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudgetForward Stop condition for " << etaRegions.size() <<
" eta regions";
47 for (
unsigned int ii = 0;
ii < etaRegions.size(); ++
ii) {
48 edm::LogInfo(
"MaterialBudget") <<
"Region[" <<
ii <<
"] : Eta < " << etaRegions[
ii] <<
" boundary type "
49 << regionTypes[
ii] <<
" limit " << boundaries[
ii];
57 const G4LogicalVolumeStore* lvs = G4LogicalVolumeStore::GetInstance();
58 std::vector<G4LogicalVolume*>::const_iterator lvcite;
60 unsigned int kount =
detNames.size();
61 for (
unsigned int ii = 0;
ii < kount; ++
ii)
64 for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) {
66 if (strcmp(
detNames[
ii].c_str(), (*lvcite)->GetName().c_str()) == 0) {
75 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudgetForward::Finds " <<
detNames.size() - kount <<
" out of "
76 <<
detNames.size() <<
" LV addresses";
100 const G4Track* aTrack = (*trk)();
101 const G4ThreeVector& mom = aTrack->GetMomentum();
102 if (mom.theta() != 0) {
111 double theEnergy = aTrack->GetTotalEnergy();
112 int theID = (int)(aTrack->GetDefinition()->GetPDGEncoding());
113 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudgetHcalHistos: Track " << aTrack->GetTrackID() <<
" Code " << theID
114 <<
" Energy " << theEnergy / CLHEP::GeV <<
" GeV; Eta " <<
eta_ <<
" Phi "
115 <<
phi_ / CLHEP::deg <<
" PT " << mom.perp() / CLHEP::GeV <<
" GeV *****";
121 G4Material* material = aStep->GetPreStepPoint()->GetMaterial();
122 double step = aStep->GetStepLength();
123 double radl = material->GetRadlen();
124 double intl = material->GetNuclearInterLength();
126 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
127 unsigned int indx =
detTypes.size();
131 if (
detLevels[nc +
kk] <= (
int)((touch->GetHistoryDepth()) + 1)) {
132 int jj = (int)((touch->GetHistoryDepth()) + 1) -
detLevels[nc +
kk];
133 if ((touch->GetVolume(jj)->GetLogicalVolume()) ==
logVolumes[nc +
kk]) {
139 nc += (
unsigned int)(constituents[
ii]);
146 radLen[indx] += (step / radl);
147 intLen[indx] += (step / intl);
149 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudgetForward::Step in "
150 << touch->GetVolume(0)->GetLogicalVolume()->GetName() <<
" Index " << indx <<
" Step "
151 << step <<
" RadL " << step / radl <<
" IntL " << step / intl;
155 G4Track*
track = aStep->GetTrack();
156 track->SetTrackStatus(fStopAndKill);
196 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudgetForward::Volume[" << ii <<
"]: " << name <<
" eta " <<
eta_
208 <<
"please add it to config file";
215 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudgetForward: Booking user "
216 <<
"histos === with " << binEta <<
" bins "
217 <<
"in eta from " << minEta <<
" to " << maxEta <<
" and " << binPhi <<
" bins "
218 <<
"in phi from " << -maxPhi <<
" to " <<
maxPhi;
227 sprintf(name,
"%d",
i + 100);
228 sprintf(title,
"MB(X0) prof Eta in %s", named.c_str());
230 sprintf(name,
"%d",
i + 200);
231 sprintf(title,
"MB(L0) prof Eta in %s", named.c_str());
233 sprintf(name,
"%d",
i + 300);
234 sprintf(title,
"MB(Step) prof Eta in %s", named.c_str());
236 sprintf(name,
"%d",
i + 400);
237 sprintf(title,
"Eta in %s", named.c_str());
239 sprintf(name,
"%d",
i + 500);
240 sprintf(title,
"MB(X0) prof Eta Phi in %s", named.c_str());
242 sprintf(name,
"%d",
i + 600);
243 sprintf(title,
"MB(L0) prof Eta Phi in %s", named.c_str());
245 sprintf(name,
"%d",
i + 700);
246 sprintf(title,
"MB(Step) prof Eta Phi in %s", named.c_str());
248 sprintf(name,
"%d",
i + 800);
249 sprintf(title,
"Eta vs Phi in %s", named.c_str());
253 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudgetForward: Booking user "
254 <<
"histos done ===";
258 G4ThreeVector hitPoint = aStep->GetPreStepPoint()->GetPosition();
259 if (aStep->GetPostStepPoint() !=
nullptr)
260 hitPoint = aStep->GetPostStepPoint()->GetPosition();
261 double rr = hitPoint.perp();
267 edm::LogInfo(
"MaterialBudget") <<
" MaterialBudgetForward::Eta " <<
eta_ <<
" in Region[" <<
ii <<
"] with "
272 if (rr >= boundaries[ii] - 0.001)
275 if (zz >= boundaries[ii] - 0.001)
280 edm::LogInfo(
"MaterialBudget") <<
" MaterialBudgetForward::Stop after R = " << rr <<
" and Z = " << zz;
286 edm::LogInfo(
"MaterialBudget") <<
" MaterialBudgetForward:: R = " << rr <<
" and Z = " << zz <<
" Flag " << flag;
T getUntrackedParameter(std::string const &, T const &) const
TProfile2D * me700[maxSet]
std::vector< G4LogicalVolume * > logVolumes
MaterialBudgetForward(const edm::ParameterSet &)
T * make(const Args &...args) const
make new ROOT object
TProfile2D * me600[maxSet]
std::vector< double > etaRegions
std::vector< int > detLevels
std::vector< double > radLen
std::vector< int > stackOrder
void update(const BeginOfRun *) override
This routine will be called when the appropriate signal arrives.
std::vector< double > intLen
std::vector< double > stepLen
Abs< T >::type abs(const T &t)
std::vector< std::string > detNames
std::vector< int > constituents
Log< level::Info, false > LogInfo
bool stopAfter(const G4Step *)
T getParameter(std::string const &) const
void book(const edm::ParameterSet &)
std::vector< int > regionTypes
~MaterialBudgetForward() override
std::vector< double > boundaries
TProfile2D * me500[maxSet]
std::vector< std::string > detTypes