93 vector<Ref<reco::RecoEcalCandidateCollection> > clusCands;
96 vector<Ref<reco::ElectronCollection> > eleCands;
102 vector<reco::RecoChargedCandidateRef> muonCands;
108 const JetCollection & theJetCollection = *theJetCollectionHandle;
110 auto_ptr < JetCollectionVector > allSelections(
new JetCollectionVector());
112 if(!clusCands.empty()){
113 for(
size_t candNr=0;candNr<clusCands.size();candNr++){
115 for (
unsigned int j = 0;
j < theJetCollection.size();
j++) {
119 std::vector<reco::PFCandidatePtr> pfConstituents = theJetCollection[
j].getPFConstituents();
120 for(std::vector<reco::PFCandidatePtr>::const_iterator i_candidate = pfConstituents.begin(); i_candidate != pfConstituents.end(); ++i_candidate){
121 TVector3 ClusP(clusCands[candNr]->
p4().Px(),clusCands[candNr]->
p4().Py(), clusCands[candNr]->
p4().Pz());
122 TVector3 PFJetConstP((*i_candidate)->px(),(*i_candidate)->py(),(*i_candidate)->pz());
123 double deltaRPFConste = ClusP.DeltaR(PFJetConstP);
124 if(deltaRPFConste < 0.001 && w==0){
125 const_cast<LorentzVector&
>(theJetCollection[
j].p4()) = theJetCollection[j].
p4() - clusCands[candNr]->p4();
129 refVector.push_back(
JetRef(theJetCollectionHandle, j));
132 allSelections->push_back(refVector);
136 if(!eleCands.empty()){
137 for(
size_t candNr=0;candNr<eleCands.size();candNr++){
139 for (
unsigned int j = 0; j < theJetCollection.size(); j++) {
140 if (
deltaR(eleCands[candNr]->superCluster()->
position(),theJetCollection[j]) >
minDeltaR_) refVector.push_back(
JetRef(theJetCollectionHandle, j));
143 std::vector<reco::PFCandidatePtr> pfConstituents = theJetCollection[
j].getPFConstituents();
144 for(std::vector<reco::PFCandidatePtr>::const_iterator i_candidate = pfConstituents.begin(); i_candidate != pfConstituents.end(); ++i_candidate){
145 TVector3 ElectronP(eleCands[candNr]->
p4().Px(),eleCands[candNr]->
p4().Py(), eleCands[candNr]->
p4().Pz());
146 TVector3 PFJetConstP((*i_candidate)->px(),(*i_candidate)->py(),(*i_candidate)->pz());
147 double deltaRPFConste = ElectronP.DeltaR(PFJetConstP);
148 if(deltaRPFConste < 0.001 && w==0){
149 const_cast<LorentzVector&
>(theJetCollection[
j].p4()) = theJetCollection[j].
p4() - eleCands[candNr]->p4();
153 refVector.push_back(
JetRef(theJetCollectionHandle, j));
157 allSelections->push_back(refVector);
161 if(!photonCands.empty()){
162 for(
size_t candNr=0;candNr<photonCands.size();candNr++){
164 for (
unsigned int j = 0; j < theJetCollection.size(); j++) {
165 if (
deltaR(photonCands[candNr]->superCluster()->
position(),theJetCollection[j]) >
minDeltaR_) refVector.push_back(
JetRef(theJetCollectionHandle, j));
168 std::vector<reco::PFCandidatePtr> pfConstituents = theJetCollection[
j].getPFConstituents();
169 for(std::vector<reco::PFCandidatePtr>::const_iterator i_candidate = pfConstituents.begin(); i_candidate != pfConstituents.end(); ++i_candidate){
170 TVector3 PhotonP(photonCands[candNr]->
p4().Px(),photonCands[candNr]->
p4().Py(), photonCands[candNr]->
p4().Pz());
171 TVector3 PFJetConstP((*i_candidate)->px(),(*i_candidate)->py(),(*i_candidate)->pz());
172 double deltaRPFConste = PhotonP.DeltaR(PFJetConstP);
173 if(deltaRPFConste < 0.001 && w==0){
174 const_cast<LorentzVector&
>(theJetCollection[
j].p4()) = theJetCollection[j].
p4() - photonCands[candNr]->p4();
178 refVector.push_back(
JetRef(theJetCollectionHandle, j));
181 allSelections->push_back(refVector);
185 if(!muonCands.empty()){
186 for(
size_t candNr=0;candNr<muonCands.size();candNr++){
188 for (
unsigned int j = 0; j < theJetCollection.size(); j++) {
189 if (
deltaR(muonCands[candNr]->
p4(),theJetCollection[j]) >
minDeltaR_) refVector.push_back(
JetRef(theJetCollectionHandle, j));
192 std::vector<reco::PFCandidatePtr> pfConstituents = theJetCollection[
j].getPFConstituents();
193 for(std::vector<reco::PFCandidatePtr>::const_iterator i_candidate = pfConstituents.begin(); i_candidate != pfConstituents.end(); ++i_candidate){
194 TVector3 MuP(muonCands[candNr]->
p4().Px(),muonCands[candNr]->
p4().Py(), muonCands[candNr]->
p4().Pz());
195 TVector3 PFJetConstP((*i_candidate)->px(),(*i_candidate)->py(),(*i_candidate)->pz());
196 double deltaRPFConste = MuP.DeltaR(PFJetConstP);
197 if(deltaRPFConste < 0.001 && w==0){
198 const_cast<LorentzVector&
>(theJetCollection[
j].p4()) = theJetCollection[j].
p4() - muonCands[candNr]->p4();
202 refVector.push_back(
JetRef(theJetCollectionHandle, j));
205 allSelections->push_back(refVector);
212 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
static int position[TOTALCHAMBERS][3]
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
std::vector< reco::RecoEcalCandidateRef > VRphoton
math::PtEtaPhiELorentzVectorF LorentzVector