-#include "AliReader.h"
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+/* $Id$ */
+
//_________________________________________________________________________
///////////////////////////////////////////////////////////////////////////
//
//
///////////////////////////////////////////////////////////////////////////
-#include <TString.h>
-#include <TObjString.h>
-#include <TObjArray.h>
#include <TClass.h>
-#include <TRandom.h>
+#include <TGliteXmlEventlist.h>
#include <TH1.h>
+#include <TObjArray.h>
+#include <TObjString.h>
+#include <TRandom.h>
+#include <TString.h>
-#include "AliAODParticleCut.h"
#include "AliAOD.h"
+#include "AliAODParticleCut.h"
#include "AliAODRun.h"
+#include "AliLog.h"
+#include "AliReader.h"
ClassImp(AliReader)
//pure virtual
/*************************************************************************************/
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
{
}
/*************************************************************************************/
-Bool_t AliReader::Pass(AliVAODParticle* p)
+Bool_t AliReader::Rejected(AliVAODParticle* p)
{
//Method examines whether particle meets all cut and particle type criteria
if(p==0x0)//of corse we not pass NULL pointers
{
- Warning("Pass()","No Pasaran! We never accept NULL pointers");
+ Warning("Rejected()","No Pasaran! We never accept NULL pointers");
return kTRUE;
}
//if no particle is specified, we pass all particles
for(Int_t i=0; i<fCuts->GetEntriesFast(); i++)
{
AliAODParticleCut &cut = *((AliAODParticleCut*)fCuts->At(i));
- if(!cut.Pass(p)) return kFALSE; //accepted
+ if(!cut.Rejected(p)) return kFALSE; //accepted
}
return kTRUE;//not accepted
}
/*************************************************************************************/
-Bool_t AliReader::Pass(Int_t pid)
+Bool_t AliReader::Rejected(Int_t pid)
{
//this method checks if any of existing cuts accepts this pid particles
//or any cuts accepts all particles
}
/*************************************************************************************/
-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;
+ }
+ AliDebug(1,Form("Index %d out of bounds",entry));
- if (fDirs->GetEntries() == 0)
- {
- retval = new TString(".");
- return *retval;
+ 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();
+ AliDebug(1,Form("Returned ok %s",dir->String().Data()));
+ 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);
}
}