#include <TRandom.h>
#include <TH1.h>
+#include <TGliteXmlEventlist.h>
+
#include "AliAODParticleCut.h"
#include "AliAOD.h"
#include "AliAODRun.h"
/*************************************************************************************/
AliReader::AliReader():
+ fEventList(0x0),
fCuts(new TObjArray()),
fDirs(0x0),
fCurrentEvent(0),
/*************************************************************************************/
AliReader::AliReader(TObjArray* dirs):
+ fEventList(0x0),
fCuts(new TObjArray()),
fDirs(dirs),
fCurrentEvent(0),
/*************************************************************************************/
AliReader::AliReader(const AliReader& in):
TNamed(in),
+ fEventList((in.fEventList)?(TGliteXmlEventlist*)in.fEventList->Clone():0x0),
fCuts((in.fCuts)?(TObjArray*)in.fCuts->Clone():0x0),
fDirs((in.fDirs)?(TObjArray*)in.fDirs->Clone():0x0),
fCurrentEvent(0),
delete fEventSim;
delete fEventRec;
delete fTrackCounter;
+ delete fEventList;
}
/*************************************************************************************/
//moves to next event
//if asked to read up to event nb. fLast, and it is overcome, report no more events
- if ((fNEventsRead > fLast) && (fLast > 0) ) return kTRUE;
+ if ((fNEventsRead >= fLast) && (fLast > 0) ) return kTRUE;
if (fTrackCounter == 0x0)//create Track Counter
{
}
/*************************************************************************************/
-TString& AliReader::GetDirName(Int_t entry)
+TString AliReader::GetDirName(Int_t entry)
{
//returns directory name of next one to read
- TString* retval;//return value
+ TString retval;//return value
if (fDirs == 0x0)
- {
- retval = new TString(".");
- return *retval;
+ {
+ if (entry == 0)
+ {
+ retval = ".";
+ return retval;
+ }
+ else
+ {
+ return retval;
+ }
}
-
- if ( (entry>fDirs->GetEntries()) || (entry<0))//if out of bounds return empty string
+
+
+ if ( (entry >= fDirs->GetEntries()) || (entry < 0))//if out of bounds return empty string
{ //note that entry==0 is accepted even if array is empty (size=0)
- Error("GetDirName","Name out of bounds");
- retval = new TString();
- return *retval;
+ if ( (fDirs->GetEntries() == 0) && (entry == 0) )
+ {
+ retval = ".";
+ return retval;
+ }
+ if (AliVAODParticle::GetDebug() > 0)
+ {
+ Warning("GetDirName","Index %d out of bounds",entry);
+ }
+ return retval;
}
- if (fDirs->GetEntries() == 0)
- {
- retval = new TString(".");
- return *retval;
- }
TClass *objclass = fDirs->At(entry)->IsA();
TClass *stringclass = TObjString::Class();
if(dir == 0x0)
{
Error("GetDirName","Object in TObjArray is not a TObjString or its descendant");
- retval = new TString();
- return *retval;
+ return retval;
}
if (gDebug > 0) Info("GetDirName","Returned ok %s",dir->String().Data());
- return dir->String();
+ retval = dir->String();
+ return retval;
}
/*************************************************************************************/
//is used to check if some distributions (of many particle properties)
//depend on the order of particles
//(tracking gives particles Pt sorted)
-
- if (fEventSim == 0x0) return;
-
- for (Int_t i = 2; i < fEventSim->GetNumberOfParticles(); i++)
+ Int_t npart = 0;
+
+ if (fEventSim )
+ {
+ npart = fEventSim->GetNumberOfParticles();
+ }
+ else
+ if (fEventRec )
+ {
+ npart = fEventRec->GetNumberOfParticles();
+ }
+ else
+ {
+ return;
+ }
+ for (Int_t i = 2; i < npart; i++)
{
Int_t with = gRandom->Integer(i);
- fEventSim->SwapParticles(i,with);
+// Info("Blend","%d %d",i, with);
+ if (fEventSim) fEventSim->SwapParticles(i,with);
if (fEventRec) fEventRec->SwapParticles(i,with);
}
}