37 throw cms::Exception(
"InconsistentParameters") <<
" *** Inconsistent configuration : if you read GsfElectrons, you should set useRecHitCollections to true and provide the correcte values to recHitCollectionEB and recHitCollectionEE (most probably reducedEcalRecHitsEB and reducedEcalRecHitsEE )" << std::endl;
41 std::cout <<
" You are running on GsfElectrons and the producer is not configured to produce ValueMaps with the results. In that case, it does not nothing !! " << std::endl;
47 produces<pat::ElectronCollection>();
49 throw cms::Exception(
"InconsistentParameters") <<
" inputCollectionType should be either 0 (GsfElectrons) or 1 (pat::Electrons) " << std::endl;
63 if(produceValueMaps_) {
75 std::cout <<
" Finished initialization " << std::endl;
110 for (reco::VertexCollection::const_iterator inV = inVertices.begin();
111 inV != inVertices.end(); ++inV) {
115 && inV->position().Rho() <= 2.0
116 && fabs(inV->z()) <= 24.0
128 rho = (*hRhoKt6PFJets);
164 std::vector<double> energyValues;
165 std::vector<double> energyErrorValues;
170 for(
unsigned iele=0; iele <
nElectrons_ ; ++iele) {
174 std::cout <<
"***********************************************************************\n";
175 std::cout <<
"Run Lumi Event: " <<
event.id().run() <<
" " <<
event.luminosityBlock() <<
" " <<
event.id().event() <<
"\n";
176 std::cout <<
"Pat Electron : " << ele->
pt() <<
" " << ele->
eta() <<
" " << ele->
phi() <<
"\n";
184 recHits = pEBRecHits.
product();
186 recHits = pEERecHits.
product();
188 recHits = (*patCollectionH)[iele].recHits();
199 Double_t FinalMomentum = 0;
200 Double_t FinalMomentumError = 0;
201 Double_t RegressionMomentum = 0;
202 Double_t RegressionMomentumError = 0;
282 energyValues.push_back(RegressionMomentum);
283 energyErrorValues.push_back(RegressionMomentumError);
428 energyValues.push_back(RegressionMomentum);
429 energyErrorValues.push_back(RegressionMomentumError);
518 FinalMomentum = RegressionMomentum;
519 FinalMomentumError = RegressionMomentumError;
522 ( oldMomentum.x()*FinalMomentum/oldMomentum.t(),
523 oldMomentum.y()*FinalMomentum/oldMomentum.t(),
524 oldMomentum.z()*FinalMomentum/oldMomentum.t(),
530 energyValues.push_back(RegressionMomentum);
531 energyErrorValues.push_back(RegressionMomentumError);
537 patElectrons->push_back(*myPatElectron);
539 if (myPatElectron)
delete myPatElectron;
540 if (mySCHelper)
delete mySCHelper;
552 energyFiller.
insert( gsfCollectionH, energyValues.begin(), energyValues.end() );
553 energyErrorFiller.
insert( gsfCollectionH, energyErrorValues.begin(), energyErrorValues.end() );
555 energyFiller.
insert( patCollectionH, energyValues.begin(), energyValues.end() );
556 energyErrorFiller.
insert( patCollectionH, energyErrorValues.begin(), energyErrorValues.end() );
560 energyErrorFiller.
fill();
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
RegressionEnergyPatElectronProducer(const edm::ParameterSet &)
float trackMomentumError() const
double eta() const final
momentum pseudorapidity
float eESClusters() const
const LorentzVector & p4(P4Kind kind) const
float eSuperClusterOverP() const
std::string nameEnergyReg_
float esClusterEnergy(unsigned i) const
float sigmaIetaIeta() const
float subClusterE3x3(unsigned i) const
void correctMomentum(const LorentzVector &p4, float trackMomentumError, float p4Error)
math::XYZVectorF trackMomentumAtVtx() const
void insert(const H &h, I begin, I end)
uint32_t inputCollectionType_
def setup(process, global_tag, zero_tesla=False)
double pt() const final
transverse momentum
std::vector< Vertex > VertexCollection
collection of Vertex objects
int charge() const final
electric charge
double regressionValueWithTrkVar(double electronP, double SCRawEnergy, double scEta, double scPhi, double R9, double etawidth, double phiwidth, double NClusters, double HoE, double rho, double vertices, double EtaSeed, double PhiSeed, double ESeed, double E3x3Seed, double E5x5Seed, double see, double spp, double sep, double EMaxSeed, double E2ndSeed, double ETopSeed, double EBottomSeed, double ELeftSeed, double ERightSeed, double E2x5MaxSeed, double E2x5TopSeed, double E2x5BottomSeed, double E2x5LeftSeed, double E2x5RightSeed, double pt, double GsfTrackPIn, double fbrem, double Charge, double EoP, double IEtaSeed, double IPhiSeed, double EtaCrySeed, double PhiCrySeed, double PreShowerOverRaw, bool printDebug=false)
float eSubClusters() const
double regressionUncertaintyNoTrkVar(double SCRawEnergy, double scEta, double scPhi, double R9, double etawidth, double phiwidth, double NClusters, double HoE, double rho, double vertices, double EtaSeed, double PhiSeed, double ESeed, double E3x3Seed, double E5x5Seed, double see, double spp, double sep, double EMaxSeed, double E2ndSeed, double ETopSeed, double EBottomSeed, double ELeftSeed, double ERightSeed, double E2x5MaxSeed, double E2x5TopSeed, double E2x5BottomSeed, double E2x5LeftSeed, double E2x5RightSeed, double IEtaSeed, double IPhiSeed, double EtaCrySeed, double PhiCrySeed, double PreShowerOverRaw, bool printDebug=false)
bool isInitialized() const
~RegressionEnergyPatElectronProducer() override
edm::EDGetTokenT< EcalRecHitCollection > recHitCollectionEBToken_
double regressionValueWithSubClusters(double SCRawEnergy, double scEta, double scPhi, double R9, double etawidth, double phiwidth, double NClusters, double HoE, double rho, double vertices, double EtaSeed, double PhiSeed, double ESeed, double E3x3Seed, double E5x5Seed, double see, double spp, double sep, double EMaxSeed, double E2ndSeed, double ETopSeed, double EBottomSeed, double ELeftSeed, double ERightSeed, double E2x5MaxSeed, double E2x5TopSeed, double E2x5BottomSeed, double E2x5LeftSeed, double E2x5RightSeed, double IEtaSeed, double IPhiSeed, double EtaCrySeed, double PhiCrySeed, double PreShowerOverRaw, double isEcalDriven, double isEtaGap, double isPhiGap, double isDeeGap, double ESubs, double ESub1, double EtaSub1, double PhiSub1, double EMaxSub1, double E3x3Sub1, double ESub2, double EtaSub2, double PhiSub2, double EMaxSub2, double E3x3Sub2, double ESub3, double EtaSub3, double PhiSub3, double EMaxSub3, double E3x3Sub3, double NPshwClusters, double EPshwSubs, double EPshwSub1, double EtaPshwSub1, double PhiPshwSub1, double EPshwSub2, double EtaPshwSub2, double PhiPshwSub2, double EPshwSub3, double EtaPshwSub3, double PhiPshwSub3, bool isEB, bool printDebug=false)
const CaloTopology * ecalTopology_
edm::EDGetTokenT< EcalRecHitCollection > recHitCollectionEEToken_
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
float esClusterEta(unsigned i) const
std::string regressionInputFile_
#define DEFINE_FWK_MODULE(type)
float subClusterEnergy(unsigned i) const
std::vector< Electron > ElectronCollection
edm::EDGetTokenT< reco::VertexCollection > verticesInputToken_
double regressionValueNoTrkVar(double SCRawEnergy, double scEta, double scPhi, double R9, double etawidth, double phiwidth, double NClusters, double HoE, double rho, double vertices, double EtaSeed, double PhiSeed, double ESeed, double E3x3Seed, double E5x5Seed, double see, double spp, double sep, double EMaxSeed, double E2ndSeed, double ETopSeed, double EBottomSeed, double ELeftSeed, double ERightSeed, double E2x5MaxSeed, double E2x5TopSeed, double E2x5BottomSeed, double E2x5LeftSeed, double E2x5RightSeed, double IEtaSeed, double IPhiSeed, double EtaCrySeed, double PhiCrySeed, double PreShowerOverRaw, bool printDebug=false)
float preshowerEnergyOverRaw() const
void initialize(std::string weightsFile, ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType type)
float preshowerEnergy() const
float hadronicOverEm() const
void correctEcalEnergy(float newEnergy, float newEnergyError, bool corrEovP=true)
float subClusterEmax(unsigned i) const
ElectronEnergyRegressionType
double p() const final
magnitude of momentum vector
ElectronEnergyRegressionEvaluate * regressionEvaluator_
float esClusterPhi(unsigned i) const
float subClusterPhi(unsigned i) const
T const * product() const
double regressionUncertaintyWithTrkVar(double electronP, double SCRawEnergy, double scEta, double scPhi, double R9, double etawidth, double phiwidth, double NClusters, double HoE, double rho, double vertices, double EtaSeed, double PhiSeed, double ESeed, double E3x3Seed, double E5x5Seed, double see, double spp, double sep, double EMaxSeed, double E2ndSeed, double ETopSeed, double EBottomSeed, double ELeftSeed, double ERightSeed, double E2x5MaxSeed, double E2x5TopSeed, double E2x5BottomSeed, double E2x5LeftSeed, double E2x5RightSeed, double pt, double GsfTrackPIn, double fbrem, double Charge, double EoP, double IEtaSeed, double IPhiSeed, double EtaCrySeed, double PhiCrySeed, double PreShowerOverRaw, bool printDebug=false)
const CaloGeometry * caloGeometry_
Analysis-level electron class.
uint32_t energyRegressionType_
std::string nameEnergyErrorReg_
edm::EDGetTokenT< reco::GsfElectronCollection > inputGsfElectronsToken_
float nPreshowerClusters() const
edm::EDGetTokenT< double > rhoInputToken_
void produce(edm::Event &, const edm::EventSetup &) override
float clustersSize() const
float subClusterEta(unsigned i) const
double regressionUncertaintyWithSubClusters(double SCRawEnergy, double scEta, double scPhi, double R9, double etawidth, double phiwidth, double NClusters, double HoE, double rho, double vertices, double EtaSeed, double PhiSeed, double ESeed, double E3x3Seed, double E5x5Seed, double see, double spp, double sep, double EMaxSeed, double E2ndSeed, double ETopSeed, double EBottomSeed, double ELeftSeed, double ERightSeed, double E2x5MaxSeed, double E2x5TopSeed, double E2x5BottomSeed, double E2x5LeftSeed, double E2x5RightSeed, double IEtaSeed, double IPhiSeed, double EtaCrySeed, double PhiCrySeed, double PreShowerOverRaw, double isEcalDriven, double isEtaGap, double isPhiGap, double isDeeGap, double ESubs, double ESub1, double EtaSub1, double PhiSub1, double EMaxSub1, double E3x3Sub1, double ESub2, double EtaSub2, double PhiSub2, double EMaxSub2, double E3x3Sub2, double ESub3, double EtaSub3, double PhiSub3, double EMaxSub3, double E3x3Sub3, double NPshwClusters, double EPshwSubs, double EPshwSub1, double EtaPshwSub1, double PhiPshwSub1, double EPshwSub2, double EtaPshwSub2, double PhiPshwSub2, double EPshwSub3, double EtaPshwSub3, double PhiPshwSub3, bool isEB, bool printDebug=false)
double phi() const final
momentum azimuthal angle
void setEcalRegressionEnergy(double val, double err)
set regression1
edm::EDGetTokenT< pat::ElectronCollection > inputPatElectronsToken_
bool ecalDrivenSeed() const