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;
129 for(reco::SuperClusterCollection::const_iterator scItEndcap = scIslandCollection->begin();
130 scItEndcap != scIslandCollection->end(); scItEndcap++){
132 std::cout <<
"EE " << scItEndcap->energy() <<
" " << scItEndcap->eta() <<
" " << scItEndcap->phi() <<
" " << eleIt->eta() <<
" " << eleIt->phi() << std::endl;
135 double DeltaReleSC =
sqrt (
pow( eleIt->eta() - scItEndcap->eta(),2) +
pow(eleIt->phi() - scItEndcap->phi(),2));
137 if(DeltaReleSC<DeltaRMineleSCendcap)
139 DeltaRMineleSCendcap = DeltaReleSC;
140 nearestSCendcap = &*scItEndcap;
150 if(nearestSCbarrel && !nearestSCendcap){
152 newEleCore.setGsfTrack(eleIt->gsfTrack());
154 newEleCore.setSuperCluster(scRef);
156 pOutEleCore->push_back(newEleCore);
160 newEle.setP4(eleIt->p4()*(nearestSCbarrel->
energy()/eleIt->ecalEnergy()));
162 pOutEle->push_back(newEle);
164 std::cout <<
"Association is with EB superCluster "<< std::endl;
168 if(!nearestSCbarrel && nearestSCendcap)
171 std::cout <<
"Starting Association is with EE superCluster "<< std::endl;
174 float preshowerEnergy=eleIt->superCluster()->preshowerEnergy();
176 std::cout <<
"preshowerEnergy"<< preshowerEnergy << std::endl;
187 pOutNewEndcapSC->push_back(newSC);
191 newEleCore.setGsfTrack(eleIt->gsfTrack());
192 newEleCore.setSuperCluster(scRef);
194 pOutEleCore->push_back(newEleCore);
199 newEle.setP4(eleIt->p4()*(newSC.energy()/eleIt->ecalEnergy())) ;
200 pOutEle->push_back(newEle);
203 std::cout <<
"Association is with EE superCluster "<< std::endl;
207 if(nearestSCbarrel && nearestSCendcap){
209 newEleCore.setGsfTrack(eleIt->gsfTrack());
212 if(DeltaRMineleSCendcap>=DeltaRMineleSCbarrel)
215 newEleCore.setSuperCluster(scRef);
217 pOutEleCore->push_back(newEleCore);
221 newEle.setP4(eleIt->p4()*(nearestSCbarrel->
energy()/eleIt->ecalEnergy()));
222 pOutEle->push_back(newEle);
226 std::cout <<
"Association is with EB superCluster, after quarrel "<< std::endl;
229 else if(DeltaRMineleSCendcap<DeltaRMineleSCbarrel)
231 float preshowerEnergy=eleIt->superCluster()->preshowerEnergy();
237 pOutNewEndcapSC->push_back(newSC);
239 newEleCore.setSuperCluster(scRef);
241 pOutEleCore->push_back(newEleCore);
245 newEle.setP4(eleIt->p4()*(newSC.energy()/eleIt->ecalEnergy())) ;
246 pOutEle->push_back(newEle);
248 std::cout <<
"Association is with EE superCluster, after quarrel "<< std::endl;
260 std::cout <<
"Filled new electrons " << pOutEle->size() << std::endl;
261 std::cout <<
"Filled new electronsCore " << pOutEleCore->size() << std::endl;
262 std::cout <<
"Filled new endcapSC " << pOutNewEndcapSC->size() << std::endl;
269 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()
std::string scCollection_
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
T const * product() const
std::string scIslandProducer_
CaloCluster_iterator clustersBegin() const
fist iterator over BasicCluster constituents
const CaloClusterPtr & seed() const
seed BasicCluster
boost::remove_cv< typename boost::remove_reference< argument_type >::type >::type key_type
Power< A, B >::type pow(const A &a, const B &b)
CaloCluster_iterator clustersEnd() const
last iterator over BasicCluster constituents