CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 15 of file MaterialBudgetCastorHistos.cc.

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

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

Definition at line 35 of file MaterialBudgetCastorHistos.cc.

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

Member Function Documentation

void MaterialBudgetCastorHistos::book ( )
private

Definition at line 169 of file MaterialBudgetCastorHistos.cc.

References binEta, binPhi, etaHigh, etaLow, i, edm::Service< T >::isAvailable(), TFileDirectory::make(), maxEta, maxSet, me100, me1000, me1100, me1200, me200, me300, me400, me500, me600, me700, me800, me900, benchmark_cfg::minEta, mergeVDriftHistosByStation::name, pi, and indexGen::title.

Referenced by MaterialBudgetCastorHistos().

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

Definition at line 154 of file MaterialBudgetCastorHistos.cc.

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

Referenced by MaterialBudgetHcal::update().

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

Definition at line 254 of file MaterialBudgetCastorHistos.cc.

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

Referenced by fillEndTrack(), and fillPerStep().

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

Definition at line 70 of file MaterialBudgetCastorHistos.cc.

References fillHisto(), fillHistos, newFWLiteAna::found, g, id1, id2, intLen, intLength, testEve_cfg::level, LogDebug, matList, mergeVDriftHistosByStation::name, printSum, radLen, radLength, launcher::step, stepLen, and stepLength.

Referenced by MaterialBudgetHcal::update().

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

Definition at line 40 of file MaterialBudgetCastorHistos.cc.

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

Referenced by MaterialBudgetHcal::update().

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

Definition at line 48 of file MaterialBudgetCastorHistos.h.

Referenced by fillHisto(), and fillStartTrack().

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

Definition at line 48 of file MaterialBudgetCastorHistos.h.

Referenced by fillHisto(), and fillStartTrack().

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().