CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Phase2TrackerCommissioningDigiProducer.cc
Go to the documentation of this file.
14 
15 namespace Phase2Tracker {
16 
18  public:
22  ~Phase2TrackerCommissioningDigiProducer() override = default;
23  void produce(edm::StreamID, edm::Event& ev, const edm::EventSetup& es) const override;
24 
25  private:
27  };
28 } // namespace Phase2Tracker
29 
33 
34 using namespace std;
35 
37  const edm::ParameterSet& pset) {
38  produces<edm::DetSet<Phase2TrackerCommissioningDigi>>("ConditionData");
39  token_ = consumes<FEDRawDataCollection>(pset.getParameter<edm::InputTag>("ProductLabel"));
40 }
41 
44  const edm::EventSetup& es) const {
45  // Retrieve FEDRawData collection
47  event.getByToken(token_, buffers);
48 
49  // Analyze strip tracker FED buffers in data
50  size_t fedIndex;
51  for (fedIndex = 0; fedIndex < Phase2Tracker::CMS_FED_ID_MAX; ++fedIndex) {
52  const FEDRawData& fed = buffers->FEDData(fedIndex);
53  if (fed.size() != 0 && fedIndex >= Phase2Tracker::FED_ID_MIN && fedIndex <= Phase2Tracker::FED_ID_MAX) {
54  // construct buffer
56  buffer = new Phase2Tracker::Phase2TrackerFEDBuffer(fed.data(), fed.size());
57 
58  // fetch condition data
59  std::map<uint32_t, uint32_t> cond_data = buffer->conditionData();
60  delete buffer;
61 
62  // print cond data for debug
63  LogTrace("Phase2TrackerCommissioningDigiProducer") << "--- Condition data debug ---" << std::endl;
64  std::map<uint32_t, uint32_t>::const_iterator it;
65  for (it = cond_data.begin(); it != cond_data.end(); it++) {
66  LogTrace("Phase2TrackerCommissioningDigiProducer")
67  << std::hex << "key: " << it->first << std::hex << " value: " << it->second << " (hex) " << std::dec
68  << it->second << " (dec) " << std::endl;
69  }
70  LogTrace("Phase2TrackerCommissioningDigiProducer") << "----------------------------" << std::endl;
71  // store it into digis
74  for (it = cond_data.begin(); it != cond_data.end(); it++) {
75  cond_data_digi->push_back(Phase2TrackerCommissioningDigi(it->first, it->second));
76  }
77  std::unique_ptr<edm::DetSet<Phase2TrackerCommissioningDigi>> cdd(cond_data_digi);
78  event.put(std::move(cdd), "ConditionData");
79  }
80  }
81 }
void push_back(const T &t)
Definition: DetSet.h:66
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
std::map< uint32_t, uint32_t > conditionData() const
static const uint16_t CMS_FED_ID_MAX
Definition: utils.h:19
~Phase2TrackerCommissioningDigiProducer() override=default
default constructor
void fedIndex(uint32_t aFedIndex, uint16_t &aFedId, uint16_t &aFedChannel)
Phase2TrackerCommissioningDigiProducer(const edm::ParameterSet &pset)
constructor
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
#define LogTrace(id)
def move
Definition: eostools.py:511
void produce(edm::StreamID, edm::Event &ev, const edm::EventSetup &es) const override
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
static const uint16_t FED_ID_MAX
Definition: utils.h:18
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
static const uint16_t FED_ID_MIN
Definition: utils.h:17
Phase2Tracker::Phase2TrackerCommissioningDigiProducer Phase2TrackerCommissioningDigiProducer