ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/TreeFiller/src/FillerPileupEnergyDensity.cc
Revision: 1.4
Committed: Wed Jun 15 20:04:14 2011 UTC (13 years, 10 months ago) by bendavid
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_026, Mit_025e, Mit_025d, Mit_025c, Mit_025b, Mit_025a, Mit_025, Mit_025pre2, Mit_024b, Mit_025pre1, Mit_024a, Mit_024, Mit_023, Mit_022a, Mit_022
Branch point for: Mit_025c_branch
Changes since 1.3: +15 -5 lines
Log Message:
new and more variations of rho

File Contents

# User Rev Content
1 bendavid 1.4 // $Id: FillerPileupEnergyDensity.cc,v 1.3 2011/03/23 19:03:46 mzanetti Exp $
2 mzanetti 1.1
3     #include "MitProd/TreeFiller/interface/FillerPileupEnergyDensity.h"
4     #include "FWCore/MessageLogger/interface/MessageLogger.h"
5     #include "DataFormats/Common/interface/Handle.h"
6     #include "MitAna/DataTree/interface/Names.h"
7     #include "MitAna/DataTree/interface/PileupEnergyDensityCol.h"
8     #include "MitProd/ObjectService/interface/ObjectService.h"
9    
10     using namespace std;
11     using namespace edm;
12     using namespace mithep;
13    
14     //--------------------------------------------------------------------------------------------------
15     FillerPileupEnergyDensity::FillerPileupEnergyDensity(const ParameterSet &cfg, const char *name, bool active) :
16     BaseFiller(cfg,name,active),
17 mzanetti 1.2 //edmName_(Conf().getUntrackedParameter<string>("edmName","kt6PFJets")),
18     edmName_(Conf().getUntrackedParameter<edm::InputTag>("edmName")),
19 bendavid 1.4 edmNameLowEta_(Conf().getUntrackedParameter<edm::InputTag>("edmNameLowEta")),
20     edmNameRandom_(Conf().getUntrackedParameter<edm::InputTag>("edmNameRandom")),
21     edmNameRandomLowEta_(Conf().getUntrackedParameter<edm::InputTag>("edmNameRandomLowEta")),
22 mzanetti 1.1 mitName_(Conf().getUntrackedParameter<string>("mitName",Names::gkPileupEnergyDensityBrn)),
23     rhos_(new mithep::PileupEnergyDensityArr)
24     {
25     // Constructor.
26     }
27    
28     //--------------------------------------------------------------------------------------------------
29     FillerPileupEnergyDensity::~FillerPileupEnergyDensity()
30     {
31     // Destructor.
32    
33     delete rhos_;
34     }
35    
36     //--------------------------------------------------------------------------------------------------
37     void FillerPileupEnergyDensity::BookDataBlock(TreeWriter &tws)
38     {
39     // Add pileup branch to tree.
40     tws.AddBranch(mitName_,&rhos_);
41     OS()->add<mithep::PileupEnergyDensityArr>(rhos_,mitName_);
42     }
43    
44     //--------------------------------------------------------------------------------------------------
45     void FillerPileupEnergyDensity::FillDataBlock(const edm::Event &event,
46     const edm::EventSetup &setup)
47     {
48     // Fill missing energy from edm collection into our collection.
49    
50     rhos_->Delete();
51    
52 mzanetti 1.2 // Handle<double> hRho;
53     // GetProduct(edmName_, hRho, event);
54    
55 mzanetti 1.1 Handle<double> hRho;
56 mzanetti 1.2 event.getByLabel(edmName_,hRho);
57 mzanetti 1.1
58 bendavid 1.4 Handle<double> hRhoLowEta;
59     event.getByLabel(edmNameLowEta_,hRhoLowEta);
60    
61     Handle<double> hRhoRandom;
62     event.getByLabel(edmNameRandom_,hRhoRandom);
63    
64     Handle<double> hRhoRandomLowEta;
65     event.getByLabel(edmNameRandomLowEta_,hRhoRandomLowEta);
66 mzanetti 1.3
67 mzanetti 1.1 mithep::PileupEnergyDensity *rho = rhos_->AddNew();
68    
69     rho->SetRho(*hRho);
70 bendavid 1.4 rho->SetRhoLowEta(*hRhoLowEta);
71     rho->SetRhoRandom(*hRhoRandom);
72     rho->SetRhoRandomLowEta(*hRhoRandomLowEta);
73 mzanetti 1.1
74     rhos_->Trim();
75     }