CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
OccupancyPlotMacros.cc File Reference
#include "TText.h"
#include "TLatex.h"
#include "TLine.h"
#include "TGaxis.h"
#include "TFile.h"
#include "TDirectory.h"
#include "TH1F.h"
#include "TProfile.h"
#include "TH1D.h"
#include "TList.h"
#include "TBox.h"
#include "TFrame.h"
#include "TStyle.h"
#include "TCanvas.h"
#include "TColor.h"
#include <cstring>
#include <iostream>
#include <math.h>
#include "TROOT.h"
#include "OccupancyPlotMacros.h"
#include <vector>

Go to the source code of this file.

Functions

float combinedOccupancy (TFile *ff, const char *module, const int lowerbin, const int upperbin)
 
void PlotDebugFPIX_XYMap (TFile *ff, const char *module, const unsigned int ioffset, const char *name)
 
void PlotOccupancyMap (TFile *ff, const char *module, const float min, const float max, const float mmin, const float mmax, const int color)
 
void PlotOccupancyMapPhase2 (TFile *ff, const char *module, const float min, const float max, const float mmin, const float mmax, const int color)
 
void PlotOnTrackOccupancyPhase2 (TFile *ff, const char *module, const char *ontrkmod, const float mmin, const float mmax, const int color)
 
void PlotTrackerXsect (TFile *ff, const char *module, const int color)
 
void printFrame (TCanvas *c, TH1D *h, TText *t, const int frame, const int min, const int max)
 

Function Documentation

float combinedOccupancy ( TFile *  ff,
const char *  module,
const int  lowerbin,
const int  upperbin 
)

Definition at line 728 of file OccupancyPlotMacros.cc.

References gather_cfg::cout, i, and mathSSE::sqrt().

728  {
729 
730  float cumoccu = -2.;
731  double cumerr = -2;
732 
733  if(ff->cd(module)) {
734 
735  TProfile* aveoccu= (TProfile*)gDirectory->Get("aveoccu");
736  // TProfile* avemult= (TProfile*)gDirectory->Get("avemult");
737  TH1F* nchannels = (TH1F*)gDirectory->Get("nchannels_real");
738 
739  float sumoccu=0.;
740  float sumnchannels=0;
741  double sumerrsq=0;
742 
743  for(int i=lowerbin; i<upperbin+1; ++i) {
744  std::cout << "processing bin " << i << " " << aveoccu->GetBinContent(i) << "+/-" << aveoccu->GetBinError(i) << std::endl;
745  sumoccu += aveoccu->GetBinContent(i);
746  sumnchannels += nchannels->GetBinContent(i);
747  sumerrsq += aveoccu->GetBinError(i)*aveoccu->GetBinError(i);
748  }
749  cumoccu = sumnchannels!=0 ? sumoccu/sumnchannels : -1;
750  cumerr = sumnchannels!=0 ? sqrt(sumerrsq)/sumnchannels : -1;
751  std::cout << "Cumulative occupancy: " << sumoccu << " " << sumnchannels << " " << cumoccu << "+/-" << cumerr;
752  }
753 
754  return cumoccu;
755 
756 }
int i
Definition: DBlmapReader.cc:9
T sqrt(T t)
Definition: SSEVec.h:48
tuple cout
Definition: gather_cfg.py:121
Definition: vlib.h:208
void PlotDebugFPIX_XYMap ( TFile *  ff,
const char *  module,
const unsigned int  ioffset,
const char *  name 
)

Definition at line 975 of file OccupancyPlotMacros.cc.

References gather_cfg::cout, mod(), x, and detailsBasic3DVector::y.

975  {
976 
977  gROOT->SetStyle("Plain");
978 
979  TCanvas* cc = new TCanvas(name,name,750,750);
980  cc->Range(-25,-25,25,25);
981  TFrame* fr1 = new TFrame(-20,-20,20,20);
982  fr1->UseCurrentStyle();
983  fr1->Draw();
984  ff->cd(module);
985  gDirectory->ls();
986  TProfile* avex = (TProfile*)gDirectory->Get("avex");
987  TProfile* avey = (TProfile*)gDirectory->Get("avey");
988  TProfile* avez = (TProfile*)gDirectory->Get("avez");
989 
990  if(avex && avey && avez) {
991  TText* tittext = new TText(0,0,name);
992  tittext->SetTextSize(.04); tittext->SetTextAlign(22);
993  tittext->Draw();
994  for(unsigned int mod=ioffset+1;mod<ioffset+57;++mod) {
995  double x = avex->GetBinContent(mod);
996  double y = avey->GetBinContent(mod);
997  // TBox* modbox = new TBox(x-1,y-1,x+1,y+1);
998  char modstring[30];
999  sprintf(modstring,"%d",mod%100);
1000  TText* modtext = new TText(x,y,modstring);
1001  modtext->SetTextAngle(atan(y/x)*180/3.14159);
1002  modtext->SetTextSize(.02); modtext->SetTextAlign(22); modtext->SetTextColor(kRed);
1003  std::cout << mod << " " << x << " " << y << std::endl;
1004  // modbox->Draw();
1005  modtext->Draw();
1006  }
1007  for(unsigned int mod=ioffset+101;mod<ioffset+157;++mod) {
1008  double x = avex->GetBinContent(mod);
1009  double y = avey->GetBinContent(mod);
1010  // TBox* modbox = new TBox(x-1,y-1,x+1,y+1);
1011  char modstring[30];
1012  sprintf(modstring,"%d",mod%100);
1013  TText* modtext = new TText(x,y,modstring);
1014  modtext->SetTextAngle(atan(y/x)*180/3.14159);
1015  modtext->SetTextSize(.02); modtext->SetTextAlign(22); modtext->SetTextColor(kBlue);
1016  std::cout << mod << " " << x << " " << y << " " << atan(y/x) << std::endl;
1017  // modbox->Draw();
1018  modtext->Draw();
1019  }
1020 
1021  }
1022 }
tuple cout
Definition: gather_cfg.py:121
Definition: DDAxes.h:10
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
Definition: vlib.h:208
void PlotOccupancyMap ( TFile *  ff,
const char *  module,
const float  min,
const float  max,
const float  mmin,
const float  mmax,
const int  color 
)

Definition at line 30 of file OccupancyPlotMacros.cc.

References gather_cfg::cout, eta(), create_public_lumi_plots::exp, cmsRelvalreport::green(), i, diffTwoXMLs::label, create_public_lumi_plots::log, cmsRelvalreport::red(), and w2.

30  {
31 
32  gROOT->SetStyle("Plain");
33 
34  if(color == 1) {
35  // A not-so-great color version
36  const Int_t NRGBs = 5;
37  const Int_t NCont = 255;
38  Double_t stops[NRGBs] = { 0.00, 0.25, 0.50, 0.75, 1.00 };
39  Double_t red[NRGBs] = { 0.00, 0.00, 0.40, 1.00, 1.00 };
40  Double_t green[NRGBs] = { 0.00, 0.40, 0.70, 0.60, 1.00 };
41  Double_t blue[NRGBs] = { 0.30, 0.60, 0.00, 0.00, 0.20 };
42  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
43  gStyle->SetNumberContours(NCont);
44  }
45  else if(color==2) {
46  // Gray scale
47  const Int_t NRGBs = 3;
48  const Int_t NCont = 255;
49  Double_t stops[NRGBs] = { 0.00, 0.50, 1.00 };
50  Double_t red[NRGBs] = { 0.90, 0.50, 0.00};
51  Double_t green[NRGBs] = { 0.90, 0.50, 0.00};
52  Double_t blue[NRGBs] = { 0.90, 0.50, 0.00};
53  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
54  gStyle->SetNumberContours(NCont);
55  }
56  else if(color==3) {
57  // used by Kevin in the TRK-11-001 paper
58  const Int_t NRGBs = 7;
59  const Int_t NCont = 255;
60  Double_t stops[NRGBs] = { 0.00, 0.15, 0.30, 0.45, 0.65, 0.85, 1.00 };
61  Double_t red[NRGBs] = { 0.60, 0.30, 0.00, 0.00, 0.60, 0.40, 0.00 };
62  Double_t green[NRGBs] = { 1.00, 0.90, 0.80, 0.75, 0.20, 0.00, 0.00 };
63  Double_t blue[NRGBs] = { 1.00, 1.00, 1.00, 0.30, 0.00, 0.00, 0.00 };
64  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
65  gStyle->SetNumberContours(NCont);
66  }
67 
68  int ncol = gStyle->GetNumberOfColors();
69  std::cout << "Number of colors " << ncol << std::endl;
70 
71  if(ff->cd(module)) {
72 
73  TProfile* aveoccu= (TProfile*)gDirectory->Get("aveoccu");
74  TProfile* avemult= (TProfile*)gDirectory->Get("avemult");
75  TH1F* nchannels = (TH1F*)gDirectory->Get("nchannels_real");
76 
77  TProfile* averadius = (TProfile*)gDirectory->Get("averadius");
78  TProfile* avez = (TProfile*)gDirectory->Get("avez");
79 
80  std::cout << "pointers " << aveoccu << " " << avemult << " " << nchannels << " " << averadius << " " << avez << std::endl;
81 
82  if(aveoccu && avemult && nchannels && averadius && avez) {
83 
84  nchannels->Sumw2();
85  for(int i=1;i<nchannels->GetNbinsX()+1;++i) {
86  nchannels->SetBinError(i,0.);
87  }
88 
89  TH1D* haveoccu = aveoccu->ProjectionX("haveoccu");
90  haveoccu->SetDirectory(0);
91  haveoccu->Divide(nchannels);
92  TH1D* havemult = avemult->ProjectionX("havemult");
93  havemult->SetDirectory(0);
94  havemult->Divide(nchannels);
95 
96  TH1D* havewidth = (TH1D*)haveoccu->Clone("havewidth");
97  havewidth->SetDirectory(0);
98  havewidth->SetTitle("Average Cluster Size");
99  havewidth->Divide(havemult);
100 
101 
102  new TCanvas("occupancy","occupancy",1200,500);
103  gPad->SetLogy(1);
104  haveoccu->SetStats(0);
105  haveoccu->DrawCopy();
106  TLine* l1 = new TLine(1000,0,1000,haveoccu->GetMaximum()); l1->DrawClone();
107  TLine* l2 = new TLine(2000,0,2000,haveoccu->GetMaximum()); l2->DrawClone();
108  TLine* l3 = new TLine(3000,0,3000,haveoccu->GetMaximum()); l3->DrawClone();
109  TLine* l4 = new TLine(4000,0,4000,haveoccu->GetMaximum()); l4->DrawClone();
110  TLine* l5 = new TLine(5000,0,5000,haveoccu->GetMaximum()); l5->DrawClone();
111  TText* tpix = new TText(500,haveoccu->GetMaximum(),"BPIX+FPIX"); tpix->SetTextAlign(22); tpix->DrawClone();
112  TText* ttib = new TText(1500,haveoccu->GetMaximum(),"TIB"); ttib->SetTextAlign(22); ttib->DrawClone();
113  TText* ttid = new TText(2500,haveoccu->GetMaximum(),"TID"); ttid->SetTextAlign(22); ttid->DrawClone();
114  TText* ttob = new TText(3500,haveoccu->GetMaximum(),"TOB"); ttob->SetTextAlign(22); ttob->DrawClone();
115  TText* ttecm = new TText(4500,haveoccu->GetMaximum(),"TEC-"); ttecm->SetTextAlign(22); ttecm->DrawClone();
116  TText* ttecp = new TText(5500,haveoccu->GetMaximum(),"TEC+"); ttecp->SetTextAlign(22); ttecp->DrawClone();
117 
118  new TCanvas("multiplicity","multiplicity",1200,500);
119  gPad->SetLogy(1);
120  havemult->SetStats(0);
121  havemult->DrawCopy();
122  tpix->SetY(havemult->GetMaximum()); tpix->DrawClone();
123  ttib->SetY(havemult->GetMaximum()); ttib->DrawClone();
124  ttid->SetY(havemult->GetMaximum()); ttid->DrawClone();
125  ttob->SetY(havemult->GetMaximum()); ttob->DrawClone();
126  ttecm->SetY(havemult->GetMaximum()); ttecm->DrawClone();
127  ttecp->SetY(havemult->GetMaximum()); ttecp->DrawClone();
128  l1->SetY2(havemult->GetMaximum()); l1->DrawClone();
129  l2->SetY2(havemult->GetMaximum()); l2->DrawClone();
130  l3->SetY2(havemult->GetMaximum()); l3->DrawClone();
131  l4->SetY2(havemult->GetMaximum()); l4->DrawClone();
132  l5->SetY2(havemult->GetMaximum()); l5->DrawClone();
133 
134  new TCanvas("width","width",1200,500);
135  havewidth->SetStats(0);
136  havewidth->DrawCopy();
137  tpix->SetY(havewidth->GetMaximum()); tpix->DrawClone();
138  ttib->SetY(havewidth->GetMaximum()); ttib->DrawClone();
139  ttid->SetY(havewidth->GetMaximum()); ttid->DrawClone();
140  ttob->SetY(havewidth->GetMaximum()); ttob->DrawClone();
141  ttecm->SetY(havewidth->GetMaximum()); ttecm->DrawClone();
142  ttecp->SetY(havewidth->GetMaximum()); ttecp->DrawClone();
143  l1->SetY2(havewidth->GetMaximum()); l1->DrawClone();
144  l2->SetY2(havewidth->GetMaximum()); l2->DrawClone();
145  l3->SetY2(havewidth->GetMaximum()); l3->DrawClone();
146  l4->SetY2(havewidth->GetMaximum()); l4->DrawClone();
147  l5->SetY2(havewidth->GetMaximum()); l5->DrawClone();
148 
149  TCanvas * o2 = new TCanvas("occupancy2","occupancy2",1200,800);
150  o2->Divide(3,2);
151  o2->cd(1);
152  haveoccu->SetAxisRange(100,270);
153  haveoccu->DrawCopy();
154  tpix->SetY(haveoccu->GetMaximum()); tpix->SetX(185); tpix->DrawClone();
155  o2->cd(2);
156  haveoccu->SetAxisRange(1050,1450);
157  haveoccu->DrawCopy();
158  ttib->SetY(haveoccu->GetMaximum()); ttib->SetX(1250); ttib->DrawClone();
159  o2->cd(3);
160  haveoccu->SetAxisRange(2070,2400);
161  haveoccu->DrawCopy();
162  ttid->SetY(haveoccu->GetMaximum()); ttid->SetX(2235); ttid->DrawClone();
163  o2->cd(4);
164  haveoccu->SetAxisRange(3000,3700);
165  haveoccu->DrawCopy();
166  ttob->SetY(haveoccu->GetMaximum()); ttob->SetX(3350); ttob->DrawClone();
167  o2->cd(5);
168  haveoccu->SetAxisRange(4000,4850);
169  haveoccu->DrawCopy();
170  ttecm->SetY(haveoccu->GetMaximum()); ttecm->SetX(4425); ttecm->DrawClone();
171  o2->cd(6);
172  haveoccu->SetAxisRange(5000,5850);
173  haveoccu->DrawCopy();
174  ttecp->SetY(haveoccu->GetMaximum()); ttecp->SetX(5425); ttecp->DrawClone();
175 
176  TCanvas * m2 = new TCanvas("multiplicity2","multiplicity2",1200,800);
177  m2->Divide(3,2);
178  m2->cd(1);
179  havemult->SetAxisRange(100,270);
180  havemult->DrawCopy();
181  tpix->SetY(havemult->GetMaximum()); tpix->SetX(185); tpix->DrawClone();
182  m2->cd(2);
183  havemult->SetAxisRange(1050,1450);
184  havemult->DrawCopy();
185  ttib->SetY(havemult->GetMaximum()); ttib->SetX(1250); ttib->DrawClone();
186  m2->cd(3);
187  havemult->SetAxisRange(2070,2400);
188  havemult->DrawCopy();
189  ttid->SetY(havemult->GetMaximum()); ttid->SetX(2235); ttid->DrawClone();
190  m2->cd(4);
191  havemult->SetAxisRange(3000,3700);
192  havemult->DrawCopy();
193  ttob->SetY(havemult->GetMaximum()); ttob->SetX(3350); ttob->DrawClone();
194  m2->cd(5);
195  havemult->SetAxisRange(4000,4850);
196  havemult->DrawCopy();
197  ttecm->SetY(havemult->GetMaximum()); ttecm->SetX(4425); ttecm->DrawClone();
198  m2->cd(6);
199  havemult->SetAxisRange(5000,5850);
200  havemult->DrawCopy();
201  ttecp->SetY(havemult->GetMaximum()); ttecp->SetX(5425); ttecp->DrawClone();
202 
203  TCanvas * w2 = new TCanvas("width2","width2",1200,800);
204  w2->Divide(3,2);
205  w2->cd(1);
206  havewidth->SetAxisRange(100,270);
207  havewidth->DrawCopy();
208  tpix->SetY(havewidth->GetMaximum()); tpix->SetX(185); tpix->DrawClone();
209  w2->cd(2);
210  havewidth->SetAxisRange(1050,1450);
211  havewidth->DrawCopy();
212  ttib->SetY(havewidth->GetMaximum()); ttib->SetX(1250); ttib->DrawClone();
213  w2->cd(3);
214  havewidth->SetAxisRange(2070,2400);
215  havewidth->DrawCopy();
216  ttid->SetY(havewidth->GetMaximum()); ttid->SetX(2235); ttid->DrawClone();
217  w2->cd(4);
218  havewidth->SetAxisRange(3000,3700);
219  havewidth->DrawCopy();
220  ttob->SetY(havewidth->GetMaximum()); ttob->SetX(3350); ttob->DrawClone();
221  w2->cd(5);
222  havewidth->SetAxisRange(4000,4850);
223  havewidth->DrawCopy();
224  ttecm->SetY(havewidth->GetMaximum()); ttecm->SetX(4425); ttecm->DrawClone();
225  w2->cd(6);
226  havewidth->SetAxisRange(5000,5850);
227  havewidth->DrawCopy();
228  ttecp->SetY(havewidth->GetMaximum()); ttecp->SetX(5425); ttecp->DrawClone();
229 
230  // Loop on bins and creation of boxes
231 
232  TList modulesoccu;
233  TList modulesmult;
234 
235  for(int i=1;i<haveoccu->GetNbinsX();++i) {
236 
237  if(averadius->GetBinEntries(i)*avez->GetBinEntries(i)) {
238 
239  double dz = 2.;
240  double dr = 1.;
241  // determine module size
242 
243  if(i > 100 && i < 200) { dz=3.33;dr=0.4;} // BPIX
244 
245  if(i > 200 && i < 1000 && ( i%10 == 1 || i%10 == 7)) { dz=0.8;dr=0.4;} // FPIX
246  if(i > 200 && i < 1000 && !( i%10 == 1 || i%10 == 7)) { dz=0.8;dr=0.8;}
247 
248  if(i > 1000 && i < 2000) { dz=5.948;dr=0.4;} // TIB
249 
250  if(i > 3000 && i < 4000) { dz=9.440;dr=0.4;} // TOB
251 
252  if(i > 2000 && i < 3000 && (i%1000)/100 == 1) { dz=0.8;dr=5.647;} // TID
253  if(i > 2000 && i < 3000 && (i%1000)/100 == 2) { dz=0.8;dr=4.512;}
254  if(i > 2000 && i < 3000 && (i%1000)/100 == 3) { dz=0.8;dr=5.637;}
255 
256  if(i > 4000 && i < 6000 && (i%1000)/100 == 1) { dz=0.8;dr=4.362;} // TEC
257  if(i > 4000 && i < 6000 && (i%1000)/100 == 2) { dz=0.8;dr=4.512;}
258  if(i > 4000 && i < 6000 && (i%1000)/100 == 3) { dz=0.8;dr=5.637;}
259  if(i > 4000 && i < 6000 && (i%1000)/100 == 4) { dz=0.8;dr=5.862;}
260  if(i > 4000 && i < 6000 && (i%1000)/100 == 5) { dz=0.8;dr=7.501;}
261  if(i > 4000 && i < 6000 && (i%1000)/100 == 6) { dz=0.8;dr=9.336;}
262  if(i > 4000 && i < 6000 && (i%1000)/100 == 7) { dz=0.8;dr=10.373;}
263 
264  {
265  TBox* modoccu = new TBox(avez->GetBinContent(i)-dz,averadius->GetBinContent(i)-dr,avez->GetBinContent(i)+dz,averadius->GetBinContent(i)+dr);
266  modoccu->SetFillStyle(1001);
267  int icol=int(ncol*(log(haveoccu->GetBinContent(i))-log(min))/(log(max)-log(min)));
268  if(icol < 0) icol=0;
269  if(icol > (ncol-1)) icol=(ncol-1);
270  std::cout << i << " " << icol << " " << haveoccu->GetBinContent(i) << std::endl;
271  modoccu->SetFillColor(gStyle->GetColorPalette(icol));
272  modulesoccu.Add(modoccu);
273  }
274  {
275  TBox* modmult = new TBox(avez->GetBinContent(i)-dz,averadius->GetBinContent(i)-dr,avez->GetBinContent(i)+dz,averadius->GetBinContent(i)+dr);
276  modmult->SetFillStyle(1001);
277  int icol=int(ncol*(log(havemult->GetBinContent(i))-log(mmin))/(log(mmax)-log(mmin)));
278  if(icol < 0) icol=0;
279  if(icol > (ncol-1)) icol=(ncol-1);
280  std::cout << i << " " << icol << " " << havemult->GetBinContent(i) << std::endl;
281  modmult->SetFillColor(gStyle->GetColorPalette(icol));
282  modulesmult.Add(modmult);
283  }
284 
285  }
286 
287  }
288  // eta boundaries lines
289  double etavalext[] = {3.,2.8,2.6,2.4,2.2,2.0,1.8,1.6};
290  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};
291  TList etalines;
292  TList etalabels;
293  TList paperlabels;
294  for(int i=0;i<8;++i) {
295  // double eta = 3.0-i*0.2;
296  double eta = etavalext[i];
297  TLine* lin = new TLine(295,2*295/(exp(eta)-exp(-eta)),305,2*305/(exp(eta)-exp(-eta)));
298  etalines.Add(lin);
299  char lab[100];
300  sprintf(lab,"%3.1f",eta);
301  TText* label = new TText(285,2*285/(exp(eta)-exp(-eta)),lab);
302  label->SetTextSize(.03);
303  label->SetTextAlign(22);
304  etalabels.Add(label);
305  }
306  for(int i=0;i<8;++i) {
307  // double eta = -3.0+i*0.2;
308  double eta = -1*etavalext[i];
309  TLine* lin = new TLine(-295,-2*295/(exp(eta)-exp(-eta)),-305,-2*305/(exp(eta)-exp(-eta)));
310  etalines.Add(lin);
311  char lab[100];
312  sprintf(lab,"%3.1f",eta);
313  TText* label = new TText(-285,-2*285/(exp(eta)-exp(-eta)),lab);
314  label->SetTextSize(.03);
315  label->SetTextAlign(22);
316  etalabels.Add(label);
317  }
318  for(int i=0;i<15;++i) {
319  // double eta = -1.4+i*0.2;
320  double eta = etavalint[i];
321  TLine* lin = new TLine(130.*(exp(eta)-exp(-eta))/2.,130,138.*(exp(eta)-exp(-eta))/2.,138);
322  etalines.Add(lin);
323  char lab[100];
324  sprintf(lab,"%3.1f",eta);
325  TText* label = new TText(125.*(exp(eta)-exp(-eta))/2.,125,lab);
326  label->SetTextSize(.03);
327  label->SetTextAlign(22);
328  etalabels.Add(label);
329  }
330  TLatex* etalab = new TLatex(0,115,"#eta");
331  etalab->SetTextSize(.03);
332  etalab->SetTextAlign(22);
333  etalabels.Add(etalab);
334 
335  // CMS label
336  TLatex *cmslab = new TLatex(0.15,0.965,"CMS");
337  cmslab->SetNDC();
338  cmslab->SetTextSize(0.04);
339  cmslab->SetTextAlign(31);
340  paperlabels.Add(cmslab);
341  TLatex *enelab = new TLatex(0.92,0.965,"#sqrt{s} = 7 TeV");
342  enelab->SetNDC();
343  enelab->SetTextSize(0.04);
344  enelab->SetTextAlign(31);
345  paperlabels.Add(enelab);
346  /*
347  TLatex *lumilab = new TLatex(0.6,0.965,Form("L = %.1f fb^{-1}",19.7));
348  lumilab->SetNDC();
349  lumilab->SetTextSize(0.04);
350  lumilab->SetTextAlign(31);
351  paperlabels.Add(lumilab);
352  */
353 
354  TGaxis *raxis = new TGaxis(-310,0,-310,140,0,140,10,"S");
355  TGaxis *zaxis = new TGaxis(-310,0,310,0,-310,310,10,"S");
356  raxis->SetTickSize(.01); zaxis->SetTickSize(.01);
357  raxis->SetTitle("r (cm)"); zaxis->SetTitle("z (cm)");
358 
359  TList palette;
360  TList mpalette;
361 
362  for(int i = 0;i< ncol ; ++i) {
363  TBox* box= new TBox(315,0+140./ncol*i,330,0+140./ncol*(i+1));
364  box->SetFillStyle(1001);
365  box->SetFillColor(gStyle->GetColorPalette(i));
366  palette.Add(box);
367  mpalette.Add(box);
368 
369  }
370 
371  TGaxis *paxis = new TGaxis(330,0,330,140,min,max,510,"SLG+");
372  paxis->SetTickSize(.02);
373  paxis->SetLabelOffset(paxis->GetLabelOffset()*0.5);
374  paxis->SetTitle("channel occupancy");
375  palette.Add(paxis);
376 
377  TGaxis *mpaxis = new TGaxis(330,0,330,140,mmin,mmax,510,"SLG+");
378  mpaxis->SetTickSize(.02);
379  mpaxis->SetLabelOffset(paxis->GetLabelOffset()*0.5);
380  mpalette.Add(mpaxis);
381 
382  TCanvas* cc1 = new TCanvas("occumap","occumap",1000,500);
383  cc1->Range(-370.,-20.,390.,150.);
384  TFrame* fr1 = new TFrame(-310,0,310,140);
385  fr1->UseCurrentStyle();
386  fr1->Draw();
387  raxis->Draw(); zaxis->Draw();
388  std::cout << modulesoccu.GetSize() << std::endl;
389  etalines.Draw();
390  etalabels.Draw();
391  paperlabels.Draw();
392  palette.Draw();
393  modulesoccu.Draw();
394 
395  TCanvas* cc2 = new TCanvas("multmap","multmap",1000,500);
396  cc2->Range(-370.,-20.,390.,150.);
397  TFrame* fr2 = new TFrame(-310,0,310,140);
398  fr2->UseCurrentStyle();
399  fr2->Draw();
400  raxis->Draw(); zaxis->Draw();
401  std::cout << modulesmult.GetSize() << std::endl;
402  etalines.Draw();
403  etalabels.Draw();
404  mpalette.Draw();
405  modulesmult.Draw();
406 
407  }
408 
409 
410  }
411 
412 }
int i
Definition: DBlmapReader.cc:9
common ppss p3p6s2 common epss epspn46 common const1 w2
Definition: inclppp.h:1
T eta() const
T min(T a, T b)
Definition: MathUtil.h:58
tuple cout
Definition: gather_cfg.py:121
Definition: vlib.h:208
void PlotOccupancyMapPhase2 ( TFile *  ff,
const char *  module,
const float  min,
const float  max,
const float  mmin,
const float  mmax,
const int  color 
)

Definition at line 413 of file OccupancyPlotMacros.cc.

References gather_cfg::cout, eta(), create_public_lumi_plots::exp, cmsRelvalreport::green(), i, diffTwoXMLs::label, create_public_lumi_plots::log, printFrame(), cmsRelvalreport::red(), and w2.

413  {
414 
415  gROOT->SetStyle("Plain");
416 
417  if(color == 1) {
418  // A not-so-great color version
419  const Int_t NRGBs = 5;
420  const Int_t NCont = 255;
421  Double_t stops[NRGBs] = { 0.00, 0.25, 0.50, 0.75, 1.00 };
422  Double_t red[NRGBs] = { 0.00, 0.00, 0.40, 1.00, 1.00 };
423  Double_t green[NRGBs] = { 0.00, 0.40, 0.70, 0.60, 1.00 };
424  Double_t blue[NRGBs] = { 0.30, 0.60, 0.00, 0.00, 0.20 };
425  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
426  gStyle->SetNumberContours(NCont);
427  }
428  else if(color==2) {
429  // Gray scale
430  const Int_t NRGBs = 3;
431  const Int_t NCont = 255;
432  Double_t stops[NRGBs] = { 0.00, 0.50, 1.00 };
433  Double_t red[NRGBs] = { 0.90, 0.50, 0.00};
434  Double_t green[NRGBs] = { 0.90, 0.50, 0.00};
435  Double_t blue[NRGBs] = { 0.90, 0.50, 0.00};
436  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
437  gStyle->SetNumberContours(NCont);
438  }
439  else if(color==3) {
440  // used by Kevin in the TRK-11-001 paper
441  const Int_t NRGBs = 7;
442  const Int_t NCont = 255;
443  Double_t stops[NRGBs] = { 0.00, 0.15, 0.30, 0.45, 0.65, 0.85, 1.00 };
444  Double_t red[NRGBs] = { 0.60, 0.30, 0.00, 0.00, 0.60, 0.40, 0.00 };
445  Double_t green[NRGBs] = { 1.00, 0.90, 0.80, 0.75, 0.20, 0.00, 0.00 };
446  Double_t blue[NRGBs] = { 1.00, 1.00, 1.00, 0.30, 0.00, 0.00, 0.00 };
447  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
448  gStyle->SetNumberContours(NCont);
449  }
450 
451  int ncol = gStyle->GetNumberOfColors();
452  std::cout << "Number of colors " << ncol << std::endl;
453 
454  if(ff->cd(module)) {
455 
456  TProfile* aveoccu= (TProfile*)gDirectory->Get("aveoccu");
457  TProfile* avemult= (TProfile*)gDirectory->Get("avemult");
458  TH1F* nchannels = (TH1F*)gDirectory->Get("nchannels_real");
459 
460  TProfile* averadius = (TProfile*)gDirectory->Get("averadius");
461  TProfile* avez = (TProfile*)gDirectory->Get("avez");
462 
463  std::cout << "pointers " << aveoccu << " " << avemult << " " << nchannels << " " << averadius << " " << avez << std::endl;
464 
465  if(aveoccu && avemult && nchannels && averadius && avez) {
466 
467  nchannels->Sumw2();
468  for(int i=1;i<nchannels->GetNbinsX()+1;++i) {
469  nchannels->SetBinError(i,0.);
470  }
471 
472  TH1D* haveoccu = aveoccu->ProjectionX("haveoccu");
473  haveoccu->SetDirectory(0);
474  haveoccu->Divide(nchannels);
475  TH1D* havemult = avemult->ProjectionX("havemult");
476  havemult->SetDirectory(0);
477  havemult->Divide(nchannels);
478 
479  TH1D* havewidth = (TH1D*)haveoccu->Clone("havewidth");
480  havewidth->SetDirectory(0);
481  havewidth->SetTitle("Average Cluster Size");
482  havewidth->Divide(havemult);
483 
484 
485  new TCanvas("occupancy","occupancy",1200,500);
486  gPad->SetLogy(1);
487  haveoccu->SetStats(0);
488  haveoccu->DrawCopy();
489  TLine* l1 = new TLine(1000,0,1000,haveoccu->GetMaximum()); l1->DrawClone();
490  TLine* l2 = new TLine(2000,0,2000,haveoccu->GetMaximum()); l2->DrawClone();
491  TLine* l3 = new TLine(3000,0,3000,haveoccu->GetMaximum()); l3->DrawClone();
492  TLine* l4 = new TLine(4000,0,4000,haveoccu->GetMaximum()); l4->DrawClone();
493  TLine* l5 = new TLine(5000,0,5000,haveoccu->GetMaximum()); l5->DrawClone();
494  TText* tpix = new TText(1500,haveoccu->GetMaximum(),"BPIX+FPIX"); tpix->SetTextAlign(22); tpix->DrawClone();
495  // TText* ttib = new TText(1500,haveoccu->GetMaximum(),"TIB"); ttib->SetTextAlign(22); ttib->DrawClone();
496  // TText* ttid = new TText(2500,haveoccu->GetMaximum(),"TID"); ttid->SetTextAlign(22); ttid->DrawClone();
497  TText* ttob = new TText(2500,haveoccu->GetMaximum(),"TOB"); ttob->SetTextAlign(22); ttob->DrawClone();
498  TText* ttecm = new TText(3500,haveoccu->GetMaximum(),"TEC-"); ttecm->SetTextAlign(22); ttecm->DrawClone();
499  TText* ttecp = new TText(4500,haveoccu->GetMaximum(),"TEC+"); ttecp->SetTextAlign(22); ttecp->DrawClone();
500 
501  new TCanvas("multiplicity","multiplicity",1200,500);
502  gPad->SetLogy(1);
503  havemult->SetStats(0);
504  havemult->DrawCopy();
505  tpix->SetY(havemult->GetMaximum()); tpix->DrawClone();
506  // ttib->SetY(havemult->GetMaximum()); ttib->DrawClone();
507  // ttid->SetY(havemult->GetMaximum()); ttid->DrawClone();
508  ttob->SetY(havemult->GetMaximum()); ttob->DrawClone();
509  ttecm->SetY(havemult->GetMaximum()); ttecm->DrawClone();
510  ttecp->SetY(havemult->GetMaximum()); ttecp->DrawClone();
511  l1->SetY2(havemult->GetMaximum()); l1->DrawClone();
512  l2->SetY2(havemult->GetMaximum()); l2->DrawClone();
513  l3->SetY2(havemult->GetMaximum()); l3->DrawClone();
514  l4->SetY2(havemult->GetMaximum()); l4->DrawClone();
515  l5->SetY2(havemult->GetMaximum()); l5->DrawClone();
516 
517  new TCanvas("width","width",1200,500);
518  havewidth->SetStats(0);
519  havewidth->DrawCopy();
520  tpix->SetY(havewidth->GetMaximum()); tpix->DrawClone();
521  // ttib->SetY(havewidth->GetMaximum()); ttib->DrawClone();
522  // ttid->SetY(havewidth->GetMaximum()); ttid->DrawClone();
523  ttob->SetY(havewidth->GetMaximum()); ttob->DrawClone();
524  ttecm->SetY(havewidth->GetMaximum()); ttecm->DrawClone();
525  ttecp->SetY(havewidth->GetMaximum()); ttecp->DrawClone();
526  l1->SetY2(havewidth->GetMaximum()); l1->DrawClone();
527  l2->SetY2(havewidth->GetMaximum()); l2->DrawClone();
528  l3->SetY2(havewidth->GetMaximum()); l3->DrawClone();
529  l4->SetY2(havewidth->GetMaximum()); l4->DrawClone();
530  l5->SetY2(havewidth->GetMaximum()); l5->DrawClone();
531 
532  TCanvas * o2 = new TCanvas("occupancy2","occupancy2",1200,800);
533  o2->Divide(2,2);
534  printFrame(o2,haveoccu,tpix,1,1000,1090);
535  printFrame(o2,haveoccu,ttob,2,2000,2900);
536  printFrame(o2,haveoccu,ttecm,3,3100,3300);
537  printFrame(o2,haveoccu,ttecp,4,4100,4300);
538 
539  TCanvas * m2 = new TCanvas("multiplicity2","multiplicity2",1200,800);
540  m2->Divide(2,2);
541  printFrame(m2,havemult,tpix,1,1000,1090);
542  printFrame(m2,havemult,ttob,2,2000,2900);
543  printFrame(m2,havemult,ttecm,3,3100,3300);
544  printFrame(m2,havemult,ttecp,4,4100,4300);
545 
546  TCanvas * w2 = new TCanvas("width2","width2",1200,800);
547  w2->Divide(2,2);
548  printFrame(w2,havewidth,tpix,1,1000,1090);
549  printFrame(w2,havewidth,ttob,2,2000,2900);
550  printFrame(w2,havewidth,ttecm,3,3100,3300);
551  printFrame(w2,havewidth,ttecp,4,4100,4300);
552 
553  // Loop on bins and creation of boxes
554 
555  TList modulesoccu;
556  TList modulesmult;
557 
558  for(int i=1;i<haveoccu->GetNbinsX();++i) {
559 
560  if(i<1000) continue;
561 
562  if(averadius->GetBinEntries(i)*avez->GetBinEntries(i)) {
563 
564  double dz = 2.;
565  double dr = 1.;
566  // determine module size
567 
568  if(i > 1000 && i < 1040) { dz=3.33;dr=0.4;}
569  if(i > 1040 && i < 1130) { dr=3.33;dz=0.4;}
570 
571  if(i > 2000 && i < 2550) { dz=2.5;dr=0.1;}
572  if(i > 2550 && i < 3000) { dz=5.0;dr=0.1;}
573 
574  if(i > 3000 && i < 5000) { dz=0.2;dr=5.0;}
575 
576  if(i > 3100 && i < 3119) { dz=0.2;dr=2.5;}
577  if(i > 3140 && i < 3159) { dz=0.2;dr=2.5;}
578  if(i > 3180 && i < 3199) { dz=0.2;dr=2.5;}
579  if(i > 3220 && i < 3239) { dz=0.2;dr=2.5;}
580  if(i > 3260 && i < 3279) { dz=0.2;dr=2.5;}
581 
582  if(i > 4100 && i < 4119) { dz=0.2;dr=2.5;}
583  if(i > 4140 && i < 4159) { dz=0.2;dr=2.5;}
584  if(i > 4180 && i < 4199) { dz=0.2;dr=2.5;}
585  if(i > 4220 && i < 4239) { dz=0.2;dr=2.5;}
586  if(i > 4260 && i < 4279) { dz=0.2;dr=2.5;}
587 
588 
589 
590  /*
591 
592  if(i > 2000 && i < 3000 && (i%1000)/100 == 1) { dz=0.8;dr=5.647;}
593  if(i > 2000 && i < 3000 && (i%1000)/100 == 2) { dz=0.8;dr=4.512;}
594  if(i > 2000 && i < 3000 && (i%1000)/100 == 3) { dz=0.8;dr=5.637;}
595 
596  if(i > 4000 && i < 6000 && (i%1000)/100 == 1) { dz=0.8;dr=4.362;}
597  if(i > 4000 && i < 6000 && (i%1000)/100 == 2) { dz=0.8;dr=4.512;}
598  if(i > 4000 && i < 6000 && (i%1000)/100 == 3) { dz=0.8;dr=5.637;}
599  if(i > 4000 && i < 6000 && (i%1000)/100 == 4) { dz=0.8;dr=5.862;}
600  if(i > 4000 && i < 6000 && (i%1000)/100 == 5) { dz=0.8;dr=7.501;}
601  if(i > 4000 && i < 6000 && (i%1000)/100 == 6) { dz=0.8;dr=9.336;}
602  if(i > 4000 && i < 6000 && (i%1000)/100 == 7) { dz=0.8;dr=10.373;}
603  */
604  {
605  TBox* modoccu = new TBox(avez->GetBinContent(i)-dz,averadius->GetBinContent(i)-dr,avez->GetBinContent(i)+dz,averadius->GetBinContent(i)+dr);
606  modoccu->SetFillStyle(1001);
607  int icol=int(ncol*(log(haveoccu->GetBinContent(i))-log(min))/(log(max)-log(min)));
608  if(icol < 0) icol=0;
609  if(icol > (ncol-1)) icol=(ncol-1);
610  std::cout << i << " " << icol << " " << haveoccu->GetBinContent(i) << std::endl;
611  modoccu->SetFillColor(gStyle->GetColorPalette(icol));
612  modulesoccu.Add(modoccu);
613  }
614  {
615  TBox* modmult = new TBox(avez->GetBinContent(i)-dz,averadius->GetBinContent(i)-dr,avez->GetBinContent(i)+dz,averadius->GetBinContent(i)+dr);
616  modmult->SetFillStyle(1001);
617  int icol=int(ncol*(log(havemult->GetBinContent(i))-log(mmin))/(log(mmax)-log(mmin)));
618  if(icol < 0) icol=0;
619  if(icol > (ncol-1)) icol=(ncol-1);
620  std::cout << i << " " << icol << " " << havemult->GetBinContent(i) << std::endl;
621  modmult->SetFillColor(gStyle->GetColorPalette(icol));
622  modulesmult.Add(modmult);
623  }
624 
625  }
626 
627  }
628  // eta boundaries lines
629  double etavalext[] = {4.,3.5,3.,2.8,2.6,2.4,2.2,2.0,1.8,1.6};
630  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};
631  TList etalines;
632  TList etalabels;
633  for(int i=0;i<10;++i) {
634  // double eta = 3.0-i*0.2;
635  double eta = etavalext[i];
636  TLine* lin = new TLine(295,2*295/(exp(eta)-exp(-eta)),305,2*305/(exp(eta)-exp(-eta)));
637  etalines.Add(lin);
638  char lab[100];
639  sprintf(lab,"%3.1f",eta);
640  TText* label = new TText(285,2*285/(exp(eta)-exp(-eta)),lab);
641  label->SetTextSize(.03);
642  label->SetTextAlign(22);
643  etalabels.Add(label);
644  }
645  for(int i=0;i<10;++i) {
646  // double eta = -3.0+i*0.2;
647  double eta = -1*etavalext[i];
648  TLine* lin = new TLine(-295,-2*295/(exp(eta)-exp(-eta)),-305,-2*305/(exp(eta)-exp(-eta)));
649  etalines.Add(lin);
650  char lab[100];
651  sprintf(lab,"%3.1f",eta);
652  TText* label = new TText(-285,-2*285/(exp(eta)-exp(-eta)),lab);
653  label->SetTextSize(.03);
654  label->SetTextAlign(22);
655  etalabels.Add(label);
656  }
657  for(int i=0;i<15;++i) {
658  // double eta = -1.4+i*0.2;
659  double eta = etavalint[i];
660  TLine* lin = new TLine(130.*(exp(eta)-exp(-eta))/2.,130,138.*(exp(eta)-exp(-eta))/2.,138);
661  etalines.Add(lin);
662  char lab[100];
663  sprintf(lab,"%3.1f",eta);
664  TText* label = new TText(125.*(exp(eta)-exp(-eta))/2.,125,lab);
665  label->SetTextSize(.03);
666  label->SetTextAlign(22);
667  etalabels.Add(label);
668  }
669 
670 
671  TGaxis *raxis = new TGaxis(-310,0,-310,140,0,140,10,"S");
672  TGaxis *zaxis = new TGaxis(-310,0,310,0,-310,310,10,"S");
673  raxis->SetTickSize(.01); zaxis->SetTickSize(.01);
674  raxis->SetTitle("R (cm)"); zaxis->SetTitle("Z (cm)");
675 
676  TList palette;
677  TList mpalette;
678 
679  for(int i = 0;i< ncol ; ++i) {
680  TBox* box= new TBox(315,0+140./ncol*i,330,0+140./ncol*(i+1));
681  box->SetFillStyle(1001);
682  box->SetFillColor(gStyle->GetColorPalette(i));
683  palette.Add(box);
684  mpalette.Add(box);
685 
686  }
687 
688  TGaxis *paxis = new TGaxis(330,0,330,140,min,max,510,"SLG+");
689  paxis->SetTickSize(.02);
690  paxis->SetLabelOffset(paxis->GetLabelOffset()*0.5);
691  palette.Add(paxis);
692 
693  TGaxis *mpaxis = new TGaxis(330,0,330,140,mmin,mmax,510,"SLG+");
694  mpaxis->SetTickSize(.02);
695  mpaxis->SetLabelOffset(paxis->GetLabelOffset()*0.5);
696  mpalette.Add(mpaxis);
697 
698  TCanvas* cc1 = new TCanvas("occumap","occumap",1000,500);
699  cc1->Range(-370.,-20.,390.,150.);
700  TFrame* fr1 = new TFrame(-310,0,310,140);
701  fr1->UseCurrentStyle();
702  fr1->Draw();
703  raxis->Draw(); zaxis->Draw();
704  std::cout << modulesoccu.GetSize() << std::endl;
705  etalines.Draw();
706  etalabels.Draw();
707  palette.Draw();
708  modulesoccu.Draw();
709 
710  TCanvas* cc2 = new TCanvas("multmap","multmap",1000,500);
711  cc2->Range(-370.,-20.,390.,150.);
712  TFrame* fr2 = new TFrame(-310,0,310,140);
713  fr2->UseCurrentStyle();
714  fr2->Draw();
715  raxis->Draw(); zaxis->Draw();
716  std::cout << modulesmult.GetSize() << std::endl;
717  etalines.Draw();
718  etalabels.Draw();
719  mpalette.Draw();
720  modulesmult.Draw();
721 
722  }
723 
724 
725  }
726 }
int i
Definition: DBlmapReader.cc:9
common ppss p3p6s2 common epss epspn46 common const1 w2
Definition: inclppp.h:1
T eta() const
void printFrame(TCanvas *c, TH1D *h, TText *t, const int frame, const int min, const int max)
T min(T a, T b)
Definition: MathUtil.h:58
tuple cout
Definition: gather_cfg.py:121
Definition: vlib.h:208
void PlotOnTrackOccupancyPhase2 ( TFile *  ff,
const char *  module,
const char *  ontrkmod,
const float  mmin,
const float  mmax,
const int  color 
)

Definition at line 758 of file OccupancyPlotMacros.cc.

References gather_cfg::cout, eta(), create_public_lumi_plots::exp, cmsRelvalreport::green(), i, diffTwoXMLs::label, printFrame(), and cmsRelvalreport::red().

758  {
759 
760  if(color == 1) {
761  // A not-so-great color version
762  const Int_t NRGBs = 5;
763  const Int_t NCont = 255;
764  Double_t stops[NRGBs] = { 0.00, 0.25, 0.50, 0.75, 1.00 };
765  Double_t red[NRGBs] = { 0.00, 0.00, 0.40, 1.00, 1.00 };
766  Double_t green[NRGBs] = { 0.00, 0.40, 0.70, 0.60, 1.00 };
767  Double_t blue[NRGBs] = { 0.30, 0.60, 0.00, 0.00, 0.20 };
768  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
769  gStyle->SetNumberContours(NCont);
770  }
771  else if(color==2) {
772  // Gray scale
773  const Int_t NRGBs = 3;
774  const Int_t NCont = 255;
775  Double_t stops[NRGBs] = { 0.00, 0.50, 1.00 };
776  Double_t red[NRGBs] = { 0.90, 0.50, 0.00};
777  Double_t green[NRGBs] = { 0.90, 0.50, 0.00};
778  Double_t blue[NRGBs] = { 0.90, 0.50, 0.00};
779  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
780  gStyle->SetNumberContours(NCont);
781  }
782  else if(color==3) {
783  // used by Kevin in the TRK-11-001 paper
784  const Int_t NRGBs = 7;
785  const Int_t NCont = 255;
786  Double_t stops[NRGBs] = { 0.00, 0.15, 0.30, 0.45, 0.65, 0.85, 1.00 };
787  Double_t red[NRGBs] = { 0.60, 0.30, 0.00, 0.00, 0.60, 0.40, 0.00 };
788  Double_t green[NRGBs] = { 1.00, 0.90, 0.80, 0.75, 0.20, 0.00, 0.00 };
789  Double_t blue[NRGBs] = { 1.00, 1.00, 1.00, 0.30, 0.00, 0.00, 0.00 };
790  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
791  gStyle->SetNumberContours(NCont);
792  }
793 
794  int ncol = gStyle->GetNumberOfColors();
795  std::cout << "Number of colors " << ncol << std::endl;
796 
797  gROOT->SetStyle("Plain");
798 
799  TProfile* avemult=0;
800  TProfile* aveontrkmult=0;
801  TProfile* averadius =0;
802  TProfile* avez =0;
803 
804  if(ff->cd(module)) {
805  avemult= (TProfile*)gDirectory->Get("avemult");
806  averadius = (TProfile*)gDirectory->Get("averadius");
807  avez = (TProfile*)gDirectory->Get("avez");
808  }
809  if(ff->cd(ontrkmod)) aveontrkmult= (TProfile*)gDirectory->Get("avemult");
810 
811  std::cout << "pointers " << avemult << " " << aveontrkmult << " " << averadius << " " << avez << std::endl;
812 
813  if( averadius && avez && avemult && aveontrkmult) {
814 
815  TH1D* havemult = avemult->ProjectionX("havemult");
816  TH1D* haveontrkmult = aveontrkmult->ProjectionX("haveontrkmult");
817  havemult->SetDirectory(0);
818  haveontrkmult->SetDirectory(0);
819  haveontrkmult->Divide(havemult);
820 
821  new TCanvas("ontrkmult","ontrkmult",1200,500);
822  gPad->SetLogy(1);
823  haveontrkmult->SetStats(0);
824  haveontrkmult->SetLineColor(kRed);
825  haveontrkmult->SetMarkerColor(kRed);
826  haveontrkmult->SetMarkerSize(.5);
827  haveontrkmult->SetMarkerStyle(20);
828  haveontrkmult->DrawCopy();
829  TLine* l1 = new TLine(1000,0,1000,haveontrkmult->GetMaximum()); l1->DrawClone();
830  TLine* l2 = new TLine(2000,0,2000,haveontrkmult->GetMaximum()); l2->DrawClone();
831  TLine* l3 = new TLine(3000,0,3000,haveontrkmult->GetMaximum()); l3->DrawClone();
832  TLine* l4 = new TLine(4000,0,4000,haveontrkmult->GetMaximum()); l4->DrawClone();
833  TLine* l5 = new TLine(5000,0,5000,haveontrkmult->GetMaximum()); l5->DrawClone();
834  TText* tpix = new TText(1500,haveontrkmult->GetMaximum(),"BPIX+FPIX"); tpix->SetTextAlign(22); tpix->DrawClone();
835  // TText* ttib = new TText(1500,haveontrkmult->GetMaximum(),"TIB"); ttib->SetTextAlign(22); ttib->DrawClone();
836  // TText* ttid = new TText(2500,haveontrkmult->GetMaximum(),"TID"); ttid->SetTextAlign(22); ttid->DrawClone();
837  TText* ttob = new TText(2500,haveontrkmult->GetMaximum(),"TOB"); ttob->SetTextAlign(22); ttob->DrawClone();
838  TText* ttecm = new TText(3500,haveontrkmult->GetMaximum(),"TEC-"); ttecm->SetTextAlign(22); ttecm->DrawClone();
839  TText* ttecp = new TText(4500,haveontrkmult->GetMaximum(),"TEC+"); ttecp->SetTextAlign(22); ttecp->DrawClone();
840 
841  TCanvas * o2 = new TCanvas("ontrkmult2","ontrkmult2",1200,800);
842  o2->Divide(2,2);
843  printFrame(o2,haveontrkmult,tpix,1,1000,1090);
844  printFrame(o2,haveontrkmult,ttob,2,2000,2900);
845  printFrame(o2,haveontrkmult,ttecm,3,3100,3300);
846  printFrame(o2,haveontrkmult,ttecp,4,4100,4300);
847 
848  // Loop on bins and creation of boxes
849 
850  TList modulesmult;
851 
852  for(int i=1;i<haveontrkmult->GetNbinsX();++i) {
853 
854  if(i<1000) continue;
855 
856  if(averadius->GetBinEntries(i)*avez->GetBinEntries(i)) {
857 
858  double dz = 2.;
859  double dr = 1.;
860  // determine module size
861 
862  if(i > 1000 && i < 1040) { dz=3.33;dr=0.4;}
863  if(i > 1040 && i < 1130) { dr=3.33;dz=0.4;}
864 
865  if(i > 2000 && i < 2550) { dz=2.5;dr=0.1;}
866  if(i > 2550 && i < 3000) { dz=5.0;dr=0.1;}
867 
868  if(i > 3000 && i < 5000) { dz=0.2;dr=5.0;}
869 
870  if(i > 3100 && i < 3119) { dz=0.2;dr=2.5;}
871  if(i > 3140 && i < 3159) { dz=0.2;dr=2.5;}
872  if(i > 3180 && i < 3199) { dz=0.2;dr=2.5;}
873  if(i > 3220 && i < 3239) { dz=0.2;dr=2.5;}
874  if(i > 3260 && i < 3279) { dz=0.2;dr=2.5;}
875 
876  if(i > 4100 && i < 4119) { dz=0.2;dr=2.5;}
877  if(i > 4140 && i < 4159) { dz=0.2;dr=2.5;}
878  if(i > 4180 && i < 4199) { dz=0.2;dr=2.5;}
879  if(i > 4220 && i < 4239) { dz=0.2;dr=2.5;}
880  if(i > 4260 && i < 4279) { dz=0.2;dr=2.5;}
881 
882  {
883  TBox* modmult = new TBox(avez->GetBinContent(i)-dz,averadius->GetBinContent(i)-dr,avez->GetBinContent(i)+dz,averadius->GetBinContent(i)+dr);
884  modmult->SetFillStyle(1001);
885  int icol=int(ncol*(haveontrkmult->GetBinContent(i)-mmin)/(mmax-mmin));
886  if(icol < 0) icol=0;
887  if(icol > (ncol-1)) icol=(ncol-1);
888  std::cout << i << " " << icol << " " << haveontrkmult->GetBinContent(i) << std::endl;
889  modmult->SetFillColor(gStyle->GetColorPalette(icol));
890  modulesmult.Add(modmult);
891  }
892 
893  }
894 
895  }
896  // eta boundaries lines
897  double etavalext[] = {4.,3.5,3.,2.8,2.6,2.4,2.2,2.0,1.8,1.6};
898  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};
899  TList etalines;
900  TList etalabels;
901  for(int i=0;i<10;++i) {
902  // double eta = 3.0-i*0.2;
903  double eta = etavalext[i];
904  TLine* lin = new TLine(295,2*295/(exp(eta)-exp(-eta)),305,2*305/(exp(eta)-exp(-eta)));
905  etalines.Add(lin);
906  char lab[100];
907  sprintf(lab,"%3.1f",eta);
908  TText* label = new TText(285,2*285/(exp(eta)-exp(-eta)),lab);
909  label->SetTextSize(.03);
910  label->SetTextAlign(22);
911  etalabels.Add(label);
912  }
913  for(int i=0;i<10;++i) {
914  // double eta = -3.0+i*0.2;
915  double eta = -1*etavalext[i];
916  TLine* lin = new TLine(-295,-2*295/(exp(eta)-exp(-eta)),-305,-2*305/(exp(eta)-exp(-eta)));
917  etalines.Add(lin);
918  char lab[100];
919  sprintf(lab,"%3.1f",eta);
920  TText* label = new TText(-285,-2*285/(exp(eta)-exp(-eta)),lab);
921  label->SetTextSize(.03);
922  label->SetTextAlign(22);
923  etalabels.Add(label);
924  }
925  for(int i=0;i<15;++i) {
926  // double eta = -1.4+i*0.2;
927  double eta = etavalint[i];
928  TLine* lin = new TLine(130.*(exp(eta)-exp(-eta))/2.,130,138.*(exp(eta)-exp(-eta))/2.,138);
929  etalines.Add(lin);
930  char lab[100];
931  sprintf(lab,"%3.1f",eta);
932  TText* label = new TText(125.*(exp(eta)-exp(-eta))/2.,125,lab);
933  label->SetTextSize(.03);
934  label->SetTextAlign(22);
935  etalabels.Add(label);
936  }
937 
938 
939  TGaxis *raxis = new TGaxis(-310,0,-310,140,0,140,10,"S");
940  TGaxis *zaxis = new TGaxis(-310,0,310,0,-310,310,10,"S");
941  raxis->SetTickSize(.01); zaxis->SetTickSize(.01);
942  raxis->SetTitle("R (cm)"); zaxis->SetTitle("Z (cm)");
943 
944  TList mpalette;
945 
946  for(int i = 0;i< ncol ; ++i) {
947  TBox* box= new TBox(315,0+140./ncol*i,330,0+140./ncol*(i+1));
948  box->SetFillStyle(1001);
949  box->SetFillColor(gStyle->GetColorPalette(i));
950  mpalette.Add(box);
951 
952  }
953 
954  TGaxis *mpaxis = new TGaxis(330,0,330,140,mmin,mmax,510,"SL+");
955  mpaxis->SetTickSize(.02);
956  mpaxis->SetLabelOffset(mpaxis->GetLabelOffset()*0.5);
957  mpalette.Add(mpaxis);
958 
959  TCanvas* cc2 = new TCanvas("multmap","multmap",1000,500);
960  cc2->Range(-370.,-20.,390.,150.);
961  TFrame* fr2 = new TFrame(-310,0,310,140);
962  fr2->UseCurrentStyle();
963  fr2->Draw();
964  raxis->Draw(); zaxis->Draw();
965  std::cout << modulesmult.GetSize() << std::endl;
966  etalines.Draw();
967  etalabels.Draw();
968  mpalette.Draw();
969  modulesmult.Draw();
970 
971  }
972 
973 }
int i
Definition: DBlmapReader.cc:9
T eta() const
void printFrame(TCanvas *c, TH1D *h, TText *t, const int frame, const int min, const int max)
tuple cout
Definition: gather_cfg.py:121
Definition: vlib.h:208
void PlotTrackerXsect ( TFile *  ff,
const char *  module,
const int  color 
)

Definition at line 1024 of file OccupancyPlotMacros.cc.

References gather_cfg::cout, eta(), create_public_lumi_plots::exp, i, and diffTwoXMLs::label.

1024  {
1025 
1026  gROOT->SetStyle("Plain");
1027 
1028  if(ff->cd(module)) {
1029 
1030  TProfile* averadius = (TProfile*)gDirectory->Get("averadius");
1031  TProfile* avez = (TProfile*)gDirectory->Get("avez");
1032 
1033  std::cout << "pointers " << averadius << " " << avez << std::endl;
1034 
1035  if(averadius && avez) {
1036 
1037  // Loop on bins and creation of boxes
1038 
1039  TList modulesoccu;
1040 
1041  for(int i=1;i<averadius->GetNbinsX();++i) {
1042 
1043  if(averadius->GetBinEntries(i)*avez->GetBinEntries(i)) {
1044 
1045  double dz = 2.;
1046  double dr = 1.;
1047  // determine module size
1048 
1049  if(i > 100 && i < 200) { dz=3.33;dr=0.4;} // BPIX
1050 
1051  if(i > 200 && i < 1000 && ( i%10 == 1 || i%10 == 7)) { dz=0.8;dr=0.4;} // FPIX
1052  if(i > 200 && i < 1000 && !( i%10 == 1 || i%10 == 7)) { dz=0.8;dr=0.8;}
1053 
1054  if(i > 1000 && i < 2000) { dz=5.948;dr=0.4;} // TIB
1055 
1056  if(i > 3000 && i < 4000) { dz=9.440;dr=0.4;} // TOB
1057 
1058  if(i > 2000 && i < 3000 && (i%1000)/100 == 1) { dz=0.8;dr=5.647;} // TID
1059  if(i > 2000 && i < 3000 && (i%1000)/100 == 2) { dz=0.8;dr=4.512;}
1060  if(i > 2000 && i < 3000 && (i%1000)/100 == 3) { dz=0.8;dr=5.637;}
1061 
1062  if(i > 4000 && i < 6000 && (i%1000)/100 == 1) { dz=0.8;dr=4.362;} // TEC
1063  if(i > 4000 && i < 6000 && (i%1000)/100 == 2) { dz=0.8;dr=4.512;}
1064  if(i > 4000 && i < 6000 && (i%1000)/100 == 3) { dz=0.8;dr=5.637;}
1065  if(i > 4000 && i < 6000 && (i%1000)/100 == 4) { dz=0.8;dr=5.862;}
1066  if(i > 4000 && i < 6000 && (i%1000)/100 == 5) { dz=0.8;dr=7.501;}
1067  if(i > 4000 && i < 6000 && (i%1000)/100 == 6) { dz=0.8;dr=9.336;}
1068  if(i > 4000 && i < 6000 && (i%1000)/100 == 7) { dz=0.8;dr=10.373;}
1069 
1070  {
1071  TBox* modoccu = new TBox(avez->GetBinContent(i)-dz,averadius->GetBinContent(i)-dr,avez->GetBinContent(i)+dz,averadius->GetBinContent(i)+dr);
1072  modoccu->SetFillStyle(1001);
1073  modoccu->SetFillColor(kBlack);
1074  modulesoccu.Add(modoccu);
1075  }
1076  }
1077 
1078  }
1079  // eta boundaries lines
1080  double etavalext[] = {3.,2.8,2.6,2.4,2.2,2.0,1.8,1.6};
1081  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};
1082  TList etalines;
1083  TList etalabels;
1084  TList paperlabels;
1085  for(int i=0;i<8;++i) {
1086  // double eta = 3.0-i*0.2;
1087  double eta = etavalext[i];
1088  TLine* lin = new TLine(295,2*295/(exp(eta)-exp(-eta)),305,2*305/(exp(eta)-exp(-eta)));
1089  etalines.Add(lin);
1090  char lab[100];
1091  sprintf(lab,"%3.1f",eta);
1092  TText* label = new TText(285,2*285/(exp(eta)-exp(-eta)),lab);
1093  label->SetTextSize(.03);
1094  label->SetTextAlign(22);
1095  etalabels.Add(label);
1096  }
1097  for(int i=0;i<8;++i) {
1098  // double eta = -3.0+i*0.2;
1099  double eta = -1*etavalext[i];
1100  TLine* lin = new TLine(-295,-2*295/(exp(eta)-exp(-eta)),-305,-2*305/(exp(eta)-exp(-eta)));
1101  etalines.Add(lin);
1102  char lab[100];
1103  sprintf(lab,"%3.1f",eta);
1104  TText* label = new TText(-285,-2*285/(exp(eta)-exp(-eta)),lab);
1105  label->SetTextSize(.03);
1106  label->SetTextAlign(22);
1107  etalabels.Add(label);
1108  }
1109  for(int i=0;i<15;++i) {
1110  // double eta = -1.4+i*0.2;
1111  double eta = etavalint[i];
1112  TLine* lin = new TLine(130.*(exp(eta)-exp(-eta))/2.,130,138.*(exp(eta)-exp(-eta))/2.,138);
1113  etalines.Add(lin);
1114  char lab[100];
1115  sprintf(lab,"%3.1f",eta);
1116  TText* label = new TText(125.*(exp(eta)-exp(-eta))/2.,125,lab);
1117  label->SetTextSize(.03);
1118  label->SetTextAlign(22);
1119  etalabels.Add(label);
1120  }
1121  TLatex* etalab = new TLatex(0,115,"#eta");
1122  etalab->SetTextSize(.03);
1123  etalab->SetTextAlign(22);
1124  etalabels.Add(etalab);
1125 
1126  // CMS label
1127  TLatex *cmslab = new TLatex(0.15,0.965,"CMS");
1128  cmslab->SetNDC();
1129  cmslab->SetTextSize(0.04);
1130  cmslab->SetTextAlign(31);
1131  paperlabels.Add(cmslab);
1132  TLatex *enelab = new TLatex(0.92,0.965,"#sqrt{s} = 7 TeV");
1133  enelab->SetNDC();
1134  enelab->SetTextSize(0.04);
1135  enelab->SetTextAlign(31);
1136  paperlabels.Add(enelab);
1137  /*
1138  TLatex *lumilab = new TLatex(0.6,0.965,Form("L = %.1f fb^{-1}",19.7));
1139  lumilab->SetNDC();
1140  lumilab->SetTextSize(0.04);
1141  lumilab->SetTextAlign(31);
1142  paperlabels.Add(lumilab);
1143  */
1144 
1145  TGaxis *raxis = new TGaxis(-310,0,-310,140,0,140,10,"S");
1146  TGaxis *zaxis = new TGaxis(-310,0,310,0,-310,310,10,"S");
1147  raxis->SetTickSize(.01); zaxis->SetTickSize(.01);
1148  raxis->SetTitle("r (cm)"); zaxis->SetTitle("z (cm)");
1149 
1150  TCanvas* cc1 = new TCanvas("occumap","occumap",1000,500);
1151  cc1->Range(-370.,-20.,390.,150.);
1152  TFrame* fr1 = new TFrame(-310,0,310,140);
1153  fr1->UseCurrentStyle();
1154  fr1->Draw();
1155  raxis->Draw(); zaxis->Draw();
1156  std::cout << modulesoccu.GetSize() << std::endl;
1157  etalines.Draw();
1158  etalabels.Draw();
1159  paperlabels.Draw();
1160  modulesoccu.Draw();
1161 
1162  }
1163 
1164 
1165  }
1166 
1167 }
int i
Definition: DBlmapReader.cc:9
T eta() const
tuple cout
Definition: gather_cfg.py:121
Definition: vlib.h:208
void printFrame ( TCanvas *  c,
TH1D *  h,
TText *  t,
const int  frame,
const int  min,
const int  max 
)

Definition at line 23 of file OccupancyPlotMacros.cc.

Referenced by PlotOccupancyMapPhase2(), and PlotOnTrackOccupancyPhase2().

23  {
24  c->cd(frame);
25  h->SetAxisRange(min,max);
26  h->DrawCopy();
27  t->SetY(h->GetMaximum()); t->SetX((max+min)/2); t->DrawClone();
28 }
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
T min(T a, T b)
Definition: MathUtil.h:58