CMS 3D CMS Logo

HLTL1MuonSelector.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
13 //
14 //--------------------------------------------------
15 
16 // Class Header
17 #include "HLTL1MuonSelector.h"
18 
19 // Framework
25 
26 using namespace std;
27 using namespace edm;
28 using namespace l1extra;
29 
30 // constructors
32  : theSource(iConfig.getParameter<InputTag>("InputObjects")),
33  theL1MinPt(iConfig.getParameter<double>("L1MinPt")),
34  theL1MaxEta(iConfig.getParameter<double>("L1MaxEta")),
35  theL1MinQuality(iConfig.getParameter<unsigned int>("L1MinQuality")) {
36  muCollToken_ = consumes<L1MuonParticleCollection>(theSource);
37 
38  produces<L1MuonParticleCollection>();
39 }
40 
41 // destructor
43 
46  desc.add<edm::InputTag>("InputObjects", edm::InputTag(""));
47  desc.add<double>("L1MinPt", -1.);
48  desc.add<double>("L1MaxEta", 5.0);
49  desc.add<unsigned int>("L1MinQuality", 0);
50  descriptions.add("hltL1MuonSelector", desc);
51 }
52 
54  const std::string metname = "Muon|RecoMuon|HLTL1MuonSelector";
55 
56  unique_ptr<L1MuonParticleCollection> output(new L1MuonParticleCollection());
57 
58  // Muon particles
60  iEvent.getByToken(muCollToken_, muColl);
61  LogTrace(metname) << "Number of muons " << muColl->size() << endl;
62 
63  L1MuonParticleCollection::const_iterator it;
64  L1MuonParticleRef::key_type l1ParticleIndex = 0;
65 
66  for (it = muColl->begin(); it != muColl->end(); ++it, ++l1ParticleIndex) {
67  const L1MuGMTExtendedCand muonCand = (*it).gmtMuonCand();
68  unsigned int quality = 0;
69  bool valid_charge = false;
70  ;
71 
72  if (muonCand.empty()) {
73  LogWarning(metname) << "HLTL1MuonSelector: WARNING, no L1MuGMTCand! " << endl;
74  LogWarning(metname) << "HLTL1MuonSelector: this should make sense only within MC tests" << endl;
75  // FIXME! Temporary to handle the MC input
76  quality = 7;
77  valid_charge = true;
78  } else {
79  quality = muonCand.quality();
80  valid_charge = muonCand.charge_valid();
81  }
82 
83  float pt = (*it).pt();
84  float eta = (*it).eta();
85  float theta = 2 * atan(exp(-eta));
86  float phi = (*it).phi();
87  int charge = (*it).charge();
88  // Set charge=0 for the time being if the valid charge bit is zero
89  if (!valid_charge)
90  charge = 0;
91  bool barrel = !(*it).isForward();
92 
93  if (pt < theL1MinPt || fabs(eta) > theL1MaxEta)
94  continue;
95 
96  LogTrace(metname) << "L1 Muon Found";
97  LogTrace(metname) << "Pt = " << pt << " GeV/c";
98  LogTrace(metname) << "eta = " << eta;
99  LogTrace(metname) << "theta = " << theta << " rad";
100  LogTrace(metname) << "phi = " << phi << " rad";
101  LogTrace(metname) << "charge = " << charge;
102  LogTrace(metname) << "In Barrel? = " << barrel;
103 
104  if (quality <= theL1MinQuality)
105  continue;
106  LogTrace(metname) << "quality = " << quality;
107 
108  output->push_back(L1MuonParticle(*it));
109 
110  } // loop over L1MuonParticleCollection
111 
112  iEvent.put(std::move(output));
113 }
114 
115 // declare this class as a framework plugin
ConfigurationDescriptions.h
edm::StreamID
Definition: StreamID.h:30
HLTL1MuonSelector::theL1MinPt
const double theL1MinPt
Definition: HLTL1MuonSelector.h:57
Reference_intrackfit_cff.barrel
list barrel
Definition: Reference_intrackfit_cff.py:37
MessageLogger.h
L1MuGMTExtendedCand
Definition: L1MuGMTExtendedCand.h:46
HLTL1MuonSelector.h
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
edm
HLT enums.
Definition: AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89353
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
HLTL1MuonSelector::theL1MinQuality
const unsigned theL1MinQuality
Definition: HLTL1MuonSelector.h:59
HLTL1MuonSelector::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: HLTL1MuonSelector.cc:44
edm::Handle
Definition: AssociativeIterator.h:50
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
HLTL1MuonSelector::muCollToken_
edm::EDGetTokenT< l1extra::L1MuonParticleCollection > muCollToken_
Definition: HLTL1MuonSelector.h:55
HLTL1MuonSelector::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition: HLTL1MuonSelector.cc:53
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
objectEnergyScale_cfi.theSource
theSource
Definition: objectEnergyScale_cfi.py:100
PVValHelper::eta
Definition: PVValidationHelpers.h:69
L1MuGMTCand::quality
unsigned int quality() const
get quality
Definition: L1MuGMTCand.h:90
theta
Geom::Theta< T > theta() const
Definition: Basic3DVectorLD.h:150
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HLTL1MuonSelector::theL1MaxEta
const double theL1MaxEta
Definition: HLTL1MuonSelector.h:58
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
HLTL1MuonSelector::~HLTL1MuonSelector
~HLTL1MuonSelector() override
Destructor.
edm::ParameterSet
Definition: ParameterSet.h:47
L1MuGMTCand::charge_valid
bool charge_valid() const
is the charge valid ?
Definition: L1MuGMTCand.h:135
Event.h
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:57
HLTL1MuonSelector
Definition: HLTL1MuonSelector.h:41
edm::Ref< L1MuonParticleCollection >::key_type
std::remove_cv< typename std::remove_reference< argument_type >::type >::type key_type
Definition: Ref.h:164
DDAxes::phi
l1extra::L1MuonParticleCollection
std::vector< L1MuonParticle > L1MuonParticleCollection
Definition: L1MuonParticleFwd.h:28
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
L1MuGMTCand::empty
bool empty() const
is it an empty muon candidate?
Definition: L1MuGMTCand.h:61
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
qcdUeDQM_cfi.quality
quality
Definition: qcdUeDQM_cfi.py:31
HLTL1MuonSelector::HLTL1MuonSelector
HLTL1MuonSelector(const edm::ParameterSet &)
Constructor.
Definition: HLTL1MuonSelector.cc:31
HLTL1MuonSelector::theSource
edm::InputTag theSource
Definition: HLTL1MuonSelector.h:53
EventSetup.h
l1extra::L1MuonParticle
Definition: L1MuonParticle.h:27
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:224
ParameterSet.h
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
l1extra
Definition: L1EmParticle.h:26
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
metname
const std::string metname
Definition: MuonSeedOrcaPatternRecognition.cc:40