CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
comparisonPlots Class Reference

#include <comparisonPlots.h>

Public Member Functions

 comparisonPlots (std::string filename, std::string outputDir, std::string outputFilename="OUTPUT_comparison.root")
 
void plot3x5 (TCut Cut, char *dirName, bool savePlot=false, std::string plotName="plot3x5.eps", bool autolimits=false, int ColorCode=1)
 
void plot3x5Profile (TCut Cut, char *dirName, int nBins, bool savePlot=false, std::string plotName="plot3x5Profile.eps", bool autolimits=false, int ColorCode=1)
 
void readTree ()
 
void Write ()
 

Public Attributes

float arrowSize
 
TTree * data
 
TFile * fin
 
TFile * output
 

Private Member Functions

void getHistMaxMin (TH1 *hist, double &max, double &min, int flag)
 
void getMaxMin ()
 

Private Attributes

std::string _outputDir
 
float alpha_
 
float beta_
 
float dalpha_
 
float dbeta_
 
int detDim_
 
float dgamma_
 
float dphi_
 
float dr_
 
float dx_
 
float dy_
 
float dz_
 
float eta_
 
float gamma_
 
int id_
 
int level_
 
float maxDR
 
float maxDX
 
float maxDY
 
float maxDZ
 
float maxPhi
 
float maxR
 
float maxRDPhi
 
float maxZ
 
int mid_
 
float minDR
 
float minDX
 
float minDY
 
float minDZ
 
float minPhi
 
float minR
 
float minRDPhi
 
float minZ
 
int mlevel_
 
float phi_
 
float r_
 
int sublevel_
 
int useDetId_
 
float x_
 
float y_
 
float z_
 

Detailed Description

Definition at line 24 of file comparisonPlots.h.

Constructor & Destructor Documentation

comparisonPlots::comparisonPlots ( std::string  filename,
std::string  outputDir,
std::string  outputFilename = "OUTPUT_comparison.root" 
)

Definition at line 16 of file comparisonPlots.cc.

References _outputDir, fin, output, indexGen::outputDir, and readTree().

17 {
18 
20 
21  fin = new TFile(filename.c_str());
22  fin->cd();
23 
24  output = new TFile((outputDir+outputFilename).c_str(),"recreate");
25  output->cd();
26 
27  readTree();
28 
29 }
tuple filename
Definition: lut2db_cfg.py:20
std::string _outputDir

Member Function Documentation

void comparisonPlots::getHistMaxMin ( TH1 *  hist,
double &  max,
double &  min,
int  flag 
)
private

Definition at line 1048 of file comparisonPlots.cc.

References i.

Referenced by plot3x5(), and plot3x5Profile().

1048  {
1049 
1050  int nBins = hist->GetNbinsX();
1051  for (int i = 0; i < nBins; ++i){
1052  double binContent = hist->GetBinContent(i);
1053  if (binContent > 0){
1054  //double binWidth = hist->GetBinLowEdge(i) - hist->GetBinLowEdge(i-1);
1055  //std::cout << "bin width1: " << hist->GetBinWidth(i) << ", bin width2: " << binWidth << std::endl;
1056  if (flag == 0) max = hist->GetBinLowEdge(i) + 2.*hist->GetBinWidth(i) + 0.1*hist->GetBinLowEdge(i);
1057  if (flag == 1) max = hist->GetBinLowEdge(i) + hist->GetBinWidth(i) + 0.1*hist->GetBinLowEdge(i);
1058  }
1059  }
1060  for (int i = (nBins-1); i >= 0; i--){
1061  double binContent = hist->GetBinContent(i);
1062  if (binContent > 0) min = hist->GetBinLowEdge(i) - 0.1*hist->GetBinLowEdge(i);
1063  }
1064  //std::cout << "max: " << max << ", min: " << min << std::endl;
1065 }
int i
Definition: DBlmapReader.cc:9
long int flag
Definition: mlp_lapack.h:47
#define min(a, b)
Definition: mlp_lapack.h:161
const T & max(const T &a, const T &b)
void comparisonPlots::getMaxMin ( )
private

Definition at line 1012 of file comparisonPlots.cc.

References data, dphi_, dr_, dx_, dy_, dz_, i, maxDR, maxDX, maxDY, maxDZ, maxPhi, maxR, maxRDPhi, maxZ, minDR, minDX, minDY, minDZ, minPhi, minR, minRDPhi, minZ, phi_, r_, and z_.

1012  {
1013 
1014  data->GetEntry(0);
1015  minR = r_; maxR = r_;
1016  minZ = z_; maxZ = z_;
1017  minPhi = phi_; maxPhi = phi_;
1018  minDR = dr_; maxDR = dr_;
1019  minDZ = dz_; maxDZ = dz_;
1021  minDX = dx_; maxDX = dx_;
1022  minDY = dy_; maxDY = dy_;
1023 
1024  int nEntries = data->GetEntries();
1025  for (int i = 1; i < nEntries; ++i){
1026  data->GetEntry(i);
1027 
1028  if (r_ < minR) minR = r_;
1029  if (r_ > maxR) maxR = r_;
1030  if (z_ < minZ) minZ = z_;
1031  if (z_ > maxZ) maxZ = z_;
1032  if (phi_ < minPhi) minPhi = phi_;
1033  if (phi_ > maxPhi) maxPhi = phi_;
1034  if (dr_ < minDR) minDR = dr_;
1035  if (dr_ > maxDR) maxDR = dr_;
1036  if (dz_ < minDZ) minDZ = dz_;
1037  if (dz_ > maxDZ) maxDZ = dz_;
1038  if (r_*dphi_ < minRDPhi) minRDPhi = r_*dphi_;
1039  if (r_*dphi_ > maxRDPhi) maxRDPhi = r_*dphi_;
1040  if (dx_ < minDX) minDX = dx_;
1041  if (dx_ > maxDX) maxDX = dx_;
1042  if (dy_ < minDY) minDY = dy_;
1043  if (dy_ > maxDY) maxDY = dy_;
1044  }
1045 }
int i
Definition: DBlmapReader.cc:9
void comparisonPlots::plot3x5 ( TCut  Cut,
char *  dirName,
bool  savePlot = false,
std::string  plotName = "plot3x5.eps",
bool  autolimits = false,
int  ColorCode = 1 
)

Definition at line 60 of file comparisonPlots.cc.

References _outputDir, trackerHits::c, data, getHistMaxMin(), i, j, and output.

60  {
61 
62  //int ColorCodeHalfBarrels = 1; //color seperation of moodules corresponding to the different subdets
63  //if you want to seperate corresponding to the halfbarrels (+z or -z) set colorcode !=1
64  gStyle->SetTitleAlign(22);
65  gStyle->SetTitleX(0.5);
66  gStyle->SetTitleY(0.97);
67  //gStyle->SetShadowColor(0);
68  //gStyle->SetTitleSize(.5);
69  gStyle->SetTitleFont(62);
70 
71  // --------- create directory for histograms ---------
72  //const char* dirName = Cut;
73  TDirectory* plotDir = output->mkdir( dirName );
74 
75  // --------- get right limits for histogram ---------
76  double minimumR, maximumR;
77  double minimumZ, maximumZ;
78  double minimumPhi, maximumPhi;
79  double minimumDR, maximumDR;
80  double minimumDZ, maximumDZ;
81  double minimumRDPhi, maximumRDPhi;
82  double minimumDX, maximumDX;
83  double minimumDY, maximumDY;
84  if (autolimits){
85  // --------- get right limits for histogram ---------
86  TH1F* phr = new TH1F("phr", "phr", 200, 0, 200);
87  TH1F* phz = new TH1F("phz", "phz", 400, -300, 300);
88  TH1F* phphi = new TH1F("phphi", "phphi", 200, -3.15, 3.15);
89  TH1F* phdr = new TH1F("phdr", "phdr", 2000, -10, 10);
90  TH1F* phdz = new TH1F("phdz", "phdz", 2000, -10, 10);
91  TH1F* phrdphi = new TH1F("phrdphi", "phrdphi", 200, -10, 10);
92  TH1F* phdx = new TH1F("phdx", "phy", 2000, -10, 10);
93  TH1F* phdy = new TH1F("phdy", "phy", 2000, -10, 10);
94  data->Project("phr","r",Cut);
95  data->Project("phz","z",Cut);
96  data->Project("phphi","phi",Cut);
97  data->Project("phdr","dr",Cut);
98  data->Project("phdz","dz",Cut);
99  data->Project("phrdphi","r*dphi",Cut);
100  data->Project("phdx","dx",Cut);
101  data->Project("phdy","dy",Cut);
102  getHistMaxMin(phr, maximumR, minimumR, 0);
103  getHistMaxMin(phz, maximumZ, minimumZ, 0);
104  getHistMaxMin(phphi, maximumPhi, minimumPhi, 0);
105  getHistMaxMin(phdr, maximumDR, minimumDR, 1);
106  getHistMaxMin(phdz, maximumDZ, minimumDZ, 1);
107  getHistMaxMin(phrdphi, maximumRDPhi, minimumRDPhi, 1);
108  getHistMaxMin(phdx, maximumDX, minimumDX, 1);
109  getHistMaxMin(phdy, maximumDY, minimumDY, 1);
110  }
111  else{
112  minimumR = 0., maximumR = 200.;
113  minimumZ = -300., maximumZ = 300.;
114  minimumPhi = -3.15, maximumPhi = 3.15;
115  minimumDR = -1, maximumDR = 1;
116  minimumDZ = -1, maximumDZ = 1;
117  minimumRDPhi = -1, maximumRDPhi = 1;
118  minimumDX = -1, maximumDX = 1;
119  minimumDY = -1, maximumDY = 1;
120  }
121 
122 
123  // --------- declare histograms ---------
124  TH1F* h_dr = new TH1F("h_dr", "#Delta r", 2000, minimumDR, maximumDR);
125  TH1F* h_dz = new TH1F("h_dz", "#Delta z", 2000, minimumDZ, maximumDZ);
126  TH1F* h_rdphi = new TH1F("h_rdphi", "r* #Delta #phi", 2000, minimumRDPhi, maximumRDPhi);
127  TH2F* h_drVr = new TH2F("h_drVr","#Delta r vs. r",200,minimumR,maximumR,200,minimumDR,maximumDR);
128  TH2F* h_dzVr = new TH2F("h_dzVr","#Delta z vs. r",200,minimumR,maximumR,200,minimumDZ,maximumDZ);
129  TH2F* h_rdphiVr = new TH2F("h_rdphiVr","r#Delta #phi vs. r",200,minimumR,maximumR,200,minimumRDPhi,maximumRDPhi);
130  TH2F* h_dxVr = new TH2F("h_dxVr","#Delta x vs. r", 200,minimumR,maximumR, 200,minimumDX,maximumDX);
131  TH2F* h_dyVr = new TH2F("h_dyVr","#Delta y vs. r", 200,minimumR,maximumR, 200,minimumDY,maximumDY);
132  TH2F* h_drVz = new TH2F("h_drVz","#Delta r vs. z", 200,minimumZ,maximumZ, 200,minimumDR,maximumDR);
133  TH2F* h_dzVz = new TH2F("h_dzVz","#Delta z vs. z", 200,minimumZ,maximumZ, 200,minimumDZ,maximumDZ);
134  TH2F* h_rdphiVz = new TH2F("h_rdphiVz","r#Delta #phi vs. z", 200,minimumZ,maximumZ, 200,minimumRDPhi,maximumRDPhi);
135  TH2F* h_dxVz = new TH2F("h_dxVz","#Delta x vs. z", 200,minimumZ,maximumZ, 200,minimumDX,maximumDX);
136  TH2F* h_dyVz = new TH2F("h_dyVz","#Delta y vs. z", 200,minimumZ,maximumZ, 200,minimumDY,maximumDY);
137  TH2F* h_drVphi = new TH2F("h_drVphi","#Delta r vs. #phi", 200,minimumPhi,maximumPhi,200,minimumDR,maximumDR);
138  TH2F* h_dzVphi = new TH2F("h_dzVphi","#Delta z vs. #phi", 200,minimumPhi,maximumPhi, 200,minimumDZ,maximumDZ);
139  TH2F* h_rdphiVphi = new TH2F("h_rdphiVphi","r#Delta #phi vs. #phi", 200,minimumPhi,maximumPhi,200,minimumRDPhi,maximumRDPhi);
140  TH2F* h_dxVphi = new TH2F("h_dxVphi","#Delta x vs. #phi", 200,minimumPhi,maximumPhi, 200,minimumDX,maximumDX);
141  TH2F* h_dyVphi = new TH2F("h_dyVphi","#Delta y vs. #phi", 200,minimumPhi,maximumPhi, 200,minimumDY,maximumDY);
142 
143  h_drVr->SetMarkerStyle(6);
144  h_dzVr->SetMarkerStyle(6);
145  h_rdphiVr->SetMarkerStyle(6);
146  h_dxVr->SetMarkerStyle(6);
147  h_dyVr->SetMarkerStyle(6);
148  h_drVz->SetMarkerStyle(6);
149  h_dzVz->SetMarkerStyle(6);
150  h_rdphiVz->SetMarkerStyle(6);
151  h_dxVz->SetMarkerStyle(6);
152  h_dyVz->SetMarkerStyle(6);
153  h_drVphi->SetMarkerStyle(6);
154  h_dzVphi->SetMarkerStyle(6);
155  h_rdphiVphi->SetMarkerStyle(6);
156  h_dxVphi->SetMarkerStyle(6);
157  h_dyVphi->SetMarkerStyle(6);
158 
159 
160  int j = 2;
161  TCut zCut[6];
162  zCut[0] = "z < 0";
163  zCut[1] = "z >= 0";
164 
165 
166  if (ColorCode == 1) {
167  j = 6;
168  zCut[6];
169  zCut[0] = "sublevel==1";
170  zCut[1] = "sublevel==2";
171  zCut[2] = "sublevel==3";
172  zCut[3] = "sublevel==4";
173  zCut[4] = "sublevel==5";
174  zCut[5] = "sublevel==6";
175  }
176 
177  // --------- project tree onto histograms ---------
178  data->Project("h_dr","dr",Cut);
179  data->Project("h_dz","dz",Cut);
180  data->Project("h_rdphi","r*dphi",Cut);
181 
182 
183  data->Project("h_drVr", "dr:r",Cut);
184  TGraph* gr_drVr_Array[j];
185  TMultiGraph* mgr_drVr=new TMultiGraph();
186  for ( int i = 0; i < j; i++) {
187  data->Draw("dr:r",Cut+zCut[i]);
188  gr_drVr_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
189  gr_drVr_Array[i]->SetMarkerColor(int(i/4)+i+1);
190  gr_drVr_Array[i]->SetMarkerStyle(6);
191  mgr_drVr->Add(gr_drVr_Array[i],"p");
192  }
193 
194  data->Project("h_dzVr", "dz:r",Cut);
195  TGraph* gr_dzVr_Array[j];
196  TMultiGraph* mgr_dzVr=new TMultiGraph();
197  for ( int i = 0; i < j; i++) {
198  data->Draw("dz:r",Cut+zCut[i]);
199  gr_dzVr_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
200  gr_dzVr_Array[i]->SetMarkerColor(int(i/4)+i+1);
201  gr_dzVr_Array[i]->SetMarkerStyle(6);
202  mgr_dzVr->Add(gr_dzVr_Array[i],"p");
203  }
204 
205  data->Project("h_rdphiVr", "r*dphi:r",Cut);
206  TGraph* gr_rdphiVr_Array[j];
207  TMultiGraph* mgr_rdphiVr=new TMultiGraph();
208  for ( int i = 0; i < j; i++) {
209  data->Draw("r*dphi:r",Cut+zCut[i]);
210  gr_rdphiVr_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
211  gr_rdphiVr_Array[i]->SetMarkerColor(int(i/4)+i+1);
212  gr_rdphiVr_Array[i]->SetMarkerStyle(6);
213  mgr_rdphiVr->Add(gr_rdphiVr_Array[i],"p");
214  }
215 
216  data->Project("h_dxVr", "dx:r",Cut);
217  TGraph* gr_dxVr_Array[j];
218  TMultiGraph* mgr_dxVr=new TMultiGraph();
219  for ( int i = 0; i < j; i++) {
220  data->Draw("dx:r",Cut+zCut[i]);
221  gr_dxVr_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
222  gr_dxVr_Array[i]->SetMarkerColor(int(i/4)+i+1);
223  gr_dxVr_Array[i]->SetMarkerStyle(6);
224  mgr_dxVr->Add(gr_dxVr_Array[i],"p");
225  }
226 
227  data->Project("h_dyVr", "dy:r",Cut);
228  TGraph* gr_dyVr_Array[j];
229  TMultiGraph* mgr_dyVr=new TMultiGraph();
230  for ( int i = 0; i < j; i++) {
231  data->Draw("dy:r",Cut+zCut[i]);
232  gr_dyVr_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
233  gr_dyVr_Array[i]->SetMarkerColor(int(i/4)+i+1);
234  gr_dyVr_Array[i]->SetMarkerStyle(6);
235  mgr_dyVr->Add(gr_dyVr_Array[i],"p");
236  }
237 
238  data->Project("h_drVz", "dr:z",Cut);
239  TGraph* gr_drVz_Array[j];
240  TMultiGraph* mgr_drVz=new TMultiGraph();
241  for ( int i = 0; i < j; i++) {
242  data->Draw("dr:z",Cut+zCut[i]);
243  gr_drVz_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
244  gr_drVz_Array[i]->SetMarkerColor(int(i/4)+i+1);
245  gr_drVz_Array[i]->SetMarkerStyle(6);
246  mgr_drVz->Add(gr_drVz_Array[i],"p");
247  }
248 
249  data->Project("h_dzVz", "dz:z",Cut);
250  TGraph* gr_dzVz_Array[j];
251  TMultiGraph* mgr_dzVz=new TMultiGraph();
252  for ( int i = 0; i < j; i++) {
253  data->Draw("dz:z",Cut+zCut[i]);
254  gr_dzVz_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
255  gr_dzVz_Array[i]->SetMarkerColor(int(i/4)+i+1);
256  gr_dzVz_Array[i]->SetMarkerStyle(6);
257  mgr_dzVz->Add(gr_dzVz_Array[i],"p");
258  }
259 
260  data->Project("h_rdphiVz", "r*dphi:z",Cut);
261  TGraph* gr_rdphiVz_Array[j];
262  TMultiGraph* mgr_rdphiVz=new TMultiGraph();
263  for ( int i = 0; i < j; i++) {
264  data->Draw("r*dphi:z",Cut+zCut[i]);
265  gr_rdphiVz_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
266  gr_rdphiVz_Array[i]->SetMarkerColor(int(i/4)+i+1);
267  gr_rdphiVz_Array[i]->SetMarkerStyle(6);
268  mgr_rdphiVz->Add(gr_rdphiVz_Array[i],"p");
269  }
270 
271  data->Project("h_dxVz", "dx:z",Cut);
272  TGraph* gr_dxVz_Array[j];
273  TMultiGraph* mgr_dxVz=new TMultiGraph();
274  for ( int i = 0; i < j; i++) {
275  data->Draw("dx:z",Cut+zCut[i]);
276  gr_dxVz_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
277  gr_dxVz_Array[i]->SetMarkerColor(int(i/4)+i+1);
278  gr_dxVz_Array[i]->SetMarkerStyle(6);
279  mgr_dxVz->Add(gr_dxVz_Array[i],"p");
280  }
281 
282  data->Project("h_dyVz", "dy:z",Cut);
283  TGraph* gr_dyVz_Array[j];
284  TMultiGraph* mgr_dyVz=new TMultiGraph();
285  for ( int i = 0; i < j; i++) {
286  data->Draw("dy:z",Cut+zCut[i]);
287  gr_dyVz_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
288  gr_dyVz_Array[i]->SetMarkerColor(int(i/4)+i+1);
289  gr_dyVz_Array[i]->SetMarkerStyle(6);
290  mgr_dyVz->Add(gr_dyVz_Array[i],"p");
291  }
292 
293  data->Project("h_drVphi", "dr:phi",Cut);
294  TGraph* gr_drVphi_Array[j];
295  TMultiGraph* mgr_drVphi=new TMultiGraph();
296  for ( int i = 0; i < j; i++) {
297  data->Draw("dr:phi",Cut+zCut[i]);
298  gr_drVphi_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
299  gr_drVphi_Array[i]->SetMarkerColor(int(i/4)+i+1);
300  gr_drVphi_Array[i]->SetMarkerStyle(6);
301  mgr_drVphi->Add(gr_drVphi_Array[i],"p");
302  }
303 
304  data->Project("h_dzVphi", "dz:phi",Cut);
305  TGraph* gr_dzVphi_Array[j];
306  TMultiGraph* mgr_dzVphi=new TMultiGraph();
307  for ( int i = 0; i < j; i++) {
308  data->Draw("dz:phi",Cut+zCut[i]);
309  gr_dzVphi_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
310  gr_dzVphi_Array[i]->SetMarkerColor(int(i/4)+i+1);
311  gr_dzVphi_Array[i]->SetMarkerStyle(6);
312  mgr_dzVphi->Add(gr_dzVphi_Array[i],"p");
313  }
314 
315  data->Project("h_rdphiVphi", "r*dphi:phi",Cut);
316  TGraph* gr_rdphiVphi_Array[j];
317  TMultiGraph* mgr_rdphiVphi=new TMultiGraph();
318  for ( int i = 0; i < j; i++) {
319  data->Draw("r*dphi:phi",Cut+zCut[i]);
320  gr_rdphiVphi_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
321  gr_rdphiVphi_Array[i]->SetMarkerColor(int(i/4)+i+1);
322  gr_rdphiVphi_Array[i]->SetMarkerStyle(6);
323  mgr_rdphiVphi->Add(gr_rdphiVphi_Array[i],"p");
324  }
325 
326  data->Project("h_dxVphi", "dx:phi",Cut);
327  TGraph* gr_dxVphi_Array[j];
328  TMultiGraph* mgr_dxVphi=new TMultiGraph();
329  for ( int i = 0; i < j; i++) {
330  data->Draw("dx:phi",Cut+zCut[i]);
331  gr_dxVphi_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
332  gr_dxVphi_Array[i]->SetMarkerColor(int(i/4)+i+1);
333  gr_dxVphi_Array[i]->SetMarkerStyle(6);
334  mgr_dxVphi->Add(gr_dxVphi_Array[i],"p");
335  }
336 
337  data->Project("h_dyVphi", "dy:phi",Cut);
338  TGraph* gr_dyVphi_Array[j];
339  TMultiGraph* mgr_dyVphi=new TMultiGraph();
340  for ( int i = 0; i < j; i++) {
341  data->Draw("dy:phi",Cut+zCut[i]);
342  gr_dyVphi_Array[i] = new TGraph(data->GetSelectedRows(),data->GetV2(),data->GetV1());
343  gr_dyVphi_Array[i]->SetMarkerColor(int(i/4)+i+1);
344  gr_dyVphi_Array[i]->SetMarkerStyle(6);
345  mgr_dyVphi->Add(gr_dyVphi_Array[i],"p");
346  }
347 
348 
349 
350  // --------- draw histograms ---------
351  TCanvas* c0 = new TCanvas("c0", "c0", 200, 10, 900, 300);
352  c0->SetFillColor(0);
353  c0->Divide(3,1);
354  c0->cd(1);
355  h_dr->Draw();
356  c0->cd(2);
357  h_dz->Draw();
358  c0->cd(3);
359  h_rdphi->Draw();
360  if (savePlot) c0->Print((_outputDir+"plot3x1_"+plotName).c_str());
361 
362  mgr_drVr->SetTitle("#Delta r vs. r");
363  //TStyle::SetTitleAlign(23)
364  mgr_dzVr->SetTitle("#Delta z vs. r");
365  mgr_rdphiVr->SetTitle("r#Delta #phi vs. r");
366  mgr_dxVr->SetTitle("#Delta x vs. r");
367  mgr_dyVr->SetTitle("#Delta y vs. r");
368  mgr_drVz->SetTitle("#Delta r vs. z");
369  mgr_dzVz->SetTitle("#Delta z vs. z");
370  mgr_rdphiVz->SetTitle("r#Delta #phi vs. z");
371  mgr_dxVz->SetTitle("#Delta x vs. z");
372  mgr_dyVz->SetTitle("#Delta y vs. z");
373  mgr_drVphi->SetTitle("#Delta r vs. #phi");
374  mgr_dzVphi->SetTitle("#Delta z vs. #phi");
375  mgr_rdphiVphi->SetTitle("r#Delta #phi vs. #phi");
376  mgr_dxVphi->SetTitle("#Delta x vs. #phi");
377  mgr_dyVphi->SetTitle("#Delta y vs. #phi");
378 
379  // --------- draw histograms ---------
380  TCanvas* c = new TCanvas("c", "c", 200, 10, 1200, 700);
381  c->SetFillColor(0);
382  data->SetMarkerSize(0.5);
383  data->SetMarkerStyle(6);
384  c->Divide(5,3);
385  c->cd(1);
386  if (!autolimits) h_drVr->Draw();
387  if (autolimits) mgr_drVr->Draw("a");
388  c->Update();
389  c->cd(2);
390  if (!autolimits) h_dzVr->Draw();
391  if (autolimits) mgr_dzVr->Draw("a");
392  c->Update();
393  c->cd(3);
394  if (!autolimits) h_rdphiVr->Draw();
395  if (autolimits) mgr_rdphiVr->Draw("a");
396  c->cd(4);
397  if (!autolimits) h_dxVr->Draw();
398  if (autolimits) mgr_dxVr->Draw("a");
399  c->cd(5);
400  if (!autolimits) h_dyVr->Draw();
401  if (autolimits) mgr_dyVr->Draw("a");
402  c->cd(6);
403  if (!autolimits) h_drVz->Draw();
404  if (autolimits) mgr_drVz->Draw("a");
405  c->cd(7);
406  if (!autolimits) h_dzVz->Draw();
407  if (autolimits) mgr_dzVz->Draw("a");
408  c->cd(8);
409  if (!autolimits) h_rdphiVz->Draw();
410  if (autolimits) mgr_rdphiVz->Draw("a");
411  c->cd(9);
412  if (!autolimits) h_dxVz->Draw();
413  if (autolimits) mgr_dxVz->Draw("a");
414  c->cd(10);
415  if (!autolimits) h_dyVz->Draw();
416  if (autolimits) mgr_dyVz->Draw("a");
417  c->cd(11);
418  if (!autolimits) h_drVphi->Draw();
419  if (autolimits) mgr_drVphi->Draw("a");
420  c->cd(12);
421  if (!autolimits) h_dzVphi->Draw();
422  if (autolimits) mgr_dzVphi->Draw("a");
423  c->cd(13);
424  if (!autolimits) h_rdphiVphi->Draw();
425  if (autolimits) mgr_rdphiVphi->Draw("a");
426  c->cd(14);
427  if (!autolimits) h_dxVphi->Draw();
428  if (autolimits) mgr_dxVphi->Draw("a");
429  c->cd(15);
430  if (!autolimits) h_dyVphi->Draw();
431  if (autolimits) mgr_dyVphi->Draw("a");
432 
433  c->Update();
434 
435  // --------- set output directory for histograms ---------
436  plotDir->cd();
437  h_dr->Write(); h_dz->Write(); h_rdphi->Write();
438  h_drVr->Write(); h_dzVr->Write(); h_rdphiVr->Write(); h_dxVr->Write(); h_dyVr->Write();
439  h_drVz->Write(); h_dzVz->Write(); h_rdphiVz->Write(); h_dxVz->Write(); h_dyVz->Write();
440  h_drVphi->Write(); h_dzVphi->Write(); h_rdphiVphi->Write(); h_dxVphi->Write(); h_dyVphi->Write();
441 
442  if (savePlot) c->Print((_outputDir+"plot3x5_"+plotName).c_str());
443 
444 }
int i
Definition: DBlmapReader.cc:9
void getHistMaxMin(TH1 *hist, double &max, double &min, int flag)
int j
Definition: DBlmapReader.cc:9
std::string _outputDir
void comparisonPlots::plot3x5Profile ( TCut  Cut,
char *  dirName,
int  nBins,
bool  savePlot = false,
std::string  plotName = "plot3x5Profile.eps",
bool  autolimits = false,
int  ColorCode = 1 
)

Definition at line 446 of file comparisonPlots.cc.

References _outputDir, trackerHits::c, data, TrackerOfflineValidation_Dqm_cff::dirName, getHistMaxMin(), i, j, output, and asciidump::s.

446  {
447 
448  //for all histograms set the title centered
449  gStyle->SetTitleAlign(22);
450  gStyle->SetTitleX(0.5);
451  gStyle->SetTitleY(0.97);
452  //gStyle->SetShadowColor(0);
453  //gStyle->SetTitleSize(.5);
454  gStyle->SetTitleFont(62);
455  //int ColorCodeHalfBarrels = 1; //color seperation of moodules corresponding to the different subdets
456  //if you want to seperate corresponding to the halfbarrels (+z or -z) set colorcode !=1
457  // --------- create directory for histograms ---------
458  //const char* dirName = Cut;
459  string s;// = "profile";
460  s = s + dirName;
461  s.append("_profile");
462  TDirectory* plotDir = output->mkdir( s.data() );
463 
464 
465  int j = 2;
466  TCut zCut[6];
467  zCut[0] = "z < 0";
468  zCut[1] = "z >= 0";
469 
470 
471  if (ColorCode == 1) {
472  j = 6;
473  zCut[6];
474  zCut[0] = "sublevel==1";
475  zCut[1] = "sublevel==2";
476  zCut[2] = "sublevel==3";
477  zCut[3] = "sublevel==4";
478  zCut[4] = "sublevel==5";
479  zCut[5] = "sublevel==6";
480 
481  }
482 
483  double minimumR, maximumR;
484  double minimumZ, maximumZ;
485  double minimumPhi, maximumPhi;
486  double minimumDR, maximumDR;
487  double minimumDZ, maximumDZ;
488  double minimumRDPhi, maximumRDPhi;
489  double minimumDX, maximumDX;
490  double minimumDY, maximumDY;
491  if (autolimits){
492  // --------- get right limits for histogram ---------
493  TH1F* phr = new TH1F("phr", "phr", 200, 0, 200);
494  TH1F* phz = new TH1F("phz", "phz", 400, -300, 300);
495  TH1F* phphi = new TH1F("phphi", "phphi", 200, -3.15, 3.15);
496  TH1F* phdr = new TH1F("phdr", "phdr", 2000, -10, 10);
497  TH1F* phdz = new TH1F("phdz", "phdz", 2000, -10, 10);
498  TH1F* phrdphi = new TH1F("phrdphi", "phrdphi", 200, -10, 10);
499  TH1F* phdx = new TH1F("phdx", "phy", 2000, -10, 10);
500  TH1F* phdy = new TH1F("phdy", "phy", 2000, -10, 10);
501  data->Project("phr","r",Cut);
502  data->Project("phz","z",Cut);
503  data->Project("phphi","phi",Cut);
504  data->Project("phdr","dr",Cut);
505  data->Project("phdz","dz",Cut);
506  data->Project("phrdphi","r*dphi",Cut );
507  data->Project("phdx","dx",Cut );
508  data->Project("phdy","dy",Cut );
509  getHistMaxMin(phr, maximumR, minimumR, 0);
510  getHistMaxMin(phz, maximumZ, minimumZ, 0);
511  getHistMaxMin(phphi, maximumPhi, minimumPhi, 0);
512  getHistMaxMin(phdr, maximumDR, minimumDR, 1);
513  getHistMaxMin(phdz, maximumDZ, minimumDZ, 1);
514  getHistMaxMin(phrdphi, maximumRDPhi, minimumRDPhi, 1);
515  getHistMaxMin(phdx, maximumDX, minimumDX, 1);
516  getHistMaxMin(phdy, maximumDY, minimumDY, 1);
517  }
518  else{
519  minimumR = 0., maximumR = 120.;
520  minimumZ = -300., maximumZ = 300.;
521  minimumPhi = -3.15, maximumPhi = 3.15;
522  minimumDR = -1, maximumDR = 1;
523  minimumDZ = -1, maximumDZ = 1;
524  minimumRDPhi = -1, maximumRDPhi = 1;
525  minimumDX = -1, maximumDX = 1;
526  minimumDY = -1, maximumDY = 1;
527  }
528 
529  // --------- declare histograms ---------
530  TProfile* hprof_drVr = new TProfile("hprof_drVr","#Delta r vs. r",nBins,minimumR,maximumR,minimumDR,maximumDR);
531  TProfile* hprof_dzVr = new TProfile("hprof_dzVr","#Delta z vs. r",nBins,minimumR,maximumR,minimumDZ,maximumDZ);
532  TProfile* hprof_rdphiVr = new TProfile("hprof_rdphiVr","r#Delta #phi vs. r",nBins,minimumR,maximumR,minimumRDPhi,maximumRDPhi);
533  TProfile* hprof_dxVr = new TProfile("hprof_dxVr","#Delta x vs. r", nBins,minimumR,maximumR,minimumDX,maximumDX);
534  TProfile* hprof_dyVr = new TProfile("hprof_dyVr","#Delta y vs. r", nBins,minimumR,maximumR,minimumDY,maximumDY);
535  TProfile* hprof_drVz = new TProfile("hprof_drVz","#Delta r vs. z", nBins,minimumZ,maximumZ,minimumDR,maximumDR);
536  TProfile* hprof_dzVz = new TProfile("hprof_dzVz","#Delta z vs. z", nBins,minimumZ,maximumZ,minimumDZ,maximumDZ);
537  TProfile* hprof_rdphiVz = new TProfile("hprof_rdphiVz","r#Delta #phi vs. z", nBins,minimumZ,maximumZ,minimumRDPhi,maximumRDPhi);
538  TProfile* hprof_dxVz = new TProfile("hprof_dxVz","#Delta x vs. z", nBins,minimumZ,maximumZ,minimumDX,maximumDX);
539  TProfile* hprof_dyVz = new TProfile("hprof_dyVz","#Delta y vs. z", nBins,minimumZ,maximumZ,minimumDY,maximumDY);
540  TProfile* hprof_drVphi = new TProfile("hprof_drVphi","#Delta r vs. #phi", nBins,minimumPhi,maximumPhi,minimumDR,maximumDR);
541  TProfile* hprof_dzVphi = new TProfile("hprof_dzVphi","#Delta z vs. #phi", nBins,minimumPhi,maximumPhi,minimumDZ,maximumDZ);
542  TProfile* hprof_rdphiVphi = new TProfile("hprof_rdphiVphi","r#Delta #phi vs. #phi", nBins,minimumPhi,maximumPhi,minimumRDPhi,maximumRDPhi);
543  TProfile* hprof_dxVphi = new TProfile("hprof_dxVphi","#Delta x vs. #phi", nBins,minimumPhi,maximumPhi,minimumDX,maximumDX);
544  TProfile* hprof_dyVphi = new TProfile("hprof_dyVphi","#Delta y vs. #phi", nBins,minimumPhi,maximumPhi,minimumDY,maximumDY);
545 
546  TProfile* gr_drVr_Array[j];
547  THStack* mgr_drVr=new THStack("mgr_drVr","");
548 
549  for ( int i = 0; i < j; i++) {
550  data->Draw("dr:r>>hprof_drVr",Cut+zCut[i],"prof");
551  if (hprof_drVr->GetEntries()>0){
552  gr_drVr_Array[i] =(TProfile*)hprof_drVr->Clone() ;//data->Draw("dr:r",Cut+zCut[i],"prof");
553  gr_drVr_Array[i]->SetMarkerColor(int(i/4)+i+1);
554  gr_drVr_Array[i]->SetLineColor(int(i/4)+i+1);
555  mgr_drVr->Add(gr_drVr_Array[i]);
556  }
557  }
558  //y-axis scaled 2 times the max value for values >5 micron
559  //for max values<5 micron set fixed range to 10 micron
560  if ( (mgr_drVr->GetMaximum("nostack")>0.00005)||(mgr_drVr->GetMinimum("nostack")<-0.00005) ){
561  mgr_drVr->SetMaximum( 2.*mgr_drVr->GetMaximum("nostack") );
562  mgr_drVr->SetMinimum( 2.*mgr_drVr->GetMinimum("nostack") );
563  }
564  else{
565  mgr_drVr->SetMaximum(100*mgr_drVr->GetMaximum("nostack"));
566  mgr_drVr->SetMinimum( 100.*mgr_drVr->GetMinimum("nostack"));
567  }
568 
569  //data->Project("hprof_dzVr", "dz:r",Cut,"prof");
570  TProfile* gr_dzVr_Array[j];
571  THStack* mgr_dzVr=new THStack("mgr_dzVr","");
572  for ( int i = 0; i < j; i++) {
573  data->Draw("dz:r>>hprof_dzVr",Cut+zCut[i],"prof");
574  if (hprof_dzVr->GetEntries()>0){
575  gr_dzVr_Array[i] =(TProfile*)hprof_dzVr->Clone() ;
576  gr_dzVr_Array[i]->SetMarkerColor(int(i/4)+i+1);
577  gr_dzVr_Array[i]->SetLineColor(int(i/4)+i+1);
578  mgr_dzVr->Add(gr_dzVr_Array[i]);
579  }
580  }
581  if ( (mgr_dzVr->GetMaximum("nostack")>0.00005)||(mgr_dzVr->GetMinimum("nostack")<-0.00005) ){
582  mgr_dzVr->SetMaximum( 2.*mgr_dzVr->GetMaximum("nostack") );
583  mgr_dzVr->SetMinimum( 2.*mgr_dzVr->GetMinimum("nostack") );
584  }
585  else{
586  mgr_dzVr->SetMaximum( 100.*mgr_dzVr->GetMaximum("nostack") );
587  mgr_dzVr->SetMinimum( 100.*mgr_dzVr->GetMinimum("nostack") );
588  }
589 
590  //data->Project("hprof_rdphiVr", "r*dphi:r",Cut,"prof");
591  TProfile* gr_rdphiVr_Array[j];
592  THStack* mgr_rdphiVr=new THStack();
593  for ( int i = 0; i < j; i++) {
594  data->Draw("r*dphi:r>>hprof_rdphiVr",Cut+zCut[i],"prof");
595  if (hprof_rdphiVr->GetEntries()>0){
596  gr_rdphiVr_Array[i] = (TProfile*)hprof_rdphiVr->Clone() ;
597  gr_rdphiVr_Array[i]->SetMarkerColor(int(i/4)+i+1);
598  gr_rdphiVr_Array[i]->SetLineColor(int(i/4)+i+1);
599  mgr_rdphiVr->Add(gr_rdphiVr_Array[i]);
600  }
601  }
602  if ( (mgr_rdphiVr->GetMaximum("nostack")>0.00005)||(mgr_rdphiVr->GetMinimum("nostack")<-0.00005) ){
603  mgr_rdphiVr->SetMaximum( 2.*mgr_rdphiVr->GetMaximum("nostack") );
604  mgr_rdphiVr->SetMinimum( 2.*mgr_rdphiVr->GetMinimum("nostack") );
605  }
606  else{
607  mgr_rdphiVr->SetMaximum( 100.*mgr_rdphiVr->GetMaximum("nostack") );
608  mgr_rdphiVr->SetMinimum( 100.*mgr_rdphiVr->GetMinimum("nostack") );
609  }
610 
611  //data->Project("hprof_dxVr", "dx:r",Cut,"prof");
612  TProfile* gr_dxVr_Array[j];
613  THStack* mgr_dxVr=new THStack();
614  for ( int i = 0; i < j; i++) {
615  data->Draw("dx:r>>hprof_dxVr",Cut+zCut[i],"prof");
616  if (hprof_dxVr->GetEntries()>0){
617  gr_dxVr_Array[i] = (TProfile*)hprof_dxVr->Clone() ;
618  gr_dxVr_Array[i]->SetMarkerColor(int(i/4)+i+1);
619  gr_dxVr_Array[i]->SetLineColor(int(i/4)+i+1);
620  mgr_dxVr->Add(gr_dxVr_Array[i]);
621  }
622  }
623  if ( (mgr_dxVr->GetMaximum("nostack")>0.00005)||(mgr_dxVr->GetMinimum("nostack")<-0.00005) ){
624  mgr_dxVr->SetMaximum( 2.*mgr_dxVr->GetMaximum("nostack") );
625  mgr_dxVr->SetMinimum( 2.*mgr_dxVr->GetMinimum("nostack") );
626  }
627  else{
628  mgr_dxVr->SetMaximum( 100.*mgr_dxVr->GetMaximum("nostack") );
629  mgr_dxVr->SetMinimum( 100.*mgr_dxVr->GetMinimum("nostack") );
630 }
631 
632  //data->Project("hprof_dyVr", "dy:r",Cut,"prof");
633  TProfile* gr_dyVr_Array[j];
634  THStack* mgr_dyVr=new THStack();
635  for ( int i = 0; i < j; i++) {
636  data->Draw("dy:r>>hprof_dyVr",Cut+zCut[i],"prof");
637  if (hprof_dyVr->GetEntries()>0){
638  gr_dyVr_Array[i] = (TProfile*)hprof_dyVr->Clone() ;
639  gr_dyVr_Array[i]->SetMarkerColor(int(i/4)+i+1);
640  gr_dyVr_Array[i]->SetLineColor(int(i/4)+i+1);
641  mgr_dyVr->Add(gr_dyVr_Array[i]);
642  }
643  }
644  if ( (mgr_dyVr->GetMaximum("nostack")>0.00005)||(mgr_dyVr->GetMinimum("nostack")<-0.00005) ){
645  mgr_dyVr->SetMaximum( 2.*mgr_dyVr->GetMaximum("nostack") );
646  mgr_dyVr->SetMinimum( 2.*mgr_dyVr->GetMinimum("nostack") );
647  }
648  else{
649  mgr_dyVr->SetMaximum( 100.*mgr_dyVr->GetMaximum("nostack") );
650  mgr_dyVr->SetMinimum( 100.*mgr_dyVr->GetMinimum("nostack") );
651  }
652  //data->Project("hprof_drVz", "dr:z",Cut,"prof");
653  TProfile* gr_drVz_Array[j];
654  THStack* mgr_drVz=new THStack();
655  for ( int i = 0; i < j; i++) {
656  data->Draw("dr:z>>hprof_drVz",Cut+zCut[i],"prof");
657  if (hprof_drVz->GetEntries()>0){
658  gr_drVz_Array[i] = (TProfile*)hprof_drVz->Clone() ;
659  gr_drVz_Array[i]->SetMarkerColor(int(i/4)+i+1);
660  gr_drVz_Array[i]->SetLineColor(int(i/4)+i+1);
661  mgr_drVz->Add(gr_drVz_Array[i]);
662  }
663  }
664  if ( (mgr_drVr->GetMaximum("nostack")>0.00005)||(mgr_drVr->GetMinimum("nostack")<-0.00005) ){
665  mgr_drVz->SetMaximum( 2.*mgr_drVz->GetMaximum("nostack") );
666  mgr_drVz->SetMinimum( 2.*mgr_drVz->GetMinimum("nostack") );
667  }
668  else{
669  mgr_drVz->SetMaximum( 100.*mgr_drVz->GetMaximum("nostack") );
670  mgr_drVz->SetMinimum( 100.*mgr_drVz->GetMinimum("nostack") );
671  }
672  //data->Project("hprof_dzVz", "dz:z",Cut,"prof");
673  TProfile* gr_dzVz_Array[j];
674  THStack* mgr_dzVz=new THStack();
675  for ( int i = 0; i < j; i++) {
676  data->Draw("dz:z>>hprof_dzVz",Cut+zCut[i],"prof");
677  if (hprof_dzVz->GetEntries()>0){
678  gr_dzVz_Array[i] = (TProfile*)hprof_dzVz->Clone() ;
679  gr_dzVz_Array[i]->SetMarkerColor(int(i/4)+i+1);
680  gr_dzVz_Array[i]->SetLineColor(int(i/4)+i+1);
681  mgr_dzVz->Add(gr_dzVz_Array[i]);
682  }
683  }
684  if ( (mgr_dzVr->GetMaximum("nostack")>0.00005)||(mgr_dzVr->GetMinimum("nostack")<-0.00005) ){
685  mgr_dzVz->SetMaximum( 2.*mgr_dzVz->GetMaximum("nostack") );
686  mgr_dzVz->SetMinimum( 2.*mgr_dzVz->GetMinimum("nostack") );
687  }
688  else{
689  mgr_dzVz->SetMaximum( 100.*mgr_dzVz->GetMaximum("nostack") );
690  mgr_dzVz->SetMinimum( 100.*mgr_dzVz->GetMinimum("nostack") );
691  }
692 
693  //data->Project("hprof_rdphiVz", "r*dphi:z",Cut,"prof");
694  TProfile* gr_rdphiVz_Array[j];
695  THStack* mgr_rdphiVz=new THStack();
696  for ( int i = 0; i < j; i++) {
697  data->Draw("r*dphi:z>>hprof_rdphiVz",Cut+zCut[i],"prof");
698  if (hprof_rdphiVz->GetEntries()>0){
699  gr_rdphiVz_Array[i] = (TProfile*)hprof_rdphiVz->Clone() ;
700  gr_rdphiVz_Array[i]->SetMarkerColor(int(i/4)+i+1);
701  gr_rdphiVz_Array[i]->SetLineColor(int(i/4)+i+1);
702  mgr_rdphiVz->Add(gr_rdphiVz_Array[i]);
703  }
704  }
705  if ( (mgr_rdphiVz->GetMaximum("nostack")>0.00005)||(mgr_rdphiVz->GetMinimum("nostack")<-0.00005) ){
706  mgr_rdphiVz->SetMaximum( 2.*mgr_rdphiVz->GetMaximum("nostack") );
707  mgr_rdphiVz->SetMinimum( 2.*mgr_rdphiVz->GetMinimum("nostack") );
708  }
709  else{
710  mgr_rdphiVz->SetMaximum( 100.*mgr_rdphiVz->GetMaximum("nostack") );
711  mgr_rdphiVz->SetMinimum( 100.*mgr_rdphiVz->GetMinimum("nostack") );
712  }
713  //data->Project("hprof_dxVz", "dx:z",Cut,"prof");
714  TProfile* gr_dxVz_Array[j];
715  THStack* mgr_dxVz=new THStack();
716  for ( int i = 0; i < j; i++) {
717  data->Draw("dx:z>>hprof_dxVz",Cut+zCut[i],"prof");
718  if (hprof_dxVz->GetEntries()>0){
719  gr_dxVz_Array[i] = (TProfile*)hprof_dxVz->Clone() ;
720  gr_dxVz_Array[i]->SetMarkerColor(int(i/4)+i+1);
721  gr_dxVz_Array[i]->SetLineColor(int(i/4)+i+1);
722  mgr_dxVz->Add(gr_dxVz_Array[i]);
723  }
724  }
725  if ( (mgr_dxVz->GetMaximum("nostack")>0.00005)||(mgr_dxVz->GetMinimum("nostack")<-0.00005) ){
726  mgr_dxVz->SetMaximum( 2.*mgr_dxVz->GetMaximum("nostack") );
727  mgr_dxVz->SetMinimum( 2.*mgr_dxVz->GetMinimum("nostack") );
728  }
729  else{
730  mgr_dxVz->SetMaximum( 100.*mgr_dxVz->GetMaximum("nostack") );
731  mgr_dxVz->SetMinimum( 100.*mgr_dxVz->GetMinimum("nostack") );
732  }
733 
734  //data->Project("hprof_dyVz", "dy:z",Cut,"prof");
735  TProfile* gr_dyVz_Array[j];
736  THStack* mgr_dyVz=new THStack();
737  for ( int i = 0; i < j; i++) {
738  data->Draw("dy:z>>hprof_dyVz",Cut+zCut[i],"prof");
739  if (hprof_dyVz->GetEntries()>0){
740  gr_dyVz_Array[i] = (TProfile*)hprof_dyVz->Clone() ;
741  gr_dyVz_Array[i]->SetMarkerColor(int(i/4)+i+1);
742  gr_dyVz_Array[i]->SetLineColor(int(i/4)+i+1);
743  mgr_dyVz->Add(gr_dyVz_Array[i],"p");
744  }
745  }
746  if ( (mgr_dyVz->GetMaximum("nostack")>0.00005)||(mgr_dyVz->GetMinimum("nostack")<-0.00005) ){
747  mgr_dyVz->SetMaximum( 2.*mgr_dyVz->GetMaximum("nostack") );
748  mgr_dyVz->SetMinimum( 2.*mgr_dyVz->GetMinimum("nostack") );
749  }
750  else{
751  mgr_dyVz->SetMaximum( 100.*mgr_dyVz->GetMaximum("nostack") );
752  mgr_dyVz->SetMinimum( 100.*mgr_dyVz->GetMinimum("nostack") );
753  }
754 
755  //data->Project("hprof_drVphi", "dr:phi",Cut,"prof");
756  TProfile* gr_drVphi_Array[j];
757  THStack* mgr_drVphi=new THStack();
758  for ( int i = 0; i < j; i++) {
759  data->Draw("dr:phi>>hprof_drVphi",Cut+zCut[i],"prof");
760  if (hprof_drVphi->GetEntries()>0){
761  gr_drVphi_Array[i] = (TProfile*)hprof_drVphi->Clone() ;
762  gr_drVphi_Array[i]->SetMarkerColor(int(i/4)+i+1);
763  gr_drVphi_Array[i]->SetLineColor(int(i/4)+i+1);
764  mgr_drVphi->Add(gr_drVphi_Array[i],"p");
765  }
766  }
767  if ( (mgr_drVphi->GetMaximum("nostack")>0.00005)||(mgr_drVphi->GetMinimum("nostack")<-0.00005) ){
768  mgr_drVphi->SetMaximum( 2.*mgr_drVphi->GetMaximum("nostack") );
769  mgr_drVphi->SetMinimum( 2.*mgr_drVphi->GetMinimum("nostack") );
770  }
771  else{
772  mgr_drVphi->SetMaximum( 100.*mgr_drVphi->GetMaximum("nostack") );
773  mgr_drVphi->SetMinimum( 100.*mgr_drVphi->GetMinimum("nostack") );
774  }
775  //data->Project("hprof_dzVphi", "dz:phi",Cut,"prof");
776  TProfile* gr_dzVphi_Array[j];
777  THStack* mgr_dzVphi=new THStack();
778  for ( int i = 0; i < j; i++) {
779  data->Draw("dz:phi>>hprof_dzVphi",Cut+zCut[i],"prof");
780  if (hprof_dzVphi->GetEntries()>0){
781  gr_dzVphi_Array[i] = (TProfile*)hprof_dzVphi->Clone() ;
782  gr_dzVphi_Array[i]->SetMarkerColor(int(i/4)+i+1);
783  gr_dzVphi_Array[i]->SetLineColor(int(i/4)+i+1);
784  mgr_dzVphi->Add(gr_dzVphi_Array[i],"p");
785  }
786  }
787  if ( (mgr_dzVphi->GetMaximum("nostack")>0.00005)||(mgr_dzVphi->GetMinimum("nostack")<-0.00005) ){
788  mgr_dzVphi->SetMaximum( 2.*mgr_dzVphi->GetMaximum("nostack") );
789  mgr_dzVphi->SetMinimum( 2.*mgr_dzVphi->GetMinimum("nostack") );
790  }
791  else{
792  mgr_dzVphi->SetMaximum( 100.*mgr_dzVphi->GetMaximum("nostack") );
793  mgr_dzVphi->SetMinimum( 100.*mgr_dzVphi->GetMinimum("nostack") );
794  }
795  //data->Project("hprof_rdphiVphi", "r*dphi:phi",Cut,"prof");
796  TProfile* gr_rdphiVphi_Array[j];
797  THStack* mgr_rdphiVphi=new THStack();
798  for ( int i = 0; i < j; i++) {
799  data->Draw("r*dphi:phi>>hprof_rdphiVphi",Cut+zCut[i],"prof");
800  if (hprof_rdphiVphi->GetEntries()>0){
801  gr_rdphiVphi_Array[i] = (TProfile*)hprof_rdphiVphi->Clone() ;
802  gr_rdphiVphi_Array[i]->SetMarkerColor(int(i/4)+i+1);
803  gr_rdphiVphi_Array[i]->SetLineColor(int(i/4)+i+1);
804  mgr_rdphiVphi->Add(gr_rdphiVphi_Array[i],"p");
805  }
806  }
807  if ( (mgr_rdphiVphi->GetMaximum("nostack")>0.00005)||(mgr_rdphiVphi->GetMinimum("nostack")<-0.00005) ){
808  mgr_rdphiVphi->SetMaximum( 2.*mgr_rdphiVphi->GetMaximum("nostack") );
809  mgr_rdphiVphi->SetMinimum( 2.*mgr_rdphiVphi->GetMinimum("nostack") );
810  }
811  else{
812  mgr_rdphiVphi->SetMaximum( 100.*mgr_rdphiVphi->GetMaximum("nostack") );
813  mgr_rdphiVphi->SetMinimum( 100.*mgr_rdphiVphi->GetMinimum("nostack") );
814  }
815  //data->Project("hprof_dxVphi", "dx:phi",Cut,"prof");
816  TProfile* gr_dxVphi_Array[j];
817  THStack* mgr_dxVphi=new THStack();
818  for ( int i = 0; i < j; i++) {
819  data->Draw("dx:phi>>hprof_dxVphi",Cut+zCut[i],"prof");
820  if (hprof_dxVphi->GetEntries()>0){
821  gr_dxVphi_Array[i] = (TProfile*)hprof_dxVphi->Clone() ;
822  gr_dxVphi_Array[i]->SetMarkerColor(int(i/4)+i+1);
823  gr_dxVphi_Array[i]->SetLineColor(int(i/4)+i+1);
824  mgr_dxVphi->Add(gr_dxVphi_Array[i],"p");
825  }
826  }
827  if ( (mgr_dxVphi->GetMaximum("nostack")>0.00005)||(mgr_dxVphi->GetMinimum("nostack")<-0.00005) ){
828  mgr_dxVphi->SetMaximum( 2.*mgr_dxVphi->GetMaximum("nostack") );
829  mgr_dxVphi->SetMinimum( 2.*mgr_dxVphi->GetMinimum("nostack") );
830  }
831  else{
832  mgr_dxVphi->SetMaximum( 100.*mgr_dxVphi->GetMaximum("nostack") );
833  mgr_dxVphi->SetMinimum( 100.*mgr_dxVphi->GetMinimum("nostack") );
834  }
835  //data->Project("hprof_dyVphi", "dy:phi",Cut,"prof");
836  TProfile* gr_dyVphi_Array[j];
837  THStack* mgr_dyVphi=new THStack();
838  for ( int i = 0; i < j; i++) {
839  data->Draw("dy:phi>>hprof_dyVphi",Cut+zCut[i],"prof");
840  if (hprof_dyVphi->GetEntries()>0){
841  gr_dyVphi_Array[i] = (TProfile*)hprof_dyVphi->Clone() ;
842  gr_dyVphi_Array[i]->SetMarkerColor(int(i/4)+i+1);
843  gr_dyVphi_Array[i]->SetLineColor(int(i/4)+i+1);
844  mgr_dyVphi->Add(gr_dyVphi_Array[i],"p");
845  }
846  }
847 if ( (mgr_dyVphi->GetMaximum("nostack")>0.00005)||(mgr_dyVphi->GetMinimum("nostack")<-0.00005) ){
848  mgr_dyVphi->SetMaximum( 2.*mgr_dyVphi->GetMaximum("nostack") );
849  mgr_dyVphi->SetMinimum( 2.*mgr_dyVphi->GetMinimum("nostack") );
850  }
851  else{
852  mgr_dyVphi->SetMaximum( 100.*mgr_dyVphi->GetMaximum("nostack") );
853  mgr_dyVphi->SetMinimum( 100.*mgr_dyVphi->GetMinimum("nostack") );
854  }
855 
856  // --------- draw histograms ---------
857  /*TCanvas* c0 = new TCanvas("c0", "c0", 200, 10, 900, 300);
858  c0->SetFillColor(0);
859  c0->Divide(3,1);
860  c0->cd(1);
861  hprof_dr->Draw();
862  c0->cd(2);
863  hprof_dz->Draw();
864  c0->cd(3);
865  hprof_rdphi->Draw();
866  if (savePlot) c0->Print((_outputDir+"plot3x1_Profile"+plotName).c_str());
867  */
868  mgr_drVr->SetTitle("#Delta r vs. r");
869  mgr_dzVr->SetTitle("#Delta z vs. r");
870  mgr_rdphiVr->SetTitle("r#Delta #phi vs. r");
871  mgr_dxVr->SetTitle("#Delta x vs. r");
872  mgr_dyVr->SetTitle("#Delta y vs. r");
873  mgr_drVz->SetTitle("#Delta r vs. z");
874  mgr_dzVz->SetTitle("#Delta z vs. z");
875  mgr_rdphiVz->SetTitle("r#Delta #phi vs. z");
876  mgr_dxVz->SetTitle("#Delta x vs. z");
877  mgr_dyVz->SetTitle("#Delta y vs. z");
878  mgr_drVphi->SetTitle("#Delta r vs. #phi");
879  mgr_dzVphi->SetTitle("#Delta z vs. #phi");
880  mgr_rdphiVphi->SetTitle("r#Delta #phi vs. #phi");
881  mgr_dxVphi->SetTitle("#Delta x vs. #phi");
882  mgr_dyVphi->SetTitle("#Delta y vs. #phi");
883 
884  // --------- draw histograms ---------
885  TCanvas* c = new TCanvas("c", "c", 200, 10, 1200, 700);
886  c->SetFillColor(0);
887  data->SetMarkerSize(0.5);
888  data->SetMarkerStyle(6);
889  c->Divide(5,3);
890  c->cd(1);
891  if (!autolimits) mgr_drVr->Draw("nostack");
892  if (autolimits) mgr_drVr->Draw("nostack");
893  c->Update();
894  c->cd(2);
895  if (!autolimits) mgr_dzVr->Draw("nostack");
896  if (autolimits) mgr_dzVr->Draw("nostack");
897  c->Update();
898  c->cd(3);
899  if (!autolimits) mgr_rdphiVr->Draw("nostack");
900  if (autolimits) mgr_rdphiVr->Draw("nostack");
901  c->cd(4);
902  if (!autolimits) mgr_dxVr->Draw("nostack");
903  if (autolimits) mgr_dxVr->Draw("nostack");
904  c->cd(5);
905  if (!autolimits) mgr_dyVr->Draw("nostack");
906  if (autolimits) mgr_dyVr->Draw("nostack");
907  c->cd(6);
908  if (!autolimits) mgr_drVz->Draw("nostack");
909  if (autolimits) mgr_drVz->Draw("nostack");
910  c->cd(7);
911  if (!autolimits) mgr_dzVz->Draw("nostack");
912  if (autolimits) mgr_dzVz->Draw("nostack");
913  c->cd(8);
914  if (!autolimits) mgr_rdphiVz->Draw("nostack");
915  if (autolimits) mgr_rdphiVz->Draw("nostack");
916  c->cd(9);
917  if (!autolimits) mgr_dxVz->Draw("nostack");
918  if (autolimits) mgr_dxVz->Draw("nostack");
919  c->cd(10);
920  if (!autolimits) mgr_dyVz->Draw("nostack");
921  if (autolimits) mgr_dyVz->Draw("nostack");
922  c->cd(11);
923  if (!autolimits) mgr_drVphi->Draw("nostack");
924  if (autolimits) mgr_drVphi->Draw("nostack");
925  c->cd(12);
926  if (!autolimits) mgr_dzVphi->Draw("nostack");
927  if (autolimits) mgr_dzVphi->Draw("nostack");
928  c->cd(13);
929  if (!autolimits) mgr_rdphiVphi->Draw("nostack");
930  if (autolimits) mgr_rdphiVphi->Draw("nostack");
931  c->cd(14);
932  if (!autolimits) mgr_dxVphi->Draw("nostack");
933  if (autolimits) mgr_dxVphi->Draw("nostack");
934  c->cd(15);
935  if (!autolimits) mgr_dyVphi->Draw("nostack");
936  if (autolimits) mgr_dyVphi->Draw("nostack");
937 
938  c->Update();
939 
940  // --------- set output directory for histograms ---------
941  plotDir->cd();
942 
943  hprof_drVr->Write(); hprof_dzVr->Write(); hprof_rdphiVr->Write(); hprof_dxVr->Write(); hprof_dyVr->Write();
944  hprof_drVz->Write(); hprof_dzVz->Write(); hprof_rdphiVz->Write(); hprof_dxVz->Write(); hprof_dyVz->Write();
945  hprof_drVphi->Write(); hprof_dzVphi->Write(); hprof_rdphiVphi->Write(); hprof_dxVphi->Write(); hprof_dyVphi->Write();
946 
947  /*
948  // --------- project tree onto histograms ---------
949  data->Project("hprof_drVr", "dr:r",Cut ,"prof");
950  data->Project("hprof_dzVr", "dz:r",Cut ,"prof");
951  data->Project("hprof_rdphiVr", "r*dphi:r",Cut ,"prof");
952  data->Project("hprof_dxVr", "dx:r",Cut ,"prof");
953  data->Project("hprof_dyVr", "dy:r",Cut ,"prof");
954  data->Project("hprof_drVz", "dr:z",Cut ,"prof");
955  data->Project("hprof_dzVz", "dz:z",Cut ,"prof");
956  data->Project("hprof_rdphiVz", "r*dphi:z",Cut ,"prof");
957  data->Project("hprof_dxVz", "dx:z",Cut ,"prof");
958  data->Project("hprof_dyVz", "dy:z",Cut ,"prof");
959  data->Project("hprof_drVphi", "dr:phi",Cut ,"prof");
960  data->Project("hprof_dzVphi", "dz:phi",Cut ,"prof");
961  data->Project("hprof_rdphiVphi", "r*dphi:phi",Cut ,"prof");
962  data->Project("hprof_dxVphi", "dx:phi",Cut ,"prof");
963  data->Project("hprof_dyVphi", "dy:phi",Cut ,"prof");
964 
965  // --------- draw histograms ---------
966  TCanvas* cp = new TCanvas("cp", "cp", 200, 10, 1200, 700);
967  cp->SetFillColor(0);
968  data->SetMarkerSize(0.5);
969  data->SetMarkerStyle(6);
970  cp->Divide(5,3);
971  cp->cd(1);
972  hprof_drVr->Draw();
973  cp->cd(2);
974  hprof_dzVr->Draw();
975  cp->cd(3);
976  hprof_rdphiVr->Draw();
977  cp->cd(4);
978  hprof_dxVr->Draw();
979  cp->cd(5);
980  hprof_dyVr->Draw();
981  cp->cd(6);
982  hprof_drVz->Draw();
983  cp->cd(7);
984  hprof_dzVz->Draw();
985  cp->cd(8);
986  hprof_rdphiVz->Draw();
987  cp->cd(9);
988  hprof_dxVz->Draw();
989  cp->cd(10);
990  hprof_dyVz->Draw();
991  cp->cd(11);
992  hprof_drVphi->Draw();
993  cp->cd(12);
994  hprof_dzVphi->Draw();
995  cp->cd(13);
996  hprof_rdphiVphi->Draw();
997  cp->cd(14);
998  hprof_dxVphi->Draw();
999  cp->cd(15);
1000  hprof_dyVphi->Draw();
1001 
1002  // --------- set output directory for histograms ---------
1003  plotDir->cd();
1004  hprof_drVr->Write(); hprof_dzVr->Write(); hprof_rdphiVr->Write(); hprof_dxVr->Write(); hprof_dyVr->Write();
1005  hprof_drVz->Write(); hprof_dzVz->Write(); hprof_rdphiVz->Write(); hprof_dxVz->Write(); hprof_dyVz->Write();
1006  hprof_drVphi->Write(); hprof_dzVphi->Write(); hprof_rdphiVphi->Write(); hprof_dxVphi->Write(); hprof_dyVphi->Write();
1007  */
1008  if (savePlot) c->Print((_outputDir+"plot3x5Prof_"+plotName).c_str());
1009 }
int i
Definition: DBlmapReader.cc:9
void getHistMaxMin(TH1 *hist, double &max, double &min, int flag)
int j
Definition: DBlmapReader.cc:9
string s
Definition: asciidump.py:422
std::string _outputDir
void comparisonPlots::readTree ( )

Definition at line 31 of file comparisonPlots.cc.

References alpha_, beta_, dalpha_, data, dbeta_, detDim_, dgamma_, dphi_, dr_, dx_, dy_, dz_, eta_, fin, gamma_, id_, level_, mid_, mlevel_, phi_, r_, sublevel_, useDetId_, x_, y_, and z_.

Referenced by comparisonPlots().

31  {
32 
33  data = (TTree*)fin->Get("alignTree");
34  data->SetBranchAddress("id",&id_);
35  data->SetBranchAddress("mid",&mid_);
36  data->SetBranchAddress("level",&level_);
37  data->SetBranchAddress("mlevel",&mlevel_);
38  data->SetBranchAddress("sublevel",&sublevel_);
39  data->SetBranchAddress("x",&x_);
40  data->SetBranchAddress("y",&y_);
41  data->SetBranchAddress("z",&z_);
42  data->SetBranchAddress("alpha",&alpha_);
43  data->SetBranchAddress("beta",&beta_);
44  data->SetBranchAddress("gamma",&gamma_);
45  data->SetBranchAddress("phi",&phi_);
46  data->SetBranchAddress("eta",&eta_);
47  data->SetBranchAddress("r",&r_);
48  data->SetBranchAddress("dx",&dx_);
49  data->SetBranchAddress("dy",&dy_);
50  data->SetBranchAddress("dz",&dz_);
51  data->SetBranchAddress("dphi",&dphi_);
52  data->SetBranchAddress("dr",&dr_);
53  data->SetBranchAddress("dalpha",&dalpha_);
54  data->SetBranchAddress("dbeta",&dbeta_);
55  data->SetBranchAddress("dgamma",&dgamma_);
56  data->SetBranchAddress("useDetId",&useDetId_);
57  data->SetBranchAddress("detDim",&detDim_);
58 }
void comparisonPlots::Write ( )

Definition at line 1067 of file comparisonPlots.cc.

References output.

1068 {
1069  output->Write();
1070 }

Member Data Documentation

std::string comparisonPlots::_outputDir
private

Definition at line 47 of file comparisonPlots.h.

Referenced by comparisonPlots(), plot3x5(), and plot3x5Profile().

float comparisonPlots::alpha_
private

Definition at line 51 of file comparisonPlots.h.

Referenced by readTree().

float comparisonPlots::arrowSize

Definition at line 34 of file comparisonPlots.h.

float comparisonPlots::beta_
private

Definition at line 51 of file comparisonPlots.h.

Referenced by readTree().

float comparisonPlots::dalpha_
private

Definition at line 52 of file comparisonPlots.h.

Referenced by readTree().

TTree* comparisonPlots::data
float comparisonPlots::dbeta_
private

Definition at line 52 of file comparisonPlots.h.

Referenced by readTree().

int comparisonPlots::detDim_
private

Definition at line 50 of file comparisonPlots.h.

Referenced by readTree().

float comparisonPlots::dgamma_
private

Definition at line 52 of file comparisonPlots.h.

Referenced by readTree().

float comparisonPlots::dphi_
private

Definition at line 52 of file comparisonPlots.h.

Referenced by getMaxMin(), and readTree().

float comparisonPlots::dr_
private

Definition at line 52 of file comparisonPlots.h.

Referenced by getMaxMin(), and readTree().

float comparisonPlots::dx_
private

Definition at line 52 of file comparisonPlots.h.

Referenced by getMaxMin(), and readTree().

float comparisonPlots::dy_
private

Definition at line 52 of file comparisonPlots.h.

Referenced by getMaxMin(), and readTree().

float comparisonPlots::dz_
private

Definition at line 52 of file comparisonPlots.h.

Referenced by getMaxMin(), and readTree().

float comparisonPlots::eta_
private

Definition at line 51 of file comparisonPlots.h.

Referenced by readTree().

TFile* comparisonPlots::fin

Definition at line 36 of file comparisonPlots.h.

Referenced by comparisonPlots(), and readTree().

float comparisonPlots::gamma_
private

Definition at line 51 of file comparisonPlots.h.

Referenced by readTree().

int comparisonPlots::id_
private

Definition at line 50 of file comparisonPlots.h.

Referenced by readTree().

int comparisonPlots::level_
private

Definition at line 50 of file comparisonPlots.h.

Referenced by readTree().

float comparisonPlots::maxDR
private

Definition at line 57 of file comparisonPlots.h.

Referenced by getMaxMin().

float comparisonPlots::maxDX
private

Definition at line 60 of file comparisonPlots.h.

Referenced by getMaxMin().

float comparisonPlots::maxDY
private

Definition at line 61 of file comparisonPlots.h.

Referenced by getMaxMin().

float comparisonPlots::maxDZ
private

Definition at line 58 of file comparisonPlots.h.

Referenced by getMaxMin().

float comparisonPlots::maxPhi
private

Definition at line 56 of file comparisonPlots.h.

Referenced by getMaxMin().

float comparisonPlots::maxR
private

Definition at line 54 of file comparisonPlots.h.

Referenced by getMaxMin().

float comparisonPlots::maxRDPhi
private

Definition at line 59 of file comparisonPlots.h.

Referenced by getMaxMin().

float comparisonPlots::maxZ
private

Definition at line 55 of file comparisonPlots.h.

Referenced by getMaxMin().

int comparisonPlots::mid_
private

Definition at line 50 of file comparisonPlots.h.

Referenced by readTree().

float comparisonPlots::minDR
private

Definition at line 57 of file comparisonPlots.h.

Referenced by getMaxMin().

float comparisonPlots::minDX
private

Definition at line 60 of file comparisonPlots.h.

Referenced by getMaxMin().

float comparisonPlots::minDY
private

Definition at line 61 of file comparisonPlots.h.

Referenced by getMaxMin().

float comparisonPlots::minDZ
private

Definition at line 58 of file comparisonPlots.h.

Referenced by getMaxMin().

float comparisonPlots::minPhi
private

Definition at line 56 of file comparisonPlots.h.

Referenced by getMaxMin().

float comparisonPlots::minR
private

Definition at line 54 of file comparisonPlots.h.

Referenced by getMaxMin().

float comparisonPlots::minRDPhi
private

Definition at line 59 of file comparisonPlots.h.

Referenced by getMaxMin().

float comparisonPlots::minZ
private

Definition at line 55 of file comparisonPlots.h.

Referenced by getMaxMin().

int comparisonPlots::mlevel_
private

Definition at line 50 of file comparisonPlots.h.

Referenced by readTree().

TFile* comparisonPlots::output

Definition at line 37 of file comparisonPlots.h.

Referenced by comparisonPlots(), plot3x5(), plot3x5Profile(), and Write().

float comparisonPlots::phi_
private

Definition at line 51 of file comparisonPlots.h.

Referenced by getMaxMin(), and readTree().

float comparisonPlots::r_
private

Definition at line 51 of file comparisonPlots.h.

Referenced by getMaxMin(), and readTree().

int comparisonPlots::sublevel_
private

Definition at line 50 of file comparisonPlots.h.

Referenced by readTree().

int comparisonPlots::useDetId_
private

Definition at line 50 of file comparisonPlots.h.

Referenced by readTree().

float comparisonPlots::x_
private

Definition at line 51 of file comparisonPlots.h.

Referenced by readTree().

float comparisonPlots::y_
private

Definition at line 51 of file comparisonPlots.h.

Referenced by readTree().

float comparisonPlots::z_
private

Definition at line 51 of file comparisonPlots.h.

Referenced by getMaxMin(), and readTree().