ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
G4UA::LengthIntegrator Class Referencefinal

A user action used to evaluate thickness of all detectors traversed by outgoing particles. More...

#include <LengthIntegrator.h>

Inheritance diagram for G4UA::LengthIntegrator:
Collaboration diagram for G4UA::LengthIntegrator:

Public Member Functions

 LengthIntegrator (const std::string &histSvcName, bool doHistos)
 Constructor takes the name of the histogram service as argument. More...
 
 LengthIntegrator (const LengthIntegrator &)=delete
 
LengthIntegratoroperator= (const LengthIntegrator &)=delete
 
virtual void BeginOfEventAction (const G4Event *) override
 Called at beginning of G4 event to cache some details about the current primary vertex and particle. More...
 
virtual void EndOfEventAction (const G4Event *) override
 Called at end of G4 event to finalize measurements and fill hists. More...
 
virtual void UserSteppingAction (const G4Step *) override
 Called at every particle step to accumulate thickness. More...
 

Private Member Functions

void fillNtuple ()
 
std::string getMaterialClassification (const std::string &name)
 
std::string getVolumeType (const std::string &s)
 
void addToDetThickMap (const std::string &, double, double)
 
void regAndFillHist (const std::string &, const std::pair< double, double > &)
 Setup one set of measurement hists for a detector name. More...
 
TProfile2D * getOrCreateProfile (const std::string &regName, const TString &histoname, const TString &xtitle, int nbinsx, float xmin, float xmax, const TString &ytitle, int nbinsy, float ymin, float ymax, const TString &ztitle)
 this method checks if a histo is on THsvc already and caches a local pointer to it if the histo is not present, it creates and registers it More...
 

Private Attributes

G4Pow * m_g4pow
 
TTree * m_tree
 
int m_genNPart = 0
 
float m_genEta = 0.0F
 
float m_genPhi = 0.0F
 
float m_genZ = 0.0F
 
float m_genR = 0.0F
 
float m_total_X0 = 0.0F
 
float m_total_L0 = 0.0F
 
std::vector< double > m_collected_X0
 
std::vector< double > m_collected_L0
 
std::vector< float > m_collected_hitr
 
std::vector< float > m_collected_hitx
 
std::vector< float > m_collected_hity
 
std::vector< float > m_collected_hitz
 
std::vector< float > m_collected_outhitr
 
std::vector< float > m_collected_outhitx
 
std::vector< float > m_collected_outhity
 
std::vector< float > m_collected_outhitz
 
std::vector< float > m_collected_density
 
std::vector< std::string > m_collected_material
 
std::vector< std::string > m_collected_volume
 
std::vector< std::string > m_collected_groupedmaterial
 
std::vector< std::string > m_collected_volumetype
 
bool m_splitModerator
 
bool m_splitPP1
 
ServiceHandle< ITHistSvc > m_hSvc
 Handle to the histogram service. More...
 
bool m_doHistos
 
double m_etaPrimary
 Cached eta of the current primary. More...
 
double m_phiPrimary
 Cached phi of the current primary. More...
 
std::map< std::string, std::pair< double, double > > m_detThickMap
 Map of detector thickness measurements for current event. More...
 
TProfile2D * m_rzProfRL
 Rad-length profile hist in R-Z. More...
 
std::map< std::string, TProfile * > m_etaMapRL
 Rad-length profile hist in eta. More...
 
std::map< std::string, TProfile * > m_phiMapRL
 Rad-length profile hist in phi. More...
 
TProfile2D * m_rzProfIL
 Int-length profile hist in R-Z. More...
 
std::map< std::string, TProfile * > m_etaMapIL
 Int-length profile hist in eta. More...
 
std::map< std::string, TProfile * > m_phiMapIL
 Int-length profile hist in phi. More...
 
std::map< std::string, TProfile2D *, std::less< std::string > > m_rzMapRL
 
std::map< std::string, TProfile2D *, std::less< std::string > > m_xyMapRL
 
std::map< std::string, TProfile2D *, std::less< std::string > > m_rzMapIL
 
std::map< std::string, TProfile2D *, std::less< std::string > > m_xyMapIL
 

Detailed Description

A user action used to evaluate thickness of all detectors traversed by outgoing particles.

This user action is currently used only in special runs with geantinos. Thickness is recorded in terms of both rad length and int length.

NOTE: the current design is safe for multi-threading, but not performant due to sharing of the histograms and excessive locking. If this action needs to be used in multi-threaded jobs, we can rewrite it so that each instance has its own copy of the histograms which get merged in finalization of the LengthIntegratorTool.

Definition at line 41 of file LengthIntegrator.h.

Constructor & Destructor Documentation

◆ LengthIntegrator() [1/2]

G4UA::LengthIntegrator::LengthIntegrator ( const std::string &  histSvcName,
bool  doHistos = false 
)

Constructor takes the name of the histogram service as argument.

Definition at line 100 of file LengthIntegrator.cxx.

101  : m_g4pow(0),
102  m_hSvc(histSvcName, "LengthIntegrator"),
103  m_doHistos(doHistos),
104  m_etaPrimary(0), m_phiPrimary(0),
105  m_rzProfRL(nullptr), m_rzProfIL(nullptr)
106  {
107  // Protect concurrent access to the non-thread-safe hist svc
108  std::lock_guard<std::mutex> lock(gHistSvcMutex);
109 
110 
111  if(m_doHistos){
112  // Register the RZ profiles. The other profiles need to wait until the end
113  // of the events as they are created only if used.
114  const char* radName = "/lengths/radLen/RZRadLen";
115  if(!getHist(m_hSvc, radName, m_rzProfRL)) {
116  m_rzProfRL = new TProfile2D("RZRadLen","RZRadLen",1000,-25000.,25000.,2000,0.,15000.);
117  regHist(m_hSvc, radName, m_rzProfRL);
118  }
119 
120  const char* intName = "/lengths/intLen/RZIntLen";
121  if(!getHist(m_hSvc, intName, m_rzProfIL)) {
122  m_rzProfIL = new TProfile2D("RZIntLen","RZIntLen",1000,-25000.,25000.,2000,0.,15000.);
123  regHist(m_hSvc, intName, m_rzProfIL);
124  }
125 
126  }
127  m_tree = new TTree( "TheLarch", "And now, the Larch" );
128  //Add Braches to the tree
129  //Particle properties
130  m_tree->Branch("genNPart", &m_genNPart, "genNPart/I");
131  m_tree->Branch("genEta", &m_genEta, "genEta/F");
132  m_tree->Branch("genPhi", &m_genPhi, "genPhi/F");
133  m_tree->Branch("genZ", &m_genZ, "genZ/F");
134  m_tree->Branch("genR", &m_genR, "genR/F");
135  m_tree->Branch("total_X0", &m_total_X0, "total_X0/F");
136  m_tree->Branch("total_L0", &m_total_L0, "total_L0/F");
137 
138 // m_tree->Branch("collected_sensitivehit", &m_collected_sensitivehit); //Vector
139 
140  m_tree->Branch("collected_X0", &m_collected_X0); //Vector
141  m_tree->Branch("collected_L0", &m_collected_L0); //Vector
142 
143  m_tree->Branch("collected_inhitr", &m_collected_hitr); //Vector
144  m_tree->Branch("collected_inhitz", &m_collected_hitz); //Vector
145  m_tree->Branch("collected_inhitx", &m_collected_hitx); //Vector
146  m_tree->Branch("collected_inhity", &m_collected_hity); //Vector
147 
148  m_tree->Branch("collected_outhitr", &m_collected_outhitr); //Vector
149  m_tree->Branch("collected_outhitz", &m_collected_outhitz); //Vector
150  m_tree->Branch("collected_outhitx", &m_collected_outhitx); //Vector
151  m_tree->Branch("collected_outhity", &m_collected_outhity); //Vector
152 
153  m_tree->Branch("collected_material", &m_collected_material); //Vector
154  m_tree->Branch("collected_density", &m_collected_density); //Vector
155  m_tree->Branch("collected_volume", &m_collected_volume); //Vector
156  m_tree->Branch("collected_groupedmaterial", &m_collected_groupedmaterial); //Vector
157  m_tree->Branch("collected_volumetype", &m_collected_volumetype); //Vector
158 
159  regTree(m_hSvc, "/lengths/TheLarch", m_tree );
160 
161  //find a good way to configure this?
162  m_splitModerator = true;
163  m_splitPP1 = true;
164 
165 
166  m_g4pow = G4Pow::GetInstance();
167 
168  }

◆ LengthIntegrator() [2/2]

G4UA::LengthIntegrator::LengthIntegrator ( const LengthIntegrator )
delete

Member Function Documentation

◆ addToDetThickMap()

void G4UA::LengthIntegrator::addToDetThickMap ( const std::string &  name,
double  thickstepRL,
double  thickstepIL 
)
private

Definition at line 516 of file LengthIntegrator.cxx.

517  {
518  auto it=m_detThickMap.find(name);
519  if(it!=m_detThickMap.end()){
520  (*it).second.first+=thickstepRL;
521  (*it).second.second+=thickstepIL;
522  } else {
523  m_detThickMap.insert(std::map<std::string,std::pair<double,double>,std::less<std::string> >::value_type( name, std::pair<double,double>( thickstepRL, thickstepIL) ) );
524  }
525  }

◆ BeginOfEventAction()

void G4UA::LengthIntegrator::BeginOfEventAction ( const G4Event *  event)
overridevirtual

Called at beginning of G4 event to cache some details about the current primary vertex and particle.

Also resets some measurements.

Definition at line 173 of file LengthIntegrator.cxx.

174  {
175  m_detThickMap.clear();
176  G4PrimaryVertex* vert = event->GetPrimaryVertex(0);
177  G4PrimaryParticle* part = vert->GetPrimary();
178  G4ThreeVector mom = part->GetMomentum();
179  m_etaPrimary = mom.eta();
180  m_phiPrimary = mom.phi();
181 
182  m_genEta = std::isfinite(mom.eta()) ? mom.eta() : -999;
183  m_genPhi = mom.phi();
184  m_genZ = vert->GetZ0();
185  m_genR = sqrt((vert->GetX0()*vert->GetX0())+(vert->GetY0()*vert->GetY0()));
186  m_genNPart++;
187 
188  m_total_X0 = 0;
189  m_total_L0 = 0;
190 
191 
192  }

◆ EndOfEventAction()

void G4UA::LengthIntegrator::EndOfEventAction ( const G4Event *  )
overridevirtual

Called at end of G4 event to finalize measurements and fill hists.

Definition at line 197 of file LengthIntegrator.cxx.

198  {
199  // Lazily protect this whole code from concurrent access
200  std::lock_guard<std::mutex> lock(gHistSvcMutex);
201 
202  if(m_doHistos){
203 
204  // Loop over volumes
205  for (const auto& it : m_detThickMap) {
206 
207  // If histos already exist, then fill them
208  if (m_etaMapRL.find(it.first) != m_etaMapRL.end()) {
209  m_etaMapRL[it.first]->Fill(m_etaPrimary, it.second.first, 1.);
210  m_phiMapRL[it.first]->Fill(m_phiPrimary, it.second.first, 1.);
211 
212  m_etaMapIL[it.first]->Fill(m_etaPrimary, it.second.second, 1.);
213  m_phiMapIL[it.first]->Fill(m_phiPrimary, it.second.second, 1.);
214  }
215  // New detector volume; register it
216  else {
217  regAndFillHist(it.first, it.second);
218  }
219 
220  } // Loop over detectors
221 
222  }
223 
224  fillNtuple();
225 
226  }

◆ fillNtuple()

void G4UA::LengthIntegrator::fillNtuple ( )
private

Definition at line 391 of file LengthIntegrator.cxx.

391  {
392 
393  m_tree->Fill();
394 
395 
396  //Clean vectors and such
397  m_collected_X0.clear();
398  m_collected_L0.clear();
399 
400  m_collected_hitr.clear();
401  m_collected_hitx.clear();
402  m_collected_hity.clear();
403  m_collected_hitz.clear();
404 
405  m_collected_outhitr.clear();
406  m_collected_outhitx.clear();
407  m_collected_outhity.clear();
408  m_collected_outhitz.clear();
409 
410  m_collected_material.clear();
411  m_collected_density.clear();
412  m_collected_volume.clear();
413 
415  m_collected_volumetype.clear();
416 
417  }

◆ getMaterialClassification()

std::string G4UA::LengthIntegrator::getMaterialClassification ( const std::string &  name)
private

Definition at line 229 of file LengthIntegrator.cxx.

230  {
231 
232  if((name.find("DM_Atlas_Air") != std::string::npos) || (name.find("DM_Atlas") != std::string::npos) ||
233  (name.find("pix::HEX") != std::string::npos)){
234  return "NONE";
235  }
236 
237  if((name.find("Silicon") != std::string::npos) || (name.find("SiMetal") != std::string::npos)){
238  return "ActiveSensors";
239  }
240 
241 
242  //These material categories and groupings are based on the ITk
243  //for other purposes these need to be different
244 
245  if(name.find("SCT_TiMetal_heat") != std::string::npos) return "HeatExchangers";
246  if(name.find("pix::HEX") != std::string::npos) return "HeatExchangers";
247  if(name.find("HeatExchangers") != std::string::npos) return "PP1"; // comment out this line to see the Heat Exchangers separately in the final plot
248 
249  //----HYBRID----:
250  if(name.find("matEC_Hybrid") != std::string::npos) return "StripChips"; //"Hybrid";
251  else if(name.find("matB_HybridPCB") != std::string::npos) return "StripChips"; //"Hybrid";
252  //----SERVICES----:
253  else if(name.find("matSV_Endcap") != std::string::npos) return "Services";
254  else if(name.find("matSV_Barrel") != std::string::npos) return "Services";
255  //----ADHESIVE----
256  else if(name.find("BoronNitrideEpoxy") != std::string::npos) return "SupportStructure"; //"Adhesive";
257  else if(name.find("SE4445") != std::string::npos) return "SupportStructure"; //"Adhesive";
258  //----SUPPORT STRUCTURE----
259  else if(name.find("Peek") != std::string::npos) return "SupportStructure";
260  else if(name.find("CFRP") != std::string::npos) return "SupportStructure";
261  else if(name.find("CFoam") != std::string::npos) return "SupportStructure";
262  else if(name.find("K13C2U") != std::string::npos) return "SupportStructure";
263  else if(name.find("K13D2U") != std::string::npos) return "SupportStructure";
264  else if(name.find("Rohacell110A") != std::string::npos) return "SupportStructure";
265  //----SUPPORT HONEYCOMB----
266  else if(name.find("Honeycomb10pcf") != std::string::npos) return "SupportStructure"; //"HoneyComb";
267  else if(name.find("Honeycomb2pcf") != std::string::npos) return "SupportStructure"; //"HoneyComb";
268  else if(name.find("Honeycomb3pcf") != std::string::npos) return "SupportStructure"; //"HoneyComb";
269  //----Copper----
270  else if(name.find("CuMetal") != std::string::npos) return "Services"; //"Copper";
271  else if(name.find("Copper") != std::string::npos) return "Services"; //"Copper";
272  //----Active Sensors---- (includes sensors, ABC and HCC chips)
273  else if(name.find("SiMetal") != std::string::npos) return "ActiveSensors";
274  //----Air----
275  else if(name.find("Air") != std::string::npos) return "Air";
276  else if(name.find("N2") != std::string::npos) return "Air";
277  //----Cooling----
278  else if(name.find("CO2Liquid") != std::string::npos) return "Cooling";
279  else if(name.find("k9Allcomp") != std::string::npos) return "Cooling";
280  else if(name.find("TiMetal") != std::string::npos) return "Cooling";
281  //----BusTape----
282  else if(name.find("Kapton") != std::string::npos) return "Services"; //"BusTape";
283  else if(name.find("matPetalBusKapton") != std::string::npos) return "Services"; //"BusTape";
284  //----closeouts and connectors----
285  else if(name.find("T300CF") != std::string::npos) return "Cooling"; //"CloseoutsAndConnectors";
286  else if(name.find("Torlon") != std::string::npos) return "Cooling"; //"CloseoutsAndConnectors";
287  //----strip chips----
288  else if(name.find("matDCDC") != std::string::npos) return "StripChips";
289  else if(name.find("matEOS") != std::string::npos) return "StripChips";
290  //else return "OtherSCT";
291 
292  // Older stuff
293  if(name.find("CO2") != std::string::npos) return "Cooling";
294  //if(name.find("BoronNitrideEpoxy") != std::string::npos) return "Cooling";
295  if(name.find("BoronNitrideEpoxy") != std::string::npos) return "SupportStructure";
296  if(name.find("FwdSpineOutBase") != std::string::npos) return "SupportStructure";
297  if(name.find("Rohacell") != std::string::npos) return "SupportStructure";
298  if(name.find("Honeycomb") != std::string::npos) return "SupportStructure";
299  if(name.find("matSV") != std::string::npos) return "Services";
300  if(name.find("matEOS") != std::string::npos) return "Services";
301  if(name.find("matDCDC") != std::string::npos) return "Services";
302  if(name.find("PCB") != std::string::npos) return "Services";
303 
304  if(name.find("N2") != std::string::npos) return "DryNitrogen";
305  if(name.find("TiMetal") != std::string::npos) return "Services";
306  if(name.find("CuMetal") != std::string::npos) return "Services";
307  if(name.find("Aluminium") != std::string::npos) return "BeamPipe";
308 
309  // Do you want to split cooling and services where possible?
310  if(name.find("Cooling") != std::string::npos) return "Services";
311 
312  if(name.find("Inconel") != std::string::npos) return "BeamPipe";
313  if(name.find("Aerogel") != std::string::npos) return "BeamPipe";
314  if(name.find("Beryllium") != std::string::npos) return "BeamPipe";
315  if(name.find("Getter") != std::string::npos) return "BeamPipe";
316  if(name.find("Vacuum") != std::string::npos) return "BeamPipe";
317 
318 
319  if(name.find("Iron") != std::string::npos) return "SupportStructure";
320  if(name.find("Peek") != std::string::npos) return "SupportStructure";
321  if(name.find("CFRP") != std::string::npos) return "SupportStructure";
322  if(name.find("CFoam") != std::string::npos) return "SupportStructure";
323  if(name.find("K13D2U") != std::string::npos) return "SupportStructure";
324  if(name.find("BoratedPolyethylene") != std::string::npos) return "Moderator";
325 
326 
327  if(name.find("TiMetal") != std::string::npos) return "Titanium";
328  if(name.find("CuMetal") != std::string::npos) return "Copper";
329 
330  if(name.find("Alpine") != std::string::npos) return "SupportStructure";
331 
332  if(name.find("Support") != std::string::npos) return "SupportStructure";
333  if(name.find("Carbon") != std::string::npos) return "SupportStructure";
334  if(name.find("Default") != std::string::npos) return "SupportStructure";
335  if(name.find("Moderator") != std::string::npos) return "Moderator";
336  if(name.find("Steel") != std::string::npos) return "Steel";
337  if(name.find("BarrelStrip") != std::string::npos) return "Services";
338  if(name.find("Brl") != std::string::npos) return "Services";
339  if(name.find("Svc") != std::string::npos) return "Services";
340  if(name.find("InnerIST") != std::string::npos) return "Services";
341  if(name.find("InnerPST") != std::string::npos) return "Services";
342  if(name.find("BarrelPixel") != std::string::npos) return "Services";
343  if(name.find("EndcapPixel") != std::string::npos) return "Services";
344  if(name.find("InnerPixel") != std::string::npos) return "Services";
345  if(name.find("OuterPixel") != std::string::npos) return "Services";
346  if(name.find("pix::Chip") != std::string::npos) return "PixelChips";
347  if(name.find("pix::Hybrid") != std::string::npos) return "PixelChips";
348  if(name.find("PP0") != std::string::npos) return "PP0";
349  if(name.find("PP1") != std::string::npos) return "PP1";
350 
351  if(name.find("PP0") != std::string::npos) return "PP1"; //Grouping PP0 and PP1
352 
353  if(name.find("PST") != std::string::npos) return "SupportStructure";
354  if(name.find("IST") != std::string::npos) return "SupportStructure";
355  if(name.find("Silicon") != std::string::npos) return "ActiveSensors";
356  if(name.find("Straw") != std::string::npos) return "ActiveSensors";
357  if(name.find("Diamond") != std::string::npos) return "ActiveSensors";
358  if(name.find("SiMetal") != std::string::npos) return "ActiveSensors";
359  if(name.find("Air") != std::string::npos) return "Air";
360 
361  //FIXME hack while we fix the air->nitrogen issue
362  if(name.find("DryNitrogen") != std::string::npos) return "Air";
363 
364  if(name.find("CurlyPipeMountain") != std::string::npos) return "SupportStructure";
365  if(name.find("Flange") != std::string::npos) return "SupportStructure";
366 
367  if(name.find("Pigtail") != std::string::npos) return "Services"; //Overwritten by some other statement...
368 
369  return "NONE";
370 
371  }

◆ getOrCreateProfile()

TProfile2D * G4UA::LengthIntegrator::getOrCreateProfile ( const std::string &  regName,
const TString &  histoname,
const TString &  xtitle,
int  nbinsx,
float  xmin,
float  xmax,
const TString &  ytitle,
int  nbinsy,
float  ymin,
float  ymax,
const TString &  ztitle 
)
private

this method checks if a histo is on THsvc already and caches a local pointer to it if the histo is not present, it creates and registers it

note that this should be called from a section protected by a mutex, since it talks to the THitSvc

Definition at line 489 of file LengthIntegrator.cxx.

489  {
490 
491  if(m_hSvc->exists(regName)){
492  TH2* histo=nullptr;
493  if(m_hSvc->getHist(regName,histo).isSuccess())
494  return dynamic_cast<TProfile2D*>(histo);
495  } else {
496  TProfile2D* result= new TProfile2D(histoname,histoname,nbinsx,xmin,xmax,nbinsy,ymin,ymax);
497  result->GetXaxis()->SetTitle(xtitle);
498  result->GetYaxis()->SetTitle(ytitle);
499  result->GetZaxis()->SetTitle(ztitle);
500 
501  if (m_hSvc && m_hSvc->regHist(regName,result).isFailure()){
502  //ATH_MSG_FATAL( "Registration of histogram " << rznameReg << " failed" );
503  throw GaudiException("Registration of histogram " + regName + " failed", "RegHistErr", StatusCode::FAILURE);
504  }
505  return result;
506  }
507 
508  // should never be here
509  G4cout<<"ERROR something went wrong in handling of THistSvc "<<regName <<" "<<histoname<<G4endl;
510  return nullptr;
511  }

◆ getVolumeType()

std::string G4UA::LengthIntegrator::getVolumeType ( const std::string &  s)
private

Definition at line 373 of file LengthIntegrator.cxx.

373  {
374 
375  std::string type = "";
376  if(m_splitModerator && ( s.find("Moderator") != std::string::npos || s.find("BoratedPolyethylene") != std::string::npos)) type = "Moderator";
377  else if(m_splitPP1 && ( s.find("PP0") != std::string::npos || s.find("PP1") != std::string::npos)) type = "PP1";
378  else{
379  auto colsPos = s.find("::");
380  if (colsPos != std::string::npos)
381  type = s.substr(0, colsPos);
382  else
383  type=s;
384  }
385 
386  return type;
387  }

◆ operator=()

LengthIntegrator& G4UA::LengthIntegrator::operator= ( const LengthIntegrator )
delete

◆ regAndFillHist()

void G4UA::LengthIntegrator::regAndFillHist ( const std::string &  detName,
const std::pair< double, double > &  thicks 
)
private

Setup one set of measurement hists for a detector name.

Definition at line 530 of file LengthIntegrator.cxx.

532  {
533  TProfile* profEtaRL = nullptr;
534  TProfile* profEtaIL = nullptr;
535  TProfile* profPhiRL = nullptr;
536  TProfile* profPhiIL = nullptr;
537 
538  auto pathEtaRL = "/lengths/radLen/" + detName + "_RL";
539  auto pathEtaIL = "/lengths/intLen/" + detName + "_IL";
540  auto pathPhiRL = "/lengths/radLen/" + detName + "Phi_RL";
541  auto pathPhiIL = "/lengths/intLen/" + detName + "Phi_IL";
542 
543  // Eta rad profile
544  if(!getHist(m_hSvc, pathEtaRL, profEtaRL)) {
545  const std::string name(detName+"_RL");
546  profEtaRL = new TProfile(name.c_str(), name.c_str(), 1000, -6., 6.);
547  profEtaRL->GetXaxis()->SetTitle("#eta");
548  profEtaRL->GetYaxis()->SetTitle("%X0");
549  regHist(m_hSvc, pathEtaRL, profEtaRL);
550  }
551  // Eta int profile
552  if(!getHist(m_hSvc, pathEtaIL, profEtaIL)) {
553  const std::string name(detName+"_IL");
554  profEtaIL = new TProfile(name.c_str(), name.c_str(), 1000, -6., 6.);
555  profEtaIL->GetXaxis()->SetTitle("#eta");
556  profEtaIL->GetYaxis()->SetTitle("#lambda");
557  regHist(m_hSvc, pathEtaIL, profEtaIL);
558  }
559  // Phi rad profile
560  if(!getHist(m_hSvc, pathPhiRL, profPhiRL)) {
561  const std::string name(detName+"Phi_RL");
562  profPhiRL = new TProfile(name.c_str(), name.c_str(), 500, -M_PI, M_PI);
563  profPhiRL->GetXaxis()->SetTitle("#phi");
564  profPhiRL->GetYaxis()->SetTitle("%X0");
565  regHist(m_hSvc, pathPhiRL, profPhiRL);
566  }
567  // Phi int profile
568  if(!getHist(m_hSvc, pathPhiIL, profPhiIL)) {
569  const std::string name(detName+"Phi_IL");
570  profPhiIL = new TProfile(name.c_str(), name.c_str(), 500, -M_PI, M_PI);
571  profPhiIL->GetXaxis()->SetTitle("#phi");
572  profPhiIL->GetYaxis()->SetTitle("#lambda");
573  regHist(m_hSvc, pathPhiIL, profPhiIL);
574  }
575 
576  m_etaMapRL[detName] = profEtaRL;
577  m_etaMapIL[detName] = profEtaIL;
578  m_phiMapRL[detName] = profPhiRL;
579  m_phiMapIL[detName] = profPhiIL;
580 
581  profEtaRL->Fill(m_etaPrimary, thicks.first, 1.);
582  profEtaIL->Fill(m_etaPrimary, thicks.second, 1.);
583  profPhiRL->Fill(m_phiPrimary, thicks.first, 1.);
584  profPhiIL->Fill(m_phiPrimary, thicks.second, 1.);
585  }

◆ UserSteppingAction()

void G4UA::LengthIntegrator::UserSteppingAction ( const G4Step *  aStep)
overridevirtual

Called at every particle step to accumulate thickness.

Definition at line 423 of file LengthIntegrator.cxx.

424  {
425 
426  const G4TouchableHistory* touchHist =
427  static_cast<const G4TouchableHistory*>(aStep->GetPreStepPoint()->GetTouchable());
428  G4LogicalVolume* lv = touchHist->GetVolume()->GetLogicalVolume();
429  G4ThreeVector hitPoint = aStep->GetPreStepPoint()->GetPosition();
430  G4ThreeVector endPoint = aStep->GetPostStepPoint()->GetPosition();
431  G4Material* mat = lv->GetMaterial();
432 
433  const std::string& volName = lv->GetName();
434  const std::string& matName = mat->GetName();
435 
436  double radl = mat->GetRadlen();
437  double intl = mat->GetNuclearInterLength();
438  double stepl = aStep->GetStepLength();
439  double density = mat->GetDensity()*CLHEP::cm3/CLHEP::gram;
440 
441  // FIXME: using DBL_MAX just ensures double overflow below.
442  double thickstepRL = radl != 0 ? stepl/radl : DBL_MAX;
443  double thickstepIL = intl != 0 ? stepl/intl : DBL_MAX;
444 
445  //Fill information for the step
446  m_collected_X0.push_back(thickstepRL);
447  m_collected_L0.push_back(thickstepIL);
448 
449  m_collected_material.push_back(matName);
450  m_collected_density.push_back(density);
451  m_collected_volume.push_back(volName);
452 
453  m_total_X0+=thickstepRL;
454  m_total_L0+=thickstepIL;
455 
456  m_collected_hitr.push_back(hitPoint.perp());
457  m_collected_hitz.push_back(hitPoint.z());
458  m_collected_hitx.push_back(hitPoint.x());
459  m_collected_hity.push_back(hitPoint.y());
460 
461  m_collected_outhitr.push_back(endPoint.perp());
462  m_collected_outhitz.push_back(endPoint.z());
463  m_collected_outhitx.push_back(endPoint.x());
464  m_collected_outhity.push_back(endPoint.y());
465 
466  std::string groupmaterial = getMaterialClassification(matName);
467 
468  std::string volumetype = getVolumeType(matName);
469 
470  m_collected_groupedmaterial.push_back(groupmaterial);
471  m_collected_volumetype.push_back(volumetype);
472 
473  if(m_doHistos){
474  // Protect concurrent histo filling
475  {
476  static std::mutex mutex_instance;
477  std::lock_guard<std::mutex> lock(mutex_instance);
478  m_rzProfRL->Fill( hitPoint.z() , hitPoint.perp() , thickstepRL , 1. );
479  m_rzProfIL->Fill( hitPoint.z() , hitPoint.perp() , thickstepIL , 1. );
480  m_rzProfRL->Fill( endPoint.z() , endPoint.perp() , thickstepRL , 1. );
481  m_rzProfIL->Fill( endPoint.z() , endPoint.perp() , thickstepIL , 1. );
482  }
483  }
484 
485  }

Member Data Documentation

◆ m_collected_density

std::vector<float> G4UA::LengthIntegrator::m_collected_density
private

Definition at line 95 of file LengthIntegrator.h.

◆ m_collected_groupedmaterial

std::vector<std::string> G4UA::LengthIntegrator::m_collected_groupedmaterial
private

Definition at line 99 of file LengthIntegrator.h.

◆ m_collected_hitr

std::vector<float> G4UA::LengthIntegrator::m_collected_hitr
private

Definition at line 85 of file LengthIntegrator.h.

◆ m_collected_hitx

std::vector<float> G4UA::LengthIntegrator::m_collected_hitx
private

Definition at line 86 of file LengthIntegrator.h.

◆ m_collected_hity

std::vector<float> G4UA::LengthIntegrator::m_collected_hity
private

Definition at line 87 of file LengthIntegrator.h.

◆ m_collected_hitz

std::vector<float> G4UA::LengthIntegrator::m_collected_hitz
private

Definition at line 88 of file LengthIntegrator.h.

◆ m_collected_L0

std::vector<double> G4UA::LengthIntegrator::m_collected_L0
private

Definition at line 83 of file LengthIntegrator.h.

◆ m_collected_material

std::vector<std::string> G4UA::LengthIntegrator::m_collected_material
private

Definition at line 96 of file LengthIntegrator.h.

◆ m_collected_outhitr

std::vector<float> G4UA::LengthIntegrator::m_collected_outhitr
private

Definition at line 90 of file LengthIntegrator.h.

◆ m_collected_outhitx

std::vector<float> G4UA::LengthIntegrator::m_collected_outhitx
private

Definition at line 91 of file LengthIntegrator.h.

◆ m_collected_outhity

std::vector<float> G4UA::LengthIntegrator::m_collected_outhity
private

Definition at line 92 of file LengthIntegrator.h.

◆ m_collected_outhitz

std::vector<float> G4UA::LengthIntegrator::m_collected_outhitz
private

Definition at line 93 of file LengthIntegrator.h.

◆ m_collected_volume

std::vector<std::string> G4UA::LengthIntegrator::m_collected_volume
private

Definition at line 97 of file LengthIntegrator.h.

◆ m_collected_volumetype

std::vector<std::string> G4UA::LengthIntegrator::m_collected_volumetype
private

Definition at line 100 of file LengthIntegrator.h.

◆ m_collected_X0

std::vector<double> G4UA::LengthIntegrator::m_collected_X0
private

Definition at line 82 of file LengthIntegrator.h.

◆ m_detThickMap

std::map<std::string, std::pair<double, double> > G4UA::LengthIntegrator::m_detThickMap
private

Map of detector thickness measurements for current event.

Definition at line 131 of file LengthIntegrator.h.

◆ m_doHistos

bool G4UA::LengthIntegrator::m_doHistos
private

Definition at line 123 of file LengthIntegrator.h.

◆ m_etaMapIL

std::map<std::string, TProfile*> G4UA::LengthIntegrator::m_etaMapIL
private

Int-length profile hist in eta.

Definition at line 145 of file LengthIntegrator.h.

◆ m_etaMapRL

std::map<std::string, TProfile*> G4UA::LengthIntegrator::m_etaMapRL
private

Rad-length profile hist in eta.

Definition at line 136 of file LengthIntegrator.h.

◆ m_etaPrimary

double G4UA::LengthIntegrator::m_etaPrimary
private

Cached eta of the current primary.

Definition at line 126 of file LengthIntegrator.h.

◆ m_g4pow

G4Pow* G4UA::LengthIntegrator::m_g4pow
private

Definition at line 66 of file LengthIntegrator.h.

◆ m_genEta

float G4UA::LengthIntegrator::m_genEta = 0.0F
private

Definition at line 73 of file LengthIntegrator.h.

◆ m_genNPart

int G4UA::LengthIntegrator::m_genNPart = 0
private

Definition at line 72 of file LengthIntegrator.h.

◆ m_genPhi

float G4UA::LengthIntegrator::m_genPhi = 0.0F
private

Definition at line 74 of file LengthIntegrator.h.

◆ m_genR

float G4UA::LengthIntegrator::m_genR = 0.0F
private

Definition at line 76 of file LengthIntegrator.h.

◆ m_genZ

float G4UA::LengthIntegrator::m_genZ = 0.0F
private

Definition at line 75 of file LengthIntegrator.h.

◆ m_hSvc

ServiceHandle<ITHistSvc> G4UA::LengthIntegrator::m_hSvc
private

Handle to the histogram service.

Definition at line 120 of file LengthIntegrator.h.

◆ m_phiMapIL

std::map<std::string, TProfile*> G4UA::LengthIntegrator::m_phiMapIL
private

Int-length profile hist in phi.

Definition at line 147 of file LengthIntegrator.h.

◆ m_phiMapRL

std::map<std::string, TProfile*> G4UA::LengthIntegrator::m_phiMapRL
private

Rad-length profile hist in phi.

Definition at line 138 of file LengthIntegrator.h.

◆ m_phiPrimary

double G4UA::LengthIntegrator::m_phiPrimary
private

Cached phi of the current primary.

Definition at line 128 of file LengthIntegrator.h.

◆ m_rzMapIL

std::map<std::string,TProfile2D*,std::less<std::string> > G4UA::LengthIntegrator::m_rzMapIL
private

Definition at line 153 of file LengthIntegrator.h.

◆ m_rzMapRL

std::map<std::string,TProfile2D*,std::less<std::string> > G4UA::LengthIntegrator::m_rzMapRL
private

Definition at line 150 of file LengthIntegrator.h.

◆ m_rzProfIL

TProfile2D* G4UA::LengthIntegrator::m_rzProfIL
private

Int-length profile hist in R-Z.

Definition at line 143 of file LengthIntegrator.h.

◆ m_rzProfRL

TProfile2D* G4UA::LengthIntegrator::m_rzProfRL
private

Rad-length profile hist in R-Z.

Definition at line 134 of file LengthIntegrator.h.

◆ m_splitModerator

bool G4UA::LengthIntegrator::m_splitModerator
private

Definition at line 102 of file LengthIntegrator.h.

◆ m_splitPP1

bool G4UA::LengthIntegrator::m_splitPP1
private

Definition at line 103 of file LengthIntegrator.h.

◆ m_total_L0

float G4UA::LengthIntegrator::m_total_L0 = 0.0F
private

Definition at line 80 of file LengthIntegrator.h.

◆ m_total_X0

float G4UA::LengthIntegrator::m_total_X0 = 0.0F
private

Definition at line 79 of file LengthIntegrator.h.

◆ m_tree

TTree* G4UA::LengthIntegrator::m_tree
private

Definition at line 69 of file LengthIntegrator.h.

◆ m_xyMapIL

std::map<std::string,TProfile2D*,std::less<std::string> > G4UA::LengthIntegrator::m_xyMapIL
private

Definition at line 154 of file LengthIntegrator.h.

◆ m_xyMapRL

std::map<std::string,TProfile2D*,std::less<std::string> > G4UA::LengthIntegrator::m_xyMapRL
private

Definition at line 151 of file LengthIntegrator.h.


The documentation for this class was generated from the following files:
G4UA::LengthIntegrator::m_etaMapIL
std::map< std::string, TProfile * > m_etaMapIL
Int-length profile hist in eta.
Definition: LengthIntegrator.h:145
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
G4UA::LengthIntegrator::m_splitPP1
bool m_splitPP1
Definition: LengthIntegrator.h:103
ymin
double ymin
Definition: listroot.cxx:63
G4UA::LengthIntegrator::m_collected_density
std::vector< float > m_collected_density
Definition: LengthIntegrator.h:95
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
get_generator_info.result
result
Definition: get_generator_info.py:21
G4UA::LengthIntegrator::m_collected_X0
std::vector< double > m_collected_X0
Definition: LengthIntegrator.h:82
G4UA::LengthIntegrator::m_detThickMap
std::map< std::string, std::pair< double, double > > m_detThickMap
Map of detector thickness measurements for current event.
Definition: LengthIntegrator.h:131
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
G4UA::LengthIntegrator::m_phiMapIL
std::map< std::string, TProfile * > m_phiMapIL
Int-length profile hist in phi.
Definition: LengthIntegrator.h:147
mat
GeoMaterial * mat
Definition: LArDetectorConstructionTBEC.cxx:55
skel.it
it
Definition: skel.GENtoEVGEN.py:396
cm3
#define cm3
G4UA::LengthIntegrator::m_genNPart
int m_genNPart
Definition: LengthIntegrator.h:72
M_PI
#define M_PI
Definition: ActiveFraction.h:11
python.SystemOfUnits.gram
int gram
Definition: SystemOfUnits.py:165
G4UA::LengthIntegrator::m_collected_volumetype
std::vector< std::string > m_collected_volumetype
Definition: LengthIntegrator.h:100
G4UA::LengthIntegrator::m_genZ
float m_genZ
Definition: LengthIntegrator.h:75
G4UA::LengthIntegrator::m_etaPrimary
double m_etaPrimary
Cached eta of the current primary.
Definition: LengthIntegrator.h:126
G4UA::LengthIntegrator::m_etaMapRL
std::map< std::string, TProfile * > m_etaMapRL
Rad-length profile hist in eta.
Definition: LengthIntegrator.h:136
G4UA::LengthIntegrator::m_genEta
float m_genEta
Definition: LengthIntegrator.h:73
G4UA::LengthIntegrator::m_collected_hitx
std::vector< float > m_collected_hitx
Definition: LengthIntegrator.h:86
G4UA::LengthIntegrator::regAndFillHist
void regAndFillHist(const std::string &, const std::pair< double, double > &)
Setup one set of measurement hists for a detector name.
Definition: LengthIntegrator.cxx:530
G4UA::LengthIntegrator::m_rzProfIL
TProfile2D * m_rzProfIL
Int-length profile hist in R-Z.
Definition: LengthIntegrator.h:143
G4UA::LengthIntegrator::m_genR
float m_genR
Definition: LengthIntegrator.h:76
ParticleGun_EoverP_Config.mom
mom
Definition: ParticleGun_EoverP_Config.py:63
G4UA::LengthIntegrator::m_hSvc
ServiceHandle< ITHistSvc > m_hSvc
Handle to the histogram service.
Definition: LengthIntegrator.h:120
G4UA::LengthIntegrator::getVolumeType
std::string getVolumeType(const std::string &s)
Definition: LengthIntegrator.cxx:373
xmin
double xmin
Definition: listroot.cxx:60
python.TrigEgammaMonitorHelper.TProfile
def TProfile(*args, **kwargs)
Definition: TrigEgammaMonitorHelper.py:81
G4UA::LengthIntegrator::m_total_X0
float m_total_X0
Definition: LengthIntegrator.h:79
G4UA::LengthIntegrator::m_rzProfRL
TProfile2D * m_rzProfRL
Rad-length profile hist in R-Z.
Definition: LengthIntegrator.h:134
G4UA::LengthIntegrator::m_collected_hity
std::vector< float > m_collected_hity
Definition: LengthIntegrator.h:87
G4UA::LengthIntegrator::m_collected_hitz
std::vector< float > m_collected_hitz
Definition: LengthIntegrator.h:88
G4UA::LengthIntegrator::m_splitModerator
bool m_splitModerator
Definition: LengthIntegrator.h:102
G4UA::LengthIntegrator::m_collected_outhitr
std::vector< float > m_collected_outhitr
Definition: LengthIntegrator.h:90
G4UA::LengthIntegrator::m_collected_outhitz
std::vector< float > m_collected_outhitz
Definition: LengthIntegrator.h:93
G4UA::LengthIntegrator::m_g4pow
G4Pow * m_g4pow
Definition: LengthIntegrator.h:66
G4UA::LengthIntegrator::m_collected_outhitx
std::vector< float > m_collected_outhitx
Definition: LengthIntegrator.h:91
PixelAthHitMonAlgCfg.histoname
string histoname
Definition: PixelAthHitMonAlgCfg.py:139
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
G4UA::LengthIntegrator::m_phiMapRL
std::map< std::string, TProfile * > m_phiMapRL
Rad-length profile hist in phi.
Definition: LengthIntegrator.h:138
G4UA::LengthIntegrator::m_collected_L0
std::vector< double > m_collected_L0
Definition: LengthIntegrator.h:83
module_driven_slicing.getHist
def getHist(name, makehist)
Definition: module_driven_slicing.py:121
G4UA::LengthIntegrator::m_doHistos
bool m_doHistos
Definition: LengthIntegrator.h:123
G4UA::LengthIntegrator::m_collected_outhity
std::vector< float > m_collected_outhity
Definition: LengthIntegrator.h:92
G4UA::LengthIntegrator::fillNtuple
void fillNtuple()
Definition: LengthIntegrator.cxx:391
G4UA::LengthIntegrator::m_total_L0
float m_total_L0
Definition: LengthIntegrator.h:80
G4UA::LengthIntegrator::m_tree
TTree * m_tree
Definition: LengthIntegrator.h:69
G4UA::LengthIntegrator::m_collected_material
std::vector< std::string > m_collected_material
Definition: LengthIntegrator.h:96
G4UA::LengthIntegrator::m_collected_groupedmaterial
std::vector< std::string > m_collected_groupedmaterial
Definition: LengthIntegrator.h:99
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
plotting.yearwise_efficiency.xtitle
string xtitle
Definition: yearwise_efficiency.py:32
G4UA::LengthIntegrator::m_collected_volume
std::vector< std::string > m_collected_volume
Definition: LengthIntegrator.h:97
xmax
double xmax
Definition: listroot.cxx:61
G4UA::LengthIntegrator::getMaterialClassification
std::string getMaterialClassification(const std::string &name)
Definition: LengthIntegrator.cxx:229
plotBeamSpotCompare.histo
histo
Definition: plotBeamSpotCompare.py:415
G4UA::LengthIntegrator::m_phiPrimary
double m_phiPrimary
Cached phi of the current primary.
Definition: LengthIntegrator.h:128
value_type
Definition: EDM_MasterSearch.h:11
python.LArCondContChannels.detName
detName
Definition: LArCondContChannels.py:665
ymax
double ymax
Definition: listroot.cxx:64
G4UA::LengthIntegrator::m_collected_hitr
std::vector< float > m_collected_hitr
Definition: LengthIntegrator.h:85
G4UA::LengthIntegrator::m_genPhi
float m_genPhi
Definition: LengthIntegrator.h:74