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 173 of file MaterialBudgetCastorHistos.cc.

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

Referenced by MaterialBudgetCastorHistos().

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

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

Referenced by MaterialBudgetHcal::update().

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

Definition at line 247 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().

247  {
248 
249  int ii = 2*(id-1) + ix;
250  double etaAbs = eta;
251  if (eta < 0) {
252  etaAbs = -eta;
253  ii += 10;
254  }
255  LogDebug("MaterialBudget") << "MaterialBudgetCastorHistos:FillHisto "
256  << "called with index " << id << ":" << ix
257  << ":" << ii << " eta " << etaAbs << " ("
258  << eta << ") integrated step " << stepLen
259  << " X0 " << radLen << " Lamda " << intLen;
260 
261  me100[ii]->Fill(eta, radLen);
262  me200[ii]->Fill(eta, intLen);
263  me300[ii]->Fill(eta, stepLen);
264  me400[ii]->Fill(eta);
265 
266  if (etaAbs >= etaLow && etaAbs <= etaHigh) {
267  me500[ii]->Fill(phi, radLen);
268  me600[ii]->Fill(phi, intLen);
269  me700[ii]->Fill(phi, stepLen);
270  me800[ii]->Fill(phi);
271  }
272 
273  me900[ii]->Fill(eta, phi, radLen);
274  me1000[ii]->Fill(eta, phi, intLen);
275  me1100[ii]->Fill(eta, phi, stepLen);
276  me1200[ii]->Fill(eta, phi);
277 
278 }
#define LogDebug(id)
ii
Definition: cuy.py:590
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  const 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") << "MaterialBudgetCastorHistos: "
103  << name << " " << step << " " << matName
104  << " " << stepLen << " " << step/radl << " "
105  << radLen << " " <<step/intl << " " <<intLen;
106  } else {
107  edm::LogInfo("MaterialBudget") << "MaterialBudgetCastorHistos: Step at "
108  << name << " Length " << step << " in "
109  << matName << " of density " << density
110  << " g/cc; Radiation Length " <<radl <<" mm;"
111  << " Interaction Length " << intl << " mm\n"
112  << " Position "
113  << aStep->GetPreStepPoint()->GetPosition()
114  << " Cylindrical R "
115  <<aStep->GetPreStepPoint()->GetPosition().perp()
116  << " Length (so far) " << stepLen << " L/X0 "
117  << step/radl << "/" << radLen << " L/Lambda "
118  << step/intl << "/" << intLen;
119  }
120 
121  int level = ((touch->GetHistoryDepth())+1);
122  std::string name1="XXXX", name2="XXXX";
123  if (level>3) name1 = touch->GetVolume(level-4)->GetName();
124  if (level>4) name2 = touch->GetVolume(level-5)->GetName();
125  if (name1 == "CAST") {
126  id1 = 1;
127  if (name2 == "CAEC") id2 = 2;
128  else if (name2 == "CAHC") id2 = 3;
129  else if (name2 == "CEDC") id2 = 4;
130  else if (name2 == "CHDC") id2 = 5;
131  else id2 = 0;
132  } else {
133  id1 = id2 = 0;
134  }
135  LogDebug("MaterialBudget") << "MaterialBudgetCastorHistos: Level " << level
136  << " Volume " << name1 << " and " << name2
137  << " ID1 " << id1 << " (" << id1Old << ") ID2 "
138  << id2 << " (" << id2Old << ")";
139 
140  if (fillHistos) {
141  if (id1 != id1Old) {
142  if (id1 == 0) fillHisto(id1Old, 1);
143  else fillHisto(id1, 0);
144  }
145  if (id2 != id2Old) {
146  if (id2 == 0) fillHisto(id2Old, 1);
147  else fillHisto(id2, 0);
148  }
149  }
150 
151  stepLen += step;
152  radLen += step/radl;
153  intLen += step/intl;
154 }
#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:590
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().