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
00559 rosL1AIdsPerFED[ddu].insert(data.getROSHeader().TTCEventCounter());
00560
00561
00562
00563
00564
00565 if (data.getROSTrailer().TPX() != 0) {
00566 LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask") << " TXP error en ROS "
00567 << code.getROS() << endl;
00568 ROSSummary->Fill(9,code.getROS());
00569 }
00570
00571
00572 if(data.getROSTrailer().l1AFifoOccupancy() > 31) {
00573 ROSSummary->Fill(10,code.getROS());
00574 }
00575
00576
00577 if (neventsROS25 == 1) FirstRos = code.getROSID();
00578 if (code.getROSID() == FirstRos) nevents++ ;
00579
00580
00581 for (vector<DTROSErrorWord>::const_iterator error_it = data.getROSErrors().begin();
00582 error_it != data.getROSErrors().end(); error_it++) {
00583
00584 LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask") << " Error in ROS " << code.getROS()
00585 << " ROB Id " << (*error_it).robID()
00586 << " Error type " << (*error_it).errorType() << endl;
00587
00588
00589 ROSSummary->Fill((*error_it).errorType(), code.getROS());
00590 if((*error_it).errorType() <= 11) {
00591 eventErrorFlag = true;
00592 }
00593
00594 if(mode <= 2) {
00595
00596 if ((*error_it).robID() != 31) {
00597 ROSError->Fill((*error_it).errorType(),(*error_it).robID());
00598 }
00599 else if ((*error_it).errorType() == 4) {
00600 vector<int> channelBins;
00601 channelsInROS((*error_it).cerosID(),channelBins);
00602 vector<int>::const_iterator channelIt = channelBins.begin();
00603 vector<int>::const_iterator channelEnd = channelBins.end();
00604 for(;channelIt!=channelEnd;++channelIt) {
00605 ROSError->Fill(4,(*channelIt));
00606 }
00607 }
00608 }
00609 }
00610
00611
00612 int ROSDebug_BunchNumber = -1;
00613 int ROSDebug_BcntResCntLow = 0;
00614 int ROSDebug_BcntResCntHigh = 0;
00615 int ROSDebug_BcntResCnt = 0;
00616
00617 for (vector<DTROSDebugWord>::const_iterator debug_it = data.getROSDebugs().begin();
00618 debug_it != data.getROSDebugs().end(); debug_it++) {
00619
00620 int debugROSSummary = 0;
00621 int debugROSError = 0;
00622 vector<int> debugBins;
00623 bool hasEvIdMis = false;
00624 vector<int> evIdMisBins;
00625
00626 if ((*debug_it).debugType() == 0 ) {
00627 ROSDebug_BunchNumber = (*debug_it).debugMessage();
00628 } else if ((*debug_it).debugType() == 1 ) {
00629 ROSDebug_BcntResCntLow = (*debug_it).debugMessage();
00630 } else if ((*debug_it).debugType() == 2 ) {
00631 ROSDebug_BcntResCntHigh = (*debug_it).debugMessage();
00632 } else if ((*debug_it).debugType() == 3) {
00633 if ((*debug_it).dontRead()){
00634 debugROSSummary = 11;
00635 debugROSError = 8;
00636 if (mode <= 2) channelsInCEROS((*debug_it).cerosIdCerosStatus(),(*debug_it).dontRead(),debugBins);
00637 } if ((*debug_it).evIdMis()){
00638 hasEvIdMis = true;
00639 if (mode <= 2) channelsInCEROS((*debug_it).cerosIdCerosStatus(),(*debug_it).evIdMis(),evIdMisBins);
00640 }
00641 } else if ((*debug_it).debugType() == 4 &&
00642 (*debug_it).cerosIdRosStatus()){
00643 debugROSSummary = 13;
00644 debugROSError = 10;
00645 if (mode <= 2) channelsInROS((*debug_it).cerosIdRosStatus(),debugBins);
00646 }
00647
00648 if (debugROSSummary) {
00649 ROSSummary->Fill(debugROSSummary,code.getROS());
00650 if (mode <= 2) {
00651 vector<int>::const_iterator channelIt = debugBins.begin();
00652 vector<int>::const_iterator channelEnd = debugBins.end();
00653 for (;channelIt!=channelEnd;++channelIt) {
00654 ROSError->Fill(debugROSError,(*channelIt));
00655 }
00656 }
00657 }
00658
00659 if (hasEvIdMis) {
00660 ROSSummary->Fill(12,code.getROS());
00661 if (mode <= 2) {
00662 vector<int>::const_iterator channelIt = evIdMisBins.begin();
00663 vector<int>::const_iterator channelEnd = evIdMisBins.end();
00664 for (;channelIt!=channelEnd;++channelIt) {
00665 ROSError->Fill(9,(*channelIt));
00666 }
00667 }
00668 }
00669
00670 }
00671
00672 ROSDebug_BcntResCnt = (ROSDebug_BcntResCntHigh << 15) + ROSDebug_BcntResCntLow;
00673
00674
00675
00676
00677
00678
00679
00680 ROSWords_t(ResetCount_unfolded,code.getROS(),ROSDebug_BcntResCnt,nevents);
00681
00682
00683
00684
00685
00686
00687
00688
00689
00690
00691
00692
00693
00694
00695
00696
00697
00698 for (vector<DTROBHeader>::const_iterator rob_it = data.getROBHeaders().begin();
00699 rob_it != data.getROBHeaders().end(); rob_it++) {
00700
00701 code.setROB((*rob_it).first);
00702 DTROBHeaderWord robheader = (*rob_it).second;
00703
00704 rosBxIdsPerFED[ddu].insert(ROSDebug_BunchNumber);
00705
00706 if (robheader.bunchID() != ROSDebug_BunchNumber) {
00707
00708 ROSSummary->Fill(8,code.getROS());
00709 eventErrorFlag = true;
00710
00711
00712 if(mode <= 2) ROSError->Fill(7,robheader.robID());
00713 }
00714 }
00715
00716
00717 if(mode <= 1) {
00718
00719 for (vector<DTROBTrailerWord>::const_iterator robt_it = data.getROBTrailers().begin();
00720 robt_it != data.getROBTrailers().end(); robt_it++) {
00721 float wCount = (*robt_it).wordCount()<100. ? (*robt_it).wordCount() : 99.9;
00722 rosHistos["ROB_mean"][code.getROSID()]->Fill((*robt_it).robID(),wCount);
00723 }
00724
00725
00726
00727
00728
00729
00730
00731
00732 int rosEventLenght = data.getROSTrailer().EventWordCount()*4;
00733 rosTimeHistos["ROSAvgEventLenghtvsLumi"][code.getROSID()]->accumulateValueTimeSlot(rosEventLenght);
00734
00735 if(rosEventLenght > 1600) rosEventLenght = 1600;
00736 rosHistos["ROSEventLenght"][code.getROSID()]->Fill(rosEventLenght);
00737 }
00738
00739
00740
00741 for (vector<DTTDCData>::const_iterator tdc_it = data.getTDCData().begin();
00742 tdc_it != data.getTDCData().end(); tdc_it++) {
00743
00744 DTTDCMeasurementWord tdcDatum = (*tdc_it).second;
00745
00746 if ( tdcDatum.PC() !=0) {
00747 LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
00748 << " PC error in ROS " << code.getROS() << " TDC " << (*tdc_it).first << endl;
00749
00750 ROSSummary->Fill(7,code.getROS());
00751
00752 eventErrorFlag = true;
00753
00754
00755 if(mode <= 2) ROSError->Fill(6,(*tdc_it).first);
00756 }
00757 }
00758
00759
00760 for (vector<DTTDCError>::const_iterator tdc_it = data.getTDCError().begin();
00761 tdc_it != data.getTDCError().end(); tdc_it++) {
00762
00763 code.setROB((*tdc_it).first);
00764
00765 int tdcError_ROSSummary = 0;
00766 int tdcError_ROSError = 0;
00767 int tdcError_TDCHisto = 0;
00768
00769 if(((*tdc_it).second).tdcError() & 0x4000 ) {
00770 LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
00771 << " ROS " << code.getROS() << " ROB " << code.getROB()
00772 << " Internal fatal Error 4000 in TDC " << (*tdc_it).first << endl;
00773
00774 tdcError_ROSSummary = 14;
00775 tdcError_ROSError = 11;
00776 tdcError_TDCHisto = 0;
00777
00778 } else if ( ((*tdc_it).second).tdcError() & 0x0249 ) {
00779 LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
00780 << " ROS " << code.getROS() << " ROB " << code.getROB()
00781 << " TDC FIFO overflow in TDC " << (*tdc_it).first << endl;
00782
00783 tdcError_ROSSummary = 15;
00784 tdcError_ROSError = 12;
00785 tdcError_TDCHisto = 1;
00786
00787 } else if ( ((*tdc_it).second).tdcError() & 0x0492 ) {
00788 LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
00789 << " ROS " << code.getROS() << " ROB " << code.getROB()
00790 << " TDC L1 buffer overflow in TDC " << (*tdc_it).first << endl;
00791
00792 tdcError_ROSSummary = 16;
00793 tdcError_ROSError = 13;
00794 tdcError_TDCHisto = 2;
00795
00796 } else if ( ((*tdc_it).second).tdcError() & 0x2000 ) {
00797 LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
00798 << " ROS " << code.getROS() << " ROB " << code.getROB()
00799 << " TDC L1A FIFO overflow in TDC " << (*tdc_it).first << endl;
00800
00801 tdcError_ROSSummary = 17;
00802 tdcError_ROSError = 14;
00803 tdcError_TDCHisto = 3;
00804
00805 } else if ( ((*tdc_it).second).tdcError() & 0x0924 ) {
00806 LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
00807 << " ROS " << code.getROS() << " ROB " << code.getROB()
00808 << " TDC hit error in TDC " << (*tdc_it).first << endl;
00809
00810 tdcError_ROSSummary = 18;
00811 tdcError_ROSError = 15;
00812 tdcError_TDCHisto = 4;
00813
00814 } else if ( ((*tdc_it).second).tdcError() & 0x1000 ) {
00815 LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
00816 << " ROS " << code.getROS() << " ROB " << code.getROB()
00817 << " TDC hit rejected in TDC " << (*tdc_it).first << endl;
00818
00819 tdcError_ROSSummary = 19;
00820 tdcError_ROSError = 16;
00821 tdcError_TDCHisto = 5;
00822
00823 } else {
00824 LogWarning("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
00825 << " TDC error code not known " << ((*tdc_it).second).tdcError() << endl;
00826 }
00827
00828 ROSSummary->Fill(tdcError_ROSSummary,code.getROS());
00829
00830 if(tdcError_ROSSummary <= 15) {
00831 eventErrorFlag = true;
00832 }
00833
00834 if(mode <= 2) {
00835 ROSError->Fill(tdcError_ROSError,(*tdc_it).first);
00836 if(mode <= 1)
00837 rosHistos["TDCError"][code.getROSID()]->Fill(tdcError_TDCHisto+6*((*tdc_it).second).tdcID(),(*tdc_it).first);
00838 }
00839 }
00840
00841
00842 if (mode <= 1 && getSCInfo) {
00843
00844
00845
00846
00847 rosHistos["SCSizeVsROSSize"][code.getSCID()]->Fill(ros,data.getSCPrivHeader().NumberOf16bitWords()+3-data.getSCTrailer().wordCount());
00848
00849 }
00850
00851
00852
00853
00854 }
00855
00856 void DTDataIntegrityTask::processFED(DTDDUData & data, const std::vector<DTROS25Data> & rosData, int ddu) {
00857
00858 neventsDDU++;
00859 if (neventsDDU%1000 == 0)
00860 LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
00861 << "[DTDataIntegrityTask]: " << neventsDDU << " events analyzed by processFED" << endl;
00862
00863
00864 DTROChainCoding code;
00865 code.setDDU(ddu);
00866
00867 hFEDEntry->Fill(code.getDDUID());
00868
00869 FEDTrailer trailer = data.getDDUTrailer();
00870 FEDHeader header = data.getDDUHeader();
00871
00872
00873 if(!header.check()) {
00874
00875 hFEDFatal->Fill(code.getDDUID());
00876 hCorruptionSummary->Fill(code.getDDUID(), 7);
00877 }
00878
00879 if(!trailer.check()) {
00880
00881 hFEDFatal->Fill(code.getDDUID());
00882 hCorruptionSummary->Fill(code.getDDUID(), 8);
00883 }
00884
00885
00886 if(data.crcErrorBit()) {
00887
00888 hFEDFatal->Fill(code.getDDUID());
00889 hCorruptionSummary->Fill(code.getDDUID(), 6);
00890 }
00891
00892 DTDDUSecondStatusWord secondWord = data.getSecondStatusWord();
00893
00894
00895
00896
00897
00898 int ttsCodeValue = -1;
00899 int ttsSummaryBin = -1;
00900
00901 switch(trailer.ttsBits()) {
00902 case 0:{
00903 ttsCodeValue = 0;
00904 break;
00905 }
00906 case 1:{
00907 ttsCodeValue = 1;
00908 if(secondWord.warningROSPAF()) {
00909 ttsSummaryBin = 1;
00910 } else {
00911 ttsSummaryBin = 2;
00912 }
00913
00914 break;
00915 }
00916 case 2:{
00917 ttsCodeValue = 2;
00918 bool knownOrigin = false;
00919 if(secondWord.outOfSynchROSError()) {
00920 ttsSummaryBin = 7;
00921 knownOrigin = true;
00922 }
00923 if(secondWord.l1AIDError()) {
00924 ttsSummaryBin = 6;
00925 knownOrigin = true;
00926 }
00927 if(secondWord.bxIDError()) {
00928 ttsSummaryBin = 8;
00929 knownOrigin = true;
00930 }
00931 if(secondWord.outputFifoFull() || secondWord.inputFifoFull() || secondWord.fifoFull()) {
00932 ttsSummaryBin = 5;
00933 knownOrigin = true;
00934 }
00935 if(!knownOrigin) ttsSummaryBin = 9;
00936
00937 break;
00938 }
00939 case 4:{
00940 ttsCodeValue = 3;
00941 bool knownOrigin = false;
00942 if(secondWord.busyROSPAF()) {
00943 ttsSummaryBin = 3;
00944 knownOrigin = true;
00945 }
00946 if(secondWord.outputFifoAlmostFull() || secondWord.inputFifoAlmostFull() || secondWord.fifoAlmostFull() ){
00947 ttsSummaryBin = 4;
00948 knownOrigin = true;
00949 }
00950 if(!knownOrigin) ttsSummaryBin = 9;
00951 break;
00952 }
00953 case 8:{
00954 ttsCodeValue = 4;
00955 break;
00956 }
00957 case 12:{
00958 ttsCodeValue = 5;
00959 break;
00960 }
00961 case 16:{
00962 ttsCodeValue = 6;
00963 break;
00964 }
00965 default:{
00966 LogError("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
00967 <<"[DTDataIntegrityTask] DDU control: wrong TTS value "<<trailer.ttsBits()<<endl;
00968 ttsCodeValue = 7;
00969 }
00970 }
00971 if(mode <= 1) dduHistos["TTSValues"][code.getDDUID()]->Fill(ttsCodeValue);
00972 if(ttsSummaryBin != -1) {
00973 hTTSSummary->Fill(ddu, ttsSummaryBin);
00974 }
00975
00976
00977
00978
00979
00980
00981
00982 MonitorElement* hROSStatus = dduHistos["ROSStatus"][code.getDDUID()];
00983
00984
00985 int rosList = secondWord.rosList();
00986 set<int> rosPositions;
00987 for(int i=0;i<12;i++) {
00988 if(rosList & 0x1) {
00989 rosPositions.insert(i);
00990
00991 if(mode <= 2) hROSStatus->Fill(8,i,1);
00992 }
00993 rosList >>= 1;
00994 }
00995
00996 int channel=0;
00997 for (vector<DTDDUFirstStatusWord>::const_iterator fsw_it = data.getFirstStatusWord().begin();
00998 fsw_it != data.getFirstStatusWord().end(); fsw_it++) {
00999
01000 if(mode <= 2) {
01001 hROSStatus->Fill(0,channel,(*fsw_it).channelEnabled());
01002 hROSStatus->Fill(1,channel,(*fsw_it).timeout());
01003 hROSStatus->Fill(2,channel,(*fsw_it).eventTrailerLost());
01004 hROSStatus->Fill(3,channel,(*fsw_it).opticalFiberSignalLost());
01005 hROSStatus->Fill(4,channel,(*fsw_it).tlkPropagationError());
01006 hROSStatus->Fill(5,channel,(*fsw_it).tlkPatternError());
01007 hROSStatus->Fill(6,channel,(*fsw_it).tlkSignalLost());
01008 hROSStatus->Fill(7,channel,(*fsw_it).errorFromROS());
01009 }
01010
01011 if((*fsw_it).channelEnabled() == 1 &&
01012 rosPositions.find(channel) == rosPositions.end()) {
01013 if(mode <= 2) hROSStatus->Fill(9,channel,1);
01014
01015 hFEDFatal->Fill(code.getDDUID());
01016 hCorruptionSummary->Fill(code.getDDUID(), 1);
01017 }
01018 channel++;
01019 }
01020
01021
01022
01023
01024
01025 set<int> rosBXIds = rosBxIdsPerFED[ddu];
01026 if((rosBXIds.size() > 1 || rosBXIds.find(header.bxID()) == rosBXIds.end()) && rosBXIds.size() != 0) {
01027 for(vector<DTROS25Data>::const_iterator rosControlData = rosData.begin();
01028 rosControlData != rosData.end(); ++rosControlData) {
01029 for (vector<DTROSDebugWord>::const_iterator debug_it = (*rosControlData).getROSDebugs().begin();
01030 debug_it != (*rosControlData).getROSDebugs().end(); debug_it++) {
01031 if ((*debug_it).debugType() == 0 && (*debug_it).debugMessage() != header.bxID()) {
01032 int ros = (*rosControlData).getROSID();
01033
01034 if(mode <= 2) hROSStatus->Fill(11,ros-1);
01035
01036 hFEDFatal->Fill(code.getDDUID());
01037 hCorruptionSummary->Fill(code.getDDUID(), 2);
01038 }
01039 }
01040 }
01041 }
01042
01043
01044 fedBXIds.insert(header.bxID());
01045 if(fedBXIds.size() != 1) {
01046 LogWarning("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
01047 << "ERROR: FED " << ddu << " BX ID different from other feds: " << header.bxID() << endl;
01048
01049 hFEDFatal->Fill(code.getDDUID());
01050 hCorruptionSummary->Fill(code.getDDUID(), 3);
01051 }
01052
01053
01054
01055 set<int> rosL1AIds = rosL1AIdsPerFED[ddu];
01056 if((rosL1AIds.size() > 1 || rosL1AIds.find(header.lvl1ID()-1) == rosL1AIds.end()) && rosL1AIds.size() != 0) {
01057
01058 for (vector<DTROS25Data>::const_iterator rosControlData = rosData.begin();
01059 rosControlData != rosData.end(); rosControlData++) {
01060 int ROSHeader_TTCCount = ((*rosControlData).getROSHeader().TTCEventCounter() + 1) % 0x1000000;
01061 if( ROSHeader_TTCCount != header.lvl1ID() ) {
01062 int ros = (*rosControlData).getROSID();
01063 if(mode <= 2) hROSStatus->Fill(10,ros-1);
01064
01065 hFEDFatal->Fill(code.getDDUID());
01066 hCorruptionSummary->Fill(code.getDDUID(), 4);
01067 }
01068 }
01069 }
01070
01071
01072 int fedEvtLenght = trailer.lenght()*8;
01073
01074 dduHistos["EventLenght"][code.getDDUID()]->Fill(fedEvtLenght);
01075
01076 if(mode > 1) return;
01077
01078 dduTimeHistos["FEDAvgEvLenghtvsLumi"][code.getDDUID()]->accumulateValueTimeSlot(fedEvtLenght);
01079
01080
01081 dduHistos["ROSList"][code.getDDUID()]->Fill(rosPositions.size());
01082
01083
01084
01085 MonitorElement *hFIFOStatus = dduHistos["FIFOStatus"][code.getDDUID()];
01086 int inputFifoFull = secondWord.inputFifoFull();
01087 int inputFifoAlmostFull = secondWord.inputFifoAlmostFull();
01088 int fifoFull = secondWord.fifoFull();
01089 int fifoAlmostFull = secondWord.fifoAlmostFull();
01090 int outputFifoFull = secondWord.outputFifoFull();
01091 int outputFifoAlmostFull = secondWord.outputFifoAlmostFull();
01092 for(int i=0;i<3;i++){
01093 if(inputFifoFull & 0x1){
01094 hFIFOStatus->Fill(i,0);
01095 }
01096 if(inputFifoAlmostFull & 0x1){
01097 hFIFOStatus->Fill(i,1);
01098 }
01099 if(fifoFull & 0x1){
01100 hFIFOStatus->Fill(3+i,0);
01101 }
01102 if(fifoAlmostFull & 0x1){
01103 hFIFOStatus->Fill(3+i,1);
01104 }
01105 if(!(inputFifoFull & 0x1) && !(inputFifoAlmostFull & 0x1)){
01106 hFIFOStatus->Fill(i,2);
01107 }
01108 if(!(fifoFull & 0x1) && !(fifoAlmostFull & 0x1)){
01109 hFIFOStatus->Fill(3+i,2);
01110 }
01111 inputFifoFull >>= 1;
01112 inputFifoAlmostFull >>= 1;
01113 fifoFull >>= 1;
01114 fifoAlmostFull >>= 1;
01115 }
01116
01117 if(outputFifoFull){
01118 hFIFOStatus->Fill(6,0);
01119 }
01120 if(outputFifoAlmostFull){
01121 hFIFOStatus->Fill(6,1);
01122 }
01123 if(!outputFifoFull && !outputFifoAlmostFull){
01124 hFIFOStatus->Fill(6,2);
01125 }
01126
01127
01128
01129
01130
01131
01132
01133
01134 dduHistos["EventType"][code.getDDUID()]->Fill(header.triggerType());
01135
01136
01137 dduHistos["BXID"][code.getDDUID()]->Fill(header.bxID());
01138
01139
01140 }
01141
01142
01143 bool DTDataIntegrityTask::eventHasErrors() const {
01144 return eventErrorFlag;
01145 }
01146
01147
01148
01149
01150 void DTDataIntegrityTask::fedEntry(int dduID) {
01151 hFEDEntry->Fill(dduID);
01152 }
01153
01154
01155
01156
01157 void DTDataIntegrityTask::fedFatal(int dduID) {
01158 hFEDFatal->Fill(dduID);
01159 }
01160
01161
01162
01163
01164 void DTDataIntegrityTask::fedNonFatal(int dduID) {
01165 hFEDNonFatal->Fill(dduID);
01166 }
01167
01168 std::string DTDataIntegrityTask::topFolder(bool isFEDIntegrity) const {
01169
01170 string folder = isFEDIntegrity ? fedIntegrityFolder : "DT/00-DataIntegrity";
01171
01172 if (!isFEDIntegrity)
01173 folder += (mode==1) ? "_SM/" : (mode==3) ? "_EvF/" : "/";
01174
01175 return folder;
01176
01177 }
01178
01179 void DTDataIntegrityTask::channelsInCEROS(int cerosId, int chMask, vector<int>& channels ){
01180 for (int iCh=0; iCh<6;++iCh) {
01181 if ((chMask >> iCh) & 0x1){
01182 channels.push_back(cerosId*6+iCh);
01183 }
01184 }
01185 return;
01186 }
01187
01188 void DTDataIntegrityTask::channelsInROS(int cerosMask, vector<int>& channels){
01189 for (int iCeros=0; iCeros<5;++iCeros) {
01190 if ((cerosMask >> iCeros) & 0x1){
01191 for (int iCh=0; iCh<6;++iCh) {
01192 channels.push_back(iCeros*6+iCh);
01193 }
01194 }
01195 }
01196 return;
01197 }
01198
01199 void DTDataIntegrityTask::preProcessEvent(const edm::EventID& iEvtid, const edm::Timestamp& iTime) {
01200
01201 nevents++;
01202 nEventMonitor->Fill(nevents);
01203
01204 nEventsLS++;
01205
01206 LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask") << "[DTDataIntegrityTask]: preProcessEvent" <<endl;
01207
01208 for(map<int, set<int> >::iterator rosBxIds = rosBxIdsPerFED.begin();
01209 rosBxIds != rosBxIdsPerFED.end(); ++rosBxIds) {
01210 (*rosBxIds).second.clear();
01211 }
01212
01213 fedBXIds.clear();
01214
01215 for(map<int, set<int> >::iterator rosL1AIds = rosL1AIdsPerFED.begin();
01216 rosL1AIds != rosL1AIdsPerFED.end(); ++rosL1AIds) {
01217 (*rosL1AIds).second.clear();
01218 }
01219
01220
01221 eventErrorFlag = false;
01222
01223 }
01224
01225 void DTDataIntegrityTask::preBeginLumi(const edm::LuminosityBlockID& ls, const edm::Timestamp& iTime) {
01226
01227 nEventsLS = 0;
01228
01229 }
01230
01231 void DTDataIntegrityTask::preEndLumi(const edm::LuminosityBlockID& ls, const edm::Timestamp& iTime) {
01232
01233 int lumiBlock = ls.luminosityBlock();
01234
01235 map<std::string, map<int, DTTimeEvolutionHisto*> >::iterator dduIt = dduTimeHistos.begin();
01236 map<std::string, map<int, DTTimeEvolutionHisto*> >::iterator dduEnd = dduTimeHistos.end();
01237 for(; dduIt!=dduEnd; ++dduIt) {
01238 map<int, DTTimeEvolutionHisto*>::iterator histoIt = dduIt->second.begin();
01239 map<int, DTTimeEvolutionHisto*>::iterator histoEnd = dduIt->second.end();
01240 for(; histoIt!=histoEnd; ++histoIt) {
01241 histoIt->second->updateTimeSlot(lumiBlock,nEventsLS);
01242 }
01243 }
01244
01245 map<std::string, map<int, DTTimeEvolutionHisto*> >::iterator rosIt = rosTimeHistos.begin();
01246 map<std::string, map<int, DTTimeEvolutionHisto*> >::iterator rosEnd = rosTimeHistos.end();
01247 for(; rosIt!=rosEnd; ++rosIt) {
01248 map<int, DTTimeEvolutionHisto*>::iterator histoIt = rosIt->second.begin();
01249 map<int, DTTimeEvolutionHisto*>::iterator histoEnd = rosIt->second.end();
01250 for(; histoIt!=histoEnd; ++histoIt) {
01251 histoIt->second->updateTimeSlot(lumiBlock,nEventsLS);
01252 }
01253 }
01254
01255 }
01256
01257 void DTDataIntegrityTask::postBeginJob() {
01258 LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask") << "[DTDataIntegrityTask]: postBeginJob" <<endl;
01259
01260 dbe = edm::Service<DQMStore>().operator->();
01261 LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask") << "[DTDataIntegrityTask] Get DQMStore service" << endl;
01262
01263
01264
01265
01266 int FEDIDmin = FEDNumbering::MINDTFEDID;
01267 int FEDIDMax = FEDNumbering::MAXDTFEDID;
01268
01269 LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
01270 << " FEDS: " << FEDIDmin << " to " << FEDIDMax << " in the RO" << endl;
01271
01272
01273 bookHistos(FEDIDmin, FEDIDMax);
01274
01275
01276 for(int fed = FEDIDmin; fed <= FEDIDMax; ++fed) {
01277 DTROChainCoding code;
01278 code.setDDU(fed);
01279
01280 bookHistos( string("ROS_S"), code);
01281
01282 bookHistos( string("DDU"), code);
01283
01284 for(int ros = 1; ros <= 12; ++ros) {
01285 code.setROS(ros);
01286 bookHistosROS25(code);
01287 }
01288 }
01289
01290 }