separate tree.
- Change of the name of the friends tree (esdTree --> esdFriendTree).
- Warning suppressed.
#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+;
fEntry(0),
fInputEvent(0x0),
fInputHandler(0x0),
- fOutputESD(0x0),
fOutputESDfriend(0x0),
- fTreeE(0x0)
+ fTreeEF(0x0)
{
//
// Default constructor
fEntry(0),
fInputEvent(0x0),
fInputHandler(0x0),
- fOutputESD(0x0),
fOutputESDfriend(0x0),
- fTreeE(0x0)
+ fTreeEF(0x0)
{
//
// Default constructor
fEntry(0),
fInputEvent(0x0),
fInputHandler(0x0),
- fOutputESD(0x0),
fOutputESDfriend(0x0),
- fTreeE(0x0)
+ fTreeEF(0x0)
{
//
// Copy constructor
fEntry = obj.fEntry;
fInputEvent = obj.fInputEvent;
fInputHandler = obj.fInputHandler;
- fOutputESD = obj.fOutputESD;
fOutputESDfriend = obj.fOutputESDfriend;
- fTreeE = obj.fTreeE;
+ fTreeEF = obj.fTreeEF;
}
fEntry = other.fEntry;
fInputEvent = other.fInputEvent;
fInputHandler = other.fInputHandler;
- fOutputESD = other.fOutputESD;
fOutputESDfriend = other.fOutputESDfriend;
- fTreeE = other.fTreeE;
+ fTreeEF = other.fTreeEF;
return *this;
}
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.") ;
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);
}
//______________________________________________________________________
// 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();
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
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()));
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()));
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()));
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);
#-*- Mode: Makefile -*-
-SRCS = AliAnalysisTaskCopyESD.cxx \
+SRCS = \
AliAnalysisTaskFilter.cxx \
AliAnalysisTaskFilterFriend.cxx \
AliAnalysisTaskFilterFriendSecond.cxx \
//______________________________________________________________________________
AliESDHandler::AliESDHandler() :
AliVEventHandler(),
- fESDEvent(NULL),
fesdf(NULL),
- fTreeE(NULL),
- fFileE(NULL),
+ fTreeEF(NULL),
fFileEF(NULL),
- fFileName("")
+ fFileName("AliESDfriends_v2.root")
{
// default constructor
}
//______________________________________________________________________________
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
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;
}
//______________________________________________________________________________
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;
FillTree();
// resetting
- fESDEvent->Reset();
fesdf->~AliESDfriend();
new(fesdf) AliESDfriend();
return kTRUE;
// Terminate
//
- AddESDtoTreeUserInfo();
return kTRUE;
}
// 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()
{
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);
-}
-
-
-
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
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();
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();
}