Add a draw class for the CORRFW (produces a warning, will be fixed
[u/mrichter/AliRoot.git] / PWG3 / dielectron / AliDielectron.h
CommitLineData
b2a297fa 1#ifndef ALIDIELECTRON_H
2#define ALIDIELECTRON_H
3/* Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6//#####################################################
7//# #
8//# Class AliDielectron #
9//# Main Class for e+e- analysis #
10//# #
11//# by WooJin J. Park, GSI / W.J.Park@gsi.de #
12//# Ionut C. Arsene, GSI / I.C.Arsene@gsi.de #
13//# Magnus Mager, CERN / Magnus.Mager@cern.ch #
14//# Jens Wiechula, Uni HD / Jens.Wiechula@cern.ch #
15//# #
16//#####################################################
17
18
19#include <TNamed.h>
20#include <TObjArray.h>
21
22#include <AliAnalysisFilter.h>
23#include <AliKFParticle.h>
24
25#include "AliDielectronHistos.h"
26#include "AliDielectronPair.h"
27
28class AliVEvent;
29class THashList;
30class AliDielectronCF;
31
32//________________________________________________________________
33class AliDielectron : public TNamed {
34
35public:
36 enum ParticleValues { kPx=0, kPy, kPz, kPt, kP, kXv, kYv, kZv, kOneOverPt,
37 kPhi, kTheta, kE, kM, kEta, kY, kCharge, kNParticleValues };
38 enum PairValues { kChi2NDF=kNParticleValues, kDecayLength, kR, kOpeningAngle, kMerr, kNPairValues };
39
40 AliDielectron();
41 AliDielectron(const char* name, const char* title);
42 virtual ~AliDielectron();
43
44 void Init();
45
46 void Process(AliVEvent *ev1, AliVEvent *ev2=0);
47
6551594b 48 void FillHistograms(const AliVEvent *ev);
b2a297fa 49
50 const AliAnalysisFilter& GetEventFilter() const { return fEventFilter; }
51 const AliAnalysisFilter& GetTrackFilter() const { return fTrackFilter; }
52 const AliAnalysisFilter& GetPairFilter() const { return fPairFilter; }
53
54 AliAnalysisFilter& GetEventFilter() { return fEventFilter; }
55 AliAnalysisFilter& GetTrackFilter() { return fTrackFilter; }
56 AliAnalysisFilter& GetPairFilter() { return fPairFilter; }
57
58 void SetMotherPdg( Int_t pdgMother ) { fPdgMother=pdgMother; }
59
60 const TObjArray* GetTrackArray(Int_t i) const {return (i>=0&&i<4)?&fTracks[i]:0;}
61 const TObjArray* GetPairArray(Int_t i) const {return (i>=0&&i<10)?
62 static_cast<TObjArray*>(fPairCandidates->UncheckedAt(i)):0;}
63
64 TObjArray** GetPairArraysPointer() { return &fPairCandidates; }
65
66 void SetHistogramManager(AliDielectronHistos * const histos) { fHistos=histos; }
67 const THashList * GetHistogramList() const { return fHistos?fHistos->GetHistogramList():0x0; }
68
69 Bool_t HasCandidates() const { return GetPairArray(1)?GetPairArray(1)->GetEntriesFast()>0:0; }
70
71 void SetCFManagerPair(AliDielectronCF * const cf) { fCfManagerPair=cf; }
72 AliDielectronCF* GetCFManagerPair() const { return fCfManagerPair; }
73
74 static const char* TrackClassName(Int_t i) { return (i>=0&&i<4)?fgkTrackClassNames[i]:""; }
75 static const char* PairClassName(Int_t i) { return (i>=0&&i<10)?fgkPairClassNames[i]:""; }
76
77private:
78
79
80 AliAnalysisFilter fEventFilter; // Event cuts
81 AliAnalysisFilter fTrackFilter; // leg cuts
82 AliAnalysisFilter fPairFilter; // pair cuts
83
84 Int_t fPdgMother; // pdg code of mother tracks
85
86 AliDielectronHistos *fHistos; // Histogram manager
87 // Streaming and merging should be handled
88 // by the analysis framework
89
90 TObjArray fTracks[4]; //! Selected track candidates
91 // 0: Event1, positive particles
92 // 1: Event1, negative particles
93 // 2: Event2, positive particles
94 // 3: Event2, negative particles
95
96 TObjArray *fPairCandidates; //! Pair candidate arrays
97 //TODO: better way to store it? TClonesArray?
98
99 AliDielectronCF *fCfManagerPair;//Correction Framework Manager for the Pair
100
101 void FillTrackArrays(AliVEvent * const ev, Int_t eventNr=0);
102 void FillPairArrays(Int_t arr1, Int_t arr2);
103
104 Int_t GetPairIndex(Int_t arr1, Int_t arr2) const {return arr1>=arr2?arr1*(arr1+1)/2+arr2:arr2*(arr2+1)/2+arr1;}
105
106 void InitPairCandidateArrays();
107 void ClearArrays();
108
109 TObjArray* PairArray(Int_t i);
110
111 static const char* fgkTrackClassNames[4]; //Names for track arrays
112 static const char* fgkPairClassNames[10]; //Names for pair arrays
113
114 void ProcessMC();
115
116 AliDielectron(const AliDielectron &c);
117 AliDielectron &operator=(const AliDielectron &c);
118
119 ClassDef(AliDielectron,1);
120};
121
122inline void AliDielectron::InitPairCandidateArrays()
123{
124 //
125 // initialise all pair candidate arrays
126 //
127 fPairCandidates->SetOwner();
128 for (Int_t i=0;i<10;++i){
129 TObjArray *arr=new TObjArray;
130 fPairCandidates->AddAt(arr,i);
131 arr->SetOwner();
132 }
133}
134
135inline TObjArray* AliDielectron::PairArray(Int_t i)
136{
137 //
138 // for internal use only: unchecked return of track array for fast access
139 //
140 return static_cast<TObjArray*>(fPairCandidates->UncheckedAt(i));
141}
142
143inline void AliDielectron::ClearArrays()
144{
145 //
146 // Reset the Arrays
147 //
148 for (Int_t i=0;i<4;++i){
149 fTracks[i].Clear();
150 }
151 for (Int_t i=0;i<10;++i){
152 PairArray(i)->Delete();
153 }
154}
155
156#endif