ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/TreeFiller/src/FillerCaloMet.cc
Revision: 1.1
Committed: Mon Jul 7 16:13:22 2008 UTC (16 years, 10 months ago) by loizides
Content type: text/plain
Branch: MAIN
Log Message:
Added fillers for Jet and Met

File Contents

# User Rev Content
1 loizides 1.1 // $Id: FillerTracks.cc,v 1.4 2008/07/03 07:56:14 loizides Exp $
2    
3     #include "MitProd/TreeFiller/interface/FillerCaloMet.h"
4     #include "FWCore/MessageLogger/interface/MessageLogger.h"
5     #include "DataFormats/Common/interface/Handle.h"
6     #include "DataFormats/METReco/interface/CaloMET.h"
7     #include "MitAna/DataTree/interface/Names.h"
8    
9     using namespace std;
10     using namespace edm;
11     using namespace mithep;
12    
13     //--------------------------------------------------------------------------------------------------
14     FillerCaloMet::FillerCaloMet(const ParameterSet &cfg, const char *name, bool active) :
15     BaseFiller(cfg, name, active),
16     edmName_(Conf().getUntrackedParameter<string>("edmName","")),
17     mitName_(Conf().getUntrackedParameter<string>("mitName",Names::gkCaloJetBrn)),
18     mets_(new mithep::MetArr)
19     {
20     // Constructor.
21     }
22    
23     //--------------------------------------------------------------------------------------------------
24     FillerCaloMet::~FillerCaloMet()
25     {
26     // Destructor.
27    
28     delete mets_;
29     }
30    
31     //--------------------------------------------------------------------------------------------------
32     void FillerCaloMet::BookDataBlock(TreeWriter &tws)
33     {
34     // Add mets branch to tree.
35    
36     tws.AddBranch(mitName_.c_str(),&mets_);
37     }
38    
39     //--------------------------------------------------------------------------------------------------
40     void FillerCaloMet::FillDataBlock(const edm::Event &event,
41     const edm::EventSetup &setup)
42     {
43     // Fill missing energy from edm collection into our collection.
44    
45     mets_->Reset();
46    
47     try {
48     event.getByLabel(edm::InputTag(edmName_),metProduct_);
49     } catch (cms::Exception &ex) {
50     edm::LogError("FillerCaloMet") << "Error! Cannot get collection with label "
51     << edmName_ << endl;
52     throw edm::Exception(edm::errors::Configuration, "FillerCaloMet:FillDataBlock()\n")
53     << "Error! Cannot get collection with label " << edmName_ << endl;
54     }
55    
56     const reco::CaloMETCollection inMets = *(metProduct_.product());
57    
58     // loop through all mets
59     for (reco::CaloMETCollection::const_iterator inMet = inMets.begin();
60     inMet != inMets.end(); ++inMet) {
61    
62     mithep::Met *jet = mets_->Allocate();
63     }
64    
65     mets_->Trim();
66    
67     }