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 //********************************************************
19 // class AliRunAnalysis *
21 // Author: Piotr.Skowronski@cern.ch *
22 //********************************************************
24 #include "AliRunAnalysis.h"
26 #include "AliAnalysis.h"
27 #include "AliEventCut.h"
28 #include "AliReader.h"
31 ClassImp(AliRunAnalysis)
32 AliRunAnalysis::AliRunAnalysis():
33 TTask("RunAnalysis","Alice Analysis Manager"),
42 /*********************************************************/
44 AliRunAnalysis::~AliRunAnalysis()
50 /*********************************************************/
52 Int_t AliRunAnalysis::Run()
58 AliError("Reader is not set");
61 TDirectory* cwd = gDirectory;
62 Int_t nanal = fAnalysies.GetEntries();
63 AliDebug(1,Form("There are %d analyses",nanal));
64 /******************************/
66 /******************************/
67 AliDebug(1,"Intializing analyses...");
68 for (Int_t an = 0; an < nanal; an++)
70 AliAnalysis* analysis = (AliAnalysis*)fAnalysies.At(an);
71 AliDebug(1,Form("Intializing analysis %d,address=%#x, name=%s",
72 an, analysis, analysis->GetName()));
74 AliDebug(1,Form("Init done for analysis %d",an));
76 AliDebug(1,"Intializing analyses... Done.");
78 while (fReader->Next() == kFALSE)
80 AliAOD* eventrec = fReader->GetEventRec();
81 AliAOD* eventsim = fReader->GetEventSim();
83 /******************************/
85 /******************************/
86 if ( Rejected(eventrec,eventsim) )
88 AliDebug(1,"Event rejected by Event Cut");
89 continue; //Did not pass the
92 /******************************/
94 /******************************/
95 AliDebug(1,Form("There is %d analyses",fAnalysies.GetEntries()));
97 for (Int_t an = 0; an < fAnalysies.GetEntries(); an++)
99 AliAnalysis* analysis = (AliAnalysis*)fAnalysies.At(an);
100 analysis->ProcessEvent(eventrec,eventsim);
103 }//end of loop over events
105 /******************************/
107 /******************************/
108 AliDebug(1,Form("Finishing analyses...\n There are %d anlyses",fAnalysies.GetEntries()));
110 for (Int_t an = 0; an < fAnalysies.GetEntries(); an++)
112 AliAnalysis* analysis = (AliAnalysis*)fAnalysies.At(an);
113 AliDebug(1,Form("Calling Finish for analysis %d address %#x name=%s",
114 an, analysis,analysis->GetName()));
116 AliDebug(1,Form("Called Finish for analysis %d",an));
118 AliDebug(1,"Finishing done");
122 /*********************************************************/
124 void AliRunAnalysis::Add(AliAnalysis* a)
126 //adds a to the list of analysis
129 /*********************************************************/
131 void AliRunAnalysis::SetEventCut(AliEventCut* evcut)
133 //Sets event - makes a private copy
135 if (evcut) fEventCut = (AliEventCut*)evcut->Clone();
136 else fEventCut = 0x0;
139 /*********************************************************/
141 Bool_t AliRunAnalysis::Rejected(AliAOD* recevent, AliAOD* simevent)
143 //checks the event cut
144 if (fEventCut == 0x0) return kFALSE;
147 if (fEventCut->Rejected(recevent)) return kTRUE;
150 if (fEventCut->Rejected(simevent)) return kTRUE;