11 std::vector<std::string> theFolders;
12 std::vector<std::string>::iterator
fit;
15 std::map<std::string, std::pair<TH1*, string> >::const_iterator mapit;
16 for (mapit = theMap.begin(); mapit != theMap.end(); mapit++) {
18 fit =
find(theFolders.begin(), theFolders.end(),
folder);
19 if (fit == theFolders.end()) {
20 theFolders.push_back(folder);
21 theFile->mkdir(folder.c_str());
23 theFile->cd((*mapit).second.second.c_str());
24 (*mapit).second.first->Write();
30 theFile->cd(
"recHits");
34 theFile->cd(
"Segments");
41 rHTree =
new TTree(
"rHPositions",
"Local and Global reconstructed positions for recHits");
42 segTree =
new TTree(
"segPositions",
"Local and Global reconstructed positions for segments");
45 rHTree->Branch(
"rHpos", &rHpos,
"endcap/I:station/I:ring/I:chamber/I:layer/I:localx/F:localy/F:globalx/F:globaly/F");
47 "segpos", &segpos,
"endcap/I:station/I:ring/I:chamber/I:layer/I:localx/F:localy/F:globalx/F:globaly/F");
79 theMap[
name] = std::pair<TH1*, string>(thePlot,
folder);
84 std::map<std::string, std::pair<TH1*, string> >::iterator it;
85 it = theMap.find(name);
86 if (it == theMap.end()) {
87 theMap[
name] = std::pair<TH1*, string>(
new TH1I(name.c_str(), title.c_str(), bins,
xmin,
xmax), folder);
90 theMap[
name].first->SetBinContent(bin, x);
95 std::map<std::string, std::pair<TH1*, string> >::iterator it;
96 it = theMap.find(name);
97 if (it == theMap.end()) {
98 theMap[
name] = std::pair<TH1*, string>(
new TH1I(name.c_str(), title.c_str(), bins,
xmin,
xmax), folder);
101 theMap[
name].first->Fill(x);
115 std::map<std::string, std::pair<TH1*, string> >::iterator it;
116 it = theMap.find(name);
117 if (it == theMap.end()) {
119 std::pair<TH1*, string>(
new TH2F(name.c_str(), title.c_str(), binsx,
xmin,
xmax, binsy,
ymin,
ymax), folder);
122 theMap[
name].first->Fill(x, y);
133 std::map<std::string, std::pair<TH1*, string> >::iterator it;
136 oss1 << name << endcap <<
id.station() <<
id.ring();
137 oss2 << title <<
" (ME " << endcap <<
id.station() <<
"/" <<
id.ring() <<
")";
140 it = theMap.find(name);
141 if (it == theMap.end()) {
142 theMap[
name] = std::pair<TH1*, string>(
new TH1F(name.c_str(), title.c_str(), bins,
xmin,
xmax), folder);
145 theMap[
name].first->Fill(x);
166 std::map<std::string, std::pair<TH1*, string> >::iterator it;
169 oss1 << name << endcap <<
id.station() <<
id.ring();
170 oss2 << title <<
" (ME " << endcap <<
id.station() <<
"/" <<
id.ring() <<
")";
173 it = theMap.find(name);
174 if (it == theMap.end()) {
176 std::pair<TH1*, string>(
new TH2F(name.c_str(), title.c_str(), binsx,
xmin,
xmax, binsy,
ymin,
ymax), folder);
179 theMap[
name].first->Fill(x, y);
184 int crate = crate_lookup(
id);
186 map<string, pair<TH1*, string> >::iterator it;
189 oss1 << name <<
"_crate_" << crate;
190 oss2 << title <<
" (crate " << crate <<
")";
193 it = theMap.find(name);
194 if (it == theMap.end()) {
195 theMap[
name] = pair<TH1*, string>(
new TH1F(name.c_str(), title.c_str(), bins,
xmin,
xmax), folder);
198 theMap[
name].first->Fill(x);
213 int crate = crate_lookup(
id);
215 map<string, pair<TH1*, string> >::iterator it;
218 oss1 << name <<
"_crate_" << crate;
219 oss2 << title <<
" (crate " << crate <<
")";
222 it = theMap.find(name);
223 if (it == theMap.end()) {
225 pair<TH1*, string>(
new TH2F(name.c_str(), title.c_str(), binsx,
xmin,
xmax, binsy,
ymin,
ymax), folder);
228 theMap[
name].first->Fill(x, y);
239 map<string, pair<TH1*, string> >::iterator it;
242 oss1 << name << endcap <<
id.station();
243 oss2 << title <<
" (Station " << endcap <<
id.station() <<
")";
246 it = theMap.find(name);
247 if (it == theMap.end()) {
248 theMap[
name] = pair<TH1*, string>(
new TH1F(name.c_str(), title.c_str(), bins,
xmin,
xmax), folder);
251 theMap[
name].first->Fill(x);
272 std::map<std::string, std::pair<TH1*, string> >::iterator it;
275 oss1 << name << endcap <<
id.station();
276 oss2 << title <<
" (Station " << endcap <<
id.station() <<
")";
279 it = theMap.find(name);
280 if (it == theMap.end()) {
282 std::pair<TH1*, string>(
new TH2F(name.c_str(), title.c_str(), binsx,
xmin,
xmax, binsy,
ymin,
ymax), folder);
285 theMap[
name].first->Fill(x, y);
296 std::map<std::string, std::pair<TH1*, string> >::iterator it;
299 oss1 << name <<
"_" << endcap <<
id.station() <<
"_" <<
id.ring() <<
"_" <<
id.chamber();
300 oss2 << title <<
" (ME " << endcap <<
id.station() <<
"/" <<
id.ring() <<
"/" <<
id.chamber() <<
")";
303 it = theMap.find(name);
304 if (it == theMap.end()) {
305 theMap[
name] = std::pair<TH1*, string>(
new TH1F(name.c_str(), title.c_str(), bins,
xmin,
xmax), folder);
308 theMap[
name].first->Fill(x);
329 std::map<std::string, std::pair<TH1*, string> >::iterator it;
332 oss1 << name <<
"_" << endcap <<
id.station() <<
"_" <<
id.ring() <<
"_" <<
id.chamber();
333 oss2 << title <<
" (ME " << endcap <<
id.station() <<
"/" <<
id.ring() <<
"/" <<
id.chamber() <<
")";
336 it = theMap.find(name);
337 if (it == theMap.end()) {
339 std::pair<TH1*, string>(
new TH2F(name.c_str(), title.c_str(), binsx,
xmin,
xmax, binsy,
ymin,
ymax), folder);
342 theMap[
name].first->Fill(x, y);
352 map<string, pair<TH1*, string> >::iterator it;
355 oss1 << name <<
"_" << run <<
"_" <<
event;
356 oss2 << title <<
" ( Run: " << run <<
" Event: " <<
event <<
" )";
359 it = theMap.find(name);
360 if (it == theMap.end()) {
361 theMap[
name] = pair<TH1*, string>(
new TH2F(name.c_str(), title.c_str(), 36, 0.5, 36.5, 18, 0.5, 18.5),
folder);
364 int x =
id.chamber();
369 y = y + 3 + (
id.station() - 2) * 2;
376 dynamic_cast<TH2F*
>(theMap[
name].first)->
Fill(x, y, z);
380 map<string, pair<TH1*, string> >::iterator it;
381 it = theMap.find(name);
382 if (it == theMap.end()) {
383 theMap[
name] = pair<TH1*, string>(
new TH2F(name.c_str(), title.c_str(), 36, 0.5, 36.5, 18, 0.5, 18.5),
folder);
386 int x =
id.chamber();
391 y = y + 3 + (
id.station() - 2) * 2;
398 dynamic_cast<TH2F*
>(theMap[
name].first)->
Fill(x, y, z);
402 float x,
string name,
string title,
CSCDetId id,
int bins,
float xmin,
float xmax,
string folder) {
409 std::map<std::string, std::pair<TH1*, string> >::iterator it;
412 oss1 << name <<
"_" << endcap <<
id.station() <<
"_" <<
id.ring() <<
"_" <<
id.chamber() <<
"_L" <<
id.layer();
413 oss2 << title <<
" (ME " << endcap <<
id.station() <<
"/" <<
id.ring() <<
"/" <<
id.chamber() <<
"/L" <<
id.layer()
417 it = theMap.find(name);
418 if (it == theMap.end()) {
419 theMap[
name] = std::pair<TH1*, string>(
new TH1F(name.c_str(), title.c_str(), bins,
xmin,
xmax), folder);
422 theMap[
name].first->Fill(x);
443 std::map<std::string, std::pair<TH1*, string> >::iterator it;
446 oss1 << name <<
"_" << endcap <<
id.station() <<
"_" <<
id.ring() <<
"_" <<
id.chamber() <<
"_L" <<
id.layer();
448 oss2 << title <<
" (ME " << endcap <<
id.station() <<
"/" <<
id.ring() <<
"/" <<
id.chamber() <<
"/L" <<
id.layer()
452 it = theMap.find(name);
453 if (it == theMap.end()) {
455 std::pair<TH1*, string>(
new TH2F(name.c_str(), title.c_str(), binsx,
xmin,
xmax, binsy,
ymin,
ymax), folder);
458 theMap[
name].first->Fill(x, y);
471 std::map<std::string, std::pair<TH1*, string> >::iterator it;
472 it = theMap.find(name);
473 if (it == theMap.end()) {
475 std::pair<TProfile*, string>(
new TProfile(name.c_str(), title.c_str(), binsx,
xmin,
xmax,
ymin,
ymax), folder);
478 theMap[
name].first->Fill(x, y);
492 std::map<std::string, std::pair<TH1*, string> >::iterator it;
501 oss1 << name << endcap <<
id.station() <<
id.ring();
502 oss2 << title <<
" (ME " << endcap <<
id.station() <<
"/" <<
id.ring() <<
")";
506 it = theMap.find(name);
507 if (it == theMap.end()) {
509 std::pair<TProfile*, string>(
new TProfile(name.c_str(), title.c_str(), binsx,
xmin,
xmax,
ymin,
ymax), folder);
512 theMap[
name].first->Fill(x, y);
526 std::map<std::string, std::pair<TH1*, string> >::iterator it;
535 oss1 << name <<
"_" << endcap <<
id.station() <<
"_" <<
id.ring() <<
"_" <<
id.chamber();
536 oss2 << title <<
" (ME " << endcap <<
id.station() <<
"/" <<
id.ring() <<
"/" <<
id.chamber() <<
")";
540 it = theMap.find(name);
541 if (it == theMap.end()) {
543 std::pair<TProfile*, string>(
new TProfile(name.c_str(), title.c_str(), binsx,
xmin,
xmax,
ymin,
ymax), folder);
546 theMap[
name].first->Fill(x, y);
563 std::map<std::string, std::pair<TH1*, string> >::iterator it;
565 it = theMap.find(name);
566 if (it == theMap.end()) {
567 theMap[
name] = std::pair<TProfile2D*, string>(
568 new TProfile2D(name.c_str(), title.c_str(), binsx,
xmin,
xmax, binsy,
ymin,
ymax, zmin, zmax), folder);
571 TProfile2D* tempp = (TProfile2D*)theMap[name].
first;
572 tempp->Fill(x, y, z);
579 if (
id.chamber() == 36 ||
id.chamber() == 1 ||
id.chamber() == 2)
581 if (
id.chamber() == 3 ||
id.chamber() == 4 ||
id.chamber() == 5)
583 if (
id.chamber() == 6 ||
id.chamber() == 7 ||
id.chamber() == 8)
585 if (
id.chamber() == 9 ||
id.chamber() == 10 ||
id.chamber() == 11)
587 if (
id.chamber() == 12 ||
id.chamber() == 13 ||
id.chamber() == 14)
589 if (
id.chamber() == 15 ||
id.chamber() == 16 ||
id.chamber() == 17)
591 if (
id.chamber() == 18 ||
id.chamber() == 19 ||
id.chamber() == 20)
593 if (
id.chamber() == 21 ||
id.chamber() == 22 ||
id.chamber() == 23)
595 if (
id.chamber() == 24 ||
id.chamber() == 25 ||
id.chamber() == 26)
597 if (
id.chamber() == 27 ||
id.chamber() == 28 ||
id.chamber() == 29)
599 if (
id.chamber() == 30 ||
id.chamber() == 31 ||
id.chamber() == 32)
601 if (
id.chamber() == 33 ||
id.chamber() == 34 ||
id.chamber() == 35)
604 crate = 12 +
id.triggerSector() + (
id.station() - 2) * 6;
int crate_lookup(CSCDetId id)
void fill2DHistByStation(float x, float y, std::string name, std::string title, CSCDetId id, int binsx, float xmin, float xmax, int binsy, float ymin, float ymax, std::string folder)
void fillProfileByType(float x, float y, std::string name, std::string title, CSCDetId id, int binsx, float xmin, float xmax, float ymin, float ymax, std::string folder)
void fillProfile(float x, float y, std::string name, std::string title, int binsx, float xmin, float xmax, float ymin, float ymax, std::string folder)
void writeTrees(TFile *theFile)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void fill1DHist(float x, std::string name, std::string title, int bins, float xmin, float xmax, std::string folder)
void fill2DHistByCrate(float x, float y, std::string name, std::string title, CSCDetId id, int binsx, float xmin, float xmax, int binsy, float ymin, float ymax, std::string folder)
void fill1DHistByLayer(float x, std::string name, std::string title, CSCDetId id, int bins, float xmin, float xmax, std::string folder)
void fillProfileByChamber(float x, float y, std::string name, std::string title, CSCDetId id, int binsx, float xmin, float xmax, float ymin, float ymax, std::string folder)
void writeHists(TFile *theFile)
void insertPlot(TH1 *thePlot, std::string name, std::string folder)
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
uint16_t const *__restrict__ x
void fill1DHistByType(float x, std::string name, std::string title, CSCDetId id, int bins, float xmin, float xmax, std::string folder)
void fillRechitTree(float x, float y, float gx, float gy, int en, int st, int ri, int ch, int la)
void fill1DHistByCrate(float x, std::string name, std::string title, CSCDetId id, int bins, float xmin, float xmax, std::string folder)
void fill2DHistByLayer(float x, float y, std::string name, std::string title, CSCDetId id, int binsx, float xmin, float xmax, int binsy, float ymin, float ymax, std::string folder)
void fill1DHistByStation(float x, std::string name, std::string title, CSCDetId id, int bins, float xmin, float xmax, std::string folder)
void fill1DHistByChamber(float x, std::string name, std::string title, CSCDetId id, int bins, float xmin, float xmax, std::string folder)
void fill2DHistByChamber(float x, float y, std::string name, std::string title, CSCDetId id, int binsx, float xmin, float xmax, int binsy, float ymin, float ymax, std::string folder)
void fill2DHistByEvent(int run, int event, float x, std::string name, std::string title, CSCDetId id, std::string folder)
void fill2DHist(float x, float y, std::string name, std::string title, int binsx, float xmin, float xmax, int binsy, float ymin, float ymax, std::string folder)
void fill2DHistByType(float x, float y, std::string name, std::string title, CSCDetId id, int binsx, float xmin, float xmax, int binsy, float ymin, float ymax, std::string folder)
void fillSegmentTree(float x, float y, float gx, float gy, int en, int st, int ri, int ch)
void fill2DProfile(float x, float y, float z, std::string name, std::string title, int binsx, float xmin, float xmax, int binsy, float ymin, float ymax, float zmin, float zmax, std::string folder)
void fillCalibHist(float x, std::string name, std::string title, int bins, float xmin, float xmax, int bin, std::string folder)