fca's changes -- take shelter -- optimising AOD tree handling
authorfca <fca@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 15 Apr 2011 08:45:41 +0000 (08:45 +0000)
committerfca <fca@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 15 Apr 2011 08:45:41 +0000 (08:45 +0000)
ANALYSIS/AliAnalysisSelector.cxx
STEER/AliAODEvent.cxx

index 5896e7f..4379c2f 100644 (file)
@@ -141,7 +141,13 @@ Bool_t AliAnalysisSelector::Process(Long64_t entry)
    if (fAnalysis->GetDebugLevel() > 1) {
       cout << "->AliAnalysisSelector::Process()" << endl;
    }
-   Int_t nobjCount = TProcessID::GetObjectCount();
+   static Bool_t init=kTRUE;
+   static Int_t nobjCount = 0;
+   if(init) {
+     nobjCount = TProcessID::GetObjectCount();
+     init=kFALSE;
+   }
+   TProcessID::SetObjectCount(nobjCount);
    Int_t returnCode = fAnalysis->GetEntry(entry);
    if (returnCode <= 0) {
       cout << "Error retrieving event:" << entry << " Skipping ..." << endl;
@@ -153,7 +159,6 @@ Bool_t AliAnalysisSelector::Process(Long64_t entry)
       fAnalysis->ExecAnalysis();
       if (returnCode<100000000) fAnalysis->CountEvent(1,1,0,0);
    }   
-   TProcessID::SetObjectCount(nobjCount);
    if (fAnalysis->GetDebugLevel() > 1) {
       cout << "<-AliAnalysisSelector::Process()" << endl;
    }   
index b6dde64..2a9111c 100644 (file)
@@ -216,14 +216,8 @@ AliAODEvent & AliAODEvent::operator=(const AliAODEvent& aod) {
 AliAODEvent::~AliAODEvent() 
 {
 // destructor
-    if(fAODObjects&&!fConnected)
-    {
-       delete fAODObjects;
-       fAODObjects = 0;
-    }
-
+    if(!fConnected) delete fAODObjects;
     delete fAODFolder;
-    fAODFolder = 0;
 }
 
 //______________________________________________________________________________
@@ -559,7 +553,7 @@ void AliAODEvent::ReadFromTree(TTree *tree, Option_t* opt /*= ""*/)
     TList* connectedList = (TList*) (tree->GetUserInfo()->FindObject("AODObjectsConnectedToTree"));
     if (connectedList && (strcmp(opt, "reconnect"))) {
         // If connected use the connected list of objects
-       fAODObjects->Delete();
+        delete fAODObjects;
        fAODObjects = connectedList;
        GetStdContent(); 
        fConnected = kTRUE;
@@ -571,7 +565,8 @@ void AliAODEvent::ReadFromTree(TTree *tree, Option_t* opt /*= ""*/)
     
       // create a new TList from the UserInfo TList... 
       // copy constructor does not work...
-    fAODObjects = (TList*)(aodEvent->GetList()->Clone());
+    //    fAODObjects = (TList*)(aodEvent->GetList()->Clone());
+    fAODObjects = (TList*)aodEvent->GetList();
     fAODObjects->SetOwner(kTRUE);
     if(fAODObjects->GetEntries()<kAODListN)
     {
@@ -591,7 +586,8 @@ void AliAODEvent::ReadFromTree(TTree *tree, Option_t* opt /*= ""*/)
           printf("No UserInfo on tree \n");
         } else {
           
-          TList* objL = (TList*)(aodEvent->GetList()->Clone());
+         //          TList* objL = (TList*)(aodEvent->GetList()->Clone());
+          TList* objL = (TList*)aodEvent->GetList();
           printf("Get list of object from tree %d !!\n", objL->GetEntries());
           TIter nextobject(objL);
           TObject* obj =  0;