00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include "DQM/DTMonitorModule/interface/DTDataIntegrityTask.h"
00011 #include "FWCore/Framework/interface/Frameworkfwd.h"
00012 #include "FWCore/Framework/interface/Event.h"
00013 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00014 #include "EventFilter/DTRawToDigi/interface/DTDataMonitorInterface.h"
00015 #include "EventFilter/DTRawToDigi/interface/DTControlData.h"
00016 #include "EventFilter/DTRawToDigi/interface/DTDDUWords.h"
00017 #include "DQMServices/Core/interface/DQMStore.h"
00018 #include "DQMServices/Core/interface/MonitorElement.h"
00019 #include <DQM/DTMonitorModule/interface/DTTimeEvolutionHisto.h>
00020 #include "FWCore/ServiceRegistry/interface/Service.h"
00021 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00022 #include "DataFormats/FEDRawData/interface/FEDNumbering.h"
00023 #include "FWCore/Utilities/interface/Exception.h"
00024
00025 #include <math.h>
00026 #include <fstream>
00027 #include <map>
00028 #include <string>
00029 #include <vector>
00030
00031 using namespace std;
00032 using namespace edm;
00033 int FirstRos=0,nevents=0,n,m;
00034 const unsigned long long max_bx = 59793997824ULL;
00035 #include "ROSDebugUtility.h"
00036
00037 DTDataIntegrityTask::DTDataIntegrityTask(const edm::ParameterSet& ps,edm::ActivityRegistry& reg) : nevents(0) , dbe(0) {
00038
00039
00040
00041 reg.watchPreBeginLumi(this,&DTDataIntegrityTask::preBeginLumi);
00042 reg.watchPreEndLumi(this,&DTDataIntegrityTask::preEndLumi);
00043
00044 reg.watchPostBeginJob(this,&DTDataIntegrityTask::postBeginJob);
00045 reg.watchPreProcessEvent(this,&DTDataIntegrityTask::preProcessEvent);
00046
00047 LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
00048 << "[DTDataIntegrityTask]: Constructor" <<endl;
00049
00050 neventsDDU = 0;
00051 neventsROS25 = 0;
00052
00053
00054
00055
00056 getSCInfo = ps.getUntrackedParameter<bool>("getSCInfo", false);
00057
00058 fedIntegrityFolder = ps.getUntrackedParameter<string>("fedIntegrityFolder","DT/FEDIntegrity");
00059
00060 string processingMode = ps.getUntrackedParameter<string>("processingMode","Online");
00061
00062
00063 if (processingMode == "Online") {
00064 mode = 0;
00065 } else if(processingMode == "SM") {
00066 mode = 1;
00067 } else if (processingMode == "Offline") {
00068 mode = 2;
00069 } else if (processingMode == "HLT") {
00070 mode = 3;
00071 } else {
00072 throw cms::Exception("MissingParameter")
00073 << "[DTDataIntegrityTask]: processingMode :" << processingMode
00074 << " invalid! Must be Online, SM, Offline or HLT !" << endl;
00075 }
00076
00077 }
00078
00079
00080
00081 DTDataIntegrityTask::~DTDataIntegrityTask() {
00082 LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
00083 <<"[DTDataIntegrityTask]: Destructor. Analyzed "<< neventsDDU <<" events"<<endl;
00084 }
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097 void DTDataIntegrityTask::postEndJob(){
00098 LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
00099 << "[DTDataIntegrityTask]: postEndJob called!" <<endl;
00100
00101
00102
00103 }
00104
00105
00106 void DTDataIntegrityTask::bookHistos(const int fedMin, const int fedMax) {
00107
00108 dbe->setCurrentFolder("DT/EventInfo/Counters");
00109 nEventMonitor = dbe->bookFloat("nProcessedEventsDataIntegrity");
00110
00111
00112 dbe->setCurrentFolder(topFolder(true));
00113
00114 int nFED = (fedMax - fedMin)+1;
00115
00116 hFEDEntry = dbe->book1D("FEDEntries","# entries per DT FED",nFED,fedMin,fedMax+1);
00117 hFEDFatal = dbe->book1D("FEDFatal","# fatal errors DT FED",nFED,fedMin,fedMax+1);
00118 hFEDNonFatal = dbe->book1D("FEDNonFatal","# NON fatal errors DT FED",nFED,fedMin,fedMax+1);
00119
00120
00121 dbe->setCurrentFolder(topFolder(false));
00122 hTTSSummary = dbe->book2D("TTSSummary","Summary Status TTS",nFED,fedMin,fedMax+1,9,1,10);
00123 hTTSSummary->setAxisTitle("FED",1);
00124 hTTSSummary->setBinLabel(1,"ROS PAF",2);
00125 hTTSSummary->setBinLabel(2,"DDU PAF",2);
00126 hTTSSummary->setBinLabel(3,"ROS PAF",2);
00127 hTTSSummary->setBinLabel(4,"DDU PAF",2);
00128 hTTSSummary->setBinLabel(5,"DDU Full",2);
00129 hTTSSummary->setBinLabel(6,"L1A Mism.",2);
00130 hTTSSummary->setBinLabel(7,"ROS Error",2);
00131 hTTSSummary->setBinLabel(8,"BX Mism.",2);
00132 hTTSSummary->setBinLabel(9,"DDU Logic Err.",2);
00133
00134
00135
00136 hCorruptionSummary = dbe->book2D("DataCorruptionSummary", "Data Corruption Sources",
00137 nFED,fedMin,fedMax+1, 8, 1, 9);
00138 hCorruptionSummary->setAxisTitle("FED",1);
00139 hCorruptionSummary->setBinLabel(1,"Miss Ch.",2);
00140 hCorruptionSummary->setBinLabel(2,"ROS BX mism",2);
00141 hCorruptionSummary->setBinLabel(3,"DDU BX mism",2);
00142 hCorruptionSummary->setBinLabel(4,"ROS L1A mism",2);
00143 hCorruptionSummary->setBinLabel(5,"Miss Payload",2);
00144 hCorruptionSummary->setBinLabel(6,"FCRC bit",2);
00145 hCorruptionSummary->setBinLabel(7,"Header check",2);
00146 hCorruptionSummary->setBinLabel(8,"Triler Check",2);
00147
00148 }
00149
00150
00151
00152 void DTDataIntegrityTask::bookHistos(string folder, DTROChainCoding code) {
00153
00154 stringstream dduID_s; dduID_s << code.getDDU();
00155 stringstream rosID_s; rosID_s << code.getROS();
00156 stringstream robID_s; robID_s << code.getROB();
00157 int wheel = (code.getDDUID() - 770)%5 - 2;
00158 stringstream wheel_s; wheel_s << wheel;
00159
00160 LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
00161 << " Booking histos for FED: " << code.getDDU() << " ROS: " << code.getROS()
00162 << " ROB: " << code.getROB() << " folder: " << folder << endl;
00163
00164 string histoType;
00165 string histoName;
00166 string histoTitle;
00167 MonitorElement* histo = 0;
00168
00169
00170 if (folder == "DDU") {
00171
00172 dbe->setCurrentFolder(topFolder(false) + "FED" + dduID_s.str());
00173
00174 histoType = "EventLenght";
00175 histoName = "FED" + dduID_s.str() + "_" + histoType;
00176 histoTitle = "Event Lenght (Bytes) FED " + dduID_s.str();
00177 (dduHistos[histoType])[code.getDDUID()] = dbe->book1D(histoName,histoTitle,501,0,16032);
00178
00179 if(mode > 2) return;
00180
00181 histoType = "ROSStatus";
00182 histoName = "FED" + dduID_s.str() + "_" + histoType;
00183 (dduHistos[histoType])[code.getDDUID()] = dbe->book2D(histoName,histoName,12,0,12,12,0,12);
00184 histo = (dduHistos[histoType])[code.getDDUID()];
00185 histo->setBinLabel(1,"ch.enabled",1);
00186 histo->setBinLabel(2,"timeout",1);
00187 histo->setBinLabel(3,"ev.trailer lost",1);
00188 histo->setBinLabel(4,"opt.fiber lost",1);
00189 histo->setBinLabel(5,"tlk.prop.error",1);
00190 histo->setBinLabel(6,"tlk.pattern error",1);
00191 histo->setBinLabel(7,"tlk.sign.lost",1);
00192 histo->setBinLabel(8,"error from ROS",1);
00193 histo->setBinLabel(9,"if ROS in events",1);
00194 histo->setBinLabel(10,"Miss. Evt.",1);
00195 histo->setBinLabel(11,"Evt. ID Mismatch",1);
00196 histo->setBinLabel(12,"BX Mismatch",1);
00197
00198 histo->setBinLabel(1,"ROS 1",2);
00199 histo->setBinLabel(2,"ROS 2",2);
00200 histo->setBinLabel(3,"ROS 3",2);
00201 histo->setBinLabel(4,"ROS 4",2);
00202 histo->setBinLabel(5,"ROS 5",2);
00203 histo->setBinLabel(6,"ROS 6",2);
00204 histo->setBinLabel(7,"ROS 7",2);
00205 histo->setBinLabel(8,"ROS 8",2);
00206 histo->setBinLabel(9,"ROS 9",2);
00207 histo->setBinLabel(10,"ROS 10",2);
00208 histo->setBinLabel(11,"ROS 11",2);
00209 histo->setBinLabel(12,"ROS 12",2);
00210
00211 if(mode > 1) return;
00212
00213 histoType = "FEDAvgEvLenghtvsLumi";
00214 histoName = "FED" + dduID_s.str() + "_" + histoType;
00215 histoTitle = "Avg Event Lenght (Bytes) vs LumiSec FED " + dduID_s.str();
00216 dduTimeHistos[histoType][code.getDDUID()] = new DTTimeEvolutionHisto(dbe,histoName,histoTitle,200,10,true,0);
00217
00218 histoType = "TTSValues";
00219 histoName = "FED" + dduID_s.str() + "_" + histoType;
00220 (dduHistos[histoType])[code.getDDUID()] = dbe->book1D(histoName,histoName,8,0,8);
00221 histo = (dduHistos[histoType])[code.getDDUID()];
00222 histo->setBinLabel(1,"disconnected",1);
00223 histo->setBinLabel(2,"warning overflow",1);
00224 histo->setBinLabel(3,"out of synch",1);
00225 histo->setBinLabel(4,"busy",1);
00226 histo->setBinLabel(5,"ready",1);
00227 histo->setBinLabel(6,"error",1);
00228 histo->setBinLabel(7,"disconnected",1);
00229 histo->setBinLabel(8,"unknown",1);
00230
00231 histoType = "EventType";
00232 histoName = "FED" + dduID_s.str() + "_" + histoType;
00233 (dduHistos[histoType])[code.getDDUID()] = dbe->book1D(histoName,histoName,2,1,3);
00234 histo = (dduHistos[histoType])[code.getDDUID()];
00235 histo->setBinLabel(1,"physics",1);
00236 histo->setBinLabel(2,"calibration",1);
00237
00238 histoType = "ROSList";
00239 histoName = "FED" + dduID_s.str() + "_" + histoType;
00240 histoTitle = "# of ROS in the FED payload (FED" + dduID_s.str() + ")";
00241 (dduHistos[histoType])[code.getDDUID()] = dbe->book1D(histoName,histoTitle,13,0,13);
00242
00243 histoType = "FIFOStatus";
00244 histoName = "FED" + dduID_s.str() + "_" + histoType;
00245 (dduHistos[histoType])[code.getDDUID()] = dbe->book2D(histoName,histoName,7,0,7,3,0,3);
00246 histo = (dduHistos[histoType])[code.getDDUID()];
00247 histo->setBinLabel(1,"Input ch1-4",1);
00248 histo->setBinLabel(2,"Input ch5-8",1);
00249 histo->setBinLabel(3,"Input ch9-12",1);
00250 histo->setBinLabel(4,"Error/L1A ch1-4",1);
00251 histo->setBinLabel(5,"Error/L1A ch5-8",1);
00252 histo->setBinLabel(6,"Error/L1A ch9-12",1);
00253 histo->setBinLabel(7,"Output",1);
00254 histo->setBinLabel(1,"Full",2);
00255 histo->setBinLabel(2,"Almost Full",2);
00256 histo->setBinLabel(3,"Not Full",2);
00257
00258 histoType = "BXID";
00259 histoName = "FED" + dduID_s.str() + "_BXID";
00260 histoTitle = "Distrib. BX ID (FED" + dduID_s.str() + ")";
00261 (dduHistos[histoType])[code.getDDUID()] = dbe->book1D(histoName,histoTitle,3600,0,3600);
00262
00263 }
00264
00265
00266 if ( folder == "ROS_S" ) {
00267 dbe->setCurrentFolder(topFolder(false));
00268
00269 histoType = "ROSSummary";
00270 histoName = "FED" + dduID_s.str() + "_ROSSummary";
00271 string histoTitle = "Summary Wheel" + wheel_s.str() + " (FED " + dduID_s.str() + ")";
00272
00273 ((rosSHistos[histoType])[code.getDDUID()]) = dbe->book2D(histoName,histoTitle,20,0,20,12,1,13);
00274 MonitorElement *histo = ((rosSHistos[histoType])[code.getDDUID()]);
00275
00276 histo ->setBinLabel(1,"Link TimeOut",1);
00277 histo ->setBinLabel(2,"Ev.Id.Mis.",1);
00278 histo ->setBinLabel(3,"FIFO almost full",1);
00279 histo ->setBinLabel(4,"FIFO full",1);
00280 histo ->setBinLabel(5,"CEROS timeout",1);
00281 histo ->setBinLabel(6,"Max. wds",1);
00282 histo ->setBinLabel(7,"WO L1A FIFO",1);
00283 histo ->setBinLabel(8,"TDC parity err.",1);
00284 histo ->setBinLabel(9,"BX ID Mis.",1);
00285 histo ->setBinLabel(10,"TXP",1);
00286 histo ->setBinLabel(11,"L1A almost full",1);
00287 histo ->setBinLabel(12,"Ch. blocked",1);
00288 histo ->setBinLabel(13,"Ev. Id. Mis.",1);
00289 histo ->setBinLabel(14,"CEROS blocked",1);
00290
00291 histo ->setBinLabel(15,"TDC Fatal",1);
00292 histo ->setBinLabel(16,"TDC RO FIFO ov.",1);
00293 histo ->setBinLabel(17,"TDC L1 buf. ov.",1);
00294 histo ->setBinLabel(18,"TDC L1A FIFO ov.",1);
00295 histo ->setBinLabel(19,"TDC hit err.",1);
00296 histo ->setBinLabel(20,"TDC hit rej.",1);
00297
00298 histo ->setBinLabel(1,"ROS1",2);
00299 histo ->setBinLabel(2,"ROS2",2);
00300 histo ->setBinLabel(3,"ROS3",2);
00301 histo ->setBinLabel(4,"ROS4",2);
00302 histo ->setBinLabel(5,"ROS5",2);
00303 histo ->setBinLabel(6,"ROS6",2);
00304 histo ->setBinLabel(7,"ROS7",2);
00305 histo ->setBinLabel(8,"ROS8",2);
00306 histo ->setBinLabel(9,"ROS9",2);
00307 histo ->setBinLabel(10,"ROS10",2);
00308 histo ->setBinLabel(11,"ROS11",2);
00309 histo ->setBinLabel(12,"ROS12",2);
00310 }
00311
00312 if ( folder == "ROS" ) {
00313 dbe->setCurrentFolder(topFolder(false) + "FED" + dduID_s.str() + "/" + folder + rosID_s.str());
00314
00315
00316 histoType = "ROSError";
00317 histoName = "FED" + dduID_s.str() + "_" + folder + rosID_s.str() + "_ROSError";
00318 histoTitle = histoName + " (ROBID error summary)";
00319 if(mode <= 1)
00320 (rosHistos[histoType])[code.getROSID()] = dbe->book2D(histoName,histoTitle,17,0,17,26,0,26);
00321 else
00322 (rosHistos[histoType])[code.getROSID()] = dbe->book2D(histoName,histoTitle,11,0,11,26,0,26);
00323
00324 MonitorElement* histo = (rosHistos[histoType])[code.getROSID()];
00325
00326 histo->setBinLabel(1,"Link TimeOut",1);
00327 histo->setBinLabel(2,"Ev.Id.Mis.",1);
00328 histo->setBinLabel(3,"FIFO almost full",1);
00329 histo->setBinLabel(4,"FIFO full",1);
00330 histo->setBinLabel(5,"CEROS timeout",1);
00331 histo->setBinLabel(6,"Max. wds",1);
00332 histo->setBinLabel(7,"TDC parity err.",1);
00333 histo->setBinLabel(8,"BX ID Mis.",1);
00334 histo->setBinLabel(9,"Ch. blocked",1);
00335 histo->setBinLabel(10,"Ev. Id. Mis.",1);
00336 histo->setBinLabel(11,"CEROS blocked",1);
00337 if(mode <= 1) {
00338
00339 histo->setBinLabel(12,"TDC Fatal",1);
00340 histo->setBinLabel(13,"TDC RO FIFO ov.",1);
00341 histo->setBinLabel(14,"TDC L1 buf. ov.",1);
00342 histo->setBinLabel(15,"TDC L1A FIFO ov.",1);
00343 histo->setBinLabel(16,"TDC hit err.",1);
00344 histo->setBinLabel(17,"TDC hit rej.",1);
00345 }
00346 histo->setBinLabel(1,"ROB0",2);
00347 histo->setBinLabel(2,"ROB1",2);
00348 histo->setBinLabel(3,"ROB2",2);
00349 histo->setBinLabel(4,"ROB3",2);
00350 histo->setBinLabel(5,"ROB4",2);
00351 histo->setBinLabel(6,"ROB5",2);
00352 histo->setBinLabel(7,"ROB6",2);
00353 histo->setBinLabel(8,"ROB7",2);
00354 histo->setBinLabel(9,"ROB8",2);
00355 histo->setBinLabel(10,"ROB9",2);
00356 histo->setBinLabel(11,"ROB10",2);
00357 histo->setBinLabel(12,"ROB11",2);
00358 histo->setBinLabel(13,"ROB12",2);
00359 histo->setBinLabel(14,"ROB13",2);
00360 histo->setBinLabel(15,"ROB14",2);
00361 histo->setBinLabel(16,"ROB15",2);
00362 histo->setBinLabel(17,"ROB16",2);
00363 histo->setBinLabel(18,"ROB17",2);
00364 histo->setBinLabel(19,"ROB18",2);
00365 histo->setBinLabel(20,"ROB19",2);
00366 histo->setBinLabel(21,"ROB20",2);
00367 histo->setBinLabel(22,"ROB21",2);
00368 histo->setBinLabel(23,"ROB22",2);
00369 histo->setBinLabel(24,"ROB23",2);
00370 histo->setBinLabel(25,"ROB24",2);
00371 histo->setBinLabel(26,"SC",2);
00372
00373 if(mode > 1) return;
00374
00375 histoType = "ROSEventLenght";
00376 histoName = "FED" + dduID_s.str() + "_" + folder + rosID_s.str() + "_ROSEventLenght";
00377 histoTitle = "Event Lenght (Bytes) FED " + dduID_s.str() + " ROS " + rosID_s.str();
00378 (rosHistos[histoType])[code.getROSID()] = dbe->book1D(histoName,histoTitle,101,0,1616);
00379
00380 histoType = "ROSAvgEventLenghtvsLumi";
00381 histoName = "FED" + dduID_s.str() + "_" + folder + rosID_s.str() + histoType;
00382 histoTitle = "Event Lenght (Bytes) FED " + dduID_s.str() + " ROS " + rosID_s.str();
00383 rosTimeHistos[histoType][code.getROSID()] = new DTTimeEvolutionHisto(dbe,histoName,histoTitle,200,10,true,0);
00384
00385 histoType = "TDCError";
00386 histoName = "FED" + dduID_s.str() + "_" + folder + rosID_s.str() + "_TDCError";
00387 histoTitle = histoName + " (ROBID error summary)";
00388 (rosHistos[histoType])[code.getROSID()] = dbe->book2D(histoName,histoTitle,24,0,24,25,0,25);
00389 histo = (rosHistos[histoType])[code.getROSID()];
00390
00391 histo->setBinLabel(1,"Fatal",1);
00392 histo->setBinLabel(2,"RO FIFO ov.",1);
00393 histo->setBinLabel(3,"L1 buf. ov.",1);
00394 histo->setBinLabel(4,"L1A FIFO ov.",1);
00395 histo->setBinLabel(5,"hit err.",1);
00396 histo->setBinLabel(6,"hit rej.",1);
00397 histo->setBinLabel(7,"Fatal",1);
00398 histo->setBinLabel(8,"RO FIFO ov.",1);
00399 histo->setBinLabel(9,"L1 buf. ov.",1);
00400 histo->setBinLabel(10,"L1A FIFO ov.",1);
00401 histo->setBinLabel(11,"hit err.",1);
00402 histo->setBinLabel(12,"hit rej.",1);
00403 histo->setBinLabel(13,"Fatal",1);
00404 histo->setBinLabel(14,"RO FIFO ov.",1);
00405 histo->setBinLabel(15,"L1 buf. ov.",1);
00406 histo->setBinLabel(16,"L1A FIFO ov.",1);
00407 histo->setBinLabel(17,"hit err.",1);
00408 histo->setBinLabel(18,"hit rej.",1);
00409 histo->setBinLabel(19,"Fatal",1);
00410 histo->setBinLabel(20,"RO FIFO ov.",1);
00411 histo->setBinLabel(21,"L1 buf. ov.",1);
00412 histo->setBinLabel(22,"L1A FIFO ov.",1);
00413 histo->setBinLabel(23,"hit err.",1);
00414 histo->setBinLabel(24,"hit rej.",1);
00415
00416 histo->setBinLabel(1,"ROB0",2);
00417 histo->setBinLabel(2,"ROB1",2);
00418 histo->setBinLabel(3,"ROB2",2);
00419 histo->setBinLabel(4,"ROB3",2);
00420 histo->setBinLabel(5,"ROB4",2);
00421 histo->setBinLabel(6,"ROB5",2);
00422 histo->setBinLabel(7,"ROB6",2);
00423 histo->setBinLabel(8,"ROB7",2);
00424 histo->setBinLabel(9,"ROB8",2);
00425 histo->setBinLabel(10,"ROB9",2);
00426 histo->setBinLabel(11,"ROB10",2);
00427 histo->setBinLabel(12,"ROB11",2);
00428 histo->setBinLabel(13,"ROB12",2);
00429 histo->setBinLabel(14,"ROB13",2);
00430 histo->setBinLabel(15,"ROB14",2);
00431 histo->setBinLabel(16,"ROB15",2);
00432 histo->setBinLabel(17,"ROB16",2);
00433 histo->setBinLabel(18,"ROB17",2);
00434 histo->setBinLabel(19,"ROB18",2);
00435 histo->setBinLabel(20,"ROB19",2);
00436 histo->setBinLabel(21,"ROB20",2);
00437 histo->setBinLabel(22,"ROB21",2);
00438 histo->setBinLabel(23,"ROB22",2);
00439 histo->setBinLabel(24,"ROB23",2);
00440 histo->setBinLabel(25,"ROB24",2);
00441
00442 histoType = "ROB_mean";
00443 histoName = "FED" + dduID_s.str() + "_" + "ROS" + rosID_s.str() + "_ROB_mean";
00444 string fullName = topFolder(false) + "FED" + dduID_s.str() + "/" + folder + rosID_s.str()+ "/" + histoName;
00445 names.insert (pair<std::string,std::string> (histoType,string(fullName)));
00446 (rosHistos[histoType])[code.getROSID()] = dbe->book2D(histoName,histoName,25,0,25,100,0,100);
00447 (rosHistos[histoType])[code.getROSID()]->setAxisTitle("ROB #",1);
00448 (rosHistos[histoType])[code.getROSID()]->setAxisTitle("ROB wordcounts",2);
00449
00450
00451
00452
00453 }
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478 if ( folder == "SC" ) {
00479
00480 dbe->setCurrentFolder(topFolder(false) + "FED" + dduID_s.str());
00481
00482
00483 histoType = "SCSizeVsROSSize";
00484 histoName = "FED" + dduID_s.str() + "_SCSizeVsROSSize";
00485 histoTitle = "SC size - ROS size vs SC (FED " + dduID_s.str() + ")";
00486 rosHistos[histoType][code.getSCID()] = dbe->book2D(histoName,histoTitle,12,1,13,51,-1,50);
00487 rosHistos[histoType][code.getSCID()]->setAxisTitle("SC",1);
00488
00489 }
00490 }
00491
00492 void DTDataIntegrityTask::TimeHistos(string histoType){
00493
00494 if(histoType == "Event_word_vs_time"){
00495
00496 for (it = names.begin(); it != names.end(); it++) {
00497
00498 if ((*it).first==histoType){
00499
00500 MonitorElement * h1 =dbe->get((*it).second);
00501
00502 int first_bin = -1, last_bin=-1;
00503 for( int bin=1; bin < h1->getNbinsX()+1; bin++ ){
00504 for( int j=1; j < h1->getNbinsY(); j++ ){
00505 if( h1->getBinContent(bin,j) > 0 ) {
00506 if( first_bin == -1 ) { first_bin = bin; }
00507 last_bin = bin;
00508 }
00509 }
00510 }
00511
00512 if( first_bin > 1 ) { first_bin -= 1; }
00513 if( last_bin < h1-> getNbinsX() ){ last_bin += 1; }
00514 h1->setAxisRange(0,last_bin,1);
00515 }
00516 }
00517 }
00518 }
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528 void DTDataIntegrityTask::bookHistosROS25(DTROChainCoding code) {
00529 bookHistos( string("ROS"), code);
00530
00531
00532
00533
00534 if(mode <= 1)
00535 if(getSCInfo)
00536 bookHistos( string("SC"), code);
00537 }
00538
00539
00540 void DTDataIntegrityTask::processROS25(DTROS25Data & data, int ddu, int ros) {
00541 neventsROS25++;
00542
00543
00544 LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
00545 << "[DTDataIntegrityTask]: " << neventsROS25 << " events analyzed by processROS25" << endl;
00546
00547
00548 DTROChainCoding code;
00549 code.setDDU(ddu);
00550 code.setROS(ros);
00551
00552 MonitorElement* ROSSummary = rosSHistos["ROSSummary"][code.getDDUID()];
00553
00554
00555 MonitorElement* ROSError = 0;
00556 if(mode <= 2) ROSError = rosHistos["ROSError"][code.getROSID()];
00557
00558 if ( (mode<=2) && (!ROSError) ) {
00559 LogError("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask") <<
00560 "Trying to access non existing ME at ROSID " << code.getROSID() <<
00561 std::endl;
00562 return;
00563 }
00564
00565
00566 rosL1AIdsPerFED[ddu].insert(data.getROSHeader().TTCEventCounter());
00567
00568
00569
00570
00571
00572 if (data.getROSTrailer().TPX() != 0) {
00573 LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask") << " TXP error en ROS "
00574 << code.getROS() << endl;
00575 ROSSummary->Fill(9,code.getROS());
00576 }
00577
00578
00579 if(data.getROSTrailer().l1AFifoOccupancy() > 31) {
00580 ROSSummary->Fill(10,code.getROS());
00581 }
00582
00583
00584 if (neventsROS25 == 1) FirstRos = code.getROSID();
00585 if (code.getROSID() == FirstRos) nevents++ ;
00586
00587
00588 for (vector<DTROSErrorWord>::const_iterator error_it = data.getROSErrors().begin();
00589 error_it != data.getROSErrors().end(); error_it++) {
00590
00591 LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask") << " Error in ROS " << code.getROS()
00592 << " ROB Id " << (*error_it).robID()
00593 << " Error type " << (*error_it).errorType() << endl;
00594
00595
00596 ROSSummary->Fill((*error_it).errorType(), code.getROS());
00597 if((*error_it).errorType() <= 11) {
00598 eventErrorFlag = true;
00599 }
00600
00601 if(mode <= 2) {
00602
00603 if ((*error_it).robID() != 31) {
00604 ROSError->Fill((*error_it).errorType(),(*error_it).robID());
00605 }
00606 else if ((*error_it).errorType() == 4) {
00607 vector<int> channelBins;
00608 channelsInROS((*error_it).cerosID(),channelBins);
00609 vector<int>::const_iterator channelIt = channelBins.begin();
00610 vector<int>::const_iterator channelEnd = channelBins.end();
00611 for(;channelIt!=channelEnd;++channelIt) {
00612 ROSError->Fill(4,(*channelIt));
00613 }
00614 }
00615 }
00616 }
00617
00618
00619 int ROSDebug_BunchNumber = -1;
00620 int ROSDebug_BcntResCntLow = 0;
00621 int ROSDebug_BcntResCntHigh = 0;
00622 int ROSDebug_BcntResCnt = 0;
00623
00624 for (vector<DTROSDebugWord>::const_iterator debug_it = data.getROSDebugs().begin();
00625 debug_it != data.getROSDebugs().end(); debug_it++) {
00626
00627 int debugROSSummary = 0;
00628 int debugROSError = 0;
00629 vector<int> debugBins;
00630 bool hasEvIdMis = false;
00631 vector<int> evIdMisBins;
00632
00633 if ((*debug_it).debugType() == 0 ) {
00634 ROSDebug_BunchNumber = (*debug_it).debugMessage();
00635 } else if ((*debug_it).debugType() == 1 ) {
00636 ROSDebug_BcntResCntLow = (*debug_it).debugMessage();
00637 } else if ((*debug_it).debugType() == 2 ) {
00638 ROSDebug_BcntResCntHigh = (*debug_it).debugMessage();
00639 } else if ((*debug_it).debugType() == 3) {
00640 if ((*debug_it).dontRead()){
00641 debugROSSummary = 11;
00642 debugROSError = 8;
00643 if (mode <= 2) channelsInCEROS((*debug_it).cerosIdCerosStatus(),(*debug_it).dontRead(),debugBins);
00644 } if ((*debug_it).evIdMis()){
00645 hasEvIdMis = true;
00646 if (mode <= 2) channelsInCEROS((*debug_it).cerosIdCerosStatus(),(*debug_it).evIdMis(),evIdMisBins);
00647 }
00648 } else if ((*debug_it).debugType() == 4 &&
00649 (*debug_it).cerosIdRosStatus()){
00650 debugROSSummary = 13;
00651 debugROSError = 10;
00652 if (mode <= 2) channelsInROS((*debug_it).cerosIdRosStatus(),debugBins);
00653 }
00654
00655 if (debugROSSummary) {
00656 ROSSummary->Fill(debugROSSummary,code.getROS());
00657 if (mode <= 2) {
00658 vector<int>::const_iterator channelIt = debugBins.begin();
00659 vector<int>::const_iterator channelEnd = debugBins.end();
00660 for (;channelIt!=channelEnd;++channelIt) {
00661 ROSError->Fill(debugROSError,(*channelIt));
00662 }
00663 }
00664 }
00665
00666 if (hasEvIdMis) {
00667 ROSSummary->Fill(12,code.getROS());
00668 if (mode <= 2) {
00669 vector<int>::const_iterator channelIt = evIdMisBins.begin();
00670 vector<int>::const_iterator channelEnd = evIdMisBins.end();
00671 for (;channelIt!=channelEnd;++channelIt) {
00672 ROSError->Fill(9,(*channelIt));
00673 }
00674 }
00675 }
00676
00677 }
00678
00679 ROSDebug_BcntResCnt = (ROSDebug_BcntResCntHigh << 15) + ROSDebug_BcntResCntLow;
00680
00681
00682
00683
00684
00685
00686
00687 ROSWords_t(ResetCount_unfolded,code.getROS(),ROSDebug_BcntResCnt,nevents);
00688
00689
00690
00691
00692
00693
00694
00695
00696
00697
00698
00699
00700
00701
00702
00703
00704
00705 for (vector<DTROBHeader>::const_iterator rob_it = data.getROBHeaders().begin();
00706 rob_it != data.getROBHeaders().end(); rob_it++) {
00707
00708 code.setROB((*rob_it).first);
00709 DTROBHeaderWord robheader = (*rob_it).second;
00710
00711 rosBxIdsPerFED[ddu].insert(ROSDebug_BunchNumber);
00712
00713 if (robheader.bunchID() != ROSDebug_BunchNumber) {
00714
00715 ROSSummary->Fill(8,code.getROS());
00716 eventErrorFlag = true;
00717
00718
00719 if(mode <= 2) ROSError->Fill(7,robheader.robID());
00720 }
00721 }
00722
00723
00724 if(mode <= 1) {
00725
00726 for (vector<DTROBTrailerWord>::const_iterator robt_it = data.getROBTrailers().begin();
00727 robt_it != data.getROBTrailers().end(); robt_it++) {
00728 float wCount = (*robt_it).wordCount()<100. ? (*robt_it).wordCount() : 99.9;
00729 rosHistos["ROB_mean"][code.getROSID()]->Fill((*robt_it).robID(),wCount);
00730 }
00731
00732
00733
00734
00735
00736
00737
00738
00739 int rosEventLenght = data.getROSTrailer().EventWordCount()*4;
00740 rosTimeHistos["ROSAvgEventLenghtvsLumi"][code.getROSID()]->accumulateValueTimeSlot(rosEventLenght);
00741
00742 if(rosEventLenght > 1600) rosEventLenght = 1600;
00743 rosHistos["ROSEventLenght"][code.getROSID()]->Fill(rosEventLenght);
00744 }
00745
00746
00747
00748 for (vector<DTTDCData>::const_iterator tdc_it = data.getTDCData().begin();
00749 tdc_it != data.getTDCData().end(); tdc_it++) {
00750
00751 DTTDCMeasurementWord tdcDatum = (*tdc_it).second;
00752
00753 if ( tdcDatum.PC() !=0) {
00754 LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
00755 << " PC error in ROS " << code.getROS() << " TDC " << (*tdc_it).first << endl;
00756
00757 ROSSummary->Fill(7,code.getROS());
00758
00759 eventErrorFlag = true;
00760
00761
00762 if(mode <= 2) ROSError->Fill(6,(*tdc_it).first);
00763 }
00764 }
00765
00766
00767 for (vector<DTTDCError>::const_iterator tdc_it = data.getTDCError().begin();
00768 tdc_it != data.getTDCError().end(); tdc_it++) {
00769
00770 code.setROB((*tdc_it).first);
00771
00772 int tdcError_ROSSummary = 0;
00773 int tdcError_ROSError = 0;
00774 int tdcError_TDCHisto = 0;
00775
00776 if(((*tdc_it).second).tdcError() & 0x4000 ) {
00777 LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
00778 << " ROS " << code.getROS() << " ROB " << code.getROB()
00779 << " Internal fatal Error 4000 in TDC " << (*tdc_it).first << endl;
00780
00781 tdcError_ROSSummary = 14;
00782 tdcError_ROSError = 11;
00783 tdcError_TDCHisto = 0;
00784
00785 } else if ( ((*tdc_it).second).tdcError() & 0x0249 ) {
00786 LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
00787 << " ROS " << code.getROS() << " ROB " << code.getROB()
00788 << " TDC FIFO overflow in TDC " << (*tdc_it).first << endl;
00789
00790 tdcError_ROSSummary = 15;
00791 tdcError_ROSError = 12;
00792 tdcError_TDCHisto = 1;
00793
00794 } else if ( ((*tdc_it).second).tdcError() & 0x0492 ) {
00795 LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
00796 << " ROS " << code.getROS() << " ROB " << code.getROB()
00797 << " TDC L1 buffer overflow in TDC " << (*tdc_it).first << endl;
00798
00799 tdcError_ROSSummary = 16;
00800 tdcError_ROSError = 13;
00801 tdcError_TDCHisto = 2;
00802
00803 } else if ( ((*tdc_it).second).tdcError() & 0x2000 ) {
00804 LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
00805 << " ROS " << code.getROS() << " ROB " << code.getROB()
00806 << " TDC L1A FIFO overflow in TDC " << (*tdc_it).first << endl;
00807
00808 tdcError_ROSSummary = 17;
00809 tdcError_ROSError = 14;
00810 tdcError_TDCHisto = 3;
00811
00812 } else if ( ((*tdc_it).second).tdcError() & 0x0924 ) {
00813 LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
00814 << " ROS " << code.getROS() << " ROB " << code.getROB()
00815 << " TDC hit error in TDC " << (*tdc_it).first << endl;
00816
00817 tdcError_ROSSummary = 18;
00818 tdcError_ROSError = 15;
00819 tdcError_TDCHisto = 4;
00820
00821 } else if ( ((*tdc_it).second).tdcError() & 0x1000 ) {
00822 LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
00823 << " ROS " << code.getROS() << " ROB " << code.getROB()
00824 << " TDC hit rejected in TDC " << (*tdc_it).first << endl;
00825
00826 tdcError_ROSSummary = 19;
00827 tdcError_ROSError = 16;
00828 tdcError_TDCHisto = 5;
00829
00830 } else {
00831 LogWarning("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
00832 << " TDC error code not known " << ((*tdc_it).second).tdcError() << endl;
00833 }
00834
00835 ROSSummary->Fill(tdcError_ROSSummary,code.getROS());
00836
00837 if(tdcError_ROSSummary <= 15) {
00838 eventErrorFlag = true;
00839 }
00840
00841 if(mode <= 2) {
00842 ROSError->Fill(tdcError_ROSError,(*tdc_it).first);
00843 if(mode <= 1)
00844 rosHistos["TDCError"][code.getROSID()]->Fill(tdcError_TDCHisto+6*((*tdc_it).second).tdcID(),(*tdc_it).first);
00845 }
00846 }
00847
00848
00849 if (mode <= 1 && getSCInfo) {
00850
00851
00852
00853
00854 rosHistos["SCSizeVsROSSize"][code.getSCID()]->Fill(ros,data.getSCPrivHeader().NumberOf16bitWords()+3-data.getSCTrailer().wordCount());
00855
00856 }
00857
00858
00859
00860
00861 }
00862
00863 void DTDataIntegrityTask::processFED(DTDDUData & data, const std::vector<DTROS25Data> & rosData, int ddu) {
00864
00865 neventsDDU++;
00866 if (neventsDDU%1000 == 0)
00867 LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
00868 << "[DTDataIntegrityTask]: " << neventsDDU << " events analyzed by processFED" << endl;
00869
00870
00871 DTROChainCoding code;
00872 code.setDDU(ddu);
00873
00874 hFEDEntry->Fill(code.getDDUID());
00875
00876 FEDTrailer trailer = data.getDDUTrailer();
00877 FEDHeader header = data.getDDUHeader();
00878
00879
00880 if(!header.check()) {
00881
00882 hFEDFatal->Fill(code.getDDUID());
00883 hCorruptionSummary->Fill(code.getDDUID(), 7);
00884 }
00885
00886 if(!trailer.check()) {
00887
00888 hFEDFatal->Fill(code.getDDUID());
00889 hCorruptionSummary->Fill(code.getDDUID(), 8);
00890 }
00891
00892
00893 if(data.crcErrorBit()) {
00894
00895 hFEDFatal->Fill(code.getDDUID());
00896 hCorruptionSummary->Fill(code.getDDUID(), 6);
00897 }
00898
00899 DTDDUSecondStatusWord secondWord = data.getSecondStatusWord();
00900
00901
00902
00903
00904
00905 int ttsCodeValue = -1;
00906 int ttsSummaryBin = -1;
00907
00908 switch(trailer.ttsBits()) {
00909 case 0:{
00910 ttsCodeValue = 0;
00911 break;
00912 }
00913 case 1:{
00914 ttsCodeValue = 1;
00915 if(secondWord.warningROSPAF()) {
00916 ttsSummaryBin = 1;
00917 } else {
00918 ttsSummaryBin = 2;
00919 }
00920
00921 break;
00922 }
00923 case 2:{
00924 ttsCodeValue = 2;
00925 bool knownOrigin = false;
00926 if(secondWord.outOfSynchROSError()) {
00927 ttsSummaryBin = 7;
00928 knownOrigin = true;
00929 }
00930 if(secondWord.l1AIDError()) {
00931 ttsSummaryBin = 6;
00932 knownOrigin = true;
00933 }
00934 if(secondWord.bxIDError()) {
00935 ttsSummaryBin = 8;
00936 knownOrigin = true;
00937 }
00938 if(secondWord.outputFifoFull() || secondWord.inputFifoFull() || secondWord.fifoFull()) {
00939 ttsSummaryBin = 5;
00940 knownOrigin = true;
00941 }
00942 if(!knownOrigin) ttsSummaryBin = 9;
00943
00944 break;
00945 }
00946 case 4:{
00947 ttsCodeValue = 3;
00948 bool knownOrigin = false;
00949 if(secondWord.busyROSPAF()) {
00950 ttsSummaryBin = 3;
00951 knownOrigin = true;
00952 }
00953 if(secondWord.outputFifoAlmostFull() || secondWord.inputFifoAlmostFull() || secondWord.fifoAlmostFull() ){
00954 ttsSummaryBin = 4;
00955 knownOrigin = true;
00956 }
00957 if(!knownOrigin) ttsSummaryBin = 9;
00958 break;
00959 }
00960 case 8:{
00961 ttsCodeValue = 4;
00962 break;
00963 }
00964 case 12:{
00965 ttsCodeValue = 5;
00966 break;
00967 }
00968 case 16:{
00969 ttsCodeValue = 6;
00970 break;
00971 }
00972 default:{
00973 LogError("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
00974 <<"[DTDataIntegrityTask] DDU control: wrong TTS value "<<trailer.ttsBits()<<endl;
00975 ttsCodeValue = 7;
00976 }
00977 }
00978 if(mode <= 1) dduHistos["TTSValues"][code.getDDUID()]->Fill(ttsCodeValue);
00979 if(ttsSummaryBin != -1) {
00980 hTTSSummary->Fill(ddu, ttsSummaryBin);
00981 }
00982
00983
00984
00985
00986
00987
00988
00989 MonitorElement* hROSStatus = dduHistos["ROSStatus"][code.getDDUID()];
00990
00991
00992 int rosList = secondWord.rosList();
00993 set<int> rosPositions;
00994 for(int i=0;i<12;i++) {
00995 if(rosList & 0x1) {
00996 rosPositions.insert(i);
00997
00998 if(mode <= 2) hROSStatus->Fill(8,i,1);
00999 }
01000 rosList >>= 1;
01001 }
01002
01003 int channel=0;
01004 for (vector<DTDDUFirstStatusWord>::const_iterator fsw_it = data.getFirstStatusWord().begin();
01005 fsw_it != data.getFirstStatusWord().end(); fsw_it++) {
01006
01007 if(mode <= 2) {
01008 hROSStatus->Fill(0,channel,(*fsw_it).channelEnabled());
01009 hROSStatus->Fill(1,channel,(*fsw_it).timeout());
01010 hROSStatus->Fill(2,channel,(*fsw_it).eventTrailerLost());
01011 hROSStatus->Fill(3,channel,(*fsw_it).opticalFiberSignalLost());
01012 hROSStatus->Fill(4,channel,(*fsw_it).tlkPropagationError());
01013 hROSStatus->Fill(5,channel,(*fsw_it).tlkPatternError());
01014 hROSStatus->Fill(6,channel,(*fsw_it).tlkSignalLost());
01015 hROSStatus->Fill(7,channel,(*fsw_it).errorFromROS());
01016 }
01017
01018 if((*fsw_it).channelEnabled() == 1 &&
01019 rosPositions.find(channel) == rosPositions.end()) {
01020 if(mode <= 2) hROSStatus->Fill(9,channel,1);
01021
01022 hFEDFatal->Fill(code.getDDUID());
01023 hCorruptionSummary->Fill(code.getDDUID(), 1);
01024 }
01025 channel++;
01026 }
01027
01028
01029
01030
01031
01032 set<int> rosBXIds = rosBxIdsPerFED[ddu];
01033 if((rosBXIds.size() > 1 || rosBXIds.find(header.bxID()) == rosBXIds.end()) && rosBXIds.size() != 0) {
01034 for(vector<DTROS25Data>::const_iterator rosControlData = rosData.begin();
01035 rosControlData != rosData.end(); ++rosControlData) {
01036 for (vector<DTROSDebugWord>::const_iterator debug_it = (*rosControlData).getROSDebugs().begin();
01037 debug_it != (*rosControlData).getROSDebugs().end(); debug_it++) {
01038 if ((*debug_it).debugType() == 0 && (*debug_it).debugMessage() != header.bxID()) {
01039 int ros = (*rosControlData).getROSID();
01040
01041 if(mode <= 2) hROSStatus->Fill(11,ros-1);
01042
01043 hFEDFatal->Fill(code.getDDUID());
01044 hCorruptionSummary->Fill(code.getDDUID(), 2);
01045 }
01046 }
01047 }
01048 }
01049
01050
01051 fedBXIds.insert(header.bxID());
01052 if(fedBXIds.size() != 1) {
01053 LogWarning("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
01054 << "ERROR: FED " << ddu << " BX ID different from other feds: " << header.bxID() << endl;
01055
01056 hFEDFatal->Fill(code.getDDUID());
01057 hCorruptionSummary->Fill(code.getDDUID(), 3);
01058 }
01059
01060
01061
01062 set<int> rosL1AIds = rosL1AIdsPerFED[ddu];
01063 if((rosL1AIds.size() > 1 || rosL1AIds.find(header.lvl1ID()-1) == rosL1AIds.end()) && rosL1AIds.size() != 0) {
01064
01065 for (vector<DTROS25Data>::const_iterator rosControlData = rosData.begin();
01066 rosControlData != rosData.end(); rosControlData++) {
01067 int ROSHeader_TTCCount = ((*rosControlData).getROSHeader().TTCEventCounter() + 1) % 0x1000000;
01068 if( ROSHeader_TTCCount != header.lvl1ID() ) {
01069 int ros = (*rosControlData).getROSID();
01070 if(mode <= 2) hROSStatus->Fill(10,ros-1);
01071
01072 hFEDFatal->Fill(code.getDDUID());
01073 hCorruptionSummary->Fill(code.getDDUID(), 4);
01074 }
01075 }
01076 }
01077
01078
01079 int fedEvtLenght = trailer.lenght()*8;
01080
01081 dduHistos["EventLenght"][code.getDDUID()]->Fill(fedEvtLenght);
01082
01083 if(mode > 1) return;
01084
01085 dduTimeHistos["FEDAvgEvLenghtvsLumi"][code.getDDUID()]->accumulateValueTimeSlot(fedEvtLenght);
01086
01087
01088 dduHistos["ROSList"][code.getDDUID()]->Fill(rosPositions.size());
01089
01090
01091
01092 MonitorElement *hFIFOStatus = dduHistos["FIFOStatus"][code.getDDUID()];
01093 int inputFifoFull = secondWord.inputFifoFull();
01094 int inputFifoAlmostFull = secondWord.inputFifoAlmostFull();
01095 int fifoFull = secondWord.fifoFull();
01096 int fifoAlmostFull = secondWord.fifoAlmostFull();
01097 int outputFifoFull = secondWord.outputFifoFull();
01098 int outputFifoAlmostFull = secondWord.outputFifoAlmostFull();
01099 for(int i=0;i<3;i++){
01100 if(inputFifoFull & 0x1){
01101 hFIFOStatus->Fill(i,0);
01102 }
01103 if(inputFifoAlmostFull & 0x1){
01104 hFIFOStatus->Fill(i,1);
01105 }
01106 if(fifoFull & 0x1){
01107 hFIFOStatus->Fill(3+i,0);
01108 }
01109 if(fifoAlmostFull & 0x1){
01110 hFIFOStatus->Fill(3+i,1);
01111 }
01112 if(!(inputFifoFull & 0x1) && !(inputFifoAlmostFull & 0x1)){
01113 hFIFOStatus->Fill(i,2);
01114 }
01115 if(!(fifoFull & 0x1) && !(fifoAlmostFull & 0x1)){
01116 hFIFOStatus->Fill(3+i,2);
01117 }
01118 inputFifoFull >>= 1;
01119 inputFifoAlmostFull >>= 1;
01120 fifoFull >>= 1;
01121 fifoAlmostFull >>= 1;
01122 }
01123
01124 if(outputFifoFull){
01125 hFIFOStatus->Fill(6,0);
01126 }
01127 if(outputFifoAlmostFull){
01128 hFIFOStatus->Fill(6,1);
01129 }
01130 if(!outputFifoFull && !outputFifoAlmostFull){
01131 hFIFOStatus->Fill(6,2);
01132 }
01133
01134
01135
01136
01137
01138
01139
01140
01141 dduHistos["EventType"][code.getDDUID()]->Fill(header.triggerType());
01142
01143
01144 dduHistos["BXID"][code.getDDUID()]->Fill(header.bxID());
01145
01146
01147 }
01148
01149
01150 bool DTDataIntegrityTask::eventHasErrors() const {
01151 return eventErrorFlag;
01152 }
01153
01154
01155
01156
01157 void DTDataIntegrityTask::fedEntry(int dduID) {
01158 hFEDEntry->Fill(dduID);
01159 }
01160
01161
01162
01163
01164 void DTDataIntegrityTask::fedFatal(int dduID) {
01165 hFEDFatal->Fill(dduID);
01166 }
01167
01168
01169
01170
01171 void DTDataIntegrityTask::fedNonFatal(int dduID) {
01172 hFEDNonFatal->Fill(dduID);
01173 }
01174
01175 std::string DTDataIntegrityTask::topFolder(bool isFEDIntegrity) const {
01176
01177 string folder = isFEDIntegrity ? fedIntegrityFolder : "DT/00-DataIntegrity";
01178
01179 if (!isFEDIntegrity)
01180 folder += (mode==1) ? "_SM/" : (mode==3) ? "_EvF/" : "/";
01181
01182 return folder;
01183
01184 }
01185
01186 void DTDataIntegrityTask::channelsInCEROS(int cerosId, int chMask, vector<int>& channels ){
01187 for (int iCh=0; iCh<6;++iCh) {
01188 if ((chMask >> iCh) & 0x1){
01189 channels.push_back(cerosId*6+iCh);
01190 }
01191 }
01192 return;
01193 }
01194
01195 void DTDataIntegrityTask::channelsInROS(int cerosMask, vector<int>& channels){
01196 for (int iCeros=0; iCeros<5;++iCeros) {
01197 if ((cerosMask >> iCeros) & 0x1){
01198 for (int iCh=0; iCh<6;++iCh) {
01199 channels.push_back(iCeros*6+iCh);
01200 }
01201 }
01202 }
01203 return;
01204 }
01205
01206 void DTDataIntegrityTask::preProcessEvent(const edm::EventID& iEvtid, const edm::Timestamp& iTime) {
01207
01208 nevents++;
01209 nEventMonitor->Fill(nevents);
01210
01211 nEventsLS++;
01212
01213 LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask") << "[DTDataIntegrityTask]: preProcessEvent" <<endl;
01214
01215 for(map<int, set<int> >::iterator rosBxIds = rosBxIdsPerFED.begin();
01216 rosBxIds != rosBxIdsPerFED.end(); ++rosBxIds) {
01217 (*rosBxIds).second.clear();
01218 }
01219
01220 fedBXIds.clear();
01221
01222 for(map<int, set<int> >::iterator rosL1AIds = rosL1AIdsPerFED.begin();
01223 rosL1AIds != rosL1AIdsPerFED.end(); ++rosL1AIds) {
01224 (*rosL1AIds).second.clear();
01225 }
01226
01227
01228 eventErrorFlag = false;
01229
01230 }
01231
01232 void DTDataIntegrityTask::preBeginLumi(const edm::LuminosityBlockID& ls, const edm::Timestamp& iTime) {
01233
01234 nEventsLS = 0;
01235
01236 }
01237
01238 void DTDataIntegrityTask::preEndLumi(const edm::LuminosityBlockID& ls, const edm::Timestamp& iTime) {
01239
01240 int lumiBlock = ls.luminosityBlock();
01241
01242 map<std::string, map<int, DTTimeEvolutionHisto*> >::iterator dduIt = dduTimeHistos.begin();
01243 map<std::string, map<int, DTTimeEvolutionHisto*> >::iterator dduEnd = dduTimeHistos.end();
01244 for(; dduIt!=dduEnd; ++dduIt) {
01245 map<int, DTTimeEvolutionHisto*>::iterator histoIt = dduIt->second.begin();
01246 map<int, DTTimeEvolutionHisto*>::iterator histoEnd = dduIt->second.end();
01247 for(; histoIt!=histoEnd; ++histoIt) {
01248 histoIt->second->updateTimeSlot(lumiBlock,nEventsLS);
01249 }
01250 }
01251
01252 map<std::string, map<int, DTTimeEvolutionHisto*> >::iterator rosIt = rosTimeHistos.begin();
01253 map<std::string, map<int, DTTimeEvolutionHisto*> >::iterator rosEnd = rosTimeHistos.end();
01254 for(; rosIt!=rosEnd; ++rosIt) {
01255 map<int, DTTimeEvolutionHisto*>::iterator histoIt = rosIt->second.begin();
01256 map<int, DTTimeEvolutionHisto*>::iterator histoEnd = rosIt->second.end();
01257 for(; histoIt!=histoEnd; ++histoIt) {
01258 histoIt->second->updateTimeSlot(lumiBlock,nEventsLS);
01259 }
01260 }
01261
01262 }
01263
01264 void DTDataIntegrityTask::postBeginJob() {
01265 LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask") << "[DTDataIntegrityTask]: postBeginJob" <<endl;
01266
01267 dbe = edm::Service<DQMStore>().operator->();
01268 LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask") << "[DTDataIntegrityTask] Get DQMStore service" << endl;
01269
01270
01271
01272
01273 int FEDIDmin = FEDNumbering::MINDTFEDID;
01274 int FEDIDMax = FEDNumbering::MAXDTFEDID;
01275
01276 LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
01277 << " FEDS: " << FEDIDmin << " to " << FEDIDMax << " in the RO" << endl;
01278
01279
01280 bookHistos(FEDIDmin, FEDIDMax);
01281
01282
01283 for(int fed = FEDIDmin; fed <= FEDIDMax; ++fed) {
01284 DTROChainCoding code;
01285 code.setDDU(fed);
01286
01287 bookHistos( string("ROS_S"), code);
01288
01289 bookHistos( string("DDU"), code);
01290
01291 for(int ros = 1; ros <= 12; ++ros) {
01292 code.setROS(ros);
01293 bookHistosROS25(code);
01294 }
01295 }
01296
01297 }