CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
MaterialBudgetCastorHistos Class Reference

#include <MaterialBudgetCastorHistos.h>

Public Member Functions

void fillEndTrack ()
 
void fillPerStep (const G4Step *)
 
void fillStartTrack (const G4Track *)
 
 MaterialBudgetCastorHistos (const edm::ParameterSet &p)
 
virtual ~MaterialBudgetCastorHistos ()
 

Private Member Functions

void book ()
 
void fillHisto (int id, int ix)
 

Private Attributes

int binEta
 
int binPhi
 
double eta_
 
double etaHigh
 
double etaLow
 
bool fillHistos
 
int id1
 
int id2
 
double intLen
 
std::vector< double > intLength
 
std::vector< std::string > matList
 
TProfile * me100 [maxSet]
 
TProfile2D * me1000 [maxSet]
 
TProfile2D * me1100 [maxSet]
 
TH2F * me1200 [maxSet]
 
TProfile * me200 [maxSet]
 
TProfile * me300 [maxSet]
 
TH1F * me400 [maxSet]
 
TProfile * me500 [maxSet]
 
TProfile * me600 [maxSet]
 
TProfile * me700 [maxSet]
 
TH1F * me800 [maxSet]
 
TProfile2D * me900 [maxSet]
 
double phi_
 
bool printSum
 
double radLen
 
std::vector< double > radLength
 
double stepLen
 
std::vector< double > stepLength
 
int steps
 

Static Private Attributes

static const int maxSet = 20
 

Detailed Description

Definition at line 17 of file MaterialBudgetCastorHistos.h.

Constructor & Destructor Documentation

◆ MaterialBudgetCastorHistos()

MaterialBudgetCastorHistos::MaterialBudgetCastorHistos ( const edm::ParameterSet p)

Definition at line 17 of file MaterialBudgetCastorHistos.cc.

References binEta, binPhi, book(), etaHigh, etaLow, fillHistos, AlCaHLTBitMon_ParallelJobs::p, pi, and printSum.

17  {
18  binEta = p.getUntrackedParameter<int>("NBinEta", 100);
19  binPhi = p.getUntrackedParameter<int>("NBinPhi", 180);
20  etaLow = p.getUntrackedParameter<double>("EtaLow", 5.0);
21  etaHigh = p.getUntrackedParameter<double>("EtaHigh", 7.0);
22  fillHistos = p.getUntrackedParameter<bool>("FillHisto", true);
23  printSum = p.getUntrackedParameter<bool>("PrintSummary", false);
24  edm::LogInfo("MaterialBudget") << "MaterialBudgetCastorHistos: FillHisto : " << fillHistos << " PrintSummary "
25  << printSum << " == Eta plot: NX " << binEta << " Range " << etaLow << " (" << -etaHigh
26  << ") : " << etaHigh << " (" << -etaLow << ") Phi plot: "
27  << "NX " << binPhi << " Range " << -pi << ":" << pi << " (Eta limit " << etaLow << ":"
28  << etaHigh << ")";
29  if (fillHistos)
30  book();
31 }
const Double_t pi
Log< level::Info, false > LogInfo

◆ ~MaterialBudgetCastorHistos()

MaterialBudgetCastorHistos::~MaterialBudgetCastorHistos ( )
virtual

Definition at line 33 of file MaterialBudgetCastorHistos.cc.

33  {
34  edm::LogInfo("MaterialBudget") << "MaterialBudgetCastorHistos: Save user "
35  << "histos ===";
36 }
Log< level::Info, false > LogInfo

Member Function Documentation

◆ book()

void MaterialBudgetCastorHistos::book ( )
private

Definition at line 166 of file MaterialBudgetCastorHistos.cc.

References binEta, binPhi, etaHigh, etaLow, mps_fire::i, razorScouting_cff::maxEta, HLT_2024v14_cff::maxPhi, maxSet, me100, me1000, me1100, me1200, me200, me300, me400, me500, me600, me700, me800, me900, EgHLTOffEleSelection_cfi::minEta, pi, AlCaHLTBitMon_QueryRunRegistry::string, compare::tfile, runGCPTkAlMap::title, and to_string().

Referenced by MaterialBudgetCastorHistos().

166  {
167  // Book histograms
169 
170  if (!tfile.isAvailable())
171  throw cms::Exception("BadConfig") << "MaterialBudgetCastorHistos: TFileService unavailable: "
172  << "please add it to config file";
173 
174  double maxPhi = pi;
175  edm::LogInfo("MaterialBudget") << "MaterialBudgetCastorHistos: Booking user "
176  << "histos === with " << binEta << " bins "
177  << "in eta from " << etaLow << " to " << etaHigh << " and " << binPhi << " bins "
178  << "in phi from " << -maxPhi << " to " << maxPhi;
179 
180  std::string tag1, tag2;
181  // total X0
182  for (int i = 0; i < maxSet; i++) {
183  double minEta = etaLow;
184  double maxEta = etaHigh;
185  int ireg = i;
186  if (i > 9) {
187  minEta = -etaHigh;
188  maxEta = -etaLow;
189  ireg -= 10;
190  tag2 = " (-ve Eta Side)";
191  } else {
192  tag2 = " (+ve Eta Side)";
193  }
194  if ((i % 2) == 0) {
195  ireg /= 2;
196  tag1 = " == Start";
197  } else {
198  ireg = (ireg - 1) / 2;
199  tag1 = " == End";
200  }
201  std::string title = std::to_string(ireg) + tag1 + tag2;
202  me100[i] = tfile->make<TProfile>(
203  std::to_string(i + 100).c_str(), ("MB(X0) prof Eta in region " + title).c_str(), binEta, minEta, maxEta);
204  me200[i] = tfile->make<TProfile>(
205  std::to_string(i + 200).c_str(), ("MB(L0) prof Eta in region " + title).c_str(), binEta, minEta, maxEta);
206  me300[i] = tfile->make<TProfile>(
207  std::to_string(i + 300).c_str(), ("MB(Step) prof Eta in region " + title).c_str(), binEta, minEta, maxEta);
208  me400[i] =
209  tfile->make<TH1F>(std::to_string(i + 400).c_str(), ("Eta in region " + title).c_str(), binEta, minEta, maxEta);
210  me500[i] = tfile->make<TProfile>(
211  std::to_string(i + 500).c_str(), ("MB(X0) prof Ph in region " + title).c_str(), binPhi, -maxPhi, maxPhi);
212  me600[i] = tfile->make<TProfile>(
213  std::to_string(i + 600).c_str(), ("MB(L0) prof Ph in region " + title).c_str(), binPhi, -maxPhi, maxPhi);
214  me700[i] = tfile->make<TProfile>(
215  std::to_string(i + 700).c_str(), ("MB(Step) prof Ph in region " + title).c_str(), binPhi, -maxPhi, maxPhi);
216  me800[i] =
217  tfile->make<TH1F>(std::to_string(i + 800).c_str(), ("Phi in region " + title).c_str(), binPhi, -maxPhi, maxPhi);
218  me900[i] = tfile->make<TProfile2D>(std::to_string(i + 900).c_str(),
219  ("MB(X0) prof Eta Phi in region " + title).c_str(),
220  binEta / 2,
221  minEta,
222  maxEta,
223  binPhi / 2,
224  -maxPhi,
225  maxPhi);
226  me1000[i] = tfile->make<TProfile2D>(std::to_string(i + 1000).c_str(),
227  ("MB(L0) prof Eta Phi in region " + title).c_str(),
228  binEta / 2,
229  minEta,
230  maxEta,
231  binPhi / 2,
232  -maxPhi,
233  maxPhi);
234  me1100[i] = tfile->make<TProfile2D>(std::to_string(i + 1100).c_str(),
235  ("MB(Step) prof Eta Phi in region " + title).c_str(),
236  binEta / 2,
237  minEta,
238  maxEta,
239  binPhi / 2,
240  -maxPhi,
241  maxPhi);
242  me1200[i] = tfile->make<TH2F>(std::to_string(i + 1200).c_str(),
243  ("Eta vs Phi in region " + title).c_str(),
244  binEta / 2,
245  minEta,
246  maxEta,
247  binPhi / 2,
248  -maxPhi,
249  maxPhi);
250  }
251 
252  edm::LogInfo("MaterialBudget") << "MaterialBudgetCastorHistos: Booking user "
253  << "histos done ===";
254 }
static std::string to_string(const XMLCh *ch)
const Double_t pi
Definition: tfile.py:1
Log< level::Info, false > LogInfo

◆ fillEndTrack()

void MaterialBudgetCastorHistos::fillEndTrack ( )

Definition at line 151 of file MaterialBudgetCastorHistos.cc.

References fillHisto(), fillHistos, id1, id2, cuy::ii, intLength, matList, printSum, radLength, and stepLength.

151  {
152  if (fillHistos) {
153  if (id1 != 0)
154  fillHisto(id1, 1);
155  if (id2 != 0)
156  fillHisto(id2, 1);
157  }
158  if (printSum) {
159  for (unsigned int ii = 0; ii < matList.size(); ii++) {
160  edm::LogInfo("MaterialBudget") << "MaterialBudgetCastorHistos: " << matList[ii] << "\t" << stepLength[ii] << "\t"
161  << radLength[ii] << "\t" << intLength[ii];
162  }
163  }
164 }
std::vector< std::string > matList
ii
Definition: cuy.py:589
Log< level::Info, false > LogInfo

◆ fillHisto()

void MaterialBudgetCastorHistos::fillHisto ( int  id,
int  ix 
)
private

Definition at line 256 of file MaterialBudgetCastorHistos.cc.

References eta_, etaHigh, etaLow, cuy::ii, intLen, ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::endcap::ix(), LogDebug, me100, me1000, me1100, me1200, me200, me300, me400, me500, me600, me700, me800, me900, phi_, radLen, and stepLen.

Referenced by fillEndTrack(), and fillPerStep().

256  {
257  int ii = 2 * (id - 1) + ix;
258  double etaAbs = eta_;
259  if (eta_ < 0) {
260  etaAbs = -eta_;
261  ii += 10;
262  }
263  LogDebug("MaterialBudget") << "MaterialBudgetCastorHistos:FillHisto "
264  << "called with index " << id << ":" << ix << ":" << ii << " eta " << etaAbs << " ("
265  << eta_ << ") integrated step " << stepLen << " X0 " << radLen << " Lamda " << intLen;
266 
267  me100[ii]->Fill(eta_, radLen);
268  me200[ii]->Fill(eta_, intLen);
269  me300[ii]->Fill(eta_, stepLen);
270  me400[ii]->Fill(eta_);
271 
272  if (etaAbs >= etaLow && etaAbs <= etaHigh) {
273  me500[ii]->Fill(phi_, radLen);
274  me600[ii]->Fill(phi_, intLen);
275  me700[ii]->Fill(phi_, stepLen);
276  me800[ii]->Fill(phi_);
277  }
278 
279  me900[ii]->Fill(eta_, phi_, radLen);
280  me1000[ii]->Fill(eta_, phi_, intLen);
281  me1100[ii]->Fill(eta_, phi_, stepLen);
282  me1200[ii]->Fill(eta_, phi_);
283 }
ii
Definition: cuy.py:589
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
#define LogDebug(id)

◆ fillPerStep()

void MaterialBudgetCastorHistos::fillPerStep ( const G4Step *  aStep)

Definition at line 64 of file MaterialBudgetCastorHistos.cc.

References fastSimProducer_cff::density, fillHisto(), fillHistos, newFWLiteAna::found, g, id1, id2, cuy::ii, intLen, intLength, personalPlayback::level, LogDebug, matList, Skims_PA_cff::name, hfnoseParametersInitialization_cfi::name2, printSum, radLen, radLength, stepLen, stepLength, and AlCaHLTBitMon_QueryRunRegistry::string.

64  {
65  G4Material* material = aStep->GetPreStepPoint()->GetMaterial();
66  double step = aStep->GetStepLength();
67  double radl = material->GetRadlen();
68  double intl = material->GetNuclearInterLength();
69  double density = material->GetDensity() / (g / cm3);
70 
71  int id1Old = id1;
72  int id2Old = id2;
73  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
74  std::string name = touch->GetVolume(0)->GetName();
75  const std::string& matName = material->GetName();
76  if (printSum) {
77  bool found = false;
78  for (unsigned int ii = 0; ii < matList.size(); ii++) {
79  if (matList[ii] == matName) {
80  stepLength[ii] += step;
81  radLength[ii] += (step / radl);
82  intLength[ii] += (step / intl);
83  found = true;
84  break;
85  }
86  }
87  if (!found) {
88  matList.push_back(matName);
89  stepLength.push_back(step);
90  radLength.push_back(step / radl);
91  intLength.push_back(step / intl);
92  }
93  edm::LogInfo("MaterialBudget") << "MaterialBudgetCastorHistos: " << name << " " << step << " " << matName << " "
94  << stepLen << " " << step / radl << " " << radLen << " " << step / intl << " "
95  << intLen;
96  } else {
97  edm::LogInfo("MaterialBudget") << "MaterialBudgetCastorHistos: Step at " << name << " Length " << step << " in "
98  << matName << " of density " << density << " g/cc; Radiation Length " << radl
99  << " mm;"
100  << " Interaction Length " << intl << " mm\n"
101  << " Position " << aStep->GetPreStepPoint()->GetPosition()
102  << " Cylindrical R " << aStep->GetPreStepPoint()->GetPosition().perp()
103  << " Length (so far) " << stepLen << " L/X0 " << step / radl << "/" << radLen
104  << " L/Lambda " << step / intl << "/" << intLen;
105  }
106 
107  int level = ((touch->GetHistoryDepth()) + 1);
108  std::string name1 = "XXXX", name2 = "XXXX";
109  if (level > 3)
110  name1 = touch->GetVolume(level - 4)->GetName();
111  if (level > 4)
112  name2 = touch->GetVolume(level - 5)->GetName();
113  if (name1 == "CAST") {
114  id1 = 1;
115  if (name2 == "CAEC")
116  id2 = 2;
117  else if (name2 == "CAHC")
118  id2 = 3;
119  else if (name2 == "CEDC")
120  id2 = 4;
121  else if (name2 == "CHDC")
122  id2 = 5;
123  else
124  id2 = 0;
125  } else {
126  id1 = id2 = 0;
127  }
128  LogDebug("MaterialBudget") << "MaterialBudgetCastorHistos: Level " << level << " Volume " << name1 << " and " << name2
129  << " ID1 " << id1 << " (" << id1Old << ") ID2 " << id2 << " (" << id2Old << ")";
130 
131  if (fillHistos) {
132  if (id1 != id1Old) {
133  if (id1 == 0)
134  fillHisto(id1Old, 1);
135  else
136  fillHisto(id1, 0);
137  }
138  if (id2 != id2Old) {
139  if (id2 == 0)
140  fillHisto(id2Old, 1);
141  else
142  fillHisto(id2, 0);
143  }
144  }
145 
146  stepLen += step;
147  radLen += step / radl;
148  intLen += step / intl;
149 }
std::vector< std::string > matList
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
ii
Definition: cuy.py:589
Log< level::Info, false > LogInfo
step
Definition: StallMonitor.cc:83
#define LogDebug(id)

◆ fillStartTrack()

void MaterialBudgetCastorHistos::fillStartTrack ( const G4Track *  aTrack)

Definition at line 38 of file MaterialBudgetCastorHistos.cc.

References DeadROC_duringRun::dir, eta_, id1, id2, createfilelist::int, intLen, intLength, matList, phi_, printSum, radLen, radLength, stepLen, stepLength, and steps.

38  {
39  id1 = id2 = steps = 0;
40  radLen = intLen = stepLen = 0;
41 
42  const G4ThreeVector& dir = aTrack->GetMomentum();
43  if (dir.theta() != 0) {
44  eta_ = dir.eta();
45  } else {
46  eta_ = -99;
47  }
48  phi_ = dir.phi();
49  double theEnergy = aTrack->GetTotalEnergy();
50  int theID = (int)(aTrack->GetDefinition()->GetPDGEncoding());
51 
52  if (printSum) {
53  matList.clear();
54  stepLength.clear();
55  radLength.clear();
56  intLength.clear();
57  }
58 
59  edm::LogInfo("MaterialBudget") << "MaterialBudgetCastorHistos: Track " << aTrack->GetTrackID() << " Code " << theID
60  << " Energy " << theEnergy / GeV << " GeV; Eta " << eta_ << " Phi " << phi_ / deg
61  << " PT " << dir.perp() / GeV << " GeV *****";
62 }
std::vector< std::string > matList
Log< level::Info, false > LogInfo

Member Data Documentation

◆ binEta

int MaterialBudgetCastorHistos::binEta
private

Definition at line 33 of file MaterialBudgetCastorHistos.h.

Referenced by book(), and MaterialBudgetCastorHistos().

◆ binPhi

int MaterialBudgetCastorHistos::binPhi
private

Definition at line 33 of file MaterialBudgetCastorHistos.h.

Referenced by book(), and MaterialBudgetCastorHistos().

◆ eta_

double MaterialBudgetCastorHistos::eta_
private

Definition at line 44 of file MaterialBudgetCastorHistos.h.

Referenced by fillHisto(), and fillStartTrack().

◆ etaHigh

double MaterialBudgetCastorHistos::etaHigh
private

Definition at line 34 of file MaterialBudgetCastorHistos.h.

Referenced by book(), fillHisto(), and MaterialBudgetCastorHistos().

◆ etaLow

double MaterialBudgetCastorHistos::etaLow
private

Definition at line 34 of file MaterialBudgetCastorHistos.h.

Referenced by book(), fillHisto(), and MaterialBudgetCastorHistos().

◆ fillHistos

bool MaterialBudgetCastorHistos::fillHistos
private

◆ id1

int MaterialBudgetCastorHistos::id1
private

Definition at line 42 of file MaterialBudgetCastorHistos.h.

Referenced by fillEndTrack(), fillPerStep(), and fillStartTrack().

◆ id2

int MaterialBudgetCastorHistos::id2
private

Definition at line 42 of file MaterialBudgetCastorHistos.h.

Referenced by fillEndTrack(), fillPerStep(), and fillStartTrack().

◆ intLen

double MaterialBudgetCastorHistos::intLen
private

Definition at line 43 of file MaterialBudgetCastorHistos.h.

Referenced by fillHisto(), fillPerStep(), and fillStartTrack().

◆ intLength

std::vector<double> MaterialBudgetCastorHistos::intLength
private

Definition at line 36 of file MaterialBudgetCastorHistos.h.

Referenced by fillEndTrack(), fillPerStep(), and fillStartTrack().

◆ matList

std::vector<std::string> MaterialBudgetCastorHistos::matList
private

Definition at line 35 of file MaterialBudgetCastorHistos.h.

Referenced by fillEndTrack(), fillPerStep(), and fillStartTrack().

◆ maxSet

const int MaterialBudgetCastorHistos::maxSet = 20
staticprivate

Definition at line 31 of file MaterialBudgetCastorHistos.h.

Referenced by book().

◆ me100

TProfile* MaterialBudgetCastorHistos::me100[maxSet]
private

Definition at line 39 of file MaterialBudgetCastorHistos.h.

Referenced by book(), and fillHisto().

◆ me1000

TProfile2D * MaterialBudgetCastorHistos::me1000[maxSet]
private

Definition at line 41 of file MaterialBudgetCastorHistos.h.

Referenced by book(), and fillHisto().

◆ me1100

TProfile2D * MaterialBudgetCastorHistos::me1100[maxSet]
private

Definition at line 41 of file MaterialBudgetCastorHistos.h.

Referenced by book(), and fillHisto().

◆ me1200

TH2F* MaterialBudgetCastorHistos::me1200[maxSet]
private

Definition at line 38 of file MaterialBudgetCastorHistos.h.

Referenced by book(), and fillHisto().

◆ me200

TProfile * MaterialBudgetCastorHistos::me200[maxSet]
private

Definition at line 39 of file MaterialBudgetCastorHistos.h.

Referenced by book(), and fillHisto().

◆ me300

TProfile * MaterialBudgetCastorHistos::me300[maxSet]
private

Definition at line 39 of file MaterialBudgetCastorHistos.h.

Referenced by book(), and fillHisto().

◆ me400

TH1F* MaterialBudgetCastorHistos::me400[maxSet]
private

Definition at line 37 of file MaterialBudgetCastorHistos.h.

Referenced by book(), and fillHisto().

◆ me500

TProfile* MaterialBudgetCastorHistos::me500[maxSet]
private

Definition at line 40 of file MaterialBudgetCastorHistos.h.

Referenced by book(), and fillHisto().

◆ me600

TProfile * MaterialBudgetCastorHistos::me600[maxSet]
private

Definition at line 40 of file MaterialBudgetCastorHistos.h.

Referenced by book(), and fillHisto().

◆ me700

TProfile * MaterialBudgetCastorHistos::me700[maxSet]
private

Definition at line 40 of file MaterialBudgetCastorHistos.h.

Referenced by book(), and fillHisto().

◆ me800

TH1F * MaterialBudgetCastorHistos::me800[maxSet]
private

Definition at line 37 of file MaterialBudgetCastorHistos.h.

Referenced by book(), and fillHisto().

◆ me900

TProfile2D* MaterialBudgetCastorHistos::me900[maxSet]
private

Definition at line 41 of file MaterialBudgetCastorHistos.h.

Referenced by book(), and fillHisto().

◆ phi_

double MaterialBudgetCastorHistos::phi_
private

Definition at line 44 of file MaterialBudgetCastorHistos.h.

Referenced by fillHisto(), and fillStartTrack().

◆ printSum

bool MaterialBudgetCastorHistos::printSum
private

◆ radLen

double MaterialBudgetCastorHistos::radLen
private

Definition at line 43 of file MaterialBudgetCastorHistos.h.

Referenced by fillHisto(), fillPerStep(), and fillStartTrack().

◆ radLength

std::vector<double> MaterialBudgetCastorHistos::radLength
private

Definition at line 36 of file MaterialBudgetCastorHistos.h.

Referenced by fillEndTrack(), fillPerStep(), and fillStartTrack().

◆ stepLen

double MaterialBudgetCastorHistos::stepLen
private

Definition at line 43 of file MaterialBudgetCastorHistos.h.

Referenced by fillHisto(), fillPerStep(), and fillStartTrack().

◆ stepLength

std::vector<double> MaterialBudgetCastorHistos::stepLength
private

Definition at line 36 of file MaterialBudgetCastorHistos.h.

Referenced by fillEndTrack(), fillPerStep(), and fillStartTrack().

◆ steps

int MaterialBudgetCastorHistos::steps
private

Definition at line 42 of file MaterialBudgetCastorHistos.h.

Referenced by fillStartTrack().