}
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
}
}
else{
- printf("%s:%d SetStdNames() Std Entries missing \n",(char*)__FILE__,__LINE__);
+ AliWarning("Std Entries missing");
}
}
return clusters->GetEntriesFast();
}
-const void AliESDEvent::WriteToTree(TTree* tree) const {
+void AliESDEvent::WriteToTree(TTree* tree) const {
// Book the branches as in TTree::Branch(TCollection*)
// but add a "." at the end of top level branches which are
// not a TClonesArray
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 += ".";
}
// Connect the ESDEvent to a tree
//
if(!tree){
- Printf("%s %d AliESDEvent::ReadFromTree() Zero Pointer to Tree \n",(char*)__FILE__,__LINE__);
+ AliWarning("AliESDEvent::ReadFromTree() Zero Pointer to Tree \n");
return;
}
// load the TTree
char ** addressF = 0;
if(esdFB)addressF = (char **)(esdFB->GetAddress());
if (!address) {
- printf("%s %d AliESDEvent::ReadFromTree() Reading old Tree \n",(char*)__FILE__,__LINE__);
+ AliInfo("AliESDEvent::ReadFromTree() Reading old Tree");
tree->SetBranchAddress("ESD", &fESDOld);
if(esdFB){
tree->SetBranchAddress("ESDfriend.",&fESDFriendOld);
}
} else {
- printf("%s %d AliESDEvent::ReadFromTree() Reading old Tree \n",(char*)__FILE__,__LINE__);
- printf("%s %d Branch already connected. Using existing branch address. \n",(char*)__FILE__,__LINE__);
+ AliInfo("AliESDEvent::ReadFromTree() Reading old Tree");
+ AliInfo("Branch already connected. Using existing branch address.");
fESDOld = (AliESD*) (*address);
// addressF can still be 0, since branch needs to switched on
if(addressF)fESDFriendOld = (AliESDfriend*) (*addressF);
// TODO just add new entries
if(fESDObjects->GetEntries()<kESDListN){
- printf("%s %d AliESDEvent::ReadFromTree() TList contains less than the standard contents %d < %d \n",
- (char*)__FILE__,__LINE__,fESDObjects->GetEntries(),kESDListN);
+ AliWarning(Form("AliESDEvent::ReadFromTree() TList contains less than the standard contents %d < %d \n",
+ fESDObjects->GetEntries(),kESDListN));
}
// set the branch addresses
TIter next(fESDObjects);
tree->SetBranchAddress(Form("%s.",bname.Data()),fESDObjects->GetObjectRef(el));
}
else{
- printf("%s %d AliESDEvent::ReadFromTree() No Branch found with Name %s or %s. \n",
- (char*)__FILE__,__LINE__,bname.Data(),bname.Data());
+ AliWarning(Form("AliESDEvent::ReadFromTree() No Branch found with Name %s or %s.",bname.Data(),bname.Data()));
}
}
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());