CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
ElectronRegressionEnergyProducer Class Reference
Inheritance diagram for ElectronRegressionEnergyProducer:
edm::EDFilter edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 ElectronRegressionEnergyProducer (const edm::ParameterSet &)
 
 ~ElectronRegressionEnergyProducer ()
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Member Functions

virtual bool filter (edm::Event &, const edm::EventSetup &)
 

Private Attributes

const CaloGeometrycaloGeometry_
 
const CaloTopologyecalTopology_
 
edm::InputTag electronTag_
 
uint32_t energyRegressionType_
 
bool geomInitialized_
 
std::string nameEnergyErrorReg_
 
std::string nameEnergyReg_
 
bool printDebug_
 
edm::InputTag recHitCollectionEB_
 
edm::InputTag recHitCollectionEE_
 
ElectronEnergyRegressionEvaluateregressionEvaluator
 
std::string regressionInputFile_
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
typedef WorkerT< EDFilterWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDFilter
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 35 of file ElectronRegressionEnergyProducer.cc.

Constructor & Destructor Documentation

ElectronRegressionEnergyProducer::ElectronRegressionEnergyProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 65 of file ElectronRegressionEnergyProducer.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), ElectronEnergyRegressionEvaluate::kNoTrkVar, ElectronEnergyRegressionEvaluate::kWithSubCluVar, ElectronEnergyRegressionEvaluate::kWithTrkVarV1, and ElectronEnergyRegressionEvaluate::kWithTrkVarV2.

65  {
66  printDebug_ = iConfig.getUntrackedParameter<bool>("printDebug", false);
67  electronTag_ = iConfig.getParameter<edm::InputTag>("electronTag");
68 
69  regressionInputFile_ = iConfig.getParameter<std::string>("regressionInputFile");
70  energyRegressionType_ = iConfig.getParameter<uint32_t>("energyRegressionType");
71 
72  nameEnergyReg_ = iConfig.getParameter<std::string>("nameEnergyReg");
73  nameEnergyErrorReg_ = iConfig.getParameter<std::string>("nameEnergyErrorReg");
74 
75  recHitCollectionEB_ = iConfig.getParameter<edm::InputTag>("recHitCollectionEB");
76  recHitCollectionEE_ = iConfig.getParameter<edm::InputTag>("recHitCollectionEE");
77 
78  produces<edm::ValueMap<double> >(nameEnergyReg_);
79  produces<edm::ValueMap<double> >(nameEnergyErrorReg_);
80 
82 
83  //set regression type
85  if (energyRegressionType_ == 1) type = ElectronEnergyRegressionEvaluate::kNoTrkVar;
86  else if (energyRegressionType_ == 2) type = ElectronEnergyRegressionEvaluate::kWithSubCluVar;
87  else if (energyRegressionType_ == 3) type = ElectronEnergyRegressionEvaluate::kWithTrkVarV1;
88  else if (energyRegressionType_ == 4) type = ElectronEnergyRegressionEvaluate::kWithTrkVarV2;
89 
90  //load weights and initialize
91  regressionEvaluator->initialize(regressionInputFile_.c_str(),type);
92 
93  geomInitialized_ = false;
94 
95 }
type
Definition: HCALResponse.h:22
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
ElectronEnergyRegressionEvaluate * regressionEvaluator
ElectronRegressionEnergyProducer::~ElectronRegressionEnergyProducer ( )

Definition at line 98 of file ElectronRegressionEnergyProducer.cc.

99 {
100  delete regressionEvaluator;
101 }
ElectronEnergyRegressionEvaluate * regressionEvaluator

Member Function Documentation

bool ElectronRegressionEnergyProducer::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDFilter.

Definition at line 104 of file ElectronRegressionEnergyProducer.cc.

References relval_parameters_module::energy, error, edm::helper::Filler< Map >::fill(), edm::EventSetup::get(), edm::Event::getByLabel(), edm::helper::Filler< Map >::insert(), edm::Handle< T >::product(), edm::Event::put(), and rho.

Referenced by Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::filter(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::setDataAccessor(), and Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::switchCenterView().

104  {
105 
107 
108  if (!geomInitialized_) {
109  edm::ESHandle<CaloTopology> theCaloTopology;
110  iSetup.get<CaloTopologyRecord>().get(theCaloTopology);
111  ecalTopology_ = & (*theCaloTopology);
112 
113  edm::ESHandle<CaloGeometry> theCaloGeometry;
114  iSetup.get<CaloGeometryRecord>().get(theCaloGeometry);
115  caloGeometry_ = & (*theCaloGeometry);
116  geomInitialized_ = true;
117  }
118 
119  std::auto_ptr<edm::ValueMap<double> > regrEnergyMap(new edm::ValueMap<double>() );
120  edm::ValueMap<double>::Filler energyFiller(*regrEnergyMap);
121 
122  std::auto_ptr<edm::ValueMap<double> > regrEnergyErrorMap(new edm::ValueMap<double>() );
123  edm::ValueMap<double>::Filler energyErrorFiller(*regrEnergyErrorMap);
124 
126  iEvent.getByLabel(electronTag_,egCollection);
127  const reco::GsfElectronCollection egCandidates = (*egCollection.product());
128 
129  std::vector<double> energyValues;
130  std::vector<double> energyErrorValues;
131  energyValues.reserve(egCollection->size());
132  energyErrorValues.reserve(egCollection->size());
133  //
134  //**************************************************************************
135  // Rechits
136  //**************************************************************************
139  iEvent.getByLabel( recHitCollectionEB_, pEBRecHits );
140  iEvent.getByLabel( recHitCollectionEE_, pEERecHits );
141 
142  //**************************************************************************
143  //Get Number of Vertices
144  //**************************************************************************
145  Handle<reco::VertexCollection> hVertexProduct;
146  iEvent.getByLabel(edm::InputTag("offlinePrimaryVertices"),hVertexProduct);
147  const reco::VertexCollection inVertices = *(hVertexProduct.product());
148 
149  // loop through all vertices
150  Int_t nvertices = 0;
151  for (reco::VertexCollection::const_iterator inV = inVertices.begin();
152  inV != inVertices.end(); ++inV) {
153 
154  // pass these vertex cuts
155  if (inV->ndof() >= 4
156  && inV->position().Rho() <= 2.0
157  && fabs(inV->z()) <= 24.0
158  ) {
159  nvertices++;
160  }
161  }
162 
163  //**************************************************************************
164  //Get Rho
165  //**************************************************************************
166  double rho = 0;
167  Handle<double> hRhoKt6PFJets;
168  iEvent.getByLabel(edm::InputTag("kt6PFJets","rho"), hRhoKt6PFJets);
169  rho = (*hRhoKt6PFJets);
170 
171 
172  for ( reco::GsfElectronCollection::const_iterator egIter = egCandidates.begin();
173  egIter != egCandidates.end(); ++egIter) {
174 
175  const EcalRecHitCollection * recHits=0;
176  if(egIter->isEB())
177  recHits = pEBRecHits.product();
178  else
179  recHits = pEERecHits.product();
180 
181  SuperClusterHelper mySCHelper(&(*egIter),recHits,ecalTopology_,caloGeometry_);
182 
184  mySCHelper,
185  rho,nvertices,
186  printDebug_);
187 
189  mySCHelper,
190  rho,nvertices,
191  printDebug_);
192 
193  energyValues.push_back(energy);
194  energyErrorValues.push_back(error);
195 
196  }
197 
198  energyFiller.insert( egCollection, energyValues.begin(), energyValues.end() );
199  energyFiller.fill();
200 
201  energyErrorFiller.insert( egCollection, energyErrorValues.begin(), energyErrorValues.end() );
202  energyErrorFiller.fill();
203 
204  iEvent.put(regrEnergyMap,nameEnergyReg_);
205  iEvent.put(regrEnergyErrorMap,nameEnergyErrorReg_);
206 
207  return true;
208 
209 }
ElectronEnergyRegressionEvaluate * regressionEvaluator
Definition: DDAxes.h:10
double calculateRegressionEnergy(const reco::GsfElectron *ele, SuperClusterHelper &mySCHelper, double rho, double nvertices, bool printDebug=false)
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: Handle.h:74
double calculateRegressionEnergyUncertainty(const reco::GsfElectron *ele, SuperClusterHelper &mySCHelper, double rho, double nvertices, bool printDebug=false)

Member Data Documentation

const CaloGeometry* ElectronRegressionEnergyProducer::caloGeometry_
private

Definition at line 55 of file ElectronRegressionEnergyProducer.cc.

const CaloTopology* ElectronRegressionEnergyProducer::ecalTopology_
private

Definition at line 54 of file ElectronRegressionEnergyProducer.cc.

edm::InputTag ElectronRegressionEnergyProducer::electronTag_
private

Definition at line 44 of file ElectronRegressionEnergyProducer.cc.

uint32_t ElectronRegressionEnergyProducer::energyRegressionType_
private

Definition at line 47 of file ElectronRegressionEnergyProducer.cc.

bool ElectronRegressionEnergyProducer::geomInitialized_
private

Definition at line 52 of file ElectronRegressionEnergyProducer.cc.

std::string ElectronRegressionEnergyProducer::nameEnergyErrorReg_
private

Definition at line 50 of file ElectronRegressionEnergyProducer.cc.

std::string ElectronRegressionEnergyProducer::nameEnergyReg_
private

Definition at line 49 of file ElectronRegressionEnergyProducer.cc.

bool ElectronRegressionEnergyProducer::printDebug_
private

Definition at line 43 of file ElectronRegressionEnergyProducer.cc.

edm::InputTag ElectronRegressionEnergyProducer::recHitCollectionEB_
private

Definition at line 57 of file ElectronRegressionEnergyProducer.cc.

edm::InputTag ElectronRegressionEnergyProducer::recHitCollectionEE_
private

Definition at line 58 of file ElectronRegressionEnergyProducer.cc.

ElectronEnergyRegressionEvaluate* ElectronRegressionEnergyProducer::regressionEvaluator
private

Definition at line 60 of file ElectronRegressionEnergyProducer.cc.

std::string ElectronRegressionEnergyProducer::regressionInputFile_
private

Definition at line 46 of file ElectronRegressionEnergyProducer.cc.