CMS 3D CMS Logo

PatJPsiProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: PatJPsiProducer
4 // Class: PatJPsiProducer
5 //
13 //
14 // Original Author: "Salvatore Rappoccio"
15 // Created: Mon Sep 28 12:53:57 CDT 2009
16 //
17 //
18 
19 // system include files
20 #include <memory>
21 
22 // user include files
25 
28 
30 
38 
39 #include <TLorentzVector.h>
40 
41 #include <vector>
42 
43 //
44 // class decleration
45 //
46 
48 public:
49  explicit PatJPsiProducer(const edm::ParameterSet&);
50  ~PatJPsiProducer() override;
51 
52 private:
53  void beginJob() override;
54  void produce(edm::Event&, const edm::EventSetup&) override;
55  void endJob() override;
56 
57  // ----------member data ---------------------------
58 
60 };
61 
62 //
63 // constants, enums and typedefs
64 //
65 
66 //
67 // static data member definitions
68 //
69 
70 //
71 // constructors and destructor
72 //
74  : muonSrcToken_(consumes<edm::View<pat::Muon>>(iConfig.getParameter<edm::InputTag>("muonSrc"))) {
75  produces<std::vector<pat::CompositeCandidate>>();
76 }
77 
79 
80 //
81 // member functions
82 //
83 
84 // ------------ method called to produce the data ------------
86  auto jpsiCands = std::make_unique<std::vector<pat::CompositeCandidate>>();
88  iEvent.getByToken(muonSrcToken_, h_muons);
89 
90  // const double MUON_MASS = 0.106;
91  const double JPSI_MASS = 3.097;
92 
93  if (h_muons.isValid() && h_muons->size() > 1) {
94  for (edm::View<pat::Muon>::const_iterator muonsBegin = h_muons->begin(),
95  muonsEnd = h_muons->end(),
96  imuon = muonsBegin;
97  imuon != muonsEnd - 1;
98  ++imuon) {
99  if (imuon->pt() > 1.0) {
100  for (edm::View<pat::Muon>::const_iterator jmuon = imuon + 1; jmuon != muonsEnd; ++jmuon) {
101  if (imuon->charge() * jmuon->charge() < 0) {
103  jpsi.addDaughter(*imuon, "mu1");
104  jpsi.addDaughter(*jmuon, "mu2");
105 
106  AddFourMomenta addp4;
107  addp4.set(jpsi);
108 
109  double dR = reco::deltaR<pat::Muon, pat::Muon>(*imuon, *jmuon);
110 
111  jpsi.addUserFloat("dR", dR);
112 
113  if (fabs(jpsi.mass() - JPSI_MASS) < 1.0) {
114  jpsiCands->push_back(jpsi);
115  }
116  }
117  }
118  }
119  }
120  }
121 
122  iEvent.put(std::move(jpsiCands));
123 }
124 
125 // ------------ method called once each job just before starting event loop ------------
127 
128 // ------------ method called once each job just after ending the event loop ------------
130 
131 //define this as a plug-in
CompositeCandidate.h
EDProducer.h
sistrip::View
View
Definition: ConstantsForView.h:26
edm::EDGetTokenT
Definition: EDGetToken.h:33
pat::CompositeCandidate
Analysis-level particle class.
Definition: CompositeCandidate.h:31
edm
HLT enums.
Definition: AlignableModifier.h:19
Muon.h
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89281
PatJPsiProducer::endJob
void endJob() override
Definition: PatJPsiProducer.cc:129
edm::Handle
Definition: AssociativeIterator.h:50
Muon
Definition: Muon.py:1
MakerMacros.h
Track.h
TrackFwd.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
PatJPsiProducer::beginJob
void beginJob() override
Definition: PatJPsiProducer.cc:126
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
deltaR.h
PatJPsiProducer
Definition: PatJPsiProducer.cc:47
AddFourMomenta.h
iEvent
int iEvent
Definition: GenABIO.cc:224
jpsi
#define jpsi
Definition: CascadeWrapper.h:46
PatJPsiProducer::~PatJPsiProducer
~PatJPsiProducer() override
Definition: PatJPsiProducer.cc:78
edm::EventSetup
Definition: EventSetup.h:58
pat
Definition: HeavyIon.h:7
PatJPsiProducer::PatJPsiProducer
PatJPsiProducer(const edm::ParameterSet &)
Definition: PatJPsiProducer.cc:73
eostools.move
def move(src, dest)
Definition: eostools.py:511
PatJPsiProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: PatJPsiProducer.cc:85
RecoChargedCandidate.h
Frameworkfwd.h
AddFourMomenta::set
void set(reco::Candidate &c) const
set up a candidate
Definition: AddFourMomenta.cc:6
edm::EDProducer
Definition: EDProducer.h:35
edm::View::const_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
AddFourMomenta
Definition: AddFourMomenta.h:18
HGC3DClusterGenMatchSelector_cfi.dR
dR
Definition: HGC3DClusterGenMatchSelector_cfi.py:7
ParameterSet.h
edm::Event
Definition: Event.h:73
PatJPsiProducer::muonSrcToken_
edm::EDGetTokenT< edm::View< pat::Muon > > muonSrcToken_
Definition: PatJPsiProducer.cc:59