]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGPP/TRD/macros/DrawTrendingTRDQA.C
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWGPP / TRD / macros / DrawTrendingTRDQA.C
1 /*
2  author: Ionut-Cristian Arsene
3  email: i.c.arsene@cern.ch
4  
5  Macro to plot trends from an input root file containing a tree.
6  Usage:
7  DrawTrendingTRDQA("trendingFile.root")
8  
9  How to add a new trending plot:
10  1. If a new trending variables needs to be added, its name must be added
11     in the gTrendNames array and also a corresponding entry in the Trends enumeration.
12     The name must match the name of its corresponding branch in the trending tree.
13     If no new trending variable is added, proceed to step 2
14  2. Define the needed histogram in DefineHistograms()
15    2.1 If just a plot of the trending variable as a function of run number is needed, then
16        a) define the histogram, 
17        b) set the uniqueID for the TH1D (with the corresponding Trends index needed to be filled) 
18        c) set the uniqueID for the y axis which will represent the variable used as error bar (optional)
19        d) add it to the output list
20        The histogram will then be filled and drawn automatically.
21    2.2 If the plot is more complicated then defined at 2.1 (e.g. use quantities derived from the existing trends, 
22                                                            correlations between various trends, etc.):
23        a) define the histogram
24        b) add it to the output list
25        c) fill the histogram in the FillHistograms() function in the section for exceptions.
26        d) drawing will be done automatically
27  */
28
29
30 // Trending variable indices
31 enum Trends {
32   kTPCTRDmatchEffPosAll=0, kTPCTRDmatchEffPosAllErr,
33   kTPCTRDmatchEffNegAll, kTPCTRDmatchEffNegAllErr,
34   kTRDTOFmatchEffPosAll, kTRDTOFmatchEffPosAllErr,
35   kTRDTOFmatchEffNegAll, kTRDTOFmatchEffNegAllErr,
36   kAvTRDtrkltsPerTrackAll, kAvTRDtrkltsPerTrackAllErr,
37   kAvNclsPerTrackAll, kAvNclsPerTrackAllErr,
38   kPHplateauHeight, kPHplateauHeightErr,
39   kPHplateauSlope, kPHplateauSlopeErr,
40   kQtotLandauMPV1GeVAll, kQtotLandauWidth1GeVAll,
41   kPHplateauHeightAbsolute, kPHplateauHeightErrAbsolute,
42   kPHplateauSlopeAbsolute, kPHplateauSlopeErrAbsolute,
43   kQtotLandauMPV1GeVAllAbsolute, kQtotLandauWidth1GeVAllAbsolute,
44   kTRDcheckDET_NTracksEvent, kTRDcheckDET_NTracksEventRMS,
45   kTRDcheckDET_NTracksSector, 
46   kTRDcheckDET_NClustersTrack, kTRDcheckDET_NClustersTrackRMS, 
47   kTRDcheckDET_NClustersTracklet, kTRDcheckDET_NClustersTrackletRMS, 
48   kTRDcheckDET_NTrackletsTrack, kTRDcheckDET_NTrackletsTrackRMS, 
49   kTRDcheckDET_ChargeCluster, kTRDcheckDET_ChargeClusterRMS, 
50   kTRDcheckDET_ChargeTracklet, kTRDcheckDET_ChargeTrackletRMS, 
51   kTRDcheckDET_PHplateau, kTRDcheckDET_PHslope, kTRDcheckDET_PHamplificationPeak,
52   kMeanExB, kRmsExB,
53   kMeanGainFactor, kRmsGainFactor,
54   kMeanT0, kRmsT0,
55   kMeanVdrift, kRmsVdrift,
56   kBeamIntensityA, kBeamIntensityC,
57   kNtrends,
58   kRun
59 };
60
61 // Trending variable names
62 // These names must match the names of the branches in the trending tree
63 // since branches are detected automatically based on the strings in this array
64 TString gTrendNames[kNtrends] = {
65   "TPCTRDmatchEffPosAll", "TPCTRDmatchEffPosAllErr",
66   "TPCTRDmatchEffNegAll", "TPCTRDmatchEffNegAllErr",
67   "TRDTOFmatchEffPosAll", "TRDTOFmatchEffPosAllErr",
68   "TRDTOFmatchEffNegAll", "TRDTOFmatchEffNegAllErr",
69   "AvTRDtrkltsPerTrackAll", "AvTRDtrkltsPerTrackAllErr",
70   "AvNclsPerTrackAll", "AvNclsPerTrackAllErr",
71   "PHplateauHeight", "PHplateauHeightErr",
72   "PHplateauSlope", "PHplateauSlopeErr",
73   "QtotLandauMPV1GeVAll", "QtotLandauWidth1GeVAll",
74   "PHplateauHeightAbsolute", "PHplateauHeightErrAbsolute",
75   "PHplateauSlopeAbsolute", "PHplateauSlopeErrAbsolute",
76   "QtotLandauMPV1GeVAllAbsolute", "QtotLandauWidth1GeVAllAbsolute",
77   "TRDcheckDET_NTracksEvent", "TRDcheckDET_NTracksEventRMS",
78   "TRDcheckDET_NTracksSector", 
79   "TRDcheckDET_NClustersTrack", "TRDcheckDET_NClustersTrackRMS", 
80   "TRDcheckDET_NClustersTracklet", "TRDcheckDET_NClustersTrackletRMS", 
81   "TRDcheckDET_NTrackletsTrack", "TRDcheckDET_NTrackletsTrackRMS", 
82   "TRDcheckDET_ChargeCluster", "TRDcheckDET_ChargeClusterRMS", 
83   "TRDcheckDET_ChargeTracklet", "TRDcheckDET_ChargeTrackletRMS", 
84   "TRDcheckDET_PHplateau", "TRDcheckDET_PHslope", "TRDcheckDET_PHamplificationPeak",
85   "meanExB", "rmsExB",
86   "meanGainFactor", "rmsGainFactor",
87   "meanT0", "rmsT0",
88   "meanVdrift", "rmsVdrift",
89   "beamIntensityA", "beamIntensityC"
90 };
91
92
93 // prototypes
94 void DefineHistograms(TList* outList, Int_t nRuns);
95 void FillHistograms(Int_t irun, TList* hList, Double_t* values, Bool_t* branchFound);
96 void DrawAllHistograms(TList* hList);
97 void SetDrawStyle(TObject* obj, TString drawOption="E1",
98                   Int_t markerStyle=24, Int_t markerColor=4, Double_t markerSize=2.0,
99                   Int_t lineStyle=1, Int_t lineColor=4, Double_t lineWidth=2.0);
100
101 //________________________________________________________________________
102 void DrawTrendingTRDQA(TString trendingFilename="trending.root") {
103   //
104   // Draw the TRD QA trending
105   //
106   TFile* trendingFile = TFile::Open(trendingFilename.Data(), "READ");
107   TTree* tree = (TTree*)trendingFile->Get("trending");
108   if(!tree){
109     cout << "E-DrawTrendingTRDQA.C: Cannot get the trending tree!" << endl;
110     return;
111   }
112     
113   Int_t run=0;
114   tree->SetBranchAddress("run",&run);
115   
116   // Array which will hold the information from the tree
117   // Note that its size is kNtrends+1. The extra element is reserved for the run number and 
118   // is always located at the back of the array (element at index kNtrends)
119   Double_t trends[kNtrends+1]={0.0};
120   
121   // Detect branches in the tree and assign an address
122   Bool_t branchFound[kNtrends]; for(Int_t i=0;i<kNtrends;++i) branchFound[i]=kFALSE;
123   for(Int_t i=0;i<kNtrends;++i) {
124     TBranch* branch = tree->FindBranch(gTrendNames[i].Data());
125     if(!branch) continue;
126     branch->SetAddress(&trends[i]);
127     branchFound[i]=kTRUE;
128   }
129   
130   // Define histograms and add them to a list
131   Int_t nRuns = tree->GetEntries();
132   TList histList;
133   histList.SetOwner(kTRUE);
134   DefineHistograms(&histList, nRuns);
135   
136   // loop over all entries in the tree (one entry per run)
137   for(Int_t i=0; i<nRuns; ++i) {
138     tree->GetEntry(i);
139     trends[kNtrends] = run;
140     FillHistograms(i, &histList, trends, branchFound);
141   }  // end loop over runs
142   
143   // Draw trending histograms
144   // Here the canvases with one drawn histogram each are saved as PNG files.
145   // The names of the PNG files use the name of the histogram
146   DrawAllHistograms(&histList);
147   
148   // save histograms into a root file
149   TFile* save=new TFile("PeriodTRDQAtrends.hist.root", "RECREATE");
150   histList.Write();
151   save->Close();
152 }
153
154
155 //________________________________________________________________________
156 void DrawAllHistograms(TList* l) {
157   //
158   // Draw all histograms in the list
159   //
160   if(!l) return;
161   TCanvas* c=0x0;
162   for(Int_t i=0; i<l->GetEntries(); ++i) {
163     TObject* o=l->At(i);
164     c=new TCanvas(Form("canvas_%s",o->GetName()), Form("%s", o->GetName()), 800.,600.);
165     c->SetLeftMargin(0.15); c->SetBottomMargin(0.15); c->SetTopMargin(0.08); c->SetRightMargin(0.03);
166     ((TH1*)o)->SetStats(kFALSE);
167     
168     // some exceptions
169     if(TString(o->GetName()).Contains("BeamIntensity")) c->SetLogy();
170     
171     o->Draw();
172     c->Print(Form("%s.png", TString(o->GetName()).Remove(0,1).Data()));
173     delete c;
174   }
175 }
176
177
178 //________________________________________________________________________
179 void FillHistograms(Int_t irun, TList* l, Double_t* v, Bool_t* branchFound) {
180   //
181   // Fill all histograms in the list
182   //
183   if(!l) return;
184   for(Int_t i=0; i<l->GetEntries(); ++i) {
185     TObject* o=l->At(i);
186     if(TString(o->IsA()->GetName()).Contains("TH1D")) {
187       TH1D* h1=(TH1D*)o;
188       h1->GetXaxis()->SetBinLabel(irun+1, Form("%.0f", v[kNtrends]));
189       
190       // Deal with the exceptions (no assigned space in the Trends enum)
191       if(TString(h1->GetName()).Contains("hTPCTRDmatchChargeAsymm")) {
192         if(branchFound[kTPCTRDmatchEffPosAll] && branchFound[kTPCTRDmatchEffNegAll]) {
193           Double_t p=v[kTPCTRDmatchEffPosAll], m=v[kTPCTRDmatchEffNegAll], 
194                dp=v[kTPCTRDmatchEffPosAllErr], dm=v[kTPCTRDmatchEffNegAllErr];
195           if(TMath::Abs(p+m)>1.0e-6) {
196             h1->SetBinContent(irun+1, 100.0*2.0*(p-m)/(p+m));
197             h1->SetBinError(irun+1, 100.0*4.0*TMath::Sqrt(m*m*dp*dp+p*p*dm*dm)/(p+m)/(p+m));
198           }
199         }
200         continue;
201       }
202       if(TString(h1->GetName()).Contains("hTRDTOFmatchChargeAsymm")) {
203         if(branchFound[kTRDTOFmatchEffPosAll] && branchFound[kTRDTOFmatchEffNegAll]) {
204           Double_t p=v[kTRDTOFmatchEffPosAll], m=v[kTRDTOFmatchEffNegAll], 
205                dp=v[kTRDTOFmatchEffPosAllErr], dm=v[kTRDTOFmatchEffNegAllErr];
206           if(TMath::Abs(p+m)>1.0e-6) {
207             h1->SetBinContent(irun+1, 100.0*2.0*(p-m)/(p+m));
208             h1->SetBinError(irun+1, 100.0*4.0*TMath::Sqrt(m*m*dp*dp+p*p*dm*dm)/(p+m)/(p+m));
209           }
210         }
211         continue;
212       }
213       
214       // Fill the rest of the histograms
215       Int_t var = h1->GetUniqueID()-1;
216       Int_t errY = h1->GetYaxis()->GetUniqueID()-1;
217       if(var>=0 && branchFound[var]) 
218         h1->SetBinContent(irun+1, v[var]);
219       if(errY>=0 && branchFound[errY]) h1->SetBinError(irun+1, v[errY]);
220       
221     }  // end if(TH1D)
222   }  // end loop over histograms
223 }
224
225
226 //________________________________________________________________________
227 void DefineHistograms(TList* outList, Int_t nRuns) {
228   //
229   // Define trending histograms
230   //
231   TH1D* hTPCTRDmatchPos=new TH1D("hTPCTRDmatchPos","TPC-TRD matching efficiency at pt=1GeV/c, positive tracks;run;matching efficiency",
232                                  nRuns, 0., nRuns);
233   hTPCTRDmatchPos->SetUniqueID(kTPCTRDmatchEffPosAll+1); hTPCTRDmatchPos->GetYaxis()->SetUniqueID(kTPCTRDmatchEffPosAllErr+1);
234   SetDrawStyle(hTPCTRDmatchPos); outList->Add(hTPCTRDmatchPos);
235   
236   TH1D* hTPCTRDmatchNeg=new TH1D("hTPCTRDmatchNeg","TPC-TRD matching efficiency at pt=1GeV/c, negative tracks;run;matching efficiency",
237                                  nRuns, 0., nRuns);
238   hTPCTRDmatchNeg->SetUniqueID(kTPCTRDmatchEffNegAll+1); hTPCTRDmatchNeg->GetYaxis()->SetUniqueID(kTPCTRDmatchEffNegAllErr+1);
239   SetDrawStyle(hTPCTRDmatchNeg); outList->Add(hTPCTRDmatchNeg);
240   
241   TH1D* hTPCTRDmatchChargeAsymm=new TH1D("hTPCTRDmatchChargeAsymm","TPC-TRD matching efficiency at pt=1GeV/c, charge asymmetry;run;percents",
242                                  nRuns, 0., nRuns);
243   SetDrawStyle(hTPCTRDmatchChargeAsymm); outList->Add(hTPCTRDmatchChargeAsymm);
244   
245   TH1D* hTRDTOFmatchPos=new TH1D("hTRDTOFmatchPos","TRD-TOF matching efficiency at pt=1GeV/c, positive tracks;run;matching efficiency",
246                                  nRuns, 0., nRuns);
247   hTRDTOFmatchPos->SetUniqueID(kTRDTOFmatchEffPosAll+1); hTRDTOFmatchPos->GetYaxis()->SetUniqueID(kTRDTOFmatchEffPosAllErr+1);
248   SetDrawStyle(hTRDTOFmatchPos); outList->Add(hTRDTOFmatchPos);
249   
250   TH1D* hTRDTOFmatchNeg=new TH1D("hTRDTOFmatchNeg","TRD-TOF matching efficiency at pt=1GeV/c, negative tracks;run;matching efficiency",
251                                  nRuns, 0., nRuns);
252   hTRDTOFmatchNeg->SetUniqueID(kTRDTOFmatchEffNegAll+1); hTRDTOFmatchNeg->GetYaxis()->SetUniqueID(kTRDTOFmatchEffNegAllErr+1);
253   SetDrawStyle(hTRDTOFmatchNeg); outList->Add(hTRDTOFmatchNeg);
254   
255   TH1D* hTRDTOFmatchChargeAsymm=new TH1D("hTRDTOFmatchChargeAsymm","TRD-TOF matching efficiency at pt=1GeV/c, charge asymmetry;run;percents",
256                                  nRuns, 0., nRuns);
257   SetDrawStyle(hTRDTOFmatchChargeAsymm); outList->Add(hTRDTOFmatchChargeAsymm);
258
259   TH1D* hTrkltsPerTrack=new TH1D("hTrkltsPerTrack","Average no. tracklets per TRD track at pt=1GeV/c;run;#tracklets",
260                                  nRuns, 0., nRuns);
261   hTrkltsPerTrack->SetUniqueID(kAvTRDtrkltsPerTrackAll+1); hTrkltsPerTrack->GetYaxis()->SetUniqueID(kAvTRDtrkltsPerTrackAllErr+1);
262   SetDrawStyle(hTrkltsPerTrack); outList->Add(hTrkltsPerTrack);
263   
264   TH1D* hClsPerTrack=new TH1D("hClsPerTrack","Average no. clusters per TRD track at pt=1GeV/c;run;#tracklets",
265                               nRuns, 0., nRuns);
266   SetDrawStyle(hClsPerTrack); outList->Add(hClsPerTrack);
267   hClsPerTrack->SetUniqueID(kAvNclsPerTrackAll+1); hClsPerTrack->GetYaxis()->SetUniqueID(kAvNclsPerTrackAllErr+1);
268   
269   TH1D* hPHplateauHeight=new TH1D("hPHplateauHeight","PH plateau height from slices;run;PH",
270                                   nRuns, 0., nRuns);
271   hPHplateauHeight->SetUniqueID(kPHplateauHeightAbsolute+1); hPHplateauHeight->GetYaxis()->SetUniqueID(kPHplateauHeightErrAbsolute+1);
272   SetDrawStyle(hPHplateauHeight); outList->Add(hPHplateauHeight);
273   
274   TH1D* hPHplateauSlope=new TH1D("hPHplateauSlope","PH plateau slope from slices;run;slope",
275                                   nRuns, 0., nRuns);
276   hPHplateauSlope->SetUniqueID(kPHplateauSlopeAbsolute+1); hPHplateauSlope->GetYaxis()->SetUniqueID(kPHplateauSlopeErrAbsolute+1);
277   SetDrawStyle(hPHplateauSlope); outList->Add(hPHplateauSlope);
278   
279   TH1D* hQtotLandauMPV=new TH1D("hQtotLandauMPV","Landau MPV for the tracklet charge distribution (Q_{tot}) ;run;Q_{tot}",
280                                   nRuns, 0., nRuns);
281   hQtotLandauMPV->SetUniqueID(kQtotLandauMPV1GeVAllAbsolute+1);
282   SetDrawStyle(hQtotLandauMPV); outList->Add(hQtotLandauMPV);
283   
284   TH1D* hQtotLandauWidth=new TH1D("hQtotLandauWidth","Landau width for the tracklet charge distribution (Q_{tot});run;Q_{tot}",
285                                   nRuns, 0., nRuns);
286   hQtotLandauWidth->SetUniqueID(kQtotLandauWidth1GeVAllAbsolute+1);
287   SetDrawStyle(hQtotLandauWidth); outList->Add(hQtotLandauWidth);
288   
289   TH1D* hNTracksPerEvent_DET=new TH1D("hNTracksPerEvent_DET", "Number of TRD tracks per event, (TRDcheckDET);run;#tracks",
290                                   nRuns, 0., nRuns);
291   hNTracksPerEvent_DET->SetUniqueID(kTRDcheckDET_NTracksEvent+1); hNTracksPerEvent_DET->GetYaxis()->SetUniqueID(kTRDcheckDET_NTracksEventRMS+1);
292   SetDrawStyle(hNTracksPerEvent_DET); outList->Add(hNTracksPerEvent_DET);
293   
294   TH1D* hNTracksPerSector_DET=new TH1D("hNTracksPerSector_DET", "Number of TRD tracks per sector (TRDcheckDET);run;#tracks",
295                                   nRuns, 0., nRuns);
296   hNTracksPerSector_DET->SetUniqueID(kTRDcheckDET_NTracksSector+1);
297   SetDrawStyle(hNTracksPerSector_DET); outList->Add(hNTracksPerSector_DET);
298   
299   TH1D* hNClustersPerTrack_DET=new TH1D("hNClustersPerTrack_DET", "Number of clusters per track (TRDcheckDET);run;#clusters",
300                                   nRuns, 0., nRuns);
301   hNClustersPerTrack_DET->SetUniqueID(kTRDcheckDET_NClustersTrack+1); hNClustersPerTrack_DET->GetYaxis()->SetUniqueID(kTRDcheckDET_NClustersTrackRMS+1);
302   SetDrawStyle(hNClustersPerTrack_DET); outList->Add(hNClustersPerTrack_DET);
303   
304   TH1D* hNClustersPerTracklet_DET=new TH1D("hNClustersPerTracklet_DET", "Number of clusters per tracklet (TRDcheckDET);run;#clusters",
305                                   nRuns, 0., nRuns);
306   hNClustersPerTracklet_DET->SetUniqueID(kTRDcheckDET_NClustersTracklet+1); hNClustersPerTracklet_DET->GetYaxis()->SetUniqueID(kTRDcheckDET_NClustersTrackletRMS+1);
307   SetDrawStyle(hNClustersPerTracklet_DET); outList->Add(hNClustersPerTracklet_DET);
308
309   TH1D* hNTrackletsPerTrack_DET=new TH1D("hNTrackletsPerTrack_DET", "Number of tracklets per track (TRDcheckDET);run;#tracklets",
310                                   nRuns, 0., nRuns);
311   hNTrackletsPerTrack_DET->SetUniqueID(kTRDcheckDET_NTrackletsTrack+1); hNTrackletsPerTrack_DET->GetYaxis()->SetUniqueID(kTRDcheckDET_NTrackletsTrackRMS+1);
312   SetDrawStyle(hNTrackletsPerTrack_DET); outList->Add(hNTrackletsPerTrack_DET);
313   
314   TH1D* hClusterCharge_DET=new TH1D("hClusterCharge_DET", "Cluster charge (TRDcheckDET);run;#charge",
315                                   nRuns, 0., nRuns);
316   hClusterCharge_DET->SetUniqueID(kTRDcheckDET_ChargeCluster+1); hClusterCharge_DET->GetYaxis()->SetUniqueID(kTRDcheckDET_ChargeClusterRMS+1);
317   SetDrawStyle(hClusterCharge_DET); outList->Add(hClusterCharge_DET);
318   
319   TH1D* hTrackletCharge_DET=new TH1D("hTrackletCharge_DET", "Tracklet charge (TRDcheckDET);run;#charge",
320                                   nRuns, 0., nRuns);
321   hTrackletCharge_DET->SetUniqueID(kTRDcheckDET_ChargeTracklet+1); hTrackletCharge_DET->GetYaxis()->SetUniqueID(kTRDcheckDET_ChargeTrackletRMS+1);
322   SetDrawStyle(hTrackletCharge_DET); outList->Add(hTrackletCharge_DET);
323   
324   TH1D* hPHplateau_DET=new TH1D("hPHplateau_DET", "PH plateau (TRDcheckDET);run;#charge",
325                                   nRuns, 0., nRuns);
326   hPHplateau_DET->SetUniqueID(kTRDcheckDET_PHplateau+1);
327   SetDrawStyle(hPHplateau_DET); outList->Add(hPHplateau_DET);
328   
329   TH1D* hPHslope_DET=new TH1D("hPHslope_DET", "PH slope (TRDcheckDET);run;#charge/timebin",
330                                   nRuns, 0., nRuns);
331   hPHslope_DET->SetUniqueID(kTRDcheckDET_PHslope+1);
332   SetDrawStyle(hPHslope_DET); outList->Add(hPHslope_DET);
333   
334   TH1D* hPHamplifPeak_DET=new TH1D("hPHamplifPeak_DET", "PH amplification peak position (TRDcheckDET);run;#timebin",
335                                   nRuns, 0., nRuns);
336   hPHamplifPeak_DET->SetUniqueID(kTRDcheckDET_PHamplificationPeak+1);
337   SetDrawStyle(hPHamplifPeak_DET); outList->Add(hPHamplifPeak_DET);
338   
339   TH1D* hMeanExB=new TH1D("hMeanExB", "Mean ExB over all chambers from OCDB;run;ExB correction",
340                                   nRuns, 0., nRuns);
341   hMeanExB->SetUniqueID(kMeanExB+1); hMeanExB->GetYaxis()->SetUniqueID(kRmsExB+1);
342   SetDrawStyle(hMeanExB); outList->Add(hMeanExB);
343   
344   TH1D* hMeanGainFactor=new TH1D("hMeanGainFactor", "Mean gain factor over all chambers from OCDB;run;gain factor",
345                                   nRuns, 0., nRuns);
346   hMeanGainFactor->SetUniqueID(kMeanGainFactor+1); hMeanGainFactor->GetYaxis()->SetUniqueID(kRmsGainFactor+1);
347   SetDrawStyle(hMeanGainFactor); outList->Add(hMeanGainFactor);
348   
349   TH1D* hMeanT0=new TH1D("hMeanT0", "Mean T0 over all chambers from OCDB;run;T0",
350                                   nRuns, 0., nRuns);
351   hMeanT0->SetUniqueID(kMeanT0+1); hMeanT0->GetYaxis()->SetUniqueID(kRmsT0+1);
352   SetDrawStyle(hMeanT0); outList->Add(hMeanT0);
353   
354   TH1D* hMeanVdrift=new TH1D("hMeanVdrift", "Mean drift velocity over all chambers from OCDB;run;drift velocity",
355                                   nRuns, 0., nRuns);
356   hMeanVdrift->SetUniqueID(kMeanVdrift+1); hMeanVdrift->GetYaxis()->SetUniqueID(kRmsVdrift+1);
357   SetDrawStyle(hMeanVdrift); outList->Add(hMeanVdrift);
358   
359   TH1D* hBeamIntensityA=new TH1D("hBeamIntensityA", "Beam A intensity from OCDB;run;beam intensity",
360                                   nRuns, 0., nRuns);
361   hBeamIntensityA->SetUniqueID(kBeamIntensityA+1);
362   SetDrawStyle(hBeamIntensityA); outList->Add(hBeamIntensityA);
363   
364   TH1D* hBeamIntensityC=new TH1D("hBeamIntensityC", "Beam C intensity from OCDB;run;beam intensity",
365                                   nRuns, 0., nRuns);
366   hBeamIntensityC->SetUniqueID(kBeamIntensityC+1);
367   SetDrawStyle(hBeamIntensityC); outList->Add(hBeamIntensityC);
368 }
369
370
371 //________________________________________________________________________
372 void SetDrawStyle(TObject* obj, 
373                   TString drawOption /*="E1"*/,
374                   Int_t markerStyle /*=24*/, Int_t markerColor /*=4*/, Double_t markerSize /*=2.0*/,
375                   Int_t lineStyle /*=1*/, Int_t lineColor /*=4*/, Double_t lineWidth /*=2.0*/) {
376   //
377   // Set draw options
378   //
379   if(TString(obj->IsA()->GetName()).Contains("TH1D")) {
380     TH1D* o=(TH1D*)obj;
381     o->SetDrawOption(drawOption.Data());
382     o->SetMarkerStyle(markerStyle);
383     o->SetMarkerColor(markerColor);
384     o->SetMarkerSize(markerSize);
385     o->SetLineStyle(lineStyle);
386     o->SetLineColor(lineColor);
387     o->SetLineWidth(lineWidth);
388     o->GetXaxis()->SetTitleOffset(1.6);
389     o->GetYaxis()->SetNdivisions(507);
390     o->GetXaxis()->SetLabelFont(42);
391     o->GetXaxis()->SetTitleFont(42);
392     o->GetYaxis()->SetLabelFont(42);
393     o->GetYaxis()->SetTitleFont(42);
394     o->SetTitleFont(42);
395   }
396 }