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 
10 
16 
23 
25 
29 
30 
31 using namespace edm;
32 using namespace std;
33 
34 
35 
36 #define SLINK_WORD_SIZE 8
37 
38 
40 
41  const string & dataType = ps.getParameter<string>("dataType");
42 
43  ParameterSet unpackerParameters = ps.getParameter<ParameterSet>("readOutParameters");
44 
45 
46  if (dataType == "DDU") {
47  unpacker = new DTDDUUnpacker(unpackerParameters);
48  }
49  else if (dataType == "ROS25") {
50  unpacker = new DTROS25Unpacker(unpackerParameters.getParameter<ParameterSet>("rosParameters"));
51  }
52  else if (dataType == "ROS8") {
53  unpacker = new DTROS8Unpacker(unpackerParameters);
54  }
55  else {
56  throw cms::Exception("InvalidParameter") << "DTUnpackingModule: dataType "
57  << dataType << " is unknown";
58  }
59 
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  e.getByLabel(inputLabel, rawdata);
81 
82  if(!rawdata.isValid()){
83  LogError("DTUnpackingModule::produce") << " unable to get raw data from the event" << endl;
84  return;
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
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:94
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
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