CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
21 
24 
30 #include <iostream>
31 
32 
33 using namespace edm;
34 using namespace std;
35 
36 
37 DTDCSByLumiTask::DTDCSByLumiTask(const edm::ParameterSet& ps) : theEvents(0) , theLumis(0) {
38 
40  LogTrace("DTDQM|DTMonitorModule|DTDCSByLumiTask")
41  << "[DTDCSByLumiTask]: Constructor" << endl;
42 
43  // If needed put getParameter here
44  // dtDCSByLumiLabel = ps.getParameter<InputTag>("dtDCSByLumiLabel");
45 
46 }
47 
48 
50 
51  LogTrace("DTDQM|DTMonitorModule|DTDCSByLumiTask")
52  << "DTDCSByLumiTask: processed " << theEvents <<
53  " events in " << theLumis << " lumi sections" << endl;
54 
55 }
56 
57 
59 
60  LogTrace("DTDQM|DTMonitorModule|DTDCSByLumiTask")
61  <<"[DTDCSByLumiTask] endjob called!"<<endl;
62 
63 }
64 
65 
67 
68  LogTrace("DTDQM|DTMonitorModule|DTDCSByLumiTask")
69  <<"[DTDCSByLumiTask]: BeginJob"<<endl;
70 
71 }
72 
73 void DTDCSByLumiTask::beginRun(const edm::Run& run, const edm::EventSetup& context) {
74 
75  LogTrace("DTDQM|DTMonitorModule|DTDCSByLumiTask")
76  << "[DTDCSByLumiTask]: begin run" << endl;
77 
78  bookHistos();
79 
80  context.get<MuonGeometryRecord>().get(theDTGeom);
81 
82  DTHVRecordFound=true;
83 
85 
86  std::vector<eventsetup::EventSetupRecordKey> recordKeys;
87  context.fillAvailableRecordKeys(recordKeys);
88  vector<eventsetup::EventSetupRecordKey>::iterator it = find(recordKeys.begin(),recordKeys.end(),recordKey);
89 
90  if( it == recordKeys.end() ) {
91  //record not found
92  LogTrace("DTDQM|DTMonitorModule|DTDCSByLumiTask")<<"Record DTHVStatusRcd does not exist "<<std::endl;
93 
94  DTHVRecordFound=false;
95  }
96 
97 }
98 
99 
101 
102  theLumis++;
103 
104  LogTrace("DTDQM|DTMonitorModule|DTDCSByLumiTask")
105  << "[DTDCSByLumiTask]: Begin of processed lumi # " << lumiSeg.id().luminosityBlock()
106  << " " << theLumis << " lumi processed by this job" << endl;
107 
108  for(int wheel=0; wheel <5; wheel++) {
109  hActiveUnits[wheel]->Reset(); // Cb by lumi histo need to be resetted in between lumi boundaries
110  }
111 
112 }
113 
114 
116 
117 
118  if(DTHVRecordFound) context.get<DTHVStatusRcd>().get(hvStatus);
119 
120  vector<const DTLayer*>::const_iterator layersIt = theDTGeom->layers().begin();
121  vector<const DTLayer*>::const_iterator layersEnd = theDTGeom->layers().end();
122 
123  for(; layersIt!=layersEnd; ++layersIt) {
124 
125  int wheel = (*layersIt)->id().wheel();
126 
127  int nWiresLayer = (*layersIt)->specificTopology().channels();
128 
129  hActiveUnits[wheel+2]->Fill(1,nWiresLayer); // CB first bin is # of layers
130  int nActiveWires = nWiresLayer;
131 
132  int flagA = -100;
133  int flagC = -100;
134  int flagS = -100;
135  int first = -100;
136  int last = -100;
137 
138  // CB info is not stored if HV is ON -> in this case get returns 1
139  // process all other cases and removed wires with "BAD HV" from active
140  // wires list
141 
142  if( DTHVRecordFound ) {
143  if ( !hvStatus->get((*layersIt)->id(),0,first,last,flagA,flagC,flagS)
144  && (flagA || flagC || flagS) ) {
145  nActiveWires -= (last - first + 1);
146  }
147 
148  if ( !hvStatus->get((*layersIt)->id(),1,first,last,flagA,flagC,flagS)
149  && (flagA || flagC || flagS) ) {
150  nActiveWires -= (last - first + 1);
151  }
152  } else {
153  nActiveWires=-1.;
154  }
155 
156  hActiveUnits[wheel+2]->Fill(2,nActiveWires); // CB 2nd bin is the list of wires wit HV ON
157 
158  }
159 
160  /* LogTrace("DTDQM|DTMonitorModule|DTDCSByLumiTask")
161  << "[DTDCSByLumiTask]: processed lumi # : " << lumiSeg.id().luminosityBlock()
162  << "\t# of wires " << hActiveUnits->getBinContent(1)
163  << "\t# of Active wires (anodes && cathodes && strips ON) : "
164  << hActiveUnits->getBinContent(2) << endl;
165  */
166 }
167 
168 
170 
171  // Book bylumi histo (# of bins as reduced as possible)
172  theDQMStore->setCurrentFolder(topFolder());
173 
174  for(int wheel=-2; wheel <=2; wheel++) {
175 
176  stringstream wheel_str; wheel_str << wheel;
177 
178  MonitorElement* ME = theDQMStore->book1D("hActiveUnits"+wheel_str.str(),"Active Untis x LS Wh"+wheel_str.str(),2,0.5,2.5);
179  ME->setLumiFlag();// Set LumiFlag in order to save histo every LS
180 
181  hActiveUnits.push_back(ME);
182  }
183 
184 }
185 
187 
188  theEvents++;
189 
190 }
191 
192 
194 
195  return string("DT/EventInfo/DCSContents");
196 
197 }
198 
199 // Local Variables:
200 // show-trailing-whitespace: t
201 // truncate-lines: t
202 // End:
LuminosityBlockID id() const
std::pair< const char *, const std::type_info * > findType(const char *iClassName)
Definition: typelookup.cc:51
edm::ESHandle< DTHVStatus > hvStatus
void bookHistos()
Book Monitor Elements.
DQMStore * theDQMStore
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
virtual ~DTDCSByLumiTask()
Destructor.
Definition: ME.h:11
void endJob()
Endjob.
edm::ESHandle< DTGeometry > theDTGeom
void fillAvailableRecordKeys(std::vector< eventsetup::EventSetupRecordKey > &oToFill) const
clears the oToFill vector and then fills it with the keys for all available records ...
Definition: EventSetup.cc:101
void beginJob()
BeginJob.
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
bool first
Definition: L1TdeRCT.cc:75
#define LogTrace(id)
const T & get() const
Definition: EventSetup.h:55
void beginLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
By Lumi DCS DB Operation.
LuminosityBlockNumber_t luminosityBlock() const
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
void beginRun(const edm::Run &, const edm::EventSetup &)
Begin Run.
DTDCSByLumiTask(const edm::ParameterSet &ps)
Constructor.
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &setup)
By Lumi DCS DB Operation.
std::string topFolder() const
void setLumiFlag(void)
this ME is meant to be stored for each luminosity section
std::vector< MonitorElement * > hActiveUnits
Definition: Run.h:41