ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/TreeService/src/TreeService.cc
(Generate patch)

Comparing UserCode/MitProd/TreeService/src/TreeService.cc (file contents):
Revision 1.8 by loizides, Thu Jul 3 08:25:12 2008 UTC vs.
Revision 1.10 by loizides, Mon Oct 6 15:56:51 2008 UTC

# Line 15 | Line 15 | using namespace mithep;
15  
16   //--------------------------------------------------------------------------------------------------
17   TreeService::TreeService(const ParameterSet &cfg, ActivityRegistry &ar) :
18 <  tws_(0)
18 >  tws_(0),
19 >  fDoReset_(cfg.getUntrackedParameter<bool>("doReset",1))
20   {
21    // Constructor.
22  
# Line 68 | Line 69 | TreeService::TreeService(const Parameter
69    // init tree writers
70    for (unsigned int i=0; i<treeNames_.size(); ++i) {
71  
72 <    TreeWriter *t = new TreeWriter(treeNames_.at(i).c_str(),1);
72 >    TreeWriter *t = new TreeWriter(treeNames_.at(i).c_str(),0);
73      t->SetPrefix(fileNames_.at(i).c_str());
74  
75      if (i<pathNames_.size())
# Line 114 | Line 115 | TreeService::~TreeService()
115   }
116  
117   //--------------------------------------------------------------------------------------------------
118 < TreeWriter* TreeService::get(const char *name)
118 > TreeWriter *TreeService::get(const char *name)
119   {
120    // Get TreeWriter by name. If no name given, first one will be returned.
121  
# Line 150 | Line 151 | void TreeService::postEventProcessing(co
151  
152    for (int i=0; i<tws_.GetEntries(); ++i) {
153      TreeWriter *tw=dynamic_cast<TreeWriter*>(tws_.At(i));
154 <    if (tw)
155 <      tw->EndEvent();
154 >    if (tw) {
155 >      if (i<tws_.GetEntries()-1)
156 >        tw->EndEvent();
157 >      else // make sure objects are only reset at the end (if at all)
158 >        tw->EndEvent(fDoReset_);
159 >    }
160    }
161   }
162  
# Line 162 | Line 167 | void TreeService::preEventProcessing(con
167  
168    for (int i=0; i<tws_.GetEntries(); ++i) {
169      TreeWriter *tw=dynamic_cast<TreeWriter*>(tws_.At(i));
170 <    if (tw)
171 <      tw->BeginEvent();
170 >    if (tw) {
171 >      if (i==0) // make sure objects are only reset at the beginning (if at all)
172 >        tw->BeginEvent(fDoReset_);
173 >      else
174 >        tw->BeginEvent();
175 >    }
176    }
177   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines