]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/macros/QA/DrawCaloQA.C
Update Wagon with physics event selection option and change a couple of histogram...
[u/mrichter/AliRoot.git] / PWG4 / macros / QA / DrawCaloQA.C
1 //Histograms
2 //CaloClusters 
3 TH1F * fhE  ; //! E distribution, Reco
4 TH1F * fhPt ; //! pT distribution, Reco
5 TH1F * fhPhi; //! phi distribution, Reco 
6 TH1F * fhEta; //! eta distribution, Reco 
7 TH2F * fhEtaPhi  ; //! eta vs phi, Reco 
8 TH3F * fhEtaPhiE  ; //! eta vs phi vs E, Reco
9 TH1F * fhECharged  ; //! E distribution, Reco, matched with track
10 TH1F * fhPtCharged ; //! pT distribution, Reco, matched with track
11 TH1F * fhPhiCharged; //! phi distribution, Reco, matched with track 
12 TH1F * fhEtaCharged; //! eta distribution, Reco, matched with track 
13 TH2F * fhEtaPhiCharged  ; //! eta vs phi, Reco, matched with track
14 TH1F * fhEChargedNoOut  ; //! E distribution, Reco, matched with track, no outer param
15 TH1F * fhPtChargedNoOut ; //! pT distribution, Reco, matched with track, no outer param
16 TH1F * fhPhiChargedNoOut; //! phi distribution, Reco, matched with track, no outer param
17 TH1F * fhEtaChargedNoOut; //! eta distribution, Reco, matched with track, no outer param
18 TH2F * fhEtaPhiChargedNoOut  ; //! eta vs phi, Reco, matched with track, no outer param
19 TH1F * fhDeltaE  ; //! MC-Reco E distribution   
20 TH1F * fhDeltaPt ; //! MC-Reco pT distribution
21 TH1F * fhDeltaPhi; //! MC-Reco phi distribution
22 TH1F * fhDeltaEta; //! MC-Reco eta distribution
23 TH1F * fhRatioE  ; //! Reco/MC E distribution   
24 TH1F * fhRatioPt ; //! Reco/MC pT distribution
25 TH1F * fhRatioPhi; //! Reco/MC phi distribution
26 TH1F * fhRatioEta; //! Reco/MC eta distribution
27 TH2F * fh2E  ; //! E distribution, Reco vs MC
28 TH2F * fh2Pt ; //! pT distribution, Reco vs MC
29 TH2F * fh2Phi; //! phi distribution, Reco vs MC
30 TH2F * fh2Eta; //! eta distribution, Reco vs MC
31 TH2F * fhIM; //! cluster pairs invariant mass
32 TH2F * fhIMCellCut; //! cluster pairs invariant mass, n cells > 1 per cluster
33 TH2F * fhAsym; //! cluster pairs invariant mass 
34 TH2F * fhNCellsPerCluster; //! N cells per cluster      
35 TH2F * fhNCellsPerClusterMIP; //! N cells per cluster   
36 TH1F * fhNClusters; //! Number of clusters
37
38 //Calo Cells
39 TH1F * fhNCells; //! Number of towers/crystals with signal
40 TH1F * fhAmplitude; //! Amplitude measured in towers/crystals
41 TH1F * fhAmpId; //! Amplitude measured vs towers/crystals id
42 TH1F * fhTime;      //! Time measured in towers/crystals
43 TH2F * fhTimeId;    //! Time vs Absolute cell Id
44 TH2F * fhTimeAmp;   //! Time vs Amplitude 
45
46 //Calorimeters Correlation
47 TH2F * fhCaloCorrNClusters; // EMCAL vs PHOS, number of clusters        
48 TH2F * fhCaloCorrEClusters; // EMCAL vs PHOS, total measured cluster energy
49 TH2F * fhCaloCorrNCells; // EMCAL vs PHOS, number of cells
50 TH2F * fhCaloCorrECells; // EMCAL vs PHOS,  total measured cell energy
51
52 //Module histograms
53 TH1F ** fhEMod  ;               //! E distribution for different module, Reco
54 TH1F ** fhNClustersMod ;        //! Number of clusters for different module, Reco
55 TH2F ** fhNCellsPerClusterMod ; //! N cells per clusters different module, Reco
56 TH1F ** fhNCellsMod ;           //! Number of towers/crystals with signal different module, Reco
57 TH2F ** fhGridCellsMod ;        //! Cells ordered in column/row for different module, Reco
58 TH2F ** fhGridCellsEMod ;       //! Cells ordered in column/row for different module, weighted with energy, Reco
59 TH1F ** fhAmplitudeMod ;        //! Amplitude measured in towers/crystals different module, Reco
60 TH2F ** fhIMMod;                //! cluster pairs invariant mass, different module,
61 TH2F ** fhIMCellCutMod;         //! cluster pairs invariant mass, n cells > 1 per cluster, different module
62
63
64 //MC  
65 TH1F *fhGenGamPt  ; // pt of primary gamma
66 TH1F *fhGenGamEta ; // eta of primart gamma
67 TH1F *fhGenGamPhi ; // phi of primary gamma     
68 TH1F *fhGenPi0Pt  ; // pt of primary pi0
69 TH1F *fhGenPi0Eta ; // eta of primart pi0
70 TH1F *fhGenPi0Phi ; // phi of primary pi0       
71 TH1F *fhGenEtaPt  ; // pt of primary eta
72 TH1F *fhGenEtaEta ; // eta of primart eta
73 TH1F *fhGenEtaPhi ; // phi of primary eta
74 TH1F *fhGenOmegaPt  ; // pt of primary omega
75 TH1F *fhGenOmegaEta ; // eta of primart omega
76 TH1F *fhGenOmegaPhi ; // phi of primary omega
77 TH1F *fhGenElePt  ; // pt of primary electron
78 TH1F *fhGenEleEta ; // eta of primart electron
79 TH1F *fhGenElePhi ; // phi of primary electron
80
81 //TH3F * fhEMVxyz    ; // Electromagnetic particle production vertex
82 TH2F * fhEMVxyz    ; // Electromagnetic particle production vertex
83 TH2F * fhEMR       ; // Electromagnetic distance to vertex vs rec energy  
84 //TH3F * fhHaVxyz    ; // Hadron production vertex
85 TH2F * fhHaVxyz    ; // Hadron production vertex
86 TH2F * fhHaR       ; // Hadron distance to vertex vs rec energy  
87
88 TH2F * fhGamE  ; //! E distribution of generated photons, Reco
89 TH2F * fhGamPt ; //! pT distribution of generated photons, Reco
90 TH2F * fhGamPhi; //! phi distribution of generated photon, Reco 
91 TH2F * fhGamEta; //! eta distribution of generated photons, Reco        
92 TH1F * fhGamDeltaE  ; //! MC-Reco E distribution of generated photons   
93 TH1F * fhGamDeltaPt ; //! MC-Reco pT distribution of generated photons
94 TH1F * fhGamDeltaPhi; //! MC-Reco phi distribution of generated photons
95 TH1F * fhGamDeltaEta; //! MC-Reco eta distribution of generated photons
96 TH1F * fhGamRatioE  ; //! Reco/MC E distribution of generated photons   
97 TH1F * fhGamRatioPt ; //! Reco/MC pT distribution of generated photons
98 TH1F * fhGamRatioPhi; //! Reco/MC phi distribution of generated photons
99 TH1F * fhGamRatioEta; //! Reco/MC eta distribution of generated photons
100 TH2F * fhEleE  ; //! E distribution of generated electrons, Reco
101 TH2F * fhElePt ; //! pT distribution of generated electrons, Reco
102 TH2F * fhElePhi; //! phi distribution of generated electron, Reco 
103 TH2F * fhEleEta; //! eta distribution of generated electrons, Reco              
104 TH2F * fhPi0E  ; //! E distribution of generated pi0, Reco, gamma decay overlapped
105 TH2F * fhPi0Pt ; //! pT distribution of generated pi0, Reco, gamma decay overlapped
106 TH2F * fhPi0Phi; //! phi distribution of generated pi0, Reco, gamma decay overlapped
107 TH2F * fhPi0Eta; //! eta distribution of generated pi0, Reco, gamma decay overlapped
108 TH2F * fhNeHadE  ; //! E distribution of generated neutral hadron, Reco
109 TH2F * fhNeHadPt ; //! pT distribution of generated neutral hadron, Reco
110 TH2F * fhNeHadPhi; //! phi distribution of generated neutral hadron, Reco 
111 TH2F * fhNeHadEta; //! eta distribution of generated neutral hadron, Reco       
112 TH2F * fhChHadE  ; //! E distribution of generated charged hadron, Reco
113 TH2F * fhChHadPt ; //! pT distribution of generated charged hadron, Reco
114 TH2F * fhChHadPhi; //! phi distribution of generated charged hadron, Reco 
115 TH2F * fhChHadEta; //! eta distribution of generated charged hadron, Reco 
116
117 TH2F * fhGamECharged  ; //! E distribution of generated photons, Reco, track matched cluster
118 TH2F * fhGamPtCharged ; //! pT distribution of generated photons, Reco, track matched cluster
119 TH2F * fhGamPhiCharged; //! phi distribution of generated photon, Reco, track matched cluster 
120 TH2F * fhGamEtaCharged; //! eta distribution of generated photons, Reco, track matched cluster 
121 TH2F * fhEleECharged  ; //! E distribution of generated electrons, Reco, track matched cluster
122 TH2F * fhElePtCharged ; //! pT distribution of generated electrons, Reco, track matched cluster
123 TH2F * fhElePhiCharged; //! phi distribution of generated electron, Reco, track matched cluster 
124 TH2F * fhEleEtaCharged; //! eta distribution of generated electrons, Reco, track matched cluster                
125 TH2F * fhPi0ECharged  ; //! E distribution of generated pi0, Reco, gamma decay overlapped, track matched cluster
126 TH2F * fhPi0PtCharged ; //! pT distribution of generated pi0, Reco, gamma decay overlapped, track matched cluster
127 TH2F * fhPi0PhiCharged; //! phi distribution of generated pi0, Reco, gamma decay overlapped, track matched cluster
128 TH2F * fhPi0EtaCharged; //! eta distribution of generated pi0, Reco, gamma decay overlapped, track matched cluster
129 TH2F * fhNeHadECharged  ; //! E distribution of generated neutral hadron, Reco, track matched cluster
130 TH2F * fhNeHadPtCharged ; //! pT distribution of generated neutral hadron, Reco, track matched cluster
131 TH2F * fhNeHadPhiCharged; //! phi distribution of generated neutral hadron, Reco , track matched cluster
132 TH2F * fhNeHadEtaCharged; //! eta distribution of generated neutral hadron, Reco, track matched cluster         
133 TH2F * fhChHadECharged  ; //! E distribution of generated charged hadron, Reco, track matched cluster
134 TH2F * fhChHadPtCharged ; //! pT distribution of generated charged hadron, Reco, track matched cluster
135 TH2F * fhChHadPhiCharged; //! phi distribution of generated charged hadron, Reco, track matched cluster 
136 TH2F * fhChHadEtaCharged; //! eta distribution of generated charged hadron, Reco, track matched cluster         
137
138 TH1F *fhGenGamAccE   ; // E of primary gamma
139 TH1F *fhGenGamAccPt  ; // pt of primary gamma
140 TH1F *fhGenGamAccEta ; // eta of primart gamma
141 TH1F *fhGenGamAccPhi ; // phi of primary gamma  
142 TH1F *fhGenPi0AccE   ; // E of primary pi0
143 TH1F *fhGenPi0AccPt  ; // pt of primary pi0
144 TH1F *fhGenPi0AccEta ; // eta of primart pi0
145 TH1F *fhGenPi0AccPhi ; // phi of primary pi0            
146
147 //Histograms for track-matching
148 TH2F *fh1pOverE;     //! p/E for track-cluster matches
149 TH1F *fh1dR;         //! distance between projected track and cluster
150 TH2F *fh2EledEdx;    //! dE/dx vs. momentum for electron candidates
151 TH2F *fh2MatchdEdx;  //! dE/dx vs. momentum for all matches
152 TH2F *fhMCEle1pOverE;     //! p/E for track-cluster matches, MC electrons
153 TH1F *fhMCEle1dR;         //! distance between projected track and cluster, MC electrons
154 TH2F *fhMCEle2MatchdEdx;  //! dE/dx vs. momentum for all matches, MC electrons  
155
156 TH2F *fhMCChHad1pOverE;     //! p/E for track-cluster matches, MC charged hadrons
157 TH1F *fhMCChHad1dR;         //! distance between projected track and cluster, MC charged hadrons
158 TH2F *fhMCChHad2MatchdEdx;  //! dE/dx vs. momentum for all matches, MC charged
159
160 TH2F *fhMCNeutral1pOverE;     //! p/E for track-cluster matches, MC neutral
161 TH1F *fhMCNeutral1dR;         //! distance between projected track and cluster, MC neutral
162 TH2F *fhMCNeutral2MatchdEdx;  //! dE/dx vs. momentum for all matches, MC neutral        
163
164 TH2F *fh1pOverER02;           //! p/E for track-cluster matches, dR > 0.2       
165 TH2F *fhMCEle1pOverER02;      //! p/E for track-cluster matches, dR > 0.2, MC electrons
166 TH2F *fhMCChHad1pOverER02;    //! p/E for track-cluster matches, dR > 0.2, MC charged hadrons
167 TH2F *fhMCNeutral1pOverER02;  //! p/E for track-cluster matches, dR > 0.2, MC neutral
168
169 //________________________________________________________________________
170 void ReadHistograms(TString name, TString dataType, Bool_t isDataMC, Bool_t  fCorrelateCalos, Int_t fNModules)
171 {
172         TFile *f = new TFile("Calo.Performance.root","read");
173         TList* outputList = f->Get("Calo.Performance");
174         
175         //Module histograms
176         fhEMod                = new TH1F*[fNModules];
177         fhNClustersMod        = new TH1F*[fNModules];
178         fhNCellsPerClusterMod = new TH2F*[fNModules];
179         fhNCellsMod           = new TH1F*[fNModules];
180         fhGridCellsMod        = new TH2F*[fNModules];
181         fhGridCellsEMod       = new TH2F*[fNModules];
182         fhAmplitudeMod        = new TH1F*[fNModules];
183         fhIMMod               = new TH2F*[fNModules];
184         fhIMCellCutMod        = new TH2F*[fNModules];
185         
186         
187         // Histograms of this analsys are kept in the same list as other analysis, recover the position of
188         // the first one and then add the next 
189         Int_t index = outputList->IndexOf(outputList->FindObject(name+"hE"));
190         //printf("Calo: %s, index: %d\n",fCalorimeter.Data(),index);
191         //Read histograms, must be in the same order as in GetCreateOutputObject.
192         fhE      = (TH1F *) outputList->At(index++);    
193         fhPt     = (TH1F *) outputList->At(index++); 
194         fhPhi    = (TH1F *) outputList->At(index++); 
195         fhEta    = (TH1F *) outputList->At(index++);
196         fhEtaPhi = (TH2F *) outputList->At(index++);
197         fhEtaPhiE = (TH3F *) outputList->At(index++);
198
199         fhECharged      = (TH1F *) outputList->At(index++);     
200         fhPtCharged     = (TH1F *) outputList->At(index++); 
201         fhPhiCharged    = (TH1F *) outputList->At(index++); 
202         fhEtaCharged    = (TH1F *) outputList->At(index++);
203         fhEtaPhiCharged = (TH2F *) outputList->At(index++);
204         
205         fhEChargedNoOut      = (TH1F *) outputList->At(index++);        
206         fhPtChargedNoOut     = (TH1F *) outputList->At(index++); 
207         fhPhiChargedNoOut    = (TH1F *) outputList->At(index++); 
208         fhEtaChargedNoOut    = (TH1F *) outputList->At(index++);
209         fhEtaPhiChargedNoOut = (TH2F *) outputList->At(index++);
210         
211         fh1pOverE    = (TH2F *) outputList->At(index++);
212         fh1dR        = (TH1F *) outputList->At(index++);
213         fh2MatchdEdx = (TH2F *) outputList->At(index++);
214         fh2EledEdx   = (TH2F *) outputList->At(index++);
215         fh1pOverER02 = (TH2F *) outputList->At(index++); 
216
217         fhIM     = (TH2F *) outputList->At(index++);
218         fhIMCellCut = (TH2F *) outputList->At(index++);
219         fhAsym   = (TH2F *) outputList->At(index++);
220         
221         fhNCellsPerCluster    = (TH2F *) outputList->At(index++);
222         fhNCellsPerClusterMIP = (TH2F *) outputList->At(index++);
223
224         fhNClusters  = (TH1F *) outputList->At(index++); 
225         fhNCells     = (TH1F *) outputList->At(index++); 
226         fhAmplitude  = (TH1F *) outputList->At(index++); 
227         fhAmpId      = (TH1F *) outputList->At(index++); 
228         if(dataType=="ESD") {
229                 fhTime       = (TH1F *) outputList->At(index++); 
230                 fhTimeId     = (TH2F *) outputList->At(index++); 
231                 fhTimeAmp    = (TH2F *) outputList->At(index++); 
232         }
233         
234         if(fCorrelateCalos){
235                 fhCaloCorrNClusters = (TH2F *) outputList->At(index++);
236                 fhCaloCorrEClusters = (TH2F *) outputList->At(index++); 
237                 fhCaloCorrNCells    = (TH2F *) outputList->At(index++); 
238                 fhCaloCorrECells    = (TH2F *) outputList->At(index++); 
239         }
240         
241         for(Int_t imod = 0 ; imod < fNModules; imod++){
242                 fhEMod[imod]                = (TH1F *) outputList->At(index++);
243                 fhNClustersMod[imod]        = (TH1F *) outputList->At(index++); 
244                 fhNCellsPerClusterMod[imod] = (TH2F *) outputList->At(index++); 
245                 fhNCellsMod[imod]           = (TH1F *) outputList->At(index++);         
246                 fhGridCellsMod[imod]        = (TH2F *) outputList->At(index++);
247                 fhGridCellsEMod[imod]       = (TH2F *) outputList->At(index++); 
248                 fhAmplitudeMod[imod]        = (TH1F *) outputList->At(index++); 
249                 fhIMMod[imod]               = (TH2F *) outputList->At(index++); 
250                 fhIMCellCutMod[imod]        = (TH2F *) outputList->At(index++);         
251                 
252         }
253         
254         if(isDataMC){
255                 fhDeltaE   = (TH1F *) outputList->At(index++); 
256                 fhDeltaPt  = (TH1F *) outputList->At(index++); 
257                 fhDeltaPhi = (TH1F *) outputList->At(index++); 
258                 fhDeltaEta = (TH1F *) outputList->At(index++); 
259                 
260                 fhRatioE   = (TH1F *) outputList->At(index++); 
261                 fhRatioPt  = (TH1F *) outputList->At(index++); 
262                 fhRatioPhi = (TH1F *) outputList->At(index++); 
263                 fhRatioEta = (TH1F *) outputList->At(index++); 
264                 
265                 fh2E       = (TH2F *) outputList->At(index++); 
266                 fh2Pt      = (TH2F *) outputList->At(index++); 
267                 fh2Phi     = (TH2F *) outputList->At(index++); 
268                 fh2Eta     = (TH2F *) outputList->At(index++); 
269                 
270                 fhGamE     = (TH2F *) outputList->At(index++); 
271                 fhGamPt    = (TH2F *) outputList->At(index++); 
272                 fhGamPhi   = (TH2F *) outputList->At(index++); 
273                 fhGamEta   = (TH2F *) outputList->At(index++); 
274                 
275                 fhGamDeltaE   = (TH1F *) outputList->At(index++); 
276                 fhGamDeltaPt  = (TH1F *) outputList->At(index++); 
277                 fhGamDeltaPhi = (TH1F *) outputList->At(index++); 
278                 fhGamDeltaEta = (TH1F *) outputList->At(index++); 
279                 
280                 fhGamRatioE   = (TH1F *) outputList->At(index++); 
281                 fhGamRatioPt  = (TH1F *) outputList->At(index++); 
282                 fhGamRatioPhi = (TH1F *) outputList->At(index++); 
283                 fhGamRatioEta = (TH1F *) outputList->At(index++); 
284                                 
285                 fhPi0E     = (TH2F *) outputList->At(index++); 
286                 fhPi0Pt    = (TH2F *) outputList->At(index++); 
287                 fhPi0Phi   = (TH2F *) outputList->At(index++); 
288                 fhPi0Eta   = (TH2F *) outputList->At(index++);          
289                 
290                 fhEleE     = (TH2F *) outputList->At(index++); 
291                 fhElePt    = (TH2F *) outputList->At(index++); 
292                 fhElePhi   = (TH2F *) outputList->At(index++); 
293                 fhEleEta   = (TH2F *) outputList->At(index++);          
294                 
295                 fhNeHadE     = (TH2F *) outputList->At(index++); 
296                 fhNeHadPt    = (TH2F *) outputList->At(index++); 
297                 fhNeHadPhi   = (TH2F *) outputList->At(index++); 
298                 fhNeHadEta   = (TH2F *) outputList->At(index++);                
299                 
300                 fhChHadE     = (TH2F *) outputList->At(index++); 
301                 fhChHadPt    = (TH2F *) outputList->At(index++); 
302                 fhChHadPhi   = (TH2F *) outputList->At(index++); 
303                 fhChHadEta   = (TH2F *) outputList->At(index++);                                        
304                 fhGamECharged     = (TH2F *) outputList->At(index++); 
305                 fhGamPtCharged    = (TH2F *) outputList->At(index++); 
306                 fhGamPhiCharged   = (TH2F *) outputList->At(index++); 
307                 fhGamEtaCharged   = (TH2F *) outputList->At(index++); 
308                 
309                 fhPi0ECharged     = (TH2F *) outputList->At(index++); 
310                 fhPi0PtCharged    = (TH2F *) outputList->At(index++); 
311                 fhPi0PhiCharged   = (TH2F *) outputList->At(index++); 
312                 fhPi0EtaCharged   = (TH2F *) outputList->At(index++);           
313                 
314                 fhEleECharged     = (TH2F *) outputList->At(index++); 
315                 fhElePtCharged    = (TH2F *) outputList->At(index++); 
316                 fhElePhiCharged   = (TH2F *) outputList->At(index++); 
317                 fhEleEtaCharged   = (TH2F *) outputList->At(index++);           
318                 
319                 fhNeHadECharged     = (TH2F *) outputList->At(index++); 
320                 fhNeHadPtCharged    = (TH2F *) outputList->At(index++); 
321                 fhNeHadPhiCharged   = (TH2F *) outputList->At(index++); 
322                 fhNeHadEtaCharged   = (TH2F *) outputList->At(index++);                 
323                 
324                 fhChHadECharged     = (TH2F *) outputList->At(index++); 
325                 fhChHadPtCharged    = (TH2F *) outputList->At(index++); 
326                 fhChHadPhiCharged   = (TH2F *) outputList->At(index++); 
327                 fhChHadEtaCharged   = (TH2F *) outputList->At(index++);                                 
328                 
329 //              fhEMVxyz     = (TH3F *) outputList->At(index++); 
330 //              fhHaVxyz     = (TH3F *) outputList->At(index++); 
331                 
332                 fhEMVxyz     = (TH2F *) outputList->At(index++); 
333                 fhHaVxyz     = (TH2F *) outputList->At(index++); 
334                 fhEMR        = (TH2F *) outputList->At(index++); 
335                 fhHaR        = (TH2F *) outputList->At(index++); 
336                 
337                 fhGenGamPt    = (TH1F *) outputList->At(index++); 
338                 fhGenGamEta   = (TH1F *) outputList->At(index++); 
339                 fhGenGamPhi   = (TH1F *) outputList->At(index++); 
340                 
341                 fhGenPi0Pt    = (TH1F *) outputList->At(index++); 
342                 fhGenPi0Eta   = (TH1F *) outputList->At(index++); 
343                 fhGenPi0Phi   = (TH1F *) outputList->At(index++); 
344                 
345                 fhGenEtaPt    = (TH1F *) outputList->At(index++); 
346                 fhGenEtaEta   = (TH1F *) outputList->At(index++); 
347                 fhGenEtaPhi   = (TH1F *) outputList->At(index++); 
348                 
349                 fhGenOmegaPt  = (TH1F *) outputList->At(index++); 
350                 fhGenOmegaEta = (TH1F *) outputList->At(index++); 
351                 fhGenOmegaPhi = (TH1F *) outputList->At(index++); 
352                 
353                 fhGenElePt    = (TH1F *) outputList->At(index++); 
354                 fhGenEleEta   = (TH1F *) outputList->At(index++); 
355                 fhGenElePhi   = (TH1F *) outputList->At(index++); 
356                 
357                 fhGenGamAccE   = (TH1F *) outputList->At(index++);              
358                 fhGenGamAccPt  = (TH1F *) outputList->At(index++); 
359                 fhGenGamAccEta = (TH1F *) outputList->At(index++); 
360                 fhGenGamAccPhi = (TH1F *) outputList->At(index++); 
361                 
362                 fhGenPi0AccE   = (TH1F *) outputList->At(index++);              
363                 fhGenPi0AccPt  = (TH1F *) outputList->At(index++); 
364                 fhGenPi0AccEta = (TH1F *) outputList->At(index++); 
365                 fhGenPi0AccPhi = (TH1F *) outputList->At(index++); 
366              
367                 //Track matching
368                 fhMCEle1pOverE =    (TH2F *) outputList->At(index++);
369                 fhMCEle1dR =        (TH1F *) outputList->At(index++);
370                 fhMCEle2MatchdEdx = (TH2F *) outputList->At(index++);
371         
372                 fhMCChHad1pOverE =    (TH2F *) outputList->At(index++);
373                 fhMCChHad1dR =        (TH1F *) outputList->At(index++);
374                 fhMCChHad2MatchdEdx = (TH2F *) outputList->At(index++);
375         
376                 fhMCNeutral1pOverE    = (TH2F *) outputList->At(index++);
377                 fhMCNeutral1dR        = (TH1F *) outputList->At(index++);
378                 fhMCNeutral2MatchdEdx = (TH2F *) outputList->At(index++);
379         
380                 fhMCEle1pOverER02     =    (TH2F *) outputList->At(index++);
381                 fhMCChHad1pOverER02   =    (TH2F *) outputList->At(index++);
382                 fhMCNeutral1pOverER02 =    (TH2F *) outputList->At(index++);
383         }//Is data MC
384 }
385
386
387 //__________________________________________________________________
388 void  DrawCaloQA(TString fCalorimeter = "EMCAL", TString dataType = "ESD", Bool_t isDataMC = kFALSE) 
389 {
390         //Macro for replotting Calorimeter QA histograms
391         Bool_t fCorrelateCalos = kFALSE;
392         Int_t fNModules = 12;
393         //By default when PHOS QA is called correlation not done
394         if(fCalorimeter == "PHOS") {
395                 fCorrelateCalos = kFALSE;
396                 fNModules = 3;//5
397         }
398         else {
399                 fCorrelateCalos = kTRUE;
400                 fNModules = 4;//12
401         }
402         cout<<"Calo? "<<fCalorimeter<<" Correlate plots? "<<fCorrelateCalos<<" MC plots?"<<isDataMC<<endl;
403         //Do some plots to end
404         gROOT->Macro("./style.C");//Set different root style parameters
405         //Recover histograms from output histograms list, needed for distributed analysis.      
406         ReadHistograms(fCalorimeter+"_", dataType, isDataMC, fCorrelateCalos,fNModules);
407         Float_t minx = 0;
408         Float_t maxx = 10;
409         
410         char name[128];
411         char cname[128];
412         
413         //Reconstructed distributions
414         //printf("c1\n");
415         sprintf(cname,"QA_%s_rec",fCalorimeter.Data());
416         TCanvas  * c = new TCanvas(cname, "Reconstructed distributions", 400, 400) ;
417         c->Divide(2, 2);
418         
419         fhE->SetAxisRange(minx,maxx,"X");
420         fhPt->SetAxisRange(minx,maxx,"X");
421         
422         c->cd(1) ; 
423         if(fhE->GetEntries() > 0) gPad->SetLogy();
424         TLegend pLegendE(0.7,0.6,0.9,0.8);
425         pLegendE.SetTextSize(0.03);
426         pLegendE.AddEntry(fhE,"all modules","L");
427         pLegendE.SetFillColor(10);
428         pLegendE.SetBorderSize(1);
429         
430         fhE->SetLineColor(1);
431         fhE->Draw();
432         for(Int_t imod = 0; imod < fNModules; imod++){
433                 fhEMod[imod]->SetLineColor(imod+1);
434                 fhEMod[imod]->Draw("same");
435                 pLegendE.AddEntry(fhEMod[imod],Form("module %d",imod),"L");
436         }
437         pLegendE.Draw();
438         
439         c->cd(2) ; 
440         gPad->SetLogy();
441         fhPt->SetLineColor(4);
442         fhPt->Draw();
443         
444         c->cd(3) ; 
445         fhPhi->SetLineColor(4);
446         fhPhi->Draw();
447         
448         c->cd(4) ; 
449         fhEta->SetLineColor(4);
450         fhEta->Draw();
451         
452         sprintf(name,"QA_%s_ReconstructedDistributions.eps",fCalorimeter.Data());
453         c->Print(name);
454         
455         //Reconstructed distributions, matched with tracks
456         //printf("c2\n");
457         sprintf(cname,"QA_%s_rectrackmatch",fCalorimeter.Data());
458         TCanvas  * c2 = new TCanvas(cname, "Reconstructed distributions, matched with tracks", 400, 400) ;
459         c2->Divide(2, 2);
460         
461         fhECharged->SetAxisRange(minx,maxx,"X");
462         fhPtCharged->SetAxisRange(minx,maxx,"X");
463
464         c2->cd(1) ; 
465         gPad->SetLogy();
466         fhECharged->SetLineColor(4);
467         fhECharged->Draw();
468         
469         c2->cd(2) ; 
470         gPad->SetLogy();
471         fhPtCharged->SetLineColor(4);
472         fhPtCharged->Draw();
473         
474         c2->cd(3) ; 
475         fhPhiCharged->SetLineColor(4);
476         fhPhiCharged->Draw();
477         
478         c2->cd(4) ; 
479         fhEtaCharged->SetLineColor(4);
480         fhEtaCharged->Draw();
481         
482         sprintf(name,"QA_%s_ReconstructedDistributions_TrackMatched.eps",fCalorimeter.Data());
483         c2->Print(name);
484         
485         TH1F *  hEChargedClone   = (TH1F*)   fhECharged->Clone("EChargedClone");
486         TH1F *  hPtChargedClone  = (TH1F*)   fhPtCharged->Clone("PtChargedClone");
487         TH1F *  hEtaChargedClone = (TH1F*)   fhEtaCharged->Clone("EtaChargedClone");
488         TH1F *  hPhiChargedClone = (TH1F*)   fhPhiCharged->Clone("PhiChargedClone");
489         
490         TH1F *  hEChargedClone2   = (TH1F*)   fhECharged->Clone("EChargedClone2");
491         TH1F *  hPtChargedClone2  = (TH1F*)   fhPtCharged->Clone("PtChargedClone2");
492         TH1F *  hEtaChargedClone2 = (TH1F*)   fhEtaCharged->Clone("EtaChargedClone2");
493         TH1F *  hPhiChargedClone2 = (TH1F*)   fhPhiCharged->Clone("PhiChargedClone2");
494         
495         //Ratio: reconstructed track matched/ all reconstructed
496         //printf("c3\n");
497         sprintf(cname,"QA_%s_rectrackmatchrat",fCalorimeter.Data());
498         TCanvas  * c3 = new TCanvas(cname, "Ratio: reconstructed track matched/ all reconstructed", 400, 400) ;
499         c3->Divide(2, 2);
500         
501         c3->cd(1) ;
502         gPad->SetLogy();
503         hEChargedClone->SetTitleOffset(1.6,"Y");
504         hEChargedClone->SetYTitle("track matched / all   ");
505         hEChargedClone->SetXTitle("E (GeV)");
506         hEChargedClone->Divide(fhE);
507         hEChargedClone->Draw();
508         
509         c3->cd(2) ; 
510         gPad->SetLogy();
511         hPtChargedClone->SetTitleOffset(1.6,"Y");
512         hPtChargedClone->SetYTitle("track matched / all   ");
513         hPtChargedClone->SetXTitle("p_{T} (GeV/c)");
514         hPtChargedClone->Divide(fhPt);
515         hPtChargedClone->Draw();
516         
517         c3->cd(3) ;
518         gPad->SetLogy();
519         hPhiChargedClone->SetTitleOffset(1.6,"Y");
520         hPhiChargedClone->SetYTitle("track matched / all   ");
521         hPhiChargedClone->SetXTitle("#phi (rad)");
522         hPhiChargedClone->Divide(fhPhi);
523         hPhiChargedClone->Draw();
524         
525         c3->cd(4) ; 
526         gPad->SetLogy();
527         hEtaChargedClone->SetTitleOffset(1.6,"Y");
528         hEtaChargedClone->SetYTitle("track matched / all   ");
529         hEtaChargedClone->SetXTitle("#eta");
530         hEtaChargedClone->Divide(fhEta);
531         hEtaChargedClone->Draw();
532         
533         sprintf(name,"QA_%s_RatioReconstructedMatchedDistributions.eps",fCalorimeter.Data());
534         c3->Print(name);
535         
536         //Ratio: reconstructed track matched (minus no track param) / all
537         //printf("c333\n");
538         sprintf(cname,"QA_%s_rectrackmatchratout",fCalorimeter.Data());
539         TCanvas  * c333 = new TCanvas(cname, "Ratio: reconstructed track matched (with outer track param)/ all", 400, 400) ;
540         c333->Divide(2, 2);
541         
542         c333->cd(1) ;
543         hEChargedClone2->Add(fhEChargedNoOut,-1);
544         hEChargedClone2->SetYTitle("track matched / all");
545         hEChargedClone2->SetXTitle("E (GeV)");
546         hEChargedClone2->Divide(fhE);
547         hEChargedClone2->Draw();
548         
549         c333->cd(2) ; 
550         hPtChargedClone2->Add(fhPtChargedNoOut,-1);
551         hPtChargedClone2->SetYTitle("track matched / all");
552         hPtChargedClone2->SetXTitle("p_{T} (GeV/c)");
553         hPtChargedClone2->Divide(fhPt);
554         hPtChargedClone2->Draw();
555         
556         c333->cd(3) ;
557         hPhiChargedClone2->Add(fhPhiChargedNoOut,-1);
558         hPhiChargedClone2->SetYTitle("track matched / all");
559         hPhiChargedClone2->SetXTitle("#phi (rad)");
560         hPhiChargedClone2->Divide(fhPhi);
561         hPhiChargedClone2->Draw();
562         
563         c333->cd(4) ; 
564         hEtaChargedClone2->Add(fhEtaChargedNoOut,-1);
565         hEtaChargedClone2->SetYTitle("track matched / all");
566         hEtaChargedClone2->SetXTitle("#eta");
567         hEtaChargedClone2->Divide(fhEta);
568         hEtaChargedClone2->Draw();
569         
570         sprintf(name,"QA_%s_RatioReconstructedMatchedDistributionsOuter.eps",fCalorimeter.Data());
571         c333->Print(name);
572         
573 //      //Reconstructed distributions, matched with tracks but no outer param
574 //      //printf("c2\n");
575 //      sprintf(cname,"QA_%s_rectrackmatch_noout",fCalorimeter.Data());
576 //      TCanvas  * c22 = new TCanvas(cname, "Reconstructed distributions, matched with tracks, no outer track param", 400, 400) ;
577 //      c22->Divide(2, 2);
578 //      
579 //      c22->cd(1) ; 
580 //      gPad->SetLogy();
581 //      fhEChargedNoOut->SetLineColor(4);
582 //      fhEChargedNoOut->Draw();
583 //      
584 //      c22->cd(2) ; 
585 //      gPad->SetLogy();
586 //      fhPtChargedNoOut->SetLineColor(4);
587 //      fhPtChargedNoOut->Draw();
588 //      
589 //      c22->cd(3) ; 
590 //      fhPhiChargedNoOut->SetLineColor(4);
591 //      fhPhiChargedNoOut->Draw();
592 //      
593 //      c22->cd(4) ; 
594 //      fhEtaChargedNoOut->SetLineColor(4);
595 //      fhEtaChargedNoOut->Draw();
596 //      
597 //      sprintf(name,"QA_%s_ReconstructedDistributions_TrackMatched_NoOutParam.eps",fCalorimeter.Data());
598 //      c22->Print(name);
599         
600         //Ratio: reconstructed track matched/ all reconstructed
601         //printf("c3\n");
602         
603 //      TH1F *  hEChargedNoOutClone   = (TH1F*)   fhEChargedNoOut->Clone("EChargedNoOutClone");
604 //      TH1F *  hPtChargedNoOutClone  = (TH1F*)   fhPtChargedNoOut->Clone("PtChargedNoOutClone");
605 //      TH1F *  hEtaChargedNoOutClone = (TH1F*)   fhEtaChargedNoOut->Clone("EtaChargedNoOutClone");
606 //      TH1F *  hPhiChargedNoOutClone = (TH1F*)   fhPhiChargedNoOut->Clone("PhiChargedNoOutClone");     
607 //      
608 //      sprintf(cname,"QA_%s_rectrackmatchratnoout",fCalorimeter.Data());
609 //      TCanvas  * c33 = new TCanvas(cname, "Ratio: reconstructed track matched/ all reconstructed", 400, 400) ;
610 //      c33->Divide(2, 2);
611 //      
612 //      c33->cd(1) ;
613 //      hEChargedNoOutClone->SetYTitle("track matched no out/ all matched");
614 //      hEChargedNoOutClone->SetXTitle("E (GeV)");
615 //      hEChargedNoOutClone->Divide(fhECharged);
616 //      hEChargedNoOutClone->Draw();
617 //      
618 //      c33->cd(2) ; 
619 //      hPtChargedNoOutClone->SetYTitle("track matched no out / all matched");
620 //      hPtChargedNoOutClone->SetXTitle("p_{T} (GeV/c)");
621 //      hPtChargedNoOutClone->Divide(fhPtCharged);
622 //      hPtChargedNoOutClone->Draw();
623 //      
624 //      c33->cd(3) ;
625 //      hPhiChargedNoOutClone->SetYTitle("track matched no out/ all matched");
626 //      hPhiChargedNoOutClone->SetXTitle("#phi (rad)");
627 //      hPhiChargedNoOutClone->Divide(fhPhiCharged);
628 //      hPhiChargedNoOutClone->Draw();
629 //      
630 //      c33->cd(4) ; 
631 //      hEtaChargedNoOutClone->SetYTitle("track matched no out/ all matched");
632 //      hEtaChargedNoOutClone->SetXTitle("#eta");
633 //      hEtaChargedNoOutClone->Divide(fhEtaCharged);
634 //      hEtaChargedNoOutClone->Draw();
635 //      
636 //      sprintf(name,"QA_%s_RatioMatchedDistributionsAllToNoOut.eps",fCalorimeter.Data());
637 //      c33->Print(name);
638         
639         
640
641         //TRACK MATCHING P/E distributions
642         //printf("cPoverE\n");
643         sprintf(cname,"QA_%s_trkmatch",fCalorimeter.Data());
644         TCanvas *cme = new TCanvas(cname,"Track-matching distributions", 400, 400);
645         cme->Divide(2,2);
646         
647         TLegend pLegendpE0(0.6,0.55,0.9,0.8);
648         pLegendpE0.SetTextSize(0.04);
649         pLegendpE0.AddEntry(fh1pOverE,"all","L");
650         pLegendpE0.AddEntry(fh1pOverER02,"dR < 0.02","L");
651         pLegendpE0.SetFillColor(10);
652         pLegendpE0.SetBorderSize(1);
653         //pLegendpE0.Draw();
654         
655         cme->cd(1);
656         gPad->SetLogy();
657         fh1pOverE->SetTitle("Track matches p/E");
658         fh1pOverE->Draw();
659         fh1pOverER02->SetLineColor(4);
660         fh1pOverER02->Draw("same");
661         pLegendpE0.Draw();
662         
663         cme->cd(2);
664         gPad->SetLogy();
665         fh1dR->Draw();
666         
667         cme->cd(3);
668         fh2MatchdEdx->Draw();
669         
670         cme->cd(4);
671         fh2EledEdx->Draw();
672         
673         sprintf(name,"QA_%s_TrackMatchingEleDist.eps",fCalorimeter.Data());
674         cme->Print(name);       
675
676         //eta vs phi
677         //printf("c4\n");
678         sprintf(cname,"QA_%s_etavsphi",fCalorimeter.Data());
679 //      TCanvas  * c4 = new TCanvas(cname, "reconstructed #eta vs #phi", 600, 200) ;
680 //      c4->Divide(3, 1);
681         
682         TCanvas  * c4 = new TCanvas(cname, "reconstructed #eta vs #phi", 400, 200) ;
683         c4->Divide(2, 1);
684         
685         c4->cd(1) ;
686         fhEtaPhi->Draw("cont");
687         
688         c4->cd(2) ; 
689         fhEtaPhiCharged->Draw("cont");
690         
691 //      c4->cd(3) ; 
692 //      fhEtaPhiChargedNoOut->Draw("cont");
693
694         sprintf(name,"QA_%s_ReconstructedEtaVsPhi.eps",fCalorimeter.Data());
695         c4->Print(name);
696         
697         sprintf(name,"QA_%s_ReconstructedEtaVsPhiVsE.eps",fCalorimeter.Data());
698         c4->Print(name); printf("Plot: %s\n",name);
699         
700         //Invariant mass
701         Int_t binmin = -1;
702         Int_t binmax = -1;
703         
704         if(fhIM->GetEntries() > 1){
705                 Int_t nebins  = fhIM->GetNbinsX();
706                 Int_t emax = (Int_t) fhIM->GetXaxis()->GetXmax();
707                 Int_t emin = (Int_t) fhIM->GetXaxis()->GetXmin();
708                 if (emin != 0 ) printf("emin != 0 \n");
709                 //printf("IM: nBinsX %d, emin %2.2f, emax %2.2f\n",nebins,emin,emax);
710                 
711                 sprintf(cname,"QA_%s_IM",fCalorimeter.Data());
712                 //      printf("c5\n");
713                 TCanvas  * c5 = new TCanvas(cname, "Invariant mass", 600, 400) ;
714                 c5->Divide(2, 3);
715                 
716                 c5->cd(1) ; 
717                 //fhIM->SetLineColor(4);
718                 //fhIM->Draw();
719                 binmin = 0;
720                 binmax =  (Int_t) (1-emin)*nebins/emax;
721                 TH1D *pyim1 = fhIM->ProjectionY("pyim1",binmin,binmax);
722                 pyim1->SetTitle("E_{pair} < 1 GeV");
723                 pyim1->SetLineColor(1);
724                 pyim1->Draw();
725                 TLegend pLegendIM(0.7,0.6,0.9,0.8);
726                 pLegendIM.SetTextSize(0.03);
727                 pLegendIM.AddEntry(pyim1,"all modules","L");
728                 pLegendIM.SetFillColor(10);
729                 pLegendIM.SetBorderSize(1);
730                 for(Int_t imod = 0; imod < fNModules; imod++){
731                         pyim1 = fhIMMod[imod]->ProjectionY(Form("pyim1_%d",imod),binmin,binmax);
732                         pLegendIM.AddEntry(pyim1,Form("module %d",imod),"L");
733                         pyim1->SetLineColor(imod+1);
734                         pyim1->Draw("same");
735                 }
736                 pLegendIM.Draw();
737                 
738                 c5->cd(2) ; 
739                 binmin =  (Int_t) (1-emin)*nebins/emax;
740                 binmax =  (Int_t) (2-emin)*nebins/emax;
741                 TH1D *pyim2 = fhIM->ProjectionY("pyim2",binmin,binmax);
742                 pyim2->SetTitle("1 < E_{pair} < 2 GeV");
743                 pyim2->SetLineColor(1);
744                 pyim2->Draw();
745                 for(Int_t imod = 0; imod < fNModules; imod++){
746                         pyim2 = fhIMMod[imod]->ProjectionY(Form("pyim2_%d",imod),binmin,binmax);
747                         pyim2->SetLineColor(imod+1);
748                         pyim2->Draw("same");
749                 }
750                 
751                 c5->cd(3) ; 
752                 binmin =  (Int_t) (2-emin)*nebins/emax;
753                 binmax =  (Int_t) (3-emin)*nebins/emax;
754                 TH1D *pyim3 = fhIM->ProjectionY("pyim3",binmin,binmax);
755                 pyim3->SetTitle("2 < E_{pair} < 3 GeV");
756                 pyim3->SetLineColor(1);
757                 pyim3->Draw();
758                 for(Int_t imod = 0; imod < fNModules; imod++){
759                         pyim3 = fhIMMod[imod]->ProjectionY(Form("pyim3_%d",imod),binmin,binmax);
760                         pyim3->SetLineColor(imod+1);
761                         pyim3->Draw("same");
762                 }
763                 
764                 c5->cd(4) ;
765                 binmin =  (Int_t) (3-emin)*nebins/emax;
766                 binmax =  (Int_t) (4-emin)*nebins/emax;
767                 TH1D *pyim4 = fhIM->ProjectionY("pyim4",binmin,binmax);
768                 pyim4->SetTitle("3 < E_{pair} < 4 GeV");
769                 pyim4->SetLineColor(1);
770                 pyim4->Draw();
771                 for(Int_t imod = 0; imod < fNModules; imod++){
772                         pyim4 = fhIMMod[imod]->ProjectionY(Form("pyim4_%d",imod),binmin,binmax);
773                         pyim4->SetLineColor(imod+1);
774                         pyim4->Draw("same");
775                 }
776                 
777                 c5->cd(5) ;
778                 binmin =  (Int_t) (4-emin)*nebins/emax;
779                 binmax =  (Int_t) (5-emin)*nebins/emax;
780                 TH1D *pyim5 = fhIM->ProjectionY("pyim5",binmin,binmax);
781                 pyim5->SetTitle("4< E_{pair} < 5 GeV");
782                 pyim5->SetLineColor(1);
783                 pyim5->Draw();
784                 for(Int_t imod = 0; imod < fNModules; imod++){
785                         pyim5 = fhIMMod[imod]->ProjectionY(Form("pyim5_%d",imod),binmin,binmax);
786                         pyim5->SetLineColor(imod+1);
787                         pyim5->Draw("same");
788                 }
789                 
790                 c5->cd(6) ;
791                 binmin =  (Int_t) (5-emin)*nebins/emax;
792                 binmax =  -1;
793                 TH1D *pyim10 = fhIM->ProjectionY("pyim10",binmin,binmax);
794                 pyim10->SetTitle("E_{pair} > 5 GeV");
795                 pyim10->SetLineColor(1);
796                 pyim10->Draw();
797                 for(Int_t imod = 0; imod < fNModules; imod++){
798                         pyim10 = fhIMMod[imod]->ProjectionY(Form("pyim10_%d",imod),binmin,binmax);
799                         pyim10->SetLineColor(imod+1);
800                         pyim10->Draw("same");
801                 }
802                 
803                 sprintf(name,"QA_%s_InvariantMass.eps",fCalorimeter.Data());
804                 c5->Print(name); printf("Plot: %s\n",name);
805         }
806         
807         
808         if(fhIMCellCut->GetEntries() > 1){
809                 Int_t nebins  = fhIMCellCut->GetNbinsX();
810                 Int_t emax = (Int_t) fhIMCellCut->GetXaxis()->GetXmax();
811                 Int_t emin = (Int_t) fhIMCellCut->GetXaxis()->GetXmin();
812                 if (emin != 0 ) printf("emin != 0 \n");
813                 //printf("IMCellCut: nBinsX %d, emin %2.2f, emax %2.2f\n",nebins,emin,emax);
814                 
815                 sprintf(cname,"QA_%s_IMCellCut",fCalorimeter.Data());
816                 //      printf("c5cc\n");
817                 TCanvas  * c5cc = new TCanvas(cname, "Invariant mass, Cell Cut", 600, 400) ;
818                 c5cc->Divide(2, 3);
819                 
820                 c5cc->cd(1) ; 
821                 //fhIMCellCut->SetLineColor(4);
822                 //fhIMCellCut->Draw();
823                 binmin = 0;
824                 binmax =  (Int_t) (1-emin)*nebins/emax;
825                 TH1D *pyimcc1 = fhIMCellCut->ProjectionY("pyimcc1",binmin,binmax);
826                 pyimcc1->SetTitle("E_{pair} < 1 GeV");
827                 pyimcc1->SetLineColor(1);
828                 pyimcc1->Draw();
829                 TLegend pLegendIMCellCut(0.7,0.6,0.9,0.8);
830                 pLegendIMCellCut.SetTextSize(0.03);
831                 pLegendIMCellCut.AddEntry(pyimcc1,"all modules","L");
832                 pLegendIMCellCut.SetFillColor(10);
833                 pLegendIMCellCut.SetBorderSize(1);
834                 for(Int_t imod = 0; imod < fNModules; imod++){
835                         pyimcc1 = fhIMCellCutMod[imod]->ProjectionY(Form("pyimcc1_%d",imod),binmin,binmax);
836                         pLegendIMCellCut.AddEntry(pyimcc1,Form("module %d",imod),"L");
837                         pyimcc1->SetLineColor(imod+1);
838                         pyimcc1->Draw("same");
839                 }
840                 pLegendIMCellCut.Draw();
841                 
842                 c5cc->cd(2) ; 
843                 binmin =  (Int_t) (1-emin)*nebins/emax;
844                 binmax =  (Int_t) (2-emin)*nebins/emax;
845                 TH1D *pyimcc2 = fhIMCellCut->ProjectionY("pyimcc2",binmin,binmax);
846                 pyimcc2->SetTitle("1 < E_{pair} < 2 GeV");
847                 pyimcc2->SetLineColor(1);
848                 pyimcc2->Draw();
849                 for(Int_t imod = 0; imod < fNModules; imod++){
850                         pyimcc2 = fhIMCellCutMod[imod]->ProjectionY(Form("pyimcc2_%d",imod),binmin,binmax);
851                         pyimcc2->SetLineColor(imod+1);
852                         pyimcc2->Draw("same");
853                 }
854                 
855                 c5cc->cd(3) ; 
856                 binmin =  (Int_t) (2-emin)*nebins/emax;
857                 binmax =  (Int_t) (3-emin)*nebins/emax;
858                 TH1D *pyimcc3 = fhIMCellCut->ProjectionY("pyimcc3",binmin,binmax);
859                 pyimcc3->SetTitle("2 < E_{pair} < 3 GeV");
860                 pyimcc3->SetLineColor(1);
861                 pyimcc3->Draw();
862                 for(Int_t imod = 0; imod < fNModules; imod++){
863                         pyimcc3 = fhIMCellCutMod[imod]->ProjectionY(Form("pyimcc3_%d",imod),binmin,binmax);
864                         pyimcc3->SetLineColor(imod+1);
865                         pyimcc3->Draw("same");
866                 }
867                 
868                 c5cc->cd(4) ;
869                 binmin =  (Int_t) (3-emin)*nebins/emax;
870                 binmax =  (Int_t) (4-emin)*nebins/emax;
871                 TH1D *pyimcc4 = fhIMCellCut->ProjectionY("pyimcc4",binmin,binmax);
872                 pyimcc4->SetTitle("3 < E_{pair} < 4 GeV");
873                 pyimcc4->SetLineColor(1);
874                 pyimcc4->Draw();
875                 for(Int_t imod = 0; imod < fNModules; imod++){
876                         pyimcc4 = fhIMCellCutMod[imod]->ProjectionY(Form("pyimcc4_%d",imod),binmin,binmax);
877                         pyimcc4->SetLineColor(imod+1);
878                         pyimcc4->Draw("same");
879                 }
880                 
881                 c5cc->cd(5) ;
882                 binmin =  (Int_t) (4-emin)*nebins/emax;
883                 binmax =  (Int_t) (5-emin)*nebins/emax;
884                 TH1D *pyimcc5cc = fhIMCellCut->ProjectionY("pyimcc5cc",binmin,binmax);
885                 pyimcc5cc->SetTitle("4< E_{pair} < 5 GeV");
886                 pyimcc5cc->SetLineColor(1);
887                 pyimcc5cc->Draw();
888                 for(Int_t imod = 0; imod < fNModules; imod++){
889                         pyimcc5cc = fhIMCellCutMod[imod]->ProjectionY(Form("pyimcc5cc_%d",imod),binmin,binmax);
890                         pyimcc5cc->SetLineColor(imod+1);
891                         pyimcc5cc->Draw("same");
892                 }
893                 
894                 c5cc->cd(6) ;
895                 binmin =  (Int_t) (5-emin)*nebins/emax;
896                 binmax =  -1;
897                 TH1D *pyimcc10 = fhIMCellCut->ProjectionY("pyimcc10",binmin,binmax);
898                 pyimcc10->SetTitle("E_{pair} > 5 GeV");
899                 pyimcc10->SetLineColor(1);
900                 pyimcc10->Draw();
901                 for(Int_t imod = 0; imod < fNModules; imod++){
902                         pyimcc10 = fhIMCellCutMod[imod]->ProjectionY(Form("pyimcc10_%d",imod),binmin,binmax);
903                         pyimcc10->SetLineColor(imod+1);
904                         pyimcc10->Draw("same");
905                 }
906                 
907                 sprintf(name,"QA_%s_InvariantMass_CellCut.eps",fCalorimeter.Data());
908                 c5cc->Print(name); printf("Plot: %s\n",name);
909         }
910         //Asymmetry
911         //printf("c5b\n");
912         if(fhAsym->GetEntries() > 1){
913                 Int_t nebins  = fhAsym->GetNbinsX();
914                 Int_t emax = (Int_t) fhAsym->GetXaxis()->GetXmax();
915                 Int_t emin = (Int_t) fhAsym->GetXaxis()->GetXmin();
916                 if (emin != 0 ) printf("emin != 0 \n");
917                 //printf("Asym: nBinsX %d, emin %2.2f, emax %2.2f\n",nebins,emin,emax);
918                 
919                 sprintf(cname,"QA_%s_Asym",fCalorimeter.Data());
920                 //      printf("c5\n");
921                 TCanvas  * c5b = new TCanvas(cname, "Asymmetry", 400, 400) ;
922                 c5b->Divide(2, 2);
923                 
924                 c5b->cd(1) ; 
925                 fhAsym->SetTitleOffset(1.6,"Y");
926                 fhAsym->SetLineColor(4);
927                 fhAsym->Draw();
928                 
929                 c5b->cd(2) ; 
930                 binmin = 0;
931                 binmax = (Int_t) (5-emin)*nebins/emax;
932                 TH1D *pyAsym5 = fhAsym->ProjectionY("pyAsym5",binmin,binmax);
933                 pyAsym5->SetTitle("E_{pair} < 5 GeV");
934                 pyAsym5->SetLineColor(4);
935                 pyAsym5->Draw();
936                 
937                 c5b->cd(3) ; 
938                 binmin = (Int_t) (5-emin)*nebins/emax;
939                 binmax = (Int_t) (10-emin)*nebins/emax;
940                 TH1D *pyAsym510 = fhAsym->ProjectionY("pyAsym5_10",binmin,binmax);
941                 pyAsym510->SetTitle("5 < E_{pair} < 10 GeV");
942                 pyAsym510->SetLineColor(4);
943                 pyAsym510->Draw();
944                 
945                 c5b->cd(4) ;
946                 binmin = (Int_t) (10-emin)*nebins/emax;
947                 binmax = -1;
948                 TH1D *pyAsym10 = fhAsym->ProjectionY("pyAsym10",binmin,binmax);
949                 pyAsym10->SetTitle("E_{pair} > 10 GeV");
950                 pyAsym10->SetLineColor(4);
951                 pyAsym10->Draw();
952                 
953                 sprintf(name,"QA_%s_Asymmetry.eps",fCalorimeter.Data());
954                 c5b->Print(name);
955         }
956                 
957         
958         //CaloCells
959         //printf("c9\n");
960         sprintf(cname,"QA_%s_nclustercellsamp",fCalorimeter.Data());
961         TCanvas  * c9 = new TCanvas(cname, " CaloClusters and CaloCells", 400, 400) ;
962         c9->Divide(2, 2);
963         
964         c9->cd(1) ; 
965         
966         TLegend pLegendN(0.7,0.6,0.9,0.8);
967         pLegendN.SetTextSize(0.03);
968         pLegendN.AddEntry(fhNClusters,"all modules","L");
969         pLegendN.SetFillColor(10);
970         pLegendN.SetBorderSize(1);
971         
972         if(fhNClusters->GetEntries() > 0) gPad->SetLogy();
973         gPad->SetLogx();
974         fhNClusters->SetLineColor(1);
975         fhNClusters->Draw();
976         for(Int_t imod = 0; imod < fNModules; imod++){
977                 fhNClustersMod[imod]->SetLineColor(imod+1);
978                 fhNClustersMod[imod]->Draw("same");
979                 pLegendN.AddEntry(fhNClustersMod[imod],Form("module %d",imod),"L");
980         }
981         pLegendN.Draw();
982         
983         c9->cd(2) ; 
984         if(fhNCells->GetEntries() > 0) gPad->SetLogy();
985         gPad->SetLogx();
986         fhNCells->SetLineColor(1);
987         fhNCells->Draw();
988         for(Int_t imod = 0; imod < fNModules; imod++){
989                 fhNCellsMod[imod]->SetLineColor(imod+1);
990                 fhNCellsMod[imod]->Draw("same");
991         }
992         c9->cd(3) ; 
993         if(fhNCellsPerCluster->GetEntries() > 0) gPad->SetLogy();
994         gPad->SetLogx();
995         TH1D *cpc = fhNCellsPerCluster->ProjectionY("cpc",-1,-1);
996         cpc->SetLineColor(1);
997         cpc->Draw();
998         for(Int_t imod = 0; imod < fNModules; imod++){
999                 cpc = fhNCellsPerClusterMod[imod]->ProjectionY(Form("cpc_%d",imod),-1,-1);
1000                 cpc->SetLineColor(imod+1);
1001                 cpc->Draw("same");
1002         }
1003         
1004         c9->cd(4) ; 
1005         if(fhAmplitude->GetEntries() > 0) gPad->SetLogy();
1006         gPad->SetLogx();
1007         fhAmplitude->SetLineColor(1);
1008         fhAmplitude->Draw();
1009         for(Int_t imod = 0; imod < fNModules; imod++){
1010                 fhAmplitudeMod[imod]->SetLineColor(imod+1);
1011                 fhAmplitudeMod[imod]->Draw("same");
1012         }
1013         
1014         sprintf(name,"QA_%s_CaloClustersAndCaloCells.eps",fCalorimeter.Data());
1015         c9->Print(name); printf("Plot: %s\n",name);
1016
1017         //Cell Time histograms, time only available in ESDs
1018         if(dataType=="ESD") {
1019                 
1020                 sprintf(cname,"QA_%s_cellstime",fCalorimeter.Data());
1021                 TCanvas  * ctime = new TCanvas(cname, " Cells time", 1200, 400) ;
1022                 ctime->Divide(3, 1);
1023                 
1024                 ctime->cd(1) ; 
1025                 if(fhTime->GetEntries() > 0) gPad->SetLogy();
1026                 fhTime->Draw();
1027                 
1028                 ctime->cd(2) ; 
1029                 //if(fhTimeId->GetEntries() > 0) gPad->SetLogy();
1030                 fhTimeId->Draw("colz");
1031                 
1032                 ctime->cd(3) ; 
1033                 //if(fhTimeAmp->GetEntries() > 0) gPad->SetLogy();
1034                 fhTimeAmp->Draw("colz");
1035                 
1036                 sprintf(name,"QA_%s_CellsTime.eps",fCalorimeter.Data());
1037                 ctime->Print(name); printf("Plot: %s\n",name);
1038         }
1039         
1040         
1041         if(fCorrelateCalos){
1042                 //Calorimeter Correlation, PHOS vs EMCAL
1043                 sprintf(cname,"QA_%s_CaloCorr_EMCALvsPHOS",fCalorimeter.Data());
1044                 TCanvas  * ccorr = new TCanvas(cname, " EMCAL vs PHOS", 400, 400) ;
1045                 ccorr->Divide(2, 2);
1046                 
1047                 ccorr->cd(1) ; 
1048                 //gPad->SetLogy();
1049                 //gPad->SetLogx();
1050                 fhCaloCorrNClusters ->Draw();
1051                 
1052                 ccorr->cd(2) ; 
1053                 //gPad->SetLogy();
1054                 //gPad->SetLogx();
1055                 fhCaloCorrNCells->Draw();
1056                 
1057                 ccorr->cd(3) ; 
1058                 //gPad->SetLogy();
1059                 //gPad->SetLogx();
1060                 fhCaloCorrEClusters->Draw();
1061                 
1062                 ccorr->cd(4) ; 
1063                 //gPad->SetLogy();
1064                 //gPad->SetLogx();
1065                 fhCaloCorrECells->Draw();
1066                 
1067                 sprintf(name,"QA_%s_CaloCorr_EMCALvsPHOS.eps",fCalorimeter.Data());
1068                 ccorr->Print(name); printf("Plot: %s\n",name);
1069         }
1070         
1071         //Grid of cell per module plots 
1072     {
1073                 gStyle->SetOptStat(0);
1074                 sprintf(cname,"QA_%s_GridCellEntries",fCalorimeter.Data());
1075                 //      printf("c5\n");
1076                 TCanvas *cgrid   = new TCanvas("cgrid","Number of entries per cell", 12,12,800,400);
1077                 if(fNModules%2 == 0)
1078                         cgrid->Divide(fNModules/2,2); 
1079                 else
1080                         cgrid->Divide(fNModules/2+1,2); 
1081                 
1082                 for(Int_t imod = 0; imod < fNModules ; imod++){
1083                         cgrid->cd(imod+1);
1084                         gPad->SetLogz();
1085                         gPad->SetGridy();
1086                         gPad->SetGridx();
1087                         fhGridCellsMod[imod]->SetLabelSize(0.025,"z");
1088                         fhGridCellsMod[imod]->Draw("colz");
1089                 }
1090                 sprintf(name,"QA_%s_GridCellsEntries.eps",fCalorimeter.Data());
1091                 cgrid->Print(name); printf("Plot: %s\n",name);
1092                 
1093                 sprintf(cname,"QA_%s_GridCellAccumEnergy",fCalorimeter.Data());
1094                 //      printf("c5\n");
1095                 TCanvas *cgridE   = new TCanvas("cgridE","Summed energy per cell", 12,12,800,400);
1096                 cgridE->Divide(fNModules/2,2); 
1097                 for(Int_t imod = 0; imod < fNModules ; imod++){
1098                         cgridE->cd(imod+1);
1099                         gPad->SetLogz();
1100                         gPad->SetGridy();
1101                         gPad->SetGridx();
1102                         fhGridCellsEMod[imod]->SetLabelSize(0.025,"z");
1103                         fhGridCellsEMod[imod]->Draw("colz");
1104                 }
1105                 sprintf(name,"QA_%s_GridCellsAccumEnergy.eps",fCalorimeter.Data());
1106                 cgridE->Print(name); printf("Plot: %s\n",name);
1107                 
1108                 sprintf(cname,"QA_%s_GridCellAverageEnergy",fCalorimeter.Data());
1109                 //      printf("c5\n");
1110                 TCanvas *cgridEA   = new TCanvas("cgridEA","Average energy per cell", 12,12,800,400);
1111                 cgridEA->Divide(fNModules/2,2); 
1112                 for(Int_t imod = 0; imod < fNModules ; imod++){
1113                         cgridEA->cd(imod+1);
1114                         gPad->SetLogz();
1115                         gPad->SetGridy();
1116                         gPad->SetGridx();
1117                         fhGridCellsEMod[imod]->SetLabelSize(0.025,"z");
1118                         fhGridCellsEMod[imod]->Divide(fhGridCellsMod[imod]);
1119                         fhGridCellsEMod[imod]->Draw("colz");
1120                 }
1121                 sprintf(name,"QA_%s_GridCellsAverageEnergy.eps",fCalorimeter.Data());
1122                 cgridEA->Print(name); printf("Plot: %s\n",name);
1123                 
1124         }       
1125         
1126         if(isDataMC){
1127           //Reconstructed vs MC distributions
1128           //printf("c6\n");
1129           sprintf(cname,"QA_%s_recvsmc",fCalorimeter.Data());
1130           TCanvas  * c6 = new TCanvas(cname, "Reconstructed vs MC distributions", 400, 400) ;
1131           c6->Divide(2, 2);
1132           
1133           fh2E->SetAxisRange(minx,maxx,"X");
1134           fh2Pt->SetAxisRange(minx,maxx,"X");
1135           fh2E->SetAxisRange(minx,maxx,"Y");
1136           fh2Pt->SetAxisRange(minx,maxx,"Y");
1137           
1138           c6->cd(1) ; 
1139           fh2E->SetTitleOffset(1.6,"Y");
1140           fh2E->SetLineColor(4);
1141           fh2E->Draw();
1142           
1143           c6->cd(2) ; 
1144           fh2Pt->SetTitleOffset(1.6,"Y");
1145           fh2Pt->SetLineColor(4);
1146           fh2Pt->Draw();
1147           
1148           c6->cd(3) ; 
1149           fh2Phi->SetTitleOffset(1.6,"Y");
1150           fh2Phi->SetLineColor(4);
1151           fh2Phi->Draw();
1152           
1153           c6->cd(4) ; 
1154           fh2Eta->SetTitleOffset(1.6,"Y");
1155           fh2Eta->SetLineColor(4);
1156           fh2Eta->Draw();
1157           
1158           sprintf(name,"QA_%s_ReconstructedVSMCDistributions.eps",fCalorimeter.Data());
1159           c6->Print(name);      
1160           
1161           //Reconstructed vs MC distributions
1162           //printf("c6\n");
1163           sprintf(cname,"QA_%s_gamrecvsmc",fCalorimeter.Data());
1164           TCanvas  * c6Gam = new TCanvas(cname, "Reconstructed vs MC distributions", 400, 400) ;
1165           c6Gam->Divide(2, 2);
1166           
1167           fhGamE->SetAxisRange(minx,maxx,"X");
1168           fhGamPt->SetAxisRange(minx,maxx,"X");
1169           
1170           c6Gam->cd(1) ; 
1171           fhGamE->Draw();
1172           
1173           c6Gam->cd(2) ; 
1174           fhGamPt->Draw();
1175           
1176           c6Gam->cd(3) ; 
1177           fhGamPhi->Draw();
1178           
1179           c6Gam->cd(4) ; 
1180           fhGamEta->Draw();
1181           
1182           sprintf(name,"QA_%s_GammaReconstructedVSMCDistributions.eps",fCalorimeter.Data());
1183           c6->Print(name);      
1184           
1185           //Generated - reconstructed  
1186           //printf("c7\n");
1187           sprintf(cname,"QA_%s_diffgenrec",fCalorimeter.Data());
1188           TCanvas  * c7 = new TCanvas(cname, "generated - reconstructed", 400, 400) ;
1189           c7->Divide(2, 2);
1190           
1191           c7->cd(1) ; 
1192           gPad->SetLogy();
1193           fhGamDeltaE->SetLineColor(4);
1194           fhDeltaE->Draw();
1195           fhGamDeltaE->Draw("same");
1196           
1197           TLegend pLegendd(0.65,0.55,0.9,0.8);
1198           pLegendd.SetTextSize(0.06);
1199           pLegendd.AddEntry(fhDeltaE,"all","L");
1200           pLegendd.AddEntry(fhGamDeltaE,"from  #gamma","L");
1201           pLegendd.SetFillColor(10);
1202           pLegendd.SetBorderSize(1);
1203           pLegendd.Draw();
1204           
1205           c7->cd(2) ; 
1206           gPad->SetLogy();
1207           fhGamDeltaPt->SetLineColor(4);
1208           fhDeltaPt->Draw();
1209           fhGamDeltaPt->Draw("same");
1210           
1211           c7->cd(3) ; 
1212           gPad->SetLogy();
1213           fhGamDeltaPhi->SetLineColor(4);
1214           fhDeltaPhi->Draw();
1215           fhGamDeltaPhi->Draw("same");
1216           
1217           c7->cd(4) ; 
1218           gPad->SetLogy();
1219           fhGamDeltaEta->SetLineColor(4);
1220           fhDeltaEta->Draw();
1221           fhGamDeltaEta->Draw("same");
1222           
1223           sprintf(name,"QA_%s_DiffGeneratedReconstructed.eps",fCalorimeter.Data());
1224           c7->Print(name);
1225           
1226           // Reconstructed / Generated 
1227           //printf("c8\n");
1228           sprintf(cname,"QA_%s_ratiorecgen",fCalorimeter.Data());
1229           TCanvas  * c8 = new TCanvas(cname, " reconstructed / generated", 400, 400) ;
1230           c8->Divide(2, 2);
1231           
1232           c8->cd(1) ; 
1233           gPad->SetLogy();
1234           fhGamRatioE->SetLineColor(4);
1235           fhRatioE->Draw();
1236           fhGamRatioE->Draw("same");
1237           
1238           TLegend pLegendr(0.65,0.55,0.9,0.8);
1239           pLegendr.SetTextSize(0.06);
1240           pLegendr.AddEntry(fhRatioE,"all","L");
1241           pLegendr.AddEntry(fhGamRatioE,"from  #gamma","L");
1242           pLegendr.SetFillColor(10);
1243           pLegendr.SetBorderSize(1);
1244           pLegendr.Draw();
1245           
1246           c8->cd(2) ; 
1247           gPad->SetLogy();
1248           fhGamRatioPt->SetLineColor(4);
1249           fhRatioPt->Draw();
1250           fhGamRatioPt->Draw("same");
1251           
1252           c8->cd(3) ; 
1253           fhGamRatioPhi->SetLineColor(4);
1254           fhRatioPhi->Draw();
1255           fhGamRatioPhi->Draw("same");
1256           
1257           c8->cd(4) ; 
1258           fhGamRatioEta->SetLineColor(4);
1259           fhRatioEta->Draw();
1260           fhGamRatioEta->Draw("same");
1261           
1262           sprintf(name,"QA_%s_ReconstructedDivGenerated.eps",fCalorimeter.Data());
1263           c8->Print(name);
1264           
1265           
1266           //Generated distributions
1267           //printf("c1\n");
1268           sprintf(cname,"QA_%s_gen",fCalorimeter.Data());
1269           TCanvas  * c10 = new TCanvas(cname, "Generated distributions", 600, 200) ;
1270           c10->Divide(3, 1);
1271           
1272           c10->cd(1) ; 
1273           gPad->SetLogy();
1274           TH1F * haxispt  = (TH1F*) fhGenPi0Pt->Clone("axispt");  
1275           haxispt->SetTitle("Generated Particles p_{T}, |#eta| < 1");
1276           fhGenPi0Pt->SetLineColor(1);
1277           fhGenGamPt->SetLineColor(4);
1278           fhGenEtaPt->SetLineColor(2);
1279           fhGenOmegaPt->SetLineColor(7);
1280           fhGenElePt->SetLineColor(6);
1281           
1282           //Select the maximum of the histogram to show all lines.
1283           if(fhGenPi0Pt->GetMaximum() >= fhGenGamPt->GetMaximum() && fhGenPi0Pt->GetMaximum() >= fhGenEtaPt->GetMaximum() && 
1284              fhGenPi0Pt->GetMaximum() >= fhGenOmegaPt->GetMaximum() && fhGenPi0Pt->GetMaximum() >= fhGenElePt->GetMaximum())
1285             haxispt->SetMaximum(fhGenPi0Pt->GetMaximum());
1286           else if(fhGenGamPt->GetMaximum() >= fhGenPi0Pt->GetMaximum() && fhGenGamPt->GetMaximum() >= fhGenEtaPt->GetMaximum() && 
1287                   fhGenGamPt->GetMaximum() >= fhGenOmegaPt->GetMaximum() && fhGenGamPt->GetMaximum() >= fhGenElePt->GetMaximum())
1288             haxispt->SetMaximum(fhGenGamPt->GetMaximum());
1289           else if(fhGenEtaPt->GetMaximum() >= fhGenPi0Pt->GetMaximum() && fhGenEtaPt->GetMaximum() >= fhGenGamPt->GetMaximum() && 
1290                   fhGenEtaPt->GetMaximum() >= fhGenOmegaPt->GetMaximum() && fhGenEtaPt->GetMaximum() >= fhGenElePt->GetMaximum())
1291             haxispt->SetMaximum(fhGenEtaPt->GetMaximum());      
1292           else if(fhGenOmegaPt->GetMaximum() >= fhGenPi0Pt->GetMaximum() && fhGenOmegaPt->GetMaximum() >= fhGenEtaPt->GetMaximum() && 
1293                   fhGenOmegaPt->GetMaximum() >= fhGenGamPt->GetMaximum() && fhGenOmegaPt->GetMaximum() >= fhGenElePt->GetMaximum())
1294             haxispt->SetMaximum(fhGenOmegaPt->GetMaximum());
1295           else if(fhGenElePt->GetMaximum() >= fhGenPi0Pt->GetMaximum() && fhGenElePt->GetMaximum() >= fhGenEtaPt->GetMaximum() && 
1296                   fhGenElePt->GetMaximum() >= fhGenOmegaPt->GetMaximum() && fhGenElePt->GetMaximum() >= fhGenGamPt->GetMaximum())
1297             haxispt->SetMaximum(fhGenElePt->GetMaximum());
1298           haxispt->SetMinimum(1);
1299           haxispt->SetAxisRange(minx,maxx,"X"); 
1300           haxispt->Draw("axis");
1301           fhGenPi0Pt->Draw("same");
1302           fhGenGamPt->Draw("same");
1303           fhGenEtaPt->Draw("same");
1304           fhGenOmegaPt->Draw("same");
1305           fhGenElePt->Draw("same");
1306           
1307           TLegend pLegend(0.85,0.65,0.95,0.93);
1308           pLegend.SetTextSize(0.06);
1309           pLegend.AddEntry(fhGenPi0Pt,"  #pi^{0}","L");
1310           pLegend.AddEntry(fhGenGamPt,"  #gamma","L");
1311           pLegend.AddEntry(fhGenEtaPt,"  #eta","L");
1312           pLegend.AddEntry(fhGenOmegaPt,"  #omega","L");
1313           pLegend.AddEntry(fhGenElePt,"  e^{#pm}","L");
1314           pLegend.SetFillColor(10);
1315           pLegend.SetBorderSize(1);
1316           pLegend.Draw();
1317           
1318           c10->cd(2) ;
1319           gPad->SetLogy();
1320           TH1F * haxiseta  = (TH1F*) fhGenPi0Eta->Clone("axiseta");  
1321           haxiseta->SetTitle("Generated Particles #eta, |#eta| < 1");
1322           fhGenPi0Eta->SetLineColor(1);
1323           fhGenGamEta->SetLineColor(4);
1324           fhGenEtaEta->SetLineColor(2);
1325           fhGenOmegaEta->SetLineColor(7);
1326           fhGenEleEta->SetLineColor(6);
1327           //Select the maximum of the histogram to show all lines.
1328           if(fhGenPi0Eta->GetMaximum() >= fhGenGamEta->GetMaximum() && fhGenPi0Eta->GetMaximum() >= fhGenEtaEta->GetMaximum() && 
1329              fhGenPi0Eta->GetMaximum() >= fhGenOmegaEta->GetMaximum() && fhGenPi0Eta->GetMaximum() >= fhGenEleEta->GetMaximum())
1330             haxiseta->SetMaximum(fhGenPi0Eta->GetMaximum());
1331           else if(fhGenGamEta->GetMaximum() >= fhGenPi0Eta->GetMaximum() && fhGenGamEta->GetMaximum() >= fhGenEtaEta->GetMaximum() && 
1332                   fhGenGamEta->GetMaximum() >= fhGenOmegaEta->GetMaximum() && fhGenGamEta->GetMaximum() >= fhGenEleEta->GetMaximum())
1333             haxiseta->SetMaximum(fhGenGamEta->GetMaximum());
1334           else if(fhGenEtaEta->GetMaximum() >= fhGenPi0Eta->GetMaximum() && fhGenEtaEta->GetMaximum() >= fhGenGamEta->GetMaximum() && 
1335                   fhGenEtaEta->GetMaximum() >= fhGenOmegaEta->GetMaximum() && fhGenEtaEta->GetMaximum() >= fhGenEleEta->GetMaximum())
1336             haxiseta->SetMaximum(fhGenEtaEta->GetMaximum());    
1337           else if(fhGenOmegaEta->GetMaximum() >= fhGenPi0Eta->GetMaximum() && fhGenOmegaEta->GetMaximum() >= fhGenEtaEta->GetMaximum() && 
1338                   fhGenOmegaEta->GetMaximum() >= fhGenGamEta->GetMaximum() && fhGenOmegaEta->GetMaximum() >= fhGenEleEta->GetMaximum())
1339             haxiseta->SetMaximum(fhGenOmegaEta->GetMaximum());
1340           else if(fhGenEleEta->GetMaximum() >= fhGenPi0Eta->GetMaximum() && fhGenEleEta->GetMaximum() >= fhGenEtaEta->GetMaximum() && 
1341                   fhGenEleEta->GetMaximum() >= fhGenOmegaEta->GetMaximum() && fhGenEleEta->GetMaximum() >= fhGenGamEta->GetMaximum())
1342             haxiseta->SetMaximum(fhGenEleEta->GetMaximum());
1343           haxiseta->SetMinimum(100);
1344           haxiseta->Draw("axis");
1345           fhGenPi0Eta->Draw("same");
1346           fhGenGamEta->Draw("same");
1347           fhGenEtaEta->Draw("same");
1348           fhGenOmegaEta->Draw("same");
1349           fhGenEleEta->Draw("same");
1350           
1351           
1352           c10->cd(3) ; 
1353           gPad->SetLogy();
1354           TH1F * haxisphi  = (TH1F*) fhGenPi0Phi->Clone("axisphi");  
1355           haxisphi->SetTitle("Generated Particles #phi, |#eta| < 1");
1356           fhGenPi0Phi->SetLineColor(1);
1357           fhGenGamPhi->SetLineColor(4);
1358           fhGenEtaPhi->SetLineColor(2);
1359           fhGenOmegaPhi->SetLineColor(7);
1360           fhGenElePhi->SetLineColor(6);
1361           //Select the maximum of the histogram to show all lines.
1362           if(fhGenPi0Phi->GetMaximum() >= fhGenGamPhi->GetMaximum() && fhGenPi0Phi->GetMaximum() >= fhGenEtaPhi->GetMaximum() && 
1363              fhGenPi0Phi->GetMaximum() >= fhGenOmegaPhi->GetMaximum() && fhGenPi0Phi->GetMaximum() >= fhGenElePhi->GetMaximum())
1364             haxisphi->SetMaximum(fhGenPi0Phi->GetMaximum());
1365           else if(fhGenGamPhi->GetMaximum() >= fhGenPi0Phi->GetMaximum() && fhGenGamPhi->GetMaximum() >= fhGenEtaPhi->GetMaximum() && 
1366                   fhGenGamPhi->GetMaximum() >= fhGenOmegaPhi->GetMaximum() && fhGenGamPhi->GetMaximum() >= fhGenElePhi->GetMaximum())
1367             haxisphi->SetMaximum(fhGenGamPhi->GetMaximum());
1368           else if(fhGenEtaPhi->GetMaximum() >= fhGenPi0Phi->GetMaximum() && fhGenEtaPhi->GetMaximum() >= fhGenGamPhi->GetMaximum() && 
1369                   fhGenEtaPhi->GetMaximum() >= fhGenOmegaPhi->GetMaximum() && fhGenEtaPhi->GetMaximum() >= fhGenElePhi->GetMaximum())
1370             haxisphi->SetMaximum(fhGenEtaPhi->GetMaximum());    
1371           else if(fhGenOmegaPhi->GetMaximum() >= fhGenPi0Phi->GetMaximum() && fhGenOmegaPhi->GetMaximum() >= fhGenEtaPhi->GetMaximum() && 
1372                   fhGenOmegaPhi->GetMaximum() >= fhGenGamPhi->GetMaximum() && fhGenOmegaPhi->GetMaximum() >= fhGenElePhi->GetMaximum())
1373             haxisphi->SetMaximum(fhGenOmegaPhi->GetMaximum());
1374           else if(fhGenElePhi->GetMaximum() >= fhGenPi0Phi->GetMaximum() && fhGenElePhi->GetMaximum() >= fhGenEtaPhi->GetMaximum() && 
1375                   fhGenElePhi->GetMaximum() >= fhGenOmegaPhi->GetMaximum() && fhGenElePhi->GetMaximum() >= fhGenGamPhi->GetMaximum())
1376             haxisphi->SetMaximum(fhGenElePhi->GetMaximum());
1377           haxisphi->SetMinimum(100);
1378           haxisphi->Draw("axis");
1379           fhGenPi0Phi->Draw("same");
1380           fhGenGamPhi->Draw("same");
1381           fhGenEtaPhi->Draw("same");
1382           fhGenOmegaPhi->Draw("same");
1383           fhGenElePhi->Draw("same");
1384           
1385           sprintf(name,"QA_%s_GeneratedDistributions.eps",fCalorimeter.Data());
1386           c10->Print(name);
1387           
1388           
1389           //Reconstructed clusters depending on its original particle.
1390           //printf("c1\n");
1391           sprintf(cname,"QA_%s_recgenid",fCalorimeter.Data());
1392           TCanvas  * c11 = new TCanvas(cname, "Reconstructed particles, function of their original particle ID", 400, 400) ;
1393           c11->Divide(2, 2);
1394           
1395           
1396           c11->cd(1) ; 
1397           gPad->SetLogy();
1398           TH1F * hGamE   = (TH1F*) fhGamE->ProjectionX("hGamE",-1,-1);
1399           TH1F * hPi0E   = (TH1F*) fhPi0E->ProjectionX("hPi0E",-1,-1);
1400           TH1F * hEleE   = (TH1F*) fhEleE->ProjectionX("hEleE",-1,-1);
1401           TH1F * hNeHadE = (TH1F*) fhNeHadE->ProjectionX("hNeHadE",-1,-1);
1402           TH1F * hChHadE = (TH1F*) fhChHadE->ProjectionX("hChHadE",-1,-1);
1403           TH1F * haxisE  = (TH1F*) hPi0E->Clone("axisE");  
1404           haxisE->SetTitle("Reconstructed particles E, function of their original particle ID");
1405           haxisE->SetAxisRange(minx,maxx,"X");  
1406           
1407           hPi0E->SetLineColor(1);
1408           hGamE->SetLineColor(4);
1409           hNeHadE->SetLineColor(2);
1410           hChHadE->SetLineColor(7);
1411           hEleE->SetLineColor(6);
1412           
1413           //Select the maximum of the histogram to show all lines.
1414           if(hPi0E->GetMaximum() >= hGamE->GetMaximum() && hPi0E->GetMaximum() >= hNeHadE->GetMaximum() && 
1415              hPi0E->GetMaximum() >= hChHadE->GetMaximum() && hPi0E->GetMaximum() >= hEleE->GetMaximum())
1416             haxisE->SetMaximum(hPi0E->GetMaximum());
1417           else if(hGamE->GetMaximum() >= hPi0E->GetMaximum() && hGamE->GetMaximum() >= hNeHadE->GetMaximum() && 
1418                   hGamE->GetMaximum() >= hChHadE->GetMaximum() && hGamE->GetMaximum() >= hEleE->GetMaximum())
1419             haxisE->SetMaximum(hGamE->GetMaximum());
1420           else if(hNeHadE->GetMaximum() >= hPi0E->GetMaximum() && hNeHadE->GetMaximum() >= hGamE->GetMaximum() && 
1421                   hNeHadE->GetMaximum() >= hChHadE->GetMaximum() && hNeHadE->GetMaximum() >= hEleE->GetMaximum())
1422             haxisE->SetMaximum(hNeHadE->GetMaximum());  
1423           else if(hChHadE->GetMaximum() >= hPi0E->GetMaximum() && hChHadE->GetMaximum() >= hNeHadE->GetMaximum() && 
1424                   hChHadE->GetMaximum() >= hGamE->GetMaximum() && hChHadE->GetMaximum() >= hEleE->GetMaximum())
1425             haxisE->SetMaximum(hChHadE->GetMaximum());
1426           else if(hEleE->GetMaximum() >= hPi0E->GetMaximum() && hEleE->GetMaximum() >= hNeHadE->GetMaximum() && 
1427                   hEleE->GetMaximum() >= hChHadE->GetMaximum() && hEleE->GetMaximum() >= hGamE->GetMaximum())
1428             haxisE->SetMaximum(hEleE->GetMaximum());
1429           haxisE->SetXTitle("E (GeV)");
1430           haxisE->SetMinimum(1);
1431           haxisE->Draw("axis");
1432           hPi0E->Draw("same");
1433           hGamE->Draw("same");
1434           hNeHadE->Draw("same");
1435           hChHadE->Draw("same");
1436           hEleE->Draw("same");
1437           
1438           TLegend pLegend2(0.8,0.65,0.95,0.93);
1439           pLegend2.SetTextSize(0.06);
1440           pLegend2.AddEntry(hPi0E,"  #pi^{0}","L");
1441           pLegend2.AddEntry(hGamE,"  #gamma","L");
1442           pLegend2.AddEntry(hEleE,"  e^{#pm}","L");
1443           pLegend2.AddEntry(hChHadE,"  h^{#pm}","L");
1444           pLegend2.AddEntry(hNeHadE,"  h^{0}","L");
1445           pLegend2.SetFillColor(10);
1446           pLegend2.SetBorderSize(1);
1447           pLegend2.Draw();
1448           
1449           
1450           c11->cd(2) ; 
1451           gPad->SetLogy();
1452           //printf("%s, %s, %s, %s, %s\n",fhGamPt->GetName(),fhPi0Pt->GetName(),fhElePt->GetName(),fhNeHadPt->GetName(), fhChHadPt->GetName());
1453           TH1F * hGamPt   = (TH1F*) fhGamPt->ProjectionX("hGamPt",-1,-1);
1454           TH1F * hPi0Pt   = (TH1F*) fhPi0Pt->ProjectionX("hPi0Pt",-1,-1);
1455           TH1F * hElePt   = (TH1F*) fhElePt->ProjectionX("hElePt",-1,-1);
1456           TH1F * hNeHadPt = (TH1F*) fhNeHadPt->ProjectionX("hNeHadPt",-1,-1);
1457           TH1F * hChHadPt = (TH1F*) fhChHadPt->ProjectionX("hChHadPt",-1,-1);
1458           haxispt  = (TH1F*) hPi0Pt->Clone("axispt");  
1459           haxispt->SetTitle("Reconstructed particles p_{T}, function of their original particle ID");
1460           hPi0Pt->SetLineColor(1);
1461           hGamPt->SetLineColor(4);
1462           hNeHadPt->SetLineColor(2);
1463           hChHadPt->SetLineColor(7);
1464           hElePt->SetLineColor(6);
1465           
1466           //Select the maximum of the histogram to show all lines.
1467           if(hPi0Pt->GetMaximum() >= hGamPt->GetMaximum() && hPi0Pt->GetMaximum() >= hNeHadPt->GetMaximum() && 
1468              hPi0Pt->GetMaximum() >= hChHadPt->GetMaximum() && hPi0Pt->GetMaximum() >= hElePt->GetMaximum())
1469             haxispt->SetMaximum(hPi0Pt->GetMaximum());
1470           else if(hGamPt->GetMaximum() >= hPi0Pt->GetMaximum() && hGamPt->GetMaximum() >= hNeHadPt->GetMaximum() && 
1471                   hGamPt->GetMaximum() >= hChHadPt->GetMaximum() && hGamPt->GetMaximum() >= hElePt->GetMaximum())
1472             haxispt->SetMaximum(hGamPt->GetMaximum());
1473           else if(hNeHadPt->GetMaximum() >= hPi0Pt->GetMaximum() && hNeHadPt->GetMaximum() >= hGamPt->GetMaximum() && 
1474                   hNeHadPt->GetMaximum() >= hChHadPt->GetMaximum() && hNeHadPt->GetMaximum() >= hElePt->GetMaximum())
1475             haxispt->SetMaximum(hNeHadPt->GetMaximum());        
1476           else if(hChHadPt->GetMaximum() >= hPi0Pt->GetMaximum() && hChHadPt->GetMaximum() >= hNeHadPt->GetMaximum() && 
1477                   hChHadPt->GetMaximum() >= hGamPt->GetMaximum() && hChHadPt->GetMaximum() >= hElePt->GetMaximum())
1478             haxispt->SetMaximum(hChHadPt->GetMaximum());
1479           else if(hElePt->GetMaximum() >= hPi0Pt->GetMaximum() && hElePt->GetMaximum() >= hNeHadPt->GetMaximum() && 
1480                   hElePt->GetMaximum() >= hChHadPt->GetMaximum() && hElePt->GetMaximum() >= hGamPt->GetMaximum())
1481             haxispt->SetMaximum(hElePt->GetMaximum());
1482           haxispt->SetXTitle("p_{T} (GeV/c)");
1483           haxispt->SetMinimum(1);
1484           haxispt->SetAxisRange(minx,maxx,"X");
1485           haxispt->Draw("axis");
1486           hPi0Pt->Draw("same");
1487           hGamPt->Draw("same");
1488           hNeHadPt->Draw("same");
1489           hChHadPt->Draw("same");
1490           hElePt->Draw("same");
1491           
1492           
1493           c11->cd(3) ;
1494           gPad->SetLogy();
1495           
1496           TH1F * hGamEta   = (TH1F*) fhGamEta->ProjectionX("hGamEta",-1,-1);
1497           TH1F * hPi0Eta   = (TH1F*) fhPi0Eta->ProjectionX("hPi0Eta",-1,-1);
1498           TH1F * hEleEta   = (TH1F*) fhEleEta->ProjectionX("hEleEta",-1,-1);
1499           TH1F * hNeHadEta = (TH1F*) fhNeHadEta->ProjectionX("hNeHadEta",-1,-1);
1500           TH1F * hChHadEta = (TH1F*) fhChHadEta->ProjectionX("hChHadEta",-1,-1);
1501           haxiseta  = (TH1F*) hPi0Eta->Clone("axiseta");  
1502           haxiseta->SetTitle("Reconstructed particles #eta, function of their original particle ID");
1503           hPi0Eta->SetLineColor(1);
1504           hGamEta->SetLineColor(4);
1505           hNeHadEta->SetLineColor(2);
1506           hChHadEta->SetLineColor(7);
1507           hEleEta->SetLineColor(6);
1508           //Select the maximum of the histogram to show all lines.
1509           if(hPi0Eta->GetMaximum() >= hGamEta->GetMaximum() && hPi0Eta->GetMaximum() >= hNeHadEta->GetMaximum() && 
1510              hPi0Eta->GetMaximum() >= hChHadEta->GetMaximum() && hPi0Eta->GetMaximum() >= hEleEta->GetMaximum())
1511             haxiseta->SetMaximum(hPi0Eta->GetMaximum());
1512           else if(hGamEta->GetMaximum() >= hPi0Eta->GetMaximum() && hGamEta->GetMaximum() >= hNeHadEta->GetMaximum() && 
1513                   hGamEta->GetMaximum() >= hChHadEta->GetMaximum() && hGamEta->GetMaximum() >= hEleEta->GetMaximum())
1514             haxiseta->SetMaximum(hGamEta->GetMaximum());
1515           else if(hNeHadEta->GetMaximum() >= hPi0Eta->GetMaximum() && hNeHadEta->GetMaximum() >= hGamEta->GetMaximum() && 
1516                   hNeHadEta->GetMaximum() >= hChHadEta->GetMaximum() && hNeHadEta->GetMaximum() >= hEleEta->GetMaximum())
1517             haxiseta->SetMaximum(hNeHadEta->GetMaximum());      
1518           else if(hChHadEta->GetMaximum() >= hPi0Eta->GetMaximum() && hChHadEta->GetMaximum() >= hNeHadEta->GetMaximum() && 
1519                   hChHadEta->GetMaximum() >= hGamEta->GetMaximum() && hChHadEta->GetMaximum() >= hEleEta->GetMaximum())
1520             haxiseta->SetMaximum(hChHadEta->GetMaximum());
1521           else if(hEleEta->GetMaximum() >= hPi0Eta->GetMaximum() && hEleEta->GetMaximum() >= hNeHadEta->GetMaximum() && 
1522                   hEleEta->GetMaximum() >= hChHadEta->GetMaximum() && hEleEta->GetMaximum() >= hGamEta->GetMaximum())
1523             haxiseta->SetMaximum(hEleEta->GetMaximum());
1524           
1525           haxiseta->SetXTitle("#eta");
1526           haxiseta->Draw("axis");
1527           hPi0Eta->Draw("same");
1528           hGamEta->Draw("same");
1529           hNeHadEta->Draw("same");
1530           hChHadEta->Draw("same");
1531           hEleEta->Draw("same");
1532           
1533           
1534           c11->cd(4) ; 
1535           gPad->SetLogy();
1536           TH1F * hGamPhi   = (TH1F*) fhGamPhi->ProjectionX("hGamPhi",-1,-1);
1537           TH1F * hPi0Phi   = (TH1F*) fhPi0Phi->ProjectionX("hPi0Phi",-1,-1);
1538           TH1F * hElePhi   = (TH1F*) fhElePhi->ProjectionX("hElePhi",-1,-1);
1539           TH1F * hNeHadPhi = (TH1F*) fhNeHadPhi->ProjectionX("hNeHadPhi",-1,-1);
1540           TH1F * hChHadPhi = (TH1F*) fhChHadPhi->ProjectionX("hChHadPhi",-1,-1);
1541           haxisphi  = (TH1F*) hPi0Phi->Clone("axisphi");  
1542           haxisphi->SetTitle("Reconstructed particles #phi, function of their original particle ID");
1543           
1544           hPi0Phi->SetLineColor(1);
1545           hGamPhi->SetLineColor(4);
1546           hNeHadPhi->SetLineColor(2);
1547           hChHadPhi->SetLineColor(7);
1548           hElePhi->SetLineColor(6);
1549           //Select the maximum of the histogram to show all lines.
1550           if(hPi0Phi->GetMaximum() >= hGamPhi->GetMaximum() && hPi0Phi->GetMaximum() >= hNeHadPhi->GetMaximum() && 
1551              hPi0Phi->GetMaximum() >= hChHadPhi->GetMaximum() && hPi0Phi->GetMaximum() >= hElePhi->GetMaximum())
1552             haxisphi->SetMaximum(hPi0Phi->GetMaximum());
1553           else if(hGamPhi->GetMaximum() >= hPi0Phi->GetMaximum() && hGamPhi->GetMaximum() >= hNeHadPhi->GetMaximum() && 
1554                   hGamPhi->GetMaximum() >= hChHadPhi->GetMaximum() && hGamPhi->GetMaximum() >= hElePhi->GetMaximum())
1555             haxisphi->SetMaximum(hGamPhi->GetMaximum());
1556           else if(hNeHadPhi->GetMaximum() >= hPi0Phi->GetMaximum() && hNeHadPhi->GetMaximum() >= hGamPhi->GetMaximum() && 
1557                   hNeHadPhi->GetMaximum() >= hChHadPhi->GetMaximum() && hNeHadPhi->GetMaximum() >= hElePhi->GetMaximum())
1558             haxisphi->SetMaximum(hNeHadPhi->GetMaximum());      
1559           else if(hChHadPhi->GetMaximum() >= hPi0Phi->GetMaximum() && hChHadPhi->GetMaximum() >= hNeHadPhi->GetMaximum() && 
1560                   hChHadPhi->GetMaximum() >= hGamPhi->GetMaximum() && hChHadPhi->GetMaximum() >= hElePhi->GetMaximum())
1561             haxisphi->SetMaximum(hChHadPhi->GetMaximum());
1562           else if(hElePhi->GetMaximum() >= hPi0Phi->GetMaximum() && hElePhi->GetMaximum() >= hNeHadPhi->GetMaximum() && 
1563                   hElePhi->GetMaximum() >= hChHadPhi->GetMaximum() && hElePhi->GetMaximum() >= hGamPhi->GetMaximum())
1564             haxisphi->SetMaximum(hElePhi->GetMaximum());
1565           haxisphi->SetXTitle("#phi (rad)");
1566           haxisphi->Draw("axis");
1567           hPi0Phi->Draw("same");
1568           hGamPhi->Draw("same");
1569           hNeHadPhi->Draw("same");
1570           hChHadPhi->Draw("same");
1571           hElePhi->Draw("same");
1572           
1573           sprintf(name,"QA_%s_RecDistributionsGenID.eps",fCalorimeter.Data());
1574           c11->Print(name);
1575           
1576           
1577           //Ratio reconstructed clusters / generated particles in acceptance, for different particle ID
1578           //printf("c1\n");
1579           
1580           TH1F *        hPi0EClone   = (TH1F*)   hPi0E  ->Clone("hPi0EClone");
1581           TH1F *        hGamEClone   = (TH1F*)   hGamE  ->Clone("hGamEClone");
1582           TH1F *        hPi0PtClone  = (TH1F*)   hPi0Pt ->Clone("hPi0PtClone");
1583           TH1F *        hGamPtClone  = (TH1F*)   hGamPt ->Clone("hGamPtClone"); 
1584           TH1F *        hPi0EtaClone = (TH1F*)   hPi0Eta->Clone("hPi0EtaClone");
1585           TH1F *        hGamEtaClone = (TH1F*)   hGamEta->Clone("hGamEtaClone");        
1586           TH1F *        hPi0PhiClone = (TH1F*)   hPi0Phi->Clone("hPi0PhiClone");
1587           TH1F *        hGamPhiClone = (TH1F*)   hGamPhi->Clone("hGamPhiClone");        
1588           
1589           sprintf(cname,"QA_%s_recgenidratio",fCalorimeter.Data());
1590           TCanvas  * c12 = new TCanvas(cname, "Ratio reconstructed clusters / generated particles in acceptance, for different particle ID", 400, 400) ;
1591           c12->Divide(2, 2);
1592           
1593           c12->cd(1) ; 
1594           gPad->SetLogy();
1595           haxisE->SetTitle("Ratio reconstructed clusters / generated particles in acceptance, for different particle ID");
1596           hPi0EClone->Divide(fhGenPi0AccE);
1597           hGamEClone->Divide(fhGenGamAccE);
1598           haxisE->SetMaximum(1000);
1599           haxisE->SetMinimum(1e-2);
1600           haxisE->SetXTitle("E (GeV)");
1601           haxisE->SetYTitle("ratio = rec/gen");
1602           haxisE->Draw("axis");
1603           hPi0E->Draw("same");
1604           hGamE->Draw("same");
1605         
1606           TLegend pLegend3(0.75,0.2,0.9,0.4);
1607           pLegend3.SetTextSize(0.06);
1608           pLegend3.AddEntry(hPi0EClone,"  #pi^{0}","L");
1609           pLegend3.AddEntry(hGamEClone,"  #gamma","L");
1610           pLegend3.SetFillColor(10);
1611           pLegend3.SetBorderSize(1);
1612           pLegend3.Draw();
1613           
1614           c12->cd(2) ; 
1615           gPad->SetLogy();
1616           haxispt->SetTitle("Ratio reconstructed clusters / generated particles in acceptance, for different particle ID");
1617           hPi0PtClone->Divide(fhGenPi0AccPt);
1618           hGamPtClone->Divide(fhGenGamAccPt);
1619           haxispt->SetMaximum(5);
1620           haxispt->SetMinimum(1e-2);
1621           haxispt->SetXTitle("p_{T} (GeV/c)");
1622           haxispt->SetYTitle("ratio = rec/gen");
1623           haxispt->Draw("axis");
1624           hPi0PtClone->Draw("same");
1625           hGamPtClone->Draw("same");
1626           
1627           c12->cd(3) ;
1628           gPad->SetLogy();
1629           
1630           haxiseta->SetTitle("Ratio reconstructed clusters / generated particles in acceptance, for different particle ID");
1631           hPi0EtaClone->Divide(fhGenPi0AccEta);
1632           hGamEtaClone->Divide(fhGenGamAccEta);
1633           haxiseta->SetMaximum(1.2);
1634           haxiseta->SetMinimum(1e-2);
1635           haxiseta->SetYTitle("ratio = rec/gen");
1636           haxiseta->SetXTitle("#eta");
1637           haxiseta->Draw("axis");
1638           hPi0EtaClone->Draw("same");
1639           hGamEtaClone->Draw("same");
1640           
1641           
1642           c12->cd(4) ; 
1643           gPad->SetLogy();
1644           haxisphi->SetTitle("Ratio reconstructed clusters / generated particles in acceptance, for different particle ID");
1645           hPi0PhiClone->Divide(fhGenPi0AccPhi);
1646           hGamPhiClone->Divide(fhGenGamAccPhi);
1647           haxisphi->SetYTitle("ratio = rec/gen");
1648           haxisphi->SetXTitle("#phi (rad)");
1649           haxisphi->SetMaximum(1.2);
1650           haxisphi->SetMinimum(1e-2);
1651           haxisphi->Draw("axis");
1652           hPi0PhiClone->Draw("same");
1653           hGamPhiClone->Draw("same");
1654           
1655           sprintf(name,"QA_%s_EfficiencyGenID.eps",fCalorimeter.Data());
1656           c12->Print(name);
1657           
1658           
1659           //Reconstructed distributions
1660           //printf("c1\n");
1661           sprintf(cname,"QA_%s_vertex",fCalorimeter.Data());
1662           TCanvas  * c13 = new TCanvas(cname, "Particle vertex", 400, 400) ;
1663           c13->Divide(2, 2);
1664           
1665           c13->cd(1) ; 
1666           //gPad->SetLogy();
1667           fhEMVxyz->SetTitleOffset(1.6,"Y");
1668           fhEMVxyz->Draw();
1669           
1670           c13->cd(2) ; 
1671           //gPad->SetLogy();
1672           fhHaVxyz->SetTitleOffset(1.6,"Y");
1673           fhHaVxyz->Draw();
1674           
1675           c13->cd(3) ;
1676           gPad->SetLogy();
1677           TH1F * hEMR = (TH1F*) fhEMR->ProjectionY("hEM",-1,-1); 
1678           hEMR->SetLineColor(4);
1679           hEMR->Draw();
1680           
1681           c13->cd(4) ; 
1682           gPad->SetLogy();
1683           TH1F * hHaR = (TH1F*) fhHaR->ProjectionY("hHa",-1,-1); 
1684           hHaR->SetLineColor(4);
1685           hHaR->Draw();
1686           
1687           
1688           sprintf(name,"QA_%s_ParticleVertex.eps",fCalorimeter.Data());
1689           c13->Print(name);
1690           
1691           
1692           //Track-matching distributions
1693           
1694           
1695           //Reconstructed distributions, matched with tracks, generated particle dependence
1696           //printf("c2\n");
1697           sprintf(cname,"QA_%s_rectrackmatchGenID",fCalorimeter.Data());
1698           TCanvas  * c22ch = new TCanvas(cname, "Reconstructed distributions, matched with tracks, for different particle ID", 400, 400) ;
1699           c22ch->Divide(2, 2);
1700           
1701           c22ch->cd(1) ; 
1702           
1703           TH1F * hGamECharged   = (TH1F*) fhGamECharged->ProjectionX("hGamECharged",-1,-1);
1704           TH1F * hPi0ECharged   = (TH1F*) fhPi0ECharged->ProjectionX("hPi0ECharged",-1,-1);
1705           TH1F * hEleECharged   = (TH1F*) fhEleECharged->ProjectionX("hEleECharged",-1,-1);
1706           TH1F * hNeHadECharged = (TH1F*) fhNeHadECharged->ProjectionX("hNeHadECharged",-1,-1);
1707           TH1F * hChHadECharged = (TH1F*) fhChHadECharged->ProjectionX("hChHadECharged",-1,-1);
1708           hPi0ECharged->SetLineColor(1);
1709           hGamECharged->SetLineColor(4);
1710           hNeHadECharged->SetLineColor(2);
1711           hChHadECharged->SetLineColor(7);
1712           hEleECharged->SetLineColor(6);        
1713           gPad->SetLogy();
1714           fhECharged->SetLineColor(3);
1715           fhECharged->SetMinimum(0.5);
1716           fhECharged->Draw();
1717           hPi0ECharged->Draw("same");
1718           hGamECharged->Draw("same");
1719           hNeHadECharged->Draw("same");
1720           hChHadECharged->Draw("same");
1721           hEleECharged->Draw("same");
1722           TLegend pLegend22(0.75,0.45,0.9,0.8);
1723           pLegend22.SetTextSize(0.06);
1724           pLegend22.AddEntry(fhECharged,"all","L");
1725           pLegend22.AddEntry(hPi0ECharged,"#pi^{0}","L");
1726           pLegend22.AddEntry(hGamECharged,"#gamma","L");
1727           pLegend22.AddEntry(hEleECharged,"e^{#pm}","L");
1728           pLegend22.AddEntry(hChHadECharged,"h^{#pm}","L");
1729           pLegend22.AddEntry(hNeHadECharged,"h^{0}","L");
1730           pLegend22.SetFillColor(10);
1731           pLegend22.SetBorderSize(1);
1732           pLegend22.Draw();
1733           
1734           c22ch->cd(2) ; 
1735           
1736           TH1F * hGamPtCharged   = (TH1F*) fhGamPtCharged->ProjectionX("hGamPtCharged",-1,-1);
1737           TH1F * hPi0PtCharged   = (TH1F*) fhPi0PtCharged->ProjectionX("hPi0PtCharged",-1,-1);
1738           TH1F * hElePtCharged   = (TH1F*) fhElePtCharged->ProjectionX("hElePtCharged",-1,-1);
1739           TH1F * hNeHadPtCharged = (TH1F*) fhNeHadPtCharged->ProjectionX("hNeHadPtCharged",-1,-1);
1740           TH1F * hChHadPtCharged = (TH1F*) fhChHadPtCharged->ProjectionX("hChHadPtCharged",-1,-1);
1741           hPi0PtCharged->SetLineColor(1);
1742           hGamPtCharged->SetLineColor(4);
1743           hNeHadPtCharged->SetLineColor(2);
1744           hChHadPtCharged->SetLineColor(7);
1745           hElePtCharged->SetLineColor(6);       
1746           gPad->SetLogy();
1747           fhPtCharged->SetLineColor(3);
1748           fhPtCharged->SetMinimum(0.5);
1749           fhPtCharged->Draw();
1750           hPi0PtCharged->Draw("same");
1751           hGamPtCharged->Draw("same");
1752           hNeHadPtCharged->Draw("same");
1753           hChHadPtCharged->Draw("same");
1754           hElePtCharged->Draw("same");  
1755           
1756           c22ch->cd(4) ; 
1757           
1758           TH1F * hGamEtaCharged   = (TH1F*) fhGamEtaCharged->ProjectionX("hGamEtaCharged",-1,-1);
1759           TH1F * hPi0EtaCharged   = (TH1F*) fhPi0EtaCharged->ProjectionX("hPi0EtaCharged",-1,-1);
1760           TH1F * hEleEtaCharged   = (TH1F*) fhEleEtaCharged->ProjectionX("hEleEtaCharged",-1,-1);
1761           TH1F * hNeHadEtaCharged = (TH1F*) fhNeHadEtaCharged->ProjectionX("hNeHadEtaCharged",-1,-1);
1762           TH1F * hChHadEtaCharged = (TH1F*) fhChHadEtaCharged->ProjectionX("hChHadEtaCharged",-1,-1);
1763           hPi0EtaCharged->SetLineColor(1);
1764           hGamEtaCharged->SetLineColor(4);
1765           hNeHadEtaCharged->SetLineColor(2);
1766           hChHadEtaCharged->SetLineColor(7);
1767           hEleEtaCharged->SetLineColor(6);      
1768           gPad->SetLogy();
1769           fhEtaCharged->SetLineColor(3);
1770           fhEtaCharged->SetMinimum(0.5);
1771           fhEtaCharged->Draw();
1772           hPi0EtaCharged->Draw("same");
1773           hGamEtaCharged->Draw("same");
1774           hNeHadEtaCharged->Draw("same");
1775           hChHadEtaCharged->Draw("same");
1776           hEleEtaCharged->Draw("same");
1777           
1778           c22ch->cd(3) ; 
1779           
1780           TH1F * hGamPhiCharged   = (TH1F*) fhGamPhiCharged->ProjectionX("hGamPhiCharged",-1,-1);
1781           TH1F * hPi0PhiCharged   = (TH1F*) fhPi0PhiCharged->ProjectionX("hPi0PhiCharged",-1,-1);
1782           TH1F * hElePhiCharged   = (TH1F*) fhElePhiCharged->ProjectionX("hElePhiCharged",-1,-1);
1783           TH1F * hNeHadPhiCharged = (TH1F*) fhNeHadPhiCharged->ProjectionX("hNeHadPhiCharged",-1,-1);
1784           TH1F * hChHadPhiCharged = (TH1F*) fhChHadPhiCharged->ProjectionX("hChHadPhiCharged",-1,-1);
1785           hPi0PhiCharged->SetLineColor(1);
1786           hGamPhiCharged->SetLineColor(4);
1787           hNeHadPhiCharged->SetLineColor(2);
1788           hChHadPhiCharged->SetLineColor(7);
1789           hElePhiCharged->SetLineColor(6);      
1790           gPad->SetLogy();
1791           fhPhiCharged->SetLineColor(3);
1792           fhPhiCharged->SetMinimum(0.5);
1793           fhPhiCharged->Draw();
1794           hPi0PhiCharged->Draw("same");
1795           hGamPhiCharged->Draw("same");
1796           hNeHadPhiCharged->Draw("same");
1797           hChHadPhiCharged->Draw("same");
1798           hElePhiCharged->Draw("same");
1799           
1800           
1801           sprintf(name,"QA_%s_ReconstructedDistributions_TrackMatchedGenID.eps",fCalorimeter.Data());
1802           c22ch->Print(name);
1803           
1804           TH1F *        hGamEChargedClone   = (TH1F*)   hGamECharged->Clone("GamEChargedClone");
1805           TH1F *        hGamPtChargedClone  = (TH1F*)   hGamPtCharged->Clone("GamPtChargedClone");
1806           TH1F *        hGamEtaChargedClone = (TH1F*)   hGamEtaCharged->Clone("GamEtaChargedClone");
1807           TH1F *        hGamPhiChargedClone = (TH1F*)   hGamPhiCharged->Clone("GamPhiChargedClone");
1808           
1809           TH1F *        hPi0EChargedClone   = (TH1F*)   hPi0ECharged->Clone("Pi0EChargedClone");
1810           TH1F *        hPi0PtChargedClone  = (TH1F*)   hPi0PtCharged->Clone("Pi0PtChargedClone");
1811           TH1F *        hPi0EtaChargedClone = (TH1F*)   hPi0EtaCharged->Clone("Pi0EtaChargedClone");
1812           TH1F *        hPi0PhiChargedClone = (TH1F*)   hPi0PhiCharged->Clone("Pi0PhiChargedClone");
1813         
1814           TH1F *        hEleEChargedClone   = (TH1F*)   hEleECharged->Clone("EleEChargedClone");
1815           TH1F *        hElePtChargedClone  = (TH1F*)   hElePtCharged->Clone("ElePtChargedClone");
1816           TH1F *        hEleEtaChargedClone = (TH1F*)   hEleEtaCharged->Clone("EleEtaChargedClone");
1817           TH1F *        hElePhiChargedClone = (TH1F*)   hElePhiCharged->Clone("ElePhiChargedClone");    
1818           
1819           TH1F *        hNeHadEChargedClone   = (TH1F*)   hNeHadECharged->Clone("NeHadEChargedClone");
1820           TH1F *        hNeHadPtChargedClone  = (TH1F*)   hNeHadPtCharged->Clone("NeHadPtChargedClone");
1821           TH1F *        hNeHadEtaChargedClone = (TH1F*)   hNeHadEtaCharged->Clone("NeHadEtaChargedClone");
1822           TH1F *        hNeHadPhiChargedClone = (TH1F*)   hNeHadPhiCharged->Clone("NeHadPhiChargedClone");
1823           
1824           TH1F *        hChHadEChargedClone   = (TH1F*)   hChHadECharged->Clone("ChHadEChargedClone");
1825           TH1F *        hChHadPtChargedClone  = (TH1F*)   hChHadPtCharged->Clone("ChHadPtChargedClone");
1826           TH1F *        hChHadEtaChargedClone = (TH1F*)   hChHadEtaCharged->Clone("ChHadEtaChargedClone");
1827           TH1F *        hChHadPhiChargedClone = (TH1F*)   hChHadPhiCharged->Clone("ChHadPhiChargedClone");      
1828           
1829           //Ratio: reconstructed track matched/ all reconstructed
1830           //printf("c3\n");
1831           sprintf(cname,"QA_%s_rectrackmatchratGenID",fCalorimeter.Data());
1832           TCanvas  * c3ch = new TCanvas(cname, "Ratio: reconstructed track matched/ all reconstructed, for different particle ID", 400, 400) ;
1833           c3ch->Divide(2, 2);
1834           
1835           c3ch->cd(1) ;
1836           hEChargedClone->SetMaximum(1.2);
1837           hEChargedClone->SetMinimum(0.001);    
1838           hEChargedClone->SetLineColor(3);
1839           hEChargedClone->SetYTitle("track matched / all");
1840           hPi0EChargedClone->Divide(hPi0E);
1841           hGamEChargedClone->Divide(hGamE);
1842           hEleEChargedClone->Divide(hEleE);
1843           hNeHadEChargedClone->Divide(hNeHadE);
1844           hChHadEChargedClone->Divide(hChHadE);
1845           hEChargedClone->Draw();
1846           hPi0EChargedClone->Draw("same");
1847           hGamEChargedClone->Draw("same");
1848           hEleEChargedClone->Draw("same");
1849           hNeHadEChargedClone->Draw("same");
1850           hChHadEChargedClone->Draw("same");
1851           
1852           TLegend pLegend3ch(0.75,0.45,0.9,0.8);
1853           pLegend3ch.SetTextSize(0.06);
1854           pLegend3ch.AddEntry(hEChargedClone,"all","L");
1855           pLegend3ch.AddEntry(hPi0EChargedClone,"#pi^{0}","L");
1856           pLegend3ch.AddEntry(hGamEChargedClone,"#gamma","L");
1857           pLegend3ch.AddEntry(hEleEChargedClone,"e^{#pm}","L");
1858           pLegend3ch.AddEntry(hChHadEChargedClone,"h^{#pm}","L");
1859           pLegend3ch.AddEntry(hNeHadEChargedClone,"h^{0}","L");
1860           pLegend3ch.SetFillColor(10);
1861           pLegend3ch.SetBorderSize(1);
1862           pLegend3ch.Draw();
1863           
1864           c3ch->cd(2) ;
1865           hPtChargedClone->SetMaximum(1.2);
1866           hPtChargedClone->SetMinimum(0.001);   
1867           hPtChargedClone->SetLineColor(3);
1868           hPtChargedClone->SetYTitle("track matched / all");
1869           hPi0PtChargedClone->Divide(hPi0Pt);
1870           hGamPtChargedClone->Divide(hGamPt);
1871           hElePtChargedClone->Divide(hElePt);
1872           hNeHadPtChargedClone->Divide(hNeHadPt);
1873           hChHadPtChargedClone->Divide(hChHadPt);
1874           hPtChargedClone->Draw();
1875           hPi0PtChargedClone->Draw("same");
1876           hGamPtChargedClone->Draw("same");
1877           hElePtChargedClone->Draw("same");
1878           hNeHadPtChargedClone->Draw("same");
1879           hChHadPtChargedClone->Draw("same");
1880           
1881           c3ch->cd(4) ;
1882           hEtaChargedClone->SetMaximum(1.2);
1883           hEtaChargedClone->SetMinimum(0.001);  
1884           hEtaChargedClone->SetLineColor(3);
1885           hEtaChargedClone->SetYTitle("track matched / all");
1886           hPi0EtaChargedClone->Divide(hPi0Eta);
1887           hGamEtaChargedClone->Divide(hGamEta);
1888           hEleEtaChargedClone->Divide(hEleEta);
1889           hNeHadEtaChargedClone->Divide(hNeHadEta);
1890           hChHadEtaChargedClone->Divide(hChHadEta);
1891           hEtaChargedClone->Draw();
1892           hPi0EtaChargedClone->Draw("same");
1893           hGamEtaChargedClone->Draw("same");
1894           hEleEtaChargedClone->Draw("same");
1895           hNeHadEtaChargedClone->Draw("same");
1896           hChHadEtaChargedClone->Draw("same");
1897           
1898           c3ch->cd(3) ;
1899           hPhiChargedClone->SetMaximum(1.2);
1900           hPhiChargedClone->SetMinimum(0.001);
1901           hPhiChargedClone->SetLineColor(3);
1902           hPhiChargedClone->SetYTitle("track matched / all");
1903           hPi0PhiChargedClone->Divide(hPi0Phi);
1904           hGamPhiChargedClone->Divide(hGamPhi);
1905           hElePhiChargedClone->Divide(hElePhi);
1906           hNeHadPhiChargedClone->Divide(hNeHadPhi);
1907           hChHadPhiChargedClone->Divide(hChHadPhi);
1908           hPhiChargedClone->Draw();
1909           hPi0PhiChargedClone->Draw("same");
1910           hGamPhiChargedClone->Draw("same");
1911           hElePhiChargedClone->Draw("same");
1912           hNeHadPhiChargedClone->Draw("same");
1913           hChHadPhiChargedClone->Draw("same");
1914           
1915           sprintf(name,"QA_%s_RatioReconstructedMatchedDistributionsGenID.eps",fCalorimeter.Data());
1916           c3ch->Print(name);      
1917           
1918           sprintf(cname,"QA_%s_trkmatchMCEle",fCalorimeter.Data());
1919           TCanvas *cmemc = new TCanvas(cname,"Track-matching distributions from MC electrons", 600, 200);
1920           cmemc->Divide(3,1);
1921           
1922           cmemc->cd(1);
1923           gPad->SetLogy();
1924           fhMCEle1pOverE->Draw();
1925           fhMCEle1pOverER02->SetLineColor(4);
1926           fhMCEle1pOverE->SetLineColor(1);
1927           fhMCEle1pOverER02->Draw("same");
1928           pLegendpE0.Draw();
1929           
1930           cmemc->cd(2);
1931           gPad->SetLogy();
1932           fhMCEle1dR->Draw();
1933           
1934           cmemc->cd(3);
1935           fhMCEle2MatchdEdx->Draw();
1936           
1937           sprintf(name,"QA_%s_TrackMatchingDistMCEle.eps",fCalorimeter.Data());
1938           cmemc->Print(name);  
1939           
1940           sprintf(cname,"QA_%s_trkmatchMCChHad",fCalorimeter.Data());
1941           TCanvas *cmemchad = new TCanvas(cname,"Track-matching distributions from MC charged hadrons", 600, 200);
1942           cmemchad->Divide(3,1);
1943           
1944           cmemchad->cd(1);
1945           gPad->SetLogy();
1946           fhMCChHad1pOverE->Draw();
1947           fhMCChHad1pOverE->SetLineColor(1);
1948           fhMCChHad1pOverER02->SetLineColor(4);
1949           fhMCChHad1pOverER02->Draw("same");
1950           pLegendpE0.Draw();
1951           
1952           cmemchad->cd(2);
1953           gPad->SetLogy();
1954           fhMCChHad1dR->Draw();
1955           
1956           cmemchad->cd(3);
1957           fhMCChHad2MatchdEdx->Draw();
1958           
1959           sprintf(name,"QA_%s_TrackMatchingDistMCChHad.eps",fCalorimeter.Data());
1960           cmemchad->Print(name);       
1961           
1962           sprintf(cname,"QA_%s_trkmatchMCNeutral",fCalorimeter.Data());
1963           TCanvas *cmemcn = new TCanvas(cname,"Track-matching distributions from MC neutrals", 600, 200);
1964           cmemcn->Divide(3,1);
1965           
1966           cmemcn->cd(1);
1967           gPad->SetLogy();
1968           fhMCNeutral1pOverE->Draw();
1969           fhMCNeutral1pOverE->SetLineColor(1);
1970           fhMCNeutral1pOverER02->SetLineColor(4);
1971           fhMCNeutral1pOverER02->Draw("same");
1972           pLegendpE0.Draw();
1973           
1974           cmemcn->cd(2);
1975           gPad->SetLogy();
1976           fhMCNeutral1dR->Draw();
1977           
1978           cmemcn->cd(3);
1979           fhMCNeutral2MatchdEdx->Draw();
1980           
1981           sprintf(name,"QA_%s_TrackMatchingDistMCNeutral.eps",fCalorimeter.Data());
1982           cmemcn->Print(name);       
1983           
1984           sprintf(cname,"QA_%s_trkmatchpE",fCalorimeter.Data());
1985           TCanvas *cmpoe = new TCanvas(cname,"Track-matching distributions, p/E", 400, 200);
1986           cmpoe->Divide(2,1);
1987           
1988           cmpoe->cd(1);
1989           gPad->SetLogy();
1990           fh1pOverE->SetLineColor(1);
1991           fhMCEle1pOverE->SetLineColor(4);
1992           fhMCChHad1pOverE->SetLineColor(2);
1993           fhMCNeutral1pOverE->SetLineColor(7);
1994           fh1pOverE->SetMinimum(0.5);
1995           fh1pOverE->Draw();
1996           fhMCEle1pOverE->Draw("same");
1997           fhMCChHad1pOverE->Draw("same");
1998           fhMCNeutral1pOverE->Draw("same");
1999           TLegend pLegendpE(0.65,0.55,0.9,0.8);
2000           pLegendpE.SetTextSize(0.06);
2001           pLegendpE.AddEntry(fh1pOverE,"all","L");
2002           pLegendpE.AddEntry(fhMCEle1pOverE,"e^{#pm}","L");
2003           pLegendpE.AddEntry(fhMCChHad1pOverE,"h^{#pm}","L");
2004           pLegendpE.AddEntry(fhMCNeutral1pOverE,"neutrals","L");
2005           pLegendpE.SetFillColor(10);
2006           pLegendpE.SetBorderSize(1);
2007           pLegendpE.Draw();
2008           
2009           cmpoe->cd(2);
2010           gPad->SetLogy();
2011           fh1pOverER02->SetTitle("Track matches p/E, dR<0.2");
2012           fh1pOverER02->SetLineColor(1);
2013           fhMCEle1pOverER02->SetLineColor(4);
2014           fhMCChHad1pOverER02->SetLineColor(2);
2015           fhMCNeutral1pOverER02->SetLineColor(7);
2016           fh1pOverER02->SetMaximum(fh1pOverE->GetMaximum());
2017           fh1pOverER02->SetMinimum(0.5);
2018           fh1pOverER02->Draw();
2019           fhMCEle1pOverER02->Draw("same");
2020           fhMCChHad1pOverER02->Draw("same");
2021           fhMCNeutral1pOverER02->Draw("same");
2022           
2023           //            TLegend pLegendpE2(0.65,0.55,0.9,0.8);
2024           //            pLegendpE2.SetTextSize(0.06);
2025           //            pLegendpE2.SetHeader("dR < 0.02");
2026           //            pLegendpE2.SetFillColor(10);
2027           //            pLegendpE2.SetBorderSize(1);
2028           //            pLegendpE2.Draw();
2029         //Track matching histograms
2030         sprintf(name,"QA_%s_TrackMatchingPOverE.eps",fCalorimeter.Data());
2031         cmpoe->Print(name);             
2032         }//MC related histograms
2033
2034         //      char line[1024] ; 
2035         //      sprintf(line, ".!tar -zcf QA_%s_%s.tar.gz *%s*.eps", fCalorimeter.Data(), GetName(),fCalorimeter.Data()) ; 
2036         //      gROOT->ProcessLine(line);
2037         //      sprintf(line, ".!rm -fR *.eps"); 
2038         //      gROOT->ProcessLine(line);
2039         //      
2040         //      printf("AliAnaCalorimeterQA::Terminate() - !! All the pdf files are in QA_%s_%s.tar.gz !!!\n",  fCalorimeter.Data(), GetName());
2041         
2042 }
2043