12 #include "G4LogicalVolumeStore.hh"
30 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudget initialized for "
31 << detTypes.size() <<
" detector types";
33 for (
unsigned int ii=0;
ii<detTypes.size(); ++
ii) {
35 <<
" with " << constituents[
ii] <<
", order "
36 << stackOrder[
ii] <<
" constituents --> ";
37 for (
int kk=0;
kk<constituents[
ii]; ++
kk) {
39 if (nc < detNames.size()) {
40 name = detNames[nc]; level = detLevels[nc]; ++nc;
43 << name <<
" at level " <<
level;
46 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudget Stop condition for "
47 << etaRegions.size() <<
" eta regions";
48 for (
unsigned int ii=0;
ii<etaRegions.size(); ++
ii) {
50 << etaRegions[
ii] <<
" boundary type "
51 << regionTypes[
ii] <<
" limit "
62 const G4LogicalVolumeStore * lvs = G4LogicalVolumeStore::GetInstance();
63 std::vector<G4LogicalVolume *>::const_iterator lvcite;
66 for (
unsigned int ii=0;
ii<kount; ++
ii)
69 for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) {
71 if (strcmp(
detNames[
ii].c_str(),(*lvcite)->GetName().c_str()) == 0) {
77 if (kount <= 0)
break;
79 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudget::Finds "
80 <<
detNames.size()-kount <<
" out of "
81 <<
detNames.size() <<
" LV addresses";
102 const G4Track * aTrack = (*trk)();
103 const G4ThreeVector& mom = aTrack->GetMomentum() ;
104 if (mom.theta() != 0 ) {
113 double theEnergy = aTrack->GetTotalEnergy();
114 int theID = (int)(aTrack->GetDefinition()->GetPDGEncoding());
115 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudgetHcalHistos: Track "
116 << aTrack->GetTrackID() <<
" Code " << theID
117 <<
" Energy " <<theEnergy/CLHEP::GeV
118 <<
" GeV; Eta " <<
eta <<
" Phi "
119 <<
phi/CLHEP::deg <<
" PT "
120 << mom.perp()/CLHEP::GeV <<
" GeV *****";
127 G4Material * material = aStep->GetPreStepPoint()->GetMaterial();
128 double step = aStep->GetStepLength();
129 double radl = material->GetRadlen();
130 double intl = material->GetNuclearInterLength();
132 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
133 unsigned int indx =
detTypes.size();
137 if (
detLevels[nc+
kk] <= (
int)((touch->GetHistoryDepth())+1)) {
138 int jj = (int)((touch->GetHistoryDepth())+1)-
detLevels[nc+
kk];
139 if ((touch->GetVolume(jj)->GetLogicalVolume()) ==
logVolumes[nc+
kk]) {
145 nc += (
unsigned int)(constituents[
ii]);
146 if (indx == ii)
break;
151 radLen[indx] += (step/radl);
152 intLen[indx] += (step/intl);
154 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudget::Step in "
155 << touch->GetVolume(0)->GetLogicalVolume()->GetName()
156 <<
" Index " << indx <<
" Step " << step
157 <<
" RadL " << step/radl <<
" IntL "
162 G4Track* track = aStep->GetTrack();
163 track->SetTrackStatus( fStopAndKill );
178 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudget::Add "
180 <<
" to " <<
jj <<
":"
206 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudget::Volume[" << ii
207 <<
"]: " << name <<
" eta " <<
eta
208 <<
" == Step " <<
stepLen[
ii] <<
" RadL "
221 <<
"please add it to config file";
228 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudget: Booking user "
229 <<
"histos === with " << binEta <<
" bins "
230 <<
"in eta from " << minEta <<
" to "
231 << maxEta <<
" and " << binPhi <<
" bins "
232 <<
"in phi from " << -maxPhi <<
" to "
238 if (
i >=
detTypes.size()) named =
"Unknown";
240 sprintf(name,
"%d",
i+100);
241 sprintf(title,
"MB(X0) prof Eta in %s", named.c_str());
242 me100.push_back(tfile->
make<TProfile>(name,title, binEta, minEta, maxEta));
243 sprintf(name,
"%d",
i+200);
244 sprintf(title,
"MB(L0) prof Eta in %s", named.c_str());
245 me200.push_back(tfile->
make<TProfile>(name,title, binEta, minEta, maxEta));
246 sprintf(name,
"%d",
i+300);
247 sprintf(title,
"MB(Step) prof Eta in %s", named.c_str());
248 me300.push_back(tfile->
make<TProfile>(name,title, binEta, minEta, maxEta));
249 sprintf(name,
"%d",
i+400);
250 sprintf(title,
"MB(X0) prof Phi in %s", named.c_str());
251 me400.push_back(tfile->
make<TProfile>(name,title, binPhi,-maxPhi, maxPhi));
252 sprintf(name,
"%d",
i+500);
253 sprintf(title,
"MB(L0) prof Phi in %s", named.c_str());
254 me500.push_back(tfile->
make<TProfile>(name,title, binPhi,-maxPhi, maxPhi));
255 sprintf(name,
"%d",
i+600);
256 sprintf(title,
"MB(Step) prof Phi in %s", named.c_str());
257 me600.push_back(tfile->
make<TProfile>(name,title, binPhi,-maxPhi, maxPhi));
260 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudget: Booking user "
261 <<
"histos done ===";
267 G4ThreeVector hitPoint = aStep->GetPreStepPoint()->GetPosition();
268 if (aStep->GetPostStepPoint() != 0)
269 hitPoint = aStep->GetPostStepPoint()->GetPosition();
270 double rr = hitPoint.perp();
277 <<
" in Region[" <<
ii <<
"] with "
283 if (rr >= boundaries[ii]-0.001) flag =
true;
285 if (zz >= boundaries[ii]-0.001) flag =
true;
289 edm::LogInfo(
"MaterialBudget") <<
" MaterialBudget::Stop after R = "
290 << rr <<
" and Z = " << zz;
296 edm::LogInfo(
"MaterialBudget") <<
" MaterialBudget:: R = " << rr
297 <<
" 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
virtual ~MaterialBudget()
std::vector< std::string > detNames
T * make(const Args &...args) const
make new ROOT object
std::vector< int > regionTypes
std::vector< double > stepLen
MaterialBudget(const edm::ParameterSet &)
std::vector< TProfile * > me600
std::vector< TProfile * > me100
void book(const edm::ParameterSet &)
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
void update(const BeginOfRun *)
This routine will be called when the appropriate signal arrives.
std::vector< int > constituents