#include <EventFilter/DTRawToDigi/plugins/DTDigiToRaw.h>
Public Member Functions | |
FEDRawData * | createFedBuffers (const DTDigiCollection &digis, edm::ESHandle< DTReadOutMapping > &mapping) |
Take a vector of digis and fill the FEDRawDataCollection. | |
DTDigiToRaw (const edm::ParameterSet &ps) | |
Constructor. | |
void | SetdduID (int dduid) |
virtual | ~DTDigiToRaw () |
Destructor. | |
Private Types | |
typedef unsigned int | Word32 |
typedef long long | Word64 |
Private Attributes | |
int | dduID_ |
bool | debug |
const edm::ParameterSet | pset |
Definition at line 18 of file DTDigiToRaw.h.
typedef unsigned int DTDigiToRaw::Word32 [private] |
Definition at line 34 of file DTDigiToRaw.h.
typedef long long DTDigiToRaw::Word64 [private] |
Definition at line 35 of file DTDigiToRaw.h.
DTDigiToRaw::DTDigiToRaw | ( | const edm::ParameterSet & | ps | ) |
Constructor.
Definition at line 10 of file DTDigiToRaw.cc.
References GenMuonPlsPt100GeV_cfg::cout, debug, lat::endl(), edm::ParameterSet::getUntrackedParameter(), and pset.
00010 : pset(ps) 00011 { 00012 00013 debug = pset.getUntrackedParameter<bool>("debugMode", false); 00014 if (debug) cout << "[DTDigiToRaw]: constructor" << endl; 00015 }
DTDigiToRaw::~DTDigiToRaw | ( | ) | [virtual] |
Destructor.
Definition at line 18 of file DTDigiToRaw.cc.
References GenMuonPlsPt100GeV_cfg::cout, debug, and lat::endl().
FEDRawData * DTDigiToRaw::createFedBuffers | ( | const DTDigiCollection & | digis, | |
edm::ESHandle< DTReadOutMapping > & | mapping | |||
) |
Take a vector of digis and fill the FEDRawDataCollection.
Definition at line 23 of file DTDigiToRaw.cc.
References begin, DTSuperLayerId::chamberId(), GenMuonPlsPt100GeV_cfg::cout, FEDRawData::data(), dduID_, debug, end, lat::endl(), DTROSWordType::headerControlWord, i, DTLayerId::layer(), funct::pow(), DTROSWordType::rosTypeWord, DTChamberId::sector(), DTROBTrailerWord::set(), DTROBHeaderWord::set(), DTTDCMeasurementWord::set(), DTChamberId::station(), DTSuperLayerId::superlayer(), DTLayerId::superlayerId(), DTTDCMeasurementWord::tdcChannel(), DTTDCMeasurementWord::tdcID(), DTTDCMeasurementWord::tdcTime(), DTROSWordType::trailerControlWord, muonGeometry::wheel, DTChamberId::wheel(), WORDCONTROLSHIFT, and WORDTYPESHIFT.
Referenced by DTDigiToRawModule::produce().
00024 { 00025 00026 int NROS = 12; 00027 int NROB = 25; 00028 00029 vector<uint32_t> words; 00030 00031 uint32_t fakeROSHeaderWord = 00032 DTROSWordType::headerControlWord << WORDCONTROLSHIFT | 00033 DTROSWordType::rosTypeWord << WORDTYPESHIFT; 00034 00035 uint32_t fakeROSTrailerWord = 00036 DTROSWordType::trailerControlWord << WORDCONTROLSHIFT | 00037 DTROSWordType::rosTypeWord << WORDTYPESHIFT; 00038 00039 00040 int NWords = 2; 00041 words.push_back(0); 00042 words.push_back(0); 00043 00044 00045 00046 int NTDCMeaWords = 0; 00047 00048 00049 int NLayers = 0; 00050 int NDigis = 0; 00051 00052 DTDigiCollection::DigiRangeIterator detUnitIt;detUnitIt = digis.begin(); 00053 00054 00055 bool b_ros[12] = {false, false, false, false, false, false, 00056 false, false, false, false, false, false}; 00057 vector <uint32_t> w_ROBROS[12][25]; 00058 00059 00060 for (detUnitIt = digis.begin(); detUnitIt != digis.end(); ++detUnitIt) { 00061 00062 NLayers++; 00063 00064 const DTLayerId layerId = (*detUnitIt).first; 00065 const DTDigiCollection::Range& digiRange = (*detUnitIt).second; 00066 // Loop over all digis in the given range 00067 00068 00069 for(DTDigiCollection::const_iterator digi = digiRange.first; 00070 digi != digiRange.second; 00071 digi++) { 00072 NDigis++; 00073 int dduId = -1, rosId = -1, robId = -1, tdcId = -1, channelId = -1; 00074 00075 int layer = layerId.layer(); 00076 DTSuperLayerId superlayerID = layerId.superlayerId(); 00077 int superlayer = superlayerID.superlayer(); 00078 DTChamberId chamberID = superlayerID.chamberId(); 00079 int station = chamberID.station(); 00080 int wheel = chamberID.wheel(); 00081 int sector = chamberID.sector(); 00082 00083 int searchstatus = map-> 00084 geometryToReadOut(wheel, station, sector, superlayer, layer, (*digi).wire(),//"input" 00085 dduId, rosId, robId, tdcId, channelId);//"output" 00086 00087 if (searchstatus == 1 && debug) 00088 cout << "[DTDigiToRaw]: warning, geometryToReadOut status = 1" << endl; 00089 00090 //create FED corresponding to current ddu 00091 if (dduID_ != dduId) continue; 00092 00093 00094 DTTDCMeasurementWord dttdc_mw; 00095 uint32_t word; 00096 int ntdc = (*digi).countsTDC(); 00097 dttdc_mw.set(word, 0, 0, 0, tdcId, channelId, ntdc*4);//FIXME 00098 00099 //provisional fix 00100 DTTDCMeasurementWord tdcMeasurementWord(word); 00101 int tdcIDCheck = tdcMeasurementWord.tdcID(); 00102 int tdcChannelCheck = tdcMeasurementWord.tdcChannel(); 00103 int tdcCountsCheck = tdcMeasurementWord.tdcTime(); 00104 if (tdcIDCheck == tdcId && channelId ==tdcChannelCheck && ntdc == tdcCountsCheck) { 00105 00106 if (rosId <= NROS && rosId > 0) b_ros[rosId - 1] = true; 00107 else if (debug) { 00108 cout << "[DTDigiToRaw]: invalid value for rosId" << endl; 00109 } 00110 00111 NTDCMeaWords++; 00112 w_ROBROS[rosId - 1][robId].push_back(word); 00113 00114 } 00115 } 00116 } 00117 00118 uint32_t therosList = 0; 00119 for (int i_ros = 0; i_ros < NROS; i_ros++) { 00120 if (b_ros[i_ros]) therosList += uint32_t(pow(2.0, i_ros)); 00121 } 00122 00123 if (debug) cout << "[DTDigiToRaw]: therosList = " << therosList << endl; 00124 00125 00126 00127 00128 for (int i_ros = 0; i_ros < NROS; i_ros++) { 00129 00130 if (b_ros[i_ros]) { 00131 words.push_back(fakeROSHeaderWord); 00132 NWords++; 00133 } 00134 00135 for (int i_rob = 0; i_rob < NROB; i_rob++) { 00136 00137 vector <uint32_t>::const_iterator i_robros; 00138 if (w_ROBROS[i_ros][i_rob].begin() != w_ROBROS[i_ros][i_rob].end()) { 00139 uint32_t word = 0; 00140 DTROBHeaderWord rob_header; 00141 rob_header.set(word, i_rob, 0, 0); 00142 //static void set(uint32_t &word, int rob_id, int event_id, int bunch_id) 00143 words.push_back(word); 00144 NWords++; 00145 00146 int n_robros = 0; 00147 for (i_robros = w_ROBROS[i_ros][i_rob].begin(); i_robros != w_ROBROS[i_ros][i_rob].end(); i_robros++) { 00148 NWords++; 00149 words.push_back((*i_robros)); 00150 n_robros++; 00151 } 00152 00153 NWords++; 00154 DTROBTrailerWord rob_trailer; 00155 rob_trailer.set(word, i_rob, 0, n_robros + 2); 00156 //static void set(uint32_t &word, int rob_id, int event_id, int word_count) 00157 words.push_back(word); 00158 00159 } 00160 } 00161 00162 if (b_ros[i_ros]) { 00163 words.push_back(fakeROSTrailerWord); 00164 NWords++; 00165 } 00166 00167 } 00168 00169 if (NWords%2 == 1) { 00170 words.push_back(0); 00171 NWords++; 00172 } 00173 00174 00175 00176 NWords += 6; 00177 00178 words.push_back(0); 00179 words.push_back(0); 00180 //include rosList in raw data information 00181 uint32_t secondstatusword = therosList << 16; 00182 words.push_back(secondstatusword); 00183 00184 words.push_back(0); 00185 words.push_back(0); 00186 words.push_back(0); 00187 00188 00189 // Write Raw Data 00190 int dataSize = words.size()*sizeof(Word32); 00191 FEDRawData* rawData = new FEDRawData(dataSize); 00192 Word64 *word64 = reinterpret_cast<Word64*>(rawData->data()); 00193 for (unsigned int i = 0; i < words.size(); i += 2) { 00194 *word64 = (Word64(words[i]) << 32) | words[i + 1]; 00195 word64++; 00196 } 00197 00198 return rawData; 00199 00200 00201 }
Definition at line 203 of file DTDigiToRaw.cc.
References dduID_.
Referenced by DTDigiToRawModule::produce().
int DTDigiToRaw::dduID_ [private] |
bool DTDigiToRaw::debug [private] |
Definition at line 39 of file DTDigiToRaw.h.
Referenced by createFedBuffers(), DTDigiToRaw(), and ~DTDigiToRaw().
const edm::ParameterSet DTDigiToRaw::pset [private] |