#pragma link C++ class AliReader+;
#pragma link C++ class AliReaderESD+;
+#pragma link C++ class AliReaderAOD+;
#pragma link C++ class AliReaderKineTree+;
#pragma link C++ class AliFlowAnalysis+;
+#include "AliAOD.h"
/**************************************************************************
* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* *
/////////////////////////////////////////////////////////////
#include <TParticle.h>
-#include "AliAOD.h"
+#include <TClass.h>
+#include <TString.h>
#include "AliAODParticle.h"
#include "AliTrackPoints.h"
ClassImp(AliAOD)
AliAOD::AliAOD():
- fParticles(10),
+ fParticles(0x0),
fIsRandomized(kFALSE),
fPrimaryVertexX(0.0),
fPrimaryVertexY(0.0),
- fPrimaryVertexZ(0.0)
+ fPrimaryVertexZ(0.0),
+ fParticleClass(0x0)
{
//ctor
- SetOwner(kTRUE);
+// Info("AliAOD()","Entered");
+// SetOwner(kTRUE);
+// Info("AliAOD()","Exited");
+}
+/**************************************************************************/
+
+AliAOD::~AliAOD()
+{
+ //Destructor
+ //fParticleClass does not belong to AliAOD -> Do not delete it
+ delete fParticles;
+
+}
+/**************************************************************************/
+
+void AliAOD::SetParticleClassName(const char* classname)
+{
+//Sets type of particle that is going to be stored
+ if (gROOT == 0x0) Fatal("SetParticleClassName","ROOT System not initialized");
+ TClass* pclass = gROOT->GetClass(classname);
+ if ( pclass == 0x0 )
+ {
+ Error("SetParticleClass","Can not get TClass for class named %s",classname);
+ return;
+ }
+ SetParticleClass(pclass);
+}
+/**************************************************************************/
+
+void AliAOD::SetParticleClass(TClass* pclass)
+{
+//Sets type of particle that is going to be stored
+
+ if ( pclass == 0x0 )
+ {
+ Error("SetParticleClass","Parameter is NULL.");
+ return;
+ }
+
+ if ( pclass->InheritsFrom("AliVAODParticle") == kFALSE )
+ {
+ Error("SetParticleClass","Class named %s does not inherit from AliVAODParticle",pclass->GetName());
+ return;
+ }
+ if (pclass != fParticleClass)
+ {
+ fParticleClass = pclass;
+ if (fParticleClass) delete fParticles;
+ fParticles = new TClonesArray(fParticleClass);
+ }
}
/**************************************************************************/
Error("AddParticle(TParticle*,Int_t)","pointer to particle is NULL");
return;
}
+
+ if (fParticles == 0x0) SetParticleClassName("AliAODParticle");
AddParticle( new AliAODParticle(*part,idx) );
}
/**************************************************************************/
+void AliAOD::AddParticle(AliVAODParticle* particle)
+{
+ //add particle to AOD
+ //MAKES ITS OWN COPY OF THE PARTICLE!!! (AOD is not going to keep and delete input pointer)
+
+ if (fParticles == 0x0) SetParticleClassName("AliAODParticle");
+
+ Int_t idx = fParticles->GetLast() + 1;
+ TClonesArray& arr = *fParticles;
+
+ AliVAODParticle* pp = (AliVAODParticle*)fParticleClass->New(arr[idx]);
+ pp->operator=(*particle);
+
+}
+/**************************************************************************/
+
void AliAOD::AddParticle(Int_t pdg, Int_t idx,
Double_t px, Double_t py, Double_t pz, Double_t etot,
Double_t vx, Double_t vy, Double_t vz, Double_t time)
{
- //adds particle to event
- AddParticle(new AliAODParticle(pdg,idx,px,py,pz,etot,vx,vy,vz,time));
+ //adds particle to event (standard AOD class)
+
+ if (fParticles == 0x0) SetParticleClassName("AliAODParticle");
+
+ Int_t newpartidx = fParticles->GetLast() + 1;
+ TClonesArray& arr = *fParticles;
+
+ AliVAODParticle* p = (AliVAODParticle*)fParticleClass->New(arr[newpartidx]);
+
+ p->SetPdgCode(pdg);
+ p->SetUID(idx);
+ p->SetMomentum(px,py,pz,etot);
+ p->SetProductionVertex(vx,vy,vz,time);
+
}
/**************************************************************************/
//swaps particles positions; used by AliHBTEvent::Blend
if ( (i<0) || (i>=GetNumberOfParticles()) ) return;
if ( (j<0) || (j>=GetNumberOfParticles()) ) return;
-
- AliVAODParticle* tmp = (AliVAODParticle*)fParticles.At(i);
- fParticles.AddAt(fParticles.At(j),i);
- fParticles.AddAt(tmp,j);
+
+ AliVAODParticle* tmpobj = (AliVAODParticle*)fParticleClass->New();
+ AliVAODParticle& tmp = *tmpobj;
+ AliVAODParticle& first = *(GetParticle(i));
+ AliVAODParticle& second = *(GetParticle(j));
+
+ tmp = first;
+ first = second;
+ second = tmp;
+
}
/**************************************************************************/
void AliAOD::Reset()
{
//deletes all particles from the event
- for(Int_t i =0; i<GetNumberOfParticles(); i++)
- {
- for (Int_t j = i+1; j<GetNumberOfParticles(); j++)
- if ( fParticles.At(j) == fParticles.At(i) ) fParticles.RemoveAt(j);
- delete fParticles.RemoveAt(i);
- }
-// fRandomized = kFALSE;
+ if (fParticles) fParticles->Clear("C");
+
+ fIsRandomized = kFALSE;
}
/**************************************************************************/
{
//reurns number of charged particles within given pseudorapidity range
Int_t n = 0;
- Int_t npart = fParticles.GetEntries();
+ Int_t npart = GetNumberOfParticles();
for (Int_t i = 0; i < npart; i++)
{
- AliVAODParticle* p = (AliVAODParticle*)fParticles.At(i);
+ AliVAODParticle* p = GetParticle(i);
Double_t eta = p->Eta();
if ( (eta < etamin) || (eta > etamax) ) continue;
if (p->Charge() != 0.0) n++;
fPrimaryVertexY += y;
fPrimaryVertexZ += z;
- Int_t npart = fParticles.GetEntries();
+ Int_t npart = GetNumberOfParticles();
for (Int_t i = 0; i < npart; i++)
{
- AliVAODParticle* p = (AliVAODParticle*)fParticles.At(i);
+ AliVAODParticle* p = GetParticle(i);
AliTrackPoints* tp = p->GetTPCTrackPoints();
if (tp) tp->Move(x,y,z);
tp = p->GetITSTrackPoints();
if (tp) tp->Move(x,y,z);
}
}
+
+void AliAOD::Print(Option_t* /*option*/)
+{
+ //Prints AOD
+ TString ts;
+ TString msg("\n");
+ msg+="Particle Class: ";
+ if (fParticleClass)
+ {
+ msg+=fParticleClass->GetName();
+ }
+ else
+ {
+ msg+="Not specified yet";
+ }
+ msg += "\n";
+ msg += "Vertex position X: ";
+ msg += fPrimaryVertexX;
+ msg += " Y:" ;
+ msg += fPrimaryVertexY;
+ msg += " Z:";
+ msg += fPrimaryVertexZ;
+ msg += "\n";
+
+ msg += "Randomized: ";
+ msg += fIsRandomized;
+ msg += "\n";
+
+ Info("Print","%s",msg.Data());
+
+ Int_t npart = GetNumberOfParticles();
+ Info("Print","Npart: %d",npart);
+ for (Int_t i = 0; i < npart; i++)
+ {
+ Info("Print","Getting particle %d",i);
+ AliVAODParticle* p = GetParticle(i);
+ Info("Print","Printing particle %d, address %#x",i,p);
+ p->Dump();
+ p->Print();
+ Info("Print","particle %d printed",i);
+ }
+}
+
+void AliAOD::SetOwner(Bool_t /*owner*/)
+{
+//Sets the ownership of particles: if particles should be also deleted if AOD is deleted/reseted
+//Since fParticles is Clones and not Object Array, it is always the owner and this method does not have sense
+
+ MayNotUse("SetOwner");
+ //if fParticles->SetOwner(owner);
+
+}
/////////////////////////////////////////////////////////////
#include <TObject.h>
-#include <TObjArray.h>
+#include <TClonesArray.h>
#include "AliVAODParticle.h"
class TParticle;
class AliAOD: public TObject {
public:
AliAOD();
- virtual ~AliAOD() { Reset(); }
+ virtual ~AliAOD();
- virtual void SetOwner(Bool_t owner){fParticles.SetOwner(owner);}
- virtual TObjArray* GetParticles() {return &fParticles;};
- virtual Int_t GetNumberOfParticles() const {return fParticles.GetEntriesFast();}
- virtual AliVAODParticle* GetParticle(Int_t index) const {return (AliVAODParticle*) fParticles[index];}
- virtual void AddParticle(AliVAODParticle* particle) {fParticles.Add(particle);};
+ virtual TClonesArray* GetParticles() {return fParticles;};
+ virtual void SetParticleClassName(const char* classname);
+ virtual void SetParticleClass(TClass* pclass);
+
+ virtual Int_t GetNumberOfParticles() const {return (fParticles)?fParticles->GetEntriesFast():0;}
+ virtual AliVAODParticle* GetParticle(Int_t index) const {return (fParticles)?(AliVAODParticle*)fParticles->At(index):0x0;}
+ virtual void AddParticle(AliVAODParticle* particle);
virtual void AddParticle(TParticle* part, Int_t idx); //adds particle to the event
virtual void AddParticle(Int_t pdg, Int_t idx, Double_t px, Double_t py, Double_t pz, Double_t etot,
Double_t vx, Double_t vy, Double_t vz, Double_t time);
Int_t GetNumberOfCharged(Double_t etamin = -10.0, Double_t etamax = 10.0) const;
void Move(Double_t x, Double_t y, Double_t z);//moves all spacial coordinates about this vector
+ virtual void SetOwner(Bool_t owner);
+ virtual void Print(Option_t* /*option*/ = 0);
private:
- TObjArray fParticles; // array of AOD particles, AliAOD is owner of particles
+ TClonesArray *fParticles; // array of AOD particles, AliAOD is owner of particles
Bool_t fIsRandomized;//flag indicating if positions of particles were randomized - used by HBTAN
Double_t fPrimaryVertexX;//X position of the primary vertex
Double_t fPrimaryVertexY;//Y position of the primary vertex
Double_t fPrimaryVertexZ;//Z position of the primary vertex
-
+ TClass* fParticleClass;//object that defines type of the particle
ClassDef(AliAOD,1) // base class for AOD containers
};
fTPCTrackPoints(0x0),fITSTrackPoints(0x0),fClusterMap(0x0)
{
//Copy constructor
+// Info("AliAODParticle(const AliAODParticle& in)","");
for(Int_t i = 0; i<fNPids; i++)
{
fPids[i] = in.fPids[i];
fTPCTrackPoints(0x0),fITSTrackPoints(0x0),fClusterMap(0x0)
{
//Copy constructor
-
+ Info("AliAODParticle(const AliVAODParticle& in)","");
for(Int_t i = 0; i<in.GetNumberOfPids(); i++)
{
SetPIDprobability(in.GetNthPid(i),in.GetNthPidProb(i));
}
//______________________________________________________________________________
+AliAODParticle& AliAODParticle::operator=(const AliVAODParticle& in)
+{
+//operator=
+// Info("operator=(const AliVAODParticle& in)","AliAODParticle");
+
+ delete [] fPids;
+ delete [] fPidProb;
+ fPids = 0x0;
+ fPidProb = 0x0;
+ Int_t npids = in.GetNumberOfPids();
+ for (Int_t i = 0; i < npids; i++)
+ {
+ SetPIDprobability(in.GetNthPid(i),in.GetNthPidProb(i));
+ }
+
+ SetPdgCode(in.GetPdgCode(),in.GetPidProb());
+
+ SetUID(in.GetUID());
+
+ fCalcMass = in.Mass();
+
+ fPx = in.Px();
+ fPy = in.Py();
+ fPz = in.Pz();
+ fE = in.E();
+ fVx = in.Vx();
+ fVy = in.Vy();
+ fVz = in.Vz();
+ fVt = in.T();
+
+ delete fTPCTrackPoints;
+ AliTrackPoints* tpts = in.GetTPCTrackPoints();
+ fTPCTrackPoints = (tpts)?(AliTrackPoints*)tpts->Clone():0x0;
+
+ delete fITSTrackPoints;
+ tpts = in.GetITSTrackPoints();
+ fITSTrackPoints = (tpts)?(AliTrackPoints*)tpts->Clone():0x0;
+
+ delete fClusterMap;
+ AliClusterMap* incmap = in.GetClusterMap();
+ fClusterMap = (incmap)?(AliClusterMap*)incmap->Clone():0x0;
+
+ return *this;
+}
+//______________________________________________________________________________
+
AliAODParticle& AliAODParticle::operator=(const AliAODParticle& in)
{
//assigment operator
-
+// Info("operator=(const AliAODParticle& in)","AliAODParticle");
fNPids = in.fNPids;
delete [] fPids;
delete [] fPidProb;
- Int_t* fPids = new Int_t[fNPids];
- Float_t* fPidProb = new Float_t[fNPids];
+ fPids = new Int_t[fNPids];
+ fPidProb = new Float_t[fNPids];
for (Int_t i = 0; i < fNPids;i++)
{
fPids[i] = in.fPids[i];
fVt = in.T();
delete fTPCTrackPoints;
- fTPCTrackPoints = (in.fTPCTrackPoints)?(AliTrackPoints*)fTPCTrackPoints->Clone():0x0;
+ fTPCTrackPoints = (in.fTPCTrackPoints)?(AliTrackPoints*)in.fTPCTrackPoints->Clone():0x0;
delete fITSTrackPoints;
- fITSTrackPoints = (in.fITSTrackPoints)?(AliTrackPoints*)fITSTrackPoints->Clone():0x0;
+ fITSTrackPoints = (in.fITSTrackPoints)?(AliTrackPoints*)in.fITSTrackPoints->Clone():0x0;
delete fClusterMap;
fClusterMap = (in.fClusterMap)?(AliClusterMap*)in.fClusterMap->Clone():0x0;
void AliAODParticle::SetPdgCode(Int_t pdg,Float_t prob)
{
+//Set PDG Code
SetPIDprobability(pdg,prob);
fPdgIdx = GetPidSlot(pdg);
}
{
//Sets another pdg code and corresponding probabilty
//Ids are set in decreasing order
-//Check if total prbaility is not ivercoming unity is performed
+//Check if total probability is not overcoming unity is performed
//in case, warning is printed
if (GetDebug() > 9) Info("SetPIDprobability","Setting PID %d prob %f",pdg,prob);
totprob+=prob;
- for (Int_t j = fNPids-1; j > i ;j--)//copy rest of old araays
+ for (Int_t j = fNPids-1; j > i ;j--)//copy rest of old arays
{
if (GetDebug() > 9) Info("SetPID","Copying from old entry %d to new entry %d",j-1,j);
aPidProbNew[j] = fPidProb[j-1];
virtual ~AliAODParticle();
AliAODParticle& operator=(const AliAODParticle& in);
+ AliAODParticle& operator=(const AliVAODParticle& in);
- void Clear(Option_t*);//Must be implemented in order to store this object in Clones Array
+ void Clear(Option_t* /*option*/ ="");//Must be implemented in order to store this object in Clones Array
TLorentzVector FourMomentum() const {TLorentzVector v(fPx,fPy,fPz,fE);return v;}
TVector3 ProductionVertex() const {TVector3 v(fVx,fVy,fVz);return v;}
Int_t GetPdgCode () const { return (fPids)?fPids[fPdgIdx]:0;}
- Double_t GetPidProb () const { return (fPidProb)?fPidProb[fPdgIdx]:0;}
+ Double_t GetPidProb () const { return (fPidProb)?fPidProb[fPdgIdx]:0;}
Int_t GetUID () const { return fIdxInEvent;}
Int_t GetNumberOfPids () const { return fNPids;}
--- /dev/null
+#include "AliReaderAOD.h"
+
+ClassImp(AliReaderAOD)
+
+#include <TError.h>
+#include <TFile.h>
+#include <TTree.h>
+#include "AliAOD.h"
+
+Int_t AliReaderAOD::WriteAOD(AliReader* reader, const char* outfilename, Bool_t /*multcheck*/)
+{
+//reads tracks from runs and writes them to file
+ ::Info("AliReaderAOD::Write","________________________________________________________");
+ ::Info("AliReaderAOD::Write","________________________________________________________");
+ ::Info("AliReaderAOD::Write","________________________________________________________");
+
+ if (reader == 0x0)
+ {
+ ::Error("AliReaderAOD::Write","Input Reader is NULL");
+ return -1;
+ }
+ TFile *outfile = TFile::Open(outfilename,"recreate");
+ if (outfile == 0x0)
+ {
+ ::Error("AliReaderAOD::Write","Can not open output file %s",outfilename);
+ return -1;
+ }
+
+ TTree *tree = new TTree("TAOD","Tree with tracks");
+
+ TBranch *recbranch = 0x0, *simbranch = 0x0;
+
+ AliAOD* eventsim = new AliAOD();
+ AliAOD* eventrec = new AliAOD;
+
+ eventsim->SetParticleClassName("AliAODParticle");
+ eventrec->SetParticleClassName("AliAODParticle");
+
+ if (reader->ReadsSim()) simbranch = tree->Branch("simulated","AliAOD",&eventsim,32000,99);
+ if (reader->ReadsRec()) recbranch = tree->Branch("reconstructed","AliAOD",&eventrec,32000,99);
+
+ reader->Rewind();
+ while (reader->Next() == kFALSE)
+ {
+
+ if (reader->ReadsSim())
+ {
+ eventsim = reader->GetEventSim();
+// simbranch->SetAddress(&eventsim);
+ }
+
+ if (reader->ReadsRec())
+ {
+ eventrec = reader->GetEventRec();
+// recbranch->SetAddress(&eventrec);
+ }
+ tree->Fill();
+ tree->Print();
+ }
+
+ ::Info("AliReaderAOD::Write","Written %d events",tree->GetEntries());
+ outfile->cd();
+ tree->Write();
+ delete tree;
+ delete outfile;
+ return 0;
+}
+
--- /dev/null
+#ifndef ALIREADERAOD_H
+#define ALIREADERAOD_H
+
+#include "AliReader.h"
+
+class AliReaderAOD: public AliReader
+{
+ public:
+ AliReaderAOD(const Char_t* aodfilename = "AliAOD.root"){}
+ virtual ~AliReaderAOD(){}
+
+ void ReadSimulatedData(Bool_t flag){fReadSim = flag;}//switches reading MC data
+ Bool_t ReadsRec() const {return kTRUE;}
+ Bool_t ReadsSim() const {return fReadSim;}
+
+
+ static Int_t WriteAOD(AliReader* reader, const char* outfilename = "AliAOD.root", Bool_t multcheck = kFALSE);//reads tracks from runs and writes them to file
+
+ protected:
+ private:
+ TString fFileName;//File name
+
+ Bool_t fReadSim;//indicates if to read simulated data
+ ClassDef(AliReaderAOD,1)
+};
+
+#endif
ClassImp(AliVAODParticle)
+void AliVAODParticle::Clear(Option_t * /*option*/)
+{
+//Clear method
+//It is necessary for storing particles in clones array
+ Error("Clear","!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
+ Error("Clear","error Error ERROR error Error ERROR");
+ Error("Clear","This Particle do not implement Clear Method");
+ Error("Clear","Clear Method must delete all dynamiclally allocalted memory");
+ Error("Clear","error Error ERROR error Error ERROR");
+ Error("Clear","!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
+}
+//______________________________________________________________________________
+
+AliVAODParticle::AliVAODParticle(const AliVAODParticle& in):
+ TObject(in)
+{
+ //Copy constructor
+// Info("AliVAODParticle(const AliVAODParticle& in)","");
+}
+//______________________________________________________________________________
+
+
+AliVAODParticle& AliVAODParticle::operator=(const AliVAODParticle& /*in*/)
+{
+//assigment operator
+ Info("operator=(const AliVAODParticle& in)","Implement opertator= in your particle!!!");
+ return *this;
+}
+
class AliVAODParticle : public TObject {
public:
- AliVAODParticle(){}
- virtual ~AliVAODParticle(){}
+ AliVAODParticle(){}
+ virtual ~AliVAODParticle(){}
+
+ AliVAODParticle(const AliVAODParticle& in);
+ virtual AliVAODParticle& operator=(const AliVAODParticle& in);
+
+
// kinematics
virtual TLorentzVector FourMomentum() const = 0;
virtual TVector3 Momentum() const {return FourMomentum().Vect();};
virtual void SetProductionVertex(Double_t /*vx*/, Double_t /*vy*/, Double_t /*vz*/, Double_t /*t*/) = 0;
// PID
- virtual Double_t Charge() const = 0;
+ virtual void SetPdgCode(Int_t pdg, Float_t prob = 1.0) = 0;
virtual Double_t GetProbability(Int_t pdg) const = 0;
- virtual Double_t GetPidProb() const = 0;
+ virtual Double_t GetPidProb() const = 0;//returns probability of being particle type defined by GetPdgCode()
virtual Int_t GetMostProbable() const = 0;
virtual Int_t GetPdgCode() const = 0;//We need to assume some PID (f.e. energy calculation)
- //sotimes one track can apear in analysis twise (e.g. ones as pion ones as kaon)
+ //sometimes one track can apear in analysis twise (e.g. ones as pion ones as kaon)
virtual Int_t GetNumberOfPids() const = 0; //returns number of non zero PID probabilities
virtual Int_t GetNthPid (Int_t idx) const = 0;//These two methods are made to be able to
virtual Float_t GetNthPidProb (Int_t idx) const = 0;//copy pid information i.e. in copy ctors
+
+ virtual Double_t Charge() const = 0;
// vertices
virtual TVector3 ProductionVertex() const = 0;
virtual Int_t GetUID() const { return 0;}//returns unique ID of this track
//(may happen than the same track is selected
//twise, f.g. as a pion and as a kaon than both have the same UID)
-
+ virtual void SetUID(Int_t /*id*/){/* *this */}
// type information
virtual Bool_t IsSimulated() {return kFALSE;};
virtual Bool_t IsTrack() {return kFALSE;};
static void SetDebug(Int_t dbg=1){fgDebug=dbg;}
static Int_t GetDebug(){return fgDebug;}
-
+ virtual void Clear(Option_t * /*option*/ ="");
private:
static Int_t fgDebug;//! debug level for all the analysis package
--- /dev/null
+#if 0
+ #include "$(ALICE_ROOT)/TPC/alles.h"
+ #include "AliReader.h"
+ #include "AliReaderKineTree.h"
+ #include "AliAODParticleCut.h"
+ #include "AliAOD.h"
+ #include "AliAODPairCut.h"
+ #include "TSystem.h"
+ #include "TObjString.h"
+ #include "TString.h"
+ #include "AliPDG.h"
+#endif
+
+
+void WriteAOD(Option_t* datatype, Option_t* processopt="TracksAndParticles",
+ Int_t first = -1,Int_t last = -1,
+ char *outfile = "AOD.root")
+ {
+//datatype defines type of data to be read
+// Kine - analyzes Kine Tree: simulated particles
+// ESD
+// AOD
+
+// default: TracksAndParticles - process both recontructed tracks and sim. particles corresponding to them
+// Tracks - process only recontructed tracks
+// Particles - process only simulated particles
+
+//Reads data from diroctories from first to last(including)
+// For examples if first=3 and last=5 it reads from
+// ./3/
+// ./4/
+// ./5/
+//if first or last is negative (or both), it reads from current directory
+//
+//these names I use when analysis is done directly from CASTOR files via RFIO
+
+ const char* basedir=".";
+ const char* serie="";
+ const char* field = "";
+ cout<<"WriteAOD.C: datatype is "<<datatype<<" dir is basedir"<<endl;
+ // Dynamically link some shared libs
+
+ cout<<"WriteAOD.C: Loading ANALYSIS .....\n";
+ gSystem->Load("$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET)/libANALYSIS");
+ cout<<"WriteAOD.C: ..... Loaded\n";
+
+ Bool_t multcheck = kTRUE;
+ /***********************************************************/
+
+ AliReader* reader;
+ Int_t kine = strcmp(datatype,"Kine");
+ Int_t ESD = strcmp(datatype,"ESD");
+ Int_t intern = strcmp(datatype,"AOD");
+
+ if(!kine)
+ {
+ reader = new AliReaderKineTree();
+ processopt="Particles"; //this reader by definition reads only simulated particles
+ multcheck = kFALSE;
+ }
+ else if(!ESD)
+ {
+ AliReaderESD* esdreader = new AliReaderESD();
+ esdreader->ReadSimulatedData(kTRUE);
+ reader = esdreader;
+ multcheck = kTRUE;
+ }
+
+ else if(!intern)
+ {
+ reader = new AliHBTReaderAOD("AOD.root");
+ multcheck = kTRUE;
+ }
+ else
+ {
+ cerr<<"Option "<<datatype<<" not recognized. Exiting"<<endl;
+ return;
+ }
+
+ TObjArray* dirs=0;
+ if ( (first >= 0) && (last>=0) && ( (last-first)>=0 ) )
+ {//read from many dirs dirs
+ cout<<"WriteAOD.C: ..... Setting dirs first="<<first<<" last="<<last<<"\n";
+ char buff[50];
+ dirs = new TObjArray(last-first+1);
+ dirs->SetOwner();
+ for (Int_t i = first; i<=last; i++)
+ {
+ sprintf(buff,"%s/%s/%s/%d",basedir,field,serie,i);
+ TObjString *odir= new TObjString(buff);
+ dirs->Add(odir);
+ }
+ }
+
+ reader->SetDirs(dirs);
+
+ AliAODParticleCut* readerpartcut= new AliAODParticleCut();
+ readerpartcut->SetPtRange(0.0,10000.0);
+ readerpartcut->SetPID(kKPlus);
+ AliAODPIDCut* pidcut = new AliAODPIDCut(kKPlus,0.5);
+ readerpartcut->AddBasePartCut(pidcut);
+
+ reader->AddParticleCut(readerpartcut);//read this particle type with this cut
+
+ cout<<"WriteAOD.C: P R O C S E S S I N G .....\n\n";
+ AliReaderAOD::WriteAOD(reader,outfile,multcheck);
+ cout<<"\n\nWriteAOD.C: F I N I S H E D\n";
+
+ if (dirs) delete dirs;
+ delete reader;
+ }
+
AliAODParticleCut.cxx AliAODParticleBaseCut.cxx \
AliAODPairCut.cxx AliAODPairBaseCut.cxx \
AliEventCut.cxx AliEventBaseCut.cxx \
- AliReader.cxx AliReaderESD.cxx AliReaderKineTree.cxx\
+ AliReader.cxx AliReaderESD.cxx AliReaderKineTree.cxx \
+ AliReaderAOD.cxx \
AliTrackPoints.cxx AliClusterMap.cxx \
AliD0toKpi.cxx AliD0toKpiAnalysis.cxx AliFlowAnalysis.cxx \