28 template <
typename jetType>
30 hltLeptonTag(iConfig.getParameter< edm::InputTag > (
"HltLeptonTag")),
31 sourceJetTag(iConfig.getParameter< edm::InputTag > (
"SourceJetTag")),
32 minDeltaR_(iConfig.getParameter< double > (
"minDeltaR"))
39 produces<JetCollectionVector> ();
42 template <
typename jetType>
50 template <
typename jetType>
56 desc.
add<
double> (
"minDeltaR", 0.5);
67 template <
typename jetType>
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++) {
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++) {
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
virtual void produce(edm::Event &, const edm::EventSetup &)
edm::InputTag sourceJetTag
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
ParameterDescriptionBase * add(U const &iLabel, T const &value)
double deltaR(double eta1, double eta2, double phi1, double phi2)
edm::InputTag hltLeptonTag
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
~HLTJetCollectionsForBoostedLeptonPlusJets()
void add(std::string const &label, ParameterSetDescription const &psetDescription)
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< float > > LorentzVector
HLTJetCollectionsForBoostedLeptonPlusJets(const edm::ParameterSet &)
std::vector< reco::RecoEcalCandidateRef > VRphoton
math::PtEtaPhiELorentzVectorF LorentzVector