CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
EgammaHLTPixelMatchVarProducer Class Reference
Inheritance diagram for EgammaHLTPixelMatchVarProducer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

std::array< float, 4 > calS2 (const reco::ElectronSeed &seed, int charge) const
 
 EgammaHLTPixelMatchVarProducer (const edm::ParameterSet &)
 
void produce (edm::StreamID sid, edm::Event &, const edm::EventSetup &) const override
 
 ~EgammaHLTPixelMatchVarProducer ()
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

egPM::Param< reco::ElectronSeeddPhi1Para_
 
egPM::Param< reco::ElectronSeeddPhi2Para_
 
egPM::Param< reco::ElectronSeeddRZ2Para_
 
size_t nrHits_
 
const edm::EDGetTokenT< reco::ElectronSeedCollectionpixelSeedsToken_
 
int productsToWrite_
 
const edm::EDGetTokenT< reco::RecoEcalCandidateCollectionrecoEcalCandidateToken_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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 103 of file EgammaHLTPixelMatchVarProducer.cc.

Constructor & Destructor Documentation

EgammaHLTPixelMatchVarProducer::EgammaHLTPixelMatchVarProducer ( const edm::ParameterSet config)
explicit

Definition at line 127 of file EgammaHLTPixelMatchVarProducer.cc.

References nrHits_, and productsToWrite_.

127  :
128  recoEcalCandidateToken_(consumes<reco::RecoEcalCandidateCollection>(config.getParameter<edm::InputTag>("recoEcalCandidateProducer"))),
129  pixelSeedsToken_(consumes<reco::ElectronSeedCollection>(config.getParameter<edm::InputTag>("pixelSeedsProducer"))),
130  dPhi1Para_(config.getParameter<edm::ParameterSet>("dPhi1SParams")),
131  dPhi2Para_(config.getParameter<edm::ParameterSet>("dPhi2SParams")),
132  dRZ2Para_(config.getParameter<edm::ParameterSet>("dRZ2SParams")),
133  productsToWrite_(config.getParameter<int>("productsToWrite")),
134  nrHits_(4)
135 
136 {
137  //register your products
138  produces < reco::RecoEcalCandidateIsolationMap >("s2");
139  if(productsToWrite_>=1){
140  produces < reco::RecoEcalCandidateIsolationMap >("dPhi1BestS2");
141  produces < reco::RecoEcalCandidateIsolationMap >("dPhi2BestS2");
142  produces < reco::RecoEcalCandidateIsolationMap >("dzBestS2");
143  }
144  if(productsToWrite_>=2){
145  //note for product names we start from index 1
146  for(size_t hitNr=1;hitNr<=nrHits_;hitNr++){
147  produces < reco::RecoEcalCandidateIsolationMap >("dPhi"+std::to_string(hitNr));
148  produces < reco::RecoEcalCandidateIsolationMap >("dPhi"+std::to_string(hitNr)+"Info");
149  produces < reco::RecoEcalCandidateIsolationMap >("dRZ"+std::to_string(hitNr));
150  produces < reco::RecoEcalCandidateIsolationMap >("dRZ"+std::to_string(hitNr)+"Info");
151  }
152  produces < reco::RecoEcalCandidateIsolationMap >("nrClus");
153  produces < reco::RecoEcalCandidateIsolationMap >("seedClusEFrac");
154  produces < reco::RecoEcalCandidateIsolationMap >("phiWidth");
155  produces < reco::RecoEcalCandidateIsolationMap >("etaWidth");
156  }
157 
158 }
T getParameter(std::string const &) const
egPM::Param< reco::ElectronSeed > dPhi2Para_
egPM::Param< reco::ElectronSeed > dPhi1Para_
egPM::Param< reco::ElectronSeed > dRZ2Para_
const edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandidateToken_
const edm::EDGetTokenT< reco::ElectronSeedCollection > pixelSeedsToken_
EgammaHLTPixelMatchVarProducer::~EgammaHLTPixelMatchVarProducer ( )

Definition at line 160 of file EgammaHLTPixelMatchVarProducer.cc.

161 {}

Member Function Documentation

std::array< float, 4 > EgammaHLTPixelMatchVarProducer::calS2 ( const reco::ElectronSeed seed,
int  charge 
) const

Definition at line 311 of file EgammaHLTPixelMatchVarProducer.cc.

References DEFINE_FWK_MODULE, dPhi1Para_, dPhi2Para_, reco::ElectronSeed::dPhiNeg(), reco::ElectronSeed::dPhiPos(), dRZ2Para_, reco::ElectronSeed::dRZNeg(), reco::ElectronSeed::dRZPos(), and indexGen::s2.

Referenced by produce().

312 {
313  const float dPhi1Const = dPhi1Para_(seed);
314  const float dPhi2Const = dPhi2Para_(seed);
315  const float dRZ2Const = dRZ2Para_(seed);
316 
317  float dPhi1 = (charge <0 ? seed.dPhiNeg(0) : seed.dPhiPos(0))/dPhi1Const;
318  float dPhi2 = (charge <0 ? seed.dPhiNeg(1) : seed.dPhiPos(1))/dPhi2Const;
319  float dRz2 = (charge <0 ? seed.dRZNeg(1) : seed.dRZPos(1))/dRZ2Const;
320 
321  float s2 = dPhi1*dPhi1+dPhi2*dPhi2+dRz2*dRz2;
322  return std::array<float,4>{{s2,dPhi1,dPhi2,dRz2}};
323 }
egPM::Param< reco::ElectronSeed > dPhi2Para_
egPM::Param< reco::ElectronSeed > dPhi1Para_
float dRZPos(size_t hitNr) const
Definition: ElectronSeed.h:106
egPM::Param< reco::ElectronSeed > dRZ2Para_
float dRZNeg(size_t hitNr) const
Definition: ElectronSeed.h:107
float dPhiNeg(size_t hitNr) const
Definition: ElectronSeed.h:103
float dPhiPos(size_t hitNr) const
Definition: ElectronSeed.h:104
void EgammaHLTPixelMatchVarProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 163 of file EgammaHLTPixelMatchVarProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::ifValue(), eostools::move(), and or.

163  {
164 
166  desc.add<edm::InputTag>(("recoEcalCandidateProducer"), edm::InputTag("hltL1SeededRecoEcalCandidate"));
167  desc.add<edm::InputTag>(("pixelSeedsProducer"), edm::InputTag("electronPixelSeeds"));
168 
169  edm::ParameterSetDescription varParamDesc;
170  edm::ParameterSetDescription binParamDesc;
171 
172  auto binDescCases =
173  "AbsEtaClus" >>
174  (edm::ParameterDescription<double>("xMin",0.0,true) and
175  edm::ParameterDescription<double>("xMax",3.0,true) and
176  edm::ParameterDescription<int>("yMin",0,true) and
177  edm::ParameterDescription<int>("yMax",99999,true) and
178  edm::ParameterDescription<std::string>("funcType","pol0",true) and
179  edm::ParameterDescription<std::vector<double>>("funcParams",{0.},true)) or
180  "AbsEtaClusPhi" >>
181  (edm::ParameterDescription<double>("xMin",0.0,true) and
182  edm::ParameterDescription<double>("xMax",3.0,true) and
183  edm::ParameterDescription<int>("yMin",0,true) and
184  edm::ParameterDescription<int>("yMax",99999,true) and
185  edm::ParameterDescription<std::string>("funcType","pol0",true) and
186  edm::ParameterDescription<std::vector<double>>("funcParams",{0.},true)) or
187  "AbsEtaClusEt" >>
188  (edm::ParameterDescription<double>("xMin",0.0,true) and
189  edm::ParameterDescription<double>("xMax",3.0,true) and
190  edm::ParameterDescription<int>("yMin",0,true) and
191  edm::ParameterDescription<int>("yMax",99999,true) and
192  edm::ParameterDescription<std::string>("funcType","pol0",true) and
193  edm::ParameterDescription<std::vector<double>>("funcParams",{0.},true));
194 
195  binParamDesc.ifValue(edm::ParameterDescription<std::string>("binType","AbsEtaClus",true), std::move(binDescCases));
196 
197 
198  varParamDesc.addVPSet("bins",binParamDesc);
199  desc.add("dPhi1SParams",varParamDesc);
200  desc.add("dPhi2SParams",varParamDesc);
201  desc.add("dRZ2SParams",varParamDesc);
202  desc.add<int>("productsToWrite",0);
203  descriptions.add(("hltEgammaHLTPixelMatchVarProducer"), desc);
204 }
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
HLT enums.
def move(src, dest)
Definition: eostools.py:510
void EgammaHLTPixelMatchVarProducer::produce ( edm::StreamID  sid,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
override

Definition at line 206 of file EgammaHLTPixelMatchVarProducer.cc.

References reco::ElectronSeed::caloCluster(), calS2(), edm::RefToBase< T >::castTo(), reco::ElectronSeed::dPhiBest(), reco::ElectronSeed::dRZBest(), edm::EventSetup::get(), edm::Event::getByToken(), edm::HandleBase::isValid(), hpstanc_transforms::max, eostools::move(), nrHits_, pixelSeedsToken_, productsToWrite_, edm::Event::put(), and recoEcalCandidateToken_.

206  {
207 
208  // Get the HLT filtered objects
210  iEvent.getByToken(recoEcalCandidateToken_,recoEcalCandHandle);
211 
212 
214  iEvent.getByToken(pixelSeedsToken_,pixelSeedsHandle);
215 
216  if(!recoEcalCandHandle.isValid()) return;
217  else if(!pixelSeedsHandle.isValid()){
218  auto s2Map = std::make_unique<reco::RecoEcalCandidateIsolationMap>(recoEcalCandHandle);
219  for(unsigned int candNr = 0; candNr<recoEcalCandHandle->size(); candNr++) {
220  reco::RecoEcalCandidateRef candRef(recoEcalCandHandle,candNr);
221  s2Map->insert(candRef,0);
222  }
223  iEvent.put(std::move(s2Map),"s2");
224  return;
225  }
226 
227  edm::ESHandle<TrackerTopology> trackerTopoHandle;
228  iSetup.get<TrackerTopologyRcd>().get(trackerTopoHandle);
229 
230  auto dPhi1BestS2Map = std::make_unique<reco::RecoEcalCandidateIsolationMap>(recoEcalCandHandle);
231  auto dPhi2BestS2Map = std::make_unique<reco::RecoEcalCandidateIsolationMap>(recoEcalCandHandle);
232  auto dzBestS2Map = std::make_unique<reco::RecoEcalCandidateIsolationMap>(recoEcalCandHandle);
233  auto s2Map = std::make_unique<reco::RecoEcalCandidateIsolationMap>(recoEcalCandHandle);
234 
235  auto nrClusMap = std::make_unique<reco::RecoEcalCandidateIsolationMap>(recoEcalCandHandle);
236  auto seedClusEFracMap = std::make_unique<reco::RecoEcalCandidateIsolationMap>(recoEcalCandHandle);
237  auto phiWidthMap = std::make_unique<reco::RecoEcalCandidateIsolationMap>(recoEcalCandHandle);
238  auto etaWidthMap = std::make_unique<reco::RecoEcalCandidateIsolationMap>(recoEcalCandHandle);
239 
240  std::vector<PixelData> pixelData;
241  for(size_t hitNr=0;hitNr<nrHits_;hitNr++){
242  pixelData.emplace_back(PixelData("dPhi",hitNr,&reco::ElectronSeed::dPhiBest,recoEcalCandHandle));
243  pixelData.emplace_back(PixelData("dRZ",hitNr,&reco::ElectronSeed::dRZBest,recoEcalCandHandle));
244  }
245 
246  for(unsigned int candNr = 0; candNr<recoEcalCandHandle->size(); candNr++) {
247 
248  reco::RecoEcalCandidateRef candRef(recoEcalCandHandle,candNr);
249  reco::SuperClusterRef candSCRef = candRef->superCluster();
250 
252  for(auto & seed : *pixelSeedsHandle){
253  edm::RefToBase<reco::CaloCluster> pixelClusterRef = seed.caloCluster() ;
254  reco::SuperClusterRef pixelSCRef = pixelClusterRef.castTo<reco::SuperClusterRef>() ;
255  if(&(*candSCRef) == &(*pixelSCRef)){
256 
257  std::array<float,4> s2Data = calS2(seed,-1);
258  std::array<float,4> s2DataPos = calS2(seed,+1);
259  if(s2Data[0]<bestS2[0]) bestS2=s2Data;
260  if(s2DataPos[0]<bestS2[0]) bestS2=s2DataPos;
261 
262  if(productsToWrite_>=2){
263  for(auto& pixelDatum : pixelData){
264  pixelDatum.fill(seed);
265  }
266  }
267  }
268  }
269 
270 
271  s2Map->insert(candRef,bestS2[0]);
272  if(productsToWrite_>=1){
273  dPhi1BestS2Map->insert(candRef,bestS2[1]);
274  dPhi2BestS2Map->insert(candRef,bestS2[2]);
275  dzBestS2Map->insert(candRef,bestS2[3]);
276  }
277  if(productsToWrite_>=2){
278  nrClusMap->insert(candRef,candSCRef->clustersSize());
279  float seedClusEFrac = candSCRef->rawEnergy()>0 ? candSCRef->seed()->energy() / candSCRef->rawEnergy() : 0.;
280  // std::cout <<"cand "<<candSCRef->energy()<<" E Corr "<<candSCRef->correctedEnergyUncertainty()<<" "<<candSCRef->correctedEnergy()<<" width "<<candSCRef->phiWidth()<<std::endl;
281  // float seedClusEFrac = candSCRef->phiWidth();
282  seedClusEFracMap->insert(candRef,seedClusEFrac);
283  float phiWidth = candSCRef->phiWidth();
284  float etaWidth = candSCRef->etaWidth();
285  phiWidthMap->insert(candRef,phiWidth);
286  etaWidthMap->insert(candRef,etaWidth);
287 
288  for(auto& pixelDatum : pixelData){
289  pixelDatum.fill(candRef);
290  }
291  }
292  }
293 
294  iEvent.put(std::move(s2Map),"s2");
295  if(productsToWrite_>=1){
296  iEvent.put(std::move(dPhi1BestS2Map),"dPhi1BestS2");
297  iEvent.put(std::move(dPhi2BestS2Map),"dPhi2BestS2");
298  iEvent.put(std::move(dzBestS2Map),"dzBestS2");
299  }
300  if(productsToWrite_>=2){
301  for(auto& pixelDatum : pixelData){
302  pixelDatum.putInto(iEvent);
303  }
304  iEvent.put(std::move(nrClusMap),"nrClus");
305  iEvent.put(std::move(seedClusEFracMap),"seedClusEFrac");
306  iEvent.put(std::move(phiWidthMap),"phiWidth");
307  iEvent.put(std::move(etaWidthMap),"etaWidth");
308  }
309 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
const edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandidateToken_
bool isValid() const
Definition: HandleBase.h:74
float dPhiBest(size_t hitNr) const
Definition: ElectronSeed.h:105
std::array< float, 4 > calS2(const reco::ElectronSeed &seed, int charge) const
REF castTo() const
Definition: RefToBase.h:286
const T & get() const
Definition: EventSetup.h:56
float dRZBest(size_t hitNr) const
Definition: ElectronSeed.h:108
const edm::EDGetTokenT< reco::ElectronSeedCollection > pixelSeedsToken_
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

egPM::Param<reco::ElectronSeed> EgammaHLTPixelMatchVarProducer::dPhi1Para_
private

Definition at line 119 of file EgammaHLTPixelMatchVarProducer.cc.

Referenced by calS2().

egPM::Param<reco::ElectronSeed> EgammaHLTPixelMatchVarProducer::dPhi2Para_
private

Definition at line 120 of file EgammaHLTPixelMatchVarProducer.cc.

Referenced by calS2().

egPM::Param<reco::ElectronSeed> EgammaHLTPixelMatchVarProducer::dRZ2Para_
private

Definition at line 121 of file EgammaHLTPixelMatchVarProducer.cc.

Referenced by calS2().

size_t EgammaHLTPixelMatchVarProducer::nrHits_
private

Definition at line 124 of file EgammaHLTPixelMatchVarProducer.cc.

Referenced by EgammaHLTPixelMatchVarProducer(), and produce().

const edm::EDGetTokenT<reco::ElectronSeedCollection> EgammaHLTPixelMatchVarProducer::pixelSeedsToken_
private

Definition at line 117 of file EgammaHLTPixelMatchVarProducer.cc.

Referenced by produce().

int EgammaHLTPixelMatchVarProducer::productsToWrite_
private

Definition at line 123 of file EgammaHLTPixelMatchVarProducer.cc.

Referenced by EgammaHLTPixelMatchVarProducer(), and produce().

const edm::EDGetTokenT<reco::RecoEcalCandidateCollection> EgammaHLTPixelMatchVarProducer::recoEcalCandidateToken_
private

Definition at line 116 of file EgammaHLTPixelMatchVarProducer.cc.

Referenced by produce().