ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/TreeFiller/src/FillMitTree.cc
Revision: 1.1
Committed: Wed Jun 18 13:23:22 2008 UTC (16 years, 10 months ago) by paus
Content type: text/plain
Branch: MAIN
Log Message:
Basic structure of Filling framework.

File Contents

# User Rev Content
1 paus 1.1 // $Id: FillMitTree.cc,v 1.2 2008/06/11 12:50:17 loizides Exp $
2    
3     #include "FWCore/MessageLogger/interface/MessageLogger.h"
4     #include "FWCore/Framework/interface/ESHandle.h"
5     #include "DataFormats/Common/interface/Handle.h"
6     #include "FWCore/ServiceRegistry/interface/Service.h"
7    
8     #include "MitProd/TreeFiller/interface/FillerGlobalMuons.h"
9     #include "MitProd/TreeFiller/interface/FillMitTree.h"
10    
11     using namespace std;
12     using namespace edm;
13     using namespace mithep;
14    
15     //-------------------------------------------------------------------------------------------------
16     FillMitTree::FillMitTree(const edm::ParameterSet &cfg) :
17     fillerGlobalMuons_(0)
18     {
19     // initialize fillers
20     fillerGlobalMuons_ = new FillerGlobalMuons(cfg);
21     if (fillerGlobalMuons_->Active())
22     fillers_.push_back(fillerGlobalMuons_);
23     }
24    
25     //-------------------------------------------------------------------------------------------------
26     FillMitTree::~FillMitTree()
27     {
28     // We own the fillers so we have to delete them
29     delete fillerGlobalMuons_;
30     }
31    
32     //-------------------------------------------------------------------------------------------------
33     void FillMitTree::beginJob(edm::EventSetup const &event)
34     {
35     Service<TreeService> ts;
36     TreeWriter *tws = ts->get();
37     if (! tws) {
38     throw edm::Exception(edm::errors::Configuration, "FillMitTree::beginJob()\n")
39     << "Could not get pointer to Tree with name " << tws->GetName() << "\n";
40     return;
41     }
42    
43     // Loop over the various components and book the branches
44     for (std::vector<BaseFiller*>::iterator iF = fillers_.begin(); iF != fillers_.end(); ++iF) {
45     (*iF)->BookDataBlock(tws);
46     }
47     return;
48     }
49    
50     //-------------------------------------------------------------------------------------------------
51     void FillMitTree::analyze(const edm::Event &event,
52     const edm::EventSetup &setup)
53     {
54     // First step: Loop over the data fillers of the various components
55     for (std::vector<BaseFiller*>::const_iterator iF = fillers_.begin(); iF != fillers_.end(); ++iF) {
56     (*iF)->FillDataBlock(event,setup);
57     }
58    
59     // Second step: Loop over the link resolution of the various components
60     for (std::vector<BaseFiller*>::const_iterator iF = fillers_.begin(); iF != fillers_.end(); ++iF) {
61     (*iF)->ResolveLinks(event,setup);
62     }
63     }
64    
65     //-------------------------------------------------------------------------------------------------
66     void FillMitTree::endJob()
67     {
68     edm::LogInfo("FillMitTree::endJob") << "Ending Job" << endl;
69     }