56 std::cout<<
"ElectronRecalibSuperClusterAssociator::produce" << std::endl;
69 if (!pSuperClusters.
isValid()) {
70 std::cerr <<
"Error! can't get the product SuperClusterCollection "<< std::endl;
75 std::cout<<
"scCollection->size()"<<scCollection->size()<<std::endl;
81 if (!pIslandSuperClusters.
isValid()) {
82 std::cerr <<
"Error! can't get the product IslandSuperClusterCollection "<< std::endl;
87 std::cout<<
"scEECollection->size()"<<scIslandCollection->size()<<std::endl;
94 std::cerr <<
"Error! can't get the product ElectronCollection "<< std::endl;
98 for(reco::GsfElectronCollection::const_iterator eleIt = electronCollection->begin(); eleIt != electronCollection->end(); eleIt++)
100 float DeltaRMineleSCbarrel(0.15);
101 float DeltaRMineleSCendcap(0.15);
108 for(reco::SuperClusterCollection::const_iterator scIt = scCollection->begin();
109 scIt != scCollection->end(); scIt++){
111 std::cout << scIt->energy() <<
" " << scIt->eta() <<
" " << scIt->phi() <<
" " << eleIt->eta() <<
" " << eleIt->phi() << std::endl;
114 double DeltaReleSC =
sqrt (
pow( eleIt->eta() - scIt->eta(),2) +
pow(eleIt->phi() - scIt->phi(),2));
116 if(DeltaReleSC<DeltaRMineleSCbarrel)
118 DeltaRMineleSCbarrel = DeltaReleSC;
119 nearestSCbarrel = &*scIt;
128 for(reco::SuperClusterCollection::const_iterator scItEndcap = scIslandCollection->begin();
129 scItEndcap != scIslandCollection->end(); scItEndcap++){
131 std::cout <<
"EE " << scItEndcap->energy() <<
" " << scItEndcap->eta() <<
" " << scItEndcap->phi() <<
" " << eleIt->eta() <<
" " << eleIt->phi() << std::endl;
134 double DeltaReleSC =
sqrt (
pow( eleIt->eta() - scItEndcap->eta(),2) +
pow(eleIt->phi() - scItEndcap->phi(),2));
136 if(DeltaReleSC<DeltaRMineleSCendcap)
138 DeltaRMineleSCendcap = DeltaReleSC;
139 nearestSCendcap = &*scItEndcap;
148 if(nearestSCbarrel && !nearestSCendcap){
150 newEleCore.setGsfTrack(eleIt->gsfTrack());
152 newEleCore.setSuperCluster(scRef);
154 pOutEleCore->push_back(newEleCore);
158 newEle.setP4(eleIt->p4()*(nearestSCbarrel->
energy()/eleIt->ecalEnergy()));
160 pOutEle->push_back(newEle);
162 std::cout <<
"Association is with EB superCluster "<< std::endl;
166 if(!nearestSCbarrel && nearestSCendcap)
169 std::cout <<
"Starting Association is with EE superCluster "<< std::endl;
172 float preshowerEnergy=eleIt->superCluster()->preshowerEnergy();
174 std::cout <<
"preshowerEnergy"<< preshowerEnergy << std::endl;
185 pOutNewEndcapSC->push_back(newSC);
189 newEleCore.setGsfTrack(eleIt->gsfTrack());
190 newEleCore.setSuperCluster(scRef);
192 pOutEleCore->push_back(newEleCore);
197 newEle.setP4(eleIt->p4()*(newSC.energy()/eleIt->ecalEnergy())) ;
198 pOutEle->push_back(newEle);
201 std::cout <<
"Association is with EE superCluster "<< std::endl;
205 if(nearestSCbarrel && nearestSCendcap){
207 newEleCore.setGsfTrack(eleIt->gsfTrack());
210 if(DeltaRMineleSCendcap>=DeltaRMineleSCbarrel)
213 newEleCore.setSuperCluster(scRef);
215 pOutEleCore->push_back(newEleCore);
219 newEle.setP4(eleIt->p4()*(nearestSCbarrel->
energy()/eleIt->ecalEnergy()));
220 pOutEle->push_back(newEle);
224 std::cout <<
"Association is with EB superCluster, after quarrel "<< std::endl;
227 else if(DeltaRMineleSCendcap<DeltaRMineleSCbarrel)
229 float preshowerEnergy=eleIt->superCluster()->preshowerEnergy();
235 pOutNewEndcapSC->push_back(newSC);
237 newEleCore.setSuperCluster(scRef);
239 pOutEleCore->push_back(newEleCore);
243 newEle.setP4(eleIt->p4()*(newSC.energy()/eleIt->ecalEnergy())) ;
244 pOutEle->push_back(newEle);
246 std::cout <<
"Association is with EE superCluster, after quarrel "<< std::endl;
258 std::cout <<
"Filled new electrons " << pOutEle->size() << std::endl;
259 std::cout <<
"Filled new electronsCore " << pOutEleCore->size() << std::endl;
260 std::cout <<
"Filled new endcapSC " << pOutNewEndcapSC->size() << std::endl;
267 e.
put(pOutNewEndcapSC);
std::string scIslandCollection_
std::string electronCollection_
const math::XYZPoint & position() const
cluster centroid position
void push_back(Ptr< T > const &iPtr)
edm::Ptr< CaloCluster > CaloClusterPtr
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
edm::RefToBase< reco::Track > TrackBaseRef
persistent reference to a Track, using views
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
std::vector< GsfElectronCore > GsfElectronCoreCollection
edm::RefVector< GsfTrackCollection > GsfTrackRefVector
vector of reference to GsfTrack in the same collection
double energy() const
cluster energy
std::string electronProducer_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
RefProd< PROD > getRefBeforePut()
T const * product() const
std::string scCollection_
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
std::string scIslandProducer_
CaloCluster_iterator clustersBegin() const
fist iterator over BasicCluster constituents
const CaloClusterPtr & seed() const
seed BasicCluster
Power< A, B >::type pow(const A &a, const B &b)
boost::remove_cv< typename boost::remove_reference< argument_type >::type >::type key_type
CaloCluster_iterator clustersEnd() const
last iterator over BasicCluster constituents