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 <TDirectory.h>
26 #include "AliRunAnalysis.h"
28 #include "AliAnalysis.h"
29 #include "AliEventCut.h"
30 #include "AliReader.h"
33 ClassImp(AliRunAnalysis)
34 AliRunAnalysis::AliRunAnalysis():
35 TTask("RunAnalysis","Alice Analysis Manager"),
44 /*********************************************************/
46 AliRunAnalysis::~AliRunAnalysis()
52 /*********************************************************/
54 Int_t AliRunAnalysis::Run()
60 AliError("Reader is not set");
63 TDirectory* cwd = gDirectory;
64 Int_t nanal = fAnalysies.GetEntries();
65 AliDebug(1,Form("There are %d analyses",nanal));
66 /******************************/
68 /******************************/
69 AliDebug(1,"Intializing analyses...");
70 for (Int_t an = 0; an < nanal; an++)
72 AliAnalysis* analysis = (AliAnalysis*)fAnalysies.At(an);
73 AliDebug(1,Form("Intializing analysis %d,address=%#x, name=%s",
74 an, analysis, analysis->GetName()));
76 AliDebug(1,Form("Init done for analysis %d",an));
78 AliDebug(1,"Intializing analyses... Done.");
80 while (fReader->Next() == kFALSE)
82 AliAOD* eventrec = fReader->GetEventRec();
83 AliAOD* eventsim = fReader->GetEventSim();
85 /******************************/
87 /******************************/
88 if ( Rejected(eventrec,eventsim) )
90 AliDebug(1,"Event rejected by Event Cut");
91 continue; //Did not pass the
94 /******************************/
96 /******************************/
97 AliDebug(1,Form("There is %d analyses",fAnalysies.GetEntries()));
99 for (Int_t an = 0; an < fAnalysies.GetEntries(); an++)
101 AliAnalysis* analysis = (AliAnalysis*)fAnalysies.At(an);
102 analysis->ProcessEvent(eventrec,eventsim);
105 }//end of loop over events
107 /******************************/
109 /******************************/
110 AliDebug(1,Form("Finishing analyses...\n There are %d anlyses",fAnalysies.GetEntries()));
112 for (Int_t an = 0; an < fAnalysies.GetEntries(); an++)
114 AliAnalysis* analysis = (AliAnalysis*)fAnalysies.At(an);
115 AliDebug(1,Form("Calling Finish for analysis %d address %#x name=%s",
116 an, analysis,analysis->GetName()));
118 AliDebug(1,Form("Called Finish for analysis %d",an));
120 AliDebug(1,"Finishing done");
124 /*********************************************************/
126 void AliRunAnalysis::Add(AliAnalysis* a)
128 //adds a to the list of analysis
131 /*********************************************************/
133 void AliRunAnalysis::SetEventCut(AliEventCut* evcut)
135 //Sets event - makes a private copy
137 if (evcut) fEventCut = (AliEventCut*)evcut->Clone();
138 else fEventCut = 0x0;
141 /*********************************************************/
143 Bool_t AliRunAnalysis::Rejected(AliAOD* recevent, AliAOD* simevent)
145 //checks the event cut
146 if (fEventCut == 0x0) return kFALSE;
149 if (fEventCut->Rejected(recevent)) return kTRUE;
152 if (fEventCut->Rejected(simevent)) return kTRUE;