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::EDConsumerBase edm::ProductRegistryHelper

Public Types

enum  MuonTrackType { InnerTrack, OuterTrack, CombinedTrack }
 
- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- 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 ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

edm::EDGetTokenT
< reco::MuonTrackLinksCollection
linkToken_
 
edm::InputTag theL3CollectionLabel
 
edm::InputTag theL3LinksLabel
 
enum MuonTrackType theType
 
bool theUseLinks
 
edm::EDGetTokenT
< reco::TrackCollection
trackToken_
 

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::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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 30 of file L3MuonCandidateProducer.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

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

constructor with config

Definition at line 45 of file L3MuonCandidateProducer.cc.

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

45  {
46  LogTrace(category)<<" constructor called";
47 
48  // StandAlone Collection Label
49  theL3CollectionLabel = parameterSet.getParameter<InputTag>("InputObjects");
50  trackToken_ = consumes<reco::TrackCollection>(theL3CollectionLabel);
51 
52  // use links
53  theUseLinks = parameterSet.existsAs<InputTag>("InputLinksObjects");
54  if (theUseLinks) {
55  theL3LinksLabel = parameterSet.getParameter<InputTag>("InputLinksObjects");
56  linkToken_ = consumes<reco::MuonTrackLinksCollection>(theL3LinksLabel);
57  if (theL3LinksLabel.label() == "" or theL3LinksLabel.label() == "unused")
58  theUseLinks = false;
59  }
60 
61  // use global, standalone or tracker pT/4-vector assignment
62  const std::string & muon_track_for_momentum = parameterSet.existsAs<std::string>("MuonPtOption") ? parameterSet.getParameter<std::string>("MuonPtOption") : "Global";
63  if (muon_track_for_momentum == std::string("Tracker"))
65  else if (muon_track_for_momentum == std::string("Standalone"))
67  else if (muon_track_for_momentum == std::string("Global"))
69  else {
70  LogError(category)<<"invalid value for MuonPtOption, please choose among 'Tracker', 'Standalone', 'Global'";
72  }
73 
74  produces<RecoChargedCandidateCollection>();
75 }
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:184
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:42
edm::EDGetTokenT< reco::TrackCollection > trackToken_
edm::EDGetTokenT< reco::MuonTrackLinksCollection > linkToken_
L3MuonCandidateProducer::~L3MuonCandidateProducer ( )
virtual

destructor

Definition at line 78 of file L3MuonCandidateProducer.cc.

References category, and LogTrace.

78  {
79  LogTrace(category)<<" L3MuonCandidateProducer destructor called";
80 }
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 84 of file L3MuonCandidateProducer.cc.

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

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

Member Data Documentation

edm::EDGetTokenT<reco::MuonTrackLinksCollection> L3MuonCandidateProducer::linkToken_
private

Definition at line 49 of file L3MuonCandidateProducer.h.

edm::InputTag L3MuonCandidateProducer::theL3CollectionLabel
private

Definition at line 46 of file L3MuonCandidateProducer.h.

edm::InputTag L3MuonCandidateProducer::theL3LinksLabel
private

Definition at line 47 of file L3MuonCandidateProducer.h.

enum MuonTrackType L3MuonCandidateProducer::theType
private

Definition at line 51 of file L3MuonCandidateProducer.h.

bool L3MuonCandidateProducer::theUseLinks
private

Definition at line 52 of file L3MuonCandidateProducer.h.

edm::EDGetTokenT<reco::TrackCollection> L3MuonCandidateProducer::trackToken_
private

Definition at line 48 of file L3MuonCandidateProducer.h.