CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTUnpackingModule.cc
Go to the documentation of this file.
1 
15 
22 
24 
28 
29 
30 using namespace edm;
31 using namespace std;
32 
33 
34 
35 #define SLINK_WORD_SIZE 8
36 
37 
39 
40  const string & dataType = ps.getParameter<string>("dataType");
41 
42  ParameterSet unpackerParameters = ps.getParameter<ParameterSet>("readOutParameters");
43 
44 
45  if (dataType == "DDU") {
46  unpacker = new DTDDUUnpacker(unpackerParameters);
47  }
48  else if (dataType == "ROS25") {
49  unpacker = new DTROS25Unpacker(unpackerParameters.getParameter<ParameterSet>("rosParameters"));
50  }
51  else if (dataType == "ROS8") {
52  unpacker = new DTROS8Unpacker(unpackerParameters);
53  }
54  else {
55  throw cms::Exception("InvalidParameter") << "DTUnpackingModule: dataType "
56  << dataType << " is unknown";
57  }
58 
59  fedbyType_ = ps.getParameter<bool>("fedbyType"); // default was: true
60  inputLabel = ps.getParameter<InputTag>("inputLabel"); // default was: source
61  useStandardFEDid_ = ps.getParameter<bool>("useStandardFEDid"); // default was: true
62  minFEDid_ = ps.getUntrackedParameter<int>("minFEDid",770); // default: 770
63  maxFEDid_ = ps.getUntrackedParameter<int>("maxFEDid",779); // default 779
64  dqmOnly = ps.getParameter<bool>("dqmOnly"); // default: false
65 
66  if(!dqmOnly) {
67  produces<DTDigiCollection>();
68  produces<DTLocalTriggerCollection>();
69  }
70 }
71 
73  delete unpacker;
74 }
75 
76 
77 void DTUnpackingModule::produce(Event & e, const EventSetup& context){
78 
80  if (fedbyType_) {
81  e.getByType(rawdata);
82  }
83  else {
84  e.getByLabel(inputLabel, rawdata);
85  }
86 
87  // Get the mapping from the setup
89  context.get<DTReadOutMappingRcd>().get(mapping);
90 
91  // Create the result i.e. the collections of MB Digis and SC local triggers
92  auto_ptr<DTDigiCollection> detectorProduct(new DTDigiCollection);
93  auto_ptr<DTLocalTriggerCollection> triggerProduct(new DTLocalTriggerCollection);
94 
95 
96  // Loop over the DT FEDs
97  int FEDIDmin = 0, FEDIDMax = 0;
98  if (useStandardFEDid_){
99  FEDIDmin = FEDNumbering::MINDTFEDID;
100  FEDIDMax = FEDNumbering::MAXDTFEDID;
101  }
102  else {
103  FEDIDmin = minFEDid_;
104  FEDIDMax = maxFEDid_;
105  }
106 
107  for (int id=FEDIDmin; id<=FEDIDMax; ++id){
108 
109  const FEDRawData& feddata = rawdata->FEDData(id);
110 
111  if (feddata.size()){
112 
113  // Unpack the data
114  unpacker->interpretRawData(reinterpret_cast<const unsigned int*>(feddata.data()),
115  feddata.size(), id, mapping, detectorProduct, triggerProduct);
116  }
117  }
118 
119  // commit to the event
120  if(!dqmOnly) {
121  e.put(detectorProduct);
122  e.put(triggerProduct);
123  }
124 }
125 
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
void produce(edm::Event &e, const edm::EventSetup &c)
Call the Unpackers and create the digis.
virtual void interpretRawData(const unsigned int *index, int datasize, int dduID, edm::ESHandle< DTReadOutMapping > &mapping, std::auto_ptr< DTDigiCollection > &product, std::auto_ptr< DTLocalTriggerCollection > &product2, uint16_t rosList=0)=0
bool getByType(Handle< PROD > &result) const
Definition: Event.h:398
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:49
virtual ~DTUnpackingModule()
Destructor.
int minFEDid_
if not you need to set the range by hand
DTUnpackingModule(const edm::ParameterSet &pset)
Constructor.
bool useStandardFEDid_
do you want to use the standard DT FED ID&#39;s, i.e. [770-775]? (why the hell 6??)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
bool fedbyType_
get the FED payload by type?
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
const T & get() const
Definition: EventSetup.h:55
DTUnpacker * unpacker
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:29
edm::InputTag inputLabel
if not you need the label
dictionary rawdata
Definition: lumiPlot.py:393