Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:24:42

0001 void CSCSegmentPlotter(int segtype){
0002 
0003   /* Macro to plot histograms produced by CSCRecHitReader.cc
0004    * You may need to update the TFile name, and will need to
0005    * input the segtype as shown below.
0006    *
0007    * Author:  Dominique Fortin - UCR
0008    */
0009 
0010   float nsigmas = 1.5;    // Number of sigmas around mean to fit gaussian.  It uses 2 iterations 
0011                           // i.e. range is = [mu - nsigmas * sigma, mu + nsigmas * sigma]
0012 
0013 // Files for histogram output --> set suffixps to desired file type:  e.g. .eps, .jpg, ...
0014 
0015 TString suffixps = ".gif";
0016 
0017 TString segment = "shower";
0018 
0019  if (segtype == 2) TString segment = "shower_zoom";
0020  if (segtype == 3) TString segment = "DF";
0021  if (segtype == 4) TString segment = "DF_zoom";
0022 
0023  TString endfile = ".root";
0024  TString tfile = "cscsegments_"+segment+endfile;
0025 
0026  TFile *file = TFile::Open(tfile);
0027 
0028  TString plot0 = "matched_pair_"+segment+suffixps;
0029 
0030  TString plot1a = "eff_raw_"+segment+suffixps;
0031  TString plot1b = "eff_6hit_"+segment+suffixps;
0032 
0033  TString plot2  = "chi2_"+segment+suffixps; 
0034 
0035  TString plot3  = "nhits_per_seg_"+segment+suffixps;
0036 
0037  TString plot4a = "dx_seg_Ori_"+segment+suffixps;
0038  TString plot4b = "dy_seg_Ori_"+segment+suffixps;
0039  TString plot4c = "dphi_seg_Dir_"+segment+suffixps;
0040  TString plot4d = "dtheta_seg_Dir_"+segment+suffixps;
0041 
0042 // ********************************************************************
0043 // Pointers to histograms
0044 // ********************************************************************
0045 
0046 
0047 // 1) Eff
0048  hRawEff     = (TH1F *) file->Get("h1");
0049  h6hitEff    = (TH1F *) file->Get("h3");
0050 
0051 // 2) Chi^2
0052  hChi2       = (TH1F *) file->Get("h4");
0053 
0054 // 3) Number hit/segment
0055  hNhit       = (TH1F *) file->Get("h5");
0056 
0057 // 4) Resolution on segment origin (dx, dy), and direction (dphi, dtheta)
0058  hdxME1A     = (TH1F *) file->Get("h20"); 
0059  hdyME1A     = (TH1F *) file->Get("h30"); 
0060  hdphiME1A   = (TH1F *) file->Get("h40"); 
0061  hdthetaME1A = (TH1F *) file->Get("h50"); 
0062 
0063 // *****************************************************************
0064 // 1) Efficiency
0065 // *****************************************************************
0066 
0067  // 1a) Raw efficiency
0068  gStyle->SetOptStat(kFALSE);
0069  TCanvas *c1 = new TCanvas("c1","");
0070  c1->SetFillColor(10);   
0071  c1->SetFillColor(10);
0072  hRawEff->SetTitle(segment);
0073  hRawEff->Draw();
0074  hRawEff->GetXaxis()->SetTitle("chamber type");
0075  hRawEff->GetYaxis()->SetTitle("3+ hit segment/6-layer events ");
0076  c1->Print(plot1a);
0077 
0078  // 1b) 6-hit efficiency
0079  gStyle->SetOptStat(kFALSE);
0080  TCanvas *c1 = new TCanvas("c1","");
0081  c1->SetFillColor(10);   
0082  c1->SetFillColor(10);
0083  h6hitEff->SetTitle(segment);
0084  h6hitEff->Draw();
0085  h6hitEff->GetXaxis()->SetTitle("chamber type");
0086  h6hitEff->GetYaxis()->SetTitle("6-hit segment/6-layer events ");
0087  c1->Print(plot1b);
0088  
0089 
0090 // *****************************************************************
0091 // 2) chi^2 
0092 // *****************************************************************
0093 
0094  gStyle->SetOptStat(kTRUE);
0095  TCanvas *c1 = new TCanvas("c1","");
0096  gPad->SetLogy(kTRUE);
0097  c1->SetFillColor(10);   
0098  c1->SetFillColor(10);
0099  hChi2->SetTitle(segment);
0100  hChi2->Draw();
0101  hChi2->GetXaxis()->SetTitle("#chi^{2}/(2 N_{hit} - 4)");
0102  hChi2->GetYaxis()->SetTitle(" ");
0103  c1->Print(plot2);
0104 
0105 
0106 // *****************************************************************
0107 // 3) Number of hits per segment 
0108 // *****************************************************************
0109 
0110  gStyle->SetOptStat(kTRUE);
0111  TCanvas *c1 = new TCanvas("c1","");
0112  c1->SetFillColor(10);   
0113  c1->SetFillColor(10);
0114  hNhit->SetTitle(segment);
0115  hNhit->Draw();
0116  hNhit->GetXaxis()->SetTitle("number of hits/segment");
0117  hNhit->GetYaxis()->SetTitle(" ");
0118  c1->Print(plot3);
0119 
0120 // *****************************************************************
0121 // 4) Resolution
0122 // *****************************************************************
0123 
0124  gStyle->SetOptStat(kTRUE);
0125  TCanvas *c1 = new TCanvas("c1","");
0126  c1->SetFillColor(10);   
0127  c1->SetFillColor(10);
0128  hdxME1A->SetTitle(segment);
0129  hdxME1A->Draw();
0130  hdxME1A->GetXaxis()->SetTitle("#Delta X for seg. origin (cm)");
0131  hdxME1A->GetYaxis()->SetTitle(" ");
0132  c1->Print(plot4a);
0133 
0134  gStyle->SetOptStat(kTRUE);
0135  TCanvas *c1 = new TCanvas("c1","");
0136  c1->SetFillColor(10);   
0137  c1->SetFillColor(10);
0138  hdyME1A->SetTitle(segment);
0139  hdyME1A->Draw();
0140  hdyME1A->GetXaxis()->SetTitle("#Delta Y for seg. origin (cm)");
0141  hdyME1A->GetYaxis()->SetTitle(" ");
0142  c1->Print(plot4b);
0143 
0144  gStyle->SetOptStat(kTRUE);
0145  TCanvas *c1 = new TCanvas("c1","");
0146  c1->SetFillColor(10);   
0147  c1->SetFillColor(10);
0148  hdphiME1A->SetTitle(segment);
0149  hdphiME1A->Draw();
0150  hdphiME1A->GetXaxis()->SetTitle("#Delta #phi on seg. direction (global)");
0151  hdphiME1A->GetYaxis()->SetTitle(" ");
0152  c1->Print(plot4c);
0153 
0154  gStyle->SetOptStat(kTRUE);
0155  TCanvas *c1 = new TCanvas("c1","");
0156  c1->SetFillColor(10);   
0157  c1->SetFillColor(10);
0158  hdthetaME1A->SetTitle(segment);
0159  hdthetaME1A->Draw();
0160  hdthetaME1A->GetXaxis()->SetTitle("#Delta #theta on seg. direction (global)");
0161  hdthetaME1A->GetYaxis()->SetTitle(" ");
0162  c1->Print(plot4d);
0163 
0164 
0165  gROOT->ProcessLine(".q");
0166 
0167 }