86 vector<Ref<reco::RecoEcalCandidateCollection> > clusCands;
89 vector<Ref<reco::ElectronCollection> > eleCands;
95 vector<reco::RecoChargedCandidateRef> muonCands;
101 const JetCollection & theJetCollection = *theJetCollectionHandle;
103 auto_ptr < JetCollectionVector > allSelections(
new JetCollectionVector());
105 if(!clusCands.empty()){
106 for(
size_t candNr=0;candNr<clusCands.size();candNr++){
108 for (
unsigned int j = 0;
j < theJetCollection.size();
j++) {
112 std::vector<reco::PFCandidatePtr> pfConstituents = theJetCollection[
j].getPFConstituents();
113 for(std::vector<reco::PFCandidatePtr>::const_iterator i_candidate = pfConstituents.begin(); i_candidate != pfConstituents.end(); ++i_candidate){
114 TVector3 ClusP(clusCands[candNr]->
p4().Px(),clusCands[candNr]->
p4().Py(), clusCands[candNr]->
p4().Pz());
115 TVector3 PFJetConstP((*i_candidate)->px(),(*i_candidate)->py(),(*i_candidate)->pz());
116 double deltaRPFConste = ClusP.DeltaR(PFJetConstP);
117 if(deltaRPFConste < 0.001 && w==0){
118 const_cast<LorentzVector&
>(theJetCollection[
j].p4()) = theJetCollection[j].
p4() - clusCands[candNr]->p4();
122 refVector.push_back(
JetRef(theJetCollectionHandle, j));
125 allSelections->push_back(refVector);
129 if(!eleCands.empty()){
130 for(
size_t candNr=0;candNr<eleCands.size();candNr++){
132 for (
unsigned int j = 0; j < theJetCollection.size(); j++) {
133 if (
deltaR(eleCands[candNr]->superCluster()->
position(),theJetCollection[j]) >
minDeltaR_) refVector.push_back(
JetRef(theJetCollectionHandle, j));
136 std::vector<reco::PFCandidatePtr> pfConstituents = theJetCollection[
j].getPFConstituents();
137 for(std::vector<reco::PFCandidatePtr>::const_iterator i_candidate = pfConstituents.begin(); i_candidate != pfConstituents.end(); ++i_candidate){
138 TVector3 ElectronP(eleCands[candNr]->
p4().Px(),eleCands[candNr]->
p4().Py(), eleCands[candNr]->
p4().Pz());
139 TVector3 PFJetConstP((*i_candidate)->px(),(*i_candidate)->py(),(*i_candidate)->pz());
140 double deltaRPFConste = ElectronP.DeltaR(PFJetConstP);
141 if(deltaRPFConste < 0.001 && w==0){
142 const_cast<LorentzVector&
>(theJetCollection[
j].p4()) = theJetCollection[j].
p4() - eleCands[candNr]->p4();
146 refVector.push_back(
JetRef(theJetCollectionHandle, j));
149 allSelections->push_back(refVector);
153 if(!photonCands.empty()){
154 for(
size_t candNr=0;candNr<photonCands.size();candNr++){
156 for (
unsigned int j = 0; j < theJetCollection.size(); j++) {
157 if (
deltaR(photonCands[candNr]->superCluster()->
position(),theJetCollection[j]) >
minDeltaR_) refVector.push_back(
JetRef(theJetCollectionHandle, j));
160 std::vector<reco::PFCandidatePtr> pfConstituents = theJetCollection[
j].getPFConstituents();
161 for(std::vector<reco::PFCandidatePtr>::const_iterator i_candidate = pfConstituents.begin(); i_candidate != pfConstituents.end(); ++i_candidate){
162 TVector3 PhotonP(photonCands[candNr]->
p4().Px(),photonCands[candNr]->
p4().Py(), photonCands[candNr]->
p4().Pz());
163 TVector3 PFJetConstP((*i_candidate)->px(),(*i_candidate)->py(),(*i_candidate)->pz());
164 double deltaRPFConste = PhotonP.DeltaR(PFJetConstP);
165 if(deltaRPFConste < 0.001 && w==0){
166 const_cast<LorentzVector&
>(theJetCollection[
j].p4()) = theJetCollection[j].
p4() - photonCands[candNr]->p4();
170 refVector.push_back(
JetRef(theJetCollectionHandle, j));
173 allSelections->push_back(refVector);
177 if(!muonCands.empty()){
178 for(
size_t candNr=0;candNr<muonCands.size();candNr++){
180 for (
unsigned int j = 0; j < theJetCollection.size(); j++) {
181 if (
deltaR(muonCands[candNr]->
p4(),theJetCollection[j]) >
minDeltaR_) refVector.push_back(
JetRef(theJetCollectionHandle, j));
184 std::vector<reco::PFCandidatePtr> pfConstituents = theJetCollection[
j].getPFConstituents();
185 for(std::vector<reco::PFCandidatePtr>::const_iterator i_candidate = pfConstituents.begin(); i_candidate != pfConstituents.end(); ++i_candidate){
186 TVector3 MuP(muonCands[candNr]->
p4().Px(),muonCands[candNr]->
p4().Py(), muonCands[candNr]->
p4().Pz());
187 TVector3 PFJetConstP((*i_candidate)->px(),(*i_candidate)->py(),(*i_candidate)->pz());
188 double deltaRPFConste = MuP.DeltaR(PFJetConstP);
189 if(deltaRPFConste < 0.001 && w==0){
190 const_cast<LorentzVector&
>(theJetCollection[
j].p4()) = theJetCollection[j].
p4() - muonCands[candNr]->p4();
194 refVector.push_back(
JetRef(theJetCollectionHandle, j));
197 allSelections->push_back(refVector);
204 iEvent.
put(allSelections);
std::vector< Jet > JetCollection
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::EDGetTokenT< std::vector< jetType > > m_theJetToken
edm::Ref< JetCollection > JetRef
edm::RefVector< JetCollection > JetRefVector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > m_theLeptonToken
double deltaR(double eta1, double eta2, double phi1, double phi2)
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< float > > LorentzVector
static int position[264][3]
std::vector< reco::RecoEcalCandidateRef > VRphoton
math::PtEtaPhiELorentzVectorF LorentzVector