2 /**************************************************************************
3 * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
5 * Author: The ALICE Off-line Project. *
6 * Contributors are mentioned in the code where appropriate. *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
19 //-------------------------------------------------------------------------
21 // Implementation of the Virtual Event Handler Interface for ESD
23 //-------------------------------------------------------------------------
32 #include "AliESDHandler.h"
33 #include "AliESDEvent.h"
34 #include "AliESDfriend.h"
37 ClassImp(AliESDHandler)
39 //______________________________________________________________________________
40 AliESDHandler::AliESDHandler() :
45 fFileName("AliESDfriends_v2.root")
47 // default constructor
50 //______________________________________________________________________________
51 AliESDHandler::AliESDHandler(const char* name, const char* title):
52 AliVEventHandler(name, title),
56 fFileName("AliESDfriends_v2.root")
59 // constructor with name and title
63 //______________________________________________________________________________
64 AliESDHandler::~AliESDHandler()
69 // is already handled in TerminateIO
76 //______________________________________________________________________________
77 Bool_t AliESDHandler::Init(Option_t* opt)
83 // File opening according to execution mode
86 TDirectory *owd = gDirectory;
88 fesdf = new AliESDfriend();
90 // Open the file with friends
91 if (option.Contains("proof")) {
93 // Merging via files. Need to access analysis manager via interpreter.
94 gROOT->ProcessLine(Form("AliAnalysisManager::GetAnalysisManager()->OpenProofFile(\"%s\", \"RECREATE\");", fFileName.Data()));
95 gROOT->ProcessLine(Form("AliAnalysisManager::GetAnalysisManager()->GetCommonOutputContainer()->SetFile((TFile*)0x%lx);", gFile));
99 fFileEF = new TFile(fFileName.Data(), "RECREATE");
102 // Create the friends tree
104 fTreeEF = new TTree("esdFriendTree", "Tree with ESD friends");
105 fTreeEF->Branch("ESDfriend.","AliESDfriend", &fesdf);
113 //______________________________________________________________________________
114 Bool_t AliESDHandler::FinishEvent()
123 fesdf->~AliESDfriend();
124 new(fesdf) AliESDfriend();
128 //______________________________________________________________________________
129 Bool_t AliESDHandler::Terminate()
138 //______________________________________________________________________________
139 Bool_t AliESDHandler::TerminateIO()
156 //______________________________________________________________________________
157 void AliESDHandler::FillTree()
163 AliDebug(2,Form("number of friend tracks = %d\n",fesdf->GetNumberOfTracks()));