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
3333 std ::cout << "Opened tree: " << tree -> GetName ()
3434 << ", entries = " << tree -> GetEntries () << std ::endl ;
@@ -73,26 +73,24 @@ void CheckClusterSizeVsEta(const std::string &strFileInput = "CheckClusters.root
7373 tree -> SetBranchAddress ("pt" , & pt );
7474
7575 // Some QA histograms
76- TH1F * hPt = new TH1F ("hPt" , "p_{T};p_{T};Entries" , 100 , 0. , 10. );
77- TH1F * hClusSize = new TH1F ("hClusSize" , "Cluster size;clusSize;Entries" , 20 , 0. , 20. );
78- TH1F * hLayer = new TH1F ("hLayer" , "Layer;layer;Entries" , 20 , -0.5 , 19.5 );
79- TH1F * hDxGlob = new TH1F ("hDxGlob" , "clusGlobX - hitGlobX;#DeltaX [global];Entries" , 200 , -1. , 1. );
80- TH1F * hDzGlob = new TH1F ("hDzGlob" , "clusGlobZ - hitGlobZ;#DeltaZ [global];Entries" , 200 , -1. , 1. );
81- TH2F * hHitXY = new TH2F ("hHitXY" , "Hit global XY;hitGlobX;hitGlobY" , 200 , -20. , 20. , 200 , -20. , 20. );
82- TH2F * hClusVsHitX = new TH2F ("hClusVsHitX" , "clusGlobX vs hitGlobX;hitGlobX;clusGlobX" , 200 , -20. , 20. , 200 , -20. , 20. );
76+ TH1F * hPt = new TH1F ("hPt" , "p_{T};p_{T};Entries" , 100 , 0. , 10. );
77+ TH1F * hClusSize = new TH1F ("hClusSize" , "Cluster size;clusSize;Entries" , 20 , 0. , 20. );
78+ TH1F * hLayer = new TH1F ("hLayer" , "Layer;layer;Entries" , 20 , -0.5 , 19.5 );
79+ TH1F * hDxGlob = new TH1F ("hDxGlob" , "clusGlobX - hitGlobX;#DeltaX [global];Entries" , 200 , -1. , 1. );
80+ TH1F * hDzGlob = new TH1F ("hDzGlob" , "clusGlobZ - hitGlobZ;#DeltaZ [global];Entries" , 200 , -1. , 1. );
81+ TH2F * hHitXY = new TH2F ("hHitXY" , "Hit global XY;hitGlobX;hitGlobY" , 200 , -20. , 20. , 200 , -20. , 20. );
82+ TH2F * hClusVsHitX = new TH2F ("hClusVsHitX" , "clusGlobX vs hitGlobX;hitGlobX;clusGlobX" , 200 , -20. , 20. , 200 , -20. , 20. );
8383
8484 // histograms for cluster size vs eta for each layer (ML and OT barrel layers):
8585 const int nLayers = 8 ; // ML and OT barrel layers only
86- TH2F * hClustSizePerLayerVsEta [nLayers ];
87- for (int i = 0 ; i < nLayers ; i ++ )
88- {
86+ TH2F * hClustSizePerLayerVsEta [nLayers ];
87+ for (int i = 0 ; i < nLayers ; i ++ ) {
8988 hClustSizePerLayerVsEta [i ] = new TH2F (Form ("hClustSizePerLayerVsEta_Lay%d" , i ), Form ("Cluster size vs eta for layer %d;#eta;Cluster size" , i ), 160 , -4 , 4 , 101 , -0.5 , 100.5 );
9089 }
9190
9291 // Loop over entries
9392 const Long64_t nEntries = tree -> GetEntries ();
94- for (Long64_t i = 0 ; i < nEntries ; ++ i )
95- {
93+ for (Long64_t i = 0 ; i < nEntries ; ++ i ) {
9694 tree -> GetEntry (i );
9795
9896 // 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 ();
@@ -145,10 +142,9 @@ void CheckClusterSizeVsEta(const std::string &strFileInput = "CheckClusters.root
145142 c1 -> cd (4 );
146143 hHitXY -> Draw ("COLZ" );
147144
148- TCanvas * canv_clsSize_vs_eta [nLayers ];
149- TProfile * profPerLayerVsEta [nLayers ];
150- for (int i = 0 ; i < nLayers ; i ++ )
151- {
145+ TCanvas * canv_clsSize_vs_eta [nLayers ];
146+ TProfile * profPerLayerVsEta [nLayers ];
147+ for (int i = 0 ; i < nLayers ; i ++ ) {
152148 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 );
153149 hClustSizePerLayerVsEta [i ]-> Draw ("COLZ" );
154150 gPad -> SetLogz ();
@@ -160,11 +156,10 @@ void CheckClusterSizeVsEta(const std::string &strFileInput = "CheckClusters.root
160156 }
161157
162158 // canvas with profiles for all layers together
163- TCanvas * canv_av_clsSize_vs_eta_all_layers = new TCanvas ("canv_clsSize_vs_eta_all_layers" , "Cluster size vs eta for all layers" , 800 , 600 );
164- TLegend * legLayers = new TLegend (0.3 , 0.52 , 0.65 , 0.89 );
159+ TCanvas * canv_av_clsSize_vs_eta_all_layers = new TCanvas ("canv_clsSize_vs_eta_all_layers" , "Cluster size vs eta for all layers" , 800 , 600 );
160+ TLegend * legLayers = new TLegend (0.3 , 0.52 , 0.65 , 0.89 );
165161 int colors [] = {kRed , kBlue , kMagenta + 1 , kCyan + 1 , kGray + 2 , kRed , kBlue , kMagenta + 1 , kCyan , kAzure + 1 , kOrange - 9 , kRed + 2 , kBlue + 2 , kMagenta + 2 };
166- for (int i = 0 ; i < nLayers ; i ++ )
167- {
162+ for (int i = 0 ; i < nLayers ; i ++ ) {
168163 profPerLayerVsEta [i ]-> SetLineColor (colors [i ]);
169164 profPerLayerVsEta [i ]-> SetMarkerColor (colors [i ]);
170165 profPerLayerVsEta [i ]-> SetMarkerStyle (i < 5 ? 20 : 24 );
0 commit comments