- Changes in the calibration framework to write the filtered friends in a
authorzampolli <zampolli@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 10 Mar 2010 15:41:52 +0000 (15:41 +0000)
committerzampolli <zampolli@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 10 Mar 2010 15:41:52 +0000 (15:41 +0000)
separate tree.
- Change of the name of the friends tree (esdTree --> esdFriendTree).
- Warning suppressed.

ANALYSIS/ANALYSIScalibLinkDef.h
ANALYSIS/AliAnalysisTaskFilter.cxx
ANALYSIS/AliAnalysisTaskFilter.h
ANALYSIS/AliAnalysisTaskFilterFriend.cxx
ANALYSIS/AliAnalysisTaskFilterFriendSecond.cxx
ANALYSIS/libANALYSIScalib.pkg
STEER/AliESDHandler.cxx
STEER/AliESDHandler.h
STEER/AliESDInputHandler.cxx
STEER/AliReconstruction.cxx

index 88aed78..57b4d2c 100644 (file)
@@ -4,7 +4,7 @@
 #pragma link off all classes;
 #pragma link off all functions;
 
-#pragma link C++ class AliAnalysisTaskCopyESD+;
+//#pragma link C++ class AliAnalysisTaskCopyESD+;
 #pragma link C++ class AliAnalysisTaskFilter+;
 #pragma link C++ class AliAnalysisTaskFilterFriend+;
 #pragma link C++ class AliAnalysisTaskFilterFriendSecond+;
index ce9e98f..64907db 100644 (file)
@@ -48,9 +48,8 @@ AliAnalysisTaskFilter::AliAnalysisTaskFilter():
        fEntry(0),
        fInputEvent(0x0),
        fInputHandler(0x0),
-       fOutputESD(0x0),
        fOutputESDfriend(0x0),
-       fTreeE(0x0)
+       fTreeEF(0x0)
 {
        //
        // Default constructor
@@ -65,9 +64,8 @@ AliAnalysisTaskFilter::AliAnalysisTaskFilter(const char* name):
        fEntry(0),
        fInputEvent(0x0),
        fInputHandler(0x0),
-       fOutputESD(0x0),
        fOutputESDfriend(0x0),
-       fTreeE(0x0)
+       fTreeEF(0x0)
 {
        //
        // Default constructor
@@ -85,9 +83,8 @@ AliAnalysisTaskFilter::AliAnalysisTaskFilter(const AliAnalysisTaskFilter& obj):
        fEntry(0),
        fInputEvent(0x0),
        fInputHandler(0x0),
-       fOutputESD(0x0),
        fOutputESDfriend(0x0),
-       fTreeE(0x0)
+       fTreeEF(0x0)
 {
        //
        // Copy constructor
@@ -97,9 +94,8 @@ AliAnalysisTaskFilter::AliAnalysisTaskFilter(const AliAnalysisTaskFilter& obj):
        fEntry        = obj.fEntry;
        fInputEvent   = obj.fInputEvent;
        fInputHandler = obj.fInputHandler;
-       fOutputESD    = obj.fOutputESD;
        fOutputESDfriend = obj.fOutputESDfriend;
-       fTreeE        = obj.fTreeE;    
+       fTreeEF        = obj.fTreeEF;    
 }
 
 
@@ -116,9 +112,8 @@ AliAnalysisTaskFilter& AliAnalysisTaskFilter::operator=(const AliAnalysisTaskFil
        fEntry        = other.fEntry;
        fInputEvent   = other.fInputEvent;
        fInputHandler = other.fInputHandler;
-       fOutputESD    = other.fOutputESD;
        fOutputESDfriend = other.fOutputESDfriend;
-       fTreeE        = other.fTreeE;    
+       fTreeEF        = other.fTreeEF;    
        return *this;
 }
 
@@ -155,9 +150,7 @@ void AliAnalysisTaskFilter::CreateOutputObjects()
        AliESDHandler* handler = (AliESDHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
     
        if (handler) {
-               fOutputESD   = handler->GetESD();
-               fTreeE = handler->GetTree();
-               fOutputESD->GetStdContent();
+               fTreeEF = handler->GetTree();
        }
        else {
                AliWarning("No AOD Event Handler connected.") ; 
@@ -191,10 +184,15 @@ void AliAnalysisTaskFilter::Exec(Option_t* option)
                fOutputESDfriend   = handler->GetESDfriend();
                UserExec(option);
        }
+       else {
+         // Set null pointer
+         fOutputESDfriend = 0x0;
+
+       }
 
        // Added protection in case the derived task is not an AOD producer.
        AliAnalysisDataSlot *out0 = GetOutputSlot(0);
-       if (out0 && out0->IsConnected()) PostData(0, fTreeE);    
+       if (out0 && out0->IsConnected()) PostData(0, fTreeEF);    
 }
 
 //______________________________________________________________________
index f13889c..552cd8a 100644 (file)
@@ -45,9 +45,8 @@ class AliAnalysisTaskFilter : public AliAnalysisTask
        // Getters
        virtual Int_t         DebugLevel()  {return fDebug;     }
        virtual AliVEvent*    InputEvent()  {return fInputEvent;}
-       virtual AliESDEvent*  ESDEvent()    {return fOutputESD; }
        virtual AliESDfriend* ESDfriend()   {return fOutputESDfriend; }
-       virtual TTree*        OutputTree()  {return fTreeE;     }
+       virtual TTree*        OutputTree()  {return fTreeEF;     }
        virtual Long64_t      Entry()       {return fEntry;     }
        virtual const char*   CurrentFileName();
 
@@ -59,11 +58,10 @@ class AliAnalysisTaskFilter : public AliAnalysisTask
        Int_t                 fEntry;           //  Current entry in the chain
        AliVEvent*            fInputEvent;      //! VEvent Input
        AliInputEventHandler* fInputHandler;    //! Input Handler
-       AliESDEvent*          fOutputESD;       //! ESD out 
        AliESDfriend*         fOutputESDfriend; //! ESD friend out 
-       TTree*                fTreeE;           //  ESD output Tree
+       TTree*                fTreeEF;          //  ESD friend output Tree
        
-       ClassDef(AliAnalysisTaskFilter, 1); // Analysis task for filtering friends
+       ClassDef(AliAnalysisTaskFilter, 2); // Analysis task for filtering friends
 };
 
 #endif
index 628cde3..5eab6a8 100644 (file)
@@ -110,11 +110,9 @@ void AliAnalysisTaskFilterFriend::UserExec(Option_t */*option*/)
                return;
        } 
        // attach ESDfriend
-       AliESDEvent* esdEventOutput = (AliESDEvent*)ESDEvent();
        
        AliESDfriend* esdFriendOutput = (AliESDfriend*)ESDfriend();  
        AliInfo(Form("Number of ESD tracks in input = %d ",fESDInput->GetNumberOfTracks()));
-       AliInfo(Form("Number of ESD tracks in output = %d ",esdEventOutput->GetNumberOfTracks()));
        AliInfo(Form("Number of tracks in input friends = %d ",fESDfriendInput->GetNumberOfTracks()));
        AliInfo(Form("Number of tracks in output friendsNew before filtering = %d ",esdFriendOutput->GetNumberOfTracks()));
        
@@ -124,7 +122,6 @@ void AliAnalysisTaskFilterFriend::UserExec(Option_t */*option*/)
                if (i%2 ==0){
                        // keep friend
                        AliInfo(Form("Keeping %d-th track",i));
-                       esdEventOutput->GetTrack(i);
                        AliESDfriendTrack* tOld = (AliESDfriendTrack*)fESDfriendInput->GetTrack(i);
                        AliDebug(2,Form("1P of the %d-th track = %f",i,tOld->Get1P()));
                        AliInfo(Form("1P of the %d-th track = %f",i,tOld->Get1P()));
index 2deceb8..6012dec 100644 (file)
@@ -110,11 +110,9 @@ void AliAnalysisTaskFilterFriendSecond::UserExec(Option_t */*option*/)
                return;
        } 
        // attach ESDfriend
-       AliESDEvent* esdEventOutput = (AliESDEvent*)ESDEvent();
        
        AliESDfriend* esdFriendOutput = (AliESDfriend*)ESDfriend();  
        AliInfo(Form("Number of ESD tracks in input = %d ",fESDInput->GetNumberOfTracks()));
-       AliInfo(Form("Number of ESD tracks in output = %d ",esdEventOutput->GetNumberOfTracks()));
        AliInfo(Form("Number of tracks in input friends = %d ",fESDfriendInput->GetNumberOfTracks()));
        AliInfo(Form("Number of tracks in output friendsNew before filtering = %d ",esdFriendOutput->GetNumberOfTracks()));
        
@@ -124,7 +122,6 @@ void AliAnalysisTaskFilterFriendSecond::UserExec(Option_t */*option*/)
                if (i%3 == 0){
                        // keep friend
                        AliInfo(Form("Keeping %d-th track",i));
-                       esdEventOutput->GetTrack(i);
                        AliESDfriendTrack* tOld = (AliESDfriendTrack*)fESDfriendInput->GetTrack(i);
                        AliDebug(2,Form("1P of the %d-th track = %f",i,tOld->Get1P()));
                        AddFriendTrackAt(tOld,i);
index 13fab97..0f84553 100644 (file)
@@ -1,6 +1,6 @@
 #-*- Mode: Makefile -*-
 
-SRCS =         AliAnalysisTaskCopyESD.cxx \
+SRCS =         \
        AliAnalysisTaskFilter.cxx \
        AliAnalysisTaskFilterFriend.cxx \
        AliAnalysisTaskFilterFriendSecond.cxx \
index 37f7f14..72519f9 100644 (file)
@@ -39,12 +39,10 @@ ClassImp(AliESDHandler)
 //______________________________________________________________________________
 AliESDHandler::AliESDHandler() :
        AliVEventHandler(),
-       fESDEvent(NULL),
        fesdf(NULL),
-       fTreeE(NULL),
-       fFileE(NULL),
+       fTreeEF(NULL),
        fFileEF(NULL),
-       fFileName("")
+       fFileName("AliESDfriends_v2.root")
 {
        // default constructor
 }
@@ -52,12 +50,10 @@ AliESDHandler::AliESDHandler() :
 //______________________________________________________________________________
 AliESDHandler::AliESDHandler(const char* name, const char* title):
        AliVEventHandler(name, title),
-       fESDEvent(NULL),
        fesdf(NULL),
-       fTreeE(NULL),
-       fFileE(NULL),
+       fTreeEF(NULL),
        fFileEF(NULL),
-       fFileName("")
+       fFileName("AliESDfriends_v2.root")
 {
 
        // constructor with name and title
@@ -68,19 +64,13 @@ AliESDHandler::AliESDHandler(const char* name, const char* title):
 AliESDHandler::~AliESDHandler() 
 {
        // Destructor.
-       delete fESDEvent;
        delete fesdf;
-       if(fFileE){
-               // is already handled in TerminateIO
-               fFileE->Close();
-               delete fFileE;
-       }
        if(fFileEF){
                // is already handled in TerminateIO
                fFileEF->Close();
                delete fFileEF;
        }
-       delete fTreeE;
+       delete fTreeEF;
 }
 
 //______________________________________________________________________________
@@ -94,18 +84,26 @@ Bool_t AliESDHandler::Init(Option_t* opt)
        TString option(opt);
        option.ToLower();
        TDirectory *owd = gDirectory;
+
+       fesdf = new AliESDfriend();
+
+       // Open the file with friends
        if (option.Contains("proof")) {
                // proof
                // Merging via files. Need to access analysis manager via interpreter.
                gROOT->ProcessLine(Form("AliAnalysisManager::GetAnalysisManager()->OpenProofFile(\"%s\", \"RECREATE\");", fFileName.Data()));
                gROOT->ProcessLine(Form("AliAnalysisManager::GetAnalysisManager()->GetCommonOutputContainer()->SetFile((TFile*)0x%lx);", gFile));
-               fFileE = gFile;
+               fFileEF = gFile;
        } else {
                // local and grid
-               fFileE = new TFile(fFileName.Data(), "RECREATE");
+               fFileEF = new TFile(fFileName.Data(), "RECREATE");
        }
-       CreateTree(1);
-       CreateFriends(1);
+
+       // Create the friends tree
+       fFileEF->cd();
+       fTreeEF = new TTree("esdFriendTree", "Tree with ESD friends");
+       fTreeEF->Branch("ESDfriend.","AliESDfriend", &fesdf);
+
        owd->cd();
        
        return kTRUE;
@@ -122,7 +120,6 @@ Bool_t AliESDHandler::FinishEvent()
        FillTree();
        
        // resetting
-       fESDEvent->Reset();
        fesdf->~AliESDfriend();
        new(fesdf) AliESDfriend();  
        return kTRUE;
@@ -135,7 +132,6 @@ Bool_t AliESDHandler::Terminate()
        // Terminate 
        //
 
-       AddESDtoTreeUserInfo();
        return kTRUE;
 }
 
@@ -146,43 +142,17 @@ Bool_t AliESDHandler::TerminateIO()
        // Terminate IO
        //
 
-       if (fFileE) {
-               fFileE->cd();
-               fTreeE->Write();
-               fFileE->Close();
-               delete fFileE;
-               fFileE = 0;
+       if (fFileEF) {
+               fFileEF->cd();
+               fTreeEF->Write();
+               fFileEF->Close();
+               delete fFileEF;
+               fFileEF = 0;
        }
 
        return kTRUE;
 }
 
-
-//______________________________________________________________________________
-void AliESDHandler::CreateTree(Int_t /*flag*/)
-{
-       //
-       // Creates the ESD Tree
-       // 
-
-       fTreeE = new TTree("esdTree", "AliESD tree");
-       // Create the ESDevent object
-       if(!fESDEvent){
-               fESDEvent = new AliESDEvent();
-               fESDEvent->CreateStdContent();
-       }
-       fESDEvent->WriteToTree(fTreeE);
-}
-//______________________________________________________________________________
-void AliESDHandler::CreateFriends(Int_t /*flag*/)
-{
-       fesdf = new AliESDfriend();
-
-       TBranch *br=fTreeE->Branch("ESDfriend.","AliESDfriend", &fesdf);
-       br->SetFile("AliESDfriends_v1.root");
-       fESDEvent->AddObject(fesdf);
-}
-
 //______________________________________________________________________________
 void AliESDHandler::FillTree()
 {
@@ -192,19 +162,7 @@ void AliESDHandler::FillTree()
 
        AliDebug(2,Form("number of friend tracks = %d\n",fesdf->GetNumberOfTracks()));
 
-       fFileE->cd();
-       fTreeE->Fill();
+       fFileEF->cd();
+       fTreeEF->Fill();
 }
 
-//______________________________________________________________________________
-void AliESDHandler::AddESDtoTreeUserInfo()
-{
-       //
-       // Add aod event to tree user info
-       //
-
-       fTreeE->GetUserInfo()->Add(fESDEvent);
-}
-
-
-
index 072180b..fc50b51 100644 (file)
@@ -35,26 +35,20 @@ class AliESDHandler : public AliVEventHandler {
        virtual Bool_t Terminate();
        virtual Bool_t TerminateIO();
        
-       AliESDEvent* GetESD()  {return fESDEvent;}
        AliESDfriend* GetESDfriend()  {return fesdf;}
-       virtual TTree* GetTree() const {return fTreeE;}
-       void CreateTree(Int_t flag);
-       void CreateFriends(Int_t flag);
+       virtual TTree* GetTree() const {return fTreeEF;}
        void FillTree();
-       void AddESDtoTreeUserInfo();
        void SetInputTree(TTree* /*tree*/) {;}
  private:
 
        AliESDHandler(const AliESDHandler&);             // Not implemented
        AliESDHandler& operator=(const AliESDHandler&);  // Not implemented
        
-       AliESDEvent* fESDEvent; //! Pointer to the ESD event
        AliESDfriend* fesdf;    //! Pointer to the ESD friend
-       TTree* fTreeE;          //! tree for ESD persistency
-       TFile* fFileE;          //! Output file
+       TTree* fTreeEF;         //! Output tree for friends
        TFile* fFileEF;         //! Output file for friends
-       TString fFileName;      //  Output file name
+       TString fFileName;      //!  Output file name for friends
        
-    ClassDef(AliESDHandler, 1)
+    ClassDef(AliESDHandler, 2)
 };
 #endif
index 7ed03ea..a2eb102 100644 (file)
@@ -100,7 +100,7 @@ Bool_t AliESDInputHandler::Init(TTree* tree,  Option_t* opt)
       esdTreeFName = (theTree->GetCurrentFile())->GetName();
       esdFriendTreeFName = esdTreeFName;
       esdFriendTreeFName.ReplaceAll("AliESDs.root", "AliESDfriends.root");
-      theTree->AddFriend("esdTree", esdFriendTreeFName.Data());
+      theTree->AddFriend("esdFriendTree", esdFriendTreeFName.Data());
     }
 
     if (!fEvent) fEvent = new AliESDEvent();
index b533fe8..3c82b76 100644 (file)
@@ -1508,9 +1508,9 @@ void AliReconstruction::SlaveBegin(TTree*)
   fesd->WriteToTree(ftree);
   if (fWriteESDfriend) {
     ffileF = TFile::Open("AliESDfriends.root", "RECREATE");
-    ftreeF = new TTree("esdTree", "Tree with ESD Friend objects");
+    ftreeF = new TTree("esdFriendTree", "Tree with ESD Friend objects");
     fesdf  = new AliESDfriend();
-    TBranch *br=ftreeF->Branch("ESDfriend.","AliESDfriend", &fesdf);
+    ftreeF->Branch("ESDfriend.","AliESDfriend", &fesdf);
     fesd->AddObject(fesdf);
     ffile->cd();
   }