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++) {
19 if (
fit == theFolders.end()) {
20 theFolders.push_back(
folder);
23 theFile->cd((*mapit).second.second.c_str());
24 (*mapit).second.first->Write();
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;
86 if (
it == theMap.end()) {
90 theMap[
name].first->SetBinContent(
bin,
x);
95 std::map<std::string, std::pair<TH1*, string> >::iterator
it;
97 if (
it == theMap.end()) {
101 theMap[
name].first->Fill(
x);
115 std::map<std::string, std::pair<TH1*, string> >::iterator
it;
117 if (
it == theMap.end()) {
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() <<
")";
141 if (
it == theMap.end()) {
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() <<
")";
174 if (
it == theMap.end()) {
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 <<
")";
194 if (
it == theMap.end()) {
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 <<
")";
223 if (
it == theMap.end()) {
228 theMap[
name].first->Fill(
x, y);
239 map<string, pair<TH1*, string> >::iterator
it;
243 oss2 <<
title <<
" (Station " <<
endcap <<
id.station() <<
")";
247 if (
it == theMap.end()) {
251 theMap[
name].first->Fill(
x);
272 std::map<std::string, std::pair<TH1*, string> >::iterator
it;
276 oss2 <<
title <<
" (Station " <<
endcap <<
id.station() <<
")";
280 if (
it == theMap.end()) {
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() <<
")";
304 if (
it == theMap.end()) {
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() <<
")";
337 if (
it == theMap.end()) {
342 theMap[
name].first->Fill(
x, y);
352 map<string, pair<TH1*, string> >::iterator
it;
356 oss2 <<
title <<
" ( Run: " <<
run <<
" Event: " <<
event <<
" )";
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;
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);
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()
418 if (
it == theMap.end()) {
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()
453 if (
it == theMap.end()) {
458 theMap[
name].first->Fill(
x, y);
471 std::map<std::string, std::pair<TH1*, string> >::iterator
it;
473 if (
it == theMap.end()) {
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() <<
")";
507 if (
it == theMap.end()) {
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() <<
")";
541 if (
it == theMap.end()) {
546 theMap[
name].first->Fill(
x, y);
563 std::map<std::string, std::pair<TH1*, string> >::iterator
it;
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);
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)
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)