]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/STEERBase/AliInputEventHandler.cxx
Merge branch 'master' into TPCdev
[u/mrichter/AliRoot.git] / STEER / STEERBase / AliInputEventHandler.cxx
CommitLineData
76147823 1/**************************************************************************
2 * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16/* $Id$ */
17
18//-------------------------------------------------------------------------
19// Event handler for event input
20// Author: Andreas Morsch, CERN
21//-------------------------------------------------------------------------
22
76147823 23
24#include "AliInputEventHandler.h"
25#include "AliVEvent.h"
b2af62ab 26#include "AliVCuts.h"
f16ba708 27#include "AliLog.h"
76147823 28
b2af62ab 29
76147823 30ClassImp(AliInputEventHandler)
31
32//______________________________________________________________________________
33AliInputEventHandler::AliInputEventHandler() :
13054f41 34 AliVEventHandler(),
f16ba708 35 fTree(0),
fdbaa4ce 36 fBranches(),
37 fBranchesOn(),
38 fInputFileName(),
b2af62ab 39 fNewEvent(kTRUE),
40 fEventCuts(0),
b890a10d 41 fIsSelectedResult(0),
7af7146c 42 fMixingHandler(0),
4cf1e5f2 43 fParentHandler(0),
44 fUserInfo(0)
76147823 45{
46 // default constructor
47}
48
49//______________________________________________________________________________
50AliInputEventHandler::~AliInputEventHandler()
51{
52// destructor
53}
54
55//______________________________________________________________________________
56AliInputEventHandler::AliInputEventHandler(const char* name, const char* title):
fdbaa4ce 57 AliVEventHandler(name, title),
58 fTree(0),
59 fBranches(),
60 fBranchesOn(),
61 fInputFileName(),
62 fNewEvent(kTRUE),
63 fEventCuts(0),
64 fIsSelectedResult(0),
65 fMixingHandler(0),
66 fParentHandler(0),
67 fUserInfo(0)
76147823 68{
70908d05 69// Named constructor.
76147823 70}
71
fdbaa4ce 72//______________________________________________________________________________
f16ba708 73void AliInputEventHandler::SwitchOffBranches() const {
74 //
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)
81 continue;
82 fTree->SetBranchStatus(Form("%s%s%s","*", str.Data(), "*"), 0);
e06036ee 83 AliDebug(1,Form("Branch %s switched off", str.Data()));
f16ba708 84 }
62e57953 85 delete tokens;
f16ba708 86}
87
fdbaa4ce 88//______________________________________________________________________________
f16ba708 89void AliInputEventHandler::SwitchOnBranches() const {
90 //
91 // Switch of branches on user request
92 TObjArray * tokens = fBranchesOn.Tokenize(" ");
93 Int_t ntok = tokens->GetEntries();
94
95 for (Int_t i = 0; i < ntok; i++) {
96 TString str = ((TObjString*) tokens->At(i))->GetString();
97 if (str.Length() == 0)
98 continue;
99 fTree->SetBranchStatus(Form("%s%s%s","*", str.Data(), "*"), 1);
e06036ee 100 AliDebug(1,Form("Branch %s switched on", str.Data()));
f16ba708 101 }
62e57953 102 delete tokens;
f16ba708 103}
f0ee78b0 104
fdbaa4ce 105//______________________________________________________________________________
70908d05 106TObject *AliInputEventHandler::GetStatistics(Option_t *) const
107{
108// Returns the statistics object(s) (TH2F histogram) produced by the physics
109// selection. Implementations both for ESD and AOD input handlers.
110 return NULL;
111}
112
f0ee78b0 113Long64_t AliInputEventHandler::GetReadEntry() const
70908d05 114{
115 // Get the current entry.
116 return fTree->GetReadEntry();
117}
fdbaa4ce 118
119//______________________________________________________________________________
120void AliInputEventHandler::SetInputFileName(const char* fname)
121{
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());
127 return;
128 }
129 fInputFileName = fname;
130}