CMS 3D CMS Logo

DTDCSByLumiTask.cc
Go to the documentation of this file.
1 /*
2  * \file DTDCSByLumiTask.cc
3  *
4  * \author C. Battilana - CIEMAT
5  * \author P. Bellan - INFN PD
6  * \author A. Branca = INFN PD
7 
8  *
9  */
10 
12 
13 // Framework
15 
16 // Geometry
19 
25 
26 #include <iostream>
27 
28 using namespace edm;
29 using namespace std;
30 
32  : theEvents(0),
33  theLumis(0),
36  LogTrace("DTDQM|DTMonitorModule|DTDCSByLumiTask") << "[DTDCSByLumiTask]: Constructor" << endl;
37 
38  // If needed put getParameter here
39  // dtDCSByLumiLabel = ps.getParameter<InputTag>("dtDCSByLumiLabel");
40 }
41 
43  LogTrace("DTDQM|DTMonitorModule|DTDCSByLumiTask")
44  << "DTDCSByLumiTask: processed " << theEvents << " events in " << theLumis << " lumi sections" << endl;
45 }
46 
48  LogTrace("DTDQM|DTMonitorModule|DTDCSByLumiTask") << "[DTDCSByLumiTask]: begin run" << endl;
49 
50  theDTGeom = context.getHandle(dtGeometryToken_);
51 
52  DTHVRecordFound = true;
53 
55 
56  std::vector<eventsetup::EventSetupRecordKey> recordKeys;
57  context.fillAvailableRecordKeys(recordKeys);
58  vector<eventsetup::EventSetupRecordKey>::iterator it = find(recordKeys.begin(), recordKeys.end(), recordKey);
59 
60  if (it == recordKeys.end()) {
61  //record not found
62  LogTrace("DTDQM|DTMonitorModule|DTDCSByLumiTask") << "Record DTHVStatusRcd does not exist " << std::endl;
63 
64  DTHVRecordFound = false;
65  }
66 }
67 
69  // Book bylumi histo (# of bins as reduced as possible)
70  ibooker.setCurrentFolder(topFolder());
71 
72  for (int wheel = -2; wheel <= 2; wheel++) {
73  stringstream wheel_str;
74  wheel_str << wheel;
75 
76  {
77  // Set Lumi scope in order to save histo every LS
78  auto scope = DQMStore::IBooker::UseLumiScope(ibooker);
80  ibooker.book1D("hActiveUnits" + wheel_str.str(), "Active Untis x LS Wh" + wheel_str.str(), 2, 0.5, 2.5);
81  hActiveUnits.push_back(ME);
82  }
83  }
84 }
85 
87  theLumis++;
88 
89  LogTrace("DTDQM|DTMonitorModule|DTDCSByLumiTask")
90  << "[DTDCSByLumiTask]: Begin of processed lumi # " << lumiSeg.id().luminosityBlock() << " " << theLumis
91  << " lumi processed by this job" << endl;
92 
93  for (int wheel = 0; wheel < 5; wheel++) {
94  hActiveUnits[wheel]->Reset(); // Cb by lumi histo need to be resetted in between lumi boundaries
95  }
96 }
97 
99  const DTHVStatus* dtHVStatus = nullptr;
100  if (DTHVRecordFound) {
101  dtHVStatus = &context.getData(dtHVStatusToken_);
102  }
103 
104  vector<const DTLayer*>::const_iterator layersIt = theDTGeom->layers().begin();
105  vector<const DTLayer*>::const_iterator layersEnd = theDTGeom->layers().end();
106 
107  for (; layersIt != layersEnd; ++layersIt) {
108  int wheel = (*layersIt)->id().wheel();
109 
110  int nWiresLayer = (*layersIt)->specificTopology().channels();
111  hActiveUnits[wheel + 2]->Fill(1, nWiresLayer); // CB first bin is # of layers
112  int nActiveWires = nWiresLayer;
113 
114  int flagA = -100;
115  int flagC = -100;
116  int flagS = -100;
117  int first = -100;
118  int last = -100;
119 
120  // CB info is not stored if HV is ON -> in this case get returns 1
121  // process all other cases and removed wires with "BAD HV" from active
122  // wires list
123 
124  if (DTHVRecordFound) {
125  if (!dtHVStatus->get((*layersIt)->id(), 0, first, last, flagA, flagC, flagS) && (flagA || flagC || flagS)) {
126  nActiveWires -= (last - first + 1);
127  }
128 
129  if (!dtHVStatus->get((*layersIt)->id(), 1, first, last, flagA, flagC, flagS) && (flagA || flagC || flagS)) {
130  nActiveWires -= (last - first + 1);
131  }
132  } else {
133  nActiveWires = -1.;
134  }
135 
136  hActiveUnits[wheel + 2]->Fill(2, nActiveWires); // CB 2nd bin is the list of wires wit HV ON
137  }
138 }
139 
141 
142 string DTDCSByLumiTask::topFolder() const { return string("DT/EventInfo/DCSContents"); }
143 
144 // Local Variables:
145 // show-trailing-whitespace: t
146 // truncate-lines: t
147 // End:
DTGeometry
Definition: DTGeometry.h:28
dqm::impl::MonitorElement
Definition: MonitorElement.h:98
DTDCSByLumiTask::analyze
void analyze(const edm::Event &e, const edm::EventSetup &) override
Analyze.
Definition: DTDCSByLumiTask.cc:140
edm::typelookup::findType
std::pair< const char *, const std::type_info * > findType(const char *iClassName)
Definition: typelookup.cc:69
DTDCSByLumiTask::DTHVRecordFound
bool DTHVRecordFound
Definition: DTDCSByLumiTask.h:66
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
edm::Run
Definition: Run.h:45
edm
HLT enums.
Definition: AlignableModifier.h:19
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
DQMStore.h
DTHVStatusRcd
Definition: DTHVStatusRcd.h:5
DTDCSByLumiTask::dtHVStatusToken_
edm::ESGetToken< DTHVStatus, DTHVStatusRcd > dtHVStatusToken_
Definition: DTDCSByLumiTask.h:71
DTDCSByLumiTask::theDTGeom
edm::ESHandle< DTGeometry > theDTGeom
Definition: DTDCSByLumiTask.h:68
DTDCSByLumiTask::topFolder
std::string topFolder() const
Definition: DTDCSByLumiTask.cc:142
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
edm::eventsetup::EventSetupRecordKey
Definition: EventSetupRecordKey.h:30
DTDCSByLumiTask::~DTDCSByLumiTask
~DTDCSByLumiTask() override
Destructor.
Definition: DTDCSByLumiTask.cc:42
EventSetupRecord.h
visDQMUpload.context
context
Definition: visDQMUpload.py:37
DTDCSByLumiTask::dtGeometryToken_
edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtGeometryToken_
Definition: DTDCSByLumiTask.h:70
dqmdumpme.last
last
Definition: dqmdumpme.py:56
DTGeometry::layers
const std::vector< const DTLayer * > & layers() const
Return a vector of all SuperLayer.
Definition: DTGeometry.cc:88
Service.h
DTDCSByLumiTask::dqmEndLuminosityBlock
void dqmEndLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &) override
By Lumi DCS DB Operation.
Definition: DTDCSByLumiTask.cc:98
DTDCSByLumiTask::theEvents
int theEvents
Definition: DTDCSByLumiTask.h:63
Transition.h
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:125
DTLayer.h
DTDCSByLumiTask::DTDCSByLumiTask
DTDCSByLumiTask(const edm::ParameterSet &ps)
Constructor.
Definition: DTDCSByLumiTask.cc:31
DTDCSByLumiTask::dqmBeginRun
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
Begin Run.
Definition: DTDCSByLumiTask.cc:47
edm::ParameterSet
Definition: ParameterSet.h:47
edm::Transition
Transition
Definition: Transition.h:12
DTDCSByLumiTask::theLumis
int theLumis
Definition: DTDCSByLumiTask.h:64
makeMuonMisalignmentScenario.wheel
wheel
Definition: makeMuonMisalignmentScenario.py:319
edm::LuminosityBlockID::luminosityBlock
LuminosityBlockNumber_t luminosityBlock() const
Definition: LuminosityBlockID.h:42
edm::LuminosityBlockBase::id
LuminosityBlockID id() const
Definition: LuminosityBlockBase.h:44
dqm::implementation::IBooker::UseLumiScope
UseScope< MonitorElementData::Scope::LUMI > UseLumiScope
Definition: DQMStore.h:463
DTDCSByLumiTask::hActiveUnits
std::vector< MonitorElement * > hActiveUnits
Definition: DTDCSByLumiTask.h:73
edm::EventSetup
Definition: EventSetup.h:58
DTDCSByLumiTask.h
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::Transition::EndLuminosityBlock
std
Definition: JetResolutionObject.h:76
writedatasetfile.run
run
Definition: writedatasetfile.py:27
DTHVStatus
Definition: DTHVStatus.h:70
edm::Transition::BeginRun
ME
Definition: ME.h:11
EventSetup.h
dqm::implementation::IBooker
Definition: DQMStore.h:43
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
DTDCSByLumiTask::dqmBeginLuminosityBlock
void dqmBeginLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &) override
By Lumi DCS DB Operation.
Definition: DTDCSByLumiTask.cc:86
DTDCSByLumiTask::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: DTDCSByLumiTask.cc:68
DTHVStatus::get
int get(int wheelId, int stationId, int sectorId, int slId, int layerId, int partId, int &fCell, int &lCell, int &flagA, int &flagC, int &flagS) const
get content
Definition: DTHVStatus.cc:56
EventSetupRecordKey.h
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::Event
Definition: Event.h:73
DTTopology.h
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98