TENDER becomes Tender
[u/mrichter/AliRoot.git] / PWGPP / ZDC / macros / DrawPerformanceZDCQAMatch.C
CommitLineData
343d2002 1#if !defined(__CINT__) || defined(__MAKECINT__)
2#include <stdio.h>
3#include <stdlib.h>
4#include <TROOT.h>
5#include <Riostream.h>
6#include <TClassTable.h>
7#include <TStyle.h>
8#include <TMath.h>
9#include <TFile.h>
10#include <TCanvas.h>
11#include <TH1.h>
12#include <TH2.h>
13#include <TProfile.h>
14#include <TLine.h>
15#include <TGrid.h>
16#include <TBits.h>
17#include <TChain.h>
18#include <TNtuple.h>
19#include <TTree.h>
20#include <TBranch.h>
21#include <TFileMerger.h>
22#include <TGridResult.h>
23#include <TSystem.h>
24#include <TGaxis.h>
25#include <TRandom.h>
26#include <TLegend.h>
27#endif
28
29Int_t DrawPerformanceZDCQAMatch(const char* inFile){
30
31// Draw control histograms and generate output pictures
32
33gSystem->Load("libSTAT");
34gSystem->Load("libANALYSIS");
35gSystem->Load("libANALYSISalice");
36gSystem->Load("libANALYSIScalib");
37gSystem->Load("libCORRFW");
38gSystem->Load("libANALYSISalice.so");
39gSystem->Load("libANALYSIScalib.so");
af472fff 40gSystem->Load("libTender.so");
343d2002 41gSystem->Load("libPWGPP.so");
42
43gROOT->Reset();
44gROOT->SetStyle("Plain");
45gStyle->SetPalette(1);
46gStyle->SetOptStat(0);
47gStyle->SetTitleSize(0.025);
48TH1::AddDirectory(kFALSE);
49
50TFile * fin = TFile::Open(inFile);
51TTree * ttree = (TTree*) fin->Get("trending"); //in
52TTree * tree = new TTree("tree","tree"); //out (to be summed)
53
54if (!ttree){
55 Printf("Invalid trending tree.");
56 return 2;
57}
58
59Int_t nRuns=ttree->GetEntries();
60TList list;
61
62/*set graphic style*/
63gStyle->SetCanvasColor(kWhite);
64gStyle->SetFrameFillColor(kWhite);
65gStyle->SetFrameBorderMode(0);
66gStyle->SetCanvasBorderMode(0);
67gStyle->SetTitleFillColor(kWhite);
68gStyle->SetTitleBorderSize(0);
69gStyle->SetTitleFont(42);
70gStyle->SetTitleX(0.5);
71gStyle->SetTitleAlign(23);
72gStyle->SetTextFont(42);
73gStyle->SetStatColor(kWhite);
74gStyle->SetStatBorderSize(1);
75gStyle->SetOptStat(0);
76gStyle->SetTickLength(0.02,"y");
77gStyle->SetLabelSize(0.02,"xyz");
78gStyle->SetLabelOffset(0.03,"xyz");
79
80char outfilename[200]= "trending.root";
81TString plotDir(".");
82
83legend = new TLegend(0.9,0.1,1.0,0.9);
84legend->SetFillColor(kWhite);
85
86Int_t runNumber=0;
87Double_t ZNC_mean=0;
88Double_t ZNA_mean=0;
89Double_t ZPA_mean=0;
90Double_t ZPC_mean=0;
91Double_t ZEM1_mean=0;
92Double_t ZEM2_mean=0;
93Double_t ZNC_XCent=0;
94Double_t ZNC_YCent=0;
95Double_t ZNA_XCent=0;
96Double_t ZNA_YCent=0;
97Double_t ZNC_XCent_err=0;
98Double_t ZNC_YCent_err=0;
99Double_t ZNA_XCent_err=0;
100Double_t ZNA_YCent_err=0;
101Double_t ZN_TDC_Sum=0;
102Double_t ZN_TDC_Diff=0;
103Double_t ZN_TDC_Sum_err=0;
104Double_t ZN_TDC_Diff_err=0;
105
106TH1D *hZNCpmcSpectrum = new TH1D("hZNCpmcSpectrum","hZNCpmcSpectrum",200.,0.,2000.);
107TH1D *hZNApmcSpectrum = new TH1D("hZNApmcSpectrum","hZNApmcSpectrum",200.,0.,2000.);
108TH1D *hZPCpmcSpectrum = new TH1D("hZPCpmcSpectrum","hZPCpmcSpectrum",200.,0.,2000.);
109TH1D *hZPApmcSpectrum = new TH1D("hZPApmcSpectrum","hZPApmcSpectrum",200.,0.,2000.);
110TH1D *hZEM1Spectrum = new TH1D("hZEM1Spectrum","hZEM1Spectrum",200.,0.,2000.);
111TH1D *hZEM2Spectrum = new TH1D("hZEM2Spectrum","hZEM2Spectrum",200.,0.,2000.);
112
113ttree->SetBranchAddress("run",&runNumber);
114ttree->SetBranchAddress("ZNC_mean_value",&ZNC_mean);
115ttree->SetBranchAddress("ZNA_mean_value",&ZNA_mean);
116ttree->SetBranchAddress("ZPC_mean_value",&ZPC_mean);
117ttree->SetBranchAddress("ZPA_mean_value",&ZPA_mean);
118ttree->SetBranchAddress("ZEM1_mean_value",&ZEM1_mean);
119ttree->SetBranchAddress("ZEM2_mean_value",&ZEM2_mean);
120ttree->SetBranchAddress("ZNC_X_Centroid",&ZNC_XCent);
121ttree->SetBranchAddress("ZNC_Y_Centroid",&ZNC_YCent);
122ttree->SetBranchAddress("ZNA_X_Centroid",&ZNA_XCent);
123ttree->SetBranchAddress("ZNA_Y_Centroid",&ZNA_YCent);
124ttree->SetBranchAddress("ZNC_X_Centroid_Err",&ZNC_XCent_err);
125ttree->SetBranchAddress("ZNC_Y_Centroid_Err",&ZNC_YCent_err);
126ttree->SetBranchAddress("ZNA_X_Centroid_Err",&ZNA_XCent_err);
127ttree->SetBranchAddress("ZNA_Y_Centroid_Err",&ZNA_YCent_err);
128ttree->SetBranchAddress("ZN_TDC_Sum",&ZN_TDC_Sum);
129ttree->SetBranchAddress("ZN_TDC_Diff",&ZN_TDC_Diff);
130ttree->SetBranchAddress("ZN_TDC_Sum_Err",&ZN_TDC_Sum_err);
131ttree->SetBranchAddress("ZN_TDC_Diff_Err",&ZN_TDC_Diff_err);
132
133TH1D *hznc = new TH1D("hznc","ZNC TC mean signal",3,-1,1);
134hznc->GetXaxis()->SetRangeUser(-1.,1.);
135hznc->SetDrawOption("EP");
136hznc->SetMarkerStyle(20);
137hznc->SetMarkerColor(kRed);
138hznc->SetLineColor(kRed);
139
140TH1D *hzna = new TH1D("hzna","ZNA TC mean signal",3,-1,1);
141hzna->GetXaxis()->SetRangeUser(-1.,1.);
142hzna->SetDrawOption("EP");
143hzna->SetMarkerStyle(20);
144hzna->SetMarkerColor(kRed);
145hzna->SetLineColor(kRed);
146
147TH1D *hzpc = new TH1D("hzpc","ZPC TC mean signal",3,-1,1);
148hzpc->GetXaxis()->SetRangeUser(-1.,1.);
149hzpc->SetDrawOption("EP");
150hzpc->SetMarkerStyle(20);
151hzpc->SetMarkerColor(kRed);
152hzpc->SetLineColor(kRed);
153
154TH1D *hzpa = new TH1D("hzpa","ZPA TC mean signal",3,-1,1);
155hzpa->GetXaxis()->SetRangeUser(-1.,1.);
156hzpa->SetDrawOption("EP");
157hzpa->SetMarkerStyle(20);
158hzpa->SetMarkerColor(kRed);
159hzpa->SetLineColor(kRed);
160
161TH1D *hzem1 = new TH1D("hzem1","ZEM1 mean signal",3,-1,1);
162hzem1->GetXaxis()->SetRangeUser(-1.,1.);
163hzem1->SetDrawOption("EP");
164hzem1->SetMarkerStyle(20);
165hzem1->SetMarkerColor(kRed);
166hzem1->SetLineColor(kRed);
167
168TH1D *hzem2 = new TH1D("hzem2","ZEM2 mean signal",3,-1,1);
169hzem2->GetXaxis()->SetRangeUser(-1.,1.);
170hzem2->SetDrawOption("EP");
171hzem2->SetMarkerStyle(20);
172hzem2->SetMarkerColor(kRed);
173hzem2->SetLineColor(kRed);
174
175TH1D *hzna_Xcentroid = new TH1D("hzna_Xcentroid","ZNA X centroid",3,-1,1);
176hzna_Xcentroid->GetXaxis()->SetRangeUser(-1.,1.);
177hzna_Xcentroid->SetDrawOption("EP");
178hzna_Xcentroid->SetMarkerStyle(20);
179hzna_Xcentroid->SetMarkerColor(kRed);
180hzna_Xcentroid->SetLineColor(kRed);
181
182TH1D *hzna_Ycentroid = new TH1D("hzna_Ycentroid","ZNA Y centroid",3,-1,1);
183hzna_Ycentroid->GetXaxis()->SetRangeUser(-1.,1.);
184hzna_Ycentroid->SetDrawOption("EP");
185hzna_Ycentroid->SetMarkerStyle(20);
186hzna_Ycentroid->SetMarkerColor(kRed);
187hzna_Ycentroid->SetLineColor(kRed);
188
189TH1D *hznc_Xcentroid = new TH1D("hznc_Xcentroid","ZNC X centroid",3,-1,1);
190hznc_Xcentroid->GetXaxis()->SetRangeUser(-1.,1.);
191hznc_Xcentroid->SetDrawOption("EP");
192hznc_Xcentroid->SetMarkerStyle(20);
193hznc_Xcentroid->SetMarkerColor(kRed);
194hznc_Xcentroid->SetLineColor(kRed);
195
196TH1D *hznc_Ycentroid = new TH1D("hznc_Ycentroid","ZNC Y centroid",3,-1,1);
197hznc_Ycentroid->GetXaxis()->SetRangeUser(-1.,1.);
198hznc_Ycentroid->SetDrawOption("EP");
199hznc_Ycentroid->SetMarkerStyle(20);
200hznc_Ycentroid->SetMarkerColor(kRed);
201hznc_Ycentroid->SetLineColor(kRed);
202
203TH1D *hzn_TDC_Sum = new TH1D("hzn_TDC_Sum","ZNC TDC + ZNA TDC",3,-1,1);
204hzn_TDC_Sum->GetXaxis()->SetRangeUser(-1.,1.);
205hzn_TDC_Sum->SetDrawOption("EP");
206hzn_TDC_Sum->SetMarkerStyle(20);
207hzn_TDC_Sum->SetMarkerColor(kRed);
208hzn_TDC_Sum->SetLineColor(kRed);
209
210TH1D *hzn_TDC_Diff = new TH1D("hzn_TDC_Diff","ZNC TDC - ZNA TDC",3,-1,1);
211hzn_TDC_Diff->GetXaxis()->SetRangeUser(-1.,1.);
212hzn_TDC_Diff->SetDrawOption("EP");
213hzn_TDC_Diff->SetMarkerStyle(20);
214hzn_TDC_Diff->SetMarkerColor(kRed);
215hzn_TDC_Diff->SetLineColor(kRed);
216
217char runlabel[10];
218
219for (Int_t irun=0;irun<nRuns;irun++){
220 ttree->GetEntry(irun);
221 }
222
223sprintf(runlabel,"%i",runNumber);
224
225//----------------------------------------------------------------------
226//spectrum vs run
227//----------------------------------------------------------------------
228
229hZNCpmcSpectrum = dynamic_cast<TH1D*> (fin->Get("fhZNCpmc"));
230hZNCpmcSpectrum->GetXaxis()->SetRangeUser(0.,2000);
231hZNCpmcSpectrum->Scale(1./hZNCpmcSpectrum->GetEntries());
232hZNCpmcSpectrum->SetLineColor(kRed);
233hZNCpmcSpectrum->SetLineWidth(2);
234hZNCpmcSpectrum->SetTitle("ZNC spectrum");
235hZNCpmcSpectrum->SetXTitle("ZNC signal (ADC ch.)");
236
237hZNApmcSpectrum = dynamic_cast<TH1D*> (fin->Get("fhZNApmc"));
238hZNApmcSpectrum->GetXaxis()->SetRangeUser(0.,2000);
239hZNApmcSpectrum->Scale(1./hZNApmcSpectrum->GetEntries());
240hZNApmcSpectrum->SetLineColor(kRed);
241hZNApmcSpectrum->SetLineWidth(2);
242hZNApmcSpectrum->SetTitle("ZNA spectrum");
243hZNApmcSpectrum->SetXTitle("ZNA signal (ADC ch.)");
244
245hZPCpmcSpectrum = dynamic_cast<TH1D*> (fin->Get("fhZPCpmc"));
246hZPCpmcSpectrum->GetXaxis()->SetRangeUser(0.,2000);
247hZPCpmcSpectrum->Scale(1./hZPCpmcSpectrum->GetEntries());
248hZPCpmcSpectrum->SetLineColor(kRed);
249hZPCpmcSpectrum->SetLineWidth(2);
250hZPCpmcSpectrum->SetTitle("ZPC spectrum");
251hZPCpmcSpectrum->SetXTitle("ZPC signal (ADC ch.)");
252
253hZPApmcSpectrum = dynamic_cast<TH1D*> (fin->Get("fhZPApmc"));
254hZPApmcSpectrum->GetXaxis()->SetRangeUser(0.,2000);
255hZPApmcSpectrum->Scale(1./hZPApmcSpectrum->GetEntries());
256hZPApmcSpectrum->SetLineColor(kRed);
257hZPApmcSpectrum->SetLineWidth(2);
258hZPApmcSpectrum->SetTitle("ZPA spectrum");
259hZPApmcSpectrum->SetXTitle("ZPA signal (ADC ch.)");
260
261hZEM1Spectrum = dynamic_cast<TH1D*> (fin->Get("fhZEM1Spectrum"));
262hZEM1Spectrum->GetXaxis()->SetRangeUser(0.,2000);
263hZEM1Spectrum->Scale(1./hZEM1Spectrum->GetEntries());
264hZEM1Spectrum->SetLineColor(kRed);
265hZEM1Spectrum->SetLineWidth(2);
266hZEM1Spectrum->SetTitle("ZEM1 spectrum");
267hZEM1Spectrum->SetXTitle("ZEM1 signal (ADC ch.)");
268
269hZEM2Spectrum = dynamic_cast<TH1D*> (fin->Get("fhZEM2Spectrum"));
270hZEM2Spectrum->GetXaxis()->SetRangeUser(0.,2000);
271hZEM2Spectrum->Scale(1./hZEM2Spectrum->GetEntries());
272hZEM2Spectrum->SetLineColor(kRed);
273hZEM2Spectrum->SetLineWidth(2);
274hZEM2Spectrum->SetTitle("ZEM2 spectrum");
275hZEM2Spectrum->SetXTitle("ZEM2 signal (ADC ch.)");
276
277//----------------------------------------------------------------------
278//variables vs run
279//----------------------------------------------------------------------
280hzna->SetBinContent(2,ZNA_mean);
281hzna->GetXaxis()->SetBinLabel(2,runlabel);
282hzna->GetXaxis()->SetLabelSize(0.05);
283
284hzpc->SetBinContent(2,ZPC_mean);
285hzpc->GetXaxis()->SetBinLabel(2,runlabel);
286hzpc->GetXaxis()->SetLabelSize(0.05);
287
288hzpa->SetBinContent(2,ZPA_mean);
289hzpa->GetXaxis()->SetBinLabel(2,runlabel);
290hzpa->GetXaxis()->SetLabelSize(0.05);
291
292hzem1->SetBinContent(2,ZEM1_mean);
293hzem1->GetXaxis()->SetBinLabel(2,runlabel);
294hzem1->GetXaxis()->SetLabelSize(0.05);
295
296hzem2->SetBinContent(2,ZEM2_mean);
297hzem2->GetXaxis()->SetBinLabel(2,runlabel);
298hzem2->GetXaxis()->SetLabelSize(0.05);
299
300hzna_Xcentroid->SetBinContent(2,ZNA_XCent);
301hzna_Xcentroid->SetBinError(2,ZNA_XCent_err);
302hzna_Xcentroid->GetXaxis()->SetBinLabel(2,runlabel);
303hzna_Xcentroid->GetXaxis()->SetLabelSize(0.05);
304hzna_Xcentroid->GetYaxis()->SetTitle("(cm)");
305
306hzna_Ycentroid->SetBinContent(2,ZNA_YCent);
307hzna_Ycentroid->SetBinError(2,ZNA_YCent_err);
308hzna_Ycentroid->GetXaxis()->SetBinLabel(2,runlabel);
309hzna_Ycentroid->GetXaxis()->SetLabelSize(0.05);
310hzna_Ycentroid->GetYaxis()->SetTitle("(cm)");
311
312hznc_Xcentroid->SetBinContent(2,ZNC_XCent);
313hznc_Xcentroid->SetBinError(2,ZNC_XCent_err);
314hznc_Xcentroid->GetXaxis()->SetBinLabel(2,runlabel);
315hznc_Xcentroid->GetXaxis()->SetLabelSize(0.05);
316hznc_Xcentroid->GetYaxis()->SetTitle("(cm)");
317
318hznc_Ycentroid->SetBinContent(2,ZNC_YCent);
319hznc_Ycentroid->SetBinError(2,ZNC_YCent_err);
320hznc_Ycentroid->GetXaxis()->SetBinLabel(2,runlabel);
321hznc_Ycentroid->GetXaxis()->SetLabelSize(0.05);
322hznc_Ycentroid->GetYaxis()->SetTitle("(cm)");
323
324hzn_TDC_Sum->SetBinContent(2,ZN_TDC_Sum);
325hzn_TDC_Sum->SetBinError(2,ZN_TDC_Sum_err);
326hzn_TDC_Sum->GetXaxis()->SetBinLabel(2,runlabel);
327hzn_TDC_Sum->GetXaxis()->SetLabelSize(0.05);
328hzn_TDC_Sum->GetYaxis()->SetTitle("(ns)");
329
330hzn_TDC_Diff->SetBinContent(2,ZN_TDC_Diff);
331hzn_TDC_Diff->SetBinError(2,ZN_TDC_Diff_err);
332hzn_TDC_Diff->GetXaxis()->SetBinLabel(2,runlabel);
333hzn_TDC_Diff->GetXaxis()->SetLabelSize(0.05);
334hzn_TDC_Diff->GetYaxis()->SetTitle("(ns)");
335
336//----------------------------------------------------------------------
337//spectra
338//----------------------------------------------------------------------
339
340TCanvas* cZNC_Spectra = new TCanvas("cZNC_Spectra","cZNC_Spectra",50,50,1200,900); gPad->SetLogy();
341hZNCpmcSpectrum->Draw();
342cZNC_Spectra->Print(Form("%s/cZNC_Spectra.png",plotDir.Data()));
343
344TCanvas* cZNA_Spectra = new TCanvas("cZNA_Spectra","cZNA_Spectra",50,50,1200,900); gPad->SetLogy();
345hZNApmcSpectrum->Draw();
346cZNA_Spectra->Print(Form("%s/cZNA_Spectra.png",plotDir.Data()));
347
348TCanvas* cZPC_Spectra = new TCanvas("cZPC_Spectra","cZPC_Spectra",50,50,1200,900); gPad->SetLogy();
349hZPCpmcSpectrum->Draw();
350cZPC_Spectra->Print(Form("%s/cZPC_Spectra.png",plotDir.Data()));
351
352TCanvas* cZPA_Spectra = new TCanvas("cZPA_Spectra","cZPA_Spectra",50,50,1200,900); gPad->SetLogy();
353hZPApmcSpectrum->Draw();
354cZPA_Spectra->Print(Form("%s/cZPA_Spectra.png",plotDir.Data()));
355
356TCanvas* cZEM1_Spectra = new TCanvas("cZEM1_Spectra","cZEM1_Spectra",50,50,1200,900); gPad->SetLogy();
357hZEM1Spectrum->Draw();
358cZEM1_Spectra->Print(Form("%s/cZEM1_Spectra.png",plotDir.Data()));
359
360TCanvas* cZEM2_Spectra = new TCanvas("cZEM2_Spectra","cZEM2_Spectra",50,50,1200,900); gPad->SetLogy();
361hZEM2Spectrum->Draw();
362cZEM2_Spectra->Print(Form("%s/cZEM2_Spectra.png",plotDir.Data()));
363
364
365//---------------------------------------------------------------------------------------------------
366//variables
367//---------------------------------------------------------------------------------------------------
368
369//---------------------------------------------------------------------------------------------------
370//means
371//---------------------------------------------------------------------------------------------------
372TCanvas* cZNC_Mean_Values = new TCanvas("cZNC_Mean_Values","cZNC_Mean_Values", 50,50,750,550);
373hznc->Draw("ep");
374hznc->SetBinContent(2,ZNC_mean);
375hznc->GetXaxis()->SetBinLabel(2,runlabel);
376hznc->GetXaxis()->SetLabelSize(0.05);
377cZNC_Mean_Values->Print(Form("%s/cZNC_Mean_Values.png",plotDir.Data()));
378
379TCanvas* cZNA_Mean_Values = new TCanvas("cZNA_Mean_Values","cZNA_Mean_Values", 50,50,750,550);
380hzna->Draw("ep");
381cZNA_Mean_Values->Print(Form("%s/cZNA_Mean_Values.png",plotDir.Data()));
382
383TCanvas* cZPC_Mean_Values = new TCanvas("cZPC_Mean_Values","cZPC_Mean_Values", 50,50,750,550);
384hzpc->Draw("ep");
385cZPC_Mean_Values->Print(Form("%s/cZPC_Mean_Values.png",plotDir.Data()));
386
387TCanvas* cZPA_Mean_Values = new TCanvas("cZPA_Mean_Values","cZPA_Mean_Values", 50,50,750,550);
388hzpa->Draw("ep");
389cZPA_Mean_Values->Print(Form("%s/cZPA_Mean_Values.png",plotDir.Data()));
390
391TCanvas* cZEM1_Mean_Values = new TCanvas("cZEM1_Mean_Values","cZEM1_Mean_Values", 50,50,750,550);
392hzem1->Draw("ep");
393cZEM1_Mean_Values->Print(Form("%s/cZEM1_Mean_Values.png",plotDir.Data()));
394
395TCanvas* cZEM2_Mean_Values = new TCanvas("cZEM2_Mean_Values","cZEM2_Mean_Values", 50,50,750,550);
396hzem2->Draw("ep");
397cZEM2_Mean_Values->Print(Form("%s/cZEM2_Mean_Values.png",plotDir.Data()));
398
399//---------------------------------------------------------------------------------------------------
400//centroids
401//---------------------------------------------------------------------------------------------------
402TCanvas* cZNA_X_centroid = new TCanvas("cZNA_X_centroid","cZNA_X_centroid", 50,50,750,550);
403hzna_Xcentroid->Draw();
404cZNA_X_centroid->Print(Form("%s/cZNA_X_centroid.png",plotDir.Data()));
405
406TCanvas* cZNA_Y_centroid = new TCanvas("cZNA_Y_centroid","cZNA_Y_centroid", 50,50,750,550);
407hzna_Ycentroid->Draw();
408cZNA_Y_centroid->Print(Form("%s/cZNA_Y_centroid.png",plotDir.Data()));
409
410TCanvas* cZNC_X_centroid = new TCanvas("cZNC_X_centroid","cZNC_X_centroid", 50,50,750,550);
411hznc_Xcentroid->Draw();
412cZNC_X_centroid->Print(Form("%s/cZNC_X_centroid.png",plotDir.Data()));
413
414TCanvas* cZNC_Y_centroid = new TCanvas("cZNC_Y_centroid","cZNC_Y_centroid", 50,50,750,550);
415hznc_Ycentroid->Draw();
416cZNC_Y_centroid->Print(Form("%s/cZNC_Y_centroid.png",plotDir.Data()));
417
418//---------------------------------------------------------------------------------
419//timing
420//---------------------------------------------------------------------------------
421TCanvas* cTimingSum = new TCanvas("cTimingSum","cTimingSum",50,50,750,550);
422hzn_TDC_Sum->Draw();
423cTimingSum->Print(Form("%s/cTimingSum.png",plotDir.Data()));
424
425TCanvas* cTimingDiff = new TCanvas("cTimingDiff","cTimingDiff",50,50,750,550);
426hzn_TDC_Diff->Draw();
427cTimingDiff->Print(Form("%s/cTimingDiff.png",plotDir.Data()));
428
429//----------------------------------------------------------------------
430//out
431//----------------------------------------------------------------------
432tree->Branch("run",&runNumber,"runNumber/I");
433tree->Branch("ZNC_mean_value",&ZNC_mean,"ZNC_mean/D");
434tree->Branch("ZNA_mean_value",&ZNA_mean,"ZNA_mean/D");
435tree->Branch("ZPC_mean_value",&ZPC_mean,"ZPC_mean/D");
436tree->Branch("ZPA_mean_value",&ZPA_mean,"ZPA_mean/D");
437tree->Branch("ZEM1_mean_value",&ZEM1_mean,"ZEM1_mean/D");
438tree->Branch("ZEM2_mean_value",&ZEM2_mean,"ZEM2_mean/D");
439tree->Branch("ZNC_X_Centroid",&ZNC_XCent,"ZNC_XCent/D");
440tree->Branch("ZNC_Y_Centroid",&ZNC_YCent,"ZNC_YCent/D");
441tree->Branch("ZNA_X_Centroid",&ZNA_XCent,"ZNA_XCent/D");
442tree->Branch("ZNA_Y_Centroid",&ZNA_YCent,"ZNA_YCent/D");
443tree->Branch("ZNC_X_Centroid_Err",&ZNC_XCent_err,"ZNC_XCent_err/D");
444tree->Branch("ZNC_Y_Centroid_Err",&ZNC_YCent_err,"ZNC_YCent_err/D");
445tree->Branch("ZNA_X_Centroid_Err",&ZNA_XCent_err,"ZNA_XCent_err/D");
446tree->Branch("ZNA_Y_Centroid_Err",&ZNA_YCent_err,"ZNA_YCent_err/D");
447tree->Branch("ZN_TDC_Sum",&ZN_TDC_Sum,"ZN_TDC_Sum/D");
448tree->Branch("ZN_TDC_Diff",&ZN_TDC_Diff,"ZN_TDC_Diff/D");
449tree->Branch("ZN_TDC_Sum_Err",&ZN_TDC_Sum_err,"ZN_TDC_Sum_err/D");
450tree->Branch("ZN_TDC_Diff_Err",&ZN_TDC_Diff_err,"ZN_TDC_Diff_err/D");
451tree->Fill();
452
453list.Add(cZNC_Spectra);
454list.Add(cZNA_Spectra);
455list.Add(cZPC_Spectra);
456list.Add(cZPA_Spectra);
457list.Add(cZEM1_Spectra);
458list.Add(cZEM2_Spectra);
459list.Add(hznc);
460list.Add(hzna);
461list.Add(hzpc);
462list.Add(hzpa);
463list.Add(hzem1);
464list.Add(hzem2);
465list.Add(hzna_Xcentroid);
466list.Add(hzna_Ycentroid);
467list.Add(hznc_Xcentroid);
468list.Add(hznc_Ycentroid);
469list.Add(hzn_TDC_Sum);
470list.Add(hzn_TDC_Diff);
471
472TFile * fout=new TFile(outfilename,"recreate");
473fout->cd();
474list.Write();
475tree.Write();
476fout->Close();
477
478return 0;
479
480}