test
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::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 ElectronRegressionEnergyProducer (const edm::ParameterSet &)
 
 ~ElectronRegressionEnergyProducer ()
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

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

Private Attributes

const CaloGeometrycaloGeometry_
 
const CaloTopologyecalTopology_
 
edm::EDGetTokenT
< reco::GsfElectronCollection
electronToken_
 
uint32_t energyRegressionType_
 
bool geomInitialized_
 
edm::EDGetTokenT< double > hRhoKt6PFJetsToken_
 
edm::EDGetTokenT
< reco::VertexCollection
hVertexToken_
 
std::string nameEnergyErrorReg_
 
std::string nameEnergyReg_
 
bool printDebug_
 
edm::EDGetTokenT
< EcalRecHitCollection
recHitCollectionEBToken_
 
edm::EDGetTokenT
< EcalRecHitCollection
recHitCollectionEEToken_
 
ElectronEnergyRegressionEvaluateregressionEvaluator
 
std::string regressionInputFile_
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
- 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::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 35 of file ElectronRegressionEnergyProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 68 of file ElectronRegressionEnergyProducer.cc.

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

68  {
69  printDebug_ = iConfig.getUntrackedParameter<bool>("printDebug", false);
70  electronToken_ = consumes<reco::GsfElectronCollection>(iConfig.getParameter<edm::InputTag>("electronTag"));
71 
72  regressionInputFile_ = iConfig.getParameter<std::string>("regressionInputFile");
73  energyRegressionType_ = iConfig.getParameter<uint32_t>("energyRegressionType");
74 
75  nameEnergyReg_ = iConfig.getParameter<std::string>("nameEnergyReg");
76  nameEnergyErrorReg_ = iConfig.getParameter<std::string>("nameEnergyErrorReg");
77 
78  recHitCollectionEBToken_ = consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("recHitCollectionEB"));
79  recHitCollectionEEToken_ = consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("recHitCollectionEE"));
80 
81  hVertexToken_ = consumes<reco::VertexCollection>(edm::InputTag("offlinePrimaryVertices"));
82  hRhoKt6PFJetsToken_ = consumes<double>(edm::InputTag("kt6PFJets","rho"));
83 
84  produces<edm::ValueMap<double> >(nameEnergyReg_);
85  produces<edm::ValueMap<double> >(nameEnergyErrorReg_);
86 
88 
89  //set regression type
95 
96  //load weights and initialize
98 
99  geomInitialized_ = false;
100 
101 }
type
Definition: HCALResponse.h:21
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
ElectronEnergyRegressionEvaluate * regressionEvaluator
edm::EDGetTokenT< EcalRecHitCollection > recHitCollectionEEToken_
edm::EDGetTokenT< reco::VertexCollection > hVertexToken_
void initialize(std::string weightsFile, ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType type)
edm::EDGetTokenT< EcalRecHitCollection > recHitCollectionEBToken_
edm::EDGetTokenT< reco::GsfElectronCollection > electronToken_
ElectronRegressionEnergyProducer::~ElectronRegressionEnergyProducer ( )

Definition at line 104 of file ElectronRegressionEnergyProducer.cc.

105 {
106  delete regressionEvaluator;
107 }
ElectronEnergyRegressionEvaluate * regressionEvaluator

Member Function Documentation

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

Implements edm::EDFilter.

Definition at line 110 of file ElectronRegressionEnergyProducer.cc.

References relval_parameters_module::energy, relativeConstraints::error, edm::helper::Filler< Map >::fill(), edm::EventSetup::get(), edm::Event::getByToken(), 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().

110  {
111 
113 
114  if (!geomInitialized_) {
115  edm::ESHandle<CaloTopology> theCaloTopology;
116  iSetup.get<CaloTopologyRecord>().get(theCaloTopology);
117  ecalTopology_ = & (*theCaloTopology);
118 
119  edm::ESHandle<CaloGeometry> theCaloGeometry;
120  iSetup.get<CaloGeometryRecord>().get(theCaloGeometry);
121  caloGeometry_ = & (*theCaloGeometry);
122  geomInitialized_ = true;
123  }
124 
125  std::auto_ptr<edm::ValueMap<double> > regrEnergyMap(new edm::ValueMap<double>() );
126  edm::ValueMap<double>::Filler energyFiller(*regrEnergyMap);
127 
128  std::auto_ptr<edm::ValueMap<double> > regrEnergyErrorMap(new edm::ValueMap<double>() );
129  edm::ValueMap<double>::Filler energyErrorFiller(*regrEnergyErrorMap);
130 
132  iEvent.getByToken(electronToken_,egCollection);
133  const reco::GsfElectronCollection egCandidates = (*egCollection.product());
134 
135  std::vector<double> energyValues;
136  std::vector<double> energyErrorValues;
137  energyValues.reserve(egCollection->size());
138  energyErrorValues.reserve(egCollection->size());
139  //
140  //**************************************************************************
141  // Rechits
142  //**************************************************************************
145  iEvent.getByToken( recHitCollectionEBToken_, pEBRecHits );
146  iEvent.getByToken( recHitCollectionEEToken_, pEERecHits );
147 
148  //**************************************************************************
149  //Get Number of Vertices
150  //**************************************************************************
151  Handle<reco::VertexCollection> hVertexProduct;
152  iEvent.getByToken(hVertexToken_,hVertexProduct);
153  const reco::VertexCollection inVertices = *(hVertexProduct.product());
154 
155  // loop through all vertices
156  Int_t nvertices = 0;
157  for (reco::VertexCollection::const_iterator inV = inVertices.begin();
158  inV != inVertices.end(); ++inV) {
159 
160  // pass these vertex cuts
161  if (inV->ndof() >= 4
162  && inV->position().Rho() <= 2.0
163  && fabs(inV->z()) <= 24.0
164  ) {
165  nvertices++;
166  }
167  }
168 
169  //**************************************************************************
170  //Get Rho
171  //**************************************************************************
172  double rho = 0;
173  Handle<double> hRhoKt6PFJets;
174  iEvent.getByToken(hRhoKt6PFJetsToken_, hRhoKt6PFJets);
175  rho = (*hRhoKt6PFJets);
176 
177 
178  for ( reco::GsfElectronCollection::const_iterator egIter = egCandidates.begin();
179  egIter != egCandidates.end(); ++egIter) {
180 
181  const EcalRecHitCollection * recHits=0;
182  if(egIter->isEB())
183  recHits = pEBRecHits.product();
184  else
185  recHits = pEERecHits.product();
186 
187  SuperClusterHelper mySCHelper(&(*egIter),recHits,ecalTopology_,caloGeometry_);
188 
190  mySCHelper,
191  rho,nvertices,
192  printDebug_);
193 
195  mySCHelper,
196  rho,nvertices,
197  printDebug_);
198 
199  energyValues.push_back(energy);
200  energyErrorValues.push_back(error);
201 
202  }
203 
204  energyFiller.insert( egCollection, energyValues.begin(), energyValues.end() );
205  energyFiller.fill();
206 
207  energyErrorFiller.insert( egCollection, energyErrorValues.begin(), energyErrorValues.end() );
208  energyErrorFiller.fill();
209 
210  iEvent.put(regrEnergyMap,nameEnergyReg_);
211  iEvent.put(regrEnergyErrorMap,nameEnergyErrorReg_);
212 
213  return true;
214 
215 }
ElectronEnergyRegressionEvaluate * regressionEvaluator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
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
edm::EDGetTokenT< EcalRecHitCollection > recHitCollectionEEToken_
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
edm::EDGetTokenT< reco::VertexCollection > hVertexToken_
edm::EDGetTokenT< EcalRecHitCollection > recHitCollectionEBToken_
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: Handle.h:81
double calculateRegressionEnergyUncertainty(const reco::GsfElectron *ele, SuperClusterHelper &mySCHelper, double rho, double nvertices, bool printDebug=false)
edm::EDGetTokenT< reco::GsfElectronCollection > electronToken_

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::EDGetTokenT<reco::GsfElectronCollection> ElectronRegressionEnergyProducer::electronToken_
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.

edm::EDGetTokenT<double> ElectronRegressionEnergyProducer::hRhoKt6PFJetsToken_
private

Definition at line 63 of file ElectronRegressionEnergyProducer.cc.

edm::EDGetTokenT<reco::VertexCollection> ElectronRegressionEnergyProducer::hVertexToken_
private

Definition at line 62 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::EDGetTokenT<EcalRecHitCollection> ElectronRegressionEnergyProducer::recHitCollectionEBToken_
private

Definition at line 57 of file ElectronRegressionEnergyProducer.cc.

edm::EDGetTokenT<EcalRecHitCollection> ElectronRegressionEnergyProducer::recHitCollectionEEToken_
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.