CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
 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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &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 ()
 

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_
 
const edm::EDGetTokenT
< reco::ElectronSeedCollection
pixelSeedsToken_
 
int productsToWrite_
 
const edm::EDGetTokenT
< reco::RecoEcalCandidateCollection
recoEcalCandidateToken_
 

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 27 of file EgammaHLTPixelMatchVarProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 51 of file EgammaHLTPixelMatchVarProducer.cc.

References productsToWrite_.

51  :
52  recoEcalCandidateToken_(consumes<reco::RecoEcalCandidateCollection>(config.getParameter<edm::InputTag>("recoEcalCandidateProducer"))),
53  pixelSeedsToken_(consumes<reco::ElectronSeedCollection>(config.getParameter<edm::InputTag>("pixelSeedsProducer"))),
54  dPhi1Para_(config.getParameter<edm::ParameterSet>("dPhi1SParams")),
55  dPhi2Para_(config.getParameter<edm::ParameterSet>("dPhi2SParams")),
56  dRZ2Para_(config.getParameter<edm::ParameterSet>("dRZ2SParams")),
57  productsToWrite_(config.getParameter<int>("productsToWrite"))
58 
59 {
60  //register your products
61  produces < reco::RecoEcalCandidateIsolationMap >("s2");
62  if(productsToWrite_>=1){
63  produces < reco::RecoEcalCandidateIsolationMap >("dPhi1BestS2");
64  produces < reco::RecoEcalCandidateIsolationMap >("dPhi2BestS2");
65  produces < reco::RecoEcalCandidateIsolationMap >("dzBestS2");
66  }
67 
68 
69 }
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 71 of file EgammaHLTPixelMatchVarProducer.cc.

72 {}

Member Function Documentation

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

Definition at line 172 of file EgammaHLTPixelMatchVarProducer.cc.

References reco::ElectronSeed::dPhi1(), dPhi1Para_, reco::ElectronSeed::dPhi1Pos(), reco::ElectronSeed::dPhi2(), dPhi2Para_, reco::ElectronSeed::dPhi2Pos(), reco::ElectronSeed::dRz2(), dRZ2Para_, reco::ElectronSeed::dRz2Pos(), and indexGen::s2.

Referenced by produce().

173 {
174  const float dPhi1Const = dPhi1Para_(seed);
175  const float dPhi2Const = dPhi2Para_(seed);
176  const float dRZ2Const = dRZ2Para_(seed);
177 
178  float dPhi1 = (charge <0 ? seed.dPhi1() : seed.dPhi1Pos())/dPhi1Const;
179  float dPhi2 = (charge <0 ? seed.dPhi2() : seed.dPhi2Pos())/dPhi2Const;
180  float dRz2 = (charge <0 ? seed.dRz2() : seed.dRz2Pos())/dRZ2Const;
181 
182  float s2 = dPhi1*dPhi1+dPhi2*dPhi2+dRz2*dRz2;
183  return std::array<float,4>{{s2,dPhi1,dPhi2,dRz2}};
184 }
float dPhi1() const
Definition: ElectronSeed.h:79
egPM::Param< reco::ElectronSeed > dPhi2Para_
egPM::Param< reco::ElectronSeed > dPhi1Para_
float dPhi1Pos() const
Definition: ElectronSeed.h:81
tuple s2
Definition: indexGen.py:106
egPM::Param< reco::ElectronSeed > dRZ2Para_
float dPhi2() const
Definition: ElectronSeed.h:74
float dRz2Pos() const
Definition: ElectronSeed.h:75
float dRz2() const
Definition: ElectronSeed.h:73
float dPhi2Pos() const
Definition: ElectronSeed.h:76
void EgammaHLTPixelMatchVarProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 74 of file EgammaHLTPixelMatchVarProducer.cc.

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

74  {
75 
77  desc.add<edm::InputTag>(("recoEcalCandidateProducer"), edm::InputTag("hltL1SeededRecoEcalCandidate"));
78  desc.add<edm::InputTag>(("pixelSeedsProducer"), edm::InputTag("electronPixelSeeds"));
79 
80  edm::ParameterSetDescription varParamDesc;
81  edm::ParameterSetDescription binParamDesc;
82 
83  std::auto_ptr<edm::ParameterDescriptionCases<std::string>> binDescCases;
84  binDescCases =
85  "AbsEtaClus" >>
86  (edm::ParameterDescription<double>("xMin",0.0,true) and
87  edm::ParameterDescription<double>("xMax",3.0,true) and
88  edm::ParameterDescription<int>("yMin",0,true) and
89  edm::ParameterDescription<int>("yMax",99999,true) and
90  edm::ParameterDescription<std::string>("funcType","pol0",true) and
91  edm::ParameterDescription<std::vector<double>>("funcParams",{0.},true)) or
92  "AbsEtaClusPhi" >>
93  (edm::ParameterDescription<double>("xMin",0.0,true) and
94  edm::ParameterDescription<double>("xMax",3.0,true) and
95  edm::ParameterDescription<int>("yMin",0,true) and
96  edm::ParameterDescription<int>("yMax",99999,true) and
97  edm::ParameterDescription<std::string>("funcType","pol0",true) and
98  edm::ParameterDescription<std::vector<double>>("funcParams",{0.},true)) or
99  "AbsEtaClusEt" >>
100  (edm::ParameterDescription<double>("xMin",0.0,true) and
101  edm::ParameterDescription<double>("xMax",3.0,true) and
102  edm::ParameterDescription<int>("yMin",0,true) and
103  edm::ParameterDescription<int>("yMax",99999,true) and
104  edm::ParameterDescription<std::string>("funcType","pol0",true) and
105  edm::ParameterDescription<std::vector<double>>("funcParams",{0.},true));
106 
107  binParamDesc.ifValue(edm::ParameterDescription<std::string>("binType","AbsEtaClus",true), binDescCases);
108 
109 
110  varParamDesc.addVPSet("bins",binParamDesc);
111  desc.add("dPhi1SParams",varParamDesc);
112  desc.add("dPhi2SParams",varParamDesc);
113  desc.add("dRZ2SParams",varParamDesc);
114  desc.add<int>("productsToWrite",0);
115  descriptions.add(("hltEgammaHLTPixelMatchVarProducer"), desc);
116 }
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::EventIDconst &, edm::Timestampconst & > 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)
void EgammaHLTPixelMatchVarProducer::produce ( edm::StreamID  sid,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overridevirtual

Implements edm::global::EDProducerBase.

Definition at line 118 of file EgammaHLTPixelMatchVarProducer.cc.

References calS2(), edm::RefToBase< T >::castTo(), edm::Event::getByToken(), edm::HandleBase::isValid(), bookConverter::max, pixelSeedsToken_, productsToWrite_, edm::Event::put(), recoEcalCandidateToken_, and fileCollector::seed.

118  {
119 
120  // Get the HLT filtered objects
122  iEvent.getByToken(recoEcalCandidateToken_,recoEcalCandHandle);
123 
124 
126  iEvent.getByToken(pixelSeedsToken_,pixelSeedsHandle);
127 
128  if(!recoEcalCandHandle.isValid() || !pixelSeedsHandle.isValid()) return;
129 
130  std::auto_ptr<reco::RecoEcalCandidateIsolationMap> dPhi1BestS2Map(new reco::RecoEcalCandidateIsolationMap(recoEcalCandHandle));
131  std::auto_ptr<reco::RecoEcalCandidateIsolationMap> dPhi2BestS2Map(new reco::RecoEcalCandidateIsolationMap(recoEcalCandHandle));
132  std::auto_ptr<reco::RecoEcalCandidateIsolationMap> dzBestS2Map(new reco::RecoEcalCandidateIsolationMap(recoEcalCandHandle));
133  std::auto_ptr<reco::RecoEcalCandidateIsolationMap> s2Map(new reco::RecoEcalCandidateIsolationMap(recoEcalCandHandle));
134 
135  for(unsigned int candNr = 0; candNr<recoEcalCandHandle->size(); candNr++) {
136 
137  reco::RecoEcalCandidateRef candRef(recoEcalCandHandle,candNr);
138  reco::SuperClusterRef candSCRef = candRef->superCluster();
139 
141  for(auto & seed : *pixelSeedsHandle){
142  edm::RefToBase<reco::CaloCluster> pixelClusterRef = seed.caloCluster() ;
143  reco::SuperClusterRef pixelSCRef = pixelClusterRef.castTo<reco::SuperClusterRef>() ;
144  if(&(*candSCRef) == &(*pixelSCRef)){
145 
146  std::array<float,4> s2Data = calS2(seed,-1);
147  std::array<float,4> s2DataPos = calS2(seed,+1);
148  if(s2Data[0]<bestS2[0]) bestS2=s2Data;
149  if(s2DataPos[0]<bestS2[0]) bestS2=s2DataPos;
150 
151  }
152  }
153 
154 
155  s2Map->insert(candRef,bestS2[0]);
156  if(productsToWrite_>=1){
157  dPhi1BestS2Map->insert(candRef,bestS2[1]);
158  dPhi2BestS2Map->insert(candRef,bestS2[2]);
159  dzBestS2Map->insert(candRef,bestS2[3]);
160  }
161 
162  }
163 
164  iEvent.put(s2Map,"s2");
165  if(productsToWrite_>=1){
166  iEvent.put(dPhi1BestS2Map,"dPhi1BestS2");
167  iEvent.put(dPhi2BestS2Map,"dPhi2BestS2");
168  iEvent.put(dzBestS2Map,"dzBestS2");
169  }
170 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
const edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandidateToken_
bool isValid() const
Definition: HandleBase.h:75
std::array< float, 4 > calS2(const reco::ElectronSeed &seed, int charge) const
REF castTo() const
Definition: RefToBase.h:286
const edm::EDGetTokenT< reco::ElectronSeedCollection > pixelSeedsToken_

Member Data Documentation

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

Definition at line 43 of file EgammaHLTPixelMatchVarProducer.cc.

Referenced by calS2().

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

Definition at line 44 of file EgammaHLTPixelMatchVarProducer.cc.

Referenced by calS2().

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

Definition at line 45 of file EgammaHLTPixelMatchVarProducer.cc.

Referenced by calS2().

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

Definition at line 41 of file EgammaHLTPixelMatchVarProducer.cc.

Referenced by produce().

int EgammaHLTPixelMatchVarProducer::productsToWrite_
private

Definition at line 47 of file EgammaHLTPixelMatchVarProducer.cc.

Referenced by EgammaHLTPixelMatchVarProducer(), and produce().

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

Definition at line 40 of file EgammaHLTPixelMatchVarProducer.cc.

Referenced by produce().