28 std::cout<<
"ElectronRecalibSuperClusterAssociator::ElectronRecalibSuperClusterAssociator" << std::endl;
32 produces<GsfElectronCollection>();
33 produces<GsfElectronCoreCollection>() ;
42 electronToken_ = consumes<reco::GsfElectronCollection>(electronSrc_);
43 ebScToken_ = consumes<reco::SuperClusterCollection>(superClusterCollectionEB_);
44 eeScToken_ = consumes<reco::SuperClusterCollection>(superClusterCollectionEE_);
47 std::cout<<
"ElectronRecalibSuperClusterAssociator::ElectronRecalibSuperClusterAssociator::end" << std::endl;
59 std::cout<<
"GEDElectronRecalibSuperClusterAssociator::produce" << std::endl;
63 auto pOutEle = std::make_unique<GsfElectronCollection>();
64 auto pOutEleCore = std::make_unique<GsfElectronCoreCollection>();
68 e.
getByToken(ebScToken_, superClusterEBHandle);
72 std::cout<<
"EB scCollection->size()" << superClusterEBHandle->size()<<std::endl;
77 e.
getByToken(eeScToken_, superClusterEEHandle);
81 std::cout<<
"EE scCollection->size()" << superClusterEEHandle->size() << std::endl;
93 for(reco::GsfElectronCollection::const_iterator eleIt = eleHandle->begin(); eleIt != eleHandle->end(); eleIt++)
95 float DeltaRMineleSCbarrel(0.15);
96 float DeltaRMineleSCendcap(0.15);
99 int iscRef=-1, iscRefendcap=-1;
102 if(eleIt->trackerDrivenSeed()){
103 edm::LogError(
"trackerDriven") <<
"skipping trackerDriven electrons";
108 for(reco::SuperClusterCollection::const_iterator scIt = superClusterEBHandle->begin();
109 scIt != superClusterEBHandle->end(); scIt++, iSC++){
112 scIt->eta(), scIt->phi()));
114 if(DeltaReleSC<DeltaRMineleSCbarrel)
116 DeltaRMineleSCbarrel = DeltaReleSC;
117 nearestSCbarrel = &*scIt;
121 std::cout <<
"EB: " << scIt - superClusterEBHandle->begin() <<
" " << iSC <<
" " << iscRef
122 <<
"\t" << std::setprecision(4) << scIt->energy()
123 <<
" " << scIt->eta() <<
" " << scIt->phi()
124 <<
"\t--\t" << eleIt->energy() <<
" " << eleIt->eta() <<
" " << eleIt->phi()
125 <<
"\t" << DeltaRMineleSCbarrel
132 for(reco::SuperClusterCollection::const_iterator scIt = superClusterEEHandle->begin();
133 scIt != superClusterEEHandle->end(); scIt++, iSC++){
135 std::cout <<
"EE: " << scIt - superClusterEEHandle->begin() <<
" " << iSC <<
" " << iscRef
136 <<
"\t" << std::setprecision(4) << scIt->energy()
137 <<
" " << scIt->eta() <<
" " << scIt->phi()
138 <<
"\t--\t " << eleIt->energy() <<
" " << eleIt->eta() <<
" " << eleIt->phi()
139 <<
"\t" << DeltaRMineleSCendcap
144 scIt->eta(), scIt->phi()));
146 if(DeltaReleSC<DeltaRMineleSCendcap)
148 DeltaRMineleSCendcap = DeltaReleSC;
149 nearestSCendcap = &*scIt;
156 if(eleIt->isEB() && DeltaRMineleSCbarrel > DeltaRMineleSCendcap){
157 edm::LogError(
"ElectronRecalibAssociator") <<
"EB electron, but nearest SC is in EE";;
161 if(eleIt->isEB() && nearestSCbarrel){
162 pOutEleCore->push_back(*eleIt->core());
187 }
else if(!(eleIt->isEB()) && nearestSCendcap)
189 pOutEleCore->push_back(*eleIt->core());
214 edm::LogError(
"Failed SC association") <<
"No SC to be associated to the electron";
221 std::cout <<
"Filled new electrons " << pOutEle->size() << std::endl;
222 std::cout <<
"Filled new electronsCore " << pOutEleCore->size() << std::endl;
T getParameter(std::string const &) const
void setP4(P4Kind kind, const LorentzVector &p4, float p4Error, bool setCandidate)
std::remove_cv< typename std::remove_reference< argument_type >::type >::type key_type
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
ElectronRecalibSuperClusterAssociator(const edm::ParameterSet &conf)
void setSuperCluster(const SuperClusterRef &scl)
void setCorrectedEcalEnergyError(float newEnergyError)
void setParentSuperCluster(const SuperClusterRef &scl)
virtual void produce(edm::Event &e, const edm::EventSetup &c)
std::vector< GsfElectronCore > GsfElectronCoreCollection
RefProd< PROD > getRefBeforePut()
virtual ~ElectronRecalibSuperClusterAssociator()
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
void setCorrectedEcalEnergy(float newEnergy)