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  * $Date: 2011/03/02 13:58:32 $
5  * $Revision: 1.1 $
6  * \author C. Battilana - CIEMAT
7  * \author P. Bellan - INFN PD
8  * \author A. Branca = INFN PD
9 
10  *
11  */
12 
14 
15 // Framework
17 
18 // Geometry
23 
26 
32 #include <iostream>
33 
34 
35 using namespace edm;
36 using namespace std;
37 
38 
39 DTDCSByLumiTask::DTDCSByLumiTask(const edm::ParameterSet& ps) : theEvents(0) , theLumis(0) {
40 
42  LogTrace("DTDQM|DTMonitorModule|DTDCSByLumiTask")
43  << "[DTDCSByLumiTask]: Constructor" << endl;
44 
45  // If needed put getParameter here
46  // dtDCSByLumiLabel = ps.getParameter<InputTag>("dtDCSByLumiLabel");
47 
48 }
49 
50 
52 
53  LogTrace("DTDQM|DTMonitorModule|DTDCSByLumiTask")
54  << "DTDCSByLumiTask: processed " << theEvents <<
55  " events in " << theLumis << " lumi sections" << endl;
56 
57 }
58 
59 
61 
62  LogTrace("DTDQM|DTMonitorModule|DTDCSByLumiTask")
63  <<"[DTDCSByLumiTask] endjob called!"<<endl;
64 
65 }
66 
67 
69 
70  LogTrace("DTDQM|DTMonitorModule|DTDCSByLumiTask")
71  <<"[DTDCSByLumiTask]: BeginJob"<<endl;
72 
73 }
74 
75 void DTDCSByLumiTask::beginRun(const edm::Run& run, const edm::EventSetup& context) {
76 
77  LogTrace("DTDQM|DTMonitorModule|DTDCSByLumiTask")
78  << "[DTDCSByLumiTask]: begin run" << endl;
79 
80  bookHistos();
81 
82  context.get<MuonGeometryRecord>().get(theDTGeom);
83 
84  DTHVRecordFound=true;
85 
87 
88  std::vector<eventsetup::EventSetupRecordKey> recordKeys;
89  context.fillAvailableRecordKeys(recordKeys);
90  vector<eventsetup::EventSetupRecordKey>::iterator it = find(recordKeys.begin(),recordKeys.end(),recordKey);
91 
92  if( it == recordKeys.end() ) {
93  //record not found
94  LogTrace("DTDQM|DTMonitorModule|DTDCSByLumiTask")<<"Record DTHVStatusRcd does not exist "<<std::endl;
95 
96  DTHVRecordFound=false;
97  }
98 
99 }
100 
101 
103 
104  theLumis++;
105 
106  LogTrace("DTDQM|DTMonitorModule|DTDCSByLumiTask")
107  << "[DTDCSByLumiTask]: Begin of processed lumi # " << lumiSeg.id().luminosityBlock()
108  << " " << theLumis << " lumi processed by this job" << endl;
109 
110  for(int wheel=0; wheel <5; wheel++) {
111  hActiveUnits[wheel]->Reset(); // Cb by lumi histo need to be resetted in between lumi boundaries
112  }
113 
114 }
115 
116 
118 
119 
120  if(DTHVRecordFound) context.get<DTHVStatusRcd>().get(hvStatus);
121 
122  vector<DTLayer*>::const_iterator layersIt = theDTGeom->layers().begin();
123  vector<DTLayer*>::const_iterator layersEnd = theDTGeom->layers().end();
124 
125  for(; layersIt!=layersEnd; ++layersIt) {
126 
127  int wheel = (*layersIt)->id().wheel();
128 
129  int nWiresLayer = (*layersIt)->specificTopology().channels();
130 
131  hActiveUnits[wheel+2]->Fill(1,nWiresLayer); // CB first bin is # of layers
132  int nActiveWires = nWiresLayer;
133 
134  int flagA = -100;
135  int flagC = -100;
136  int flagS = -100;
137  int first = -100;
138  int last = -100;
139 
140  // CB info is not stored if HV is ON -> in this case get returns 1
141  // process all other cases and removed wires with "BAD HV" from active
142  // wires list
143 
144  if( DTHVRecordFound ) {
145  if ( !hvStatus->get((*layersIt)->id(),0,first,last,flagA,flagC,flagS)
146  && (flagA || flagC || flagS) ) {
147  nActiveWires -= (last - first + 1);
148  }
149 
150  if ( !hvStatus->get((*layersIt)->id(),1,first,last,flagA,flagC,flagS)
151  && (flagA || flagC || flagS) ) {
152  nActiveWires -= (last - first + 1);
153  }
154  } else {
155  nActiveWires=-1.;
156  }
157 
158  hActiveUnits[wheel+2]->Fill(2,nActiveWires); // CB 2nd bin is the list of wires wit HV ON
159 
160  }
161 
162  /* LogTrace("DTDQM|DTMonitorModule|DTDCSByLumiTask")
163  << "[DTDCSByLumiTask]: processed lumi # : " << lumiSeg.id().luminosityBlock()
164  << "\t# of wires " << hActiveUnits->getBinContent(1)
165  << "\t# of Active wires (anodes && cathodes && strips ON) : "
166  << hActiveUnits->getBinContent(2) << endl;
167  */
168 }
169 
170 
172 
173  // Book bylumi histo (# of bins as reduced as possible)
175 
176  for(int wheel=-2; wheel <=2; wheel++) {
177 
178  stringstream wheel_str; wheel_str << wheel;
179 
180  MonitorElement* ME = theDQMStore->book1D("hActiveUnits"+wheel_str.str(),"Active Untis x LS Wh"+wheel_str.str(),2,0.5,2.5);
181  ME->setLumiFlag();// Set LumiFlag in order to save histo every LS
182 
183  hActiveUnits.push_back(ME);
184  }
185 
186 }
187 
189 
190  theEvents++;
191 
192 }
193 
194 
196 
197  return string("DT/EventInfo/DCSContents");
198 
199 }
LuminosityBlockID id() const
std::pair< const char *, const std::type_info * > findType(const char *iClassName)
Definition: typelookup.cc:51
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:717
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:94
#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
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
std::vector< MonitorElement * > hActiveUnits
Definition: Run.h:33