12 #include "G4LogicalVolumeStore.hh"
31 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudgetForward initialized for "
32 << detTypes.size() <<
" detector types";
34 for (
unsigned int ii=0;
ii<detTypes.size(); ++
ii) {
36 <<
" with " << constituents[
ii] <<
", order "
37 << stackOrder[
ii] <<
" constituents --> ";
38 for (
int kk=0;
kk<constituents[
ii]; ++
kk) {
40 if (nc < detNames.size()) {
41 name = detNames[nc]; level = detLevels[nc]; ++nc;
44 << name <<
" at level " <<
level;
47 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudgetForward Stop condition for "
48 << etaRegions.size() <<
" eta regions";
49 for (
unsigned int ii=0;
ii<etaRegions.size(); ++
ii) {
51 << etaRegions[
ii] <<
" boundary type "
52 << regionTypes[
ii] <<
" limit "
63 const G4LogicalVolumeStore * lvs = G4LogicalVolumeStore::GetInstance();
64 std::vector<G4LogicalVolume *>::const_iterator lvcite;
67 for (
unsigned int ii=0;
ii<kount; ++
ii)
70 for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) {
72 if (strcmp(
detNames[
ii].c_str(),(*lvcite)->GetName().c_str()) == 0) {
78 if (kount <= 0)
break;
80 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudgetForward::Finds "
81 <<
detNames.size()-kount <<
" out of "
82 <<
detNames.size() <<
" LV addresses";
103 const G4Track * aTrack = (*trk)();
104 const G4ThreeVector& mom = aTrack->GetMomentum() ;
105 if (mom.theta() != 0 ) {
114 double theEnergy = aTrack->GetTotalEnergy();
115 int theID = (int)(aTrack->GetDefinition()->GetPDGEncoding());
116 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudgetHcalHistos: Track "
117 << aTrack->GetTrackID() <<
" Code " << theID
119 <<
" GeV; Eta " <<
eta <<
" Phi "
120 <<
phi/CLHEP::deg <<
" PT "
128 G4Material * material = aStep->GetPreStepPoint()->GetMaterial();
129 double step = aStep->GetStepLength();
130 double radl = material->GetRadlen();
131 double intl = material->GetNuclearInterLength();
133 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
134 unsigned int indx =
detTypes.size();
138 if (
detLevels[nc+
kk] <= (
int)((touch->GetHistoryDepth())+1)) {
139 int jj = (int)((touch->GetHistoryDepth())+1)-
detLevels[nc+
kk];
140 if ((touch->GetVolume(jj)->GetLogicalVolume()) ==
logVolumes[nc+
kk]) {
146 nc += (
unsigned int)(constituents[
ii]);
147 if (indx == ii)
break;
152 radLen[indx] += (step/radl);
153 intLen[indx] += (step/intl);
155 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudgetForward::Step in "
156 << touch->GetVolume(0)->GetLogicalVolume()->GetName()
157 <<
" Index " << indx <<
" Step " << step
158 <<
" RadL " << step/radl <<
" IntL "
163 G4Track* track = aStep->GetTrack();
164 track->SetTrackStatus( fStopAndKill );
179 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudgetForward::Add "
181 <<
" to " <<
jj <<
":"
210 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudgetForward::Volume[" << ii
211 <<
"]: " << name <<
" eta " <<
eta
212 <<
" == Step " <<
stepLen[
ii] <<
" RadL "
225 <<
"please add it to config file";
232 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudgetForward: Booking user "
233 <<
"histos === with " << binEta <<
" bins "
234 <<
"in eta from " << minEta <<
" to "
235 << maxEta <<
" and " << binPhi <<
" bins "
236 <<
"in phi from " << -maxPhi <<
" to "
242 if (
i >= (
int)(
detTypes.size())) named =
"Unknown";
244 sprintf(name,
"%d",
i+100);
245 sprintf(title,
"MB(X0) prof Eta in %s", named.c_str());
247 sprintf(name,
"%d",
i+200);
248 sprintf(title,
"MB(L0) prof Eta in %s", named.c_str());
250 sprintf(name,
"%d",
i+300);
251 sprintf(title,
"MB(Step) prof Eta in %s", named.c_str());
253 sprintf(name,
"%d",
i+400);
254 sprintf(title,
"Eta in %s", named.c_str());
256 sprintf(name,
"%d",
i+500);
257 sprintf(title,
"MB(X0) prof Eta Phi in %s", named.c_str());
259 binPhi/2, -maxPhi, maxPhi);
260 sprintf(name,
"%d",
i+600);
261 sprintf(title,
"MB(L0) prof Eta Phi in %s", named.c_str());
263 binPhi/2, -maxPhi, maxPhi);
264 sprintf(name,
"%d",
i+700);
265 sprintf(title,
"MB(Step) prof Eta Phi in %s", named.c_str());
267 binPhi/2, -maxPhi, maxPhi);
268 sprintf(name,
"%d",
i+800);
269 sprintf(title,
"Eta vs Phi in %s", named.c_str());
271 binPhi/2, -maxPhi, maxPhi);
274 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudgetForward: Booking user "
275 <<
"histos done ===";
281 G4ThreeVector hitPoint = aStep->GetPreStepPoint()->GetPosition();
282 if (aStep->GetPostStepPoint() != 0)
283 hitPoint = aStep->GetPostStepPoint()->GetPosition();
284 double rr = hitPoint.perp();
290 edm::LogInfo(
"MaterialBudget") <<
" MaterialBudgetForward::Eta " <<
eta
291 <<
" in Region[" <<
ii <<
"] with "
297 if (rr >= boundaries[ii]-0.001) flag =
true;
299 if (zz >= boundaries[ii]-0.001) flag =
true;
303 edm::LogInfo(
"MaterialBudget") <<
" MaterialBudgetForward::Stop after R = "
304 << rr <<
" and Z = " << zz;
310 edm::LogInfo(
"MaterialBudget") <<
" MaterialBudgetForward:: R = " << rr
311 <<
" and Z = " << zz <<
" Flag " <<
flag;
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
TProfile2D * me700[maxSet]
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 *)
This routine will be called when the appropriate signal arrives.
virtual ~MaterialBudgetForward()
std::vector< double > intLen
std::vector< double > stepLen
Abs< T >::type abs(const T &t)
std::vector< G4LogicalVolume * > logVolumes
std::vector< std::string > detNames
std::vector< int > constituents
bool stopAfter(const G4Step *)
void book(const edm::ParameterSet &)
std::vector< int > regionTypes
std::vector< double > boundaries
TProfile2D * me500[maxSet]
std::vector< std::string > detTypes