test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TotemVFATRawToDigi.cc
Go to the documentation of this file.
1 /****************************************************************************
2 *
3 * This is a part of TOTEM offline software.
4 * Authors:
5 * Jan Kašpar (jan.kaspar@gmail.com)
6 *
7 ****************************************************************************/
8 
15 
19 
21 
25 
29 
33 
34 #include <string>
35 
36 //----------------------------------------------------------------------------------------------------
37 
39 {
40  public:
41  explicit TotemVFATRawToDigi(const edm::ParameterSet&);
43 
44  virtual void produce(edm::Event&, const edm::EventSetup&) override;
45 
46  private:
48 
49  std::vector<unsigned int> fedIds;
50 
52 
55 
56  template <typename DigiType>
57  void run(edm::Event&, const edm::EventSetup&);
58 };
59 
60 //----------------------------------------------------------------------------------------------------
61 
62 using namespace edm;
63 using namespace std;
64 
65 //----------------------------------------------------------------------------------------------------
66 
68  subSystem(conf.getParameter<string>("subSystem")),
69  fedIds(conf.getParameter< vector<unsigned int> >("fedIds")),
70  rawDataUnpacker(conf.getParameterSet("RawUnpacking")),
71  rawToDigiConverter(conf.getParameterSet("RawToDigi"))
72 {
73  fedDataToken = consumes<FEDRawDataCollection>(conf.getParameter<edm::InputTag>("rawDataTag"));
74 
75  // validate chosen subSystem
76  if (subSystem != "RP")
77  throw cms::Exception("TotemVFATRawToDigi::TotemVFATRawToDigi") << "Unknown sub-system string " << subSystem << "." << endl;
78 
79  // FED (OptoRx) headers and footers
80  produces< vector<TotemFEDInfo> >(subSystem);
81 
82  // digi
83  if (subSystem == "RP")
84  produces< DetSetVector<TotemRPDigi> >(subSystem);
85 
86  // set default IDs
87  if (fedIds.empty())
88  {
89  if (subSystem == "RP")
90  {
92  fedIds.push_back(id);
93  }
94  }
95 
96  // conversion status
97  produces< DetSetVector<TotemVFATStatus> >(subSystem);
98 }
99 
100 //----------------------------------------------------------------------------------------------------
101 
103 {
104 }
105 
106 //----------------------------------------------------------------------------------------------------
107 
109 {
110  if (subSystem == "RP")
111  run< DetSetVector<TotemRPDigi> >(event, es);
112 }
113 
114 //----------------------------------------------------------------------------------------------------
115 
116 template <typename DigiType>
118 {
119  // get DAQ mapping
121  es.get<TotemReadoutRcd>().get(mapping);
122 
123  // get analysis mask to mask channels
124  ESHandle<TotemAnalysisMask> analysisMask;
125  es.get<TotemReadoutRcd>().get(analysisMask);
126 
127  // raw data handle
129  event.getByToken(fedDataToken, rawData);
130 
131  // book output products
132  vector<TotemFEDInfo> fedInfo;
133  DigiType digi;
134  DetSetVector<TotemVFATStatus> conversionStatus;
135 
136  // raw-data unpacking
137  SimpleVFATFrameCollection vfatCollection;
138  for (const auto &fedId : fedIds)
139  {
140  const FEDRawData &data = rawData->FEDData(fedId);
141  if (data.size() > 0)
142  rawDataUnpacker.Run(fedId, data, fedInfo, vfatCollection);
143  }
144 
145  // raw-to-digi conversion
146  rawToDigiConverter.Run(vfatCollection, *mapping, *analysisMask, digi, conversionStatus);
147 
148  // commit products to event
149  event.put(make_unique<vector<TotemFEDInfo>>(fedInfo), subSystem);
150  event.put(make_unique<DigiType>(digi), subSystem);
151  event.put(make_unique<DetSetVector<TotemVFATStatus>>(conversionStatus), subSystem);
152 }
153 
154 //----------------------------------------------------------------------------------------------------
155 
T getParameter(std::string const &) const
void Run(const VFATFrameCollection &coll, const TotemDAQMapping &mapping, const TotemAnalysisMask &mask, edm::DetSetVector< TotemRPDigi > &digi, edm::DetSetVector< TotemVFATStatus > &status)
Creates RP digi.
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
ParameterSet const & getParameterSet(ParameterSetID const &id)
EventSetup record for TOTEM readout-related information.
void run(edm::Event &, const edm::EventSetup &)
std::vector< unsigned int > fedIds
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
TotemVFATRawToDigi(const edm::ParameterSet &)
Collection of code for unpacking of TOTEM raw-data.
RawDataUnpacker rawDataUnpacker
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
Collection of code to convert TOTEM raw data into digi.
edm::EDGetTokenT< FEDRawDataCollection > fedDataToken
const T & get() const
Definition: EventSetup.h:56
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
RawToDigiConverter rawToDigiConverter
virtual void produce(edm::Event &, const edm::EventSetup &) override
int Run(int fedId, const FEDRawData &data, std::vector< TotemFEDInfo > &fedInfoColl, SimpleVFATFrameCollection &coll) const
Unpack data from FED with fedId into `coll&#39; collection.