CMS 3D CMS Logo

HLTL1MuonNoL2Selector.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
14 //
15 //--------------------------------------------------
16 
17 // Class Header
18 #include "HLTL1MuonNoL2Selector.h"
19 
20 // Framework
26 
27 using namespace std;
28 using namespace edm;
29 using namespace l1t;
30 
31 // constructors
33  : theL1Source_(iConfig.getParameter<InputTag>("InputObjects")),
34  theL1MinPt_(iConfig.getParameter<double>("L1MinPt")),
35  theL1MaxEta_(iConfig.getParameter<double>("L1MaxEta")),
36  theL1MinQuality_(iConfig.getParameter<unsigned int>("L1MinQuality")),
37  centralBxOnly_(iConfig.getParameter<bool>("CentralBxOnly")),
38  theL2CandTag_(iConfig.getParameter<edm::InputTag>("L2CandTag")),
39  theL2CandToken_(consumes<reco::RecoChargedCandidateCollection>(theL2CandTag_)),
40  seedMapTag_(iConfig.getParameter<InputTag>("SeedMapTag")),
41  seedMapToken_(consumes<SeedMap>(seedMapTag_)) {
42  muCollToken_ = consumes<MuonBxCollection>(theL1Source_);
43 
44  produces<MuonBxCollection>();
45 }
46 
47 // destructor
49 
52  desc.add<edm::InputTag>("InputObjects", edm::InputTag(""));
53  desc.add<edm::InputTag>("L2CandTag", edm::InputTag("hltL2MuonCandidates"));
54  desc.add<edm::InputTag>("SeedMapTag", edm::InputTag("hltL2Muons"));
55  desc.add<double>("L1MinPt", -1.);
56  desc.add<double>("L1MaxEta", 5.0);
57  desc.add<unsigned int>("L1MinQuality", 0);
58  // # OBSOLETE - these parameters are ignored, they are left only not to break old configurations
59  // they will not be printed in the generated cfi.py file
60  desc.addOptionalNode(edm::ParameterDescription<edm::InputTag>("L1CandTag", edm::InputTag(""), false), false)
61  ->setComment("This parameter is obsolete and will be ignored.");
62  desc.add<bool>("CentralBxOnly", true);
63  descriptions.add("hltL1MuonNoL2Selector", desc);
64 }
65 
67  using namespace std;
68  using namespace reco;
69  using namespace trigger;
70 
71  const std::string metname = "Muon|RecoMuon|HLTL1MuonNoL2Selector";
72 
73  unique_ptr<MuonBxCollection> output(new MuonBxCollection());
74 
75  // Get hold of L2 trks
77  iEvent.getByToken(theL2CandToken_, L2cands);
78 
79  // Muon particles
81  iEvent.getByToken(muCollToken_, muColl);
82  LogTrace(metname) << "Number of muons " << muColl->size() << endl;
83 
84  edm::Handle<SeedMap> seedMapHandle;
85  iEvent.getByToken(seedMapToken_, seedMapHandle);
86 
87  for (int ibx = muColl->getFirstBX(); ibx <= muColl->getLastBX(); ++ibx) {
88  if (centralBxOnly_ && (ibx != 0))
89  continue;
90  for (auto it = muColl->begin(ibx); it != muColl->end(ibx); it++) {
91  l1t::MuonRef l1muon(muColl, distance(muColl->begin(muColl->getFirstBX()), it));
92 
93  unsigned int quality = it->hwQual();
94  float pt = it->pt();
95  float eta = it->eta();
96 
98  continue;
99 
100  // Loop over L2's to find whether the L1 fired this L2.
101  bool isTriggeredByL1 = false;
102  for (auto const& cand : *L2cands) {
103  TrackRef l2muon = cand.get<TrackRef>();
105  (*seedMapHandle)[l2muon->seedRef().castTo<edm::Ref<L2MuonTrajectorySeedCollection> >()];
106  for (auto const& seed : seeds) {
107  // Check if the L2 was seeded by a triggered L1, in such case skip the loop.
108  if (seed->l1tParticle() == l1muon) {
109  isTriggeredByL1 = true;
110  break;
111  }
112  }
113  if (isTriggeredByL1)
114  break; // if I found a L2 I do not need to loop on the rest.
115  }
116  // Once we loop on all L2 decide:
117  if (!isTriggeredByL1) {
118  output->push_back(ibx, *it);
119  }
120  }
121  } // loop over L1
122 
123  iEvent.put(std::move(output));
124 }
125 
126 // declare this class as a framework plugin
ConfigurationDescriptions.h
edm::StreamID
Definition: StreamID.h:30
electrons_cff.bool
bool
Definition: electrons_cff.py:366
HLTL1MuonNoL2Selector.h
HLTL1MuonNoL2Selector::theL1Source_
edm::InputTag theL1Source_
Definition: HLTL1MuonNoL2Selector.h:53
MessageLogger.h
HLTL1MuonNoL2Selector::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: HLTL1MuonNoL2Selector.cc:50
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
l1t::MuonBxCollection
BXVector< Muon > MuonBxCollection
Definition: Muon.h:11
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
HLTL1MuonNoL2Selector::theL1MinPt_
const double theL1MinPt_
Definition: HLTL1MuonNoL2Selector.h:54
edm::RefVector
Definition: EDProductfwd.h:27
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
edm::Handle
Definition: AssociativeIterator.h:50
reco::RecoChargedCandidateCollection
std::vector< RecoChargedCandidate > RecoChargedCandidateCollection
collectin of RecoChargedCandidate objects
Definition: RecoChargedCandidateFwd.h:9
edm::Ref< MuonBxCollection >
quality
const uint32_t *__restrict__ Quality * quality
Definition: CAHitNtupletGeneratorKernelsImpl.h:109
fileCollector.seed
seed
Definition: fileCollector.py:127
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
HLTL1MuonNoL2Selector::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition: HLTL1MuonNoL2Selector.cc:66
HLTL1MuonNoL2Selector::theL1MaxEta_
const double theL1MaxEta_
Definition: HLTL1MuonNoL2Selector.h:55
PVValHelper::eta
Definition: PVValidationHelpers.h:70
HLTL1MuonNoL2Selector::HLTL1MuonNoL2Selector
HLTL1MuonNoL2Selector(const edm::ParameterSet &)
Constructor.
Definition: HLTL1MuonNoL2Selector.cc:32
BXVector::begin
const_iterator begin(int bx) const
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
InitialStep_cff.seeds
seeds
Definition: InitialStep_cff.py:231
BXVector::end
const_iterator end(int bx) const
edm::ParameterSet
Definition: ParameterSet.h:47
HLTL1MuonNoL2Selector::centralBxOnly_
bool centralBxOnly_
Definition: HLTL1MuonNoL2Selector.h:57
Event.h
HLTL1MuonNoL2Selector
Definition: HLTL1MuonNoL2Selector.h:41
l1t
delete x;
Definition: CaloConfig.h:22
edm::AssociationMap
Definition: AssociationMap.h:48
cand
Definition: decayParser.h:32
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:58
HLTL1MuonNoL2Selector::muCollToken_
edm::EDGetTokenT< l1t::MuonBxCollection > muCollToken_
Definition: HLTL1MuonNoL2Selector.h:59
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
HLTL1MuonNoL2Selector::theL1MinQuality_
const unsigned theL1MinQuality_
Definition: HLTL1MuonNoL2Selector.h:56
HLTL1MuonNoL2Selector::seedMapToken_
edm::EDGetTokenT< SeedMap > seedMapToken_
Definition: HLTL1MuonNoL2Selector.h:63
EventSetup.h
HLTL1MuonNoL2Selector::theL2CandToken_
edm::EDGetTokenT< reco::RecoChargedCandidateCollection > theL2CandToken_
Definition: HLTL1MuonNoL2Selector.h:61
trigger
Definition: HLTPrescaleTableCond.h:8
BXVector::size
unsigned size(int bx) const
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
ParameterSet.h
edm::Event
Definition: Event.h:73
HLT_FULL_cff.distance
distance
Definition: HLT_FULL_cff.py:7733
BXVector::getLastBX
int getLastBX() const
edm::ParameterDescription
Definition: ParameterDescription.h:110
edm::InputTag
Definition: InputTag.h:15
HLTL1MuonNoL2Selector::~HLTL1MuonNoL2Selector
~HLTL1MuonNoL2Selector() override
Destructor.
metname
const std::string metname
Definition: MuonSeedOrcaPatternRecognition.cc:40