#include <CSCDigiToRaw.h>
CSCDigiToRaw::CSCDigiToRaw | ( | const edm::ParameterSet & | pset | ) | [explicit] |
Constructor.
Definition at line 89 of file CSCDigiToRaw.cc.
: alctWindowMin_(pset.getParameter<int>("alctWindowMin")), alctWindowMax_(pset.getParameter<int>("alctWindowMax")), clctWindowMin_(pset.getParameter<int>("clctWindowMin")), clctWindowMax_(pset.getParameter<int>("clctWindowMax")), preTriggerWindowMin_(pset.getParameter<int>("preTriggerWindowMin")), preTriggerWindowMax_(pset.getParameter<int>("preTriggerWindowMax")) {}
void CSCDigiToRaw::add | ( | const CSCStripDigiCollection & | stripDigis, |
const CSCCLCTPreTriggerCollection & | preTriggers | ||
) | [private] |
Definition at line 123 of file CSCDigiToRaw.cc.
References cscd2r::accept(), CSCEventData::add(), CSCDetId::endcap(), findEventData(), CSCStripDigi::getStrip(), j, prof2calltree::last, CSCDetId::layer(), preTriggerWindowMax_, preTriggerWindowMin_, CSCDetId::ring(), CSCStripDigi::setStrip(), CSCDetId::station(), strip(), and SurfaceOrientation::zplus.
Referenced by add(), and createFedBuffers().
{ //iterate over chambers with strip digis in them for (CSCStripDigiCollection::DigiRangeIterator j=stripDigis.begin(); j!=stripDigis.end(); ++j) { CSCDetId cscDetId=(*j).first; // only digitize if there are pre-triggers if(cscd2r::accept(cscDetId, preTriggers, preTriggerWindowMin_, preTriggerWindowMax_)) { bool me1a = (cscDetId.station()==1) && (cscDetId.ring()==4); bool zplus = (cscDetId.endcap() == 1); bool me1b = (cscDetId.station()==1) && (cscDetId.ring()==1); CSCEventData & cscData = findEventData(cscDetId); std::vector<CSCStripDigi>::const_iterator digiItr = (*j).second.first; std::vector<CSCStripDigi>::const_iterator last = (*j).second.second; for( ; digiItr != last; ++digiItr) { CSCStripDigi digi = *digiItr; int strip = digi.getStrip(); if ( me1a && zplus ) { digi.setStrip(17-strip); } // 1-16 -> 16-1 if ( me1b && !zplus) { digi.setStrip(65-strip);} // 1-64 -> 64-1 if ( me1a ) { strip = digi.getStrip(); digi.setStrip(strip+64);} // reset back 1-16 to 65-80 digi cscData.add(digi, cscDetId.layer() ); } } } }
void CSCDigiToRaw::add | ( | const CSCWireDigiCollection & | wireDigis, |
const CSCALCTDigiCollection & | alctDigis | ||
) | [private] |
Definition at line 154 of file CSCDigiToRaw.cc.
References cscd2r::accept(), CSCEventData::add(), add(), alctWindowMax_, alctWindowMin_, findEventData(), j, prof2calltree::last, and CSCDetId::layer().
{ add(alctDigis); for (CSCWireDigiCollection::DigiRangeIterator j=wireDigis.begin(); j!=wireDigis.end(); ++j) { CSCDetId cscDetId=(*j).first; if(cscd2r::accept(cscDetId, alctDigis, alctWindowMin_, alctWindowMax_)) { CSCEventData & cscData = findEventData(cscDetId); std::vector<CSCWireDigi>::const_iterator digiItr = (*j).second.first; std::vector<CSCWireDigi>::const_iterator last = (*j).second.second; for( ; digiItr != last; ++digiItr) { cscData.add(*digiItr, cscDetId.layer() ); } } } }
void CSCDigiToRaw::add | ( | const CSCCorrelatedLCTDigiCollection & | corrLCTDigis | ) | [private] |
Definition at line 227 of file CSCDigiToRaw.cc.
References CSCEventData::add(), findEventData(), and j.
{ for (CSCCorrelatedLCTDigiCollection::DigiRangeIterator j=corrLCTDigis.begin(); j!=corrLCTDigis.end(); ++j) { CSCDetId cscDetId=(*j).first; CSCEventData & cscData = findEventData(cscDetId); cscData.add(std::vector<CSCCorrelatedLCTDigi>((*j).second.first, (*j).second.second)); } }
void CSCDigiToRaw::add | ( | const CSCCLCTDigiCollection & | clctDigis | ) | [private] |
Definition at line 216 of file CSCDigiToRaw.cc.
References CSCEventData::add(), findEventData(), and j.
{ for (CSCCLCTDigiCollection::DigiRangeIterator j=clctDigis.begin(); j!=clctDigis.end(); ++j) { CSCDetId cscDetId=(*j).first; CSCEventData & cscData = findEventData(cscDetId); cscData.add(std::vector<CSCCLCTDigi>((*j).second.first, (*j).second.second)); } }
void CSCDigiToRaw::add | ( | const CSCComparatorDigiCollection & | comparatorDigis, |
const CSCCLCTDigiCollection & | clctDigis | ||
) | [private] |
Definition at line 175 of file CSCDigiToRaw.cc.
References cscd2r::accept(), CSCEventData::add(), add(), clctWindowMax_, clctWindowMin_, findEventData(), CSCComparatorDigi::getComparator(), CSCComparatorDigi::getStrip(), CSCComparatorDigi::getTimeBinWord(), j, CSCDetId::layer(), CSCDetId::ring(), and CSCDetId::station().
{ add(clctDigis); for (CSCComparatorDigiCollection::DigiRangeIterator j=comparatorDigis.begin(); j!=comparatorDigis.end(); ++j) { CSCDetId cscDetId=(*j).first; CSCEventData & cscData = findEventData(cscDetId); if(cscd2r::accept(cscDetId, clctDigis, clctWindowMin_, clctWindowMax_)) { bool me1a = (cscDetId.station()==1) && (cscDetId.ring()==4); BOOST_FOREACH(CSCComparatorDigi digi, (*j).second) { // Move ME1/A comparators from CFEB=0 to CFEB=4 if this has not // been done already. if (me1a && digi.getStrip() <= 16) { CSCComparatorDigi digi_corr(64+digi.getStrip(), digi.getComparator(), digi.getTimeBinWord()); cscData.add(digi_corr, cscDetId.layer()); } else { cscData.add(digi, cscDetId.layer()); } } } } }
void CSCDigiToRaw::add | ( | const CSCALCTDigiCollection & | alctDigis | ) | [private] |
Definition at line 205 of file CSCDigiToRaw.cc.
References CSCEventData::add(), findEventData(), and j.
{ for (CSCALCTDigiCollection::DigiRangeIterator j=alctDigis.begin(); j!=alctDigis.end(); ++j) { CSCDetId cscDetId=(*j).first; CSCEventData & cscData = findEventData(cscDetId); cscData.add(std::vector<CSCALCTDigi>((*j).second.first, (*j).second.second)); } }
void CSCDigiToRaw::beginEvent | ( | const CSCChamberMap * | electronicsMap | ) | [private] |
Definition at line 98 of file CSCDigiToRaw.cc.
References ecaldqm::electronicsMap, theChamberDataMap, and theElectronicsMap.
Referenced by createFedBuffers().
{ theChamberDataMap.clear(); theElectronicsMap = electronicsMap; }
void CSCDigiToRaw::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.
Definition at line 240 of file CSCDigiToRaw.cc.
References add(), beginEvent(), bitset_utilities::bitsetToChar(), evf::compute_crc(), FEDRawData::data(), CSCChamberMap::ddu(), CSCChamberMap::dduInput(), CSCChamberMap::dduSlot(), CSCChamberMap::dmb(), edm::EventID::event(), Exception, FEDRawDataCollection::FEDData(), edm::EventBase::id(), FEDNumbering::MAXCSCFEDID, FEDNumbering::MINCSCFEDID, FEDRawData::resize(), FEDRawData::size(), CSCChamberMap::slink(), and theChamberDataMap.
Referenced by CSCDigiToRawModule::produce().
{ //bits of code from ORCA/Muon/METBFormatter - thanks, Rick:)! //get fed object from fed_buffers // make a map from the index of a chamber to the event data from it beginEvent(mapping); add(stripDigis, preTriggers); add(wireDigis, alctDigis); add(comparatorDigis, clctDigis); add(correlatedLCTDigis); int l1a=e.id().event(); //need to add increments or get it from lct digis int bx = 0;//same as above //int startingFED = FEDNumbering::MINCSCFEDID; std::map<int, CSCDCCEventData> dccMap; for (int idcc=FEDNumbering::MINCSCFEDID; idcc<=FEDNumbering::MAXCSCFEDID;++idcc) { //idcc goes from startingFed to startingFED+7 // @@ if ReadoutMapping changes, this'll have to change // DCCs 1,2,4,5 have 5 DDUs. Otherwise, 4 //int nDDUs = (idcc < 2) || (idcc ==4) || (idcc ==5) // ? 5 : 4; //@@ WARNING some DCCs only have 4 DDUs, but I'm giving them all 5, for now int nDDUs = 5; dccMap.insert(std::pair<int, CSCDCCEventData>(idcc, CSCDCCEventData(idcc, nDDUs, bx, l1a) ) ); // for every chamber with data, add to a DDU in this DCC Event for(map<CSCDetId, CSCEventData>::iterator chamberItr = theChamberDataMap.begin(); chamberItr != theChamberDataMap.end(); ++chamberItr) { //std::cout<<"inside the pack loop" <<std::endl; int indexDCC = mapping->slink(chamberItr->first); if(indexDCC == idcc) { //FIXME (What does this mean? Is something wrong?) std::map<int, CSCDCCEventData>::iterator dccMapItr = dccMap.find(indexDCC); if(dccMapItr == dccMap.end()) { throw cms::Exception("CSCDigiToRaw") << "Bad DCC number:" << indexDCC; } // get id's based on ChamberId from mapping int dduId = mapping->ddu(chamberItr->first); int dduSlot = mapping->dduSlot(chamberItr->first); int dduInput = mapping->dduInput(chamberItr->first); int dmbId = mapping->dmb(chamberItr->first); dccMapItr->second.addChamber(chamberItr->second, dduId, dduSlot, dduInput, dmbId); } } } // FIXME: FEDRawData size set to 2*64 to add FED header and trailer for(std::map<int, CSCDCCEventData>::iterator dccMapItr = dccMap.begin(); dccMapItr != dccMap.end(); ++dccMapItr) { boost::dynamic_bitset<> dccBits = dccMapItr->second.pack(); FEDRawData & fedRawData = fed_buffers.FEDData(dccMapItr->first); fedRawData.resize(dccBits.size()); //fill data with dccEvent bitset_utilities::bitsetToChar(dccBits, fedRawData.data()); FEDTrailer cscFEDTrailer(fedRawData.data()+(fedRawData.size()-8)); cscFEDTrailer.set(fedRawData.data()+(fedRawData.size()-8), fedRawData.size()/8, evf::compute_crc(fedRawData.data(),fedRawData.size()), 0, 0); } }
CSCEventData & CSCDigiToRaw::findEventData | ( | const CSCDetId & | cscDetId | ) | [private] |
pick out the correct data object for this chamber
Definition at line 105 of file CSCDigiToRaw.cc.
References cscd2r::chamberID(), CSCChamberMap::crate(), CSCChamberMap::dmb(), CSCEventData::dmbHeader(), CSCDetId::iChamberType(), CSCDMBHeader::setCrateAddress(), theChamberDataMap, and theElectronicsMap.
Referenced by add().
{ CSCDetId chamberId = cscd2r::chamberID(cscDetId); // find the entry into the map map<CSCDetId, CSCEventData>::iterator chamberMapItr = theChamberDataMap.find(chamberId); if(chamberMapItr == theChamberDataMap.end()) { // make an entry, telling it the correct chamberType int chamberType = chamberId.iChamberType(); chamberMapItr = theChamberDataMap.insert(pair<CSCDetId, CSCEventData>(chamberId, CSCEventData(chamberType))).first; } CSCEventData & cscData = chamberMapItr->second; cscData.dmbHeader()->setCrateAddress(theElectronicsMap->crate(cscDetId), theElectronicsMap->dmb(cscDetId)); return cscData; }
int CSCDigiToRaw::alctWindowMax_ [private] |
Definition at line 62 of file CSCDigiToRaw.h.
Referenced by add().
int CSCDigiToRaw::alctWindowMin_ [private] |
Definition at line 61 of file CSCDigiToRaw.h.
Referenced by add().
int CSCDigiToRaw::clctWindowMax_ [private] |
Definition at line 64 of file CSCDigiToRaw.h.
Referenced by add().
int CSCDigiToRaw::clctWindowMin_ [private] |
Definition at line 63 of file CSCDigiToRaw.h.
Referenced by add().
int CSCDigiToRaw::preTriggerWindowMax_ [private] |
Definition at line 66 of file CSCDigiToRaw.h.
Referenced by add().
int CSCDigiToRaw::preTriggerWindowMin_ [private] |
Definition at line 65 of file CSCDigiToRaw.h.
Referenced by add().
std::map<CSCDetId, CSCEventData> CSCDigiToRaw::theChamberDataMap [private] |
Definition at line 59 of file CSCDigiToRaw.h.
Referenced by beginEvent(), createFedBuffers(), and findEventData().
const CSCChamberMap* CSCDigiToRaw::theElectronicsMap [private] |
Definition at line 60 of file CSCDigiToRaw.h.
Referenced by beginEvent(), and findEventData().