00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include <DQM/DTMonitorModule/interface/DTDigiTask.h>
00011
00012
00013 #include <FWCore/Framework/interface/EventSetup.h>
00014
00015
00016 #include <DataFormats/DTDigi/interface/DTDigi.h>
00017 #include <DataFormats/DTDigi/interface/DTDigiCollection.h>
00018 #include <DataFormats/MuonDetId/interface/DTLayerId.h>
00019 #include <DataFormats/MuonDetId/interface/DTChamberId.h>
00020
00021
00022 #include "Geometry/Records/interface/MuonGeometryRecord.h"
00023 #include "Geometry/DTGeometry/interface/DTGeometry.h"
00024 #include "Geometry/DTGeometry/interface/DTLayer.h"
00025 #include "Geometry/DTGeometry/interface/DTTopology.h"
00026
00027
00028 #include <CondFormats/DTObjects/interface/DTT0.h>
00029 #include <CondFormats/DataRecord/interface/DTT0Rcd.h>
00030 #include <CondFormats/DTObjects/interface/DTTtrig.h>
00031 #include <CondFormats/DataRecord/interface/DTTtrigRcd.h>
00032
00033 #include "CondFormats/DataRecord/interface/DTStatusFlagRcd.h"
00034 #include "CondFormats/DTObjects/interface/DTStatusFlag.h"
00035
00036 #include "DQMServices/Core/interface/DQMStore.h"
00037 #include "DQMServices/Core/interface/MonitorElement.h"
00038 #include "FWCore/ServiceRegistry/interface/Service.h"
00039
00040 #include <sstream>
00041 #include <math.h>
00042
00043 using namespace edm;
00044 using namespace std;
00045
00046
00047
00048
00049 DTDigiTask::DTDigiTask(const edm::ParameterSet& ps){
00050
00051 LogTrace("DTDQM|DTMonitorModule|DTDigiTask") << "[DTDigiTask]: Constructor" << endl;
00052
00053
00054 dtDigiLabel = ps.getParameter<InputTag>("dtDigiLabel");
00055
00056 maxTDCHits = ps.getUntrackedParameter<int>("maxTDCHitsPerChamber",30000);
00057
00058 readTTrigDB = ps.getUntrackedParameter<bool>("readDB", false);
00059
00060 subtractT0 = ps.getParameter<bool>("performPerWireT0Calibration");
00061
00062 defaultTmax = ps.getParameter<int>("defaultTmax");
00063
00064 doStaticBooking = ps.getUntrackedParameter<bool>("staticBooking", true);
00065
00066 isLocalRun = ps.getUntrackedParameter<bool>("localrun", true);
00067
00068 resetCycle = ps.getUntrackedParameter<int>("ResetCycle", 3);
00069
00070 checkNoisyChannels = ps.getUntrackedParameter<bool>("checkNoisyChannels",false);
00071
00072 defaultTTrig = ps.getParameter<int>("defaultTtrig");
00073 inTimeHitsLowerBound = ps.getParameter<int>("inTimeHitsLowerBound");
00074 inTimeHitsUpperBound = ps.getParameter<int>("inTimeHitsUpperBound");
00075 timeBoxGranularity = ps.getUntrackedParameter<int>("timeBoxGranularity",4);
00076 maxTDCCounts = ps.getUntrackedParameter<int>("maxTDCCounts", 6400);
00077
00078 doAllHitsOccupancies = ps.getUntrackedParameter<bool>("doAllHitsOccupancies", true);
00079 doNoiseOccupancies = ps.getUntrackedParameter<bool>("doNoiseOccupancies", false);
00080 doInTimeOccupancies = ps.getUntrackedParameter<bool>("doInTimeOccupancies", false);
00081
00082
00083 tpMode = ps.getUntrackedParameter<bool>("testPulseMode", false);
00084
00085
00086 filterSyncNoise = ps.getUntrackedParameter<bool>("filterSyncNoise", false);
00087
00088 lookForSyncNoise = ps.getUntrackedParameter<bool>("lookForSyncNoise", false);
00089
00090 doLayerTimeBoxes = ps.getUntrackedParameter<bool>("doLayerTimeBoxes", false);
00091
00092 dbe = edm::Service<DQMStore>().operator->();
00093
00094 syncNumTot = 0;
00095 syncNum = 0;
00096
00097 }
00098
00099
00100
00101
00102 DTDigiTask::~DTDigiTask(){
00103 LogTrace("DTDQM|DTMonitorModule|DTDigiTask") << "DTDigiTask: analyzed " << nevents << " events" << endl;
00104
00105 }
00106
00107
00108
00109
00110 void DTDigiTask::endJob(){
00111 LogTrace("DTDQM|DTMonitorModule|DTDigiTask") <<"[DTDigiTask] endjob called!"<<endl;
00112
00113 }
00114
00115
00116
00117
00118 void DTDigiTask::beginJob(){
00119 LogTrace("DTDQM|DTMonitorModule|DTDigiTask") <<"[DTDigiTask]: BeginJob"<<endl;
00120
00121 nevents = 0;
00122 }
00123
00124
00125 void DTDigiTask::beginRun(const edm::Run& run, const edm::EventSetup& context) {
00126 LogTrace("DTDQM|DTMonitorModule|DTDigiTask") << "[DTDigiTask]: begin run" << endl;
00127
00128
00129 context.get<MuonGeometryRecord>().get(muonGeom);
00130
00131
00132 if (readTTrigDB)
00133 context.get<DTTtrigRcd>().get(tTrigMap);
00134
00135 if (subtractT0)
00136 context.get<DTT0Rcd>().get(t0Map);
00137
00138 tMax = defaultTmax;
00139
00140
00141 if(doStaticBooking) {
00142
00143 dbe->setCurrentFolder("DT/EventInfo/Counters");
00144 nEventMonitor = dbe->bookFloat(tpMode ? "nProcessedEventsDigi" : "nProcessedEventsDigiTP");
00145 dbe->setCurrentFolder(topFolder());
00146 for(int wh = -2; wh <= 2; ++wh) {
00147 if(doAllHitsOccupancies) bookHistos(wh,string("Occupancies"),"OccupancyAllHits");
00148 if(doNoiseOccupancies) bookHistos(wh,string("Occupancies"),"OccupancyNoiseHits");
00149 if(doInTimeOccupancies) bookHistos(wh,string("Occupancies"),"OccupancyInTimeHits");
00150
00151 if(lookForSyncNoise || filterSyncNoise) {
00152 bookHistos(wh,string("SynchNoise"),"SyncNoiseEvents");
00153 bookHistos(wh,string("SynchNoise"),"SyncNoiseChambs");
00154 }
00155
00156 for(int st = 1; st <= 4; ++st) {
00157 for(int sect = 1; sect <= 14; ++sect) {
00158 if((sect == 13 || sect == 14) && st != 4) continue;
00159
00160 const DTChamberId dtChId(wh,st,sect);
00161
00162
00163 if (doAllHitsOccupancies)
00164 bookHistos(dtChId,string("Occupancies"),"OccupancyAllHits_perCh");
00165 if(doNoiseOccupancies)
00166 bookHistos(dtChId,string("Occupancies"),"OccupancyNoise_perCh");
00167 if(doInTimeOccupancies)
00168 bookHistos(dtChId,string("Occupancies"),"OccupancyInTimeHits_perCh");
00169
00170
00171
00172
00173 for(int sl = 1; sl <= 3; ++sl) {
00174 if(st == 4 && sl == 2) continue;
00175 const DTSuperLayerId dtSLId(wh,st,sect,sl);
00176 if(isLocalRun) {
00177 bookHistos(dtSLId,string("TimeBoxes"),"TimeBox");
00178 } else {
00179
00180 bookHistos(dtSLId,string("TimeBoxes"),"TimeBoxDTonly");
00181 bookHistos(dtSLId,string("TimeBoxes"),"TimeBoxNoDT");
00182 bookHistos(dtSLId,string("TimeBoxes"),"TimeBoxDTalso");
00183 }
00184 }
00185 }
00186 }
00187 }
00188 }
00189 }
00190
00191
00192
00193
00194 void DTDigiTask::beginLuminosityBlock(LuminosityBlock const& lumiSeg, EventSetup const& context) {
00195
00196 LogTrace("DTDQM|DTMonitorModule|DTDigiTask") << "[DTDigiTask]: Begin of LS transition" << endl;
00197
00198
00199 int lumiBlock = lumiSeg.id().luminosityBlock();
00200 if(lumiBlock % resetCycle == 0) {
00201 LogVerbatim("DTDQM|DTMonitorModule|DTDigiTask")
00202 <<"[DTDigiTask]: Reset at the LS transition : "
00203 << lumiBlock << endl;
00204
00205 map<string,map<uint32_t,MonitorElement*> >::const_iterator histosIt = digiHistos.begin();
00206 map<string,map<uint32_t,MonitorElement*> >::const_iterator histosEnd = digiHistos.end();
00207 for(;histosIt != histosEnd ; ++histosIt) {
00208 map<uint32_t,MonitorElement*>::const_iterator histoIt = (*histosIt).second.begin();
00209 map<uint32_t,MonitorElement*>::const_iterator histoEnd = (*histosIt).second.end();
00210 for(;histoIt != histoEnd; ++histoIt) { (*histoIt).second->Reset(); }
00211 }
00212
00213
00214 map<string,map<int,MonitorElement*> >::const_iterator whHistosIt = wheelHistos.begin();
00215 map<string,map<int,MonitorElement*> >::const_iterator whHistosEnd = wheelHistos.end();
00216 for(; whHistosIt != whHistosEnd ; ++whHistosIt) {
00217 if ((*whHistosIt).first.find("Sync") == string::npos) {
00218 map<int,MonitorElement*>::const_iterator histoIt = (*whHistosIt).second.begin();
00219 map<int,MonitorElement*>::const_iterator histoEnd = (*whHistosIt).second.end();
00220 for(;histoIt != histoEnd; ++histoIt) { (*histoIt).second->Reset(); }
00221 }
00222 }
00223 }
00224
00225 }
00226
00227
00228
00229
00230 void DTDigiTask::bookHistos(const DTSuperLayerId& dtSL, string folder, string histoTag) {
00231
00232 stringstream wheel; wheel << dtSL.wheel();
00233 stringstream station; station << dtSL.station();
00234 stringstream sector; sector << dtSL.sector();
00235 stringstream superLayer; superLayer << dtSL.superlayer();
00236 dbe->setCurrentFolder(topFolder() + "Wheel" + wheel.str() +
00237 "/Sector" + sector.str() +
00238 "/Station" + station.str());
00239
00240
00241 string histoName = histoTag
00242 + "_W" + wheel.str()
00243 + "_St" + station.str()
00244 + "_Sec" + sector.str()
00245 + "_SL" + superLayer.str();
00246
00247 LogTrace("DTDQM|DTMonitorModule|DTDigiTask")
00248 << "[DTDigiTask]: booking SL histo:" << histoName
00249 << " (tag: " << histoTag
00250 << ") folder: " << topFolder() + "Wheel" + wheel.str() +
00251 "/Station" + station.str() +
00252 "/Sector" + sector.str() + "/" + folder << endl;
00253
00254
00255
00256 if ( readTTrigDB )
00257 tTrigMap->get(dtSL, tTrig, tTrigRMS, kFactor, DTTimeUnits::counts);
00258 else tTrig = defaultTTrig;
00259
00260
00261 if ( folder == "TimeBoxes") {
00262 string histoTitle = histoName + " (TDC Counts)";
00263
00264 if (!readTTrigDB) {
00265 (digiHistos[histoTag])[dtSL.rawId()] =
00266 dbe->book1D(histoName,histoTitle, maxTDCCounts/timeBoxGranularity, 0, maxTDCCounts);
00267 if(doLayerTimeBoxes) {
00268 for(int layer = 1; layer != 5; ++layer) {
00269 DTLayerId layerId(dtSL, layer);
00270 stringstream layerHistoName; layerHistoName << histoName << "_L" << layer;
00271 (digiHistos[histoTag])[layerId.rawId()] =
00272 dbe->book1D(layerHistoName.str(),layerHistoName.str(), maxTDCCounts/timeBoxGranularity, 0, maxTDCCounts);
00273 }
00274 }
00275 }
00276 else {
00277 (digiHistos[histoTag])[dtSL.rawId()] =
00278 dbe->book1D(histoName,histoTitle, 3*tMax/timeBoxGranularity, tTrig-tMax, tTrig+2*tMax);
00279 if(doLayerTimeBoxes) {
00280
00281 for(int layer = 1; layer != 5; ++layer) {
00282 DTLayerId layerId(dtSL, layer);
00283 stringstream layerHistoName; layerHistoName << histoName << "_L" << layer;
00284 (digiHistos[histoTag])[layerId.rawId()] =
00285 dbe->book1D(layerHistoName.str(),layerHistoName.str(), 3*tMax/timeBoxGranularity, tTrig-tMax, tTrig+2*tMax);
00286 }
00287 }
00288 }
00289 }
00290
00291 if ( folder == "CathodPhotoPeaks" ) {
00292 dbe->setCurrentFolder(topFolder() + "Wheel" + wheel.str() +
00293 "/Sector" + sector.str() +
00294 "/Station" + station.str() + "/" + folder);
00295 (digiHistos[histoTag])[dtSL.rawId()] = dbe->book1D(histoName,histoName,500,0,1000);
00296 }
00297
00298 }
00299
00300
00301
00302
00303 void DTDigiTask::bookHistos(const DTChamberId& dtCh, string folder, string histoTag) {
00304
00305 stringstream wheel; wheel << dtCh.wheel();
00306 stringstream station; station << dtCh.station();
00307 stringstream sector; sector << dtCh.sector();
00308 dbe->setCurrentFolder(topFolder() + "Wheel" + wheel.str() +
00309 "/Sector" + sector.str() +
00310 "/Station" + station.str());
00311
00312
00313 string histoName = histoTag
00314 + "_W" + wheel.str()
00315 + "_St" + station.str()
00316 + "_Sec" + sector.str();
00317
00318
00319 LogTrace("DTDQM|DTMonitorModule|DTDigiTask")
00320 << "[DTDigiTask]: booking chamber histo:"
00321 << " (tag: " << histoTag
00322 << ") folder: " << topFolder() + "Wheel" + wheel.str() +
00323 "/Station" + station.str() +
00324 "/Sector" + sector.str() << endl;
00325
00326
00327 if (folder == "Occupancies") {
00328
00329 const DTChamber* dtchamber = muonGeom->chamber(dtCh);
00330 const std::vector<const DTSuperLayer*> dtSupLylist = dtchamber->superLayers();
00331 std::vector<const DTSuperLayer*>::const_iterator suly = dtSupLylist.begin();
00332 std::vector<const DTSuperLayer*>::const_iterator sulyend = dtSupLylist.end();
00333
00334 int nWires = 0;
00335 int firstWire = 0;
00336 int nWires_max = 0;
00337
00338 while(suly != sulyend) {
00339 const std::vector<const DTLayer*> dtLyList = (*suly)->layers();
00340 std::vector<const DTLayer*>::const_iterator ly = dtLyList.begin();
00341 std::vector<const DTLayer*>::const_iterator lyend = dtLyList.end();
00342 stringstream superLayer; superLayer << (*suly)->id().superlayer();
00343
00344 while(ly != lyend) {
00345 nWires = muonGeom->layer((*ly)->id())->specificTopology().channels();
00346 firstWire = muonGeom->layer((*ly)->id())->specificTopology().firstChannel();
00347 stringstream layer; layer << (*ly)->id().layer();
00348 string histoName_layer = histoName + "_SL" + superLayer.str() + "_L" + layer.str();
00349 if(histoTag == "OccupancyAllHits_perL"
00350 || histoTag == "OccupancyNoise_perL"
00351 || histoTag == "OccupancyInTimeHits_perL")
00352 (digiHistos[histoTag])[(*ly)->id().rawId()] = dbe->book1D(histoName_layer,histoName_layer,nWires,firstWire,nWires+firstWire);
00353 ++ly;
00354 if((nWires+firstWire) > nWires_max) nWires_max = (nWires+firstWire);
00355
00356 }
00357 ++suly;
00358 }
00359
00360 if(histoTag != "OccupancyAllHits_perL"
00361 && histoTag != "OccupancyNoise_perL"
00362 && histoTag != "OccupancyInTimeHits_perL"){
00363
00364 string histoTitle = histoName;
00365 if(!readTTrigDB && histoTag == "OccupancyInTimeHits_perCh") {
00366 stringstream title;
00367 int inTimeHitsLowerBoundCorr = int(round(defaultTTrig)) - inTimeHitsLowerBound;
00368 int inTimeHitsUpperBoundCorr = int(round(defaultTTrig)) + defaultTmax + inTimeHitsUpperBound;
00369 title << "Occ. digis in time [" << inTimeHitsLowerBoundCorr << ", "
00370 << inTimeHitsUpperBoundCorr << "] (TDC counts)";
00371 histoTitle = title.str();
00372 }
00373 (digiHistos[histoTag])[dtCh.rawId()] = dbe->book2D(histoName,histoTitle,nWires_max,1,nWires_max+1,12,0,12);
00374
00375 for(int i=1;i<=12;i++) {
00376 if(i<5){
00377 stringstream layer;
00378 string layer_name;
00379 layer<<i;
00380 layer>>layer_name;
00381 string label="SL1: L"+layer_name;
00382 (digiHistos[histoTag])[dtCh.rawId()]->setBinLabel(i,label,2);
00383 }
00384 else if(i>4 && i<9){
00385 stringstream layer;
00386 string layer_name;
00387 layer<<(i-4);
00388 layer>>layer_name;
00389 string label="SL2: L"+layer_name;
00390 (digiHistos[histoTag])[dtCh.rawId()]->setBinLabel(i,label,2);
00391 }
00392 else if(i>8 && i<13){
00393 stringstream layer;
00394 string layer_name;
00395 layer<<(i-8);
00396 layer>>layer_name;
00397 string label="SL3: L"+layer_name;
00398 (digiHistos[histoTag])[dtCh.rawId()]->setBinLabel(i,label,2);
00399 }
00400 }
00401 }
00402 }
00403 }
00404
00405
00406
00407
00408 void DTDigiTask::bookHistos(const int wheelId, string folder, string histoTag) {
00409
00410 stringstream wheel; wheel << wheelId;
00411
00412
00413
00414 string histoName = histoTag + "_W" + wheel.str();
00415
00416
00417 LogTrace("DTDQM|DTMonitorModule|DTDigiTask")
00418 << "[DTDigiTask]: booking wheel histo:" << histoName
00419 << " (tag: " << histoTag
00420 << ") folder: " << topFolder() + "Wheel" + wheel.str() + "/" <<endl;
00421
00422 if(folder == "Occupancies") {
00423 dbe->setCurrentFolder(topFolder() + "Wheel" + wheel.str());
00424 string histoTitle = "# of digis per chamber WHEEL: "+wheel.str();
00425 (wheelHistos[histoTag])[wheelId] = dbe->book2D(histoName,histoTitle,12,1,13,4,1,5);
00426 (wheelHistos[histoTag])[wheelId]->setBinLabel(1,"MB1",2);
00427 (wheelHistos[histoTag])[wheelId]->setBinLabel(2,"MB2",2);
00428 (wheelHistos[histoTag])[wheelId]->setBinLabel(3,"MB3",2);
00429 (wheelHistos[histoTag])[wheelId]->setBinLabel(4,"MB4",2);
00430 (wheelHistos[histoTag])[wheelId]->setAxisTitle("sector",1);
00431 } else if(folder == "SynchNoise") {
00432 dbe->setCurrentFolder("DT/05-Noise/SynchNoise");
00433 if (histoTag== "SyncNoiseEvents") {
00434 string histoTitle = "# of Syncronous-noise events WHEEL: "+wheel.str();
00435 (wheelHistos[histoTag])[wheelId] = dbe->book2D(histoName,histoTitle,12,1,13,4,1,5);
00436 (wheelHistos[histoTag])[wheelId]->setBinLabel(1,"MB1",2);
00437 (wheelHistos[histoTag])[wheelId]->setBinLabel(2,"MB2",2);
00438 (wheelHistos[histoTag])[wheelId]->setBinLabel(3,"MB3",2);
00439 (wheelHistos[histoTag])[wheelId]->setBinLabel(4,"MB4",2);
00440 (wheelHistos[histoTag])[wheelId]->setAxisTitle("sector",1);
00441 } else if (histoTag== "SyncNoiseChambs") {
00442 string histoTitle = "# of Synchornous-noise chamb per evt. WHEEL: "+wheel.str();
00443 (wheelHistos[histoTag])[wheelId] = dbe->book1D(histoName,histoTitle,50,0.5,50.5);
00444 (wheelHistos[histoTag])[wheelId]->setAxisTitle("# of noisy chambs.",1);
00445 (wheelHistos[histoTag])[wheelId]->setAxisTitle("# of evts.",2);
00446 }
00447 }
00448
00449 }
00450
00451
00452
00453
00454 void DTDigiTask::analyze(const edm::Event& event, const edm::EventSetup& c) {
00455 nevents++;
00456 nEventMonitor->Fill(nevents);
00457 if (nevents%1000 == 0) {
00458 LogTrace("DTDQM|DTMonitorModule|DTDigiTask") << "[DTDigiTask] Analyze #Run: " << event.id().run()
00459 << " #Event: " << event.id().event() << endl;
00460 }
00461
00462
00463
00464
00465 edm::Handle<DTDigiCollection> dtdigis;
00466 event.getByLabel(dtDigiLabel, dtdigis);
00467
00468
00469 if (!isLocalRun) event.getByType(ltcdigis);
00470
00471
00472 ESHandle<DTStatusFlag> statusMap;
00473 if(checkNoisyChannels) {
00474
00475 c.get<DTStatusFlagRcd>().get(statusMap);
00476 }
00477
00478 string histoTag;
00479
00480
00481
00482 if(dtdigis->begin() == dtdigis->end()) {
00483 LogTrace("DTDQM|DTMonitorModule|DTDigiTask") << "Event " << nevents << " empty." << endl;
00484 }
00485
00486 if (lookForSyncNoise || filterSyncNoise) {
00487
00488 DTDigiCollection::DigiRangeIterator dtLayerId_It;
00489 for (dtLayerId_It=dtdigis->begin(); dtLayerId_It!=dtdigis->end(); dtLayerId_It++) {
00490 DTChamberId chId = ((*dtLayerId_It).first).chamberId();
00491 if(hitMap.find(chId) == hitMap.end()) {
00492 hitMap[chId] = 0;
00493 }
00494 hitMap[chId] += (((*dtLayerId_It).second).second - ((*dtLayerId_It).second).first);
00495 }
00496
00497
00498
00499
00500 map<DTChamberId,int>::const_iterator hitMapIt = hitMap.begin();
00501 map<DTChamberId,int>::const_iterator hitMapEnd = hitMap.end();
00502
00503 map<int,int> chMap;
00504
00505 for (; hitMapIt != hitMapEnd; ++hitMapIt) {
00506 if((hitMapIt->second) > maxTDCHits) {
00507
00508 DTChamberId chId = hitMapIt->first;
00509 int wh = chId.wheel();
00510
00511 LogTrace("DTDQM|DTMonitorModule|DTDigiTask") << "[DTDigiTask] Synch noise in chamber: " << chId
00512 << " with # digis: " << hitMapIt->second << endl;
00513
00514 if(chMap.find(wh) == chMap.end()) { chMap[wh] = 0; }
00515 chMap[wh]++ ;
00516
00517 syncNoisyChambers.insert(chId);
00518
00519 wheelHistos["SyncNoiseEvents"][wh]->Fill(chId.sector(),chId.station());
00520
00521
00522
00523
00524
00525
00526
00527
00528 }
00529 }
00530
00531
00532 map<int,int>::const_iterator chMapIt = chMap.begin();
00533 map<int,int>::const_iterator chMapEnd = chMap.end();
00534 for (; chMapIt != chMapEnd; ++chMapIt) {
00535 wheelHistos["SyncNoiseChambs"][(*chMapIt).first]->Fill((*chMapIt).second);
00536 }
00537
00538
00539 hitMap.clear();
00540
00541 if (syncNoisyChambers.size() != 0) {
00542 LogVerbatim("DTDQM|DTMonitorModule|DTDigiTask") << "[DTDigiTask] Synch Noise in event: " << nevents;
00543 if(filterSyncNoise) LogVerbatim("DTDQM|DTMonitorModule|DTDigiTask") << "\tnoisy time-boxes and occupancy will not be filled!" << endl;
00544 syncNumTot++;
00545 syncNum++;
00546 }
00547
00548
00549 if (syncNoisyChambers.size() > 3) {
00550 time_t eventTime = time_t(event.time().value()>>32);
00551
00552 LogVerbatim("DTDQM|DTMonitorModule|DTDigiTask|DTSynchNoise")
00553 << "[DTDigiTask] At least 4 Synch Noisy chambers in Run : " << event.id().run()
00554 << " Lumi : " << event.id().luminosityBlock()
00555 << " Event : " << event.id().event()
00556 << " at time : " << ctime(&eventTime) << endl;
00557
00558 set<DTChamberId>::const_iterator chIt = syncNoisyChambers.begin();
00559 set<DTChamberId>::const_iterator chEnd = syncNoisyChambers.end();
00560
00561 stringstream synchNoisyCh;
00562 for (;chIt!=chEnd;++chIt) { synchNoisyCh << " " << (*chIt); }
00563 LogVerbatim("DTDQM|DTMonitorModule|DTDigiTask|DTSynchNoise") <<
00564 "[DTDigiTask] Chamber List :" << synchNoisyCh.str() << endl;
00565
00566 }
00567
00568
00569 if (nevents%1000 == 0) {
00570 LogVerbatim("DTDQM|DTMonitorModule|DTDigiTask") << (syncNumTot*100./nevents) << "% sync noise events since the beginning \n"
00571 << (syncNum*0.1) << "% sync noise events in the last 1000 events " << endl;
00572 syncNum = 0;
00573 }
00574 }
00575
00576 bool isSyncNoisy = false;
00577
00578 DTDigiCollection::DigiRangeIterator dtLayerId_It;
00579 for (dtLayerId_It=dtdigis->begin(); dtLayerId_It!=dtdigis->end(); ++dtLayerId_It) {
00580 isSyncNoisy = false;
00581
00582 if (filterSyncNoise) {
00583 DTChamberId chId = ((*dtLayerId_It).first).chamberId();
00584 if(syncNoisyChambers.find(chId) != syncNoisyChambers.end()) {
00585 isSyncNoisy = true;
00586 }
00587 }
00588
00589 for (DTDigiCollection::const_iterator digiIt = ((*dtLayerId_It).second).first;
00590 digiIt!=((*dtLayerId_It).second).second; ++digiIt) {
00591
00592 bool isNoisy = false;
00593 bool isFEMasked = false;
00594 bool isTDCMasked = false;
00595 bool isTrigMask = false;
00596 bool isDead = false;
00597 bool isNohv = false;
00598 if(checkNoisyChannels) {
00599 const DTWireId wireId(((*dtLayerId_It).first), (*digiIt).wire());
00600 statusMap->cellStatus(wireId, isNoisy, isFEMasked, isTDCMasked, isTrigMask, isDead, isNohv);
00601 }
00602
00603
00604
00605
00606 const DTSuperLayerId dtSLId = ((*dtLayerId_It).first).superlayerId();
00607 uint32_t indexSL = dtSLId.rawId();
00608 const DTChamberId dtChId = dtSLId.chamberId();
00609 uint32_t indexCh = dtChId.rawId();
00610 int layer_number=((*dtLayerId_It).first).layer();
00611 int superlayer_number=dtSLId.superlayer();
00612 const DTLayerId dtLId = (*dtLayerId_It).first;
00613
00614
00615
00616 if (readTTrigDB)
00617 tTrigMap->get( ((*dtLayerId_It).first).superlayerId(),
00618 tTrig, tTrigRMS, kFactor, DTTimeUnits::counts);
00619 else tTrig = defaultTTrig;
00620
00621 int inTimeHitsLowerBoundCorr = int(round(tTrig)) - inTimeHitsLowerBound;
00622 int inTimeHitsUpperBoundCorr = int(round(tTrig)) + tMax + inTimeHitsUpperBound;
00623
00624 float t0; float t0RMS;
00625 int tdcTime = (*digiIt).countsTDC();
00626
00627 if (subtractT0) {
00628 const DTWireId dtWireId(((*dtLayerId_It).first), (*digiIt).wire());
00629
00630 t0Map->get(dtWireId, t0, t0RMS, DTTimeUnits::counts) ;
00631 tdcTime += int(round(t0));
00632 }
00633
00634
00635
00636
00637
00638 if (( !isNoisy ) && (!isSyncNoisy)) {
00639
00640 histoTag = "TimeBox" + triggerSource();
00641 if (digiHistos[histoTag].find(indexSL) == digiHistos[histoTag].end())
00642 bookHistos( dtSLId, string("TimeBoxes"), histoTag );
00643 (digiHistos.find(histoTag)->second).find(indexSL)->second->Fill(tdcTime);
00644 if(doLayerTimeBoxes)
00645 (digiHistos.find(histoTag)->second).find((*dtLayerId_It).first.rawId())->second->Fill(tdcTime);
00646
00647
00648
00649
00650
00651
00652
00653
00654
00655
00656
00657
00658
00659 }
00660
00661
00662 if (!isSyncNoisy) {
00663
00664 if (doAllHitsOccupancies) {
00665
00666 histoTag = "OccupancyAllHits_perCh";
00667 map<uint32_t, MonitorElement*>::const_iterator mappedHisto =
00668 digiHistos[histoTag].find(indexCh);
00669 if (mappedHisto == digiHistos[histoTag].end()) {
00670 bookHistos(dtChId, string("Occupancies"), histoTag);
00671 mappedHisto = digiHistos[histoTag].find(indexCh);
00672 }
00673 mappedHisto->second->Fill((*digiIt).wire(),(layer_number+(superlayer_number-1)*4)-1);
00674
00675
00676
00677 histoTag = "OccupancyAllHits";
00678 map<int, MonitorElement*>::const_iterator histoPerWheel =
00679 wheelHistos[histoTag].find(dtChId.wheel());
00680 if(histoPerWheel == wheelHistos[histoTag].end()) {
00681 bookHistos(dtChId.wheel(), string("Occupancies"), histoTag);
00682 histoPerWheel = wheelHistos[histoTag].find(dtChId.wheel());
00683 }
00684 histoPerWheel->second->Fill(dtChId.sector(),dtChId.station());
00685
00686
00687 }
00688
00689 if(doNoiseOccupancies) {
00690 if (tdcTime < inTimeHitsLowerBoundCorr ) {
00691
00692
00693
00694
00695 histoTag = "OccupancyNoise_perCh";
00696 map<uint32_t, MonitorElement*>::const_iterator mappedHisto =
00697 digiHistos[histoTag].find(indexCh);
00698 if(mappedHisto == digiHistos[histoTag].end()) {
00699 bookHistos(dtChId, string("Occupancies"), histoTag);
00700 mappedHisto = digiHistos[histoTag].find(indexCh);
00701 }
00702 mappedHisto->second->Fill((*digiIt).wire(),
00703 (layer_number+(superlayer_number-1)*4)-1);
00704
00705
00706 histoTag = "OccupancyNoise";
00707 map<int, MonitorElement*>::const_iterator histoPerWheel =
00708 wheelHistos[histoTag].find(dtChId.wheel());
00709 if(histoPerWheel == wheelHistos[histoTag].end()) {
00710 bookHistos(dtChId.wheel(), string("Occupancies"), histoTag);
00711 histoPerWheel = wheelHistos[histoTag].find(dtChId.wheel());
00712 }
00713 histoPerWheel->second->Fill(dtChId.sector(),dtChId.station());
00714
00715 }
00716 }
00717
00718 if(doInTimeOccupancies) {
00719 if (tdcTime > inTimeHitsLowerBoundCorr && tdcTime < inTimeHitsUpperBoundCorr) {
00720
00721
00722
00723 histoTag = "OccupancyInTimeHits_perCh";
00724 map<uint32_t, MonitorElement*>::const_iterator mappedHisto =
00725 digiHistos[histoTag].find(indexCh);
00726 if(mappedHisto == digiHistos[histoTag].end()) {
00727 bookHistos(dtChId, string("Occupancies"), histoTag);
00728 mappedHisto = digiHistos[histoTag].find(indexCh);
00729 }
00730 mappedHisto->second->Fill((*digiIt).wire(),
00731 (layer_number+(superlayer_number-1)*4)-1);
00732
00733
00734 histoTag = "OccupancyInTimeHits";
00735 map<int, MonitorElement*>::const_iterator histoPerWheel =
00736 wheelHistos[histoTag].find(dtChId.wheel());
00737 if(histoPerWheel == wheelHistos[histoTag].end()) {
00738 bookHistos(dtChId.wheel(), string("Occupancies"), histoTag);
00739 histoPerWheel = wheelHistos[histoTag].find(dtChId.wheel());
00740 }
00741 histoPerWheel->second->Fill(dtChId.sector(),dtChId.station());
00742
00743 }
00744 }
00745 }
00746 }
00747 }
00748
00749 syncNoisyChambers.clear();
00750 }
00751
00752
00753 string DTDigiTask::triggerSource() {
00754
00755 string l1ASource;
00756
00757 if (!isLocalRun) {
00758 for (std::vector<LTCDigi>::const_iterator ltc_it = ltcdigis->begin(); ltc_it != ltcdigis->end(); ltc_it++){
00759 int otherTriggerSum=0;
00760 for (int i = 1; i < 6; i++)
00761 otherTriggerSum += int((*ltc_it).HasTriggered(i));
00762
00763 if ((*ltc_it).HasTriggered(0) && otherTriggerSum == 0)
00764 l1ASource = "DTonly";
00765 else if (!(*ltc_it).HasTriggered(0))
00766 l1ASource = "NoDT";
00767 else if ((*ltc_it).HasTriggered(0) && otherTriggerSum > 0)
00768 l1ASource = "DTalso";
00769 }
00770 }
00771
00772 return l1ASource;
00773
00774 }
00775
00776
00777 string DTDigiTask::topFolder() const {
00778
00779 if(tpMode) return string("DT/10-TestPulses/");
00780 return string("DT/01-Digi/");
00781
00782 }
00783
00784
00785
00786
00787 void DTDigiTask::endLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& setup) {
00788
00789
00790
00791
00792
00793
00794
00795
00796
00797
00798
00799
00800
00801 }