CMS 3D CMS Logo

DTUnpackingModule.cc
Go to the documentation of this file.
1 
8 
16 
19 
24 
28 
29 using namespace edm;
30 using namespace std;
31 
32 #define SLINK_WORD_SIZE 8
33 
35  dataType = ps.getParameter<string>("dataType");
36 
37  ParameterSet unpackerParameters = ps.getParameter<ParameterSet>("readOutParameters");
38 
39  if (dataType == "DDU") {
40  unpacker = new DTDDUUnpacker(unpackerParameters);
41  } else if (dataType == "ROS25") {
42  unpacker = new DTROS25Unpacker(unpackerParameters.getParameter<ParameterSet>("rosParameters"));
43  } else if (dataType == "ROS8") {
44  unpacker = new DTROS8Unpacker(unpackerParameters);
45  } else {
46  throw cms::Exception("InvalidParameter") << "DTUnpackingModule: dataType " << dataType << " is unknown";
47  }
48 
49  inputLabel = consumes<FEDRawDataCollection>(ps.getParameter<InputTag>("inputLabel")); // default was: source
50  mappingToken_ = esConsumes<DTReadOutMapping, DTReadOutMappingRcd>();
51  useStandardFEDid_ = ps.getParameter<bool>("useStandardFEDid"); // default was: true
52  minFEDid_ = ps.getUntrackedParameter<int>("minFEDid", 770); // default: 770
53  maxFEDid_ = ps.getUntrackedParameter<int>("maxFEDid", 779); // default 779
54  dqmOnly = ps.getParameter<bool>("dqmOnly"); // default: false
56  unpackerParameters.getUntrackedParameter<bool>("performDataIntegrityMonitor", false); // default: false
57 
58  if (!dqmOnly) {
59  produces<DTDigiCollection>();
60  produces<DTLocalTriggerCollection>();
61  }
63  produces<std::vector<DTDDUData>>();
64  produces<std::vector<std::vector<DTROS25Data>>>();
65  }
66 }
67 
69 
72  desc.add<std::string>("dataType", "DDU");
73  desc.add<edm::InputTag>("inputLabel", edm::InputTag("rawDataCollector"));
74  desc.add<bool>("useStandardFEDid", true);
75  desc.addUntracked<int>("minFEDid", 770);
76  desc.addUntracked<int>("maxFEDid", 779);
77  desc.addOptional<bool>("fedbyType"); // never used, only kept here for back-compatibility
78  {
80  psd0.addUntracked<bool>("debug", false);
81  {
83  psd1.addUntracked<bool>("writeSC", true);
84  psd1.addUntracked<bool>("readingDDU", true);
85  psd1.addUntracked<bool>("performDataIntegrityMonitor", false);
86  psd1.addUntracked<bool>("readDDUIDfromDDU", true);
87  psd1.addUntracked<bool>("debug", false);
88  psd1.addUntracked<bool>("localDAQ", false);
89  psd0.add<edm::ParameterSetDescription>("rosParameters", psd1);
90  }
91  psd0.addUntracked<bool>("performDataIntegrityMonitor", false);
92  psd0.addUntracked<bool>("localDAQ", false);
93  desc.add<edm::ParameterSetDescription>("readOutParameters", psd0);
94  }
95  desc.add<bool>("dqmOnly", false);
96  descriptions.add("dtUnpackingModule", desc);
97 }
98 
99 void DTUnpackingModule::produce(Event& e, const EventSetup& context) {
101  e.getByToken(inputLabel, rawdata);
102 
103  if (!rawdata.isValid()) {
104  LogError("DTUnpackingModule::produce") << " unable to get raw data from the event" << endl;
105  return;
106  }
107 
108  // Get the mapping from the setup
110 
111  // Create the result i.e. the collections of MB Digis and SC local triggers
112  auto detectorProduct = std::make_unique<DTDigiCollection>();
113  auto triggerProduct = std::make_unique<DTLocalTriggerCollection>();
114 
115  auto dduProduct = std::make_unique<std::vector<DTDDUData>>();
116  auto ros25Product = std::make_unique<DTROS25Collection>();
117 
118  // Loop over the DT FEDs
119  int FEDIDmin = 0, FEDIDMax = 0;
120  if (useStandardFEDid_) {
121  FEDIDmin = FEDNumbering::MINDTFEDID;
122  FEDIDMax = FEDNumbering::MAXDTFEDID;
123  } else {
124  FEDIDmin = minFEDid_;
125  FEDIDMax = maxFEDid_;
126  }
127 
128  for (int id = FEDIDmin; id <= FEDIDMax; ++id) {
129  const FEDRawData& feddata = rawdata->FEDData(id);
130 
131  if (feddata.size()) {
132  // Unpack the data
133  unpacker->interpretRawData(reinterpret_cast<const unsigned int*>(feddata.data()),
134  feddata.size(),
135  id,
136  mapping,
137  detectorProduct,
138  triggerProduct);
140  if (dataType == "DDU") {
141  dduProduct->push_back(dynamic_cast<DTDDUUnpacker*>(unpacker)->getDDUControlData());
142  ros25Product->push_back(dynamic_cast<DTDDUUnpacker*>(unpacker)->getROSsControlData());
143  } else if (dataType == "ROS25") {
144  ros25Product->push_back(dynamic_cast<DTROS25Unpacker*>(unpacker)->getROSsControlData());
145  }
146  }
147  }
148  }
149 
150  // commit to the event
151  if (!dqmOnly) {
152  e.put(std::move(detectorProduct));
153  e.put(std::move(triggerProduct));
154  }
156  e.put(std::move(dduProduct));
157  e.put(std::move(ros25Product));
158  }
159 }
ConfigurationDescriptions.h
FEDNumbering.h
DTROS25Unpacker
Definition: DTROS25Unpacker.h:18
Handle.h
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
MessageLogger.h
DTLocalTriggerCollection.h
ESHandle.h
DTUnpackingModule::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: DTUnpackingModule.cc:70
edm
HLT enums.
Definition: AlignableModifier.h:19
DTROS8Unpacker.h
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89287
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
DTUnpacker::interpretRawData
virtual void interpretRawData(const unsigned int *index, int datasize, int dduID, edm::ESHandle< DTReadOutMapping > &mapping, std::unique_ptr< DTDigiCollection > &product, std::unique_ptr< DTLocalTriggerCollection > &product2, uint16_t rosList=0)=0
DTUnpackingModule::inputLabel
edm::EDGetTokenT< FEDRawDataCollection > inputLabel
if not you need the label
Definition: DTUnpackingModule.h:38
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
DTDDUUnpacker.h
FEDRawData.h
edm::Handle
Definition: AssociativeIterator.h:50
DTskim_cfg.dataType
dataType
Definition: DTskim_cfg.py:56
FEDRawData::data
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
FEDRawData
Definition: FEDRawData.h:19
DTUnpackingModule::dataType
std::string dataType
Definition: DTUnpackingModule.h:47
DTROS8Unpacker
Definition: DTROS8Unpacker.h:18
DTUnpackingModule::minFEDid_
int minFEDid_
if not you need to set the range by hand
Definition: DTUnpackingModule.h:43
DTUnpackingModule.h
DTUnpackingModule::maxFEDid_
int maxFEDid_
Definition: DTUnpackingModule.h:44
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
DTControlData.h
DTROS25Unpacker.h
DTUnpackingModule::useStandardFEDid_
bool useStandardFEDid_
do you want to use the standard DT FED ID's, i.e. [770-775]? (why the hell 6??)
Definition: DTUnpackingModule.h:41
DTUnpackingModule::~DTUnpackingModule
~DTUnpackingModule() override
Destructor.
Definition: DTUnpackingModule.cc:68
edm::ESHandle< DTReadOutMapping >
ParameterSetDescription.h
DTUnpackingModule::DTUnpackingModule
DTUnpackingModule(const edm::ParameterSet &pset)
Constructor.
Definition: DTUnpackingModule.cc:34
FEDRawDataCollection::FEDData
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
Definition: FEDRawDataCollection.cc:19
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FEDNumbering::MAXDTFEDID
Definition: FEDNumbering.h:56
DTDDUUnpacker
Definition: DTDDUUnpacker.h:17
edm::ParameterSetDescription::addUntracked
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:100
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
DTUnpackingModule::mappingToken_
edm::ESGetToken< DTReadOutMapping, DTReadOutMappingRcd > mappingToken_
Definition: DTUnpackingModule.h:39
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:148
DTUnpackingModule::produce
void produce(edm::Event &e, const edm::EventSetup &c) override
Call the Unpackers and create the digis.
Definition: DTUnpackingModule.cc:99
edm::EventSetup
Definition: EventSetup.h:57
FEDNumbering::MINDTFEDID
Definition: FEDNumbering.h:55
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
FEDRawData::size
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
DTUnpackingModule::performDataIntegrityMonitor
bool performDataIntegrityMonitor
Definition: DTUnpackingModule.h:46
DTUnpackingModule::dqmOnly
bool dqmOnly
Definition: DTUnpackingModule.h:45
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
Exception
Definition: hltDiff.cc:246
DTUnpackingModule::unpacker
DTUnpacker * unpacker
Definition: DTUnpackingModule.h:35
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
DTDigiCollection.h
ParameterSet.h
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::Event
Definition: Event.h:73
taus_updatedMVAIds_cff.mapping
mapping
Definition: taus_updatedMVAIds_cff.py:29
edm::InputTag
Definition: InputTag.h:15
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37