59 std::cout<<
"GEDElectronRecalibSuperClusterAssociator::produce" << std::endl;
72 std::cout<<
"EB scCollection->size()" << superClusterEBHandle->size()<<std::endl;
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;
void setP4(P4Kind kind, const LorentzVector &p4, float p4Error, bool setCandidate)
edm::EDGetTokenT< reco::SuperClusterCollection > ebScToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::EDGetTokenT< reco::SuperClusterCollection > eeScToken_
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
void setSuperCluster(const SuperClusterRef &scl)
void setCorrectedEcalEnergyError(float newEnergyError)
void setParentSuperCluster(const SuperClusterRef &scl)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
std::vector< GsfElectronCore > GsfElectronCoreCollection
double deltaR2(const T1 &t1, const T2 &t2)
RefProd< PROD > getRefBeforePut()
void setCorrectedEcalEnergy(float newEnergy)
edm::EDGetTokenT< reco::GsfElectronCollection > electronToken_
boost::remove_cv< typename boost::remove_reference< argument_type >::type >::type key_type