]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/ESD/AliESDEvent.cxx
cov fixes
[u/mrichter/AliRoot.git] / STEER / ESD / AliESDEvent.cxx
index 3ec223e1f7a1d415ab1e7f37d84d202dc3cdc71d..8ffa41ccb6055539770c4c808af7952e53437a04 100644 (file)
 #include "AliESDACORDE.h"
 #include "AliESDHLTDecision.h"
 #include "AliCentrality.h"
+#ifdef MFT_UPGRADE
+#include "AliESDMFT.h"
+#endif
 #include "AliEventplane.h"
 
+
 ClassImp(AliESDEvent)
 
 
@@ -105,7 +109,11 @@ ClassImp(AliESDEvent)
                                                        "PHOSCells",
                                                        "AliRawDataErrorLogs",
                                                        "AliESDACORDE",
-                                                       "AliTOFHeader"};
+                                                       "AliTOFHeader"
+                               #ifdef MFT_UPGRADE
+//                             , "AliESDMFT"
+                                                       #endif
+  };
 
 //______________________________________________________________________________
 AliESDEvent::AliESDEvent():
@@ -144,7 +152,11 @@ AliESDEvent::AliESDEvent():
   fUseOwnList(kFALSE),
   fTOFHeader(0),
   fCentrality(0),
-  fEventplane(0)
+  fEventplane(0),
+  fDetectorStatus(0xFFFFFFFF)
+  #ifdef MFT_UPGRADE
+//  , fESDMFT(0)
+  #endif
 {
 }
 //______________________________________________________________________________
@@ -185,8 +197,15 @@ AliESDEvent::AliESDEvent(const AliESDEvent& esd):
   fUseOwnList(esd.fUseOwnList),
   fTOFHeader(new AliTOFHeader(*esd.fTOFHeader)),
   fCentrality(new AliCentrality(*esd.fCentrality)),
-  fEventplane(new AliEventplane(*esd.fEventplane))
+  fEventplane(new AliEventplane(*esd.fEventplane)),
+  fDetectorStatus(esd.fDetectorStatus)
+  #ifdef MFT_UPGRADE
+//  , fESDMFT(new AliESDMFT(*esd.fESDMFT))
+  #endif
+
+
 {
+  printf("copying ESD event...\n");   // AU
   // CKB init in the constructor list and only add here ...
   AddObject(fESDRun);
   AddObject(fHeader);
@@ -217,7 +236,9 @@ AliESDEvent::AliESDEvent(const AliESDEvent& esd):
   AddObject(fErrorLogs);
   AddObject(fESDACORDE);
   AddObject(fTOFHeader);
-
+  #ifdef MFT_UPGRADE
+//  AddObject(fESDMFT);
+  #endif
   GetStdContent();
 
 }
@@ -314,6 +335,8 @@ AliESDEvent & AliESDEvent::operator=(const AliESDEvent& source) {
 
   fConnected  = source.fConnected;
   fUseOwnList = source.fUseOwnList;
+  
+  fDetectorStatus = source.fDetectorStatus;
 
   return *this;
 }
@@ -461,18 +484,25 @@ void AliESDEvent::ResetStdContent()
     fTrdTrigger->~AliESDTrdTrigger();
     new (fTrdTrigger) AliESDTrdTrigger();
   }
+  #ifdef MFT_UPGRADE
+  //if(fESDMFT){
+//     fESDMFT->~AliESDMFT();
+//     new (fESDMFT) AliESDMFT();
+ // }  
+  #endif
+       
   if(fPHOSTrigger)fPHOSTrigger->DeAllocate(); 
   if(fEMCALTrigger)fEMCALTrigger->DeAllocate(); 
   if(fSPDPileupVertices)fSPDPileupVertices->Delete();
   if(fTrkPileupVertices)fTrkPileupVertices->Delete();
-  if(fTracks)fTracks->Delete();
+  if(fTracks) fTracks->Clear("C"); // Delete();
   if(fMuonTracks)fMuonTracks->Delete();
   if(fPmdTracks)fPmdTracks->Delete();
   if(fTrdTracks)fTrdTracks->Delete();
   if(fTrdTracklets)fTrdTracklets->Delete();
-  if(fV0s)fV0s->Delete();
-  if(fCascades)fCascades->Delete();
-  if(fKinks)fKinks->Delete();
+  if(fV0s)fV0s->Clear();  // not dynamic // Delete();
+  if(fCascades)fCascades->Clear(); // not dynamic // Delete();
+  if(fKinks)fKinks->Clear(); // not dynamyc //Delete();
   if(fCaloClusters)fCaloClusters->Delete();
   if(fPHOSCells)fPHOSCells->DeleteContainer();
   if(fEMCALCells)fEMCALCells->DeleteContainer();
@@ -538,6 +568,11 @@ void AliESDEvent::Print(Option_t *) const
   printf("                 CaloClusters %d\n", GetNumberOfCaloClusters());
   printf("                 FMD       %s\n", (fESDFMD ? "yes" : "no"));
   printf("                 VZERO     %s\n", (fESDVZERO ? "yes" : "no"));
+  #ifdef MFT_UPGRADE
+  //printf("                 MFT     %s\n", (fESDMFT ? "yes" : "no"));
+  #endif
+       
+       
   TObject* pHLTDecision=GetHLTTriggerDecision();
   printf("HLT trigger decision: %s\n", pHLTDecision?pHLTDecision->GetOption():"not available");
   if (pHLTDecision) pHLTDecision->Print("compact");
@@ -727,17 +762,16 @@ Bool_t  AliESDEvent::RemoveTrack(Int_t rm) const {
     }
   }
 
-
-
-  //Replace the removed track with the last track 
+  // Replace the removed track with the last track 
   TClonesArray &a=*fTracks;
   delete a.RemoveAt(rm);
 
   if (rm==last) return kTRUE;
 
+  // RS: Attention: semi-shalow copy is used: the new track will steal the dynamic content of old one
   AliESDtrack *t=GetTrack(last);
   t->SetID(rm);
-  new (a[rm]) AliESDtrack(*t);
+  new (a[rm]) AliESDtrack(t, kTRUE); // detach dynamic content of the source
   delete a.RemoveAt(last);
 
 
@@ -1109,12 +1143,29 @@ void AliESDEvent::SetTZEROData(AliESDTZERO * obj)
     *fESDTZERO = *obj;
 }
 
+#ifdef MFT_UPGRADE
+//void AliESDEvent::SetMFTData(AliESDMFT * obj)
+//{ 
+//  if(fESDMFT)
+//     *fESDMFT = *obj;
+//}
+#endif
+
 void AliESDEvent::SetACORDEData(AliESDACORDE * obj)
 {
   if(fESDACORDE)
     *fESDACORDE = *obj;
 }
 
+void AliESDEvent::DetachFriends() const
+{
+  // clean friend track pointers of ESDtracks
+  Int_t ntrk=GetNumberOfTracks();
+  for (Int_t i=0; i<ntrk; i++) {
+    AliESDtrack *t=GetTrack(i);
+    t->ReleaseESDfriendTrackGently();
+  }
+}
 
 void AliESDEvent::GetESDfriend(AliESDfriend *ev) const 
 {
@@ -1127,11 +1178,9 @@ void AliESDEvent::GetESDfriend(AliESDfriend *ev) const
 
   for (Int_t i=0; i<ntrk; i++) {
     AliESDtrack *t=GetTrack(i);
-    const AliESDfriendTrack *f=t->GetFriendTrack();
-    ev->AddTrack(f);
-
-    t->ReleaseESDfriendTrack();// Not to have two copies of "friendTrack"
-
+    AliESDfriendTrack *f = (AliESDfriendTrack*)t->GetFriendTrack();
+    ev->AddTrackShallow(f);
+    t->ReleaseESDfriendTrackGently();// Not to have two copies of "friendTrack"
   }
 
   AliESDfriend *fr = (AliESDfriend*)(const_cast<AliESDEvent*>(this)->FindListObject("AliESDfriend"));
@@ -1182,6 +1231,9 @@ void AliESDEvent::GetStdContent()
   fErrorLogs = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kErrorLogs]);
   fESDACORDE = (AliESDACORDE*)fESDObjects->FindObject(fgkESDListName[kESDACORDE]);
   fTOFHeader = (AliTOFHeader*)fESDObjects->FindObject(fgkESDListName[kTOFHeader]);
+  #ifdef MFT_UPGRADE
+ // fESDMFT = (AliESDMFT*)fESDObjects->FindObject(fgkESDListName[kESDMFT]);
+  #endif
 }
 
 void AliESDEvent::SetStdNames(){
@@ -1243,7 +1295,10 @@ void AliESDEvent::CreateStdContent()
   AddObject(new TClonesArray("AliRawDataErrorLog",0));
   AddObject(new AliESDACORDE()); 
   AddObject(new AliTOFHeader());
-
+  #ifdef MFT_UPGRADE
+  //AddObject(new AliESDMFT());
+  #endif
+       
   // check the order of the indices against enum...
 
   // set names
@@ -1309,7 +1364,7 @@ void AliESDEvent::WriteToTree(TTree* tree) const {
   TString branchname;
   TIter next(fESDObjects);
   const Int_t kSplitlevel = 99; // default value in TTree::Branch()
-  const Int_t kBufsize = 32000; // default value in TTree::Branch()
+  const Int_t kBufsize = 32000/4; // default value in TTree::Branch()
   TObject *obj = 0;
 
   while ((obj = next())) {
@@ -1608,6 +1663,11 @@ void AliESDEvent::CopyFromOldESD()
     for(int i = 0;i<fESDOld->GetNumberOfCaloClusters();i++){
       AddCaloCluster(fESDOld->GetCaloCluster(i));
     }
+         
+       #ifdef MFT_UPGRADE  
+       // MFT
+//     if (fESDOld->GetMFTData()) SetMFTData(fESDOld->GetMFTData());
+    #endif
 
   }// if fesdold
 }
@@ -1806,3 +1866,21 @@ AliEventplane* AliESDEvent::GetEventplane()
     if (!fEventplane) fEventplane = new AliEventplane();
     return  fEventplane;
 }
+
+Float_t AliESDEvent::GetVZEROEqMultiplicity(Int_t i) const
+{
+  // Get VZERO Multiplicity for channel i
+  // Themethod uses the equalization factors
+  // stored in the ESD-run object in order to
+  // get equal multiplicities within a VZERO rins (1/8 of VZERO)
+  if (!fESDVZERO || !fESDRun) return -1;
+
+  Int_t ring = i/8;
+  Float_t factorSum = 0;
+  for(Int_t j = 8*ring; j < (8*ring+8); ++j) {
+    factorSum += fESDRun->GetVZEROEqFactors(j);
+  }
+  Float_t factor = fESDRun->GetVZEROEqFactors(i)*8./factorSum;
+
+  return (fESDVZERO->GetMultiplicity(i)/factor);
+}