CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
dqmBmtfAlgoSelector::L1TBMTFAlgoSelector Class Reference

#include <L1TBMTFAlgoSelector.h>

Inheritance diagram for dqmBmtfAlgoSelector::L1TBMTFAlgoSelector:
edm::stream::EDProducer<>

Public Member Functions

 L1TBMTFAlgoSelector (const edm::ParameterSet &ps)
 
 ~L1TBMTFAlgoSelector () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::EDGetToken bmtfKalmanToken
 
edm::EDGetToken bmtfLegacyToken
 
edm::EDGetToken fedToken
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 39 of file L1TBMTFAlgoSelector.h.

Constructor & Destructor Documentation

◆ L1TBMTFAlgoSelector()

dqmBmtfAlgoSelector::L1TBMTFAlgoSelector::L1TBMTFAlgoSelector ( const edm::ParameterSet ps)
explicit

Definition at line 9 of file L1TBMTFAlgoSelector.cc.

References bmtfKalmanToken, bmtfLegacyToken, fedToken, and edm::ParameterSet::getParameter().

9  {
10  bmtfKalmanToken = consumes<l1t::RegionalMuonCandBxCollection>(ps.getParameter<edm::InputTag>("bmtfKalman"));
11  bmtfLegacyToken = consumes<l1t::RegionalMuonCandBxCollection>(ps.getParameter<edm::InputTag>("bmtfLegacy"));
12  fedToken = consumes<FEDRawDataCollection>(ps.getParameter<edm::InputTag>("feds"));
13 
14  produces<l1t::RegionalMuonCandBxCollection>("BMTF");
15  produces<l1t::RegionalMuonCandBxCollection>("BMTF2");
16 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307

◆ ~L1TBMTFAlgoSelector()

dqmBmtfAlgoSelector::L1TBMTFAlgoSelector::~L1TBMTFAlgoSelector ( )
override

Definition at line 18 of file L1TBMTFAlgoSelector.cc.

18 {}

Member Function Documentation

◆ produce()

void dqmBmtfAlgoSelector::L1TBMTFAlgoSelector::produce ( edm::Event eve,
const edm::EventSetup eveSetup 
)
overrideprivate

Definition at line 20 of file L1TBMTFAlgoSelector.cc.

References L1TBMTFAlgoSelector_cfi::bmtfKalman, L1TBMTFAlgoSelector_cfi::bmtfLegacy, FEDRawData::data(), data, l1tstage2emulator_dqm_sourceclient-live_cfg::feds, edm::Event::getByToken(), RecoTauValidation_cfi::header, eostools::move(), amc13::Packet::parse(), jetsAK4_Puppi_cff::payload, amc13::Packet::payload(), edm::Event::put(), and FEDRawData::size().

20  {
21  //Declare the Handlers
23  eve.getByToken(fedToken, feds);
28 
29  //----> Make RegMuonCand Copies
30  auto *bmtfKalman_copy = new l1t::RegionalMuonCandBxCollection(*bmtfKalman);
31  auto *bmtfLegacy_copy = new l1t::RegionalMuonCandBxCollection(*bmtfLegacy);
32  edm::LogInfo("L1TDQM") << "copy RegionalMuonCandBxCollections created";
33  edm::LogInfo("L1TDQM") << "bmtfKalman_copy address: " << bmtfKalman_copy;
34  edm::LogInfo("L1TDQM") << "bmtfLegacy_copy address: " << bmtfLegacy_copy;
35 
36  //-----> Get the fw-ver
37  int nonEmptyFed = 0;
38  if (feds->FEDData(1376).size() > 0)
39  nonEmptyFed = 1376;
40  else if (feds->FEDData(1377).size() > 0)
41  nonEmptyFed = 1377;
42  else {
43  edm::LogError("L1TDQM") << "[L1TBMTFAlgoSelector] Both BMTF feds (1376, 1377) seem empty."
44  << "Using Default Configuration."
45  << "Will be wrong if this is Kalman triggering and ZS is enabled";
46  //Define the default configuration
47  std::unique_ptr<l1t::RegionalMuonCandBxCollection> bmtfTriggering, bmtfSecondary;
48  bmtfTriggering.reset(bmtfLegacy_copy);
49  bmtfSecondary.reset(bmtfKalman_copy);
50  //Print in log the addresses
51  edm::LogInfo("L1TDQM") << "Triggering and Secondary pointers filled:";
52  edm::LogInfo("L1TDQM") << "bmtfTriggering address: " << bmtfTriggering.get();
53  edm::LogInfo("L1TDQM") << "bmtfSecondary address: " << bmtfSecondary.get();
54  //Produce the products
55  eve.put(std::move(bmtfTriggering), "BMTF");
56  eve.put(std::move(bmtfSecondary), "BMTF2");
57  return;
58  }
59 
60  const FEDRawData &l1tRcd = feds->FEDData(nonEmptyFed);
61  ;
62  edm::LogInfo("L1TDQM") << "L1T Rcd taken from the FEDData.";
63  edm::LogInfo("L1TDQM") << "l1tRcd.size=" << l1tRcd.size() << " for fed:" << nonEmptyFed;
64 
65  const unsigned char *data = l1tRcd.data();
67  edm::LogInfo("L1TDQM") << "header and data extracted from the Rcd.";
68 
69  amc13::Packet packet;
70  if (!packet.parse((const uint64_t *)data,
71  (const uint64_t *)(data + 8),
72  (l1tRcd.size()) / 8,
73  header.lvl1ID(),
74  header.bxID(),
75  false,
76  false)) {
77  edm::LogError("L1TDQM") << "Could not extract AMC13 Packet.";
78  return;
79  }
80 
81  edm::LogInfo("L1TDQM") << "AMC13-packet-payload size = " << packet.payload().size();
82  unsigned algo_ver;
83  if (!packet.payload().empty()) {
84  auto payload64 = (packet.payload().at(0)).data();
85  const uint32_t *start = (const uint32_t *)payload64.get();
86  const uint32_t *end = start + (packet.payload().at(0).size() * 2);
87 
88  l1t::MP7Payload payload(start, end, false);
89  algo_ver = payload.getAlgorithmFWVersion();
90 
91  edm::LogInfo("L1TDQM") << "algo-ver = " << algo_ver << std::endl;
92  } else {
93  edm::LogError("L1TDQM") << "amc13 payload is empty, cannot extract AMC13 Packet...";
94  return;
95  }
96 
97  //----->Make the Decision which Algo Triggers
98  std::unique_ptr<l1t::RegionalMuonCandBxCollection> bmtfTriggering, bmtfSecondary;
99  if (algo_ver >= 2499805536) { //95000160(hex)
100  // kalman triggers
101  bmtfTriggering.reset(bmtfKalman_copy);
102  bmtfSecondary.reset(bmtfLegacy_copy);
103  } else {
104  // legacy triggers
105  bmtfTriggering.reset(bmtfLegacy_copy);
106  bmtfSecondary.reset(bmtfKalman_copy);
107  }
108 
109  edm::LogInfo("L1TDQM") << "Triggering and Secondary pointers filled:";
110  edm::LogInfo("L1TDQM") << "bmtfTriggering address: " << bmtfTriggering.get();
111  edm::LogInfo("L1TDQM") << "bmtfSecondary address: " << bmtfSecondary.get();
112 
113  eve.put(std::move(bmtfTriggering), "BMTF");
114  eve.put(std::move(bmtfSecondary), "BMTF2");
115 
116  return;
117 }
Definition: start.py:1
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
BXVector< RegionalMuonCand > RegionalMuonCandBxCollection
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:48
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:526
Log< level::Error, false > LogError
Log< level::Info, false > LogInfo
unsigned long long uint64_t
Definition: Time.h:13
bool parse(const uint64_t *start, const uint64_t *data, unsigned int size, unsigned int lv1, unsigned int bx, bool legacy_mc=false, bool mtf7_mode=false)
Definition: AMC13Spec.cc:60
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
std::vector< amc::Packet > payload() const
Definition: AMC13Spec.h:92
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ bmtfKalmanToken

edm::EDGetToken dqmBmtfAlgoSelector::L1TBMTFAlgoSelector::bmtfKalmanToken
private

Definition at line 51 of file L1TBMTFAlgoSelector.h.

Referenced by L1TBMTFAlgoSelector().

◆ bmtfLegacyToken

edm::EDGetToken dqmBmtfAlgoSelector::L1TBMTFAlgoSelector::bmtfLegacyToken
private

Definition at line 52 of file L1TBMTFAlgoSelector.h.

Referenced by L1TBMTFAlgoSelector().

◆ fedToken

edm::EDGetToken dqmBmtfAlgoSelector::L1TBMTFAlgoSelector::fedToken
private

Definition at line 53 of file L1TBMTFAlgoSelector.h.

Referenced by L1TBMTFAlgoSelector().