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
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

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<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 40 of file L1TBMTFAlgoSelector.h.

Constructor & Destructor Documentation

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

Definition at line 9 of file L1TBMTFAlgoSelector.cc.

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

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

Definition at line 20 of file L1TBMTFAlgoSelector.cc.

20  {
21 }

Member Function Documentation

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

Definition at line 23 of file L1TBMTFAlgoSelector.cc.

References bmtfKalmanToken, bmtfLegacyToken, FEDHeader::bxID(), FEDRawData::data(), data, DEFINE_FWK_MODULE, end, funct::false, FEDRawDataCollection::FEDData(), fedToken, edm::Event::getByToken(), RecoTauValidation_cfi::header, FEDHeader::lvl1ID(), eostools::move(), amc13::Packet::parse(), jets_cff::payload, amc13::Packet::payload(), edm::Event::put(), and FEDRawData::size().

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

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

Member Data Documentation

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

Definition at line 54 of file L1TBMTFAlgoSelector.h.

Referenced by L1TBMTFAlgoSelector(), and produce().

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

Definition at line 55 of file L1TBMTFAlgoSelector.h.

Referenced by L1TBMTFAlgoSelector(), and produce().

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

Definition at line 56 of file L1TBMTFAlgoSelector.h.

Referenced by L1TBMTFAlgoSelector(), and produce().