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));
328 for (
const auto& jclus : gemPadClusters) {
329 const GEMDetId& gemDetId = jclus.first;
331 const int zendcap = gemDetId.
region() == 1 ? 1 : 2;
335 cscData.add(std::vector<GEMPadDigiCluster>(jclus.second.first, jclus.second.second), gemDetId);
350 uint16_t format_version,
360 add(correlatedLCTDigis, fedInfo);
362 if (gemPadDigiClusters) {
363 add(*gemPadDigiClusters, fedInfo);
365 int l1a =
eid.event();
369 if (fedInfo.formatVersion_ == 2005)
371 std::map<int, CSCDCCEventData> dccMap;
380 dccMap.insert(std::pair<int, CSCDCCEventData>(idcc,
CSCDCCEventData(idcc, nDDUs,
bx, l1a)));
385 for (map<CSCDetId, CSCEventData>::iterator chamberItr = fedInfo.theChamberDataMap.begin();
386 chamberItr != fedInfo.theChamberDataMap.end();
388 int indexDCC =
mapping->slink(chamberItr->first);
389 if (indexDCC == idcc) {
391 std::map<int, CSCDCCEventData>::iterator dccMapItr = dccMap.find(indexDCC);
392 if (dccMapItr == dccMap.end()) {
393 throw cms::Exception(
"CSCDigiToRaw") <<
"Bad DCC number:" << indexDCC;
397 int dduId =
mapping->ddu(chamberItr->first);
398 int dduSlot =
mapping->dduSlot(chamberItr->first);
399 int dduInput =
mapping->dduInput(chamberItr->first);
400 int dmbId =
mapping->dmb(chamberItr->first);
401 dccMapItr->second.addChamber(chamberItr->second, dduId, dduSlot, dduInput, dmbId, format_version);
407 for (std::map<int, CSCDCCEventData>::iterator dccMapItr = dccMap.begin(); dccMapItr != dccMap.end(); ++dccMapItr) {
408 boost::dynamic_bitset<> dccBits = dccMapItr->second.pack();
421 }
else if (format_version == 2013)
423 std::map<int, CSCDDUEventData> dduMap;
424 unsigned int ddu_fmt_version = 0x7;
425 const unsigned postLS1_map[] = {841, 842, 843, 844, 845, 846, 847, 848, 849, 831, 832, 833,
426 834, 835, 836, 837, 838, 839, 861, 862, 863, 864, 865, 866,
427 867, 868, 869, 851, 852, 853, 854, 855, 856, 857, 858, 859};
430 for (
unsigned int i = 0;
i < 36;
i++) {
431 unsigned int iddu = postLS1_map[
i];
435 dduMap.insert(std::pair<int, CSCDDUEventData>(iddu,
CSCDDUEventData(newDDUHeader)));
439 for (
unsigned int i = 0;
i < 36;
i++) {
440 unsigned int iddu = postLS1_map[
i];
442 for (map<CSCDetId, CSCEventData>::iterator chamberItr = fedInfo.theChamberDataMap.begin();
443 chamberItr != fedInfo.theChamberDataMap.end();
445 unsigned int indexDDU =
mapping->slink(chamberItr->first);
450 int dduID =
mapping->ddu(chamberItr->first);
459 if ((dduID <= 36) && (dduID > 0))
460 indexDDU = postLS1_map[dduID - 1];
464 if (indexDDU == iddu) {
465 std::map<int, CSCDDUEventData>::iterator dduMapItr = dduMap.find(indexDDU);
466 if (dduMapItr == dduMap.end()) {
467 throw cms::Exception(
"CSCDigiToRaw") <<
"Bad DDU number:" << indexDDU;
471 int dduInput =
mapping->dduInput(chamberItr->first);
472 int dmbId =
mapping->dmb(chamberItr->first);
474 dduMapItr->second.add(chamberItr->second, dmbId, dduInput, format_version);
480 for (std::map<int, CSCDDUEventData>::iterator dduMapItr = dduMap.begin(); dduMapItr != dduMap.end(); ++dduMapItr) {
481 boost::dynamic_bitset<> dduBits = dduMapItr->second.pack();