13 #include "boost/dynamic_bitset.hpp"
31 if (chamberId.
ring() == 4) {
37 template <
typename LCTCollection>
45 for (
typename LCTCollection::const_iterator lctItr = lctRange.first; lctItr != lctRange.second; ++lctItr) {
46 int bx = lctItr->getBX() - nominalBX;
56 if (
me1 &&
result ==
false && me1abCheck) {
58 lctRange = lcts.get(me1aId);
59 for (
typename LCTCollection::const_iterator lctItr = lctRange.first; lctItr != lctRange.second; ++lctItr) {
60 int bx = lctItr->getBX() - nominalBX;
81 int bx = *lctItr - nominalBX;
87 bool me1a = cscId.
station() == 1 && cscId.
ring() == 4;
88 if (me1a &&
result ==
false && me1abCheck) {
90 lctRange = lcts.get(cscId);
92 int bx = *lctItr - nominalBX;
105 : alctWindowMin_(
pset.getParameter<
int>(
"alctWindowMin")),
106 alctWindowMax_(
pset.getParameter<
int>(
"alctWindowMax")),
107 clctWindowMin_(
pset.getParameter<
int>(
"clctWindowMin")),
108 clctWindowMax_(
pset.getParameter<
int>(
"clctWindowMax")),
109 preTriggerWindowMin_(
pset.getParameter<
int>(
"preTriggerWindowMin")),
110 preTriggerWindowMax_(
pset.getParameter<
int>(
"preTriggerWindowMax")) {}
115 map<CSCDetId, CSCEventData>::iterator chamberMapItr =
info.theChamberDataMap.find(chamberId);
116 if (chamberMapItr ==
info.theChamberDataMap.end()) {
119 chamberMapItr =
info.theChamberDataMap
120 .insert(pair<CSCDetId, CSCEventData>(chamberId,
CSCEventData(chamberType,
info.formatVersion_)))
126 if (
info.formatVersion_ == 2013) {
128 bool me11 = ((chamberId.
station() == 1) && (chamberId.
ring() == 4)) ||
129 ((chamberId.
station() == 1) && (chamberId.
ring() == 1));
153 bool me1a = (cscDetId.
station() == 1) && (cscDetId.
ring() == 4);
155 bool me1b = (cscDetId.
station() == 1) && (cscDetId.
ring() == 1);
159 std::vector<CSCStripDigi>::const_iterator digiItr = (*j).second.first;
160 std::vector<CSCStripDigi>::const_iterator
last = (*j).second.second;
161 for (; digiItr !=
last; ++digiItr) {
168 if (me1b && !
zplus) {
180 if (me1b && !
zplus) {
188 cscData.
add(digi, cscDetId.
layer());
198 add(alctDigis, fedInfo);
204 std::vector<CSCWireDigi>::const_iterator digiItr = (*j).second.first;
205 std::vector<CSCWireDigi>::const_iterator
last = (*j).second.second;
206 for (; digiItr !=
last; ++digiItr) {
207 cscData.
add(*digiItr, cscDetId.
layer());
217 add(clctDigis, fedInfo);
218 for (
auto const&
j : comparatorDigis) {
223 bool me1a = (cscDetId.
station() == 1) && (cscDetId.
ring() == 4);
225 for (
auto digi =
j.second.first; digi !=
j.second.second; ++digi) {
229 if (me1a && digi->getStrip() <= 48) {
230 CSCComparatorDigi digi_corr(64 + digi->getStrip(), digi->getComparator(), digi->getTimeBinWord());
231 cscData.
add(digi_corr, cscDetId);
234 cscData.
add(*digi, cscDetId);
240 if (me1a && digi->getStrip() <= 16) {
241 CSCComparatorDigi digi_corr(64 + digi->getStrip(), digi->getComparator(), digi->getTimeBinWord());
242 cscData.
add(digi_corr, cscDetId.
layer());
244 cscData.
add(*digi, cscDetId.
layer());
257 cscData.
add(std::vector<CSCALCTDigi>((*j).second.first, (*j).second.second));
266 bool me11a = cscDetId.
station() == 1 && cscDetId.
ring() == 4;
271 std::vector<CSCCLCTDigi> shiftedDigis((*j).second.first, (*j).second.second);
272 for (std::vector<CSCCLCTDigi>::iterator iC = shiftedDigis.begin(); iC != shiftedDigis.end(); ++iC) {
273 if (iC->getCFEB() < 3) {
286 cscData.
add(shiftedDigis);
288 cscData.
add(std::vector<CSCCLCTDigi>((*j).second.first, (*j).second.second));
298 bool me11a = cscDetId.
station() == 1 && cscDetId.
ring() == 4;
303 std::vector<CSCCorrelatedLCTDigi> shiftedDigis((*j).second.first, (*j).second.second);
304 for (std::vector<CSCCorrelatedLCTDigi>::iterator iC = shiftedDigis.begin(); iC != shiftedDigis.end(); ++iC) {
305 if (iC->getStrip() < 96) {
310 iC->getStrip() + 128,
320 cscData.
add(shiftedDigis);
322 cscData.
add(std::vector<CSCCorrelatedLCTDigi>((*j).second.first, (*j).second.second));
337 uint16_t format_version,
338 bool use_pre_triggers,
348 add(correlatedLCTDigis, fedInfo);
350 int l1a =
e.id().event();
354 if (fedInfo.formatVersion_ == 2005)
356 std::map<int, CSCDCCEventData> dccMap;
365 dccMap.insert(std::pair<int, CSCDCCEventData>(idcc,
CSCDCCEventData(idcc, nDDUs,
bx, l1a)));
370 for (map<CSCDetId, CSCEventData>::iterator chamberItr = fedInfo.theChamberDataMap.begin();
371 chamberItr != fedInfo.theChamberDataMap.end();
373 int indexDCC =
mapping->slink(chamberItr->first);
374 if (indexDCC == idcc) {
376 std::map<int, CSCDCCEventData>::iterator dccMapItr = dccMap.find(indexDCC);
377 if (dccMapItr == dccMap.end()) {
378 throw cms::Exception(
"CSCDigiToRaw") <<
"Bad DCC number:" << indexDCC;
382 int dduId =
mapping->ddu(chamberItr->first);
383 int dduSlot =
mapping->dduSlot(chamberItr->first);
384 int dduInput =
mapping->dduInput(chamberItr->first);
385 int dmbId =
mapping->dmb(chamberItr->first);
386 dccMapItr->second.addChamber(chamberItr->second, dduId, dduSlot, dduInput, dmbId, format_version);
392 for (std::map<int, CSCDCCEventData>::iterator dccMapItr = dccMap.begin(); dccMapItr != dccMap.end(); ++dccMapItr) {
393 boost::dynamic_bitset<> dccBits = dccMapItr->second.pack();
406 }
else if (format_version == 2013)
408 std::map<int, CSCDDUEventData> dduMap;
409 unsigned int ddu_fmt_version = 0x7;
410 const unsigned postLS1_map[] = {841, 842, 843, 844, 845, 846, 847, 848, 849, 831, 832, 833,
411 834, 835, 836, 837, 838, 839, 861, 862, 863, 864, 865, 866,
412 867, 868, 869, 851, 852, 853, 854, 855, 856, 857, 858, 859};
415 for (
unsigned int i = 0;
i < 36;
i++) {
416 unsigned int iddu = postLS1_map[
i];
420 dduMap.insert(std::pair<int, CSCDDUEventData>(iddu,
CSCDDUEventData(newDDUHeader)));
424 for (
unsigned int i = 0;
i < 36;
i++) {
425 unsigned int iddu = postLS1_map[
i];
427 for (map<CSCDetId, CSCEventData>::iterator chamberItr = fedInfo.theChamberDataMap.begin();
428 chamberItr != fedInfo.theChamberDataMap.end();
430 unsigned int indexDDU =
mapping->slink(chamberItr->first);
435 int dduID =
mapping->ddu(chamberItr->first);
444 if ((dduID <= 36) && (dduID > 0))
445 indexDDU = postLS1_map[dduID - 1];
449 if (indexDDU == iddu) {
450 std::map<int, CSCDDUEventData>::iterator dduMapItr = dduMap.find(indexDDU);
451 if (dduMapItr == dduMap.end()) {
452 throw cms::Exception(
"CSCDigiToRaw") <<
"Bad DDU number:" << indexDDU;
456 int dduInput =
mapping->dduInput(chamberItr->first);
457 int dmbId =
mapping->dmb(chamberItr->first);
459 dduMapItr->second.add(chamberItr->second, dmbId, dduInput, format_version);
465 for (std::map<int, CSCDDUEventData>::iterator dduMapItr = dduMap.begin(); dduMapItr != dduMap.end(); ++dduMapItr) {
466 boost::dynamic_bitset<> dduBits = dduMapItr->second.pack();