CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Attributes
DTDigiToRaw Class Reference

#include <DTDigiToRaw.h>

Public Member Functions

FEDRawDatacreateFedBuffers (const DTDigiCollection &digis, edm::ESHandle< DTReadOutMapping > &mapping)
 Take a vector of digis and fill the FEDRawDataCollection. More...
 
 DTDigiToRaw (const edm::ParameterSet &ps)
 Constructor. More...
 
void SetdduID (int dduid)
 
virtual ~DTDigiToRaw ()
 Destructor. More...
 

Private Types

typedef unsigned int Word32
 
typedef long long Word64
 

Private Attributes

int dduID_
 
bool debug
 
const edm::ParameterSet pset
 

Detailed Description

Definition at line 15 of file DTDigiToRaw.h.

Member Typedef Documentation

◆ Word32

typedef unsigned int DTDigiToRaw::Word32
private

Definition at line 29 of file DTDigiToRaw.h.

◆ Word64

typedef long long DTDigiToRaw::Word64
private

Definition at line 30 of file DTDigiToRaw.h.

Constructor & Destructor Documentation

◆ DTDigiToRaw()

DTDigiToRaw::DTDigiToRaw ( const edm::ParameterSet ps)

Constructor.

Definition at line 10 of file DTDigiToRaw.cc.

10  : pset(ps) {
11  debug = pset.getUntrackedParameter<bool>("debugMode", false);
12  if (debug)
13  cout << "[DTDigiToRaw]: constructor" << endl;
14 }

References gather_cfg::cout, debug, edm::ParameterSet::getUntrackedParameter(), and pset.

◆ ~DTDigiToRaw()

DTDigiToRaw::~DTDigiToRaw ( )
virtual

Destructor.

Definition at line 16 of file DTDigiToRaw.cc.

16  {
17  if (debug)
18  cout << "[DTDigiToRaw]: destructor" << endl;
19 }

References gather_cfg::cout, and debug.

Member Function Documentation

◆ createFedBuffers()

FEDRawData * DTDigiToRaw::createFedBuffers ( const DTDigiCollection digis,
edm::ESHandle< DTReadOutMapping > &  mapping 
)

Take a vector of digis and fill the FEDRawDataCollection.

Definition at line 21 of file DTDigiToRaw.cc.

21  {
22  int NROS = 12;
23  int NROB = 25;
24 
25  vector<uint32_t> words;
26 
28  << WORDTYPESHIFT;
29 
31  << WORDTYPESHIFT;
32 
33  int NWords = 2;
34  words.push_back(0);
35  words.push_back(0);
36 
37  int NTDCMeaWords = 0;
38 
39  int NLayers = 0;
40  int NDigis = 0;
41 
43  detUnitIt = digis.begin();
44 
45  bool b_ros[12] = {false, false, false, false, false, false, false, false, false, false, false, false};
46  vector<uint32_t> w_ROBROS[12][25];
47 
48  for (detUnitIt = digis.begin(); detUnitIt != digis.end(); ++detUnitIt) {
49  NLayers++;
50 
51  const DTLayerId layerId = (*detUnitIt).first;
52  const DTDigiCollection::Range& digiRange = (*detUnitIt).second;
53  // Loop over all digis in the given range
54 
55  for (DTDigiCollection::const_iterator digi = digiRange.first; digi != digiRange.second; digi++) {
56  NDigis++;
57  int dduId = -1, rosId = -1, robId = -1, tdcId = -1, channelId = -1;
58 
59  int layer = layerId.layer();
60  DTSuperLayerId superlayerID = layerId.superlayerId();
61  int superlayer = superlayerID.superlayer();
62  DTChamberId chamberID = superlayerID.chamberId();
63  int station = chamberID.station();
64  int wheel = chamberID.wheel();
65  int sector = chamberID.sector();
66 
67  int searchstatus = map->geometryToReadOut(wheel,
68  station,
69  sector,
70  superlayer,
71  layer,
72  (*digi).wire(), //"input"
73  dduId,
74  rosId,
75  robId,
76  tdcId,
77  channelId); //"output"
78 
79  if (searchstatus == 1 && debug)
80  cout << "[DTDigiToRaw]: warning, geometryToReadOut status = 1" << endl;
81 
82  //create FED corresponding to current ddu
83  if (dduID_ != dduId)
84  continue;
85 
86  DTTDCMeasurementWord dttdc_mw;
87  uint32_t word;
88  int ntdc = (*digi).countsTDC();
89  dttdc_mw.set(word, 0, 0, 0, tdcId, channelId, ntdc * 4); //FIXME
90 
91  //provisional fix
92  DTTDCMeasurementWord tdcMeasurementWord(word);
93  int tdcIDCheck = tdcMeasurementWord.tdcID();
94  int tdcChannelCheck = tdcMeasurementWord.tdcChannel();
95  int tdcCountsCheck = tdcMeasurementWord.tdcTime();
96  if (tdcIDCheck == tdcId && channelId == tdcChannelCheck && ntdc == tdcCountsCheck) {
97  if (rosId <= NROS && rosId > 0)
98  b_ros[rosId - 1] = true;
99  else if (debug) {
100  cout << "[DTDigiToRaw]: invalid value for rosId" << endl;
101  }
102 
103  NTDCMeaWords++;
104  w_ROBROS[rosId - 1][robId].push_back(word);
105  }
106  }
107  }
108 
109  uint32_t therosList = 0;
110  for (int i_ros = 0; i_ros < NROS; i_ros++) {
111  if (b_ros[i_ros])
112  therosList += uint32_t(pow(2.0, i_ros));
113  }
114 
115  if (debug)
116  cout << "[DTDigiToRaw]: therosList = " << therosList << endl;
117 
118  for (int i_ros = 0; i_ros < NROS; i_ros++) {
119  if (b_ros[i_ros]) {
120  words.push_back(fakeROSHeaderWord);
121  NWords++;
122  }
123 
124  for (int i_rob = 0; i_rob < NROB; i_rob++) {
125  vector<uint32_t>::const_iterator i_robros;
126  if (w_ROBROS[i_ros][i_rob].begin() != w_ROBROS[i_ros][i_rob].end()) {
127  uint32_t word = 0;
128  DTROBHeaderWord rob_header;
129  rob_header.set(word, i_rob, 0, 0);
130  //static void set(uint32_t &word, int rob_id, int event_id, int bunch_id)
131  words.push_back(word);
132  NWords++;
133 
134  int n_robros = 0;
135  for (i_robros = w_ROBROS[i_ros][i_rob].begin(); i_robros != w_ROBROS[i_ros][i_rob].end(); i_robros++) {
136  NWords++;
137  words.push_back((*i_robros));
138  n_robros++;
139  }
140 
141  NWords++;
142  DTROBTrailerWord rob_trailer;
143  rob_trailer.set(word, i_rob, 0, n_robros + 2);
144  //static void set(uint32_t &word, int rob_id, int event_id, int word_count)
145  words.push_back(word);
146  }
147  }
148 
149  if (b_ros[i_ros]) {
150  words.push_back(fakeROSTrailerWord);
151  NWords++;
152  }
153  }
154 
155  if (NWords % 2 == 1) {
156  words.push_back(0);
157  NWords++;
158  }
159 
160  words.push_back(0);
161  words.push_back(0);
162  //include rosList in raw data information
163  uint32_t secondstatusword = therosList << 16;
164  words.push_back(secondstatusword);
165 
166  words.push_back(0);
167  words.push_back(0);
168  words.push_back(0);
169 
170  // Write Raw Data
171  int dataSize = words.size() * sizeof(Word32);
172  FEDRawData* rawData = new FEDRawData(dataSize);
173  Word64* word64 = reinterpret_cast<Word64*>(rawData->data());
174  for (unsigned int i = 0; i < words.size(); i += 2) {
175  *word64 = (Word64(words[i]) << 32) | words[i + 1];
176  word64++;
177  }
178 
179  return rawData;
180 }

References cscd2r::chamberID(), DTSuperLayerId::chamberId(), gather_cfg::cout, dduID_, debug, mps_fire::end, DTROSWordType::headerControlWord, mps_fire::i, DTLayerId::layer(), genParticles_cff::map, funct::pow(), l1tstage2_dqm_sourceclient-live_cfg::rawData, DTROSWordType::rosTypeWord, DTROBHeaderWord::set(), DTROBTrailerWord::set(), DTTDCMeasurementWord::set(), relativeConstraints::station, CSCDetId::station(), DTSuperLayerId::superlayer(), DTLayerId::superlayerId(), DTTDCMeasurementWord::tdcChannel(), DTTDCMeasurementWord::tdcID(), DTTDCMeasurementWord::tdcTime(), DTROSWordType::trailerControlWord, makeMuonMisalignmentScenario::wheel, WORDCONTROLSHIFT, and WORDTYPESHIFT.

◆ SetdduID()

void DTDigiToRaw::SetdduID ( int  dduid)

Definition at line 182 of file DTDigiToRaw.cc.

182 { dduID_ = x; }

References dduID_, and x.

Member Data Documentation

◆ dduID_

int DTDigiToRaw::dduID_
private

Definition at line 33 of file DTDigiToRaw.h.

Referenced by createFedBuffers(), and SetdduID().

◆ debug

bool DTDigiToRaw::debug
private

◆ pset

const edm::ParameterSet DTDigiToRaw::pset
private
DTROBTrailerWord::set
static void set(uint32_t &word, int rob_id, int event_id, int word_count)
Definition: DTDDUWords.h:389
DTSuperLayerId
Definition: DTSuperLayerId.h:12
DTTDCMeasurementWord
Definition: DTDDUWords.h:475
mps_fire.i
i
Definition: mps_fire.py:428
DTROBHeaderWord
Definition: DTDDUWords.h:341
relativeConstraints.station
station
Definition: relativeConstraints.py:67
gather_cfg.cout
cout
Definition: gather_cfg.py:144
l1tstage2_dqm_sourceclient-live_cfg.rawData
rawData
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:162
WORDCONTROLSHIFT
#define WORDCONTROLSHIFT
Definition: DTDDUWords.h:11
DTDigiToRaw::dduID_
int dduID_
Definition: DTDigiToRaw.h:33
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
DTSuperLayerId::superlayer
int superlayer() const
Return the superlayer number (deprecated method name)
Definition: DTSuperLayerId.h:42
DTTDCMeasurementWord::set
static void set(uint32_t &word, int pc, int paf, int hu, int tdc_id, int tdc_channel, int tdc_time)
Definition: DTDDUWords.h:494
DDAxes::x
DTDigiToRaw::pset
const edm::ParameterSet pset
Definition: DTDigiToRaw.h:31
MuonDigiCollection::const_iterator
std::vector< DigiType >::const_iterator const_iterator
Definition: MuonDigiCollection.h:94
FEDRawData
Definition: FEDRawData.h:19
word
uint64_t word
Definition: CTPPSTotemDataFormatter.cc:29
DTROSWordType::headerControlWord
static const uint32_t headerControlWord
Control bits definitions.
Definition: DTDDUWords.h:179
DTDigiToRaw::Word32
unsigned int Word32
Definition: DTDigiToRaw.h:29
mps_fire.end
end
Definition: mps_fire.py:242
DTROBHeaderWord::set
static void set(uint32_t &word, int rob_id, int event_id, int bunch_id)
Definition: DTDDUWords.h:357
DTLayerId
Definition: DTLayerId.h:12
DTSuperLayerId::chamberId
DTChamberId chamberId() const
Return the corresponding ChamberId.
Definition: DTSuperLayerId.h:45
Word64
uint64_t Word64
Definition: RPCUnpackingModule.cc:38
makeMuonMisalignmentScenario.wheel
wheel
Definition: makeMuonMisalignmentScenario.py:319
DTROBTrailerWord
Definition: DTDDUWords.h:373
WORDTYPESHIFT
#define WORDTYPESHIFT
Definition: DTDDUWords.h:13
DTDigiToRaw::Word64
long long Word64
Definition: DTDigiToRaw.h:30
DTROSWordType::trailerControlWord
static const uint32_t trailerControlWord
Definition: DTDDUWords.h:180
DTROSWordType::rosTypeWord
static const uint32_t rosTypeWord
Word Type bits definitions.
Definition: DTDDUWords.h:188
DTDigiToRaw::debug
bool debug
Definition: DTDigiToRaw.h:34
DTLayerId::superlayerId
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:45
MuonDigiCollection::Range
std::pair< const_iterator, const_iterator > Range
Definition: MuonDigiCollection.h:95
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
genParticles_cff.map
map
Definition: genParticles_cff.py:11
DTChamberId
Definition: DTChamberId.h:14
CSCDetId::station
int station() const
Definition: CSCDetId.h:79
cscd2r::chamberID
CSCDetId chamberID(const CSCDetId &cscDetId)
takes layer ID, converts to chamber ID, switching ME1A to ME11
Definition: CSCDigiToRaw.cc:29
DigiContainerIterator
Definition: MuonDigiCollection.h:30
DTLayerId::layer
int layer() const
Return the layer number.
Definition: DTLayerId.h:42