CMS 3D CMS Logo

CSCDigiToRaw.cc
Go to the documentation of this file.
1 
13 #include "boost/dynamic_bitset.hpp"
14 #include "boost/foreach.hpp"
23 #include <algorithm>
24 
25 using namespace edm;
26 using namespace std;
27 
28 namespace cscd2r
29 {
31 CSCDetId chamberID(const CSCDetId & cscDetId)
32 {
33  CSCDetId chamberId = cscDetId.chamberId();
34  if (chamberId.ring() ==4)
35  {
36  chamberId = CSCDetId(chamberId.endcap(), chamberId.station(), 1, chamberId.chamber(), 0);
37  }
38  return chamberId;
39 }
40 
41 template<typename LCTCollection>
42 bool accept(const CSCDetId & cscId, const LCTCollection & lcts,
43  int bxMin, int bxMax, bool me1abCheck = false)
44 {
45  if (bxMin == -999) return true;
46  int nominalBX = 6;
47  CSCDetId chamberId = chamberID(cscId);
48  typename LCTCollection::Range lctRange = lcts.get(chamberId);
49  bool result = false;
50  for (typename LCTCollection::const_iterator lctItr = lctRange.first;
51  lctItr != lctRange.second; ++lctItr)
52  {
53  int bx = lctItr->getBX() - nominalBX;
54  if (bx >= bxMin && bx <= bxMax)
55  {
56  result = true;
57  break;
58  }
59  }
60 
61  bool me1 = cscId.station() == 1 && cscId.ring() == 1;
62  //this is another "creative" recovery of smart ME1A-ME1B TMB logic cases:
63  //wire selective readout requires at least one (A)LCT in the full chamber
64  if (me1 && result == false && me1abCheck){
65  CSCDetId me1aId = CSCDetId(chamberId.endcap(), chamberId.station(), 4, chamberId.chamber(), 0);
66  lctRange = lcts.get(me1aId);
67  for (typename LCTCollection::const_iterator lctItr = lctRange.first;
68  lctItr != lctRange.second; ++lctItr)
69  {
70  int bx = lctItr->getBX() - nominalBX;
71  if (bx >= bxMin && bx <= bxMax)
72  {
73  result = true;
74  break;
75  }
76  }
77  }
78 
79  return result;
80 }
81 
82 // need to specialize for pretriggers, since they don't have a getBX()
83 template<>
84 bool accept(const CSCDetId & cscId, const CSCCLCTPreTriggerCollection & lcts,
85  int bxMin, int bxMax, bool me1abCheck)
86 {
87  if (bxMin == -999) return true;
88  int nominalBX = 6;
89  CSCDetId chamberId = chamberID(cscId);
90  CSCCLCTPreTriggerCollection::Range lctRange = lcts.get(chamberId);
91  bool result = false;
92  for (CSCCLCTPreTriggerCollection::const_iterator lctItr = lctRange.first;
93  lctItr != lctRange.second; ++lctItr)
94  {
95  int bx = *lctItr - nominalBX;
96  if (bx >= bxMin && bx <= bxMax)
97  {
98  result = true;
99  break;
100  }
101  }
102  bool me1a = cscId.station() == 1 && cscId.ring() == 4;
103  if (me1a && result == false && me1abCheck) {
104  //check pretriggers in me1a as well; relevant for TMB emulator writing to separate detIds
105  lctRange = lcts.get(cscId);
106  for (CSCCLCTPreTriggerCollection::const_iterator lctItr = lctRange.first;
107  lctItr != lctRange.second; ++lctItr)
108  {
109  int bx = *lctItr - nominalBX;
110  if (bx >= bxMin && bx <= bxMax)
111  {
112  result = true;
113  break;
114  }
115  }
116  }
117  return result;
118 }
119 
120 }
121 
122 
124  : alctWindowMin_(pset.getParameter<int>("alctWindowMin")),
125  alctWindowMax_(pset.getParameter<int>("alctWindowMax")),
126  clctWindowMin_(pset.getParameter<int>("clctWindowMin")),
127  clctWindowMax_(pset.getParameter<int>("clctWindowMax")),
128  preTriggerWindowMin_(pset.getParameter<int>("preTriggerWindowMin")),
129  preTriggerWindowMax_(pset.getParameter<int>("preTriggerWindowMax")),
130  formatVersion_(2005),
131  usePreTriggers_(true),
132  packEverything_(false)
133 {}
134 
136 {
137  theChamberDataMap.clear();
139 }
140 
141 
143 {
144  CSCDetId chamberId = cscd2r::chamberID(cscDetId);
145  // find the entry into the map
146  map<CSCDetId, CSCEventData>::iterator chamberMapItr = theChamberDataMap.find(chamberId);
147  if (chamberMapItr == theChamberDataMap.end())
148  {
149  // make an entry, telling it the correct chamberType
150  int chamberType = chamberId.iChamberType();
151  chamberMapItr = theChamberDataMap.insert(pair<CSCDetId, CSCEventData>(chamberId, CSCEventData(chamberType, formatVersion_))).first;
152  }
153  CSCEventData & cscData = chamberMapItr->second;
154  cscData.dmbHeader()->setCrateAddress(theElectronicsMap->crate(cscDetId), theElectronicsMap->dmb(cscDetId));
155 
156  if (formatVersion_ == 2013)
157  {
158  // Set DMB version field to distinguish between ME11s and other chambers (ME11 - 2, others - 1)
159  bool me11 = ((chamberId.station()==1) && (chamberId.ring()==4)) || ((chamberId.station()==1) && (chamberId.ring()==1));
160  if (me11)
161  {
162  cscData.dmbHeader()->setdmbVersion(2);
163  }
164  else
165  {
166  cscData.dmbHeader()->setdmbVersion(1);
167  }
168 
169  }
170  return cscData;
171 }
172 
173 
174 
176  const CSCCLCTPreTriggerCollection & preTriggers)
177 { //iterate over chambers with strip digis in them
178  for (CSCStripDigiCollection::DigiRangeIterator j=stripDigis.begin(); j!=stripDigis.end(); ++j)
179  {
180  CSCDetId cscDetId=(*j).first;
181  // only digitize if there are pre-triggers
182 
183  bool me1abCheck = formatVersion_ == 2013;
184  /* !!! Testing. Uncomment for production */
186  (usePreTriggers_ && cscd2r::accept(cscDetId, preTriggers, preTriggerWindowMin_, preTriggerWindowMax_, me1abCheck)) )
187  {
188  bool me1a = (cscDetId.station()==1) && (cscDetId.ring()==4);
189  bool zplus = (cscDetId.endcap() == 1);
190  bool me1b = (cscDetId.station()==1) && (cscDetId.ring()==1);
191 
192  CSCEventData & cscData = findEventData(cscDetId);
193 
194  std::vector<CSCStripDigi>::const_iterator digiItr = (*j).second.first;
195  std::vector<CSCStripDigi>::const_iterator last = (*j).second.second;
196  for ( ; digiItr != last; ++digiItr)
197  {
198  CSCStripDigi digi = *digiItr;
199  int strip = digi.getStrip();
200  if (formatVersion_ == 2013)
201  {
202  if ( me1a && zplus )
203  {
204  digi.setStrip(49-strip); // 1-48 -> 48-1
205  }
206  if ( me1b && !zplus)
207  {
208  digi.setStrip(65-strip); // 1-64 -> 64-1
209  }
210  if ( me1a )
211  {
212  strip = digi.getStrip(); // reset back 1-16 to 65-80 digi
213  digi.setStrip(strip+64);
214  }
215 
216  }
217  else
218  {
219  if ( me1a && zplus )
220  {
221  digi.setStrip(17-strip); // 1-16 -> 16-1
222  }
223  if ( me1b && !zplus)
224  {
225  digi.setStrip(65-strip); // 1-64 -> 64-1
226  }
227  if ( me1a )
228  {
229  strip = digi.getStrip(); // reset back 1-16 to 65-80 digi
230  digi.setStrip(strip+64);
231  }
232  }
233  cscData.add(digi, cscDetId.layer() );
234  }
235  }
236  }
237 }
238 
239 
241  const CSCALCTDigiCollection & alctDigis)
242 {
243  add(alctDigis);
244  for (CSCWireDigiCollection::DigiRangeIterator j=wireDigis.begin(); j!=wireDigis.end(); ++j)
245  {
246  CSCDetId cscDetId=(*j).first;
247  bool me1abCheck = formatVersion_ == 2013;
248  if (packEverything_ || cscd2r::accept(cscDetId, alctDigis, alctWindowMin_, alctWindowMax_, me1abCheck))
249  {
250  CSCEventData & cscData = findEventData(cscDetId);
251  std::vector<CSCWireDigi>::const_iterator digiItr = (*j).second.first;
252  std::vector<CSCWireDigi>::const_iterator last = (*j).second.second;
253  for ( ; digiItr != last; ++digiItr)
254  {
255  cscData.add(*digiItr, cscDetId.layer() );
256  }
257  }
258  }
259 
260 }
261 
262 void CSCDigiToRaw::add(const CSCComparatorDigiCollection & comparatorDigis,
263  const CSCCLCTDigiCollection & clctDigis)
264 {
265  add(clctDigis);
266  for (CSCComparatorDigiCollection::DigiRangeIterator j=comparatorDigis.begin(); j!=comparatorDigis.end(); ++j)
267  {
268  CSCDetId cscDetId=(*j).first;
269  CSCEventData & cscData = findEventData(cscDetId);
270  bool me1abCheck = formatVersion_ == 2013;
271  if (packEverything_ || cscd2r::accept(cscDetId, clctDigis, clctWindowMin_, clctWindowMax_, me1abCheck))
272  {
273  bool me1a = (cscDetId.station()==1) && (cscDetId.ring()==4);
274 
275 
276  BOOST_FOREACH(CSCComparatorDigi digi, (*j).second)
277  {
278  if (formatVersion_ == 2013)
279  {
280  // Move ME1/A comparators from CFEB=0 to CFEB=4 if this has not
281  // been done already.
282  if (me1a && digi.getStrip() <= 48)
283  {
284  CSCComparatorDigi digi_corr(64+digi.getStrip(),
285  digi.getComparator(),
286  digi.getTimeBinWord());
287  cscData.add(digi_corr, cscDetId); // This version does ME11 strips swapping
288  // cscData.add(digi_corr, cscDetId.layer()); // This one doesn't
289  }
290  else
291  {
292  cscData.add(digi, cscDetId); // This version does ME11 strips swapping
293  // cscData.add(digi, cscDetId.layer()); // This one doesn't
294  }
295  }
296  else
297  {
298  // Move ME1/A comparators from CFEB=0 to CFEB=4 if this has not
299  // been done already.
300  if (me1a && digi.getStrip() <= 16)
301  {
302  CSCComparatorDigi digi_corr(64+digi.getStrip(),
303  digi.getComparator(),
304  digi.getTimeBinWord());
305  cscData.add(digi_corr, cscDetId.layer());
306  }
307  else
308  {
309  cscData.add(digi, cscDetId.layer());
310  }
311  }
312  }
313  }
314  }
315 }
316 
318 {
319  for (CSCALCTDigiCollection::DigiRangeIterator j=alctDigis.begin(); j!=alctDigis.end(); ++j)
320  {
321  CSCDetId cscDetId=(*j).first;
322  CSCEventData & cscData = findEventData(cscDetId);
323 
324  cscData.add(std::vector<CSCALCTDigi>((*j).second.first, (*j).second.second));
325  }
326 }
327 
329 {
330  for (CSCCLCTDigiCollection::DigiRangeIterator j=clctDigis.begin(); j!=clctDigis.end(); ++j)
331  {
332  CSCDetId cscDetId=(*j).first;
333  CSCEventData & cscData = findEventData(cscDetId);
334 
335  bool me11a = cscDetId.station() == 1 && cscDetId.ring() == 4;
336  //CLCTs are packed by chamber not by A/B parts in ME11
337  //me11a appears only in simulation with SLHC algorithm settings
338  //without the shift, it's impossible to distinguish A and B parts
339  if (me11a && formatVersion_ == 2013){
340  std::vector<CSCCLCTDigi> shiftedDigis((*j).second.first, (*j).second.second);
341  for (std::vector<CSCCLCTDigi>::iterator iC = shiftedDigis.begin(); iC != shiftedDigis.end(); ++iC) {
342  if (iC->getCFEB() >= 0 && iC->getCFEB() < 3){//sanity check, mostly
343  (*iC) = CSCCLCTDigi(iC->isValid(), iC->getQuality(), iC->getPattern(), iC->getStripType(),
344  iC->getBend(), iC->getStrip(), iC->getCFEB()+4, iC->getBX(),
345  iC->getTrknmb(), iC->getFullBX());
346  }
347  }
348  cscData.add(shiftedDigis);
349  } else {
350  cscData.add(std::vector<CSCCLCTDigi>((*j).second.first, (*j).second.second));
351  }
352  }
353 }
354 
356 {
357  for (CSCCorrelatedLCTDigiCollection::DigiRangeIterator j=corrLCTDigis.begin(); j!=corrLCTDigis.end(); ++j)
358  {
359  CSCDetId cscDetId=(*j).first;
360  CSCEventData & cscData = findEventData(cscDetId);
361 
362  bool me11a = cscDetId.station() == 1 && cscDetId.ring() == 4;
363  //LCTs are packed by chamber not by A/B parts in ME11
364  //me11a appears only in simulation with SLHC algorithm settings
365  //without the shift, it's impossible to distinguish A and B parts
366  if (me11a && formatVersion_ == 2013){
367  std::vector<CSCCorrelatedLCTDigi> shiftedDigis((*j).second.first, (*j).second.second);
368  for (std::vector<CSCCorrelatedLCTDigi>::iterator iC = shiftedDigis.begin(); iC != shiftedDigis.end(); ++iC) {
369  if (iC->getStrip() >= 0 && iC->getStrip() < 96){//sanity check, mostly
370  (*iC) = CSCCorrelatedLCTDigi(iC->getTrknmb(), iC->isValid(), iC->getQuality(),
371  iC->getKeyWG(), iC->getStrip() + 128, iC->getPattern(),
372  iC->getBend(), iC->getBX(), iC->getMPCLink(),
373  iC->getBX0(), iC->getSyncErr(), iC->getCSCID());
374  }
375  }
376  cscData.add(shiftedDigis);
377  } else {
378  cscData.add(std::vector<CSCCorrelatedLCTDigi>((*j).second.first, (*j).second.second));
379  }
380  }
381 
382 }
383 
384 
386  const CSCWireDigiCollection& wireDigis,
387  const CSCComparatorDigiCollection& comparatorDigis,
388  const CSCALCTDigiCollection& alctDigis,
389  const CSCCLCTDigiCollection& clctDigis,
390  const CSCCLCTPreTriggerCollection & preTriggers,
391  const CSCCorrelatedLCTDigiCollection& correlatedLCTDigis,
392  FEDRawDataCollection& fed_buffers,
393  const CSCChamberMap* mapping,
394  Event & e, uint16_t format_version, bool use_pre_triggers,
395  bool packEverything)
396 {
397 
398  formatVersion_ = format_version;
399  usePreTriggers_ = use_pre_triggers;
400  packEverything_ = packEverything;
401  //bits of code from ORCA/Muon/METBFormatter - thanks, Rick:)!
402 
403  //get fed object from fed_buffers
404  // make a map from the index of a chamber to the event data from it
405  beginEvent(mapping);
406  add(stripDigis, preTriggers);
407  add(wireDigis, alctDigis);
408  add(comparatorDigis, clctDigis);
409  add(correlatedLCTDigis);
410 
411  int l1a=e.id().event(); //need to add increments or get it from lct digis
412  int bx = l1a;//same as above
413  //int startingFED = FEDNumbering::MINCSCFEDID;
414 
415  if (formatVersion_ == 2005)
416  {
417  std::map<int, CSCDCCEventData> dccMap;
418  for (int idcc=FEDNumbering::MINCSCFEDID;
419  idcc<=FEDNumbering::MAXCSCFEDID; ++idcc)
420  {
421  //idcc goes from startingFed to startingFED+7
422  // @@ if ReadoutMapping changes, this'll have to change
423  // DCCs 1,2,4,5 have 5 DDUs. Otherwise, 4
424  //int nDDUs = (idcc < 2) || (idcc ==4) || (idcc ==5)
425  // ? 5 : 4;
426  //@@ WARNING some DCCs only have 4 DDUs, but I'm giving them all 5, for now
427  int nDDUs = 5;
428  dccMap.insert(std::pair<int, CSCDCCEventData>(idcc, CSCDCCEventData(idcc, nDDUs, bx, l1a) ) );
429  }
430 
431  for (int idcc=FEDNumbering::MINCSCFEDID;
432  idcc<=FEDNumbering::MAXCSCFEDID; ++idcc)
433  {
434 
435  // for every chamber with data, add to a DDU in this DCC Event
436  for (map<CSCDetId, CSCEventData>::iterator chamberItr = theChamberDataMap.begin();
437  chamberItr != theChamberDataMap.end(); ++chamberItr)
438  {
439  int indexDCC = mapping->slink(chamberItr->first);
440  if (indexDCC == idcc)
441  {
442  //FIXME (What does this mean? Is something wrong?)
443  std::map<int, CSCDCCEventData>::iterator dccMapItr = dccMap.find(indexDCC);
444  if (dccMapItr == dccMap.end())
445  {
446  throw cms::Exception("CSCDigiToRaw") << "Bad DCC number:" << indexDCC;
447  }
448  // get id's based on ChamberId from mapping
449 
450  int dduId = mapping->ddu(chamberItr->first);
451  int dduSlot = mapping->dduSlot(chamberItr->first);
452  int dduInput = mapping->dduInput(chamberItr->first);
453  int dmbId = mapping->dmb(chamberItr->first);
454  dccMapItr->second.addChamber(chamberItr->second, dduId, dduSlot, dduInput, dmbId, formatVersion_);
455  }
456  }
457  }
458 
459  // FIXME: FEDRawData size set to 2*64 to add FED header and trailer
460  for (std::map<int, CSCDCCEventData>::iterator dccMapItr = dccMap.begin();
461  dccMapItr != dccMap.end(); ++dccMapItr)
462  {
463  boost::dynamic_bitset<> dccBits = dccMapItr->second.pack();
464  FEDRawData & fedRawData = fed_buffers.FEDData(dccMapItr->first);
465  fedRawData.resize(dccBits.size());
466  //fill data with dccEvent
467  bitset_utilities::bitsetToChar(dccBits, fedRawData.data());
468  FEDTrailer cscFEDTrailer(fedRawData.data()+(fedRawData.size()-8));
469  cscFEDTrailer.set(fedRawData.data()+(fedRawData.size()-8),
470  fedRawData.size()/8,
471  evf::compute_crc(fedRawData.data(),fedRawData.size()), 0, 0);
472  }
473 
474  }
475  else if (formatVersion_ == 2013)
476  {
477 
478  std::map<int, CSCDDUEventData> dduMap;
479  unsigned int ddu_fmt_version = 0x7;
480  const unsigned postLS1_map [] = { 841, 842, 843, 844, 845, 846, 847, 848, 849,
481  831, 832, 833, 834, 835, 836, 837, 838, 839,
482  861, 862, 863, 864, 865, 866, 867, 868, 869,
483  851, 852, 853, 854, 855, 856, 857, 858, 859 };
484 
485 
487  for (unsigned int i = 0; i < 36; i++)
488  {
489  unsigned int iddu = postLS1_map[i];
490  // make a new one
491  CSCDDUHeader newDDUHeader(bx,l1a, iddu, ddu_fmt_version);
492 
493  dduMap.insert(std::pair<int, CSCDDUEventData>(iddu, CSCDDUEventData(newDDUHeader) ) );
494  }
495 
496 
498  for (unsigned int i = 0; i < 36; i++)
499  {
500  unsigned int iddu = postLS1_map[i];
501  // for every chamber with data, add to a DDU in this DCC Event
502  for (map<CSCDetId, CSCEventData>::iterator chamberItr = theChamberDataMap.begin();
503  chamberItr != theChamberDataMap.end(); ++chamberItr)
504  {
505  unsigned int indexDDU = mapping->slink(chamberItr->first);
506 
508  if ( (indexDDU >= FEDNumbering::MINCSCFEDID) && (indexDDU <= FEDNumbering::MAXCSCFEDID) ) // Still preLS1 DCC FEDs mapping
509  {
510 
511  int dduID = mapping->ddu(chamberItr->first); // try to switch to DDU ID mapping
512  if ((dduID >= FEDNumbering::MINCSCDDUFEDID) && (dduID <= FEDNumbering::MAXCSCDDUFEDID) ) // DDU ID is in expectedi post-LS1 FED ID range
513  {
514  indexDDU = dduID;
515  }
516  else // Messy
517  {
518  // Lets try to change pre-LS1 1-36 ID range to post-LS1 MINCSCDDUFEDID - MAXCSCDDUFEDID range
519  dduID &= 0xFF;
520  if ((dduID <= 36) && (dduID > 0)) indexDDU = postLS1_map[dduID -1]; // indexDDU = FEDNumbering::MINCSCDDUFEDID + dduID-1;
521  }
522 
523  }
524 
525  if (indexDDU == iddu)
526  {
527  std::map<int, CSCDDUEventData>::iterator dduMapItr = dduMap.find(indexDDU);
528  if (dduMapItr == dduMap.end())
529  {
530  throw cms::Exception("CSCDigiToRaw") << "Bad DDU number:" << indexDDU;
531  }
532  // get id's based on ChamberId from mapping
533 
534  int dduInput = mapping->dduInput(chamberItr->first);
535  int dmbId = mapping->dmb(chamberItr->first);
536  // int crateId = mapping->crate(chamberItr->first);
537  dduMapItr->second.add( chamberItr->second, dmbId, dduInput, formatVersion_ );
538  }
539  }
540  }
541 
542  // FIXME: FEDRawData size set to 2*64 to add FED header and trailer
543  for (std::map<int, CSCDDUEventData>::iterator dduMapItr = dduMap.begin();
544  dduMapItr != dduMap.end(); ++dduMapItr)
545  {
546  boost::dynamic_bitset<> dduBits = dduMapItr->second.pack();
547  FEDRawData & fedRawData = fed_buffers.FEDData(dduMapItr->first);
548  fedRawData.resize(dduBits.size()/8);
549  //fill data with dduEvent
550  bitset_utilities::bitsetToChar(dduBits, fedRawData.data());
551  FEDTrailer cscFEDTrailer(fedRawData.data()+(fedRawData.size()-8));
552  cscFEDTrailer.set(fedRawData.data()+(fedRawData.size()-8),
553  fedRawData.size()/8,
554  evf::compute_crc(fedRawData.data(),fedRawData.size()), 0, 0);
555 
556  }
557  }
558 }
559 
560 
01/20/05 A.Tumanov
int chamber() const
Definition: CSCDetId.h:68
EventNumber_t event() const
Definition: EventID.h:41
void add(const CSCStripDigiCollection &stripDigis, const CSCCLCTPreTriggerCollection &preTriggers)
int getStrip() const
Get the strip number. Counts from 1.
bool accept(const CSCDetId &cscId, const CSCCLCTPreTriggerCollection &lcts, int bxMin, int bxMax, bool me1abCheck)
Definition: CSCDigiToRaw.cc:84
uint16_t formatVersion_
Definition: CSCDigiToRaw.h:68
bool usePreTriggers_
Definition: CSCDigiToRaw.h:69
bool packEverything_
Definition: CSCDigiToRaw.h:70
int ddu(const CSCDetId &) const
ddu id for given DetId
int clctWindowMin_
Definition: CSCDigiToRaw.h:64
int dmb(const CSCDetId &) const
dmb id for given DetId
void setdmbVersion(unsigned int version)
Definition: CSCDMBHeader.h:42
int getComparator() const
Get Comparator readings. Can be 0 or 1.
int layer() const
Definition: CSCDetId.h:61
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
int getStrip() const
Definition: CSCStripDigi.h:51
int endcap() const
Definition: CSCDetId.h:93
int alctWindowMax_
Definition: CSCDigiToRaw.h:63
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
PixelRecoRange< float > Range
void setStrip(int istrip)
Definition: CSCStripDigi.h:75
const CSCChamberMap * theElectronicsMap
Definition: CSCDigiToRaw.h:61
void resize(size_t newsize)
Definition: FEDRawData.cc:32
int slink(const CSCDetId &) const
slink id for given DetId
unsigned short compute_crc(unsigned char *buffer, unsigned int bufSize)
Definition: CRC16.h:67
int alctWindowMin_
Definition: CSCDigiToRaw.h:62
int dduInput(const CSCDetId &) const
ddu input for given DetId
CSCDetId chamberId() const
Definition: CSCDetId.h:53
CSCDetId chamberID(const CSCDetId &cscDetId)
takes layer ID, converts to chamber ID, switching ME1A to ME11
Definition: CSCDigiToRaw.cc:31
CSCDigiToRaw(const edm::ParameterSet &pset)
Constructor.
int getTimeBinWord() const
Return the word with each bit corresponding to a time bin.
int clctWindowMax_
Definition: CSCDigiToRaw.h:65
void beginEvent(const CSCChamberMap *electronicsMap)
void setCrateAddress(int crate, int dmbId)
Definition: CSCDMBHeader.h:40
bool accept(const CSCDetId &cscId, const LCTCollection &lcts, int bxMin, int bxMax, bool me1abCheck=false)
Definition: CSCDigiToRaw.cc:42
int preTriggerWindowMin_
Definition: CSCDigiToRaw.h:66
unsigned short iChamberType()
Definition: CSCDetId.h:107
int preTriggerWindowMax_
Definition: CSCDigiToRaw.h:67
int ring() const
Definition: CSCDetId.h:75
std::map< CSCDetId, CSCEventData > theChamberDataMap
Definition: CSCDigiToRaw.h:60
void bitsetToChar(const boost::dynamic_bitset<> &bs, unsigned char *result)
this method takes bitset obj and returns char * array
int crate(const CSCDetId &) const
Interface required use in digi-to-raw.
std::vector< CSCCLCTPreTrigger >::const_iterator const_iterator
int dduSlot(const CSCDetId &) const
ddu slot for given DetId
CSCEventData & findEventData(const CSCDetId &cscDetId)
pick out the correct data object for this chamber
void add(const CSCStripDigi &, int layer)
routines to add digis to the data
edm::EventID id() const
Definition: EventBase.h:60
HLT enums.
EcalElectronicsMapping const * electronicsMap(0)
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
int station() const
Definition: CSCDetId.h:86
std::pair< const_iterator, const_iterator > Range
void createFedBuffers(const CSCStripDigiCollection &stripDigis, const CSCWireDigiCollection &wireDigis, const CSCComparatorDigiCollection &comparatorDigis, const CSCALCTDigiCollection &alctDigis, const CSCCLCTDigiCollection &clctDigis, const CSCCLCTPreTriggerCollection &preTriggers, const CSCCorrelatedLCTDigiCollection &correlatedLCTDigis, FEDRawDataCollection &fed_buffers, const CSCChamberMap *theMapping, edm::Event &e, uint16_t theFormatVersion=2005, bool usePreTriggers=true, bool packEverything=false)
Take a vector of digis and fill the FEDRawDataCollection.
const CSCDMBHeader * dmbHeader() const
the DAQ motherboard header. A good place for event and chamber info
Definition: CSCEventData.h:96