CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
CSCDigiToRaw Class Reference

#include <CSCDigiToRaw.h>

Classes

struct  FindEventDataInfo
 

Public Member Functions

void createFedBuffers (const CSCStripDigiCollection &stripDigis, const CSCWireDigiCollection &wireDigis, const CSCComparatorDigiCollection &comparatorDigis, const CSCALCTDigiCollection &alctDigis, const CSCCLCTDigiCollection &clctDigis, const CSCCLCTPreTriggerCollection *preTriggers, const CSCCLCTPreTriggerDigiCollection *preTriggerDigis, const CSCCorrelatedLCTDigiCollection &correlatedLCTDigis, const CSCShowerDigiCollection *showerDigis, const GEMPadDigiClusterCollection *padDigiClusters, FEDRawDataCollection &fed_buffers, const CSCChamberMap *theMapping, const edm::EventID &eid) const
 Take a vector of digis and fill the FEDRawDataCollection. More...
 
 CSCDigiToRaw (const edm::ParameterSet &pset)
 Constructor. More...
 

Private Member Functions

void add (const CSCALCTDigiCollection &alctDigis, FindEventDataInfo &) const
 
void add (const CSCCLCTDigiCollection &clctDigis, FindEventDataInfo &) const
 
void add (const CSCComparatorDigiCollection &comparatorDigis, const CSCCLCTDigiCollection &clctDigis, FindEventDataInfo &) const
 
void add (const CSCCorrelatedLCTDigiCollection &corrLCTDigis, FindEventDataInfo &) const
 
void add (const CSCShowerDigiCollection &cscShowerDigis, FindEventDataInfo &) const
 
void add (const CSCStripDigiCollection &stripDigis, const CSCCLCTPreTriggerCollection *preTriggers, const CSCCLCTPreTriggerDigiCollection *preTriggerDigis, FindEventDataInfo &) const
 
void add (const CSCWireDigiCollection &wireDigis, const CSCALCTDigiCollection &alctDigis, FindEventDataInfo &) const
 
void add (const GEMPadDigiClusterCollection &gemPadClusters, FindEventDataInfo &) const
 
CSCEventDatafindEventData (const CSCDetId &cscDetId, FindEventDataInfo &) const
 pick out the correct data object for this chamber More...
 

Private Attributes

const int alctWindowMax_
 
const int alctWindowMin_
 
const int clctWindowMax_
 
const int clctWindowMin_
 
uint16_t formatVersion_
 
bool packEverything_
 
const int preTriggerWindowMax_
 
const int preTriggerWindowMin_
 
bool usePreTriggers_
 

Detailed Description

Author
A. Tumanov - Rice

Definition at line 26 of file CSCDigiToRaw.h.

Constructor & Destructor Documentation

◆ CSCDigiToRaw()

CSCDigiToRaw::CSCDigiToRaw ( const edm::ParameterSet pset)
explicit

Constructor.

Definition at line 109 of file CSCDigiToRaw.cc.

110  : alctWindowMin_(pset.getParameter<int>("alctWindowMin")),
111  alctWindowMax_(pset.getParameter<int>("alctWindowMax")),
112  clctWindowMin_(pset.getParameter<int>("clctWindowMin")),
113  clctWindowMax_(pset.getParameter<int>("clctWindowMax")),
114  preTriggerWindowMin_(pset.getParameter<int>("preTriggerWindowMin")),
115  preTriggerWindowMax_(pset.getParameter<int>("preTriggerWindowMax")),
116  // pre-LS1 - '2005'. post-LS1 - '2013'
117  formatVersion_(pset.getParameter<unsigned>("formatVersion")),
118  // don't check for consistency with trig primitives
119  // overrides usePreTriggers
120  packEverything_(pset.getParameter<bool>("packEverything")),
121  usePreTriggers_(pset.getParameter<bool>("usePreTriggers")) {}

Member Function Documentation

◆ add() [1/8]

void CSCDigiToRaw::add ( const CSCALCTDigiCollection alctDigis,
FindEventDataInfo fedInfo 
) const
private

Definition at line 277 of file CSCDigiToRaw.cc.

277  {
278  for (CSCALCTDigiCollection::DigiRangeIterator j = alctDigis.begin(); j != alctDigis.end(); ++j) {
279  CSCDetId cscDetId = (*j).first;
280  CSCEventData& cscData = findEventData(cscDetId, fedInfo);
281 
282  cscData.add(std::vector<CSCALCTDigi>((*j).second.first, (*j).second.second));
283  }
284 }

References CSCEventData::add(), findEventData(), and dqmiolumiharvest::j.

Referenced by counter.Counter::register(), SequenceTypes.Task::remove(), and SequenceTypes.Task::replace().

◆ add() [2/8]

void CSCDigiToRaw::add ( const CSCCLCTDigiCollection clctDigis,
FindEventDataInfo fedInfo 
) const
private

Definition at line 286 of file CSCDigiToRaw.cc.

286  {
287  for (CSCCLCTDigiCollection::DigiRangeIterator j = clctDigis.begin(); j != clctDigis.end(); ++j) {
288  CSCDetId cscDetId = (*j).first;
289  CSCEventData& cscData = findEventData(cscDetId, fedInfo);
290 
291  bool me11a = cscDetId.station() == 1 && cscDetId.ring() == 4;
292  //CLCTs are packed by chamber not by A/B parts in ME11
293  //me11a appears only in simulation with SLHC algorithm settings
294  //without the shift, it's impossible to distinguish A and B parts
295  if (me11a && fedInfo.formatVersion_ == 2013) {
296  std::vector<CSCCLCTDigi> shiftedDigis((*j).second.first, (*j).second.second);
297  for (std::vector<CSCCLCTDigi>::iterator iC = shiftedDigis.begin(); iC != shiftedDigis.end(); ++iC) {
298  if (iC->getCFEB() < CSCConstants::NUM_CFEBS_ME1A_UNGANGED) { //sanity check, mostly
299  (*iC) = CSCCLCTDigi(iC->isValid(),
300  iC->getQuality(),
301  iC->getPattern(),
302  iC->getStripType(),
303  iC->getBend(),
304  iC->getStrip(),
305  iC->getCFEB() + CSCConstants::NUM_CFEBS_ME1B,
306  iC->getBX(),
307  iC->getTrknmb(),
308  iC->getFullBX());
309  }
310  }
311  cscData.add(shiftedDigis);
312  } else {
313  cscData.add(std::vector<CSCCLCTDigi>((*j).second.first, (*j).second.second));
314  }
315  }
316 }

References CSCEventData::add(), findEventData(), CSCDigiToRaw::FindEventDataInfo::formatVersion_, dqmiolumiharvest::j, CSCConstants::NUM_CFEBS_ME1A_UNGANGED, CSCConstants::NUM_CFEBS_ME1B, CSCDetId::ring(), and CSCDetId::station().

Referenced by counter.Counter::register(), SequenceTypes.Task::remove(), and SequenceTypes.Task::replace().

◆ add() [3/8]

void CSCDigiToRaw::add ( const CSCComparatorDigiCollection comparatorDigis,
const CSCCLCTDigiCollection clctDigis,
FindEventDataInfo fedInfo 
) const
private

Definition at line 232 of file CSCDigiToRaw.cc.

234  {
235  add(clctDigis, fedInfo);
236  for (auto const& j : comparatorDigis) {
237  CSCDetId cscDetId = j.first;
238  CSCEventData& cscData = findEventData(cscDetId, fedInfo);
239  bool me1abCheck = fedInfo.formatVersion_ == 2013;
240  if (packEverything_ ||
242  cscDetId, clctDigis, clctWindowMin_, clctWindowMax_, CSCConstants::CLCT_CENTRAL_BX, me1abCheck)) {
243  bool me1a = (cscDetId.station() == 1) && (cscDetId.ring() == 4);
244 
245  /*
246  Add the comparator digi to the fedInfo.
247  Move ME1/A comparators from CFEB=0 to CFEB=4 if this has not
248  been done already.
249  Consider the case for triple-ganged and unganged ME1A strips
250  */
251  for (auto digi = j.second.first; digi != j.second.second; ++digi) {
252  if (fedInfo.formatVersion_ == 2013) {
253  // unganged case
254  if (me1a && digi->getStrip() <= CSCConstants::NUM_STRIPS_ME1A_UNGANGED) {
255  CSCComparatorDigi digi_corr(
256  CSCConstants::NUM_STRIPS_ME1B + digi->getStrip(), digi->getComparator(), digi->getTimeBinWord());
257  cscData.add(digi_corr, cscDetId);
258  } else {
259  cscData.add(*digi, cscDetId);
260  }
261  }
262  // triple-ganged case
263  else {
264  if (me1a && digi->getStrip() <= CSCConstants::NUM_STRIPS_ME1A_GANGED) {
265  CSCComparatorDigi digi_corr(
266  CSCConstants::NUM_STRIPS_ME1B + digi->getStrip(), digi->getComparator(), digi->getTimeBinWord());
267  cscData.add(digi_corr, cscDetId.layer());
268  } else {
269  cscData.add(*digi, cscDetId.layer());
270  }
271  }
272  }
273  }
274  }
275 }

References cscd2r::accept(), add(), CSCEventData::add(), CSCConstants::CLCT_CENTRAL_BX, clctWindowMax_, clctWindowMin_, findEventData(), CSCDigiToRaw::FindEventDataInfo::formatVersion_, dqmiolumiharvest::j, CSCDetId::layer(), CSCConstants::NUM_STRIPS_ME1A_GANGED, CSCConstants::NUM_STRIPS_ME1A_UNGANGED, CSCConstants::NUM_STRIPS_ME1B, packEverything_, CSCDetId::ring(), and CSCDetId::station().

Referenced by counter.Counter::register(), SequenceTypes.Task::remove(), and SequenceTypes.Task::replace().

◆ add() [4/8]

void CSCDigiToRaw::add ( const CSCCorrelatedLCTDigiCollection corrLCTDigis,
FindEventDataInfo fedInfo 
) const
private

Definition at line 318 of file CSCDigiToRaw.cc.

318  {
319  for (CSCCorrelatedLCTDigiCollection::DigiRangeIterator j = corrLCTDigis.begin(); j != corrLCTDigis.end(); ++j) {
320  CSCDetId cscDetId = (*j).first;
321  CSCEventData& cscData = findEventData(cscDetId, fedInfo);
322 
323  bool me11a = cscDetId.station() == 1 && cscDetId.ring() == 4;
324  //LCTs are packed by chamber not by A/B parts in ME11
325  //me11a appears only in simulation with SLHC algorithm settings
326  //without the shift, it's impossible to distinguish A and B parts
327  if (me11a && fedInfo.formatVersion_ == 2013) {
328  std::vector<CSCCorrelatedLCTDigi> shiftedDigis((*j).second.first, (*j).second.second);
329  for (std::vector<CSCCorrelatedLCTDigi>::iterator iC = shiftedDigis.begin(); iC != shiftedDigis.end(); ++iC) {
330  if (iC->getStrip() < CSCConstants::NUM_HALF_STRIPS_ME1A_UNGANGED) { //sanity check, mostly
331  (*iC) = CSCCorrelatedLCTDigi(iC->getTrknmb(),
332  iC->isValid(),
333  iC->getQuality(),
334  iC->getKeyWG(),
335  iC->getStrip() + CSCConstants::NUM_HALF_STRIPS_ME1B,
336  iC->getPattern(),
337  iC->getBend(),
338  iC->getBX(),
339  iC->getMPCLink(),
340  iC->getBX0(),
341  iC->getSyncErr(),
342  iC->getCSCID());
343  }
344  }
345  cscData.add(shiftedDigis);
346  } else {
347  cscData.add(std::vector<CSCCorrelatedLCTDigi>((*j).second.first, (*j).second.second));
348  }
349  }
350 }

References CSCEventData::add(), findEventData(), CSCDigiToRaw::FindEventDataInfo::formatVersion_, dqmiolumiharvest::j, CSCConstants::NUM_HALF_STRIPS_ME1A_UNGANGED, CSCConstants::NUM_HALF_STRIPS_ME1B, CSCDetId::ring(), and CSCDetId::station().

Referenced by counter.Counter::register(), SequenceTypes.Task::remove(), and SequenceTypes.Task::replace().

◆ add() [5/8]

void CSCDigiToRaw::add ( const CSCShowerDigiCollection cscShowerDigis,
FindEventDataInfo fedInfo 
) const
private

Definition at line 352 of file CSCDigiToRaw.cc.

352  {
353  for (const auto& shower : cscShowerDigis) {
354  const CSCDetId& cscDetId = shower.first;
355  CSCEventData& cscData = findEventData(cscDetId, fedInfo);
356 
357  cscData.add(std::vector<CSCShowerDigi>(shower.second.first, shower.second.second));
358  }
359 }

References CSCEventData::add(), and findEventData().

Referenced by counter.Counter::register(), SequenceTypes.Task::remove(), and SequenceTypes.Task::replace().

◆ add() [6/8]

void CSCDigiToRaw::add ( const CSCStripDigiCollection stripDigis,
const CSCCLCTPreTriggerCollection preTriggers,
const CSCCLCTPreTriggerDigiCollection preTriggerDigis,
FindEventDataInfo fedInfo 
) const
private

Definition at line 150 of file CSCDigiToRaw.cc.

153  {
154  //iterate over chambers with strip digis in them
155  for (CSCStripDigiCollection::DigiRangeIterator j = stripDigis.begin(); j != stripDigis.end(); ++j) {
156  CSCDetId cscDetId = (*j).first;
157  // only digitize if there are pre-triggers
158 
159  bool me1abCheck = fedInfo.formatVersion_ == 2013;
160  // pretrigger flag must be set and the pretrigger collection must be nonzero!
161  const bool usePreTriggers = usePreTriggers_ and preTriggers != nullptr;
162  if (!usePreTriggers || packEverything_ ||
163  (usePreTriggers && cscd2r::accept(cscDetId,
164  *preTriggerDigis,
168  me1abCheck))) {
169  bool me1a = (cscDetId.station() == 1) && (cscDetId.ring() == 4);
170  bool zplus = (cscDetId.endcap() == 1);
171  bool me1b = (cscDetId.station() == 1) && (cscDetId.ring() == 1);
172 
173  CSCEventData& cscData = findEventData(cscDetId, fedInfo);
174 
175  std::vector<CSCStripDigi>::const_iterator digiItr = (*j).second.first;
176  std::vector<CSCStripDigi>::const_iterator last = (*j).second.second;
177  for (; digiItr != last; ++digiItr) {
178  CSCStripDigi digi = *digiItr;
179  int strip = digi.getStrip();
180  // From LS1 on ME1a strips are unganged
181  if (fedInfo.formatVersion_ == 2013) {
182  if (me1a && zplus) {
183  digi.setStrip(CSCConstants::NUM_STRIPS_ME1A_UNGANGED + 1 - strip); // 1-48 -> 48-1
184  }
185  if (me1b && !zplus) {
186  digi.setStrip(CSCConstants::NUM_STRIPS_ME1B + 1 - strip); // 1-64 -> 64-1
187  }
188  if (me1a) {
189  strip = digi.getStrip(); // reset back 1-16 to 65-80 digi
191  }
192  }
193  // During Run-1 ME1a strips are triple-ganged
194  else {
195  if (me1a && zplus) {
196  digi.setStrip(CSCConstants::NUM_STRIPS_ME1A_GANGED + 1 - strip); // 1-16 -> 16-1
197  }
198  if (me1b && !zplus) {
199  digi.setStrip(CSCConstants::NUM_STRIPS_ME1B + 1 - strip); // 1-64 -> 64-1
200  }
201  if (me1a) {
202  strip = digi.getStrip(); // reset back 1-16 to 65-80 digi
204  }
205  }
206  cscData.add(digi, cscDetId.layer());
207  }
208  }
209  }
210 }

References cscd2r::accept(), CSCEventData::add(), CSCConstants::CLCT_CENTRAL_BX, CSCDetId::endcap(), findEventData(), CSCDigiToRaw::FindEventDataInfo::formatVersion_, CSCStripDigi::getStrip(), dqmiolumiharvest::j, dqmdumpme::last, CSCDetId::layer(), CSCConstants::NUM_STRIPS_ME1A_GANGED, CSCConstants::NUM_STRIPS_ME1A_UNGANGED, CSCConstants::NUM_STRIPS_ME1B, packEverything_, preTriggerWindowMax_, preTriggerWindowMin_, CSCDetId::ring(), CSCStripDigi::setStrip(), CSCDetId::station(), digitizers_cfi::strip, usePreTriggers_, and SurfaceOrientation::zplus.

Referenced by add(), createFedBuffers(), counter.Counter::register(), SequenceTypes.Task::remove(), and SequenceTypes.Task::replace().

◆ add() [7/8]

void CSCDigiToRaw::add ( const CSCWireDigiCollection wireDigis,
const CSCALCTDigiCollection alctDigis,
FindEventDataInfo fedInfo 
) const
private

Definition at line 212 of file CSCDigiToRaw.cc.

214  {
215  add(alctDigis, fedInfo);
216  for (CSCWireDigiCollection::DigiRangeIterator j = wireDigis.begin(); j != wireDigis.end(); ++j) {
217  CSCDetId cscDetId = (*j).first;
218  bool me1abCheck = fedInfo.formatVersion_ == 2013;
219  if (packEverything_ ||
221  cscDetId, alctDigis, alctWindowMin_, alctWindowMax_, CSCConstants::ALCT_CENTRAL_BX, me1abCheck)) {
222  CSCEventData& cscData = findEventData(cscDetId, fedInfo);
223  std::vector<CSCWireDigi>::const_iterator digiItr = (*j).second.first;
224  std::vector<CSCWireDigi>::const_iterator last = (*j).second.second;
225  for (; digiItr != last; ++digiItr) {
226  cscData.add(*digiItr, cscDetId.layer());
227  }
228  }
229  }
230 }

References cscd2r::accept(), add(), CSCEventData::add(), CSCConstants::ALCT_CENTRAL_BX, alctWindowMax_, alctWindowMin_, findEventData(), CSCDigiToRaw::FindEventDataInfo::formatVersion_, dqmiolumiharvest::j, dqmdumpme::last, CSCDetId::layer(), and packEverything_.

Referenced by counter.Counter::register(), SequenceTypes.Task::remove(), and SequenceTypes.Task::replace().

◆ add() [8/8]

void CSCDigiToRaw::add ( const GEMPadDigiClusterCollection gemPadClusters,
FindEventDataInfo fedInfo 
) const
private

Definition at line 361 of file CSCDigiToRaw.cc.

361  {
362  for (const auto& jclus : gemPadClusters) {
363  const GEMDetId& gemDetId = jclus.first;
364 
365  const int zendcap = gemDetId.region() == 1 ? 1 : 2;
366  CSCDetId cscDetId(zendcap, gemDetId.station(), 1, gemDetId.chamber(), 0);
367  CSCEventData& cscData = findEventData(cscDetId, fedInfo);
368 
369  cscData.add(std::vector<GEMPadDigiCluster>(jclus.second.first, jclus.second.second), gemDetId);
370  }
371 }

References GEMDetId::chamber(), findEventData(), GEMDetId::region(), and GEMDetId::station().

Referenced by counter.Counter::register(), SequenceTypes.Task::remove(), and SequenceTypes.Task::replace().

◆ createFedBuffers()

void CSCDigiToRaw::createFedBuffers ( const CSCStripDigiCollection stripDigis,
const CSCWireDigiCollection wireDigis,
const CSCComparatorDigiCollection comparatorDigis,
const CSCALCTDigiCollection alctDigis,
const CSCCLCTDigiCollection clctDigis,
const CSCCLCTPreTriggerCollection preTriggers,
const CSCCLCTPreTriggerDigiCollection preTriggerDigis,
const CSCCorrelatedLCTDigiCollection correlatedLCTDigis,
const CSCShowerDigiCollection showerDigis,
const GEMPadDigiClusterCollection padDigiClusters,
FEDRawDataCollection fed_buffers,
const CSCChamberMap theMapping,
const edm::EventID eid 
) const

Take a vector of digis and fill the FEDRawDataCollection.

Handle pre-LS1 format data

Handle post-LS1 format data

2013 Format

Create dummy DDU buffers

Loop over post-LS1 DDU FEDs

Lets handle possible mapping issues

Definition at line 373 of file CSCDigiToRaw.cc.

385  {
386  //get fed object from fed_buffers
387  // make a map from the index of a chamber to the event data from it
388  FindEventDataInfo fedInfo{mapping, formatVersion_};
389  add(stripDigis, preTriggers, preTriggerDigis, fedInfo);
390  add(wireDigis, alctDigis, fedInfo);
391  add(comparatorDigis, clctDigis, fedInfo);
392  add(correlatedLCTDigis, fedInfo);
393 
394  // Starting Run-3, the CSC DAQ will pack/unpack CSC showers
395  if (cscShowerDigis) {
396  add(*cscShowerDigis, fedInfo);
397  }
398 
399  // Starting Run-3, the CSC DAQ will pack/unpack GEM clusters
400  if (gemPadDigiClusters) {
401  add(*gemPadDigiClusters, fedInfo);
402  }
403  int l1a = eid.event(); //need to add increments or get it from lct digis
404  int bx = l1a; //same as above
405 
406  if (fedInfo.formatVersion_ == 2005)
407  {
408  std::map<int, CSCDCCEventData> dccMap;
409  //idcc goes from startingFed to startingFED+7
410  for (int idcc = FEDNumbering::MINCSCFEDID; idcc <= FEDNumbering::MAXCSCFEDID; ++idcc) {
411  dccMap.insert(std::pair<int, CSCDCCEventData>(idcc, CSCDCCEventData(idcc, CSCConstants::NUM_DDUS, bx, l1a)));
412  }
413 
414  for (int idcc = FEDNumbering::MINCSCFEDID; idcc <= FEDNumbering::MAXCSCFEDID; ++idcc) {
415  // for every chamber with data, add to a DDU in this DCC Event
416  for (map<CSCDetId, CSCEventData>::iterator chamberItr = fedInfo.theChamberDataMap.begin();
417  chamberItr != fedInfo.theChamberDataMap.end();
418  ++chamberItr) {
419  int indexDCC = mapping->slink(chamberItr->first);
420  if (indexDCC == idcc) {
421  //FIXME (What does this mean? Is something wrong?)
422  std::map<int, CSCDCCEventData>::iterator dccMapItr = dccMap.find(indexDCC);
423  if (dccMapItr == dccMap.end()) {
424  throw cms::Exception("CSCDigiToRaw") << "Bad DCC number:" << indexDCC;
425  }
426  // get id's based on ChamberId from mapping
427 
428  int dduId = mapping->ddu(chamberItr->first);
429  int dduSlot = mapping->dduSlot(chamberItr->first);
430  int dduInput = mapping->dduInput(chamberItr->first);
431  int dmbId = mapping->dmb(chamberItr->first);
432  dccMapItr->second.addChamber(chamberItr->second, dduId, dduSlot, dduInput, dmbId, formatVersion_);
433  }
434  }
435  }
436 
437  // FIXME: FEDRawData size set to 2*64 to add FED header and trailer
438  for (std::map<int, CSCDCCEventData>::iterator dccMapItr = dccMap.begin(); dccMapItr != dccMap.end(); ++dccMapItr) {
439  boost::dynamic_bitset<> dccBits = dccMapItr->second.pack();
440  FEDRawData& fedRawData = fed_buffers.FEDData(dccMapItr->first);
441  fedRawData.resize(dccBits.size());
442  //fill data with dccEvent
444  FEDTrailer cscFEDTrailer(fedRawData.data() + (fedRawData.size() - 8));
445  cscFEDTrailer.set(fedRawData.data() + (fedRawData.size() - 8),
446  fedRawData.size() / 8,
447  evf::compute_crc(fedRawData.data(), fedRawData.size()),
448  0,
449  0);
450  }
451  }
453  else if (formatVersion_ == 2013) {
454  std::map<int, CSCDDUEventData> dduMap;
455  unsigned int ddu_fmt_version = 0x7;
456  const unsigned postLS1_map[] = {841, 842, 843, 844, 845, 846, 847, 848, 849, 831, 832, 833,
457  834, 835, 836, 837, 838, 839, 861, 862, 863, 864, 865, 866,
458  867, 868, 869, 851, 852, 853, 854, 855, 856, 857, 858, 859};
459 
461  for (unsigned int i = 0; i < 36; i++) {
462  unsigned int iddu = postLS1_map[i];
463  // make a new one
464  CSCDDUHeader newDDUHeader(bx, l1a, iddu, ddu_fmt_version);
465 
466  dduMap.insert(std::pair<int, CSCDDUEventData>(iddu, CSCDDUEventData(newDDUHeader)));
467  }
468 
470  for (unsigned int i = 0; i < 36; i++) {
471  unsigned int iddu = postLS1_map[i];
472  // for every chamber with data, add to a DDU in this DCC Event
473  for (map<CSCDetId, CSCEventData>::iterator chamberItr = fedInfo.theChamberDataMap.begin();
474  chamberItr != fedInfo.theChamberDataMap.end();
475  ++chamberItr) {
476  unsigned int indexDDU = mapping->slink(chamberItr->first);
477 
479  // Still preLS1 DCC FEDs mapping
480  if ((indexDDU >= FEDNumbering::MINCSCFEDID) && (indexDDU <= FEDNumbering::MAXCSCFEDID)) {
481  int dduID = mapping->ddu(chamberItr->first); // try to switch to DDU ID mapping
482  // DDU ID is in expectedi post-LS1 FED ID range
483  if ((dduID >= FEDNumbering::MINCSCDDUFEDID) && (dduID <= FEDNumbering::MAXCSCDDUFEDID)) {
484  indexDDU = dduID;
485  } else // Messy
486  {
487  // Lets try to change pre-LS1 1-36 ID range to post-LS1 MINCSCDDUFEDID - MAXCSCDDUFEDID range
488  dduID &= 0xFF;
489  // indexDDU = FEDNumbering::MINCSCDDUFEDID + dduID-1;
490  if ((dduID <= 36) && (dduID > 0))
491  indexDDU = postLS1_map[dduID - 1];
492  }
493  }
494 
495  if (indexDDU == iddu) {
496  std::map<int, CSCDDUEventData>::iterator dduMapItr = dduMap.find(indexDDU);
497  if (dduMapItr == dduMap.end()) {
498  throw cms::Exception("CSCDigiToRaw") << "Bad DDU number:" << indexDDU;
499  }
500  // get id's based on ChamberId from mapping
501 
502  int dduInput = mapping->dduInput(chamberItr->first);
503  int dmbId = mapping->dmb(chamberItr->first);
504  // int crateId = mapping->crate(chamberItr->first);
505  dduMapItr->second.add(chamberItr->second, dmbId, dduInput, formatVersion_);
506  }
507  }
508  }
509 
510  // FIXME: FEDRawData size set to 2*64 to add FED header and trailer
511  for (std::map<int, CSCDDUEventData>::iterator dduMapItr = dduMap.begin(); dduMapItr != dduMap.end(); ++dduMapItr) {
512  boost::dynamic_bitset<> dduBits = dduMapItr->second.pack();
513  FEDRawData& fedRawData = fed_buffers.FEDData(dduMapItr->first);
514  fedRawData.resize(dduBits.size() / 8);
515  //fill data with dduEvent
517  FEDTrailer cscFEDTrailer(fedRawData.data() + (fedRawData.size() - 8));
518  cscFEDTrailer.set(fedRawData.data() + (fedRawData.size() - 8),
519  fedRawData.size() / 8,
520  evf::compute_crc(fedRawData.data(), fedRawData.size()),
521  0,
522  0);
523  }
524  }
525 }

References add(), bitset_utilities::bitsetToChar(), l1GtPatternGenerator_cfi::bx, evf::compute_crc(), runTauDisplay::eid, Exception, FEDRawDataCollection::FEDData(), l1t_dqm_sourceclient-live_cfg::fedRawData, formatVersion_, mps_fire::i, taus_updatedMVAIds_cff::mapping, FEDNumbering::MAXCSCDDUFEDID, FEDNumbering::MAXCSCFEDID, FEDNumbering::MINCSCDDUFEDID, FEDNumbering::MINCSCFEDID, and CSCConstants::NUM_DDUS.

◆ findEventData()

CSCEventData & CSCDigiToRaw::findEventData ( const CSCDetId cscDetId,
FindEventDataInfo info 
) const
private

pick out the correct data object for this chamber

Definition at line 123 of file CSCDigiToRaw.cc.

123  {
124  CSCDetId chamberId = cscd2r::chamberID(cscDetId);
125  // find the entry into the map
126  map<CSCDetId, CSCEventData>::iterator chamberMapItr = info.theChamberDataMap.find(chamberId);
127  if (chamberMapItr == info.theChamberDataMap.end()) {
128  // make an entry, telling it the correct chamberType
129  int chamberType = chamberId.iChamberType();
130  chamberMapItr = info.theChamberDataMap
131  .insert(pair<CSCDetId, CSCEventData>(chamberId, CSCEventData(chamberType, info.formatVersion_)))
132  .first;
133  }
134  CSCEventData& cscData = chamberMapItr->second;
135  cscData.dmbHeader()->setCrateAddress(info.theElectronicsMap->crate(cscDetId), info.theElectronicsMap->dmb(cscDetId));
136 
137  if (info.formatVersion_ == 2013) {
138  // Set DMB version field to distinguish between ME11s and other chambers (ME11 - 2, others - 1)
139  bool me11 = ((chamberId.station() == 1) && (chamberId.ring() == 4)) ||
140  ((chamberId.station() == 1) && (chamberId.ring() == 1));
141  if (me11) {
142  cscData.dmbHeader()->setdmbVersion(2);
143  } else {
144  cscData.dmbHeader()->setdmbVersion(1);
145  }
146  }
147  return cscData;
148 }

References cscd2r::chamberID(), CSCEventData::dmbHeader(), CSCDetId::iChamberType(), info(), CSCDetId::ring(), CSCDMBHeader::setCrateAddress(), CSCDMBHeader::setdmbVersion(), and CSCDetId::station().

Referenced by add().

Member Data Documentation

◆ alctWindowMax_

const int CSCDigiToRaw::alctWindowMax_
private

Definition at line 75 of file CSCDigiToRaw.h.

Referenced by add().

◆ alctWindowMin_

const int CSCDigiToRaw::alctWindowMin_
private

Definition at line 74 of file CSCDigiToRaw.h.

Referenced by add().

◆ clctWindowMax_

const int CSCDigiToRaw::clctWindowMax_
private

Definition at line 77 of file CSCDigiToRaw.h.

Referenced by add().

◆ clctWindowMin_

const int CSCDigiToRaw::clctWindowMin_
private

Definition at line 76 of file CSCDigiToRaw.h.

Referenced by add().

◆ formatVersion_

uint16_t CSCDigiToRaw::formatVersion_
private

Definition at line 81 of file CSCDigiToRaw.h.

Referenced by createFedBuffers().

◆ packEverything_

bool CSCDigiToRaw::packEverything_
private

Definition at line 82 of file CSCDigiToRaw.h.

Referenced by add().

◆ preTriggerWindowMax_

const int CSCDigiToRaw::preTriggerWindowMax_
private

Definition at line 79 of file CSCDigiToRaw.h.

Referenced by add().

◆ preTriggerWindowMin_

const int CSCDigiToRaw::preTriggerWindowMin_
private

Definition at line 78 of file CSCDigiToRaw.h.

Referenced by add().

◆ usePreTriggers_

bool CSCDigiToRaw::usePreTriggers_
private

Definition at line 83 of file CSCDigiToRaw.h.

Referenced by add().

CSCDigiToRaw::preTriggerWindowMax_
const int preTriggerWindowMax_
Definition: CSCDigiToRaw.h:79
CSCDMBHeader::setdmbVersion
void setdmbVersion(unsigned int version)
Definition: CSCDMBHeader.h:32
FEDNumbering::MINCSCFEDID
Definition: FEDNumbering.h:51
mps_fire.i
i
Definition: mps_fire.py:428
CSCEventData
Definition: CSCEventData.h:26
CSCDDUHeader
Definition: CSCDDUHeader.h:11
GEMDetId::region
constexpr int region() const
Definition: GEMDetId.h:171
CSCDetId::ring
int ring() const
Definition: CSCDetId.h:68
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
CSCDCCEventData
01/20/05 A.Tumanov
Definition: CSCDCCEventData.h:13
FEDNumbering::MAXCSCDDUFEDID
Definition: FEDNumbering.h:90
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
CSCStripDigi::getStrip
int getStrip() const
Definition: CSCStripDigi.h:41
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:153
CSCEventData::dmbHeader
const CSCDMBHeader * dmbHeader() const
the DAQ motherboard header. A good place for event and chamber info
Definition: CSCEventData.h:73
CSCDigiToRaw::preTriggerWindowMin_
const int preTriggerWindowMin_
Definition: CSCDigiToRaw.h:78
CSCDetId::iChamberType
unsigned short iChamberType() const
Definition: CSCDetId.h:96
CSCCLCTDigi
Definition: CSCCLCTDigi.h:17
FEDRawData
Definition: FEDRawData.h:19
CSCConstants::NUM_HALF_STRIPS_ME1A_UNGANGED
Definition: CSCConstants.h:81
bitset_utilities::bitsetToChar
void bitsetToChar(const boost::dynamic_bitset<> &bs, unsigned char *result)
this method takes bitset obj and returns char * array
Definition: bitset_append.cc:32
CSCDigiToRaw::usePreTriggers_
bool usePreTriggers_
Definition: CSCDigiToRaw.h:83
dqmdumpme.last
last
Definition: dqmdumpme.py:56
l1t_dqm_sourceclient-live_cfg.fedRawData
fedRawData
Definition: l1t_dqm_sourceclient-live_cfg.py:188
CSCConstants::NUM_DDUS
Definition: CSCConstants.h:12
CSCDetId::layer
int layer() const
Definition: CSCDetId.h:56
CSCDMBHeader::setCrateAddress
void setCrateAddress(int crate, int dmbId)
Definition: CSCDMBHeader.h:30
CSCComparatorDigi
Definition: CSCComparatorDigi.h:16
CSCDigiToRaw::alctWindowMax_
const int alctWindowMax_
Definition: CSCDigiToRaw.h:75
CSCConstants::NUM_CFEBS_ME1B
Definition: CSCConstants.h:20
FEDRawDataCollection::FEDData
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
Definition: FEDRawDataCollection.cc:19
evf::compute_crc
unsigned short compute_crc(unsigned char *buffer, unsigned int bufSize)
Definition: CRC16.h:46
GEMDetId::chamber
constexpr int chamber() const
Definition: GEMDetId.h:183
CSCConstants::NUM_HALF_STRIPS_ME1B
Definition: CSCConstants.h:82
CSCConstants::NUM_STRIPS_ME1A_UNGANGED
Definition: CSCConstants.h:77
FEDTrailer
Definition: FEDTrailer.h:14
GEMDetId
Definition: GEMDetId.h:18
CSCDetId
Definition: CSCDetId.h:26
cscd2r::accept
bool accept(const CSCDetId &cscId, const LCTCollection &lcts, int bxMin, int bxMax, int nominalBX, bool me1abCheck=false)
Definition: CSCDigiToRaw.cc:39
FEDNumbering::MINCSCDDUFEDID
Definition: FEDNumbering.h:89
CSCEventData::add
void add(const CSCStripDigi &, int layer)
routines to add digis to the data
Definition: CSCEventData.cc:461
runTauDisplay.eid
eid
Definition: runTauDisplay.py:298
CSCConstants::NUM_CFEBS_ME1A_UNGANGED
Definition: CSCConstants.h:19
CSCDigiToRaw::formatVersion_
uint16_t formatVersion_
Definition: CSCDigiToRaw.h:81
CSCDigiToRaw::add
void add(const CSCStripDigiCollection &stripDigis, const CSCCLCTPreTriggerCollection *preTriggers, const CSCCLCTPreTriggerDigiCollection *preTriggerDigis, FindEventDataInfo &) const
Definition: CSCDigiToRaw.cc:150
CSCDigiToRaw::findEventData
CSCEventData & findEventData(const CSCDetId &cscDetId, FindEventDataInfo &) const
pick out the correct data object for this chamber
Definition: CSCDigiToRaw.cc:123
CSCConstants::ALCT_CENTRAL_BX
Definition: CSCConstants.h:155
CSCStripDigi
Definition: CSCStripDigi.h:17
CSCDDUEventData
Definition: CSCDDUEventData.h:19
CSCDigiToRaw::alctWindowMin_
const int alctWindowMin_
Definition: CSCDigiToRaw.h:74
CSCDetId::endcap
int endcap() const
Definition: CSCDetId.h:85
FEDNumbering::MAXCSCFEDID
Definition: FEDNumbering.h:52
Exception
Definition: hltDiff.cc:245
SurfaceOrientation::zplus
Definition: Surface.h:19
CSCConstants::NUM_STRIPS_ME1A_GANGED
Definition: CSCConstants.h:76
CSCConstants::CLCT_CENTRAL_BX
Definition: CSCConstants.h:162
CSCConstants::NUM_STRIPS_ME1B
Definition: CSCConstants.h:78
GEMDetId::station
constexpr int station() const
Definition: GEMDetId.h:179
CSCDetId::station
int station() const
Definition: CSCDetId.h:79
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
cscd2r::chamberID
CSCDetId chamberID(const CSCDetId &cscDetId)
takes layer ID, converts to chamber ID, switching ME1A to ME11
Definition: CSCDigiToRaw.cc:30
CSCStripDigi::setStrip
void setStrip(int istrip)
Definition: CSCStripDigi.h:65
DigiContainerIterator
Definition: MuonDigiCollection.h:30
taus_updatedMVAIds_cff.mapping
mapping
Definition: taus_updatedMVAIds_cff.py:29
CSCDigiToRaw::clctWindowMin_
const int clctWindowMin_
Definition: CSCDigiToRaw.h:76
CSCDigiToRaw::packEverything_
bool packEverything_
Definition: CSCDigiToRaw.h:82
CSCCorrelatedLCTDigi
Definition: CSCCorrelatedLCTDigi.h:19
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
CSCDigiToRaw::clctWindowMax_
const int clctWindowMax_
Definition: CSCDigiToRaw.h:77