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 ( const edm::ParameterSet p)

Definition at line 17 of file MaterialBudgetCastorHistos.cc.

References binEta, binPhi, book(), etaHigh, etaLow, fillHistos, edm::ParameterSet::getUntrackedParameter(), pi, and printSum.

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

Definition at line 37 of file MaterialBudgetCastorHistos.cc.

37  {
38  edm::LogInfo("MaterialBudget") << "MaterialBudgetCastorHistos: Save user "
39  << "histos ===";
40 }

Member Function Documentation

void MaterialBudgetCastorHistos::book ( )
private

Definition at line 171 of file MaterialBudgetCastorHistos.cc.

References binEta, binPhi, etaHigh, etaLow, mps_fire::i, edm::Service< T >::isAvailable(), TFileService::make(), maxEta, MuonErrorMatrixAnalyzer_cfi::maxPhi, maxSet, me100, me1000, me1100, me1200, me200, me300, me400, me500, me600, me700, me800, me900, cutBasedElectronID_CSA14_50ns_V0_cff::minEta, pi, AlCaHLTBitMon_QueryRunRegistry::string, compare::tfile, and fftjetcommon_cfi::title.

Referenced by MaterialBudgetCastorHistos().

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

Definition at line 156 of file MaterialBudgetCastorHistos.cc.

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

Referenced by MaterialBudgetHcal::update().

156  {
157 
158  if (fillHistos) {
159  if (id1 != 0) fillHisto(id1, 1);
160  if (id2 != 0) fillHisto(id2, 1);
161  }
162  if (printSum) {
163  for (unsigned int ii=0; ii<matList.size(); ii++) {
164  edm::LogInfo("MaterialBudget") << matList[ii] << "\t" << stepLength[ii]
165  << "\t" << radLength[ii] << "\t"
166  << intLength[ii];
167  }
168  }
169 }
std::vector< std::string > matList
ii
Definition: cuy.py:588
void MaterialBudgetCastorHistos::fillHisto ( int  id,
int  ix 
)
private

Definition at line 245 of file MaterialBudgetCastorHistos.cc.

References eta, etaHigh, etaLow, cuy::ii, intLen, LogDebug, me100, me1000, me1100, me1200, me200, me300, me400, me500, me600, me700, me800, me900, phi, radLen, and stepLen.

Referenced by fillEndTrack(), and fillPerStep().

245  {
246 
247  int ii = 2*(id-1) + ix;
248  double etaAbs = eta;
249  if (eta < 0) {
250  etaAbs = -eta;
251  ii += 10;
252  }
253  LogDebug("MaterialBudget") << "MaterialBudgetCastorHistos:FillHisto "
254  << "called with index " << id << ":" << ix
255  << ":" << ii << " eta " << etaAbs << " ("
256  << eta << ") integrated step " << stepLen
257  << " X0 " << radLen << " Lamda " << intLen;
258 
259  me100[ii]->Fill(eta, radLen);
260  me200[ii]->Fill(eta, intLen);
261  me300[ii]->Fill(eta, stepLen);
262  me400[ii]->Fill(eta);
263 
264  if (etaAbs >= etaLow && etaAbs <= etaHigh) {
265  me500[ii]->Fill(phi, radLen);
266  me600[ii]->Fill(phi, intLen);
267  me700[ii]->Fill(phi, stepLen);
268  me800[ii]->Fill(phi);
269  }
270 
271  me900[ii]->Fill(eta, phi, radLen);
272  me1000[ii]->Fill(eta, phi, intLen);
273  me1100[ii]->Fill(eta, phi, stepLen);
274  me1200[ii]->Fill(eta, phi);
275 
276 }
#define LogDebug(id)
ii
Definition: cuy.py:588
void MaterialBudgetCastorHistos::fillPerStep ( const G4Step *  aStep)

Definition at line 72 of file MaterialBudgetCastorHistos.cc.

References fillHisto(), fillHistos, runEdmFileComparison::found, g, id1, id2, cuy::ii, intLen, intLength, hcalDigis_cfi::level, LogDebug, matList, dataset::name, printSum, radLen, radLength, stepLen, stepLength, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by MaterialBudgetHcal::update().

72  {
73 
74  G4Material * material = aStep->GetPreStepPoint()->GetMaterial();
75  double step = aStep->GetStepLength();
76  double radl = material->GetRadlen();
77  double intl = material->GetNuclearInterLength();
78  double density = material->GetDensity() / (g/cm3);
79 
80  int id1Old = id1;
81  int id2Old = id2;
82  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
83  std::string name = touch->GetVolume(0)->GetName();
84  std::string matName = material->GetName();
85  if (printSum) {
86  bool found = false;
87  for (unsigned int ii=0; ii<matList.size(); ii++) {
88  if (matList[ii] == matName) {
89  stepLength[ii] += step;
90  radLength[ii] += (step/radl);
91  intLength[ii] += (step/intl);
92  found = true;
93  break;
94  }
95  }
96  if (!found) {
97  matList.push_back(matName);
98  stepLength.push_back(step);
99  radLength.push_back(step/radl);
100  intLength.push_back(step/intl);
101  }
102  edm::LogInfo("MaterialBudget") << name << " " << step << " " << matName
103  << " " << stepLen << " " << step/radl << " "
104  << radLen << " " <<step/intl << " " <<intLen;
105  } else {
106  edm::LogInfo("MaterialBudget") << "MaterialBudgetCastorHistos: Step at "
107  << name << " Length " << step << " in "
108  << matName << " of density " << density
109  << " g/cc; Radiation Length " <<radl <<" mm;"
110  << " Interaction Length " << intl << " mm\n"
111  << " Position "
112  << aStep->GetPreStepPoint()->GetPosition()
113  << " Cylindrical R "
114  <<aStep->GetPreStepPoint()->GetPosition().perp()
115  << " Length (so far) " << stepLen << " L/X0 "
116  << step/radl << "/" << radLen << " L/Lambda "
117  << step/intl << "/" << intLen;
118  }
119 
120  int level = ((touch->GetHistoryDepth())+1);
121  std::string name1="XXXX", name2="XXXX";
122  if (level>3) name1 = touch->GetVolume(level-4)->GetName();
123  if (level>4) name2 = touch->GetVolume(level-5)->GetName();
124  if (name1 == "CAST") {
125  id1 = 1;
126  if (name2 == "CAEC") id2 = 2;
127  else if (name2 == "CAHC") id2 = 3;
128  else if (name2 == "CEDC") id2 = 4;
129  else if (name2 == "CHDC") id2 = 5;
130  else id2 = 0;
131  } else {
132  id1 = id2 = 0;
133  }
134  LogDebug("MaterialBudget") << "MaterialBudgetCastorHistos: Level " << level
135  << " Volume " << name1 << " and " << name2
136  << " ID1 " << id1 << " (" << id1Old << ") ID2 "
137  << id2 << " (" << id2Old << ")";
138 
139  if (fillHistos) {
140  if (id1 != id1Old) {
141  if (id1 == 0) fillHisto(id1Old, 1);
142  else fillHisto(id1, 0);
143  }
144  if (id2 != id2Old) {
145  if (id2 == 0) fillHisto(id2Old, 1);
146  else fillHisto(id2, 0);
147  }
148  }
149 
150  stepLen += step;
151  radLen += step/radl;
152  intLen += step/intl;
153 }
#define LogDebug(id)
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:588
step
void MaterialBudgetCastorHistos::fillStartTrack ( const G4Track *  aTrack)

Definition at line 42 of file MaterialBudgetCastorHistos.cc.

References dir, eta, GeV, id1, id2, createfilelist::int, intLen, intLength, matList, phi, printSum, radLen, radLength, stepLen, stepLength, and steps.

Referenced by MaterialBudgetHcal::update().

42  {
43 
44  id1 = id2 = steps = 0;
45  radLen = intLen = stepLen = 0;
46 
47  const G4ThreeVector& dir = aTrack->GetMomentum() ;
48  if (dir.theta() != 0 ) {
49  eta = dir.eta();
50  } else {
51  eta = -99;
52  }
53  phi = dir.phi();
54  double theEnergy = aTrack->GetTotalEnergy();
55  int theID = (int)(aTrack->GetDefinition()->GetPDGEncoding());
56 
57  if (printSum) {
58  matList.clear();
59  stepLength.clear();
60  radLength.clear();
61  intLength.clear();
62  }
63 
64  edm::LogInfo("MaterialBudget") << "MaterialBudgetCastorHistos: Track "
65  << aTrack->GetTrackID() << " Code " << theID
66  << " Energy " << theEnergy/GeV << " GeV; Eta "
67  << eta << " Phi " << phi/deg << " PT "
68  << dir.perp()/GeV << " GeV *****";
69 }
const double GeV
Definition: MathUtil.h:16
std::vector< std::string > matList
dbl *** dir
Definition: mlp_gen.cc:35

Member Data Documentation

int MaterialBudgetCastorHistos::binEta
private

Definition at line 37 of file MaterialBudgetCastorHistos.h.

Referenced by book(), and MaterialBudgetCastorHistos().

int MaterialBudgetCastorHistos::binPhi
private

Definition at line 37 of file MaterialBudgetCastorHistos.h.

Referenced by book(), and MaterialBudgetCastorHistos().

double MaterialBudgetCastorHistos::eta
private
double MaterialBudgetCastorHistos::etaHigh
private

Definition at line 38 of file MaterialBudgetCastorHistos.h.

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

double MaterialBudgetCastorHistos::etaLow
private

Definition at line 38 of file MaterialBudgetCastorHistos.h.

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

bool MaterialBudgetCastorHistos::fillHistos
private
int MaterialBudgetCastorHistos::id1
private

Definition at line 46 of file MaterialBudgetCastorHistos.h.

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

int MaterialBudgetCastorHistos::id2
private

Definition at line 46 of file MaterialBudgetCastorHistos.h.

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

double MaterialBudgetCastorHistos::intLen
private

Definition at line 47 of file MaterialBudgetCastorHistos.h.

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

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

Definition at line 40 of file MaterialBudgetCastorHistos.h.

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

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

Definition at line 39 of file MaterialBudgetCastorHistos.h.

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

const int MaterialBudgetCastorHistos::maxSet = 20
staticprivate

Definition at line 35 of file MaterialBudgetCastorHistos.h.

Referenced by book().

TProfile* MaterialBudgetCastorHistos::me100[maxSet]
private

Definition at line 43 of file MaterialBudgetCastorHistos.h.

Referenced by book(), and fillHisto().

TProfile2D * MaterialBudgetCastorHistos::me1000[maxSet]
private

Definition at line 45 of file MaterialBudgetCastorHistos.h.

Referenced by book(), and fillHisto().

TProfile2D * MaterialBudgetCastorHistos::me1100[maxSet]
private

Definition at line 45 of file MaterialBudgetCastorHistos.h.

Referenced by book(), and fillHisto().

TH2F* MaterialBudgetCastorHistos::me1200[maxSet]
private

Definition at line 42 of file MaterialBudgetCastorHistos.h.

Referenced by book(), and fillHisto().

TProfile * MaterialBudgetCastorHistos::me200[maxSet]
private

Definition at line 43 of file MaterialBudgetCastorHistos.h.

Referenced by book(), and fillHisto().

TProfile * MaterialBudgetCastorHistos::me300[maxSet]
private

Definition at line 43 of file MaterialBudgetCastorHistos.h.

Referenced by book(), and fillHisto().

TH1F* MaterialBudgetCastorHistos::me400[maxSet]
private

Definition at line 41 of file MaterialBudgetCastorHistos.h.

Referenced by book(), and fillHisto().

TProfile* MaterialBudgetCastorHistos::me500[maxSet]
private

Definition at line 44 of file MaterialBudgetCastorHistos.h.

Referenced by book(), and fillHisto().

TProfile * MaterialBudgetCastorHistos::me600[maxSet]
private

Definition at line 44 of file MaterialBudgetCastorHistos.h.

Referenced by book(), and fillHisto().

TProfile * MaterialBudgetCastorHistos::me700[maxSet]
private

Definition at line 44 of file MaterialBudgetCastorHistos.h.

Referenced by book(), and fillHisto().

TH1F * MaterialBudgetCastorHistos::me800[maxSet]
private

Definition at line 41 of file MaterialBudgetCastorHistos.h.

Referenced by book(), and fillHisto().

TProfile2D* MaterialBudgetCastorHistos::me900[maxSet]
private

Definition at line 45 of file MaterialBudgetCastorHistos.h.

Referenced by book(), and fillHisto().

double MaterialBudgetCastorHistos::phi
private
bool MaterialBudgetCastorHistos::printSum
private
double MaterialBudgetCastorHistos::radLen
private

Definition at line 47 of file MaterialBudgetCastorHistos.h.

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

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

Definition at line 40 of file MaterialBudgetCastorHistos.h.

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

double MaterialBudgetCastorHistos::stepLen
private

Definition at line 47 of file MaterialBudgetCastorHistos.h.

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

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

Definition at line 40 of file MaterialBudgetCastorHistos.h.

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

int MaterialBudgetCastorHistos::steps
private

Definition at line 46 of file MaterialBudgetCastorHistos.h.

Referenced by fillStartTrack().