fParticleClass = in.fParticleClass ; //althought it is pointer, this points to object in class list of gROOT
return *this;
}
-
/**************************************************************************/
AliAOD::~AliAOD()
TObject& obj = *(fParticles->At(i));
obj = inobj;
}
-
+
+ TClass* partclass = GetParticleClass();
+ if (partclass == 0x0)
+ {
+ Fatal("CopyData","Can not get particle class");
+ return;//pro forma
+ }
+
for (Int_t i = curentr; i < inentr; i++)
{
TObject& inobj = *(in.fParticles->At(i));
- TObject& obj = *((TObject*)(fParticleClass->New(arr[i])));
+ TObject& obj = *((TObject*)(partclass->New(arr[i])));
obj = inobj;
}
}
fParticles = new TClonesArray(fParticleClass);
}
}
+/**************************************************************************/
+TClass* AliAOD::GetParticleClass()
+{
+//returns TClass of particle class
+ if (fParticleClass) return fParticleClass;
+
+ if (fParticles == 0x0) return 0x0;
+
+ fParticleClass = fParticles->GetClass();
+ return fParticleClass;
+}
/**************************************************************************/
Int_t idx = fParticles->GetLast() + 1;
TClonesArray& arr = *fParticles;
+
+ TClass* partclass = GetParticleClass();
+ if (partclass == 0x0)
+ {
+ Error("AddParticle(AliVAODParticle*)","Can not get particle class");
+ return;
+ }
- AliVAODParticle* pp = (AliVAODParticle*)fParticleClass->New(arr[idx]);
+ AliVAODParticle* pp = (AliVAODParticle*)partclass->New(arr[idx]);
pp->operator=(*particle);
}
Int_t newpartidx = fParticles->GetLast() + 1;
TClonesArray& arr = *fParticles;
-
- AliVAODParticle* p = (AliVAODParticle*)fParticleClass->New(arr[newpartidx]);
+
+ TClass* partclass = GetParticleClass();
+ if (partclass == 0x0)
+ {
+ Error("AddParticle(Int_t,...)","Can not get particle class");
+ return;
+ }
+
+ AliVAODParticle* p = (AliVAODParticle*)partclass->New(arr[newpartidx]);
p->SetPdgCode(pdg);
p->SetUID(idx);
if ( (i<0) || (i>=GetNumberOfParticles()) ) return;
if ( (j<0) || (j>=GetNumberOfParticles()) ) return;
- AliVAODParticle* tmpobj = (AliVAODParticle*)fParticleClass->New();
+
+ TClass* partclass = GetParticleClass();
+ if (partclass == 0x0)
+ {
+ Error("SwapParticles","Can not get particle class");
+ return;
+ }
+
+ AliVAODParticle* tmpobj = (AliVAODParticle*)partclass->New();
AliVAODParticle& tmp = *tmpobj;
AliVAODParticle& first = *(GetParticle(i));
AliVAODParticle& second = *(GetParticle(j));
if (tp) tp->Move(x,y,z);
}
}
+/**************************************************************************/
void AliAOD::Print(Option_t* /*option*/)
{
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);
- const TClass* GetParticleClass() const {return fParticleClass;}
+ TClass* GetParticleClass();
private:
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
+ TClass* fParticleClass;//!object that defines type of the particle
ClassDef(AliAOD,1) // base class for AOD containers
};
}
else
{
- return retval;
+ 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");
+ 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 = ".";
- return retval;
- }
TClass *objclass = fDirs->At(entry)->IsA();
TClass *stringclass = TObjString::Class();
//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);
}
}
{
//Reads next event
+ Info("ReadNext","Entered");
do //do{}while; is OK even if 0 dirs specified. In that case we try to read from "./"
{
if (fFile == 0x0)
}
fCurrentEvent = 0;
}
-
+ Info("ReadNext","Getting event %d",fCurrentEvent);
fTree->GetEvent(fCurrentEvent);
+ Info("ReadNext","Getting event %d Done",fCurrentEvent);
//Temporary testing sollution
fEventSim = fSimBuffer;
fTree = 0x0;
delete fFile;
fFile = 0x0;
+ fSimBuffer = 0x0;
+ fRecBuffer = 0x0;
fCurrentDir++;
}
}
{
//opens fFile with tree
- const TString& dirname = GetDirName(n);
+// Info("ReadNext","Opening File %d",n);
+ const TString dirname = GetDirName(n);
if (dirname == "")
{
if (AliVAODParticle::GetDebug() > 2 )
fFile = 0x0;
return 3;
}
+
+ Info("ReadNext","File Is Opened, Getting the TREE");
fTree = dynamic_cast<TTree*>(fFile->Get(fgkTreeName));
if (fTree == 0x0)
return 4;
}
+// Info("ReadNext","Got TREE, Setting branch addresses");
+
fTree->SetBranchAddress(fgkSimulatedDataBranchName,&fSimBuffer);
fTree->SetBranchAddress(fgkRecosntructedDataBranchName,&fRecBuffer);
+// Info("ReadNext","Got TREE, Addresses are set.");
+// Info("ReadNext","Quitting the method.");
+
return 0;
}
if (reader->ReadsSim())
{
- AliAOD* event = reader->GetEventRec();
+ AliAOD* event = reader->GetEventSim();
if ( eventsim->GetParticleClass() != event->GetParticleClass() )
{//if class type is not what what we whant we copy particles
eventsim->CopyData(event);
simbuffer = event;
}
}
- eventrec->GetParticle(0)->Print();
- eventsim->GetParticle(0)->Print();
+ recbuffer->GetParticle(0)->Print();
+ simbuffer->GetParticle(0)->Print();
tree->Fill();
}
//
//these names I use when analysis is done directly from CASTOR files via RFIO
+ Bool_t multcheck = kTRUE;
+
const char* basedir=".";
const char* serie="";
const char* field = "";
gSystem->Load("$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET)/libANALYSIS");
cout<<"WriteAOD.C: ..... Loaded\n";
- Bool_t multcheck = kTRUE;
+ Int_t PID[11];
+ PID[0]=kProton;
+ PID[1]=kProtonBar;
+ PID[2]=kKPlus;
+ PID[3]=kKMinus;
+ PID[4]=kPiPlus;
+ PID[5]=kPiMinus;
+ PID[6]=kElectron;
+ PID[7]=kPositron;
+ PID[8]=kMuonMinus;
+ PID[9]=kMuonPlus;
+ PID[10]=0;//Last must be 0!!!!!!!!!!!!!!!!!!
+
+ Float_t PIDprob[11];
+ PIDprob[0] = 0.5;
+ PIDprob[1] = 0.5;
+ PIDprob[2] = 0.5;
+ PIDprob[3] = 0.5;
+ PIDprob[4] = 0.5;
+ PIDprob[5] = 0.5;
+ PIDprob[6] = 0.5;
+ PIDprob[7] = 0.5;
+ PIDprob[8] = 0.5;
+ PIDprob[9] = 0.5;
+ PIDprob[10] = 0.5;
/***********************************************************/
AliReader* reader;
{
AliReaderESD* esdreader = new AliReaderESD();
esdreader->ReadSimulatedData(kTRUE);
+ esdreader->SetNumberOfTrackPoints(5,30.);//5 points every 30 cm
+ esdreader->SetITSTrackPoints(kTRUE);
+ esdreader->SetClusterMap(kTRUE);
+
reader = esdreader;
multcheck = kTRUE;
}
}
reader->SetDirs(dirs);
-
- AliAODParticleCut* readerpartcut= new AliAODParticleCut();
- readerpartcut->SetPtRange(0.4,1.2);
- readerpartcut->SetPID(kPiPlus);
- AliAODPIDCut* pidcut = new AliAODPIDCut(kPiPlus,0.5);
- readerpartcut->AddBasePartCut(pidcut);
-
- reader->AddParticleCut(readerpartcut);//read this particle type with this cut
+
+ AliAODParticleCut* readerpartcut= new AliAODParticleCut();
+
+ Int_t l = 0;
+ while (PID[l] != 0)
+ {
+ cout<<"WriteAOD.C: Adding PID = "<<PID[l]<<" l = "<<l<<endl;
+ readerpartcut->SetPID(PID[l]);
+ AliAODParticleCut * pcut = (AliAODParticleCut*)readerpartcut->Clone();
+ AliAODPIDCut* pidcut = new AliAODPIDCut(PID[l],PIDprob[l]);
+ pcut->AddBasePartCut(pidcut);
+ reader->AddParticleCut(pcut);//read this particle type with this cut
+ delete pcut;
+ l++;
+ }
+
+// readerpartcut->SetPtRange(0.0,1.2);
cout<<"WriteAOD.C: P R O C S E S S I N G .....\n\n";
AliReaderAOD::WriteAOD(reader,outfile,"AliAODParticle",multcheck);