CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L3MuonCandidateProducerFromMuons.cc
Go to the documentation of this file.
1 
8 // Framework
15 
17 
18 // Input and output collections
21 
24 
27 
28 #include <string>
29 
30 using namespace edm;
31 using namespace std;
32 using namespace reco;
33 
34 static const std::string category("Muon|RecoMuon|L3MuonCandidateProducerFromMuons");
35 
38  m_L3CollectionLabel( parameterSet.getParameter<InputTag>("InputObjects") ) // standAlone Collection Label
39 {
40  LogTrace(category)<<" constructor called";
41  produces<RecoChargedCandidateCollection>();
42 }
43 
46  LogTrace(category)<<" L3MuonCandidateProducerFromMuons destructor called";
47 }
48 
49 
52  // Create a RecoChargedCandidate collection
53  LogTrace(category)<<" Creating the RecoChargedCandidate collection";
54  auto_ptr<RecoChargedCandidateCollection> candidates( new RecoChargedCandidateCollection());
55 
56  // Take the L3 container
57  LogTrace(category)<<" Taking the L3/GLB muons: "<<m_L3CollectionLabel.label();
59  event.getByLabel(m_L3CollectionLabel,muons);
60 
61  if (not muons.isValid()) {
62  LogError(category) << muons.whyFailed()->what();
63  } else {
64  for (unsigned int i=0; i<muons->size(); i++) {
65  TrackRef tkref = (*muons)[i].innerTrack();
66 
67  Particle::Charge q = tkref->charge();
68  Particle::LorentzVector p4(tkref->px(), tkref->py(), tkref->pz(), tkref->p());
69  Particle::Point vtx(tkref->vx(),tkref->vy(), tkref->vz());
70 
71  int pid = 13;
72  if (abs(q)==1)
73  pid = q < 0 ? 13 : -13;
74  else
75  LogWarning(category) << "L3MuonCandidate has charge = " << q;
76  RecoChargedCandidate cand(q, p4, vtx, pid);
77 
78  cand.setTrack(tkref);
79  candidates->push_back(cand);
80  }
81  }
82  event.put(candidates);
83 }
int i
Definition: DBlmapReader.cc:9
#define abs(x)
Definition: mlp_lapack.h:159
int Charge
electric charge type
Definition: Particle.h:23
double p4[4]
Definition: TauolaWrapper.h:92
math::XYZPoint Point
point in the space
Definition: Particle.h:29
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
bool isValid() const
Definition: HandleBase.h:76
boost::shared_ptr< cms::Exception > whyFailed() const
Definition: HandleBase.h:90
#define LogTrace(id)
L3MuonCandidateProducerFromMuons(const edm::ParameterSet &)
constructor with config
std::vector< RecoChargedCandidate > RecoChargedCandidateCollection
collectin of RecoChargedCandidate objects
std::string const & label() const
Definition: InputTag.h:42
virtual void produce(edm::Event &, const edm::EventSetup &)
produce candidates
tuple muons
Definition: patZpeak.py:38
static const std::string category("Muon|RecoMuon|L3MuonCandidateProducerFromMuons")
void setTrack(const reco::TrackRef &r)
set reference to track
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:25