}
else if(mine->InheritsFrom("TCollection")){
if(mine->InheritsFrom("TClonesArray"))
- dynamic_cast<TClonesArray*>(mine)->SetClass(its->ClassName());
+ dynamic_cast<TClonesArray*>(mine)->SetClass(dynamic_cast<TClonesArray*>(its)->GetClass());
dynamic_cast<TCollection*>(mine)->SetName(name);
}
AliDebug(1, Form("adding object %s of type %s", mine->GetName(), mine->ClassName()));
Int_t idx=cs->GetIndex();
if (rm==idx) return kFALSE;
if (idx==last) used++;
+
+ AliESDv0 *v0=cs;
+ idx=v0->GetNindex();
+ if (rm==idx) return kFALSE;
+ if (idx==last) used++;
+
+ idx=v0->GetPindex();
+ if (rm==idx) return kFALSE;
+ if (idx==last) used++;
}
Int_t nkn=GetNumberOfKinks();
if (idx==last) used++;
}
+ // Check if this track is associated with a CaloCluster
+ Int_t ncl=GetNumberOfCaloClusters();
+ for (Int_t n=0; n<ncl; n++) {
+ AliESDCaloCluster *cluster=GetCaloCluster(n);
+ TArrayI *arr=cluster->GetTracksMatched();
+ Int_t s=arr->GetSize();
+ while (s--) {
+ Int_t idx=arr->At(s);
+ if (rm==idx) return kFALSE;
+ if (idx==last) used++;
+ }
+ }
+
+
//Replace the removed track with the last track
TClonesArray &a=*fTracks;
used--;
if (!used) return kTRUE;
}
+ AliESDv0 *v0=cs;
+ if (v0->GetIndex(0)==last) {
+ v0->SetIndex(0,rm);
+ used--;
+ if (!used) return kTRUE;
+ }
+ if (v0->GetIndex(1)==last) {
+ v0->SetIndex(1,rm);
+ used--;
+ if (!used) return kTRUE;
+ }
}
for (Int_t n=0; n<nkn; n++) {
}
}
+ // Remap the indices of the tracks accosicated with CaloClusters
+ for (Int_t n=0; n<ncl; n++) {
+ AliESDCaloCluster *cluster=GetCaloCluster(n);
+ TArrayI *arr=cluster->GetTracksMatched();
+ Int_t s=arr->GetSize();
+ while (s--) {
+ Int_t idx=arr->At(s);
+ if (idx==last) {
+ arr->AddAt(rm,s);
+ used--;
+ if (!used) return kTRUE;
+ }
+ }
+ }
+
return kTRUE;
}
}
}
-void AliESDEvent::SetPrimaryVertex(const AliESDVertex *vertex)
+void AliESDEvent::SetPrimaryVertexTracks(const AliESDVertex *vertex)
{
- // Set the primary vertex
+ // Set the primary vertex reconstructed using he ESD tracks.
// use already allocated space
if(fPrimaryVertex){
*fPrimaryVertex = *vertex;
}
}
+const AliESDVertex * AliESDEvent::GetPrimaryVertex() const
+{
+ //
+ // Get the "best" available reconstructed primary vertex.
+ //
+ if(fPrimaryVertex){
+ if (fPrimaryVertex->GetStatus()) return fPrimaryVertex;
+ }
+ if(fSPDVertex){
+ if (fSPDVertex->GetStatus()) return fSPDVertex;
+ }
+ if(fTPCVertex) return fTPCVertex;
+
+ AliWarning("No primary vertex available. Returning the \"default\"...");
+ return fSPDVertex;
+}
+
void AliESDEvent::SetMultiplicity(const AliMultiplicity *mul)
{
// Set the SPD Multiplicity
while ((obj = next())) {
branchname.Form("%s", obj->GetName());
+ if(branchname.CompareTo("AliESDfriend")==0)branchname = "ESDfriend.";
if ((kSplitlevel > 1) && !obj->InheritsFrom(TClonesArray::Class())) {
if(!branchname.EndsWith("."))branchname += ".";
}
0,
fESDOld->GetZDCN2Energy(),
fESDOld->GetZDCP2Energy(),
- fESDOld->GetZDCParticipants());
+ fESDOld->GetZDCParticipants(),
+ 0);
// FMD
if(fESDOld->GetVertex())SetPrimaryVertexSPD(fESDOld->GetVertex());
- if(fESDOld->GetPrimaryVertex())SetPrimaryVertex(fESDOld->GetPrimaryVertex());
+ if(fESDOld->GetPrimaryVertex())SetPrimaryVertexTracks(fESDOld->GetPrimaryVertex());
if(fESDOld->GetMultiplicity())SetMultiplicity(fESDOld->GetMultiplicity());