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

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

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

253  {
254 
255  int ii = 2*(id-1) + ix;
256  double etaAbs = eta;
257  if (eta < 0) {
258  etaAbs = -eta;
259  ii += 10;
260  }
261  LogDebug("MaterialBudget") << "MaterialBudgetCastorHistos:FillHisto called "
262  << "with index " << id << ":" << ix << ":" << ii
263  << " eta " << etaAbs << " (" << eta << ")"
264  << " integrated step " << stepLen << " X0 "
265  << 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 
284 }
#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  LogDebug("MaterialBudget") << name << " " << step << " " << matName
101  << " " << stepLen << " " << step/radl << " "
102  << radLen << " " << step/intl << " " << intLen;
103  } else {
104  LogDebug("MaterialBudget") << "MaterialBudgetCastorHistos: Step at " << name
105  << " Length " << step << " in " << matName
106  << " of density " << density << " g/cc;"
107  << " 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, LogDebug, 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  LogDebug("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 }
#define LogDebug(id)
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().