1 #include "AliRunAnalysis.h"
2 //________________________________
3 ///////////////////////////////////////////////////////////
5 // class AliRunAnalysis
9 // Piotr.Skowronski@cern.ch
11 ///////////////////////////////////////////////////////////
16 #include <TObjString.h>
20 #include <TObjArray.h>
23 #include <AliRunLoader.h>
25 #include <AliESDtrack.h>
29 #include "AliEventCut.h"
30 #include "AliReader.h"
31 #include "AliVAODParticle.h"
34 ClassImp(AliRunAnalysis)
35 AliRunAnalysis::AliRunAnalysis():
36 TTask("RunAnalysis","Alice Analysis Manager"),
45 /*********************************************************/
47 AliRunAnalysis::~AliRunAnalysis()
53 /*********************************************************/
55 Int_t AliRunAnalysis::Run()
61 Error("Run","Reader is not set");
64 TDirectory* cwd = gDirectory;
65 Int_t nanal = fAnalysies.GetEntries();
66 if (AliVAODParticle::GetDebug()) Info("Run","There is %d analysies",nanal);
67 /******************************/
69 /******************************/
70 if (AliVAODParticle::GetDebug()) Info("Run","Intializing analyses...");
71 for (Int_t an = 0; an < nanal; an++)
73 if (AliVAODParticle::GetDebug()) Info("Run","Intializing analysis %d", an);
74 AliAnalysis* analysis = (AliAnalysis*)fAnalysies.At(an);
75 if (AliVAODParticle::GetDebug())
77 Info("Run","Intializing analysis %d address %#x", an, analysis);
78 Info("Run","Intializing analysis %d name %d", an, analysis->GetName());
79 Info("Run","Intializing analysis %d: Calling Init...", an);
82 if (AliVAODParticle::GetDebug()) Info("Run","Intializing analysis %d: Calling Init... Done");
84 if (AliVAODParticle::GetDebug()) Info("Run","Intializing analyses... Done.");
86 while (fReader->Next() == kFALSE)
88 AliAOD* eventrec = fReader->GetEventRec();
89 AliAOD* eventsim = fReader->GetEventSim();
91 /******************************/
93 /******************************/
94 if ( Rejected(eventrec,eventsim) )
96 if (AliVAODParticle::GetDebug()) Info("Run","Event rejected by Event Cut");
97 continue; //Did not pass the
100 /******************************/
102 /******************************/
103 if (AliVAODParticle::GetDebug()) Info("Run","There is %d analyses",fAnalysies.GetEntries());
105 for (Int_t an = 0; an < fAnalysies.GetEntries(); an++)
107 AliAnalysis* analysis = (AliAnalysis*)fAnalysies.At(an);
108 analysis->ProcessEvent(eventrec,eventsim);
111 }//end of loop over events
113 /******************************/
115 /******************************/
116 if (AliVAODParticle::GetDebug()) Info("Run","Finishing analyses... ");
117 if (AliVAODParticle::GetDebug()) Info("Run","There is %d anlyses",fAnalysies.GetEntries());
119 for (Int_t an = 0; an < fAnalysies.GetEntries(); an++)
121 if (AliVAODParticle::GetDebug()) Info("Run","Finishing analysis %d", an);
122 AliAnalysis* analysis = (AliAnalysis*)fAnalysies.At(an);
123 if (AliVAODParticle::GetDebug())
125 Info("Run","Finishing analysis %d address %#x", an, analysis);
126 Info("Run","Finishing analysis %d name %d", an, analysis->GetName());
127 Info("Run","Finishing analysis %d: Calling Finish...",an);
130 if (AliVAODParticle::GetDebug()) Info("Run","Finishing analysis %d: Calling Finish... Done");
132 if (AliVAODParticle::GetDebug()) Info("Run","Finishing done");
136 /*********************************************************/
138 void AliRunAnalysis::Add(AliAnalysis* a)
140 //adds a to the list of analysis
143 /*********************************************************/
145 void AliRunAnalysis::SetEventCut(AliEventCut* evcut)
147 //Sets event - makes a private copy
149 if (evcut) fEventCut = (AliEventCut*)evcut->Clone();
150 else fEventCut = 0x0;
153 /*********************************************************/
155 Bool_t AliRunAnalysis::Rejected(AliAOD* recevent, AliAOD* simevent)
157 //checks the event cut
158 if (fEventCut == 0x0) return kFALSE;
161 if (fEventCut->Rejected(recevent)) return kTRUE;
164 if (fEventCut->Rejected(simevent)) return kTRUE;