54 std::cout <<
"GEDElectronRecalibSuperClusterAssociator::produce" << std::endl;
58 auto pOutEle = std::make_unique<GsfElectronCollection>();
59 auto pOutEleCore = std::make_unique<GsfElectronCoreCollection>();
67 std::cout <<
"EB scCollection->size()" << superClusterEBHandle->size() << std::endl;
76 std::cout <<
"EE scCollection->size()" << superClusterEEHandle->size() << std::endl;
88 for (reco::GsfElectronCollection::const_iterator eleIt = eleHandle->begin(); eleIt != eleHandle->end(); eleIt++) {
89 float DeltaRMineleSCbarrel(0.15);
90 float DeltaRMineleSCendcap(0.15);
93 int iscRef = -1, iscRefendcap = -1;
96 if (eleIt->trackerDrivenSeed()) {
97 edm::LogError(
"trackerDriven") <<
"skipping trackerDriven electrons";
102 for (reco::SuperClusterCollection::const_iterator scIt = superClusterEBHandle->begin();
103 scIt != superClusterEBHandle->end();
105 double DeltaReleSC =
sqrt(
reco::deltaR2(eleIt->eta(), eleIt->phi(), scIt->eta(), scIt->phi()));
107 if (DeltaReleSC < DeltaRMineleSCbarrel)
109 DeltaRMineleSCbarrel = DeltaReleSC;
110 nearestSCbarrel = &*scIt;
114 std::cout <<
"EB: " << scIt - superClusterEBHandle->begin() <<
" " << iSC <<
" " << iscRef <<
"\t" 115 << std::setprecision(4) << scIt->energy() <<
" " << scIt->eta() <<
" " << scIt->phi() <<
"\t--\t" 116 << eleIt->energy() <<
" " << eleIt->eta() <<
" " << eleIt->phi() <<
"\t" << DeltaRMineleSCbarrel
123 for (reco::SuperClusterCollection::const_iterator scIt = superClusterEEHandle->begin();
124 scIt != superClusterEEHandle->end();
127 std::cout <<
"EE: " << scIt - superClusterEEHandle->begin() <<
" " << iSC <<
" " << iscRef <<
"\t" 128 << std::setprecision(4) << scIt->energy() <<
" " << scIt->eta() <<
" " << scIt->phi() <<
"\t--\t " 129 << eleIt->energy() <<
" " << eleIt->eta() <<
" " << eleIt->phi() <<
"\t" << DeltaRMineleSCendcap
133 double DeltaReleSC =
sqrt(
reco::deltaR2(eleIt->eta(), eleIt->phi(), scIt->eta(), scIt->phi()));
135 if (DeltaReleSC < DeltaRMineleSCendcap) {
136 DeltaRMineleSCendcap = DeltaReleSC;
137 nearestSCendcap = &*scIt;
144 if (eleIt->isEB() && DeltaRMineleSCbarrel > DeltaRMineleSCendcap) {
145 edm::LogError(
"ElectronRecalibAssociator") <<
"EB electron, but nearest SC is in EE";
150 if (eleIt->isEB() && nearestSCbarrel) {
151 pOutEleCore->push_back(*eleIt->core());
179 }
else if (!(eleIt->isEB()) && nearestSCendcap) {
180 pOutEleCore->push_back(*eleIt->core());
209 edm::LogError(
"Failed SC association") <<
"No SC to be associated to the electron";
214 std::cout <<
"Filled new electrons " << pOutEle->size() << std::endl;
215 std::cout <<
"Filled new electronsCore " << pOutEleCore->size() << std::endl;
void setP4(P4Kind kind, const LorentzVector &p4, float p4Error, bool setCandidate)
std::remove_cv< typename std::remove_reference< argument_type >::type >::type key_type
edm::EDGetTokenT< reco::SuperClusterCollection > ebScToken_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::EDGetTokenT< reco::SuperClusterCollection > eeScToken_
void setSuperCluster(const SuperClusterRef &scl)
void setCorrectedEcalEnergyError(float newEnergyError)
void setParentSuperCluster(const SuperClusterRef &scl)
std::vector< GsfElectronCore > GsfElectronCoreCollection
RefProd< PROD > getRefBeforePut()
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
void setCorrectedEcalEnergy(float newEnergy)
edm::EDGetTokenT< reco::GsfElectronCollection > electronToken_