CMS 3D CMS Logo

CTPPSTotemDigiToRaw.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: temp/CTPPSTotemDigiToRaw
4 // Class: CTPPSTotemDigiToRaw
5 //
13 //
14 // Original Author: Dilson De Jesus Damiao
15 // Maria Elena Pol
16 // Created: Tue, 11 Sep 2018 17:12:12 GMT
17 //
18 //
19 
20 // system include files
21 #include <memory>
22 
23 // user include files
39 
43 
53 
56 //
57 // class declaration
58 //
59 
61 public:
62  explicit CTPPSTotemDigiToRaw(const edm::ParameterSet&);
63  ~CTPPSTotemDigiToRaw() override;
64 
65  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
66 
67 private:
68  void beginStream(edm::StreamID) override;
69  void produce(edm::Event&, const edm::EventSetup&) override;
70 
71  unsigned long eventCounter_;
72  std::set<unsigned int> fedIds_;
75  bool debug_;
79  std::vector<CTPPSTotemDataFormatter::PPSStripIndex> v_iDdet2fed_;
81 
82  // ----------member data ---------------------------
83 };
84 
85 //
86 // constants, enums and typedefs
87 //
88 
89 //
90 // static data member definitions
91 //
92 
93 //
94 // constructors and destructor
95 //
97  : eventCounter_(0), allDigiCounter_(0), allWordCounter_(0) {
98  //register your products
99  tTotemRPDigi_ = consumes<edm::DetSetVector<TotemRPDigi>>(iConfig.getParameter<edm::InputTag>("InputLabel"));
100  tTotemDAQMapping_ = esConsumes<TotemDAQMapping, TotemReadoutRcd>();
101  produces<FEDRawDataCollection>();
102 }
103 
105  edm::LogInfo("CTPPSTotemDigiToRaw") << " CTPPSTotemDigiToRaw destructor!";
106 }
107 
108 //
109 // member functions
110 //
111 
112 // ------------ method called to produce the data ------------
114  using namespace edm;
115  using namespace std;
116  eventCounter_++;
117 
119  iEvent.getByToken(tTotemRPDigi_, digiCollection);
120 
123 
124  int digiCounter = 0;
125  for (auto const& di : *digiCollection) {
126  digiCounter += (di.data).size();
127  digis[di.detId()] = di.data;
128  }
129  allDigiCounter_ += digiCounter;
131  // label of the CTPPS sub-system
132  if (recordWatcher_.check(iSetup)) {
134  for (const auto& p : mapping->VFATMapping) {
135  //get TotemVFATInfo information
136  fedIds_.emplace(p.first.getFEDId());
137  CTPPSTotemDataFormatter::PPSStripIndex iDdet2fed = {(p.second.symbolicID).symbolicID,
138  p.second.hwID,
139  p.first.getFEDId(),
140  p.first.getIdxInFiber(),
141  p.first.getGOHId()};
142  v_iDdet2fed_.emplace_back(iDdet2fed);
143  }
144  }
145 
146  CTPPSTotemDataFormatter formatter(mapping->VFATMapping);
147 
148  // create product (raw data)
149  auto buffers = std::make_unique<FEDRawDataCollection>();
150 
152 
153  // convert data to raw
154  formatter.formatRawData(iEvent.id().event(), rawdata, digis, v_iDdet2fed_);
155 
156  // pack raw data into collection
157  for (auto it : fedIds_) {
158  FEDRawData& fedRawData = buffers->FEDData(it);
159  CTPPSTotemDataFormatter::RawData::iterator fedbuffer = rawdata.find(it);
160  if (fedbuffer != rawdata.end())
161  fedRawData = fedbuffer->second;
162  }
163  allWordCounter_ += formatter.nWords();
164 
165  if (debug_)
166  LogDebug("CTPPSTotemDigiToRaw") << "Words/Digis this iEvent: " << digiCounter << "(fm:" << formatter.nDigis()
167  << ")/" << formatter.nWords() << " all: " << allDigiCounter_ << "/"
168  << allWordCounter_;
169 
170  iEvent.put(std::move(buffers));
171 }
172 
173 // ------------ method called once each stream before processing any runs, lumis or events ------------
175 
176 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
179  desc.add<edm::InputTag>("InputLabel", edm::InputTag("RPSiDetDigitizer"));
180  descriptions.add("ctppsTotemRawData", desc);
181 }
182 
183 //define this as a plug-in
ConfigurationDescriptions.h
edm::ESWatcher::check
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:52
CTPPSTotemDigiToRaw::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: CTPPSTotemDigiToRaw.cc:177
FEDNumbering.h
edm::StreamID
Definition: StreamID.h:30
CTPPSTotemDigiToRaw::fPos_
TotemFramePosition fPos_
Definition: CTPPSTotemDigiToRaw.cc:80
Handle.h
TotemReadoutRcd.h
MessageLogger.h
edm::ESWatcher< TotemReadoutRcd >
ESHandle.h
CTPPSTotemDigiToRaw::tTotemRPDigi_
edm::EDGetTokenT< edm::DetSetVector< TotemRPDigi > > tTotemRPDigi_
Definition: CTPPSTotemDigiToRaw.cc:77
CTPPSTotemDigiToRaw
Definition: CTPPSTotemDigiToRaw.cc:60
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
TotemDAQMapping.h
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89281
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
EDProducer.h
CTPPSTotemDataFormatter::nDigis
int nDigis() const
Definition: CTPPSTotemDataFormatter.h:54
CTPPSTotemDigiToRaw::allDigiCounter_
int allDigiCounter_
Definition: CTPPSTotemDigiToRaw.cc:73
CTPPSTotemDataFormatter::Digis
std::unordered_map< cms_uint32_t, DetDigis > Digis
Definition: CTPPSTotemDataFormatter.h:49
CTPPSTotemDataFormatter::PPSStripIndex
Definition: CTPPSTotemDataFormatter.h:56
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
VFATFrameCollection.h
FEDRawData.h
edm::Handle
Definition: AssociativeIterator.h:50
CTPPSTotemDigiToRaw::recordWatcher_
edm::ESWatcher< TotemReadoutRcd > recordWatcher_
Definition: CTPPSTotemDigiToRaw.cc:76
ESGetToken.h
CTPPSTotemDigiToRaw::beginStream
void beginStream(edm::StreamID) override
Definition: CTPPSTotemDigiToRaw.cc:174
FEDRawData
Definition: FEDRawData.h:19
MakerMacros.h
l1t_dqm_sourceclient-live_cfg.fedRawData
fedRawData
Definition: l1t_dqm_sourceclient-live_cfg.py:188
CTPPSTotemDataFormatter.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
CTPPSTotemDigiToRaw::eventCounter_
unsigned long eventCounter_
Definition: CTPPSTotemDigiToRaw.cc:71
edm::ESHandle
Definition: DTSurvey.h:22
ParameterSetDescription.h
CTPPSTotemDataFormatter::RawData
std::unordered_map< int, FEDRawData > RawData
Definition: CTPPSTotemDataFormatter.h:47
CTPPSTotemDigiToRaw::CTPPSTotemDigiToRaw
CTPPSTotemDigiToRaw(const edm::ParameterSet &)
Definition: CTPPSTotemDigiToRaw.cc:96
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
TotemVFATStatus.h
CTPPSTotemDigiToRaw::~CTPPSTotemDigiToRaw
~CTPPSTotemDigiToRaw() override
Definition: CTPPSTotemDigiToRaw.cc:104
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
TotemFramePosition
Definition: TotemFramePosition.h:31
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
CTPPSTotemDataFormatter::compare
static bool compare(const PPSStripIndex &a, const PPSStripIndex &b)
Definition: CTPPSTotemDataFormatter.h:69
ModuleDef.h
TotemFramePosition.h
iEvent
int iEvent
Definition: GenABIO.cc:224
CTPPSTotemDigiToRaw::tTotemDAQMapping_
edm::ESGetToken< TotemDAQMapping, TotemReadoutRcd > tTotemDAQMapping_
Definition: CTPPSTotemDigiToRaw.cc:78
CTPPSTotemDigiToRaw::allWordCounter_
int allWordCounter_
Definition: CTPPSTotemDigiToRaw.cc:74
FEDRawDataCollection.h
CTPPSTotemDigiToRaw::v_iDdet2fed_
std::vector< CTPPSTotemDataFormatter::PPSStripIndex > v_iDdet2fed_
Definition: CTPPSTotemDigiToRaw.cc:79
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:155
CTPPSTotemDataFormatter::nWords
int nWords() const
Definition: CTPPSTotemDataFormatter.h:53
edm::stream::EDProducer
Definition: EDProducer.h:38
apvshotsanalyzer_cfi.digiCollection
digiCollection
Definition: apvshotsanalyzer_cfi.py:4
edm::EventSetup
Definition: EventSetup.h:58
DetSetVector.h
edm::ESGetToken< TotemDAQMapping, TotemReadoutRcd >
InputTag.h
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
Frameworkfwd.h
ESWatcher.h
TotemRPDetId.h
CTPPSTotemDigiToRaw::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: CTPPSTotemDigiToRaw.cc:113
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
CTPPSTotemDigiToRaw::fedIds_
std::set< unsigned int > fedIds_
Definition: CTPPSTotemDigiToRaw.cc:72
CTPPSTotemDataFormatter
Definition: CTPPSTotemDataFormatter.h:37
ParameterSet.h
TotemRPDigi.h
edm::Event
Definition: Event.h:73
StreamID.h
taus_updatedMVAIds_cff.mapping
mapping
Definition: taus_updatedMVAIds_cff.py:29
CTPPSTotemDigiToRaw::debug_
bool debug_
Definition: CTPPSTotemDigiToRaw.cc:75
CTPPSTotemDataFormatter::formatRawData
void formatRawData(unsigned int lvl1_ID, RawData &fedRawData, const Digis &digis, std::vector< PPSStripIndex > v_iDdet2fed)
Definition: CTPPSTotemDataFormatter.cc:43
edm::InputTag
Definition: InputTag.h:15
DetIdCollection.h
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443