00001
00018
00019 #include "L1Trigger/GlobalTriggerAnalyzer/interface/L1GtDataEmulAnalyzer.h"
00020
00021
00022 #include <memory>
00023 #include <iostream>
00024 #include <iomanip>
00025
00026
00027 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h"
00028 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetup.h"
00029 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
00030 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerEvmReadoutRecord.h"
00031
00032 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00033 #include "FWCore/ServiceRegistry/interface/Service.h"
00034 #include "CommonTools/UtilAlgos/interface/TFileService.h"
00035
00036 #include "FWCore/Framework/interface/EventSetup.h"
00037 #include "FWCore/Framework/interface/ESHandle.h"
00038
00039 #include "CondFormats/L1TObjects/interface/L1GtTriggerMenu.h"
00040 #include "CondFormats/DataRecord/interface/L1GtTriggerMenuRcd.h"
00041
00042 #include "CondFormats/L1TObjects/interface/L1GtTriggerMask.h"
00043 #include "CondFormats/DataRecord/interface/L1GtTriggerMaskAlgoTrigRcd.h"
00044 #include "CondFormats/DataRecord/interface/L1GtTriggerMaskTechTrigRcd.h"
00045
00046 #include "TH1.h"
00047 #include "TH2.h"
00048 #include "TTree.h"
00049
00050
00051 L1GtDataEmulAnalyzer::L1GtDataEmulAnalyzer(const edm::ParameterSet& parSet) {
00052
00053
00054 m_l1GtDataInputTag = parSet.getParameter<edm::InputTag>("L1GtDataInputTag");
00055
00056
00057 m_l1GtEmulInputTag = parSet.getParameter<edm::InputTag>("L1GtEmulInputTag");
00058
00059
00060 m_l1GctDataInputTag
00061 = parSet.getParameter<edm::InputTag>("L1GctDataInputTag");
00062
00063 LogDebug("L1GtDataEmulAnalyzer")
00064 << "\nInput tag for the L1 GT hardware records: "
00065 << m_l1GtDataInputTag
00066 << "\nInput tag for the L1 GT emulator records: "
00067 << m_l1GtEmulInputTag
00068 << "\nInput tag for the L1 GCT hardware record: "
00069 << m_l1GctDataInputTag << std::endl;
00070
00071
00072 m_nrDataEventError = 0;
00073 m_nrEmulEventError = 0;
00074
00075
00076 m_l1GtMenuCacheID = 0ULL;
00077
00078 m_l1GtTmAlgoCacheID = 0ULL;
00079 m_l1GtTmTechCacheID = 0ULL;
00080
00081
00082
00083 bookHistograms();
00084
00085 }
00086
00087
00088 L1GtDataEmulAnalyzer::~L1GtDataEmulAnalyzer() {
00089
00090 }
00091
00092
00093
00094
00095 void L1GtDataEmulAnalyzer::beginJob() {
00096
00097 }
00098
00099
00100 void L1GtDataEmulAnalyzer::compareGTFE(const edm::Event& iEvent,
00101 const edm::EventSetup& evSetup, const L1GtfeWord& gtfeBlockData,
00102 const L1GtfeWord& gtfeBlockEmul) {
00103
00104 if (gtfeBlockData == gtfeBlockEmul) {
00105 m_myCoutStream << "\nData and emulated GTFE blocks: identical.\n";
00106 gtfeBlockData.print(m_myCoutStream);
00107 }
00108 else {
00109 m_myCoutStream << "\nData and emulated GTFE blocks: different.\n";
00110
00111 m_myCoutStream << "\nData: GTFE block\n";
00112 gtfeBlockData.print(m_myCoutStream);
00113
00114 m_myCoutStream << "\nEmul: GTFE block\n";
00115 gtfeBlockEmul.print(m_myCoutStream);
00116
00117 }
00118
00119 LogDebug("L1GtDataEmulAnalyzer") << m_myCoutStream.str() << std::endl;
00120
00121 m_myCoutStream.str("");
00122 m_myCoutStream.clear();
00123
00124
00125 const boost::uint16_t boardIdData = gtfeBlockData.boardId();
00126 const boost::uint16_t boardIdEmul = gtfeBlockEmul.boardId();
00127
00128 if (boardIdData == boardIdEmul) {
00129 m_myCoutStream << "\nData and emulated GTFE boardId identical.";
00130 m_myCoutStream << "\n boardId() = " << std::hex << "0x" << std::setw(4)
00131 << std::setfill('0') << boardIdData << std::setfill(' ')
00132 << std::dec;
00133 m_myCoutStream << "\n";
00134
00135 }
00136 else {
00137 m_myCoutStream << "\nData and emulated GTFE boardId different.";
00138 m_myCoutStream << "\n Data: boardId() = " << std::hex << "0x"
00139 << std::setw(4) << std::setfill('0') << boardIdData
00140 << std::setfill(' ') << std::dec;
00141 m_myCoutStream << "\n Emul: boardId() = " << std::hex << "0x"
00142 << std::setw(4) << std::setfill('0') << boardIdEmul
00143 << std::setfill(' ') << std::dec;
00144 m_myCoutStream << "\n";
00145 m_gtfeDataEmul->Fill(0);
00146
00147 }
00148
00150 const boost::uint16_t recordLengthData = gtfeBlockData.recordLength();
00151 const boost::uint16_t recordLengthEmul = gtfeBlockEmul.recordLength();
00152
00153 if (recordLengthData == recordLengthEmul) {
00154 m_myCoutStream << "\nData and emulated GTFE recordLength identical.";
00155 m_myCoutStream << "\n recordLength() = " << recordLengthData;
00156 m_myCoutStream << "\n";
00157
00158 }
00159 else {
00160 m_myCoutStream << "\nData and emulated GTFE recordLength different.";
00161 m_myCoutStream << "\n Data: recordLength() = " << recordLengthData;
00162 m_myCoutStream << "\n Emul: recordLength() = " << recordLengthEmul;
00163 m_myCoutStream << "\n";
00164 m_gtfeDataEmul->Fill(1);
00165
00166 }
00167
00169 const boost::uint16_t bxNrData = gtfeBlockData.bxNr();
00170 const boost::uint16_t bxNrEmul = gtfeBlockEmul.bxNr();
00171
00172 if (bxNrData == bxNrEmul) {
00173 m_myCoutStream << "\nData and emulated GTFE bxNr identical.";
00174 m_myCoutStream << "\n bxNr() = " << bxNrData;
00175 m_myCoutStream << "\n";
00176
00177 }
00178 else {
00179 m_myCoutStream << "\nData and emulated GTFE bxNr different.";
00180 m_myCoutStream << "\n Data: bxNr() = " << bxNrData;
00181 m_myCoutStream << "\n Emul: bxNr() = " << bxNrEmul;
00182 m_myCoutStream << "\n";
00183 m_gtfeDataEmul->Fill(2);
00184
00185 }
00186
00188 const boost::uint32_t setupVersionData = gtfeBlockData.setupVersion();
00189 const boost::uint32_t setupVersionEmul = gtfeBlockEmul.setupVersion();
00190
00191 if (setupVersionData == setupVersionEmul) {
00192 m_myCoutStream << "\nData and emulated GTFE setupVersion identical.";
00193 m_myCoutStream << "\n setupVersion() = " << setupVersionData;
00194 m_myCoutStream << "\n";
00195
00196 }
00197 else {
00198 m_myCoutStream << "\nData and emulated GTFE setupVersion different.";
00199 m_myCoutStream << "\n Data: setupVersion() = " << setupVersionData;
00200 m_myCoutStream << "\n Emul: setupVersion() = " << setupVersionEmul;
00201 m_myCoutStream << "\n";
00202 m_gtfeDataEmul->Fill(3);
00203
00204 }
00205
00207 const boost::uint16_t activeBoardsData = gtfeBlockData.activeBoards();
00208 const boost::uint16_t activeBoardsEmul = gtfeBlockEmul.activeBoards();
00209
00210 if (activeBoardsData == activeBoardsEmul) {
00211 m_myCoutStream << "\nData and emulated GTFE activeBoards identical.";
00212 m_myCoutStream << "\n activeBoards() = " << std::hex << "0x"
00213 << std::setw(4) << std::setfill('0') << activeBoardsData
00214 << std::setfill(' ') << std::dec;
00215 m_myCoutStream << "\n";
00216
00217 }
00218 else {
00219 m_myCoutStream << "\nData and emulated GTFE activeBoards different.";
00220 m_myCoutStream << "\n Data: activeBoards() = " << std::hex << "0x"
00221 << std::setw(4) << std::setfill('0') << activeBoardsData
00222 << std::setfill(' ') << std::dec;
00223 m_myCoutStream << "\n Emul: activeBoards() = " << std::hex << "0x"
00224 << std::setw(4) << std::setfill('0') << activeBoardsEmul
00225 << std::setfill(' ') << std::dec;
00226 m_myCoutStream << "\n";
00227 m_gtfeDataEmul->Fill(4);
00228
00229 }
00230
00232 const boost::uint32_t totalTriggerNrData = gtfeBlockData.totalTriggerNr();
00233 const boost::uint32_t totalTriggerNrEmul = gtfeBlockEmul.totalTriggerNr();
00234
00235 if (totalTriggerNrData == totalTriggerNrEmul) {
00236 m_myCoutStream << "\nData and emulated GTFE totalTriggerNr identical.";
00237 m_myCoutStream << "\n totalTriggerNr() = " << totalTriggerNrData;
00238 m_myCoutStream << "\n";
00239
00240 }
00241 else {
00242 m_myCoutStream << "\nData and emulated GTFE totalTriggerNr different.";
00243 m_myCoutStream << "\n Data: totalTriggerNr() = " << totalTriggerNrData;
00244 m_myCoutStream << "\n Emul: totalTriggerNr() = " << totalTriggerNrEmul;
00245 m_myCoutStream << "\n";
00246 m_gtfeDataEmul->Fill(5);
00247
00248 }
00249
00250 edm::LogInfo("L1GtDataEmulAnalyzer") << m_myCoutStream.str() << std::endl;
00251 m_myCoutStream.str("");
00252 m_myCoutStream.clear();
00253
00254 }
00255
00256
00257 void L1GtDataEmulAnalyzer::compareFDL(const edm::Event& iEvent,
00258 const edm::EventSetup& evSetup, const L1GtFdlWord& fdlBlockData,
00259 const L1GtFdlWord& fdlBlockEmul, const int iRec) {
00260
00261
00262 int PhysicsPartition = 0;
00263
00264
00265 std::string recString;
00266 if (iRec == 0) {
00267 recString = "Daq";
00268 }
00269 else {
00270 recString = "Evm";
00271 }
00272
00273 if (fdlBlockData == fdlBlockEmul) {
00274 m_myCoutStream << "\n" << recString
00275 << " Data and emulated FDL blocks: identical.\n";
00276 fdlBlockData.print(m_myCoutStream);
00277
00278 }
00279 else {
00280 m_myCoutStream << "\n" << recString
00281 << " Data and emulated FDL blocks: different.\n";
00282
00283 m_myCoutStream << "\nData: FDL block\n";
00284 fdlBlockData.print(m_myCoutStream);
00285
00286 m_myCoutStream << "\nEmul: FDL block\n";
00287 fdlBlockEmul.print(m_myCoutStream);
00288
00289 }
00290
00291 LogDebug("L1GtDataEmulAnalyzer") << m_myCoutStream.str() << std::endl;
00292
00293 m_myCoutStream.str("");
00294 m_myCoutStream.clear();
00295
00296
00297
00298 const int bxInEventData = fdlBlockData.bxInEvent();
00299 const int bxInEventEmul = fdlBlockEmul.bxInEvent();
00300
00301 bool matchBxInEvent = false;
00302
00303 if (bxInEventData == bxInEventEmul) {
00304 m_myCoutStream << "\n" << recString
00305 << " Data and emulated FDL bxInEvent identical.";
00306 m_myCoutStream << "\n bxInEvent() = " << bxInEventData;
00307 m_myCoutStream << "\n";
00308 matchBxInEvent = true;
00309
00310 }
00311 else {
00312 m_myCoutStream << "\n" << recString
00313 << " Data and emulated FDL bxInEvent different.";
00314 m_myCoutStream << "\n Data: bxInEvent() = " << bxInEventData;
00315 m_myCoutStream << "\n Emul: bxInEvent() = " << bxInEventEmul;
00316 m_myCoutStream << "\n";
00317
00318 m_fdlDataEmul_Err[iRec]->Fill(1);
00319 }
00320
00321 LogDebug("L1GtDataEmulAnalyzer") << m_myCoutStream.str() << std::endl;
00322 m_myCoutStream.str("");
00323 m_myCoutStream.clear();
00324
00325
00326 bool validBxInEvent = false;
00327 int histIndex = bxInEventData + (TotalBxInEvent + 1)/2 -1;
00328 if ((histIndex <= TotalBxInEvent) && (histIndex >= 0)) {
00329 validBxInEvent = true;
00330 }
00331
00332
00333
00334
00335 unsigned long long l1GtMenuCacheID = evSetup.get<L1GtTriggerMenuRcd>().cacheIdentifier();
00336
00337 if (m_l1GtMenuCacheID != l1GtMenuCacheID) {
00338
00339 edm::ESHandle< L1GtTriggerMenu> l1GtMenu;
00340 evSetup.get< L1GtTriggerMenuRcd>().get(l1GtMenu) ;
00341 m_l1GtMenu = l1GtMenu.product();
00342
00343 m_l1GtMenuCacheID = l1GtMenuCacheID;
00344
00345 }
00346
00347
00348
00349 unsigned long long l1GtTmAlgoCacheID =
00350 evSetup.get<L1GtTriggerMaskAlgoTrigRcd>().cacheIdentifier();
00351
00352 if (m_l1GtTmAlgoCacheID != l1GtTmAlgoCacheID) {
00353
00354 edm::ESHandle< L1GtTriggerMask > l1GtTmAlgo;
00355 evSetup.get< L1GtTriggerMaskAlgoTrigRcd >().get( l1GtTmAlgo );
00356 m_l1GtTmAlgo = l1GtTmAlgo.product();
00357
00358 m_triggerMaskAlgoTrig = m_l1GtTmAlgo->gtTriggerMask();
00359
00360 m_l1GtTmAlgoCacheID = l1GtTmAlgoCacheID;
00361
00362 }
00363
00364
00365 unsigned long long l1GtTmTechCacheID =
00366 evSetup.get<L1GtTriggerMaskTechTrigRcd>().cacheIdentifier();
00367
00368 if (m_l1GtTmTechCacheID != l1GtTmTechCacheID) {
00369
00370 edm::ESHandle< L1GtTriggerMask > l1GtTmTech;
00371 evSetup.get< L1GtTriggerMaskTechTrigRcd >().get( l1GtTmTech );
00372 m_l1GtTmTech = l1GtTmTech.product();
00373
00374 m_triggerMaskTechTrig = m_l1GtTmTech->gtTriggerMask();
00375
00376 m_l1GtTmTechCacheID = l1GtTmTechCacheID;
00377
00378 }
00379
00380
00381
00382
00383
00384
00385 const AlgorithmMap& algorithmMap = m_l1GtMenu->gtAlgorithmMap();
00386
00387 for (CItAlgo itAlgo = algorithmMap.begin(); itAlgo != algorithmMap.end(); itAlgo++) {
00388
00389 std::string aName = itAlgo->first;
00390 const char* algName = aName.c_str();
00391 int algBitNumber = (itAlgo->second).algoBitNumber();
00392
00393 (m_fdlDataAlgoDecision[histIndex][iRec])->GetXaxis()->SetBinLabel(algBitNumber + 1, algName);
00394 m_fdlDataAlgoDecision_Err[iRec]->GetXaxis()->SetBinLabel(algBitNumber + 1, algName);
00395
00396 m_fdlEmulAlgoDecision[histIndex][iRec]->GetXaxis()->SetBinLabel(algBitNumber + 1, algName);
00397 m_fdlEmulAlgoDecision_Err[iRec]->GetXaxis()->SetBinLabel(algBitNumber + 1, algName);
00398
00399 m_fdlDataEmulAlgoDecision[histIndex][iRec]->GetXaxis()->SetBinLabel(algBitNumber + 1, algName);
00400 m_fdlDataEmulAlgoDecision_Err[iRec]->GetXaxis()->SetBinLabel(algBitNumber + 1, algName);
00401
00402 }
00403
00404
00405 const boost::uint16_t boardIdData = fdlBlockData.boardId();
00406 const boost::uint16_t boardIdEmul = fdlBlockEmul.boardId();
00407
00408 if (boardIdData == boardIdEmul) {
00409 m_myCoutStream << "\n" << recString
00410 << " Data and emulated FDL boardId identical.";
00411 m_myCoutStream << "\n boardId() = " << std::hex << "0x" << std::setw(4)
00412 << std::setfill('0') << boardIdData << std::setfill(' ')
00413 << std::dec;
00414 m_myCoutStream << "\n";
00415
00416 }
00417 else {
00418 m_myCoutStream << "\n" << recString
00419 << " Data and emulated FDL boardId different.";
00420 m_myCoutStream << "\n Data: boardId() = " << std::hex << "0x"
00421 << std::setw(4) << std::setfill('0') << boardIdData
00422 << std::setfill(' ') << std::dec;
00423 m_myCoutStream << "\n Emul: boardId() = " << std::hex << "0x"
00424 << std::setw(4) << std::setfill('0') << boardIdEmul
00425 << std::setfill(' ') << std::dec;
00426 m_myCoutStream << "\n";
00427
00428 if (matchBxInEvent && validBxInEvent) {
00429 m_fdlDataEmul[histIndex][iRec]->Fill(0);
00430 }
00431 else {
00432 m_fdlDataEmul_Err[iRec]->Fill(0);
00433 }
00434
00435 }
00436
00437 LogDebug("L1GtDataEmulAnalyzer") << m_myCoutStream.str() << std::endl;
00438 m_myCoutStream.str("");
00439 m_myCoutStream.clear();
00440
00441
00442 const boost::uint16_t bxNrData = fdlBlockData.bxNr();
00443 const boost::uint16_t bxNrEmul = fdlBlockEmul.bxNr();
00444
00445 if (bxNrData == bxNrEmul) {
00446 m_myCoutStream << "\n" << recString
00447 << " Data and emulated FDL bxNr identical.";
00448 m_myCoutStream << "\n bxNr() = " << bxNrData;
00449 m_myCoutStream << "\n";
00450
00451 }
00452 else {
00453 m_myCoutStream << "\n" << recString
00454 << " Data and emulated FDL bxNr different.";
00455 m_myCoutStream << "\n Data: bxNr() = " << bxNrData;
00456 m_myCoutStream << "\n Emul: bxNr() = " << bxNrEmul;
00457 m_myCoutStream << "\n";
00458
00459 if (matchBxInEvent && validBxInEvent) {
00460 m_fdlDataEmul[histIndex][iRec]->Fill(2);
00461 }
00462 else {
00463 m_fdlDataEmul_Err[iRec]->Fill(2);
00464 }
00465 }
00466
00467 LogDebug("L1GtDataEmulAnalyzer") << m_myCoutStream.str() << std::endl;
00468 m_myCoutStream.str("");
00469 m_myCoutStream.clear();
00470
00471
00472 const boost::uint32_t eventNrData = fdlBlockData.eventNr();
00473 const boost::uint32_t eventNrEmul = fdlBlockEmul.eventNr();
00474
00475 if (eventNrData == eventNrEmul) {
00476 m_myCoutStream << "\n" << recString
00477 << " Data and emulated FDL eventNr identical.";
00478 m_myCoutStream << "\n eventNr() = " << eventNrData;
00479 m_myCoutStream << "\n";
00480
00481 }
00482 else {
00483 m_myCoutStream << "\n" << recString
00484 << " Data and emulated FDL eventNr different.";
00485 m_myCoutStream << "\n Data: eventNr() = " << eventNrData;
00486 m_myCoutStream << "\n Emul: eventNr() = " << eventNrEmul;
00487 m_myCoutStream << "\n";
00488
00489 if (matchBxInEvent && validBxInEvent) {
00490 m_fdlDataEmul[histIndex][iRec]->Fill(3);
00491 }
00492 else {
00493 m_fdlDataEmul_Err[iRec]->Fill(3);
00494 }
00495
00496 }
00497
00498 LogDebug("L1GtDataEmulAnalyzer") << m_myCoutStream.str() << std::endl;
00499 m_myCoutStream.str("");
00500 m_myCoutStream.clear();
00501
00502
00503 const TechnicalTriggerWord gtTechnicalTriggerWordData =
00504 fdlBlockData.gtTechnicalTriggerWord();
00505 const TechnicalTriggerWord gtTechnicalTriggerWordEmul =
00506 fdlBlockEmul.gtTechnicalTriggerWord();
00507
00508 int nTechBits = gtTechnicalTriggerWordData.size();
00509
00510 TechnicalTriggerWord gtTechnicalTriggerWordDataMask(nTechBits);
00511 TechnicalTriggerWord gtTechnicalTriggerWordEmulMask(nTechBits);
00512
00513 unsigned int triggerMask = 0;
00514 unsigned int bitValue = 0;
00515
00516 if (matchBxInEvent && validBxInEvent) {
00517 for (int iBit = 0; iBit < nTechBits; ++iBit) {
00518
00519 triggerMask = (m_triggerMaskTechTrig.at(iBit)) & (1
00520 << PhysicsPartition);
00521
00522 if (gtTechnicalTriggerWordData[iBit]) {
00523 m_fdlDataTechDecision[histIndex][iRec]->Fill(iBit);
00524
00525 bitValue = (triggerMask) ? 0 : 1;
00526 gtTechnicalTriggerWordDataMask[iBit] = bitValue;
00527 if (bitValue) {
00528 m_fdlDataTechDecisionMask[histIndex][iRec]->Fill(iBit);
00529 }
00530 }
00531
00532 if (gtTechnicalTriggerWordEmul.at(iBit)) {
00533 m_fdlEmulTechDecision[histIndex][iRec]->Fill(iBit);
00534
00535 bitValue = (triggerMask) ? 0 : 1;
00536 gtTechnicalTriggerWordEmulMask[iBit] = bitValue;
00537 if (bitValue) {
00538 m_fdlEmulTechDecisionMask[histIndex][iRec]->Fill(iBit);
00539 }
00540 }
00541 }
00542 }
00543 else {
00544 for (int iBit = 0; iBit < nTechBits; ++iBit) {
00545
00546 if (gtTechnicalTriggerWordData[iBit]) {
00547 m_fdlDataTechDecision_Err[iRec]->Fill(iBit);
00548 }
00549
00550 if (gtTechnicalTriggerWordEmul.at(iBit)) {
00551 m_fdlEmulTechDecision_Err[iRec]->Fill(iBit);
00552 }
00553 }
00554 }
00555
00556 if (gtTechnicalTriggerWordData == gtTechnicalTriggerWordEmul) {
00557 m_myCoutStream << "\n" << recString
00558 << " Data and emulated FDL gtTechnicalTriggerWord identical.\n";
00559 fdlBlockData.printGtTechnicalTriggerWord(m_myCoutStream);
00560 m_myCoutStream << "\n";
00561
00562 }
00563 else {
00564 m_myCoutStream << "\n" << recString
00565 << " Data and emulated FDL gtTechnicalTriggerWord different.";
00566 m_myCoutStream << "\n Data: ";
00567 fdlBlockData.printGtTechnicalTriggerWord(m_myCoutStream);
00568 m_myCoutStream << "\n Emul: ";
00569 fdlBlockEmul.printGtTechnicalTriggerWord(m_myCoutStream);
00570 m_myCoutStream << "\n";
00571
00572 if (matchBxInEvent && validBxInEvent) {
00573 m_fdlDataEmul[histIndex][iRec]->Fill(4);
00574 }
00575 else {
00576 m_fdlDataEmul_Err[iRec]->Fill(4);
00577 }
00578
00579 if (matchBxInEvent && validBxInEvent) {
00580 for (int iBit = 0; iBit < nTechBits; ++iBit) {
00581 if (gtTechnicalTriggerWordData[iBit]
00582 != gtTechnicalTriggerWordEmul.at(iBit)) {
00583 m_fdlDataEmulTechDecision[histIndex][iRec]->Fill(iBit);
00584 }
00585 }
00586 }
00587 else {
00588 for (int iBit = 0; iBit < nTechBits; ++iBit) {
00589 if (gtTechnicalTriggerWordData[iBit]
00590 != gtTechnicalTriggerWordEmul.at(iBit)) {
00591 m_fdlDataEmulTechDecision_Err[iRec]->Fill(iBit);
00592 }
00593 }
00594 }
00595 }
00596
00597 LogDebug("L1GtDataEmulAnalyzer") << m_myCoutStream.str() << std::endl;
00598 m_myCoutStream.str("");
00599 m_myCoutStream.clear();
00600
00601 if (gtTechnicalTriggerWordDataMask == gtTechnicalTriggerWordEmulMask) {
00602 m_myCoutStream << "\n" << recString
00603 << " Data and emulated FDL gtTechnicalTriggerWord after mask identical.\n";
00604 m_myCoutStream << "\n";
00605
00606 }
00607 else {
00608 m_myCoutStream << "\n" << recString
00609 << " Data and emulated FDL gtTechnicalTriggerWord after mask different.";
00610 m_myCoutStream << "\n Data: ";
00611 m_myCoutStream << "\n Emul: ";
00612 m_myCoutStream << "\n";
00613
00614 if (matchBxInEvent && validBxInEvent) {
00615 m_fdlDataEmul[histIndex][iRec]->Fill(5);
00616 }
00617 else {
00618 m_fdlDataEmul_Err[iRec]->Fill(5);
00619 }
00620
00621 if (matchBxInEvent && validBxInEvent) {
00622 for (int iBit = 0; iBit < nTechBits; ++iBit) {
00623 if (gtTechnicalTriggerWordData[iBit]
00624 != gtTechnicalTriggerWordEmul.at(iBit)) {
00625 m_fdlDataEmulTechDecisionMask[histIndex][iRec]->Fill(iBit);
00626 }
00627 }
00628 }
00629 }
00630
00631 LogDebug("L1GtDataEmulAnalyzer") << m_myCoutStream.str() << std::endl;
00632 m_myCoutStream.str("");
00633 m_myCoutStream.clear();
00634
00635
00636 const DecisionWord gtDecisionWordData = fdlBlockData.gtDecisionWord();
00637 const DecisionWord gtDecisionWordEmul = fdlBlockEmul.gtDecisionWord();
00638
00639 int nAlgoBits = gtDecisionWordData.size();
00640
00641 DecisionWord gtDecisionWordDataMask(nAlgoBits);
00642 DecisionWord gtDecisionWordEmulMask(nAlgoBits);
00643
00644 if (matchBxInEvent && validBxInEvent) {
00645
00646 for (int iBit = 0; iBit < nAlgoBits; ++iBit) {
00647
00648 triggerMask = (m_triggerMaskAlgoTrig.at(iBit))
00649 & (1 << PhysicsPartition);
00650
00651 if (gtDecisionWordData[iBit]) {
00652 m_fdlDataAlgoDecision[histIndex][iRec]->Fill(iBit);
00653
00654 bitValue = (triggerMask) ? 0 : 1;
00655 gtDecisionWordDataMask[iBit] = bitValue;
00656 if (bitValue) {
00657 m_fdlDataAlgoDecisionMask[histIndex][iRec]->Fill(iBit);
00658 }
00659 }
00660
00661 if (gtDecisionWordEmul.at(iBit)) {
00662 m_fdlEmulAlgoDecision[histIndex][iRec]->Fill(iBit);
00663
00664 bitValue = (triggerMask) ? 0 : 1;
00665 gtDecisionWordEmulMask[iBit] = bitValue;
00666 if (bitValue) {
00667 m_fdlEmulAlgoDecisionMask[histIndex][iRec]->Fill(iBit);
00668 }
00669 }
00670 }
00671 }
00672 else {
00673 for (int iBit = 0; iBit < nAlgoBits; ++iBit) {
00674 if (gtDecisionWordData[iBit]) {
00675 m_fdlDataAlgoDecision_Err[iRec]->Fill(iBit);
00676 }
00677 }
00678
00679 for (int iBit = 0; iBit < nAlgoBits; ++iBit) {
00680 if (gtDecisionWordEmul.at(iBit)) {
00681 m_fdlEmulAlgoDecision_Err[iRec]->Fill(iBit);
00682 }
00683 }
00684 }
00685
00686 if (gtDecisionWordData == gtDecisionWordEmul) {
00687 m_myCoutStream << "\n" << recString
00688 << " Data and emulated FDL gtDecisionWord identical.";
00689 fdlBlockData.printGtDecisionWord(m_myCoutStream);
00690 m_myCoutStream << "\n";
00691
00692 }
00693 else {
00694 m_myCoutStream << "\n" << recString
00695 << " Data and emulated FDL gtDecisionWord different.";
00696 m_myCoutStream << "\n Data: ";
00697 fdlBlockData.printGtDecisionWord(m_myCoutStream);
00698 m_myCoutStream << "\n Emul: ";
00699 fdlBlockEmul.printGtDecisionWord(m_myCoutStream);
00700 m_myCoutStream << "\n";
00701
00702 if (matchBxInEvent && validBxInEvent) {
00703 m_fdlDataEmul[histIndex][iRec]->Fill(6);
00704 }
00705 else {
00706 m_fdlDataEmul_Err[iRec]->Fill(6);
00707 }
00708
00709 if (matchBxInEvent && validBxInEvent) {
00710 for (int iBit = 0; iBit < nAlgoBits; ++iBit) {
00711 if (gtDecisionWordData[iBit] != gtDecisionWordEmul.at(iBit)) {
00712 m_fdlDataEmulAlgoDecision[histIndex][iRec]->Fill(iBit);
00713 }
00714 }
00715 }
00716 else {
00717 for (int iBit = 0; iBit < nAlgoBits; ++iBit) {
00718 if (gtDecisionWordData[iBit] != gtDecisionWordEmul.at(iBit)) {
00719 m_fdlDataEmulAlgoDecision_Err[iRec]->Fill(iBit);
00720 }
00721 }
00722 }
00723
00724 }
00725
00726 if (gtDecisionWordDataMask == gtDecisionWordEmulMask) {
00727 m_myCoutStream << "\n" << recString
00728 << " Data and emulated FDL gtDecisionWord after mask identical.";
00729 m_myCoutStream << "\n";
00730
00731 }
00732 else {
00733 m_myCoutStream << "\n" << recString
00734 << " Data and emulated FDL gtDecisionWord after mask different.";
00735 m_myCoutStream << "\n Data: ";
00736 m_myCoutStream << "\n Emul: ";
00737 m_myCoutStream << "\n";
00738
00739 if (matchBxInEvent && validBxInEvent) {
00740 m_fdlDataEmul[histIndex][iRec]->Fill(7);
00741 }
00742 else {
00743 m_fdlDataEmul_Err[iRec]->Fill(7);
00744 }
00745
00746 if (matchBxInEvent && validBxInEvent) {
00747 for (int iBit = 0; iBit < nAlgoBits; ++iBit) {
00748 if (gtDecisionWordDataMask[iBit] != gtDecisionWordEmulMask.at(iBit)) {
00749 m_fdlDataEmulAlgoDecisionMask[histIndex][iRec]->Fill(iBit);
00750 }
00751 }
00752 }
00753
00754 }
00755
00756
00757 const DecisionWordExtended gtDecisionWordExtendedData =
00758 fdlBlockData.gtDecisionWordExtended();
00759 const DecisionWordExtended gtDecisionWordExtendedEmul =
00760 fdlBlockEmul.gtDecisionWordExtended();
00761
00762 if (gtDecisionWordExtendedData == gtDecisionWordExtendedEmul) {
00763 m_myCoutStream << "\n" << recString
00764 << " Data and emulated FDL gtDecisionWordExtended identical.\n";
00765 fdlBlockData.printGtDecisionWordExtended(m_myCoutStream);
00766 m_myCoutStream << "\n";
00767
00768 }
00769 else {
00770 m_myCoutStream << "\n" << recString
00771 << " Data and emulated FDL gtDecisionWordExtended different.\n";
00772 m_myCoutStream << "\n Data: ";
00773 fdlBlockData.printGtDecisionWordExtended(m_myCoutStream);
00774 m_myCoutStream << "\n Emul: ";
00775 fdlBlockEmul.printGtDecisionWordExtended(m_myCoutStream);
00776 m_myCoutStream << "\n";
00777
00778 if (matchBxInEvent && validBxInEvent) {
00779 m_fdlDataEmul[histIndex][iRec]->Fill(8);
00780 }
00781 else {
00782 m_fdlDataEmul_Err[iRec]->Fill(8);
00783 }
00784
00785 }
00786
00787
00788 const boost::uint16_t noAlgoData = fdlBlockData.noAlgo();
00789 const boost::uint16_t noAlgoEmul = fdlBlockEmul.noAlgo();
00790
00791 if (noAlgoData == noAlgoEmul) {
00792 m_myCoutStream << "\n" << recString
00793 << " Data and emulated FDL noAlgo identical.";
00794 m_myCoutStream << "\n noAlgo() = " << noAlgoData;
00795 m_myCoutStream << "\n";
00796
00797 }
00798 else {
00799 m_myCoutStream << "\n" << recString
00800 << " Data and emulated FDL noAlgo different.";
00801 m_myCoutStream << "\n Data: noAlgo() = " << noAlgoData;
00802 m_myCoutStream << "\n Emul: noAlgo() = " << noAlgoEmul;
00803 m_myCoutStream << "\n";
00804
00805 if (matchBxInEvent && validBxInEvent) {
00806 m_fdlDataEmul[histIndex][iRec]->Fill(9);
00807 }
00808 else {
00809 m_fdlDataEmul_Err[iRec]->Fill(9);
00810 }
00811
00812 }
00813
00814
00815 const boost::uint16_t finalORData = fdlBlockData.finalOR();
00816 const boost::uint16_t finalOREmul = fdlBlockEmul.finalOR();
00817
00818 if (finalORData == finalOREmul) {
00819 m_myCoutStream << "\n" << recString
00820 << " Data and emulated FDL finalOR identical.";
00821 m_myCoutStream << "\n finalOR() = " << std::hex << "0x" << std::setw(2)
00822 << std::setfill('0') << finalORData << std::setfill(' ')
00823 << std::dec;
00824 m_myCoutStream << "\n";
00825
00826 }
00827 else {
00828 m_myCoutStream << "\n" << recString
00829 << " Data and emulated FDL finalOR different.";
00830 m_myCoutStream << "\n Data: finalOR() = " << std::hex << "0x"
00831 << std::setw(2) << std::setfill('0') << finalORData
00832 << std::setfill(' ') << std::dec;
00833 m_myCoutStream << "\n Emul: finalOR() = " << std::hex << "0x"
00834 << std::setw(2) << std::setfill('0') << finalOREmul
00835 << std::setfill(' ') << std::dec;
00836 m_myCoutStream << "\n";
00837
00838 if (matchBxInEvent && validBxInEvent) {
00839 m_fdlDataEmul[histIndex][iRec]->Fill(10);
00840 }
00841 else {
00842 m_fdlDataEmul_Err[iRec]->Fill(10);
00843 }
00844
00845 }
00846
00847
00848 const int finalORPhysData = finalORData & (1 << PhysicsPartition);
00849 const int finalORPhysEmul = finalOREmul & (1 << PhysicsPartition);
00850
00851 if (finalORPhysData == finalORPhysEmul) {
00852 m_myCoutStream << "\n" << recString
00853 << " Data and emulated FDL finalOR for the physics partition identical.";
00854 m_myCoutStream << "\n finalOR() = " << finalORPhysData;
00855 m_myCoutStream << "\n";
00856
00857 }
00858 else {
00859 m_myCoutStream << "\n" << recString
00860 << " Data and emulated FDL finalOR for the physics partition different.";
00861 m_myCoutStream << "\n Data: finalOR() = " << finalORPhysData;
00862 m_myCoutStream << "\n Emul: finalOR() = " << finalORPhysEmul;
00863 m_myCoutStream << "\n";
00864
00865 if (matchBxInEvent && validBxInEvent) {
00866 m_fdlDataEmul[histIndex][iRec]->Fill(11);
00867 }
00868 else {
00869 m_fdlDataEmul_Err[iRec]->Fill(11);
00870 }
00871
00872 }
00873
00874
00875 const boost::uint16_t localBxNrData = fdlBlockData.localBxNr();
00876 const boost::uint16_t localBxNrEmul = fdlBlockEmul.localBxNr();
00877
00878 if (localBxNrData == localBxNrEmul) {
00879 m_myCoutStream << "\n" << recString
00880 << " Data and emulated FDL localBxNr identical.";
00881 m_myCoutStream << "\n localBxNr() = " << localBxNrData;
00882 m_myCoutStream << "\n";
00883
00884 }
00885 else {
00886 m_myCoutStream << "\n" << recString
00887 << " Data and emulated FDL localBxNr different.";
00888 m_myCoutStream << "\n Data: localBxNr() = " << localBxNrData;
00889 m_myCoutStream << "\n Emul: localBxNr() = " << localBxNrEmul;
00890 m_myCoutStream << "\n";
00891
00892 if (matchBxInEvent && validBxInEvent) {
00893 m_fdlDataEmul[histIndex][iRec]->Fill(12);
00894 }
00895 else {
00896 m_fdlDataEmul_Err[iRec]->Fill(12);
00897 }
00898
00899 }
00900
00901 edm::LogInfo("L1GtDataEmulAnalyzer") << m_myCoutStream.str() << std::endl;
00902 m_myCoutStream.str("");
00903 m_myCoutStream.clear();
00904
00905 }
00906
00907
00908 void L1GtDataEmulAnalyzer::comparePSB(const edm::Event& iEvent,
00909 const edm::EventSetup& evSetup, const L1GtPsbWord& psbBlockData,
00910 const L1GtPsbWord& psbBlockEmul) {
00911
00912 if (psbBlockData == psbBlockEmul) {
00913 m_myCoutStream << "\nData and emulated PSB blocks: identical.\n";
00914 psbBlockData.print(m_myCoutStream);
00915
00916 }
00917 else {
00918 m_myCoutStream << "\nData and emulated PSB blocks: different.\n";
00919
00920 m_myCoutStream << "\nData: PSB block\n";
00921 psbBlockData.print(m_myCoutStream);
00922
00923 m_myCoutStream << "\nEmul: PSB block\n";
00924 psbBlockEmul.print(m_myCoutStream);
00925
00926 }
00927
00928 LogDebug("L1GtDataEmulAnalyzer") << m_myCoutStream.str() << std::endl;
00929
00930 m_myCoutStream.str("");
00931 m_myCoutStream.clear();
00932
00933
00934 const boost::uint16_t boardIdData = psbBlockData.boardId();
00935 const boost::uint16_t boardIdEmul = psbBlockEmul.boardId();
00936
00937 if (boardIdData == boardIdEmul) {
00938 m_myCoutStream << "\nData and emulated PSB boardId identical.";
00939 m_myCoutStream << "\n boardId() = " << std::hex << "0x" << std::setw(4)
00940 << std::setfill('0') << boardIdData << std::setfill(' ')
00941 << std::dec;
00942 m_myCoutStream << "\n";
00943
00944 }
00945 else {
00946 m_myCoutStream << "\nData and emulated PSB boardId different.";
00947 m_myCoutStream << "\n Data: boardId() = " << std::hex << "0x"
00948 << std::setw(4) << std::setfill('0') << boardIdData
00949 << std::setfill(' ') << std::dec;
00950 m_myCoutStream << "\n Emul: boardId() = " << std::hex << "0x"
00951 << std::setw(4) << std::setfill('0') << boardIdEmul
00952 << std::setfill(' ') << std::dec;
00953 m_myCoutStream << "\n";
00954
00955 }
00956
00957
00958 const int bxInEventData = psbBlockData.bxInEvent();
00959 const int bxInEventEmul = psbBlockEmul.bxInEvent();
00960
00961 if (bxInEventData == bxInEventEmul) {
00962 m_myCoutStream << "\nData and emulated PSB bxInEvent identical.";
00963 m_myCoutStream << "\n bxInEvent() = " << bxInEventData;
00964 m_myCoutStream << "\n";
00965
00966 }
00967 else {
00968 m_myCoutStream << "\nData and emulated PSB bxInEvent different.";
00969 m_myCoutStream << "\n Data: bxInEvent() = " << bxInEventData;
00970 m_myCoutStream << "\n Emul: bxInEvent() = " << bxInEventEmul;
00971 m_myCoutStream << "\n";
00972
00973 }
00974
00975
00976 const boost::uint16_t bxNrData = psbBlockData.bxNr();
00977 const boost::uint16_t bxNrEmul = psbBlockEmul.bxNr();
00978
00979 if (bxNrData == bxNrEmul) {
00980 m_myCoutStream << "\nData and emulated PSB bxNr identical.";
00981 m_myCoutStream << "\n bxNr() = " << bxNrData;
00982 m_myCoutStream << "\n";
00983
00984 }
00985 else {
00986 m_myCoutStream << "\nData and emulated PSB bxNr different.";
00987 m_myCoutStream << "\n Data: bxNr() = " << bxNrData;
00988 m_myCoutStream << "\n Emul: bxNr() = " << bxNrEmul;
00989 m_myCoutStream << "\n";
00990
00991 }
00992
00993
00994 const boost::uint32_t eventNrData = psbBlockData.eventNr();
00995 const boost::uint32_t eventNrEmul = psbBlockEmul.eventNr();
00996
00997 if (eventNrData == eventNrEmul) {
00998 m_myCoutStream << "\nData and emulated PSB eventNr identical.";
00999 m_myCoutStream << "\n eventNr() = " << eventNrData;
01000 m_myCoutStream << "\n";
01001
01002 }
01003 else {
01004 m_myCoutStream << "\nData and emulated PSB eventNr different.";
01005 m_myCoutStream << "\n Data: eventNr() = " << eventNrData;
01006 m_myCoutStream << "\n Emul: eventNr() = " << eventNrEmul;
01007 m_myCoutStream << "\n";
01008
01009 }
01010
01012 boost::uint16_t valData;
01013 boost::uint16_t valEmul;
01014
01015 for (int iA = 0; iA < psbBlockData.NumberAData; ++iA) {
01016 valData = psbBlockData.aData(iA);
01017 valEmul = psbBlockEmul.aData(iA);
01018
01019 if (valData == valEmul) {
01020 m_myCoutStream << "\nData and emulated PSB aData(" << iA
01021 << ") identical.";
01022 m_myCoutStream << "\n aData(iA) = " << std::hex << "0x"
01023 << std::setw(4) << std::setfill('0') << valData
01024 << std::setfill(' ') << std::dec;
01025 m_myCoutStream << "\n";
01026
01027 }
01028 else {
01029 m_myCoutStream << "\nData and emulated PSB aData(" << iA
01030 << ") different.";
01031 m_myCoutStream << "\n Data: aData(iA) = " << std::hex << "0x"
01032 << std::setw(4) << std::setfill('0') << valData
01033 << std::setfill(' ') << std::dec;
01034 m_myCoutStream << "\n Emul: aData(iA) = "<< std::hex << "0x"
01035 << std::setw(4) << std::setfill('0') << valEmul
01036 << std::setfill(' ') << std::dec;
01037 m_myCoutStream << "\n";
01038
01039 }
01040
01041 }
01042
01044 for (int iB = 0; iB < psbBlockData.NumberBData; ++iB) {
01045 valData = psbBlockData.bData(iB);
01046 valEmul = psbBlockEmul.bData(iB);
01047
01048 if (valData == valEmul) {
01049 m_myCoutStream << "\nData and emulated PSB bData(" << iB
01050 << ") identical.";
01051 m_myCoutStream << "\n bData(iA) = " << std::hex << "0x"
01052 << std::setw(4) << std::setfill('0') << valData
01053 << std::setfill(' ') << std::dec;
01054 m_myCoutStream << "\n";
01055
01056 }
01057 else {
01058 m_myCoutStream << "\nData and emulated PSB bData(" << iB
01059 << ") different.";
01060 m_myCoutStream << "\n Data: bData(iA) = " << std::hex << "0x"
01061 << std::setw(4) << std::setfill('0') << valData
01062 << std::setfill(' ') << std::dec;
01063 m_myCoutStream << "\n Emul: bData(iA) = "<< std::hex << "0x"
01064 << std::setw(4) << std::setfill('0') << valEmul
01065 << std::setfill(' ') << std::dec;
01066 m_myCoutStream << "\n";
01067
01068 }
01069
01070 }
01071
01072
01073 const boost::uint16_t localBxNrData = psbBlockData.localBxNr();
01074 const boost::uint16_t localBxNrEmul = psbBlockEmul.localBxNr();
01075
01076 if (localBxNrData == localBxNrEmul) {
01077 m_myCoutStream << "\nData and emulated PSB localBxNr identical.";
01078 m_myCoutStream << "\n localBxNr() = " << localBxNrData;
01079 m_myCoutStream << "\n";
01080
01081 }
01082 else {
01083 m_myCoutStream << "\nData and emulated PSB localBxNr different.";
01084 m_myCoutStream << "\n Data: localBxNr() = " << localBxNrData;
01085 m_myCoutStream << "\n Emul: localBxNr() = " << localBxNrEmul;
01086 m_myCoutStream << "\n";
01087
01088 }
01089
01090 edm::LogInfo("L1GtDataEmulAnalyzer") << m_myCoutStream.str() << std::endl;
01091 m_myCoutStream.str("");
01092 m_myCoutStream.clear();
01093
01094 }
01095
01096
01097 void L1GtDataEmulAnalyzer::compareTCS(const edm::Event& iEvent,
01098 const edm::EventSetup& evSetup, const L1TcsWord&, const L1TcsWord&) {
01099
01100 }
01101
01102
01103 void L1GtDataEmulAnalyzer::compareDaqRecord(const edm::Event& iEvent,
01104 const edm::EventSetup& evSetup) {
01105
01106
01107 int iRec = 0;
01108
01109
01110 edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecordData;
01111 iEvent.getByLabel(m_l1GtDataInputTag, gtReadoutRecordData);
01112
01113 bool validData = false;
01114
01115 if (!gtReadoutRecordData.isValid()) {
01116 m_nrDataEventError++;
01117 }
01118 else {
01119 validData = true;
01120 }
01121
01122
01123 edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecordEmul;
01124 iEvent.getByLabel(m_l1GtEmulInputTag, gtReadoutRecordEmul);
01125
01126 bool validEmul = false;
01127
01128 if (!gtReadoutRecordEmul.isValid()) {
01129 m_nrEmulEventError++;
01130 }
01131 else {
01132 validEmul = true;
01133 }
01134
01135 if ((!validData) || (!validEmul)) {
01136 edm::LogWarning("L1GtDataEmulAnalyzer") << "\n Valid data:"
01137 << validData << "\n Valid emulator:" << validEmul << std::endl;
01138 }
01139
01140
01141 const L1GtfeWord& gtfeBlockData = gtReadoutRecordData->gtfeWord();
01142 const L1GtfeWord& gtfeBlockEmul = gtReadoutRecordEmul->gtfeWord();
01143
01144 compareGTFE(iEvent, evSetup, gtfeBlockData, gtfeBlockEmul);
01145
01146
01147 const std::vector<L1GtFdlWord>& gtFdlVectorData =
01148 gtReadoutRecordData->gtFdlVector();
01149 const std::vector<L1GtFdlWord>& gtFdlVectorEmul =
01150 gtReadoutRecordEmul->gtFdlVector();
01151
01152 int gtFdlVectorDataSize = gtFdlVectorData.size();
01153 int gtFdlVectorEmulSize = gtFdlVectorEmul.size();
01154
01155 if (gtFdlVectorDataSize == gtFdlVectorEmulSize) {
01156 m_myCoutStream << "\nData and emulated FDL vector size: identical.\n";
01157 m_myCoutStream << " Size: " << gtFdlVectorDataSize << std::endl;
01158
01159 for (int iFdl = 0; iFdl < gtFdlVectorDataSize; ++iFdl) {
01160
01161 const L1GtFdlWord& fdlBlockData = gtFdlVectorData[iFdl];
01162 const L1GtFdlWord& fdlBlockEmul = gtFdlVectorEmul[iFdl];
01163
01164 compareFDL(iEvent, evSetup, fdlBlockData, fdlBlockEmul, iRec);
01165 }
01166 }
01167 else {
01168 m_myCoutStream << "\nData and emulated FDL vector size: different.\n";
01169 m_myCoutStream << " Data: size = " << gtFdlVectorDataSize << std::endl;
01170 m_myCoutStream << " Emul: size = " << gtFdlVectorEmulSize << std::endl;
01171
01172 }
01173
01174 LogDebug("L1GtDataEmulAnalyzer") << m_myCoutStream.str() << std::endl;
01175
01176 m_myCoutStream.str("");
01177 m_myCoutStream.clear();
01178
01179
01180 const std::vector<L1GtPsbWord>& gtPsbVectorData =
01181 gtReadoutRecordData->gtPsbVector();
01182 const std::vector<L1GtPsbWord>& gtPsbVectorEmul =
01183 gtReadoutRecordEmul->gtPsbVector();
01184
01185 int gtPsbVectorDataSize = gtPsbVectorData.size();
01186 int gtPsbVectorEmulSize = gtPsbVectorEmul.size();
01187
01188 if (gtPsbVectorDataSize == gtPsbVectorEmulSize) {
01189 m_myCoutStream << "\nData and emulated PSB vector size: identical.\n";
01190 m_myCoutStream << " Size: " << gtPsbVectorDataSize << std::endl;
01191 }
01192 else {
01193 m_myCoutStream << "\nData and emulated PSB vector size: different.\n";
01194 m_myCoutStream << " Data: size = " << gtPsbVectorDataSize << std::endl;
01195 m_myCoutStream << " Emul: size = " << gtPsbVectorEmulSize << std::endl;
01196
01197 }
01198
01199
01200
01201
01202 for (int iPsb = 0; iPsb < gtPsbVectorDataSize; ++iPsb) {
01203
01204 const L1GtPsbWord& psbBlockData = gtPsbVectorData[iPsb];
01205 const boost::uint16_t boardIdData = psbBlockData.boardId();
01206 const int bxInEventData = psbBlockData.bxInEvent();
01207
01208
01209
01210
01211 bool foundPSB = false;
01212
01213 for (int iPsbF = 0; iPsbF < gtPsbVectorEmulSize; ++iPsbF) {
01214
01215 const L1GtPsbWord& psbBlockEmul = gtPsbVectorEmul[iPsbF];
01216 const boost::uint16_t boardIdEmul = psbBlockEmul.boardId();
01217 const int bxInEventEmul = psbBlockEmul.bxInEvent();
01218
01219 if ((boardIdEmul == boardIdData)
01220 && (bxInEventData == bxInEventEmul)) {
01221
01222 foundPSB = true;
01223
01224
01225 comparePSB(iEvent, evSetup, psbBlockData, psbBlockEmul);
01226 }
01227
01228 }
01229
01230 if (!foundPSB) {
01231 m_myCoutStream << "\nNo emulated PSB with boardId() = " << std::hex
01232 << "0x" << std::setw(4) << std::setfill('0') << boardIdData
01233 << std::setfill(' ') << std::dec << " and BxInEvent = "
01234 << bxInEventData << " was found";
01235
01236 }
01237
01238 }
01239
01240 edm::LogInfo("L1GtDataEmulAnalyzer") << m_myCoutStream.str() << std::endl;
01241
01242 m_myCoutStream.str("");
01243 m_myCoutStream.clear();
01244
01245 }
01246
01247
01248 void L1GtDataEmulAnalyzer::compareEvmRecord(const edm::Event& iEvent,
01249 const edm::EventSetup&) {
01250
01251
01252
01253 }
01254
01255
01256
01257 void L1GtDataEmulAnalyzer::compareGt_Gct(const edm::Event& iEvent,
01258 const edm::EventSetup&) {
01259
01260
01261
01262 }
01263
01264
01265 void L1GtDataEmulAnalyzer::analyze(const edm::Event& iEvent,
01266 const edm::EventSetup& evSetup) {
01267
01268
01269 compareDaqRecord(iEvent, evSetup);
01270
01271
01272 compareEvmRecord(iEvent, evSetup);
01273
01274
01275 compareGt_Gct(iEvent, evSetup);
01276
01277 }
01278
01279
01280 void L1GtDataEmulAnalyzer::bookHistograms() {
01281
01282 edm::Service<TFileService> histServ;
01283
01284
01285
01286
01287 TFileDirectory gtfeHist = histServ->mkdir("GTFE");
01288 m_gtfeDataEmul = gtfeHist.make<TH1F>("gtfeDataEmul", "GTFE data vs emul",
01289 6, 0., 6.);
01290 m_gtfeDataEmul->GetXaxis()->SetBinLabel(1, "BoardId");
01291 m_gtfeDataEmul->GetXaxis()->SetBinLabel(2, "RecordLength");
01292 m_gtfeDataEmul->GetXaxis()->SetBinLabel(3, "BxNr");
01293 m_gtfeDataEmul->GetXaxis()->SetBinLabel(4, "SetupVersion");
01294 m_gtfeDataEmul->GetXaxis()->SetBinLabel(5, "DaqActiveBoards");
01295 m_gtfeDataEmul->GetXaxis()->SetBinLabel(6, "TotalTriggerNr");
01296
01297
01298
01299 TFileDirectory fdlHist = histServ->mkdir("FDL");
01300
01301 const unsigned int numberTechTriggers =
01302 L1GlobalTriggerReadoutSetup::NumberTechnicalTriggers;
01303
01304 const unsigned int numberAlgoTriggers =
01305 L1GlobalTriggerReadoutSetup::NumberPhysTriggers;
01306
01307 for (int iRec = 0; iRec < 2; ++iRec) {
01308
01309 std::string recString;
01310 if (iRec == 0) {
01311 recString = "Daq";
01312 }
01313 else {
01314 recString = "Evm";
01315 }
01316
01317 std::string hName;
01318 const char* histName;
01319
01320 for (int iHist = 0; iHist < TotalBxInEvent; ++iHist) {
01321
01322
01323 int iIndex = iHist - ((TotalBxInEvent + 1)/2 -1);
01324 int hIndex = (iIndex + 16)%16;
01325
01326 std::stringstream ss;
01327 std::string str;
01328 ss << std::uppercase << std::hex << hIndex;
01329 ss >> str;
01330
01331 hName = recString + "FdlDataEmul_" + str;
01332 histName = hName.c_str();
01333
01334 std::string hTitle = "FDL data vs emul mismatch for BxInEvent = "
01335 + str;
01336 const char* histTitle = hTitle.c_str();
01337
01338
01339
01340 m_fdlDataEmul[iHist][iRec] = fdlHist.make<TH1F>(histName, histTitle,
01341 13, 0., 13.);
01342 m_fdlDataEmul[iHist][iRec]->GetXaxis()->SetBinLabel(1, "BoardId");
01343 m_fdlDataEmul[iHist][iRec]->GetXaxis()->SetBinLabel(2, "BxInEvent");
01344 m_fdlDataEmul[iHist][iRec]->GetXaxis()->SetBinLabel(3, "BxNr");
01345 m_fdlDataEmul[iHist][iRec]->GetXaxis()->SetBinLabel(4, "EventNr");
01346 m_fdlDataEmul[iHist][iRec]->GetXaxis()->SetBinLabel(5, "TechTrigger");
01347 m_fdlDataEmul[iHist][iRec]->GetXaxis()->SetBinLabel(6, "TechTriggerMask");
01348 m_fdlDataEmul[iHist][iRec]->GetXaxis()->SetBinLabel(7, "AlgoTrigger");
01349 m_fdlDataEmul[iHist][iRec]->GetXaxis()->SetBinLabel(8, "AlgoTriggerMask");
01350 m_fdlDataEmul[iHist][iRec]->GetXaxis()->SetBinLabel(9, "AlgoExtend");
01351 m_fdlDataEmul[iHist][iRec]->GetXaxis()->SetBinLabel(10, "NoAlgo");
01352 m_fdlDataEmul[iHist][iRec]->GetXaxis()->SetBinLabel(11, "FinalORAllParts");
01353 m_fdlDataEmul[iHist][iRec]->GetXaxis()->SetBinLabel(12, "FinalORPhysPart");
01354 m_fdlDataEmul[iHist][iRec]->GetXaxis()->SetBinLabel(13, "LocalBxNr");
01355
01356
01357
01358 hName = recString + "FdlDataAlgoDecision_" + str;
01359 histName = hName.c_str();
01360
01361 hTitle = "Data: algorithm decision word for BxInEvent = " + str;
01362 histTitle = hTitle.c_str();
01363
01364 m_fdlDataAlgoDecision[iHist][iRec] = fdlHist.make<TH1F>(histName,
01365 histTitle, numberAlgoTriggers, 0., numberAlgoTriggers);
01366
01367
01368 hName = recString + "FdlEmulAlgoDecision_" + str;
01369 histName = hName.c_str();
01370
01371 hTitle = "Emul: algorithm decision word for BxInEvent = " + str;
01372 histTitle = hTitle.c_str();
01373
01374 m_fdlEmulAlgoDecision[iHist][iRec] = fdlHist.make<TH1F>(histName,
01375 histTitle, numberAlgoTriggers, 0., numberAlgoTriggers);
01376
01377
01378
01379 hName = recString + "FdlDataAlgoDecisionMask_" + str;
01380 histName = hName.c_str();
01381
01382 hTitle
01383 = "Data, physics partition: algorithm decision word after mask for BxInEvent = "
01384 + str;
01385 histTitle = hTitle.c_str();
01386
01387 m_fdlDataAlgoDecisionMask[iHist][iRec] = fdlHist.make<TH1F>(histName,
01388 histTitle, numberAlgoTriggers, 0., numberAlgoTriggers);
01389
01390
01391 hName = recString + "FdlEmulAlgoDecisionMask_" + str;
01392 histName = hName.c_str();
01393
01394 hTitle
01395 = "Emul, physics partition: algorithm decision word after mask for BxInEvent = "
01396 + str;
01397 histTitle = hTitle.c_str();
01398
01399 m_fdlEmulAlgoDecisionMask[iHist][iRec] = fdlHist.make<TH1F>(histName,
01400 histTitle, numberAlgoTriggers, 0., numberAlgoTriggers);
01401
01402
01403 hName = recString + "FdlDataEmulAlgoDecision_" + str;
01404 histName = hName.c_str();
01405
01406 hTitle
01407 = "Data vs emul: non-matching algorithm decision word for BxInEvent = "
01408 + str;
01409 histTitle = hTitle.c_str();
01410
01411 m_fdlDataEmulAlgoDecision[iHist][iRec] = fdlHist.make<TH1F>(
01412 histName, histTitle, numberAlgoTriggers, 0.,
01413 numberAlgoTriggers);
01414
01415
01416 hName = recString + "FdlDataEmulAlgoDecisionMask_" + str;
01417 histName = hName.c_str();
01418
01419 hTitle
01420 = "Data vs emul, physics partition: non-matching algorithm decision word after mask for BxInEvent = "
01421 + str;
01422 histTitle = hTitle.c_str();
01423
01424 m_fdlDataEmulAlgoDecisionMask[iHist][iRec] = fdlHist.make<TH1F>(
01425 histName, histTitle, numberAlgoTriggers, 0.,
01426 numberAlgoTriggers);
01427
01428
01429
01430 hName = recString + "FdlDataTechDecision_" + str;
01431 histName = hName.c_str();
01432
01433 hTitle = "Data technical trigger decision word for BxInEvent = "
01434 + str;
01435 histTitle = hTitle.c_str();
01436
01437 m_fdlDataTechDecision[iHist][iRec] = fdlHist.make<TH1F>(histName,
01438 histTitle, numberTechTriggers, 0., numberTechTriggers);
01439
01440
01441 hName = recString + "FdlEmulTechDecision_" + str;
01442 histName = hName.c_str();
01443
01444 hTitle = "Emul: technical trigger decision word for BxInEvent = "
01445 + str;
01446 histTitle = hTitle.c_str();
01447
01448 m_fdlEmulTechDecision[iHist][iRec] = fdlHist.make<TH1F>(histName,
01449 histTitle, numberTechTriggers, 0., numberTechTriggers);
01450
01451
01452 hName = recString + "FdlDataTechDecisionMask_" + str;
01453 histName = hName.c_str();
01454
01455 hTitle
01456 = "Data technical trigger decision word after mask for BxInEvent = "
01457 + str;
01458 histTitle = hTitle.c_str();
01459
01460 m_fdlDataTechDecisionMask[iHist][iRec] = fdlHist.make<TH1F>(histName,
01461 histTitle, numberTechTriggers, 0., numberTechTriggers);
01462
01463
01464 hName = recString + "FdlEmulTechDecisionMask_" + str;
01465 histName = hName.c_str();
01466
01467 hTitle
01468 = "Emul: technical trigger decision word after mask for BxInEvent = "
01469 + str;
01470 histTitle = hTitle.c_str();
01471
01472 m_fdlEmulTechDecisionMask[iHist][iRec] = fdlHist.make<TH1F>(histName,
01473 histTitle, numberTechTriggers, 0., numberTechTriggers);
01474
01475
01476 hName = recString + "FdlDataEmulTechDecision_" + str;
01477 histName = hName.c_str();
01478
01479 hTitle
01480 = "Data vs emul: non-matching technical trigger decision word for BxInEvent = "
01481 + str;
01482 histTitle = hTitle.c_str();
01483
01484 m_fdlDataEmulTechDecision[iHist][iRec] = fdlHist.make<TH1F>(
01485 histName, histTitle, numberTechTriggers, 0.,
01486 numberTechTriggers);
01487
01488 hName = recString + "FdlDataEmulTechDecisionMask_" + str;
01489 histName = hName.c_str();
01490
01491 hTitle
01492 = "Data vs emul: non-matching technical trigger decision word after mask for BxInEvent = "
01493 + str;
01494 histTitle = hTitle.c_str();
01495
01496 m_fdlDataEmulTechDecisionMask[iHist][iRec] = fdlHist.make<TH1F>(
01497 histName, histTitle, numberTechTriggers, 0.,
01498 numberTechTriggers);
01499
01500 }
01501
01502 hName = recString + "FdlDataEmul_Err";
01503 histName = hName.c_str();
01504
01505 m_fdlDataEmul_Err[iRec] = fdlHist.make<TH1F>(histName,
01506 "FDL data vs emul: non-matching BxInEvent", 13, 0., 13.);
01507 m_fdlDataEmul_Err[iRec]->GetXaxis()->SetBinLabel(1, "BoardId");
01508 m_fdlDataEmul_Err[iRec]->GetXaxis()->SetBinLabel(2, "BxInEvent");
01509 m_fdlDataEmul_Err[iRec]->GetXaxis()->SetBinLabel(3, "BxNr");
01510 m_fdlDataEmul_Err[iRec]->GetXaxis()->SetBinLabel(4, "EventNr");
01511 m_fdlDataEmul_Err[iRec]->GetXaxis()->SetBinLabel(5, "TechTrigger");
01512 m_fdlDataEmul_Err[iRec]->GetXaxis()->SetBinLabel(6, "TechTriggerMask");
01513 m_fdlDataEmul_Err[iRec]->GetXaxis()->SetBinLabel(7, "AlgoTrigger");
01514 m_fdlDataEmul_Err[iRec]->GetXaxis()->SetBinLabel(8, "AlgoTriggerMask");
01515 m_fdlDataEmul_Err[iRec]->GetXaxis()->SetBinLabel(9, "AlgoExtend");
01516 m_fdlDataEmul_Err[iRec]->GetXaxis()->SetBinLabel(10, "NoAlgo");
01517 m_fdlDataEmul_Err[iRec]->GetXaxis()->SetBinLabel(11, "FinalORAllParts");
01518 m_fdlDataEmul_Err[iRec]->GetXaxis()->SetBinLabel(12, "FinalORPhysPart");
01519 m_fdlDataEmul_Err[iRec]->GetXaxis()->SetBinLabel(13, "LocalBxNr");
01520
01521 hName = recString + "FdlDataAlgoDecision_Err";
01522 histName = hName.c_str();
01523
01524 m_fdlDataAlgoDecision_Err[iRec]
01525 = fdlHist.make<TH1F>(
01526 histName,
01527 "Data: algorithm trigger decision word, non-matching BxInEvent",
01528 numberAlgoTriggers, 0., numberAlgoTriggers);
01529
01530
01531 hName = recString + "FdlEmulAlgoDecision_Err";
01532 histName = hName.c_str();
01533
01534 m_fdlEmulAlgoDecision_Err[iRec]
01535 = fdlHist.make<TH1F>(
01536 histName,
01537 "Emul: algorithm trigger decision word, non-matching BxInEvent",
01538 numberAlgoTriggers, 0., numberAlgoTriggers);
01539
01540 hName = recString + "FdlDataEmulAlgoDecision_Err";
01541 histName = hName.c_str();
01542
01543 m_fdlDataEmulAlgoDecision_Err[iRec]
01544 = fdlHist.make<TH1F>(
01545 histName,
01546 "Data vs emul: algorithm trigger decision word, non-matching BxInEvent",
01547 numberAlgoTriggers, 0., numberAlgoTriggers);
01548
01549
01550 hName = recString + "FdlDataTechDecision_Err";
01551 histName = hName.c_str();
01552
01553 m_fdlDataTechDecision_Err[iRec]
01554 = fdlHist.make<TH1F>(
01555 histName,
01556 "Data: technical trigger decision word, non-matching BxInEvent",
01557 numberTechTriggers, 0., numberTechTriggers);
01558
01559 hName = recString + "FdlEmulTechDecision_Err";
01560 histName = hName.c_str();
01561
01562 m_fdlEmulTechDecision_Err[iRec]
01563 = fdlHist.make<TH1F>(
01564 histName,
01565 "Emul: technical trigger decision word, non-matching BxInEvent",
01566 numberTechTriggers, 0., numberTechTriggers);
01567
01568 hName = recString + "FdlDataEmulTechDecision_Err";
01569 histName = hName.c_str();
01570
01571 m_fdlDataEmulTechDecision_Err[iRec]
01572 = fdlHist.make<TH1F>(
01573 histName,
01574 "Data vs emul: technical trigger decision word, non-matching BxInEvent",
01575 numberTechTriggers, 0., numberTechTriggers);
01576
01577 }
01578 }
01579
01580
01581 void L1GtDataEmulAnalyzer::endJob() {
01582
01583
01584
01585 }
01586