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 ) {
113 double theEnergy = aTrack->GetTotalEnergy();
114 int theID = (int)(aTrack->GetDefinition()->GetPDGEncoding());
115 LogDebug(
"MaterialBudget") <<
"MaterialBudgetHcalHistos: Track "
116 << aTrack->GetTrackID() <<
" Code " << theID
117 <<
" Energy " <<theEnergy/CLHEP::GeV<<
" GeV; Eta "
118 <<
eta <<
" Phi " <<
phi/CLHEP::deg <<
" PT "
119 << mom.perp()/CLHEP::GeV <<
" GeV *****";
125 G4Material * material = aStep->GetPreStepPoint()->GetMaterial();
126 double step = aStep->GetStepLength();
127 double radl = material->GetRadlen();
128 double intl = material->GetNuclearInterLength();
130 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
131 unsigned int indx =
detTypes.size();
135 if (
detLevels[nc+
kk] <= (
int)((touch->GetHistoryDepth())+1)) {
136 int jj = (int)((touch->GetHistoryDepth())+1)-
detLevels[nc+
kk];
137 if ((touch->GetVolume(jj)->GetLogicalVolume()) ==
logVolumes[nc+
kk]) {
143 nc += (
unsigned int)(constituents[
ii]);
144 if (indx == ii)
break;
149 radLen[indx] += (step/radl);
150 intLen[indx] += (step/intl);
151 LogDebug(
"MaterialBudget") <<
"MaterialBudgetForward::Step in "
152 << touch->GetVolume(0)->GetLogicalVolume()->GetName()
153 <<
" Index " << indx <<
" Step " << step <<
" RadL "
154 << step/radl <<
" IntL " << step/intl;
158 G4Track* track = aStep->GetTrack();
159 track->SetTrackStatus( fStopAndKill );
173 LogDebug(
"MaterialBudget") <<
"MaterialBudgetForward::Add " <<
kk
200 LogDebug(
"MaterialBudget") <<
"MaterialBudgetForward::Volume[" << ii
201 <<
"]: " << name <<
" == Step " <<
stepLen[
ii]
202 <<
" RadL " <<
radLen[
ii] <<
" IntL "
214 <<
"please add it to config file";
221 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudgetForward: Booking user "
222 <<
"histos === with " << binEta <<
" bins "
223 <<
"in eta from " << minEta <<
" to "
224 << maxEta <<
" and " << binPhi <<
" bins "
225 <<
"in phi from " << -maxPhi <<
" to "
231 if (
i >= (
int)(
detTypes.size())) named =
"Unknown";
233 sprintf(name,
"%d",
i+100);
234 sprintf(title,
"MB(X0) prof Eta in %s", named.c_str());
236 sprintf(name,
"%d",
i+200);
237 sprintf(title,
"MB(L0) prof Eta in %s", named.c_str());
239 sprintf(name,
"%d",
i+300);
240 sprintf(title,
"MB(Step) prof Eta in %s", named.c_str());
242 sprintf(name,
"%d",
i+400);
243 sprintf(title,
"Eta in %s", named.c_str());
245 sprintf(name,
"%d",
i+500);
246 sprintf(title,
"MB(X0) prof Eta Phi in %s", named.c_str());
248 binPhi/2, -maxPhi, maxPhi);
249 sprintf(name,
"%d",
i+600);
250 sprintf(title,
"MB(L0) prof Eta Phi in %s", named.c_str());
252 binPhi/2, -maxPhi, maxPhi);
253 sprintf(name,
"%d",
i+700);
254 sprintf(title,
"MB(Step) prof Eta Phi in %s", named.c_str());
256 binPhi/2, -maxPhi, maxPhi);
257 sprintf(name,
"%d",
i+800);
258 sprintf(title,
"Eta vs Phi in %s", named.c_str());
260 binPhi/2, -maxPhi, maxPhi);
263 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudgetForward: Booking user "
264 <<
"histos done ===";
270 G4ThreeVector hitPoint = aStep->GetPreStepPoint()->GetPosition();
271 if (aStep->GetPostStepPoint() != 0)
272 hitPoint = aStep->GetPostStepPoint()->GetPosition();
273 double rr = hitPoint.perp();
286 LogDebug(
"MaterialBudget") <<
" MaterialBudgetForward::Stop after R = "
287 << rr <<
" and Z = " << zz;
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