33 bsProducer_ (consumes<
reco::
BeamSpot>(config.getParameter<
edm::InputTag>(
"BSProducer"))),
35 useSCRefs_ (config.getParameter<
bool>(
"useSCRefs")),
36 useTrackProjectionToEcal_ (config.getParameter<
bool>(
"useTrackProjectionToEcal")),
37 variablesAtVtx_ (config.getParameter<
bool>(
"variablesAtVtx")) {
41 produces < reco::ElectronIsolationMap >(
"Deta" ).setBranchAlias(
"deta" );
42 produces < reco::ElectronIsolationMap >(
"Dphi" ).setBranchAlias(
"dphi" );
44 produces < reco::RecoEcalCandidateIsolationMap >(
"Deta" ).setBranchAlias(
"deta" );
45 produces < reco::RecoEcalCandidateIsolationMap >(
"Dphi" ).setBranchAlias(
"dphi" );
57 desc.
add<
bool>((
"useSCRefs"),
false);
58 desc.
add<
bool>((
"useTrackProjectionToEcal"),
false);
59 desc.
add<
bool>((
"variablesAtVtx"),
true);
60 descriptions.
add((
"hltEgammaHLTElectronDetaDphiProducer"), desc);
81 for(reco::ElectronCollection::const_iterator iElectron = electronHandle->begin(); iElectron != electronHandle->end(); iElectron++){
86 detaMap.
insert(eleref, dEtaDPhi.first);
87 dphiMap.
insert(eleref, dEtaDPhi.second);
95 for(reco::RecoEcalCandidateCollection::const_iterator iRecoEcalCand = recoEcalCandHandle->begin(); iRecoEcalCand != recoEcalCandHandle->end(); iRecoEcalCand++){
100 std::pair<float,float> dEtaDPhi(999999,999999);
102 detaCandMap.
insert(recoEcalCandRef, dEtaDPhi.first);
103 dphiCandMap.
insert(recoEcalCandRef, dEtaDPhi.second);
106 iEvent.
put(std::make_unique<reco::RecoEcalCandidateIsolationMap>(detaCandMap),
"Deta" );
107 iEvent.
put(std::make_unique<reco::RecoEcalCandidateIsolationMap>(dphiCandMap),
"Dphi" );
112 iEvent.
put(std::make_unique<reco::ElectronIsolationMap>(detaMap),
"Deta" );
113 iEvent.
put(std::make_unique<reco::ElectronIsolationMap>(dphiMap),
"Dphi" );
122 math::XYZPoint SCcorrPosition(theClus->x()-bsPosition.x(), theClus->y()-bsPosition.y() , theClus->z()-eleref->track()->vz() );
123 float deltaeta = fabs(SCcorrPosition.eta()-eleref->track()->eta());
124 float deltaphi = 999.;
133 deltaeta = fabs(scAtVtx.dEta());
134 deltaphi = fabs(scAtVtx.dPhi());
138 const math::XYZPoint vertex(bsPosition.x(),bsPosition.y(),eleref->track()->vz());
140 float phi1= posCalc.
ecalPhi(magField,trackMom,vertex,1);
141 float phi2= posCalc.
ecalPhi(magField,trackMom,vertex,-1);
143 float deltaphi1=fabs( phi1 - theClus->position().phi() );
144 if(deltaphi1>6.283185308) deltaphi1 -= 6.283185308;
145 if(deltaphi1>3.141592654) deltaphi1 = 6.283185308-deltaphi1;
147 float deltaphi2=fabs( phi2 - theClus->position().phi() );
148 if(deltaphi2>6.283185308) deltaphi2 -= 6.283185308;
149 if(deltaphi2>3.141592654) deltaphi2 = 6.283185308-deltaphi2;
151 deltaphi = deltaphi1;
152 if(deltaphi2<deltaphi1){ deltaphi = deltaphi2;}
154 deltaphi=fabs(eleref->track()->outerPosition().phi()-theClus->phi());
155 if(deltaphi>6.283185308) deltaphi -= 6.283185308;
156 if(deltaphi>3.141592654) deltaphi = 6.283185308-deltaphi;
159 return std::make_pair(deltaeta,deltaphi);
165 for(reco::ElectronCollection::const_iterator eleIt = electronHandle->begin(); eleIt != electronHandle->end(); eleIt++){
166 if(eleIt->superCluster()==recoEcalCandRef->superCluster()){
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
void beginRun(edm::Run const &, edm::EventSetup const &) override
std::pair< float, float > calDEtaDPhiSCTrk(reco::ElectronRef &eleref, const reco::BeamSpot::Point &BSPosition, const MagneticField *magField)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const MagneticField * magField_
const bool variablesAtVtx_
Global3DPoint GlobalPoint
GlobalPoint globalPosition() const
math::XYZPoint Point
point in the space
edm::Ref< ElectronCollection > ElectronRef
reference to an object in a collection of Electron objects
double ecalPhi(const MagneticField *magField, const math::XYZVector &momentum, const math::XYZPoint &vertex, const int charge)
const bool useTrackProjectionToEcal_
const edm::EDGetTokenT< reco::BeamSpot > bsProducer_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::vector< Electron > ElectronCollection
collectin of Electron objects
const edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandidateProducer_
EgammaHLTElectronDetaDphiProducer(const edm::ParameterSet &)
void insert(const key_type &k, const data_type &v)
insert an association
XYZVectorD XYZVector
spatial vector with cartesian internal representation
XYZPointD XYZPoint
point in space with cartesian internal representation
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< RecoEcalCandidate > RecoEcalCandidateCollection
collectin of RecoEcalCandidate objects
TrajectoryStateOnSurface stateOnSurface(const GlobalPoint &point) const
static reco::ElectronRef getEleRef(const reco::RecoEcalCandidateRef &recoEcalCandRef, const edm::Handle< reco::ElectronCollection > &electronHandle)
~EgammaHLTElectronDetaDphiProducer() override
const Point & position() const
position
const edm::EDGetTokenT< reco::ElectronCollection > electronProducer_
void produce(edm::Event &, const edm::EventSetup &) override
T const * product() const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)