Modifications in CMake* files to export all required headers.
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDPIDEfficiencyV0AnalysisTask.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 //==============================================================================
17 // AliHMPIDPIDEfficiencyV0AnalysysTask - Class representing a analysis tool to evaluate the PID efficiency for the HMPID detector using the V0's 
18 // 
19 //
20 // HMPID PID Efficiency using the V0
21 //
22 // Francesco Barile
23 //
24 //==============================================================================
25 //
26 // By means of AliHMPIDAnalysisTask.C macro it is possible to use this class
27 // to perform the analysis on local data, on data on alien using local machine
28 // and on CAF.
29
30 #ifndef AliHMPIDPIDEfficiencyV0AnalysisTASK_CXX
31 #define AliHMPIDPIDEfficiencyV0AnalysisTASK_CXX
32
33
34 #include "TH1.h"
35 #include "TH2.h"
36 #include "TFile.h"
37 #include "TCanvas.h"
38 #include "TGraphErrors.h"
39 #include "AliAnalysisManager.h"
40 #include "AliESDInputHandler.h"
41 #include "AliMCEventHandler.h"
42 #include "AliMCEvent.h"
43 #include "AliMCEvent.h"
44
45 #include "AliESDtrackCuts.h"
46
47 #include "AliESDv0.h"
48 #include "AliESDv0Cuts.h"
49
50 #include "AliPID.h"
51 #include "AliLog.h"
52 #include "AliHMPIDPIDEfficiencyV0AnalysisTask.h"
53
54 ClassImp(AliHMPIDPIDEfficiencyV0AnalysisTask)
55
56 //__________________________________________________________________________
57 AliHMPIDPIDEfficiencyV0AnalysisTask::AliHMPIDPIDEfficiencyV0AnalysisTask() :
58   fESD(0x0),fMC(0x0),fUseMC(kTRUE),
59   fHmpHistList(0x0),
60   fHmpNevents(0x0),
61   fThetavsMom(0x0),
62   fmass(0x0),
63   fpdg(0x0),
64   farme(0x0),
65   farmeb(0x0),
66   hangle(0x0),
67   massap(0x0),
68   massan(0x0),
69   fmassaHMPID(0x0),
70   hdiff(0x0),
71   hdiffn(0x0),
72   fTree(0x0)
73 {
74   //
75   //Default ctor
76   //
77   for (Int_t i=0; i<90; i++) fVar[i]=0;
78 }
79
80 //___________________________________________________________________________
81 AliHMPIDPIDEfficiencyV0AnalysisTask::AliHMPIDPIDEfficiencyV0AnalysisTask(const Char_t* name) :
82   AliAnalysisTaskSE(name),
83   fESD(0x0), fMC(0x0), fUseMC(kTRUE),
84   fHmpHistList(0x0),
85   fHmpNevents(0x0),
86   fThetavsMom(0x0),
87   fmass(0x0),
88   fpdg(0x0),
89   farme(0x0),
90   farmeb(0x0),
91   hangle(0x0),
92   massap(0x0),
93   massan(0x0),
94   fmassaHMPID(0x0),
95   hdiff(0x0),
96   hdiffn(0x0),  
97   fTree(0x0)
98   {
99   //
100   // Constructor. Initialization of Inputs and Outputs
101   //
102   for (Int_t i=0; i<90; i++) fVar[i]=0;
103   DefineOutput(1,TList::Class());
104   DefineOutput(2,TTree::Class());
105 }
106
107 //___________________________________________________________________________
108 AliHMPIDPIDEfficiencyV0AnalysisTask& AliHMPIDPIDEfficiencyV0AnalysisTask::operator=(const AliHMPIDPIDEfficiencyV0AnalysisTask& c)
109 {
110   //
111   // Assignment operator
112   //
113   if (this!=&c) {
114     AliAnalysisTaskSE::operator=(c);
115     fESD             = c.fESD;
116     fMC              = c.fMC;
117     fUseMC           = c.fUseMC;
118     fHmpHistList     = c.fHmpHistList;
119     fHmpNevents      = c.fHmpNevents;
120     fThetavsMom      = c.fThetavsMom;
121     fmass            = c.fmass;
122     fpdg             = c.fpdg;
123     farme            = c.farme;
124     farmeb           = c.farmeb;
125     hangle           = c.hangle;
126     massap           = c.massap;
127     massan           = c.massan;
128     fmassaHMPID      = c.fmassaHMPID;
129     hdiff            = c.hdiff;
130     hdiffn           = c.hdiffn;
131     fTree            = c.fTree;
132     for(Int_t i=0; i<90; i++) fVar[i]=c.fVar[i];
133  }
134   return *this;
135 }
136
137 //___________________________________________________________________________
138 AliHMPIDPIDEfficiencyV0AnalysisTask::AliHMPIDPIDEfficiencyV0AnalysisTask(const AliHMPIDPIDEfficiencyV0AnalysisTask& c) :
139   AliAnalysisTaskSE(c),
140   fESD(c.fESD),fMC(c.fMC),fUseMC(c.fUseMC),
141   fHmpHistList(c.fHmpHistList),
142   fHmpNevents(c.fHmpNevents),
143   fThetavsMom(c.fThetavsMom),
144   fmass(c.fmass),
145   fpdg(c.fpdg),
146   farme(c.farme),
147   farmeb(c.farmeb),
148   hangle(c.hangle),
149   massap(c.massap),
150   massan(c.massan),
151   fmassaHMPID(c.fmassaHMPID),
152   hdiff(c.hdiff),
153   hdiffn(c.hdiffn),
154   fTree(c.fTree)  
155 {
156   //
157   // Copy Constructor
158   //
159   for (Int_t i=0; i<90; i++) fVar[i]=c.fVar[i];
160 }
161  
162 //___________________________________________________________________________
163 AliHMPIDPIDEfficiencyV0AnalysisTask::~AliHMPIDPIDEfficiencyV0AnalysisTask() {
164   //
165   //destructor
166   //
167   Info("~AliHMPIDPIDEfficiencyV0AnalysisTask","Calling Destructor");
168   if (fHmpHistList && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) delete fHmpHistList;
169 }
170
171 //___________________________________________________________________________
172 void AliHMPIDPIDEfficiencyV0AnalysisTask::ConnectInputData(Option_t *)
173 {
174   // Connect ESD here
175
176   AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
177   if (!esdH) {
178     AliDebug(2,Form("ERROR: Could not get ESDInputHandler"));
179   } else
180     fESD = esdH->GetEvent();
181
182   if (fUseMC){
183     // Connect MC
184     AliMCEventHandler *mcH = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
185     if (!mcH) {
186       AliDebug(2,Form("ERROR: Could not get MCEventHandler"));
187       fUseMC = kFALSE;
188     } else
189       fMC = mcH->MCEvent();
190       if (!fMC) AliDebug(2,Form("ERROR: Could not get MCEvent"));
191   }
192 }
193
194 //___________________________________________________________________________
195 void AliHMPIDPIDEfficiencyV0AnalysisTask::UserExec(Option_t *)
196 {
197   
198   fHmpNevents->Fill(0);
199
200   // Variables:
201   Double_t  lPrimaryVtxPosition[3];
202   Double_t lV0Position[3];
203   
204   Double_t lDcaPosToPrimVertex = 0;
205   Double_t lDcaNegToPrimVertex = 0;
206   //Double_t lDcaV0Daughters     = 0;
207   
208   Double_t lMagneticField = 999;
209
210   
211   const AliESDVertex *vertex = fESD->GetPrimaryVertexTracks();
212   AliESDtrackCuts *myTracksCuts = NULL;
213   if (!vertex) return;
214   if (!(vertex->GetStatus())) return;  
215   vertex->GetXYZ(lPrimaryVtxPosition);
216   
217   lMagneticField = fESD->GetMagneticField();
218
219   myTracksCuts = new AliESDtrackCuts();
220   myTracksCuts->SetRequireTPCRefit(kTRUE);
221     
222   if(!vertex || !vertex->GetStatus() || vertex->GetNContributors()<1) {
223     
224     // SPD vertex
225     vertex = fESD->GetPrimaryVertexSPD();
226     if(!vertex) return;
227     if(!vertex->GetStatus()) return;
228     if(vertex->GetNContributors()<1) return; // no good vertex, skip event
229     
230   }
231   
232   Double_t vtxPos[3] = {999, 999, 999};
233   if(vertex) vertex->GetXYZ(vtxPos);
234   
235   if(vertex) {
236     lPrimaryVtxPosition[0] = vertex->GetX();
237     lPrimaryVtxPosition[1] = vertex->GetY();
238     lPrimaryVtxPosition[2] = vertex->GetZ();
239              
240              }
241   
242   fHmpNevents->Fill(1);
243   
244   
245   
246   // Daughters' momentum:
247   Double_t  lMomPos[3] = {999,999,999};
248   Double_t  lMomNeg[3] = {999,999,999};
249
250   // Daughters    
251   AliESDtrack *pTrack = NULL;
252   AliESDtrack *nTrack = NULL;
253   
254   AliStack* pStack = 0;
255   if (fUseMC){
256     pStack = fMC->Stack();
257   }
258
259   Double_t r[3]; 
260   Double_t rout[3];
261   
262   //
263   // Main loop function, executed on Event basis
264   //
265   //...........................................................
266   //...........................................................
267   //...........................................................
268   
269   // A N A L I S I   V 0
270   
271   //...........................................................
272   //...........................................................
273   //...........................................................
274      
275   if(fESD->GetNumberOfV0s()>0) { 
276   
277   for(Int_t iV0 = 0; iV0<fESD->GetNumberOfV0s(); iV0++) {
278     
279      AliESDv0 *v0 = fESD->GetV0(iV0);
280      if(!v0) continue;
281     
282      //..................................................... 
283      
284      if(v0->GetOnFlyStatus()) continue;
285      
286      //.....................................................
287      
288      Int_t pIndex = TMath::Abs(v0->GetPindex()); 
289      Int_t nIndex = TMath::Abs(v0->GetNindex()); 
290      
291      //Double_t mass=v0->GetEffMass();
292      
293      // negative..................................
294      
295      Int_t qN, nphN;
296      Float_t xN, yN;
297      Float_t xpcN, ypcN, thN, phN;
298      
299      // positive...................................
300      
301      Int_t qP, nphP;
302      Float_t xP, yP;
303      Float_t xpcP, ypcP, thP, phP;
304      
305      //.............................................
306      
307      
308      //cout<<"xP="<<xP<<"yP="<<yP<<"qP="<<qP<<"nphP="<<nphP<<endl;
309          
310       AliESDtrack *pTrackTest = fESD->GetTrack(pIndex);
311       AliESDtrack *nTrackTest = fESD->GetTrack(nIndex);
312      
313       if (!pTrackTest || !nTrackTest) { Printf("strange analysis::UserExec:: Error:Could not retreive one of the daughter track\n"); continue;  }
314       
315       // Remove like-sign
316       if(pTrackTest->GetSign() == nTrackTest->GetSign()){ continue;  } 
317
318       // IMPONGO CHE LE FIGLIE SIANO UNA POSITIVA E L'ALTRA NEGATIVA....
319       //if( pTrack->GetSign() <0 || nTrack->GetSign() > 0) continue;
320      
321       if( pTrackTest->GetSign() ==1){
322         
323         pTrack = fESD->GetTrack(pIndex);
324         nTrack = fESD->GetTrack(nIndex);
325
326         // Daughters' momentum;
327         v0->GetPPxPyPz(lMomPos[0],lMomPos[1],lMomPos[2]);
328         v0->GetNPxPyPz(lMomNeg[0],lMomNeg[1],lMomNeg[2]);
329         
330         }
331            
332       if( pTrackTest->GetSign() ==-1){
333         
334         pTrack = fESD->GetTrack(nIndex);
335         nTrack = fESD->GetTrack(pIndex);
336
337         // Daughters' momentum;
338         v0->GetPPxPyPz(lMomNeg[0],lMomNeg[1],lMomNeg[2]);
339         v0->GetNPxPyPz(lMomPos[0],lMomPos[1],lMomPos[2]);
340
341         }
342
343       // DCA between daughter and Primary Vertex:
344       if (pTrack) lDcaPosToPrimVertex = TMath::Abs(pTrack->GetD(lPrimaryVtxPosition[0],lPrimaryVtxPosition[1],lMagneticField) );
345       if (nTrack) lDcaNegToPrimVertex = TMath::Abs(nTrack->GetD(lPrimaryVtxPosition[0],lPrimaryVtxPosition[1],lMagneticField) );
346       
347       // Quality tracks cuts:
348       //if ( !(myTracksCuts->IsSelected(pTrack)) || !(myTracksCuts->IsSelected(nTrack)) ) continue;
349  
350      v0->GetD(lPrimaryVtxPosition[0],lPrimaryVtxPosition[1],lPrimaryVtxPosition[2]);
351      v0->GetXYZ(lV0Position[0], lV0Position[1], lV0Position[2]);
352      
353      //---------------------------------------------------------------------------------------------------------------------------------------------------------
354      //  TAGLIO PER RIDURRE IL PESO DEI .ROOT CREATO.................
355      
356      if(v0->Theta() < 0.873  ||  v0->Theta() > 2.268  )  continue;
357      //cout<<"Phi................................"<<  v0->Phi()<<endl;
358      if(v0->Phi() > 1.3962  &&  v0->Phi() < 5.9341 ) continue;
359      //cout<<"*****************************Phi After................................"<<  v0->Phi()<<endl;
360      
361      //---------------------------------------------------------------------------------------------------------------------------------------------------------
362      
363         pTrack->GetHMPIDmip(xP,yP,qP,nphP);
364         pTrack->GetHMPIDtrk(xpcP,ypcP,thP,phP);
365       
366         nTrack->GetHMPIDmip(xN,yN,qN,nphN);
367         nTrack->GetHMPIDtrk(xpcN,ypcN,thN,phN);
368      
369      
370               
371      Float_t bp[2];
372      Float_t bpCov[3];
373      pTrack->GetImpactParameters(bp,bpCov);    
374
375      Float_t bn[2];
376      Float_t bnCov[3];
377      nTrack->GetImpactParameters(bn,bnCov);    
378
379      
380      fVar[0] = pTrack->GetHMPIDcluIdx()/1000000;
381      fVar[1] = nTrack->GetHMPIDcluIdx()/1000000;
382      
383      //fVar[1] = pHmp3;
384      fVar[2] = (Float_t)pTrack->P();
385      fVar[3] = (Float_t)nTrack->P();
386      
387      fVar[4] = xpcP;
388      fVar[5] = ypcP;
389      fVar[6] = xP;
390      fVar[7] = yP;
391      fVar[8] = (Float_t)pTrack->GetHMPIDsignal();
392      fVar[9] = (Float_t)nTrack->GetHMPIDsignal();
393      
394      fVar[10] = qP;
395      fVar[11] = thP;
396      fVar[12] = phP;
397      
398      fVar[13] = (Float_t)pTrack->GetSign();
399      fVar[14] = (Float_t)nTrack->GetSign();
400      
401      fVar[15] = (Float_t)nphP;
402      fVar[16] = (Float_t)pTrack->GetNcls(1);
403      fVar[17] = (Float_t)nTrack->GetNcls(1);
404      
405      //fVar[14] = (Float_t)probs[0];
406      //fVar[15] = (Float_t)probs[1];
407      //fVar[16] = (Float_t)probs[2];
408      //fVar[17] = (Float_t)probs[3];
409      //fVar[18] = (Float_t)probs[4];
410      fVar[18] = (Float_t)pTrack->GetTOFsignal();
411      fVar[19] = (Float_t)nTrack->GetTOFsignal();
412      
413      fVar[20] = (Float_t)pTrack->GetKinkIndex(0);
414      fVar[21] = (Float_t)nTrack->GetKinkIndex(0);
415      
416      fVar[22] = (Float_t)pTrack->Xv();
417      fVar[23] = (Float_t)nTrack->Xv();
418      
419      fVar[24] = (Float_t)pTrack->Yv();
420      fVar[25] = (Float_t)nTrack->Yv();
421      
422      fVar[26] = (Float_t)pTrack->Zv();
423      fVar[27] = (Float_t)nTrack->Zv();
424      
425      fVar[28] = (Float_t)pTrack->GetTPCchi2();
426      fVar[29] = (Float_t)nTrack->GetTPCchi2();
427      
428      // fVar[25] = b[0];
429      // fVar[26] = b[1];
430      fVar[30] = pTrack->GetHMPIDcluIdx()%1000000/1000;
431      fVar[31] = nTrack->GetHMPIDcluIdx()%1000000/1000;
432      
433      fVar[32] = vtxPos[0];
434      fVar[33] = vtxPos[1];
435      fVar[34] = vtxPos[2];
436 //     fVar[31] = (Float_t)ITSrefit;
437 //     fVar[32] = (Float_t)TPCrefit;
438      fVar[35] = (Float_t)pTrack->Eta();
439      fVar[36] = (Float_t)nTrack->Eta();
440      
441      fVar[37] = (Float_t)r[0];
442      fVar[38] = (Float_t)r[1];
443      fVar[39] = (Float_t)r[2];
444      fVar[40] = (Float_t)rout[0];           
445      fVar[41] = (Float_t)rout[1];
446      fVar[42] = (Float_t)rout[2];
447      fVar[43] = pTrack->GetMass();
448      fVar[44] = nTrack->GetMass();
449      
450      fVar[45] = v0->GetDcaV0Daughters(); // OK
451      fVar[46] = v0->GetV0CosineOfPointingAngle();
452      
453      fVar[47] = lMomPos[0];//pTrack->Px();
454      fVar[48] = lMomPos[1];//pTrack->Py();
455      fVar[49] = lMomPos[2];//pTrack->Pz();
456      fVar[50] = lMomNeg[0];//nTrack->Px();
457      fVar[51] = lMomNeg[1];//nTrack->Py();
458      fVar[52] = lMomNeg[2];//nTrack->Pz();
459    
460      fVar[53] = v0->P(); // impulso della V0;
461      fVar[54] = v0->GetEffMass();
462      
463      fVar[55] = v0->Xv();
464      fVar[56] = v0->Yv();
465      fVar[57] = v0->Zv();
466      
467
468      fVar[58] = bp[0];
469      fVar[59] = bp[1];
470      
471      fVar[60] = bn[0];
472      fVar[61] = bn[1];
473      
474      fVar[62] = lDcaPosToPrimVertex;
475      fVar[63] = lDcaNegToPrimVertex;
476      
477      fVar[64] = v0->Eta(); // pseudorapidity
478      
479      fVar[65] = v0->GetChi2V0();
480      fVar[66] = v0->GetOnFlyStatus();
481      
482      fVar[67] = lPrimaryVtxPosition[0];
483      fVar[68] = lPrimaryVtxPosition[1];
484      fVar[69] = lPrimaryVtxPosition[2];
485          
486      fVar[70] = v0->GetV0CosineOfPointingAngle(lPrimaryVtxPosition[0],lPrimaryVtxPosition[1], lPrimaryVtxPosition[2]); // new cos pointing angle
487      
488      
489      fVar[71] = lV0Position[0];
490      fVar[72] = lV0Position[1];
491      fVar[73] = lV0Position[2];
492      
493      fVar[74] = TMath::Sqrt(lV0Position[0]*lV0Position[0]+lV0Position[1]*lV0Position[1]);  // v0 radius;
494      fVar[75] = TMath::Sqrt(TMath::Power(lV0Position[0] - lPrimaryVtxPosition[0],2) +
495                                    TMath::Power(lV0Position[1] - lPrimaryVtxPosition[1],2) +
496                                    TMath::Power(lV0Position[2] - lPrimaryVtxPosition[2],2 ));  // v0 decay lenght;
497      /*
498      fVar[76] = xpcN;
499      fVar[77] = ypcN;
500      fVar[78] = xN;
501      fVar[79] = yN;
502      fVar[80] = qN;
503      fVar[81] = thN;
504      fVar[82] = phN;
505      fVar[83] = (Float_t)nphN;
506      */
507      fVar[84] = v0->Theta();//*TMath::RadToDeg();
508      fVar[85] = v0->Phi();//*TMath::RadToDeg();
509      
510      
511      fVar[76] = xpcN;
512      fVar[77] = ypcN;
513      fVar[78] = xN;
514      fVar[79] = yN;
515      fVar[80] = qN;
516      fVar[81] = thN;
517      fVar[82] = phN;
518      fVar[83] = (Float_t)nphN;
519      
520      fTree->Fill();
521  
522      
523      
524      
525     }  // endl loop sulle V0;
526   }
527   //fVar[0] = track->GetHMPIDcluIdx()/1000000;
528   //fTree->Fill();
529   
530   /* PostData(0) is taken care of by AliAnalysisTaskSE */
531   PostData(1,fHmpHistList);
532   PostData(2,fTree);
533 }
534
535 //___________________________________________________________________________
536 void AliHMPIDPIDEfficiencyV0AnalysisTask::Terminate(Option_t*)
537 {
538   // The Terminate() function is the last function to be called during
539   // a query. It always runs on the client, it can be used to present
540   // the results graphically or save the results to file.
541
542   Info("Terminate"," ");
543
544   if (!fUseMC) return;
545
546   fHmpHistList = dynamic_cast<TList*> (GetOutputData(1));
547
548   if (!fHmpHistList) {
549     AliError("Histogram List is not available");
550     return;
551   }
552
553
554   AliAnalysisTaskSE::Terminate();
555
556 }
557
558 //___________________________________________________________________________
559 void AliHMPIDPIDEfficiencyV0AnalysisTask::UserCreateOutputObjects() {
560   //
561   //HERE ONE CAN CREATE OUTPUT OBJECTS
562   //TO BE SET BEFORE THE EXECUTION OF THE TASK
563   //
564
565   //slot #1
566 //   OpenFile(1);
567    fHmpHistList = new TList();
568    fHmpHistList->SetOwner();
569
570    fHmpNevents = new TH1F("fHmpNevents","Number of events",2,0,2);
571    fHmpHistList->Add(fHmpNevents);
572    
573    fThetavsMom = new TH2F("fThetavsMom","Theta Cherenkov vs momentum",250,0,5,250,0,1);
574    fHmpHistList->Add(fThetavsMom);
575    
576    fmass = new TH1D("fmass","mass",400,0,10);
577    fHmpHistList->Add(fmass);
578    
579    massap = new TH1D("massap","massap",400,0,10);
580    fHmpHistList->Add(massap);
581    
582    massan = new TH1D("massan","massan",400,0,10);
583    fHmpHistList->Add(massan);
584    
585    hdiff = new TH1D("hdiff","hdiff",2000,-100,100);
586    fHmpHistList->Add(hdiff);
587    
588    hdiffn = new TH1D("hdiffn","hdiffn",2000,-100,100);
589    fHmpHistList->Add(hdiffn);
590    
591    fmassaHMPID = new TH1D("fmassaHMPID","fmassaHMPID",400,0,10);
592    fHmpHistList->Add(fmassaHMPID);
593    
594    fpdg = new TH1D("fpdg","pdg",5000,0,5000);
595    fHmpHistList->Add(fpdg);
596    
597    farme = new TH2F("farme","p ARMENTEROS vs alfa", 300, -10.5, 10.5, 300, 0, 10.3);
598    fHmpHistList->Add(farme);
599    
600    farmeb = new TH2F("farmeb","p ARMENTEROS vs alfa", 300, -10.5, 10.5, 300, 0, 10.3);
601    fHmpHistList->Add(farmeb);
602    
603    hangle = new TH1D("hangle","pointing angle",1000,-10,10);
604    fHmpHistList->Add(hangle);
605    
606    
607    fTree = new TTree("Tree","Tree with data");
608    /*
609    fTree->Branch("Chamber",&fVar[0]);
610    fTree->Branch("pHmp3",&fVar[1]);
611    fTree->Branch("P",&fVar[2]);
612    fTree->Branch("h",&fVar[3]);
613    fTree->Branch("Ypc",&fVar[4]);
614    fTree->Branch("X",&fVar[5]);
615    fTree->Branch("Y",&fVar[6]);
616    fTree->Branch("HMPIDsignal",&fVar[7]);
617    fTree->Branch("Charge",&fVar[8]);
618    fTree->Branch("Theta",&fVar[9]);
619    fTree->Branch("Phi",&fVar[10]);
620    
621    fTree->Branch("pSign",&fVar[11]);
622    fTree->Branch("nSign",&fVar[52]);
623    
624    fTree->Branch("NumPhotons",&fVar[12]);
625    fTree->Branch("NumTPCclust",&fVar[13]);
626    fTree->Branch("Prob0",&fVar[14]);
627    fTree->Branch("Prob1",&fVar[15]);
628    fTree->Branch("Prob2",&fVar[16]);
629    fTree->Branch("Prob3",&fVar[17]);
630    fTree->Branch("Prob4",&fVar[18]);
631    fTree->Branch("TOFsignal",&fVar[19]);
632    fTree->Branch("KinkIndex",&fVar[20]);
633    fTree->Branch("Xv",&fVar[21]);
634    fTree->Branch("Yv",&fVar[22]);
635    fTree->Branch("Zv",&fVar[23]);
636    fTree->Branch("TPCchi2",&fVar[24]);
637    fTree->Branch("b0",&fVar[25]);
638    fTree->Branch("b1",&fVar[26]);
639    fTree->Branch("ClustSize",&fVar[27]);
640    fTree->Branch("PrimVertexX",&fVar[28]);
641    fTree->Branch("PrimVertexY",&fVar[29]);
642    fTree->Branch("PrimVertexZ",&fVar[30]);
643    fTree->Branch("ITSrefit",&fVar[31]);
644    fTree->Branch("TPCrefit",&fVar[32]);   
645    fTree->Branch("Eta",&fVar[33]);
646    fTree->Branch("xTrack",&fVar[34]);
647    fTree->Branch("yTrack",&fVar[35]);
648    fTree->Branch("zTrack",&fVar[36]);
649    fTree->Branch("xOuterTrack",&fVar[37]);
650    fTree->Branch("yOuterTrack",&fVar[38]);
651    fTree->Branch("zOuterTrack",&fVar[39]);
652    fTree->Branch("massaHMPID",&fVar[40]);
653    fTree->Branch("massa_pos",&fVar[41]);
654    fTree->Branch("massa_neg",&fVar[42]);
655    fTree->Branch("alfa",&fVar[43]);
656    fTree->Branch("cosPos",&fVar[44]);
657    fTree->Branch("cosNeg",&fVar[45]);
658    fTree->Branch("pmadre",&fVar[46]);
659    fTree->Branch("distance",&fVar[47]);
660    fTree->Branch("pARMENTEROSa",&fVar[48]);
661    fTree->Branch("pARMENTEROSb",&fVar[49]);
662    fTree->Branch("pointingangle",&fVar[50]);
663    fTree->Branch("dcafiglie",&fVar[51]);
664    fTree->Branch("alfa2",&fVar[52]);
665    fTree->Branch("qt",&fVar[53]);
666    fTree->Branch("pMadreSomma",&fVar[54]);
667    
668    fTree->Branch("pxp",&fVar[55]);
669    fTree->Branch("pyp",&fVar[56]);
670    fTree->Branch("pzp",&fVar[57]);
671    fTree->Branch("pxn",&fVar[58]);
672    fTree->Branch("pyn",&fVar[59]);
673    fTree->Branch("pzn",&fVar[60]);
674    */
675    
676        
677    //==========================================================================================    
678        
679        
680    fTree->Branch("Chamberp",&fVar[0]);
681    fTree->Branch("Chambern",&fVar[1]);
682    fTree->Branch("Pp",&fVar[2]);
683    fTree->Branch("Pn",&fVar[3]);
684    fTree->Branch("HMPIDsignalp",&fVar[8]);
685    fTree->Branch("HMPIDsignaln",&fVar[9]);
686    fTree->Branch("GetNclsp",&fVar[16]);
687    fTree->Branch("GetNclsn",&fVar[17]);
688    fTree->Branch("TOFp",&fVar[18]);
689    fTree->Branch("TOFn",&fVar[19]);
690    fTree->Branch("kinkp",&fVar[20]);
691    fTree->Branch("kinkn",&fVar[21]);
692    fTree->Branch("Xvp",&fVar[22]);
693    fTree->Branch("Xvn",&fVar[23]);
694    fTree->Branch("Yvp",&fVar[24]);
695    fTree->Branch("Yvn",&fVar[25]);
696    fTree->Branch("Zvp",&fVar[26]);
697    fTree->Branch("Zvn",&fVar[27]);
698    
699    fTree->Branch("TPCp",&fVar[28]);
700    fTree->Branch("TPCn",&fVar[29]);
701    fTree->Branch("CHp",&fVar[30]);
702    fTree->Branch("CHn",&fVar[31]);
703    fTree->Branch("vtxpos",&fVar[32]);
704    fTree->Branch("vtypos",&fVar[33]);
705    fTree->Branch("vtzpos",&fVar[34]);
706    fTree->Branch("Etap",&fVar[35]);
707    fTree->Branch("Etan",&fVar[36]);
708    fTree->Branch("R0",&fVar[37]);
709    fTree->Branch("R1",&fVar[38]);
710    fTree->Branch("R2",&fVar[39]);
711    fTree->Branch("ROUT0",&fVar[40]);
712    fTree->Branch("ROUT1",&fVar[41]);
713    fTree->Branch("ROUT2",&fVar[42]);
714    fTree->Branch("massp",&fVar[43]);
715    fTree->Branch("massn",&fVar[44]);
716    fTree->Branch("dcafiglie",&fVar[45]);
717    fTree->Branch("pointingangle",&fVar[46]);
718    fTree->Branch("pxp",&fVar[47]);
719    fTree->Branch("pyp",&fVar[48]);
720    fTree->Branch("pzp",&fVar[49]);
721    fTree->Branch("pxn",&fVar[50]);
722    fTree->Branch("pyn",&fVar[51]);
723    fTree->Branch("pzn",&fVar[52]);
724    fTree->Branch("Pmadre",&fVar[53]);
725    fTree->Branch("MassEffic",&fVar[54]);
726    
727    fTree->Branch("v0x",&fVar[55]);
728    fTree->Branch("v0y",&fVar[56]);
729    fTree->Branch("v0z",&fVar[57]);
730    
731    fTree->Branch("bpos0",&fVar[58]);
732    fTree->Branch("bpos1",&fVar[59]);
733    fTree->Branch("bneg0",&fVar[60]);
734    fTree->Branch("bneg1",&fVar[61]);
735    
736    fTree->Branch("DcaPosToPrimVertex",&fVar[62]);
737    fTree->Branch("DcaNegToPrimVertex",&fVar[63]);
738    
739    fTree->Branch("etaV0",&fVar[64]);
740    fTree->Branch("Chi2V0",&fVar[65]);
741    fTree->Branch("ONFLY",&fVar[66]);
742    
743    fTree->Branch("PrimVertex0",&fVar[67]);
744    fTree->Branch("PrimVertex1",&fVar[68]);
745    fTree->Branch("PrimVertex2",&fVar[69]);
746    
747    fTree->Branch("NewCosPointingAngle",&fVar[70]);
748    
749    fTree->Branch("V0position0",&fVar[71]);
750    fTree->Branch("V0position1",&fVar[72]);
751    fTree->Branch("V0position2",&fVar[73]);
752      
753    fTree->Branch("V0radius",&fVar[74]);
754    fTree->Branch("V0decayLenght",&fVar[75]);
755    // 8 POSITIVE.......................
756    fTree->Branch("XpcP",&fVar[4]);
757    fTree->Branch("YpcP",&fVar[5]);
758    fTree->Branch("XP"  ,&fVar[6]);
759    fTree->Branch("YP"  ,&fVar[7]);
760    fTree->Branch("QP"  ,&fVar[10]);
761    fTree->Branch("THP" ,&fVar[11]);
762    fTree->Branch("PHP" ,&fVar[12]);
763    fTree->Branch("NPHP",&fVar[15]);
764    // 8 NEGATIVE.......................
765    
766    
767    
768    //==========================================================================================    
769    
770    /*
771    fTree->Branch("XpcN  ",&fVar[76]);
772    fTree->Branch("YpcN  ",&fVar[77]);
773    fTree->Branch("XN    ",&fVar[78]);
774    fTree->Branch("YN    ",&fVar[79]);
775    fTree->Branch("QN    ",&fVar[80]);
776    fTree->Branch("THN   ",&fVar[81]);
777    fTree->Branch("PHN   ",&fVar[82]);
778    fTree->Branch("NPHN  ",&fVar[83]);
779    */
780    fTree->Branch("XpcN",&fVar[76]);
781    fTree->Branch("YpcN",&fVar[77]);
782    fTree->Branch("XN",&fVar[78]);
783    fTree->Branch("YN",&fVar[79]);
784    fTree->Branch("QN",&fVar[80]);
785    fTree->Branch("THN",&fVar[81]);
786    fTree->Branch("PHN",&fVar[82]);
787    fTree->Branch("NPHN",&fVar[83]);
788    
789    
790    fTree->Branch("Theta_VO",&fVar[84]);
791    fTree->Branch("Phi_VO",&fVar[85]);
792   
793    
794           
795    PostData(1,fHmpHistList);
796    PostData(2,fTree);
797 }
798
799 //____________________________________________________________________________________________________________________________________
800 Bool_t AliHMPIDPIDEfficiencyV0AnalysisTask::Equal(Double_t x, Double_t y, Double_t tolerance)
801 {
802  return abs(x - y) <= tolerance ;
803 }
804    
805 #endif