Line data Source code
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 :
23 :
24 : #include "AliInputEventHandler.h"
25 : #include "AliVEvent.h"
26 : #include "AliVCuts.h"
27 : #include "AliLog.h"
28 :
29 :
30 176 : ClassImp(AliInputEventHandler)
31 :
32 : //______________________________________________________________________________
33 : AliInputEventHandler::AliInputEventHandler() :
34 3 : AliVEventHandler(),
35 3 : fTree(0),
36 3 : fBranches(),
37 3 : fBranchesOn(),
38 3 : fInputFileName(),
39 3 : fNewEvent(kTRUE),
40 3 : fEventCuts(0),
41 3 : fIsSelectedResult(0),
42 3 : fMixingHandler(0),
43 3 : fParentHandler(0),
44 3 : fUserInfo(0)
45 9 : {
46 : // default constructor
47 3 : }
48 :
49 : //______________________________________________________________________________
50 : AliInputEventHandler::~AliInputEventHandler()
51 0 : {
52 : // destructor
53 0 : }
54 :
55 : //______________________________________________________________________________
56 : AliInputEventHandler::AliInputEventHandler(const char* name, const char* title):
57 0 : AliVEventHandler(name, title),
58 0 : fTree(0),
59 0 : fBranches(),
60 0 : fBranchesOn(),
61 0 : fInputFileName(),
62 0 : fNewEvent(kTRUE),
63 0 : fEventCuts(0),
64 0 : fIsSelectedResult(0),
65 0 : fMixingHandler(0),
66 0 : fParentHandler(0),
67 0 : fUserInfo(0)
68 0 : {
69 : // Named constructor.
70 0 : }
71 :
72 : //______________________________________________________________________________
73 : void AliInputEventHandler::SwitchOffBranches() const {
74 : //
75 : // Switch of branches on user request
76 6 : TObjArray * tokens = fBranches.Tokenize(" ");
77 2 : Int_t ntok = tokens->GetEntries();
78 4 : for (Int_t i = 0; i < ntok; i++) {
79 0 : TString str = ((TObjString*) tokens->At(i))->GetString();
80 0 : if (str.Length() == 0)
81 0 : continue;
82 0 : fTree->SetBranchStatus(Form("%s%s%s","*", str.Data(), "*"), 0);
83 0 : AliDebug(1,Form("Branch %s switched off", str.Data()));
84 0 : }
85 4 : delete tokens;
86 2 : }
87 :
88 : //______________________________________________________________________________
89 : void AliInputEventHandler::SwitchOnBranches() const {
90 : //
91 : // Switch of branches on user request
92 6 : TObjArray * tokens = fBranchesOn.Tokenize(" ");
93 2 : Int_t ntok = tokens->GetEntries();
94 :
95 4 : for (Int_t i = 0; i < ntok; i++) {
96 0 : TString str = ((TObjString*) tokens->At(i))->GetString();
97 0 : if (str.Length() == 0)
98 0 : continue;
99 0 : fTree->SetBranchStatus(Form("%s%s%s","*", str.Data(), "*"), 1);
100 0 : AliDebug(1,Form("Branch %s switched on", str.Data()));
101 0 : }
102 4 : delete tokens;
103 2 : }
104 :
105 : //______________________________________________________________________________
106 : TObject *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 0 : return NULL;
111 : }
112 :
113 : Long64_t AliInputEventHandler::GetReadEntry() const
114 : {
115 : // Get the current entry.
116 56 : return fTree->GetReadEntry();
117 : }
118 :
119 : //______________________________________________________________________________
120 : void 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 4 : if (!strlen(fname)) return;
125 2 : if (fInputFileName.Length()) {
126 0 : Error("SetInputFileName", "Input file name already set to: %s\n", fInputFileName.Data());
127 0 : return;
128 : }
129 2 : fInputFileName = fname;
130 4 : }
|