CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L3MuonCandidateProducer.cc
Go to the documentation of this file.
1 
18 // Framework
25 
27 
28 // Input and output collections
33 
34 #include <string>
35 
36 using namespace edm;
37 using namespace std;
38 using namespace reco;
39 
42  LogTrace("Muon|RecoMuon|L3MuonCandidateProducer")<<" constructor called";
43 
44  // StandAlone Collection Label
45  theL3CollectionLabel = parameterSet.getParameter<InputTag>("InputObjects");
46 
47  produces<RecoChargedCandidateCollection>();
48 }
49 
52  LogTrace("Muon|RecoMuon|L3MuonCandidateProducer")<<" L3MuonCandidateProducer destructor called";
53 }
54 
55 
58  const string metname = "Muon|RecoMuon|L3MuonCandidateProducer";
59 
60  // Take the L3 container
61  LogTrace(metname)<<" Taking the L3/GLB muons: "<<theL3CollectionLabel.label();
63  event.getByLabel(theL3CollectionLabel,tracks);
64 
65  // Create a RecoChargedCandidate collection
66  LogTrace(metname)<<" Creating the RecoChargedCandidate collection";
67  auto_ptr<RecoChargedCandidateCollection> candidates( new RecoChargedCandidateCollection());
68 
69  for (unsigned int i=0; i<tracks->size(); i++) {
70  TrackRef tkref(tracks,i);
71  Particle::Charge q = tkref->charge();
72  Particle::LorentzVector p4(tkref->px(), tkref->py(), tkref->pz(), tkref->p());
73  Particle::Point vtx(tkref->vx(),tkref->vy(), tkref->vz());
74 
75  int pid = 13;
76  if(abs(q)==1) pid = q < 0 ? 13 : -13;
77  else LogWarning(metname) << "L3MuonCandidate has charge = "<<q;
78  RecoChargedCandidate cand(q, p4, vtx, pid);
79 
80  cand.setTrack(tkref);
81  candidates->push_back(cand);
82  }
83 
84  event.put(candidates);
85 
86  LogTrace(metname)<<" Event loaded"
87  <<"================================";
88 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
const std::string metname
L3MuonCandidateProducer(const edm::ParameterSet &)
constructor with config
#define abs(x)
Definition: mlp_lapack.h:159
int Charge
electric charge type
Definition: Particle.h:24
double p4[4]
Definition: TauolaWrapper.h:92
math::XYZPoint Point
point in the space
Definition: Particle.h:30
virtual ~L3MuonCandidateProducer()
destructor
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
#define LogTrace(id)
std::vector< RecoChargedCandidate > RecoChargedCandidateCollection
collectin of RecoChargedCandidate objects
tuple tracks
Definition: testEve_cfg.py:39
virtual void produce(edm::Event &, const edm::EventSetup &)
produce candidates
void setTrack(const reco::TrackRef &r)
set reference to track
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:26