CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
L3MuonCandidateProducer Class Reference

#include <L3MuonCandidateProducer.h>

Inheritance diagram for L3MuonCandidateProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Types

enum  MuonTrackType { InnerTrack, OuterTrack, CombinedTrack }
 
- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 

Public Member Functions

 L3MuonCandidateProducer (const edm::ParameterSet &)
 constructor with config More...
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 produce candidates More...
 
virtual ~L3MuonCandidateProducer ()
 destructor More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Attributes

edm::InputTag theL3CollectionLabel
 
edm::InputTag theL3LinksLabel
 
enum MuonTrackType theType
 
bool theUseLinks
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Intermediate step in the L3 muons selection. This class takes the L3 muons (which are reco::Tracks) and creates the correspondent reco::RecoChargedCandidate.

Riccardo's comment: The separation between the L3MuonProducer and this class allows the interchangeability of the L3MuonProducer and the StandAloneMuonProducer This class is supposed to be removed once the L3/STA comparison will be done, then the RecoChargedCandidate production will be put into the L3MuonProducer class.

Author
J.Alcaraz

Intermediate step in the L3 muons selection. This class takes the L3 muons (which are reco::Tracks) and creates the correspondent reco::RecoChargedCandidate.

Riccardo's comment: The separation between the L3MuonProducer and this class allows the interchangeability of the L3MuonProducer and the StandAloneMuonProducer This class is supposed to be removed once the L3/STA comparison will be done, then the RecoChargedCandidate production will be done into the L3MuonProducer class.

Author
J.Alcaraz

Definition at line 26 of file L3MuonCandidateProducer.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

L3MuonCandidateProducer::L3MuonCandidateProducer ( const edm::ParameterSet parameterSet)

constructor with config

Definition at line 48 of file L3MuonCandidateProducer.cc.

References category, edm::ParameterSet::existsAs(), edm::ParameterSet::getParameter(), LogTrace, and or.

48  {
49  LogTrace(category)<<" constructor called";
50 
51  // StandAlone Collection Label
52  theL3CollectionLabel = parameterSet.getParameter<InputTag>("InputObjects");
53 
54  // use links
55  theUseLinks = parameterSet.existsAs<InputTag>("InputLinksObjects");
56  if (theUseLinks) {
57  theL3LinksLabel = parameterSet.getParameter<InputTag>("InputLinksObjects");
58  if (theL3LinksLabel.label() == "" or theL3LinksLabel.label() == "unused")
59  theUseLinks = false;
60  }
61 
62  // use global, standalone or tracker pT/4-vector assignment
63  const std::string & muon_track_for_momentum = parameterSet.existsAs<std::string>("MuonPtOption") ? parameterSet.getParameter<std::string>("MuonPtOption") : "Global";
64  if (muon_track_for_momentum == std::string("Tracker"))
66  else if (muon_track_for_momentum == std::string("Standalone"))
68  else if (muon_track_for_momentum == std::string("Global"))
70  else {
71  LogError(category)<<"invalid value for MuonPtOption, please choose among 'Tracker', 'Standalone', 'Global'";
73  }
74 
75  produces<RecoChargedCandidateCollection>();
76 }
T getParameter(std::string const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:187
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
static const char category[]
#define LogTrace(id)
std::string const & label() const
Definition: InputTag.h:25
L3MuonCandidateProducer::~L3MuonCandidateProducer ( )
virtual

destructor

Definition at line 79 of file L3MuonCandidateProducer.cc.

References category, and LogTrace.

79  {
80  LogTrace(category)<<" L3MuonCandidateProducer destructor called";
81 }
static const char category[]
#define LogTrace(id)

Member Function Documentation

void L3MuonCandidateProducer::produce ( edm::Event event,
const edm::EventSetup eventSetup 
)
virtual

produce candidates

reconstruct muons

Implements edm::EDProducer.

Definition at line 85 of file L3MuonCandidateProducer.cc.

References abs, category, deltaR(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, i, edm::Ref< C, T, F >::isNull(), link(), LogDebug, LogTrace, p4, evf::utils::pid, lumiQueryAPI::q, reco::RecoChargedCandidate::setTrack(), and testEve_cfg::tracks.

85  {
86  // Take the L3 container
87  LogTrace(category)<<" Taking the L3/GLB muons: "<<theL3CollectionLabel.label();
89  event.getByLabel(theL3CollectionLabel,tracks);
90 
92  if (theUseLinks)
93  event.getByLabel(theL3LinksLabel, links);
94 
95  // Create a RecoChargedCandidate collection
96  LogTrace(category)<<" Creating the RecoChargedCandidate collection";
97  auto_ptr<RecoChargedCandidateCollection> candidates( new RecoChargedCandidateCollection());
98  LogDebug(category) << " size = " << tracks->size();
99  for (unsigned int i=0; i<tracks->size(); i++) {
100  TrackRef inRef(tracks,i);
101  TrackRef tkRef = TrackRef();
102 
103  if (theUseLinks) {
104  for(reco::MuonTrackLinksCollection::const_iterator link = links->begin();
105  link != links->end(); ++link){ LogDebug(category) << " i = " << i;
106 
107  if (not link->trackerTrack().isNull()) LogTrace(category) << " link tk pt " << link->trackerTrack()->pt();
108  if (not link->standAloneTrack().isNull()) LogTrace(category) << " sta pt " << link->standAloneTrack()->pt();
109  if (not link->globalTrack().isNull()) LogTrace(category) << " global pt " << link->globalTrack()->pt();
110  if (not inRef.isNull()) LogTrace(category) << " inRef pt " << inRef->pt();
111 
112  if (link->globalTrack().isNull()) {
113  edm::LogError(category) << "null reference to the global track";
114  // skip this candidate
115  continue;
116  }
117 
118  float dR = deltaR(inRef->eta(),inRef->phi(),link->globalTrack()->eta(),link->globalTrack()->phi());
119  float dPt = abs(inRef->pt() - link->globalTrack()->pt())/inRef->pt();
120  if (dR < 0.02 and dPt < 0.001) {
121  LogTrace(category) << " *** pt matches *** ";
122  switch(theType) {
123  case InnerTrack: tkRef = link->trackerTrack(); break;
124  case OuterTrack: tkRef = link->standAloneTrack(); break;
125  case CombinedTrack: tkRef = link->globalTrack(); break;
126  default: tkRef = link->globalTrack(); break;
127  }
128  }
129  }
130  if (tkRef.isNull()) {
131  edm::LogWarning(category) << "null reference to the linked track, reverting to old behaviour";
132  tkRef = inRef;
133  }
134  } else {
135  // theUseLinks is false
136  tkRef = inRef;
137  }
138  LogDebug(category) << "tkRef Used For Momentum pt " << tkRef->pt() << " inRef from the input collection pt " << inRef->pt();
139 
140  Particle::Charge q = tkRef->charge();
141  Particle::LorentzVector p4(tkRef->px(), tkRef->py(), tkRef->pz(), tkRef->p());
142  Particle::Point vtx(tkRef->vx(),tkRef->vy(), tkRef->vz());
143 
144  int pid = 13;
145  if(abs(q)==1) pid = q < 0 ? 13 : -13;
146  else LogWarning(category) << "L3MuonCandidate has charge = "<<q;
147  RecoChargedCandidate cand(q, p4, vtx, pid);
148 
149  //set the inRef as the RecoChargedCandidate ref so that the isolation maps
150  //work in downstream filters
151  cand.setTrack(inRef);
152  candidates->push_back(cand);
153  }
154 
155  event.put(candidates);
156 
157  LogTrace(category)<<" Event loaded"
158  <<"================================";
159 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
static const char category[]
#define abs(x)
Definition: mlp_lapack.h:159
int Charge
electric charge type
Definition: Particle.h:23
std::string link(std::string &nm, std::string &ns)
Definition: hierarchy.cc:47
bool isNull() const
Checks for null.
Definition: Ref.h:247
double p4[4]
Definition: TauolaWrapper.h:92
math::XYZPoint Point
point in the space
Definition: Particle.h:29
#define LogTrace(id)
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
std::vector< RecoChargedCandidate > RecoChargedCandidateCollection
collectin of RecoChargedCandidate objects
tuple tracks
Definition: testEve_cfg.py:39
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:14
std::string const & label() const
Definition: InputTag.h:25
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:25

Member Data Documentation

edm::InputTag L3MuonCandidateProducer::theL3CollectionLabel
private

Definition at line 42 of file L3MuonCandidateProducer.h.

edm::InputTag L3MuonCandidateProducer::theL3LinksLabel
private

Definition at line 43 of file L3MuonCandidateProducer.h.

enum MuonTrackType L3MuonCandidateProducer::theType
private

Definition at line 44 of file L3MuonCandidateProducer.h.

bool L3MuonCandidateProducer::theUseLinks
private

Definition at line 45 of file L3MuonCandidateProducer.h.