]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnAnalysisME.cxx
Made a general review to fix as possible most coding conventions violations.
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnAnalysisME.cxx
1 //
2 // Class AliRsnAnalysisME
3 //
4 // TODO
5 // TODO
6 //
7 // authors: Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
8 //          Martin Vala (martin.vala@cern.ch)
9 //
10
11 #include "AliESDEvent.h"
12 #include "AliMCEvent.h"
13 #include "AliAODEvent.h"
14
15 #include "AliRsnAnalysisME.h"
16
17 ClassImp(AliRsnAnalysisME)
18
19 //_____________________________________________________________________________
20 AliRsnAnalysisME::AliRsnAnalysisME(const char *name) :
21     AliRsnVAnalysisTaskME(name),
22     fRsnAnalysisManager(),
23     fPIDIndex(0),
24     fPIDIndexMix(0),
25     fEvent(),
26     fEventMix()
27 {
28 //
29 // Default constructor
30 //
31   AliDebug(AliLog::kDebug+2,"<-");
32   AliDebug(AliLog::kDebug+2,"->");
33 }
34
35 AliRsnAnalysisME::AliRsnAnalysisME(const AliRsnAnalysisME& copy) : AliRsnVAnalysisTaskME(copy),
36     fRsnAnalysisManager(copy.fRsnAnalysisManager),
37     fPIDIndex(copy.fPIDIndex),
38     fPIDIndexMix(copy.fPIDIndexMix),
39     fEvent(copy.fEvent),
40     fEventMix(copy.fEvent)
41 {
42   AliDebug(AliLog::kDebug+2,"<-");
43   AliDebug(AliLog::kDebug+2,"->");
44 }
45
46 //_____________________________________________________________________________
47 void AliRsnAnalysisME::RsnUserCreateOutputObjects()
48 {
49 //
50 // TODO
51 //
52   AliLog::SetClassDebugLevel(GetName(), fLogType);
53   AliDebug(AliLog::kDebug+2,"<-");
54 //     AliRsnVAnalysisTaskME::UserCreateOutputObjects();
55
56 //       fRsnEvent = new AliRsnEvent();
57 //       fRsnEvent->SetName("rsnEvents");
58 //       fRsnEvent->Init();
59 //       AddAODBranch("AliRsnEvent", &fRsnEvent);
60
61 //     fOutList = new TList();
62 //
63 //     fOutList->Add(fTaskInfo.GenerateInfoList());
64
65 //   fOutList->Add();
66   fRsnAnalysisManager.InitAllPairMgrs(fOutList);
67 //     fRsnAnalysisManager.Print();
68
69   AliDebug(AliLog::kDebug+2,"->");
70 }
71
72 void AliRsnAnalysisME::RsnUserExec(Option_t*)
73 {
74 //
75 // TODO
76 //
77
78   AliDebug(AliLog::kDebug+2,"<-");
79   if (fESDEvent) {
80     AliDebug(AliLog::kDebug+1,Form("fESDEvent if %p",fESDEvent));
81     AliDebug(AliLog::kDebug,Form("ESD tracks %d",fESDEvent->GetNumberOfTracks()));
82   }
83   if (fMCEvent) {
84     AliDebug(AliLog::kDebug+1,Form("fMCEvent if %p",fMCEvent));
85     AliDebug(AliLog::kDebug,Form("MC tracks %d",fMCEvent->GetNumberOfTracks()));
86   }
87   if (fAODEvent) {
88     AliDebug(AliLog::kDebug+1,Form("fAODEvent if %p",fAODEvent));
89     AliDebug(AliLog::kDebug,Form("AOD tracks %d",fAODEvent->GetNumberOfTracks()));
90   }
91
92   AliAODEvent* aod1 = (AliAODEvent*)GetEvent(0);
93   AliAODEvent* aod2 = (AliAODEvent*)GetEvent(1);
94
95   // assign events
96   fEvent.SetRef(aod1);
97   fEventMix.SetRef(aod2);
98   if (fEvent.GetMultiplicity() < 2) return;
99   if (fEventMix.GetMultiplicity() < 2) return;
100
101   // sort tracks w.r. to PID
102   fPIDIndex.ResetAll(fEvent.GetMultiplicity());
103   fEvent.SetPriorProbability(fPrior);
104   fPIDIndex.FillFromEvent(&fEvent);
105   fPIDIndex.SetCorrectIndexSize();
106
107   fPIDIndexMix.ResetAll(fEventMix.GetMultiplicity());
108   fEventMix.SetPriorProbability(fPrior);
109   fPIDIndexMix.FillFromEvent(&fEventMix);
110   fPIDIndexMix.SetCorrectIndexSize();
111
112   fRsnAnalysisManager.ProcessAllPairMgrs(&fPIDIndex, &fEvent, &fPIDIndexMix, &fEventMix);
113
114   AliDebug(AliLog::kDebug,Form("AOD tracks %d",aod1->GetNumberOfTracks()));
115   AliDebug(AliLog::kDebug,Form("AOD tracks %d",aod2->GetNumberOfTracks()));
116   AliDebug(AliLog::kDebug+2,"->");
117 }
118
119
120 //_____________________________________________________________________________
121 void AliRsnAnalysisME::RsnTerminate(Option_t*)
122 {
123 //
124 // TODO
125 //
126
127   AliDebug(AliLog::kDebug+2,"<-");
128   AliDebug(AliLog::kDebug+2,"->");
129 }
130
131 //_____________________________________________________________________________
132 AliRsnAnalysisManager* AliRsnAnalysisME::GetAnalysisManager(TString name)
133 {
134 //
135 // Gets all prior probabilities to out
136 //
137
138   if (!name.IsNull()) {
139     SetAnalysisManagerName(name.Data());
140   }
141   return &fRsnAnalysisManager;
142 }
143
144 //_____________________________________________________________________________
145 void AliRsnAnalysisME::SetPriorProbability(AliPID::EParticleType type, Double_t p)
146 {
147   //
148   // Sets the prior probability for Realistic PID, for a
149   // given particle species.
150   //
151
152   if (type >= 0 && type < (Int_t)AliPID::kSPECIES) {
153     fPrior[type] = p;
154   }
155
156 }
157
158 //_____________________________________________________________________________
159 void AliRsnAnalysisME::DumpPriors()
160 {
161   //
162   // Print all prior probabilities
163   //
164
165   Int_t i;
166   for (i = 0; i < AliPID::kSPECIES; i++) {
167     AliInfo(Form("Prior probability for %10s = %3.5f", AliPID::ParticleName((AliPID::EParticleType)i), fPrior[i]));
168   }
169 }
170
171 //_____________________________________________________________________________
172 void AliRsnAnalysisME::GetPriorProbability(Double_t *out) const
173 {
174 //
175 // Gets all prior probabilities to out
176 //
177
178   Int_t i;
179   for (i=0;i<AliPID::kSPECIES;i++) {
180     out[i] = fPrior[i];
181   }
182 }