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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) 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
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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::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 34 of file ElectronRegressionEnergyProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 67 of file ElectronRegressionEnergyProducer.cc.

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

67  {
68  printDebug_ = iConfig.getUntrackedParameter<bool>("printDebug", false);
69  electronToken_ = consumes<reco::GsfElectronCollection>(iConfig.getParameter<edm::InputTag>("electronTag"));
70 
71  regressionInputFile_ = iConfig.getParameter<std::string>("regressionInputFile");
72  energyRegressionType_ = iConfig.getParameter<uint32_t>("energyRegressionType");
73 
74  nameEnergyReg_ = iConfig.getParameter<std::string>("nameEnergyReg");
75  nameEnergyErrorReg_ = iConfig.getParameter<std::string>("nameEnergyErrorReg");
76 
77  recHitCollectionEBToken_ = consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("recHitCollectionEB"));
78  recHitCollectionEEToken_ = consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("recHitCollectionEE"));
79 
80  hVertexToken_ = consumes<reco::VertexCollection>(edm::InputTag("offlinePrimaryVertices"));
81  hRhoKt6PFJetsToken_ = consumes<double>(edm::InputTag("kt6PFJets","rho"));
82 
83  produces<edm::ValueMap<double> >(nameEnergyReg_);
84  produces<edm::ValueMap<double> >(nameEnergyErrorReg_);
85 
87 
88  //set regression type
94 
95  //load weights and initialize
97 
98  geomInitialized_ = false;
99 
100 }
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 103 of file ElectronRegressionEnergyProducer.cc.

104 {
105  delete regressionEvaluator;
106 }
ElectronEnergyRegressionEvaluate * regressionEvaluator

Member Function Documentation

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

Implements edm::EDFilter.

Definition at line 109 of file ElectronRegressionEnergyProducer.cc.

References assert(), 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(), HLT_25ns14e33_v3_cff::recHits, 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().

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

const CaloTopology* ElectronRegressionEnergyProducer::ecalTopology_
private

Definition at line 53 of file ElectronRegressionEnergyProducer.cc.

edm::EDGetTokenT<reco::GsfElectronCollection> ElectronRegressionEnergyProducer::electronToken_
private

Definition at line 43 of file ElectronRegressionEnergyProducer.cc.

uint32_t ElectronRegressionEnergyProducer::energyRegressionType_
private

Definition at line 46 of file ElectronRegressionEnergyProducer.cc.

bool ElectronRegressionEnergyProducer::geomInitialized_
private

Definition at line 51 of file ElectronRegressionEnergyProducer.cc.

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

Definition at line 62 of file ElectronRegressionEnergyProducer.cc.

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

Definition at line 61 of file ElectronRegressionEnergyProducer.cc.

std::string ElectronRegressionEnergyProducer::nameEnergyErrorReg_
private

Definition at line 49 of file ElectronRegressionEnergyProducer.cc.

std::string ElectronRegressionEnergyProducer::nameEnergyReg_
private

Definition at line 48 of file ElectronRegressionEnergyProducer.cc.

bool ElectronRegressionEnergyProducer::printDebug_
private

Definition at line 42 of file ElectronRegressionEnergyProducer.cc.

edm::EDGetTokenT<EcalRecHitCollection> ElectronRegressionEnergyProducer::recHitCollectionEBToken_
private

Definition at line 56 of file ElectronRegressionEnergyProducer.cc.

edm::EDGetTokenT<EcalRecHitCollection> ElectronRegressionEnergyProducer::recHitCollectionEEToken_
private

Definition at line 57 of file ElectronRegressionEnergyProducer.cc.

ElectronEnergyRegressionEvaluate* ElectronRegressionEnergyProducer::regressionEvaluator
private

Definition at line 59 of file ElectronRegressionEnergyProducer.cc.

std::string ElectronRegressionEnergyProducer::regressionInputFile_
private

Definition at line 45 of file ElectronRegressionEnergyProducer.cc.