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.7 by loizides, Tue Jul 1 16:33:55 2008 UTC vs.
Revision 1.8 by loizides, Thu Jul 3 08:25:12 2008 UTC

# Line 14 | Line 14 | using namespace std;
14   using namespace mithep;
15  
16   //--------------------------------------------------------------------------------------------------
17 < TreeService::TreeService(const ParameterSet &cfg, ActivityRegistry &r) :
17 > TreeService::TreeService(const ParameterSet &cfg, ActivityRegistry &ar) :
18    tws_(0)
19   {
20 +  // Constructor.
21 +
22    if (cfg.exists("treeNames"))
23      treeNames_=cfg.getUntrackedParameter<vector<string>   >("treeNames");
24    else
# Line 99 | Line 101 | TreeService::TreeService(const Parameter
101    }
102  
103    // set watchers
104 <  r.watchPreProcessEvent (this,&TreeService::preEventProcessing);
105 <  r.watchPostProcessEvent(this,&TreeService::postEventProcessing);
106 <  r.watchPostBeginJob    (this,&TreeService::postBeginJob);
107 <  r.watchPostEndJob      (this,&TreeService::postEndJob);
104 >  ar.watchPreProcessEvent (this,&TreeService::preEventProcessing);
105 >  ar.watchPostProcessEvent(this,&TreeService::postEventProcessing);
106 >  ar.watchPostBeginJob    (this,&TreeService::postBeginJob);
107 >  ar.watchPostEndJob      (this,&TreeService::postEndJob);
108   }
109  
110   //--------------------------------------------------------------------------------------------------
111   TreeService::~TreeService()
112   {
113 +  // Destructor.
114   }
115  
116   //--------------------------------------------------------------------------------------------------
117   TreeWriter* TreeService::get(const char *name)
118   {
119 +  // Get TreeWriter by name. If no name given, first one will be returned.
120 +
121    if (tws_.GetEntries()<=0)
122      return 0;
123  
# Line 127 | Line 132 | TreeWriter* TreeService::get(const char
132   //--------------------------------------------------------------------------------------------------
133   void TreeService::postBeginJob()
134   {
135 <  // nothing to be done for now
135 >  // Nothing to be done for now
136   }
137  
138   //--------------------------------------------------------------------------------------------------
139   void TreeService::postEndJob()
140   {
141 +  // Clear all TreeWriter objects.
142 +
143    tws_.Clear();
144   }
145  
146   //--------------------------------------------------------------------------------------------------
147   void TreeService::postEventProcessing(const Event&, const EventSetup&)
148   {
149 +  // Loop over all TreeWriter objects before processing of an event.
150 +
151    for (int i=0; i<tws_.GetEntries(); ++i) {
152      TreeWriter *tw=dynamic_cast<TreeWriter*>(tws_.At(i));
153      if (tw)
# Line 149 | Line 158 | void TreeService::postEventProcessing(co
158   //--------------------------------------------------------------------------------------------------
159   void TreeService::preEventProcessing(const EventID&, const Timestamp&)
160   {
161 +  // Loop over all TreeWriter objects after processing of a events.
162 +
163    for (int i=0; i<tws_.GetEntries(); ++i) {
164      TreeWriter *tw=dynamic_cast<TreeWriter*>(tws_.At(i));
165      if (tw)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines