2323#include <TStyle.h>
2424
2525// ### required input file: CheckClusters.root, which is the output of CheckClusters.C macro
26- void CheckClusterSizeVsEta (const std ::string & strFileInput = "CheckClusters.root" )
26+ void CheckClusterSizeVsEta (const std ::string & strFileInput = "CheckClusters.root" )
2727{
2828 gStyle -> SetOptStat (0 );
2929
30- TFile * fileInput = new TFile (strFileInput .c_str ());
31- TTree * tree = (TTree * )fileInput -> Get ("ntc" );
30+ TFile * fileInput = new TFile (strFileInput .c_str ());
31+ TTree * tree = (TTree * )fileInput -> Get ("ntc" );
3232 std ::cout << "Opened tree: " << tree -> GetName () << ", entries = " << tree -> GetEntries () << std ::endl ;
3333
3434 // set branch addresses
@@ -71,26 +71,24 @@ void CheckClusterSizeVsEta(const std::string &strFileInput = "CheckClusters.root
7171 tree -> SetBranchAddress ("pt" , & pt );
7272
7373 // Some QA histograms
74- TH1F * hPt = new TH1F ("hPt" , "p_{T};p_{T};Entries" , 100 , 0. , 10. );
75- TH1F * hClusSize = new TH1F ("hClusSize" , "Cluster size;clusSize;Entries" , 20 , 0. , 20. );
76- TH1F * hLayer = new TH1F ("hLayer" , "Layer;layer;Entries" , 20 , -0.5 , 19.5 );
77- TH1F * hDxGlob = new TH1F ("hDxGlob" , "clusGlobX - hitGlobX;#DeltaX [global];Entries" , 200 , -1. , 1. );
78- TH1F * hDzGlob = new TH1F ("hDzGlob" , "clusGlobZ - hitGlobZ;#DeltaZ [global];Entries" , 200 , -1. , 1. );
79- TH2F * hHitXY = new TH2F ("hHitXY" , "Hit global XY;hitGlobX;hitGlobY" , 200 , -20. , 20. , 200 , -20. , 20. );
80- TH2F * hClusVsHitX = new TH2F ("hClusVsHitX" , "clusGlobX vs hitGlobX;hitGlobX;clusGlobX" , 200 , -20. , 20. , 200 , -20. , 20. );
74+ TH1F * hPt = new TH1F ("hPt" , "p_{T};p_{T};Entries" , 100 , 0. , 10. );
75+ TH1F * hClusSize = new TH1F ("hClusSize" , "Cluster size;clusSize;Entries" , 20 , 0. , 20. );
76+ TH1F * hLayer = new TH1F ("hLayer" , "Layer;layer;Entries" , 20 , -0.5 , 19.5 );
77+ TH1F * hDxGlob = new TH1F ("hDxGlob" , "clusGlobX - hitGlobX;#DeltaX [global];Entries" , 200 , -1. , 1. );
78+ TH1F * hDzGlob = new TH1F ("hDzGlob" , "clusGlobZ - hitGlobZ;#DeltaZ [global];Entries" , 200 , -1. , 1. );
79+ TH2F * hHitXY = new TH2F ("hHitXY" , "Hit global XY;hitGlobX;hitGlobY" , 200 , -20. , 20. , 200 , -20. , 20. );
80+ TH2F * hClusVsHitX = new TH2F ("hClusVsHitX" , "clusGlobX vs hitGlobX;hitGlobX;clusGlobX" , 200 , -20. , 20. , 200 , -20. , 20. );
8181
8282 // histograms for cluster size vs eta for each barrel layer:
8383 const int nLayers = 11 ;
84- TH2F * hClustSizePerLayerVsEta [nLayers ];
85- for (int i = 0 ; i < nLayers ; i ++ )
86- {
84+ TH2F * hClustSizePerLayerVsEta [nLayers ];
85+ for (int i = 0 ; i < nLayers ; i ++ ) {
8786 hClustSizePerLayerVsEta [i ] = new TH2F (Form ("hClustSizePerLayerVsEta_Lay%d" , i ), Form ("Cluster size vs eta for layer %d;#eta;Cluster size" , i ), 200 , -5 , 5 , 101 , -0.5 , 100.5 );
8887 }
8988
9089 // Loop over entries
9190 const Long64_t nEntries = tree -> GetEntries ();
92- for (Long64_t i = 0 ; i < nEntries ; ++ i )
93- {
91+ for (Long64_t i = 0 ; i < nEntries ; ++ i ) {
9492 tree -> GetEntry (i );
9593
9694 // Fill QA histograms
@@ -117,14 +115,13 @@ void CheckClusterSizeVsEta(const std::string &strFileInput = "CheckClusters.root
117115 hClustSizePerLayerVsEta [(int )layer ]-> Fill (clustEta , clusSize );
118116
119117 // progress print
120- if ((i + 1 ) % 200000 == 0 )
121- {
118+ if ((i + 1 ) % 200000 == 0 ) {
122119 std ::cout << "Processed " << (i + 1 ) << " / " << nEntries << " entries" << std ::endl ;
123120 }
124121 }
125122
126123 // Save histograms to file
127- TFile * fout = TFile ::Open ("clusterSizes_vs_eta.root" , "RECREATE" );
124+ TFile * fout = TFile ::Open ("clusterSizes_vs_eta.root" , "RECREATE" );
128125 hPt -> Write ();
129126 hClusSize -> Write ();
130127 hLayer -> Write ();
@@ -134,7 +131,7 @@ void CheckClusterSizeVsEta(const std::string &strFileInput = "CheckClusters.root
134131 hClusVsHitX -> Write ();
135132
136133 // draw some QA histograms
137- TCanvas * c1 = new TCanvas ("canv_clusters_QA" , "Clusters QA" , 1200 , 800 );
134+ TCanvas * c1 = new TCanvas ("canv_clusters_QA" , "Clusters QA" , 1200 , 800 );
138135 c1 -> Divide (2 , 2 );
139136 c1 -> cd (1 );
140137 hPt -> Draw ();
@@ -149,10 +146,9 @@ void CheckClusterSizeVsEta(const std::string &strFileInput = "CheckClusters.root
149146 kRed , kBlue + 1 , kMagenta + 1 ,
150147 kCyan + 1 , kGray + 2 , kRed , kBlue , kMagenta + 1 , kCyan , kAzure + 1 , kOrange - 9 , kRed + 2 , kBlue + 2 , kMagenta + 2 };
151148
152- TCanvas * canv_clsSize_vs_eta [nLayers ];
153- TProfile * profPerLayerVsEta [nLayers ];
154- for (int i = 0 ; i < nLayers ; i ++ )
155- {
149+ TCanvas * canv_clsSize_vs_eta [nLayers ];
150+ TProfile * profPerLayerVsEta [nLayers ];
151+ for (int i = 0 ; i < nLayers ; i ++ ) {
156152 canv_clsSize_vs_eta [i ] = new TCanvas (Form ("canv_clsSize_vs_eta_Lay%d" , i ), Form ("Cluster size vs eta for layer %d" , i ), 800 , 600 );
157153 hClustSizePerLayerVsEta [i ]-> Draw ("COLZ" );
158154 gPad -> SetLogz ();
@@ -168,10 +164,9 @@ void CheckClusterSizeVsEta(const std::string &strFileInput = "CheckClusters.root
168164 }
169165
170166 // ### canvas with profiles for 3 VD layers
171- TCanvas * canv_av_clsSize_vs_eta_VD_layers = new TCanvas ("canv_clsSize_vs_eta_VD_layers" , "Cluster size vs eta for VD layers" , 800 , 600 );
172- TLegend * legLayersVD = new TLegend (0.3 , 0.72 , 0.65 , 0.89 );
173- for (int i = 0 ; i < 3 ; i ++ )
174- {
167+ TCanvas * canv_av_clsSize_vs_eta_VD_layers = new TCanvas ("canv_clsSize_vs_eta_VD_layers" , "Cluster size vs eta for VD layers" , 800 , 600 );
168+ TLegend * legLayersVD = new TLegend (0.3 , 0.72 , 0.65 , 0.89 );
169+ for (int i = 0 ; i < 3 ; i ++ ) {
175170 profPerLayerVsEta [i ]-> GetYaxis ()-> SetRangeUser (0. , 60. );
176171 profPerLayerVsEta [i ]-> DrawCopy (i == 0 ? "P" : "P same" );
177172 legLayersVD -> AddEntry (profPerLayerVsEta [i ], Form ("VD layer %d" , i ), "P" );
@@ -182,10 +177,9 @@ void CheckClusterSizeVsEta(const std::string &strFileInput = "CheckClusters.root
182177 canv_av_clsSize_vs_eta_VD_layers -> Write ();
183178
184179 // ### canvas with profiles for MLOT layers
185- TCanvas * canv_av_clsSize_vs_eta_MLOT_layers = new TCanvas ("canv_clsSize_vs_eta_MLOT_layers" , "Cluster size vs eta for MLOT layers" , 800 , 600 );
186- TLegend * legLayersMLOT = new TLegend (0.3 , 0.52 , 0.65 , 0.89 );
187- for (int i = 3 ; i < nLayers ; i ++ )
188- {
180+ TCanvas * canv_av_clsSize_vs_eta_MLOT_layers = new TCanvas ("canv_clsSize_vs_eta_MLOT_layers" , "Cluster size vs eta for MLOT layers" , 800 , 600 );
181+ TLegend * legLayersMLOT = new TLegend (0.3 , 0.52 , 0.65 , 0.89 );
182+ for (int i = 3 ; i < nLayers ; i ++ ) {
189183 profPerLayerVsEta [i ]-> GetYaxis ()-> SetRangeUser (0. , 12.5 );
190184 profPerLayerVsEta [i ]-> GetXaxis ()-> SetRangeUser (-3.5 , 3.5 );
191185 profPerLayerVsEta [i ]-> DrawCopy (i == 3 ? "P" : "P same" );
0 commit comments