CMS 3D CMS Logo

HLTL1TMuonSelector.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
13 //
14 //--------------------------------------------------
15 
16 // Class Header
17 #include "HLTL1TMuonSelector.h"
18 
19 // Framework
25 
26 using namespace std;
27 using namespace edm;
28 using namespace l1t;
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  centralBxOnly_(iConfig.getParameter<bool>("CentralBxOnly")) {
37  muCollToken_ = consumes<MuonBxCollection>(theSource);
38 
39  produces<MuonBxCollection>();
40 }
41 
42 // destructor
44 
47  desc.add<edm::InputTag>("InputObjects", edm::InputTag("hltGmtStage2Digis"));
48  desc.add<double>("L1MinPt", -1.);
49  desc.add<double>("L1MaxEta", 5.0);
50  desc.add<unsigned int>("L1MinQuality", 0);
51  desc.add<bool>("CentralBxOnly", true);
52  descriptions.add("hltL1TMuonSelector", desc);
53 }
54 
56  const std::string metname = "Muon|RecoMuon|HLTL1TMuonSelector";
57 
58  unique_ptr<MuonBxCollection> output(new MuonBxCollection());
59 
60  // Muon particles
62  iEvent.getByToken(muCollToken_, muColl);
63  LogTrace(metname) << "Number of muons " << muColl->size() << endl;
64 
65  for (int ibx = muColl->getFirstBX(); ibx <= muColl->getLastBX(); ++ibx) {
66  if (centralBxOnly_ && (ibx != 0))
67  continue;
68  for (auto it = muColl->begin(ibx); it != muColl->end(ibx); it++) {
69  unsigned int quality = it->hwQual();
70  int valid_charge = it->hwChargeValid();
71 
72  float pt = it->pt();
73  float eta = it->eta();
74  float theta = 2 * atan(exp(-eta));
75  float phi = it->phi();
76  int charge = it->charge();
77  // Set charge=0 for the time being if the valid charge bit is zero
78  if (!valid_charge)
79  charge = 0;
80 
81  if (pt < theL1MinPt || fabs(eta) > theL1MaxEta)
82  continue;
83 
84  LogTrace(metname) << "L1 Muon Found";
85  LogTrace(metname) << "Pt = " << pt << " GeV/c";
86  LogTrace(metname) << "eta = " << eta;
87  LogTrace(metname) << "theta = " << theta << " rad";
88  LogTrace(metname) << "phi = " << phi << " rad";
89  LogTrace(metname) << "charge = " << charge;
90 
91  if (quality <= theL1MinQuality)
92  continue;
93  LogTrace(metname) << "quality = " << quality;
94 
95  output->push_back(ibx, *it);
96  }
97  }
98 
99  iEvent.put(std::move(output));
100 }
101 
102 // declare this class as a framework plugin
ConfigurationDescriptions.h
edm::StreamID
Definition: StreamID.h:30
electrons_cff.bool
bool
Definition: electrons_cff.py:372
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
MessageLogger.h
HLTL1TMuonSelector
Definition: HLTL1TMuonSelector.h:37
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:32
HLTL1TMuonSelector::theSource
edm::InputTag theSource
Definition: HLTL1TMuonSelector.h:49
edm
HLT enums.
Definition: AlignableModifier.h:19
l1t::MuonBxCollection
BXVector< Muon > MuonBxCollection
Definition: Muon.h:11
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
HLTL1TMuonSelector::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: HLTL1TMuonSelector.cc:45
edm::Handle
Definition: AssociativeIterator.h:50
BXVector::getFirstBX
int getFirstBX() const
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
HLTL1TMuonSelector::HLTL1TMuonSelector
HLTL1TMuonSelector(const edm::ParameterSet &)
Constructor.
Definition: HLTL1TMuonSelector.cc:31
theta
Geom::Theta< T > theta() const
Definition: Basic3DVectorLD.h:150
HLTL1TMuonSelector::muCollToken_
edm::EDGetTokenT< l1t::MuonBxCollection > muCollToken_
Definition: HLTL1TMuonSelector.h:51
BXVector::begin
const_iterator begin(int bx) const
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
BXVector::end
const_iterator end(int bx) const
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
HLTL1TMuonSelector::centralBxOnly_
bool centralBxOnly_
use central bx only muons
Definition: HLTL1TMuonSelector.h:58
l1t
delete x;
Definition: CaloConfig.h:22
HLTL1TMuonSelector::theL1MinQuality
const unsigned theL1MinQuality
Definition: HLTL1TMuonSelector.h:55
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:57
HLTL1TMuonSelector::~HLTL1TMuonSelector
~HLTL1TMuonSelector() override
Destructor.
DDAxes::phi
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
qcdUeDQM_cfi.quality
quality
Definition: qcdUeDQM_cfi.py:31
EventSetup.h
HLTL1TMuonSelector.h
BXVector::size
unsigned size(int bx) const
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
ParameterSet.h
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
HLTL1TMuonSelector::theL1MaxEta
const double theL1MaxEta
Definition: HLTL1TMuonSelector.h:54
edm::Event
Definition: Event.h:73
HLTL1TMuonSelector::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition: HLTL1TMuonSelector.cc:55
BXVector::getLastBX
int getLastBX() const
edm::InputTag
Definition: InputTag.h:15
HLTL1TMuonSelector::theL1MinPt
const double theL1MinPt
Definition: HLTL1TMuonSelector.h:53
metname
const std::string metname
Definition: MuonSeedOrcaPatternRecognition.cc:43