1 /**************************************************************************
2 * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 //-------------------------------------------------------------------------
19 // Event handler for event input
20 // Author: Andreas Morsch, CERN
21 //-------------------------------------------------------------------------
24 #include "AliInputEventHandler.h"
25 #include "AliVEvent.h"
30 ClassImp(AliInputEventHandler)
32 //______________________________________________________________________________
33 AliInputEventHandler::AliInputEventHandler() :
46 // default constructor
49 //______________________________________________________________________________
50 AliInputEventHandler::~AliInputEventHandler()
55 //______________________________________________________________________________
56 AliInputEventHandler::AliInputEventHandler(const char* name, const char* title):
57 AliVEventHandler(name, title),
72 //______________________________________________________________________________
73 void AliInputEventHandler::SwitchOffBranches() const {
75 // Switch of branches on user request
76 TObjArray * tokens = fBranches.Tokenize(" ");
77 Int_t ntok = tokens->GetEntries();
78 for (Int_t i = 0; i < ntok; i++) {
79 TString str = ((TObjString*) tokens->At(i))->GetString();
80 if (str.Length() == 0)
82 fTree->SetBranchStatus(Form("%s%s%s","*", str.Data(), "*"), 0);
83 AliDebug(1,Form("Branch %s switched off", str.Data()));
88 //______________________________________________________________________________
89 void AliInputEventHandler::SwitchOnBranches() const {
91 // Switch of branches on user request
92 TObjArray * tokens = fBranchesOn.Tokenize(" ");
93 Int_t ntok = tokens->GetEntries();
95 for (Int_t i = 0; i < ntok; i++) {
96 TString str = ((TObjString*) tokens->At(i))->GetString();
97 if (str.Length() == 0)
99 fTree->SetBranchStatus(Form("%s%s%s","*", str.Data(), "*"), 1);
100 AliDebug(1,Form("Branch %s switched on", str.Data()));
105 //______________________________________________________________________________
106 TObject *AliInputEventHandler::GetStatistics(Option_t *) const
108 // Returns the statistics object(s) (TH2F histogram) produced by the physics
109 // selection. Implementations both for ESD and AOD input handlers.
113 Long64_t AliInputEventHandler::GetReadEntry() const
115 // Get the current entry.
116 return fTree->GetReadEntry();
119 //______________________________________________________________________________
120 void AliInputEventHandler::SetInputFileName(const char* fname)
122 // Set the input file name to be analyzed. Done automatically by the manager, but
123 // in case this needs to be done at an earlier stage has to be done manually.
124 if (!strlen(fname)) return;
125 if (fInputFileName.Length()) {
126 Error("SetInputFileName", "Input file name already set to: %s\n", fInputFileName.Data());
129 fInputFileName = fname;