1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 #include "AliRunAnalysis.h"
21 //________________________________
22 ///////////////////////////////////////////////////////////
24 // class AliRunAnalysis
28 // Piotr.Skowronski@cern.ch
30 ///////////////////////////////////////////////////////////
35 #include <TObjString.h>
39 #include <TObjArray.h>
42 #include <AliRunLoader.h>
44 #include <AliESDtrack.h>
48 #include "AliEventCut.h"
49 #include "AliReader.h"
50 #include "AliVAODParticle.h"
53 ClassImp(AliRunAnalysis)
54 AliRunAnalysis::AliRunAnalysis():
55 TTask("RunAnalysis","Alice Analysis Manager"),
64 /*********************************************************/
66 AliRunAnalysis::~AliRunAnalysis()
72 /*********************************************************/
74 Int_t AliRunAnalysis::Run()
80 AliError("Reader is not set");
83 TDirectory* cwd = gDirectory;
84 Int_t nanal = fAnalysies.GetEntries();
85 AliDebug(1,Form("There are %d analyses",nanal));
86 /******************************/
88 /******************************/
89 AliDebug(1,"Intializing analyses...");
90 for (Int_t an = 0; an < nanal; an++)
92 AliAnalysis* analysis = (AliAnalysis*)fAnalysies.At(an);
93 AliDebug(1,Form("Intializing analysis %d,address=%#x, name=%s",
94 an, analysis, analysis->GetName()));
96 AliDebug(1,Form("Init done for analysis %d",an));
98 AliDebug(1,"Intializing analyses... Done.");
100 while (fReader->Next() == kFALSE)
102 AliAOD* eventrec = fReader->GetEventRec();
103 AliAOD* eventsim = fReader->GetEventSim();
105 /******************************/
107 /******************************/
108 if ( Rejected(eventrec,eventsim) )
110 AliDebug(1,"Event rejected by Event Cut");
111 continue; //Did not pass the
114 /******************************/
116 /******************************/
117 AliDebug(1,Form("There is %d analyses",fAnalysies.GetEntries()));
119 for (Int_t an = 0; an < fAnalysies.GetEntries(); an++)
121 AliAnalysis* analysis = (AliAnalysis*)fAnalysies.At(an);
122 analysis->ProcessEvent(eventrec,eventsim);
125 }//end of loop over events
127 /******************************/
129 /******************************/
130 AliDebug(1,Form("Finishing analyses...\n There are %d anlyses",fAnalysies.GetEntries()));
132 for (Int_t an = 0; an < fAnalysies.GetEntries(); an++)
134 AliAnalysis* analysis = (AliAnalysis*)fAnalysies.At(an);
135 AliDebug(1,Form("Calling Finish for analysis %d address %#x name=%s",
136 an, analysis,analysis->GetName()));
138 AliDebug(1,Form("Called Finish for analysis %d",an));
140 AliDebug(1,"Finishing done");
144 /*********************************************************/
146 void AliRunAnalysis::Add(AliAnalysis* a)
148 //adds a to the list of analysis
151 /*********************************************************/
153 void AliRunAnalysis::SetEventCut(AliEventCut* evcut)
155 //Sets event - makes a private copy
157 if (evcut) fEventCut = (AliEventCut*)evcut->Clone();
158 else fEventCut = 0x0;
161 /*********************************************************/
163 Bool_t AliRunAnalysis::Rejected(AliAOD* recevent, AliAOD* simevent)
165 //checks the event cut
166 if (fEventCut == 0x0) return kFALSE;
169 if (fEventCut->Rejected(recevent)) return kTRUE;
172 if (fEventCut->Rejected(simevent)) return kTRUE;