6 #include "TDirectory.h"
33 if (
i > 100 &&
i < 200) {
38 if (
i > 200 &&
i < 1000 && (
i % 10 == 1 ||
i % 10 == 7)) {
42 if (
i > 200 &&
i < 1000 && !(
i % 10 == 1 ||
i % 10 == 7)) {
47 if (
i > 1000 &&
i < 2000) {
52 if (
i > 3000 &&
i < 4000) {
57 if (
i > 2000 &&
i < 3000 && (
i % 1000) / 100 == 1) {
61 if (
i > 2000 &&
i < 3000 && (
i % 1000) / 100 == 2) {
65 if (
i > 2000 &&
i < 3000 && (
i % 1000) / 100 == 3) {
70 if (
i > 4000 &&
i < 6000 && (
i % 1000) / 100 == 1) {
74 if (
i > 4000 &&
i < 6000 && (
i % 1000) / 100 == 2) {
78 if (
i > 4000 &&
i < 6000 && (
i % 1000) / 100 == 3) {
82 if (
i > 4000 &&
i < 6000 && (
i % 1000) / 100 == 4) {
86 if (
i > 4000 &&
i < 6000 && (
i % 1000) / 100 == 5) {
90 if (
i > 4000 &&
i < 6000 && (
i % 1000) / 100 == 6) {
94 if (
i > 4000 &&
i < 6000 && (
i % 1000) / 100 == 7) {
99 std::pair<float, float>
res(
dz,
dr);
107 if (
i > 1000 &&
i < 1040) {
111 if (
i > 1040 &&
i < 1130) {
116 if (
i > 2000 &&
i < 2550) {
120 if (
i > 2550 &&
i < 3000) {
125 if (
i > 3000 &&
i < 5000) {
130 if (
i > 3100 &&
i < 3119) {
134 if (
i > 3140 &&
i < 3159) {
138 if (
i > 3180 &&
i < 3199) {
142 if (
i > 3220 &&
i < 3239) {
146 if (
i > 3260 &&
i < 3279) {
151 if (
i > 4100 &&
i < 4119) {
155 if (
i > 4140 &&
i < 4159) {
159 if (
i > 4180 &&
i < 4199) {
163 if (
i > 4220 &&
i < 4239) {
167 if (
i > 4260 &&
i < 4279) {
172 std::pair<float, float>
res(
dz,
dr);
180 if (
i > 1000 &&
i < 1040) {
184 if (
i > 1040 &&
i < 1080) {
189 if (
i > 1100 &&
i < 2000) {
194 if (
i > 3000 &&
i < 4000) {
199 if (
i > 2000 &&
i < 3000 && (
i % 1000) / 100 == 1) {
203 if (
i > 2000 &&
i < 3000 && (
i % 1000) / 100 == 2) {
207 if (
i > 2000 &&
i < 3000 && (
i % 1000) / 100 == 3) {
212 if (
i > 4000 &&
i < 6000 && (
i % 1000) / 100 == 1) {
216 if (
i > 4000 &&
i < 6000 && (
i % 1000) / 100 == 2) {
220 if (
i > 4000 &&
i < 6000 && (
i % 1000) / 100 == 3) {
224 if (
i > 4000 &&
i < 6000 && (
i % 1000) / 100 == 4) {
228 if (
i > 4000 &&
i < 6000 && (
i % 1000) / 100 == 5) {
232 if (
i > 4000 &&
i < 6000 && (
i % 1000) / 100 == 6) {
236 if (
i > 4000 &&
i < 6000 && (
i % 1000) / 100 == 7) {
241 std::pair<float, float>
res(
dz,
dr);
252 TText*
t =
new TText((
max +
min) / 2,
h->GetMaximum(),
label);
265 std::pair<float, float> (*
size)(
int),
266 std::vector<SubDetParams>& vsub) {
267 gROOT->SetStyle(
"Plain");
270 TProfile* aveoccu = (TProfile*)gDirectory->Get(
"aveoccu");
271 TProfile* avemult = (TProfile*)gDirectory->Get(
"avemult");
272 TH1F* nchannels = (TH1F*)gDirectory->Get(
"nchannels_real");
274 TProfile* averadius = (TProfile*)gDirectory->Get(
"averadius");
275 TProfile* avez = (TProfile*)gDirectory->Get(
"avez");
277 std::cout <<
"pointers " << aveoccu <<
" " << avemult <<
" " << nchannels <<
" " << averadius <<
" " << avez
280 if (aveoccu && avemult && nchannels && averadius && avez) {
282 for (
int i = 1;
i < nchannels->GetNbinsX() + 1; ++
i) {
283 nchannels->SetBinError(
i, 0.);
286 TH1D* haveoccu = aveoccu->ProjectionX(
"haveoccu");
287 haveoccu->SetDirectory(
nullptr);
288 haveoccu->Divide(nchannels);
290 TH1D* havemult = avemult->ProjectionX(
"havemult");
291 havemult->SetDirectory(
nullptr);
292 havemult->Divide(nchannels);
294 TH1D* havewidth = (TH1D*)haveoccu->Clone(
"havewidth");
295 havewidth->SetDirectory(
nullptr);
296 havewidth->SetTitle(
"Average Cluster Size");
297 havewidth->Divide(havemult);
299 new TCanvas(
"occupancy",
"occupancy", 1200, 500);
301 haveoccu->SetStats(
false);
302 haveoccu->SetLineColor(kRed);
303 haveoccu->SetMarkerColor(kRed);
304 haveoccu->DrawCopy();
306 new TCanvas(
"multiplicity",
"multiplicity", 1200, 500);
308 havemult->SetStats(
false);
309 havemult->SetLineColor(kRed);
310 havemult->SetMarkerColor(kRed);
311 havemult->DrawCopy();
313 new TCanvas(
"width",
"width", 1200, 500);
314 havewidth->SetStats(
false);
315 havewidth->SetLineColor(kRed);
316 havewidth->SetMarkerColor(kRed);
317 havewidth->DrawCopy();
320 TCanvas* o2 = (TCanvas*)gROOT->GetListOfCanvases()->FindObject(
"occupancy2");
323 haveoccu->SetLineColor(kBlue);
324 haveoccu->SetMarkerColor(kBlue);
326 o2 =
new TCanvas(
"occupancy2",
"occupancy2", 1200, 800);
329 for (
unsigned int isub = 0; isub < vsub.size(); ++isub) {
330 printFrame(o2, haveoccu, vsub[isub].
label.c_str(), isub + 1, vsub[isub].min, vsub[isub].max, same);
334 TCanvas* m2 = (TCanvas*)gROOT->GetListOfCanvases()->FindObject(
"multiplicity2");
337 havemult->SetLineColor(kBlue);
338 havemult->SetMarkerColor(kBlue);
340 m2 =
new TCanvas(
"multiplicity2",
"multiplicity2", 1200, 800);
343 for (
unsigned int isub = 0; isub < vsub.size(); ++isub) {
344 printFrame(m2, havemult, vsub[isub].
label.c_str(), isub + 1, vsub[isub].min, vsub[isub].max, same);
348 TCanvas*
w2 = (TCanvas*)gROOT->GetListOfCanvases()->FindObject(
"width2");
351 havewidth->SetLineColor(kBlue);
352 havewidth->SetMarkerColor(kBlue);
354 w2 =
new TCanvas(
"width2",
"width2", 1200, 800);
357 for (
unsigned int isub = 0; isub < vsub.size(); ++isub) {
358 printFrame(
w2, havewidth, vsub[isub].
label.c_str(), isub + 1, vsub[isub].min, vsub[isub].max, same);
364 drawMap(
"multmap", havemult, averadius, avez, mmin, mmax,
size,
scale, color);
375 TProfile* aveoccu = (TProfile*)gDirectory->Get(
"aveoccu");
377 TH1F* nchannels = (TH1F*)gDirectory->Get(
"nchannels_real");
380 float sumnchannels = 0;
383 for (
int i = lowerbin;
i < upperbin + 1; ++
i) {
384 std::cout <<
"processing bin " <<
i <<
" " << aveoccu->GetBinContent(
i) <<
"+/-" << aveoccu->GetBinError(
i)
386 sumoccu += aveoccu->GetBinContent(
i);
387 sumnchannels += nchannels->GetBinContent(
i);
388 sumerrsq += aveoccu->GetBinError(
i) * aveoccu->GetBinError(
i);
390 cumoccu = sumnchannels != 0 ? sumoccu / sumnchannels : -1;
391 cumerr = sumnchannels != 0 ?
sqrt(sumerrsq) / sumnchannels : -1;
392 std::cout <<
"Cumulative occupancy: " << sumoccu <<
" " << sumnchannels <<
" " << cumoccu <<
"+/-" << cumerr;
405 std::pair<float, float> (*
size)(
int);
408 std::vector<SubDetParams> vsub;
410 vsub.push_back(ppix);
412 vsub.push_back(ptib);
414 vsub.push_back(ptid);
416 vsub.push_back(ptob);
418 vsub.push_back(ptecm);
420 vsub.push_back(ptecp);
432 std::pair<float, float> (*
size)(
int);
435 std::vector<SubDetParams> vsub;
437 vsub.push_back(ppix);
439 vsub.push_back(ptib);
441 vsub.push_back(ptid);
443 vsub.push_back(ptob);
445 vsub.push_back(ptecm);
447 vsub.push_back(ptecp);
459 std::pair<float, float> (*
size)(
int);
462 std::vector<SubDetParams> vsub;
464 vsub.push_back(ppix);
466 vsub.push_back(ptob);
468 vsub.push_back(ptecm);
470 vsub.push_back(ptecp);
476 TFile*
ff,
const char*
module,
const char* ontrkmod,
const float mmin,
const float mmax,
const int color) {
477 std::pair<float, float> (*
size)(
int);
480 std::vector<SubDetParams> vsub;
482 vsub.push_back(ppix);
484 vsub.push_back(ptib);
486 vsub.push_back(ptid);
488 vsub.push_back(ptob);
490 vsub.push_back(ptecm);
492 vsub.push_back(ptecp);
498 TFile*
ff,
const char*
module,
const char* ontrkmod,
const float mmin,
const float mmax,
const int color) {
499 std::pair<float, float> (*
size)(
int);
502 std::vector<SubDetParams> vsub;
504 vsub.push_back(ppix);
506 vsub.push_back(ptib);
508 vsub.push_back(ptid);
510 vsub.push_back(ptob);
512 vsub.push_back(ptecm);
514 vsub.push_back(ptecp);
520 TFile*
ff,
const char*
module,
const char* ontrkmod,
const float mmin,
const float mmax,
const int color) {
521 std::pair<float, float> (*
size)(
int);
524 std::vector<SubDetParams> vsub;
526 vsub.push_back(ppix);
528 vsub.push_back(ptob);
530 vsub.push_back(ptecm);
532 vsub.push_back(ptecp);
539 const char* ontrkmod,
543 std::pair<float, float> (*
size)(
int),
544 const std::vector<SubDetParams>& vsub) {
545 gROOT->SetStyle(
"Plain");
547 TProfile* avemult =
nullptr;
548 TProfile* aveontrkmult =
nullptr;
549 TProfile* averadius =
nullptr;
550 TProfile* avez =
nullptr;
553 avemult = (TProfile*)gDirectory->Get(
"avemult");
554 averadius = (TProfile*)gDirectory->Get(
"averadius");
555 avez = (TProfile*)gDirectory->Get(
"avez");
557 if (
ff->cd(ontrkmod))
558 aveontrkmult = (TProfile*)gDirectory->Get(
"avemult");
560 std::cout <<
"pointers " << avemult <<
" " << aveontrkmult <<
" " << averadius <<
" " << avez << std::endl;
562 if (averadius && avez && avemult && aveontrkmult) {
563 TH1D* havemult = avemult->ProjectionX(
"havemult");
564 TH1D* haveontrkmult = aveontrkmult->ProjectionX(
"haveontrkmult");
565 havemult->SetDirectory(
nullptr);
566 haveontrkmult->SetDirectory(
nullptr);
567 haveontrkmult->Divide(havemult);
569 new TCanvas(
"ontrkmult",
"ontrkmult", 1200, 500);
571 haveontrkmult->SetStats(
false);
572 haveontrkmult->SetLineColor(kRed);
573 haveontrkmult->SetMarkerColor(kRed);
574 haveontrkmult->SetMarkerSize(.5);
575 haveontrkmult->SetMarkerStyle(20);
576 haveontrkmult->DrawCopy();
579 TCanvas* o2 = (TCanvas*)gROOT->GetListOfCanvases()->FindObject(
"ontrkmult2");
582 haveontrkmult->SetLineColor(kBlue);
583 haveontrkmult->SetMarkerColor(kBlue);
585 o2 =
new TCanvas(
"ontrkmult2",
"ontrkmult2", 1200, 800);
588 for (
unsigned int isub = 0; isub < vsub.size(); ++isub) {
589 printFrame(o2, haveontrkmult, vsub[isub].
label.c_str(), isub + 1, vsub[isub].min, vsub[isub].max, same);
595 drawMap(
"ontrkmultmap", haveontrkmult, averadius, avez, mmin, mmax,
size,
scale, color);
601 const TProfile* averadius,
602 const TProfile* avez,
605 std::pair<float, float> (*
size)(
int),
606 float (*
scale)(
float),
608 const char* ptitle) {
611 const Int_t NRGBs = 5;
612 const Int_t NCont = 255;
613 Double_t stops[NRGBs] = {0.00, 0.25, 0.50, 0.75, 1.00};
614 Double_t
red[NRGBs] = {0.00, 0.00, 0.40, 1.00, 1.00};
615 Double_t green[NRGBs] = {0.00, 0.40, 0.70, 0.60, 1.00};
616 Double_t
blue[NRGBs] = {0.30, 0.60, 0.00, 0.00, 0.20};
617 TColor::CreateGradientColorTable(NRGBs, stops,
red, green,
blue, NCont);
618 gStyle->SetNumberContours(NCont);
619 }
else if (color == 2) {
621 const Int_t NRGBs = 3;
622 const Int_t NCont = 255;
623 Double_t stops[NRGBs] = {0.00, 0.50, 1.00};
624 Double_t
red[NRGBs] = {0.90, 0.50, 0.00};
625 Double_t green[NRGBs] = {0.90, 0.50, 0.00};
626 Double_t
blue[NRGBs] = {0.90, 0.50, 0.00};
627 TColor::CreateGradientColorTable(NRGBs, stops,
red, green,
blue, NCont);
628 gStyle->SetNumberContours(NCont);
629 }
else if (color == 3) {
631 const Int_t NRGBs = 7;
632 const Int_t NCont = 255;
633 Double_t stops[NRGBs] = {0.00, 0.15, 0.30, 0.45, 0.65, 0.85, 1.00};
634 Double_t
red[NRGBs] = {0.60, 0.30, 0.00, 0.00, 0.60, 0.40, 0.00};
635 Double_t green[NRGBs] = {1.00, 0.90, 0.80, 0.75, 0.20, 0.00, 0.00};
636 Double_t
blue[NRGBs] = {1.00, 1.00, 1.00, 0.30, 0.00, 0.00, 0.00};
637 TColor::CreateGradientColorTable(NRGBs, stops,
red, green,
blue, NCont);
638 gStyle->SetNumberContours(NCont);
641 int ncol = gStyle->GetNumberOfColors();
642 std::cout <<
"Number of colors " << ncol << std::endl;
647 for (
int i = 1;
i < hval->GetNbinsX(); ++
i) {
648 if ((averadius->GetBinEntries(
i) * avez->GetBinEntries(
i)) != 0) {
656 if (
dz < 0 &&
dr < 0)
660 TBox* modmult =
new TBox(avez->GetBinContent(
i) -
dz,
661 averadius->GetBinContent(
i) -
dr,
662 avez->GetBinContent(
i) +
dz,
663 averadius->GetBinContent(
i) +
dr);
664 modmult->SetFillStyle(1001);
666 modmult->SetFillColor(kBlack);
671 if (icol > (ncol - 1))
673 std::cout <<
i <<
" " << icol <<
" " << hval->GetBinContent(
i) << std::endl;
674 modmult->SetFillColor(gStyle->GetColorPalette(icol));
676 modulesmult.Add(modmult);
681 double etavalext[] = {4., 3.5, 3., 2.8, 2.6, 2.4, 2.2, 2.0, 1.8, 1.6};
682 double etavalint[] = {-1.4, -1.2, -1.0, -0.8, -0.6, -0.4, -0.2, 0., 0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4};
686 for (
int i = 0;
i < 10; ++
i) {
688 double eta = etavalext[
i];
692 sprintf(lab,
"%3.1f",
eta);
694 label->SetTextSize(.03);
695 label->SetTextAlign(22);
696 etalabels.Add(
label);
698 for (
int i = 0;
i < 10; ++
i) {
700 double eta = -1 * etavalext[
i];
704 sprintf(lab,
"%3.1f",
eta);
706 label->SetTextSize(.03);
707 label->SetTextAlign(22);
708 etalabels.Add(
label);
710 for (
int i = 0;
i < 15; ++
i) {
712 double eta = etavalint[
i];
716 sprintf(lab,
"%3.1f",
eta);
718 label->SetTextSize(.03);
719 label->SetTextAlign(22);
720 etalabels.Add(
label);
722 TLatex* etalab =
new TLatex(0, 115,
"#eta");
723 etalab->SetTextSize(.03);
724 etalab->SetTextAlign(22);
725 etalabels.Add(etalab);
728 TLatex* cmslab =
new TLatex(0.15, 0.965,
"CMS");
730 cmslab->SetTextSize(0.04);
731 cmslab->SetTextAlign(31);
732 paperlabels.Add(cmslab);
733 TLatex* enelab =
new TLatex(0.92, 0.965,
"#sqrt{s} = 7 TeV");
735 enelab->SetTextSize(0.04);
736 enelab->SetTextAlign(31);
737 paperlabels.Add(enelab);
746 TGaxis* raxis =
new TGaxis(-310, 0, -310, 140, 0, 140, 10,
"S");
747 TGaxis*
zaxis =
new TGaxis(-310, 0, 310, 0, -310, 310, 10,
"S");
748 raxis->SetTickSize(.01);
749 zaxis->SetTickSize(.01);
750 raxis->SetTitle(
"r (cm)");
751 zaxis->SetTitle(
"z (cm)");
755 for (
int i = 0;
i < ncol; ++
i) {
756 TBox* box =
new TBox(315, 0 + 140. / ncol *
i, 330, 0 + 140. / ncol * (
i + 1));
757 box->SetFillStyle(1001);
758 box->SetFillColor(gStyle->GetColorPalette(
i));
762 TGaxis* mpaxis =
nullptr;
764 mpaxis =
new TGaxis(330, 0, 330, 140, mmin, mmax, 510,
"SLG+");
766 mpaxis =
new TGaxis(330, 0, 330, 140, mmin, mmax, 510,
"SL+");
768 mpaxis->SetTickSize(.02);
769 mpaxis->SetLabelOffset(mpaxis->GetLabelOffset() * 0.5);
770 mpaxis->SetTitle(ptitle);
771 mpalette.Add(mpaxis);
773 TCanvas* cc2 =
new TCanvas(cname, cname, 1000, 500);
774 cc2->Range(-370., -20., 390., 150.);
775 TFrame* fr2 =
new TFrame(-310, 0, 310, 140);
776 fr2->UseCurrentStyle();
780 std::cout << modulesmult.GetSize() << std::endl;
791 gROOT->SetStyle(
"Plain");
793 TCanvas*
cc =
new TCanvas(
name,
name, 750, 750);
794 cc->Range(-25, -25, 25, 25);
795 TFrame* fr1 =
new TFrame(-20, -20, 20, 20);
796 fr1->UseCurrentStyle();
800 TProfile* avex = (TProfile*)gDirectory->Get(
"avex");
801 TProfile* avey = (TProfile*)gDirectory->Get(
"avey");
802 TProfile* avez = (TProfile*)gDirectory->Get(
"avez");
804 if (avex && avey && avez) {
805 TText* tittext =
new TText(0, 0,
name);
806 tittext->SetTextSize(.04);
807 tittext->SetTextAlign(22);
809 for (
unsigned int mod = ioffset + 1;
mod < ioffset + 57; ++
mod) {
810 double x = avex->GetBinContent(
mod);
811 double y = avey->GetBinContent(
mod);
814 sprintf(modstring,
"%d",
mod % 100);
815 TText* modtext =
new TText(
x,
y, modstring);
816 modtext->SetTextAngle(atan(
y /
x) * 180 / 3.14159);
817 modtext->SetTextSize(.02);
818 modtext->SetTextAlign(22);
819 modtext->SetTextColor(kRed);
824 for (
unsigned int mod = ioffset + 101;
mod < ioffset + 157; ++
mod) {
825 double x = avex->GetBinContent(
mod);
826 double y = avey->GetBinContent(
mod);
829 sprintf(modstring,
"%d",
mod % 100);
830 TText* modtext =
new TText(
x,
y, modstring);
831 modtext->SetTextAngle(atan(
y /
x) * 180 / 3.14159);
832 modtext->SetTextSize(.02);
833 modtext->SetTextAlign(22);
834 modtext->SetTextColor(kBlue);
835 std::cout <<
mod <<
" " <<
x <<
" " <<
y <<
" " << atan(
y /
x) << std::endl;
843 gROOT->SetStyle(
"Plain");
846 TProfile* averadius = (TProfile*)gDirectory->Get(
"averadius");
847 TProfile* avez = (TProfile*)gDirectory->Get(
"avez");
849 std::cout <<
"pointers " << averadius <<
" " << avez << std::endl;
851 if (averadius && avez) {
852 std::pair<float, float> (*
size)(
int);
865 TH1D* occutrend =
new TH1D(
"occutrend",
"Average number of clusters vs run", 10, 0., 10.);
866 occutrend->SetCanExtend(TH1::kXaxis);
870 std::sort(
runs.begin(),
runs.end());
873 for (
unsigned int i = 0;
i <
runs.size(); ++
i) {
875 sprintf(runlabel,
"%d",
runs[
i]);
877 sprintf(runpath,
"run_%d",
runs[
i]);
880 TProfile* occu =
nullptr;
882 occu = (TProfile*)caoccu.
getObject(hname);
884 const int ibin = occu->FindBin(
bin);
886 <<
" " << ibin <<
" " << occu->GetBinContent(ibin) <<
" " << occu->GetBinError(ibin) << std::endl;
887 const int jbin = occutrend->Fill(runlabel, occu->GetBinContent(ibin));
888 occutrend->SetBinError(jbin, occu->GetBinError(ibin));