CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
TrackPlots.cc File Reference
#include "TrackPlots.h"
#include <vector>
#include <string>
#include <map>
#include "TPad.h"
#include "TFile.h"
#include "TH2F.h"
#include "TH1F.h"
#include "TF1.h"
#include "TProfile2D.h"
#include "DPGAnalysis/SiStripTools/interface/CommonAnalyzer.h"
#include "TCanvas.h"
#include "TSystem.h"
#include "TStyle.h"

Go to the source code of this file.

Functions

void TrackPlots (const char *fullname, const char *module, const char *label, const char *postfix, const char *shortname, const char *outtrunk)
 

Function Documentation

void TrackPlots ( const char *  fullname,
const char *  module,
const char *  label,
const char *  postfix,
const char *  shortname,
const char *  outtrunk 
)

Definition at line 16 of file TrackPlots.cc.

References eta(), alignCSCRings::ff, CommonAnalyzer::getObject(), phi, RecoTauCleanerPlugins::pt, and AlCaHLTBitMon_QueryRunRegistry::string.

16  {
17 
18  char modfull[300];
19  sprintf(modfull,"%s%s",module,postfix);
20  char labfull[300];
21  sprintf(labfull,"%s%s",label,postfix);
22 
23 
24  // char fullname[300];
25  // sprintf(fullname,"rootfiles/Tracking_PFG_%s.root",filename);
26 
27  TFile ff(fullname);
28 
29  // Colliding events
30 
31 
32  CommonAnalyzer castat(&ff,"",modfull);
33 
34  TH1F* ntrk = (TH1F*)castat.getObject("ntrk");
35  if (ntrk) {
36  ntrk->Draw();
37  std::string plotfilename;
38  plotfilename += outtrunk;
39  plotfilename += shortname;
40  plotfilename += "/ntrk_";
41  plotfilename += labfull;
42  plotfilename += "_";
43  plotfilename += shortname;
44  plotfilename += ".gif";
45  gPad->Print(plotfilename.c_str());
46  delete ntrk;
47  }
48  TH1F* pt = (TH1F*)castat.getObject("pt");
49  if (pt) {
50  pt->Draw();
51  std::string plotfilename;
52  plotfilename += outtrunk;
53  plotfilename += shortname;
54  plotfilename += "/pt_";
55  plotfilename += labfull;
56  plotfilename += "_";
57  plotfilename += shortname;
58  plotfilename += ".gif";
59  gPad->SetLogy(1);
60  gPad->Print(plotfilename.c_str());
61  gPad->SetLogy(0);
62  delete pt;
63  }
64  gStyle->SetOptStat(11);
65  TProfile2D* ptphieta = (TProfile2D*)castat.getObject("ptphivseta");
66  if (ptphieta) {
67  ptphieta->Draw("colz");
68  std::string plotfilename;
69  plotfilename += outtrunk;
70  plotfilename += shortname;
71  plotfilename += "/ptphieta_";
72  plotfilename += labfull;
73  plotfilename += "_";
74  plotfilename += shortname;
75  plotfilename += ".gif";
76  gPad->Print(plotfilename.c_str());
77  delete ptphieta;
78  }
79  gStyle->SetOptStat(1111);
80  TH1F* phi = (TH1F*)castat.getObject("phi");
81  if (phi) {
82  phi->Draw();
83  std::string plotfilename;
84  plotfilename += outtrunk;
85  plotfilename += shortname;
86  plotfilename += "/phi_";
87  plotfilename += labfull;
88  plotfilename += "_";
89  plotfilename += shortname;
90  plotfilename += ".gif";
91  gPad->Print(plotfilename.c_str());
92  delete phi;
93  }
94  TH1F* eta = (TH1F*)castat.getObject("eta");
95  if (eta) {
96  eta->Draw();
97  std::string plotfilename;
98  plotfilename += outtrunk;
99  plotfilename += shortname;
100  plotfilename += "/eta_";
101  plotfilename += labfull;
102  plotfilename += "_";
103  plotfilename += shortname;
104  plotfilename += ".gif";
105  gPad->Print(plotfilename.c_str());
106  delete eta;
107  }
108  gStyle->SetOptStat(11);
109  TH2F* phieta = (TH2F*)castat.getObject("phivseta");
110  if (phieta) {
111  phieta->Draw("colz");
112  std::string plotfilename;
113  plotfilename += outtrunk;
114  plotfilename += shortname;
115  plotfilename += "/phieta_";
116  plotfilename += labfull;
117  plotfilename += "_";
118  plotfilename += shortname;
119  plotfilename += ".gif";
120  gPad->Print(plotfilename.c_str());
121  delete phieta;
122  gStyle->SetOptStat(1111);
123  }
124  TH1F* nrhits = (TH1F*)castat.getObject("nrhits");
125  if (nrhits) {
126  nrhits->Draw();
127  std::string plotfilename;
128  plotfilename += outtrunk;
129  plotfilename += shortname;
130  plotfilename += "/nrhits_";
131  plotfilename += labfull;
132  plotfilename += "_";
133  plotfilename += shortname;
134  plotfilename += ".gif";
135  gPad->Print(plotfilename.c_str());
136  delete nrhits;
137  }
138  gStyle->SetOptStat(11);
139  TProfile2D* nhitphieta = (TProfile2D*)castat.getObject("nhitphivseta");
140  if (nhitphieta) {
141  nhitphieta->Draw("colz");
142  std::string plotfilename;
143  plotfilename += outtrunk;
144  plotfilename += shortname;
145  plotfilename += "/nhitphieta_";
146  plotfilename += labfull;
147  plotfilename += "_";
148  plotfilename += shortname;
149  plotfilename += ".gif";
150  gPad->Print(plotfilename.c_str());
151  delete nhitphieta;
152  }
153  gStyle->SetOptStat(1111);
154  TH1F* nlosthits = (TH1F*)castat.getObject("nlosthits");
155  if (nlosthits) {
156  nlosthits->Draw();
157  std::string plotfilename;
158  plotfilename += outtrunk;
159  plotfilename += shortname;
160  plotfilename += "/nlosthits_";
161  plotfilename += labfull;
162  plotfilename += "_";
163  plotfilename += shortname;
164  plotfilename += ".gif";
165  gPad->Print(plotfilename.c_str());
166  delete nlosthits;
167  }
168  TH1F* npixelhits = (TH1F*)castat.getObject("npixelhits");
169  if (npixelhits) {
170  npixelhits->Draw();
171  std::string plotfilename;
172  plotfilename += outtrunk;
173  plotfilename += shortname;
174  plotfilename += "/npixelhits_";
175  plotfilename += labfull;
176  plotfilename += "_";
177  plotfilename += shortname;
178  plotfilename += ".gif";
179  gPad->Print(plotfilename.c_str());
180  delete npixelhits;
181  }
182  TH1F* nstriphits = (TH1F*)castat.getObject("nstriphits");
183  if (nstriphits) {
184  nstriphits->Draw();
185  std::string plotfilename;
186  plotfilename += outtrunk;
187  plotfilename += shortname;
188  plotfilename += "/nstriphits_";
189  plotfilename += labfull;
190  plotfilename += "_";
191  plotfilename += shortname;
192  plotfilename += ".gif";
193  gPad->Print(plotfilename.c_str());
194  delete nstriphits;
195  }
196  TH1F* nrlayers = (TH1F*)castat.getObject("nlayers");
197  if (nrlayers) {
198  nrlayers->Draw();
199  std::string plotfilename;
200  plotfilename += outtrunk;
201  plotfilename += shortname;
202  plotfilename += "/nrlayers_";
203  plotfilename += labfull;
204  plotfilename += "_";
205  plotfilename += shortname;
206  plotfilename += ".gif";
207  gPad->Print(plotfilename.c_str());
208  delete nrlayers;
209  }
210  gStyle->SetOptStat(11);
211  TProfile2D* nlayerphieta = (TProfile2D*)castat.getObject("nlayerphivseta");
212  if (nlayerphieta) {
213  nlayerphieta->Draw("colz");
214  std::string plotfilename;
215  plotfilename += outtrunk;
216  plotfilename += shortname;
217  plotfilename += "/nlayerphieta_";
218  plotfilename += labfull;
219  plotfilename += "_";
220  plotfilename += shortname;
221  plotfilename += ".gif";
222  gPad->Print(plotfilename.c_str());
223  delete nlayerphieta;
224  }
225  gStyle->SetOptStat(1111);
226  TH1F* nlostlayers = (TH1F*)castat.getObject("nlostlayers");
227  if (nlostlayers) {
228  nlostlayers->Draw();
229  std::string plotfilename;
230  plotfilename += outtrunk;
231  plotfilename += shortname;
232  plotfilename += "/nlostlayers_";
233  plotfilename += labfull;
234  plotfilename += "_";
235  plotfilename += shortname;
236  plotfilename += ".gif";
237  gPad->Print(plotfilename.c_str());
238  delete nlostlayers;
239  }
240  TH1F* npixellayers = (TH1F*)castat.getObject("npixellayers");
241  if (npixellayers) {
242  npixellayers->Draw();
243  std::string plotfilename;
244  plotfilename += outtrunk;
245  plotfilename += shortname;
246  plotfilename += "/npixellayers_";
247  plotfilename += labfull;
248  plotfilename += "_";
249  plotfilename += shortname;
250  plotfilename += ".gif";
251  gPad->Print(plotfilename.c_str());
252  delete npixellayers;
253  }
254  TH1F* nstriplayers = (TH1F*)castat.getObject("nstriplayers");
255  if (nstriplayers) {
256  nstriplayers->Draw();
257  std::string plotfilename;
258  plotfilename += outtrunk;
259  plotfilename += shortname;
260  plotfilename += "/nstriplayers_";
261  plotfilename += labfull;
262  plotfilename += "_";
263  plotfilename += shortname;
264  plotfilename += ".gif";
265  gPad->Print(plotfilename.c_str());
266  delete nstriplayers;
267  }
268  TH1F* hhpfrac = (TH1F*)castat.getObject("hhpfrac");
269  if (hhpfrac) {
270  hhpfrac->Draw();
271  std::string plotfilename;
272  plotfilename += outtrunk;
273  plotfilename += shortname;
274  plotfilename += "/hhpfrac_";
275  plotfilename += labfull;
276  plotfilename += "_";
277  plotfilename += shortname;
278  plotfilename += ".gif";
279  gPad->SetLogy(1);
280  gPad->Print(plotfilename.c_str());
281  gPad->SetLogy(0);
282  delete hhpfrac;
283  }
284  TH1F* halgo = (TH1F*)castat.getObject("algo");
285  if (halgo) {
286  halgo->Draw();
287  std::string plotfilename;
288  plotfilename += outtrunk;
289  plotfilename += shortname;
290  plotfilename += "/halgo_";
291  plotfilename += labfull;
292  plotfilename += "_";
293  plotfilename += shortname;
294  plotfilename += ".gif";
295  gPad->Print(plotfilename.c_str());
296  delete halgo;
297  }
298  gStyle->SetOptStat(111);
299  gStyle->SetOptFit(111);
300  TProfile* hntrkvslumi = (TProfile*)castat.getObject("ntrkvslumi");
301  if (hntrkvslumi && hntrkvslumi->GetEntries()>0) {
302  // hntrkvslumi->Draw();
303  hntrkvslumi->Fit("pol2","","",0.5,3.0);
304  if(hntrkvslumi->GetFunction("pol2")) {
305  hntrkvslumi->GetFunction("pol2")->SetLineColor(kBlack);
306  hntrkvslumi->GetFunction("pol2")->SetLineWidth(1);
307  }
308  std::string plotfilename;
309  plotfilename += outtrunk;
310  plotfilename += shortname;
311  plotfilename += "/hntrkvslumi_";
312  plotfilename += labfull;
313  plotfilename += "_";
314  plotfilename += shortname;
315  plotfilename += ".gif";
316  gPad->Print(plotfilename.c_str());
317  }
318  gStyle->SetOptStat(1111);
319 
320  TH2D* hntrkvslumi2D = (TH2D*)castat.getObject("ntrkvslumi2D");
321  if (hntrkvslumi2D && hntrkvslumi2D->GetEntries()>0) {
322  hntrkvslumi2D->Draw("colz");
323  if(hntrkvslumi) {
324  hntrkvslumi->SetMarkerStyle(20);
325  hntrkvslumi->SetMarkerSize(.3);
326  hntrkvslumi->Draw("same");
327  }
328  std::string plotfilename;
329  plotfilename += outtrunk;
330  plotfilename += shortname;
331  plotfilename += "/hntrkvslumi2D_";
332  plotfilename += labfull;
333  plotfilename += "_";
334  plotfilename += shortname;
335  plotfilename += ".gif";
336  gPad->SetLogz(1);
337  gPad->Print(plotfilename.c_str());
338  gPad->SetLogz(0);
339  delete hntrkvslumi2D;
340  }
341  delete hntrkvslumi;
342 }
T eta() const
Definition: vlib.h:208
Definition: DDAxes.h:10