13 #include "boost/dynamic_bitset.hpp"
14 #include "boost/foreach.hpp"
32 if(chamberId.
ring() ==4)
39 template<
typename LCTCollection>
43 if(bxMin == -999)
return true;
48 for(
typename LCTCollection::const_iterator lctItr = lctRange.first;
49 lctItr != lctRange.second; ++lctItr)
51 int bx = lctItr->getBX() - nominalBX;
52 if(bx >= bxMin && bx <= bxMax)
66 if(bxMin == -999)
return true;
72 lctItr != lctRange.second; ++lctItr)
74 int bx = *lctItr - nominalBX;
75 if(bx >= bxMin && bx <= bxMax)
88 : alctWindowMin_(pset.getParameter<int>(
"alctWindowMin")),
89 alctWindowMax_(pset.getParameter<int>(
"alctWindowMax")),
90 clctWindowMin_(pset.getParameter<int>(
"clctWindowMin")),
91 clctWindowMax_(pset.getParameter<int>(
"clctWindowMax")),
92 preTriggerWindowMin_(pset.getParameter<int>(
"preTriggerWindowMin")),
93 preTriggerWindowMax_(pset.getParameter<int>(
"preTriggerWindowMax"))
107 map<CSCDetId, CSCEventData>::iterator chamberMapItr =
theChamberDataMap.find(chamberId);
130 bool me1a = (cscDetId.
station()==1) && (cscDetId.
ring()==4);
132 bool me1b = (cscDetId.
station()==1) && (cscDetId.
ring()==1);
136 std::vector<CSCStripDigi>::const_iterator digiItr = (*j).second.first;
137 std::vector<CSCStripDigi>::const_iterator
last = (*j).second.second;
138 for( ; digiItr !=
last; ++digiItr)
142 if ( me1a && zplus ) { digi.
setStrip(17-strip); }
143 if ( me1b && !zplus) { digi.
setStrip(65-strip);}
145 cscData.
add(digi, cscDetId.
layer() );
162 std::vector<CSCWireDigi>::const_iterator digiItr = (*j).second.first;
163 std::vector<CSCWireDigi>::const_iterator
last = (*j).second.second;
164 for( ; digiItr !=
last; ++digiItr)
166 cscData.
add(*digiItr, cscDetId.
layer() );
183 bool me1a = (cscDetId.
station()==1) && (cscDetId.
ring()==4);
189 if (me1a && digi.
getStrip() <= 16) {
193 cscData.
add(digi_corr, cscDetId.
layer());
196 cscData.
add(digi, cscDetId.
layer());
210 cscData.
add(std::vector<CSCALCTDigi>((*j).second.first, (*j).second.second));
221 cscData.
add(std::vector<CSCCLCTDigi>((*j).second.first, (*j).second.second));
232 cscData.
add(std::vector<CSCCorrelatedLCTDigi>((*j).second.first, (*j).second.second));
255 add(stripDigis, preTriggers);
256 add(wireDigis, alctDigis);
257 add(comparatorDigis, clctDigis);
258 add(correlatedLCTDigis);
264 std::map<int, CSCDCCEventData> dccMap;
275 dccMap.insert(std::pair<int, CSCDCCEventData>(idcc,
CSCDCCEventData(idcc, nDDUs, bx, l1a) ) );
278 for(map<CSCDetId, CSCEventData>::iterator chamberItr =
theChamberDataMap.begin();
282 int indexDCC = mapping->
slink(chamberItr->first);
286 std::map<int, CSCDCCEventData>::iterator dccMapItr = dccMap.find(indexDCC);
287 if(dccMapItr == dccMap.end())
289 throw cms::Exception(
"CSCDigiToRaw") <<
"Bad DCC number:" << indexDCC;
293 int dduId = mapping->
ddu(chamberItr->first);
294 int dduSlot = mapping->
dduSlot(chamberItr->first);
295 int dduInput = mapping->
dduInput(chamberItr->first);
296 int dmbId = mapping->
dmb(chamberItr->first);
297 dccMapItr->second.addChamber(chamberItr->second, dduId, dduSlot, dduInput, dmbId);
303 for(std::map<int, CSCDCCEventData>::iterator dccMapItr = dccMap.begin();
304 dccMapItr != dccMap.end(); ++dccMapItr)
306 boost::dynamic_bitset<> dccBits = dccMapItr->second.pack();
308 fedRawData.
resize(dccBits.size());
312 cscFEDTrailer.set(fedRawData.
data()+(fedRawData.
size()-8),
EventNumber_t event() const
void add(const CSCStripDigiCollection &stripDigis, const CSCCLCTPreTriggerCollection &preTriggers)
int getStrip() const
Get the strip number.
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)
Take a vector of digis and fill the FEDRawDataCollection.
int ddu(const CSCDetId &) const
ddu id for given DetId
int dmb(const CSCDetId &) const
dmb id for given DetId
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
int getComparator() const
Get Comparator readings.
size_t size() const
Lenght of the data buffer in bytes.
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
void setStrip(int istrip)
const CSCChamberMap * theElectronicsMap
void resize(size_t newsize)
int slink(const CSCDetId &) const
slink id for given DetId
unsigned short compute_crc(unsigned char *buffer, unsigned int bufSize)
int dduInput(const CSCDetId &) const
ddu input for given DetId
CSCDetId chamberId() const
CSCDetId chamberID(const CSCDetId &cscDetId)
takes layer ID, converts to chamber ID, switching ME1A to ME11
CSCDigiToRaw(const edm::ParameterSet &pset)
Constructor.
int getTimeBinWord() const
Return the word with each bit corresponding to a time bin.
void beginEvent(const CSCChamberMap *electronicsMap)
unsigned short iChamberType()
PixelRecoRange< float > Range
std::map< CSCDetId, CSCEventData > theChamberDataMap
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
EcalElectronicsMapping const * electronicsMap(0)
bool accept(const CSCDetId &cscId, const LCTCollection &lcts, int bxMin, int bxMax)
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
std::pair< const_iterator, const_iterator > Range
const CSCDMBHeader * dmbHeader() const
the DAQ motherboard header. A good place for event and chamber info