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 
8 
14 
21 
23 
27 
28 
29 using namespace edm;
30 using namespace std;
31 
32 
33 
34 #define SLINK_WORD_SIZE 8
35 
36 
38 
39  const string & dataType = ps.getParameter<string>("dataType");
40 
41  ParameterSet unpackerParameters = ps.getParameter<ParameterSet>("readOutParameters");
42 
43 
44  if (dataType == "DDU") {
45  unpacker = new DTDDUUnpacker(unpackerParameters);
46  }
47  else if (dataType == "ROS25") {
48  unpacker = new DTROS25Unpacker(unpackerParameters.getParameter<ParameterSet>("rosParameters"));
49  }
50  else if (dataType == "ROS8") {
51  unpacker = new DTROS8Unpacker(unpackerParameters);
52  }
53  else {
54  throw cms::Exception("InvalidParameter") << "DTUnpackingModule: dataType "
55  << dataType << " is unknown";
56  }
57 
58  inputLabel = ps.getParameter<InputTag>("inputLabel"); // default was: source
59  useStandardFEDid_ = ps.getParameter<bool>("useStandardFEDid"); // default was: true
60  minFEDid_ = ps.getUntrackedParameter<int>("minFEDid",770); // default: 770
61  maxFEDid_ = ps.getUntrackedParameter<int>("maxFEDid",779); // default 779
62  dqmOnly = ps.getParameter<bool>("dqmOnly"); // default: false
63 
64  if(!dqmOnly) {
65  produces<DTDigiCollection>();
66  produces<DTLocalTriggerCollection>();
67  }
68 }
69 
71  delete unpacker;
72 }
73 
74 
75 void DTUnpackingModule::produce(Event & e, const EventSetup& context){
76 
78  e.getByLabel(inputLabel, rawdata);
79 
80  if(!rawdata.isValid()){
81  LogError("DTUnpackingModule::produce") << " unable to get raw data from the event" << endl;
82  return;
83  }
84 
85  // Get the mapping from the setup
87  context.get<DTReadOutMappingRcd>().get(mapping);
88 
89  // Create the result i.e. the collections of MB Digis and SC local triggers
90  auto_ptr<DTDigiCollection> detectorProduct(new DTDigiCollection);
91  auto_ptr<DTLocalTriggerCollection> triggerProduct(new DTLocalTriggerCollection);
92 
93 
94  // Loop over the DT FEDs
95  int FEDIDmin = 0, FEDIDMax = 0;
96  if (useStandardFEDid_){
97  FEDIDmin = FEDNumbering::MINDTFEDID;
98  FEDIDMax = FEDNumbering::MAXDTFEDID;
99  }
100  else {
101  FEDIDmin = minFEDid_;
102  FEDIDMax = maxFEDid_;
103  }
104 
105  for (int id=FEDIDmin; id<=FEDIDMax; ++id){
106 
107  const FEDRawData& feddata = rawdata->FEDData(id);
108 
109  if (feddata.size()){
110 
111  // Unpack the data
112  unpacker->interpretRawData(reinterpret_cast<const unsigned int*>(feddata.data()),
113  feddata.size(), id, mapping, detectorProduct, triggerProduct);
114  }
115  }
116 
117  // commit to the event
118  if(!dqmOnly) {
119  e.put(detectorProduct);
120  e.put(triggerProduct);
121  }
122 }
123 
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
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
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:116
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
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:28
edm::InputTag inputLabel
if not you need the label
dictionary rawdata
Definition: lumiPlot.py:393