CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
DTDCSByLumiTask Class Reference

#include <DTDCSByLumiTask.h>

Inheritance diagram for DTDCSByLumiTask:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 DTDCSByLumiTask (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~DTDCSByLumiTask ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 Analyze. More...
 
void beginJob ()
 BeginJob. More...
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
 By Lumi DCS DB Operation. More...
 
void beginRun (const edm::Run &, const edm::EventSetup &)
 Begin Run. More...
 
void bookHistos ()
 Book Monitor Elements. More...
 
void endJob ()
 Endjob. More...
 
void endLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &setup)
 By Lumi DCS DB Operation. More...
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Private Member Functions

std::string topFolder () const
 

Private Attributes

bool DTHVRecordFound
 
std::vector< MonitorElement * > hActiveUnits
 
edm::ESHandle< DTHVStatushvStatus
 
DQMStoretheDQMStore
 
edm::ESHandle< DTGeometrytheDTGeom
 
int theEvents
 
int theLumis
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Detailed Description

Definition at line 30 of file DTDCSByLumiTask.h.

Constructor & Destructor Documentation

DTDCSByLumiTask::DTDCSByLumiTask ( const edm::ParameterSet ps)

Constructor.

Definition at line 37 of file DTDCSByLumiTask.cc.

References LogTrace, cppFunctionSkipper::operator, and theDQMStore.

37  : 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 }
DQMStore * theDQMStore
#define LogTrace(id)
DTDCSByLumiTask::~DTDCSByLumiTask ( )
virtual

Destructor.

Definition at line 49 of file DTDCSByLumiTask.cc.

References LogTrace, theEvents, and theLumis.

49  {
50 
51  LogTrace("DTDQM|DTMonitorModule|DTDCSByLumiTask")
52  << "DTDCSByLumiTask: processed " << theEvents <<
53  " events in " << theLumis << " lumi sections" << endl;
54 
55 }
#define LogTrace(id)

Member Function Documentation

void DTDCSByLumiTask::analyze ( const edm::Event e,
const edm::EventSetup c 
)
protectedvirtual

Analyze.

Implements edm::EDAnalyzer.

Definition at line 186 of file DTDCSByLumiTask.cc.

References theEvents.

186  {
187 
188  theEvents++;
189 
190 }
void DTDCSByLumiTask::beginJob ( void  )
protectedvirtual

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 66 of file DTDCSByLumiTask.cc.

References LogTrace.

66  {
67 
68  LogTrace("DTDQM|DTMonitorModule|DTDCSByLumiTask")
69  <<"[DTDCSByLumiTask]: BeginJob"<<endl;
70 
71 }
#define LogTrace(id)
void DTDCSByLumiTask::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
)
protectedvirtual

By Lumi DCS DB Operation.

Reimplemented from edm::EDAnalyzer.

Definition at line 100 of file DTDCSByLumiTask.cc.

References hActiveUnits, edm::LuminosityBlockBase::id(), LogTrace, edm::LuminosityBlockID::luminosityBlock(), and theLumis.

100  {
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 }
#define LogTrace(id)
std::vector< MonitorElement * > hActiveUnits
void DTDCSByLumiTask::beginRun ( const edm::Run run,
const edm::EventSetup context 
)
protectedvirtual

Begin Run.

Reimplemented from edm::EDAnalyzer.

Definition at line 73 of file DTDCSByLumiTask.cc.

References bookHistos(), DTHVRecordFound, edm::EventSetup::fillAvailableRecordKeys(), spr::find(), edm::typelookup::findType(), edm::EventSetup::get(), LogTrace, and theDTGeom.

73  {
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 }
std::pair< const char *, const std::type_info * > findType(const char *iClassName)
Definition: typelookup.cc:51
void bookHistos()
Book Monitor Elements.
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
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
#define LogTrace(id)
const T & get() const
Definition: EventSetup.h:55
void DTDCSByLumiTask::bookHistos ( )
protected

Book Monitor Elements.

Definition at line 169 of file DTDCSByLumiTask.cc.

References DQMStore::book1D(), hActiveUnits, DQMStore::setCurrentFolder(), MonitorElement::setLumiFlag(), theDQMStore, and topFolder().

Referenced by beginRun().

169  {
170 
171  // Book bylumi histo (# of bins as reduced as possible)
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 }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:954
DQMStore * theDQMStore
Definition: ME.h:11
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:667
std::vector< MonitorElement * > hActiveUnits
void DTDCSByLumiTask::endJob ( void  )
protectedvirtual

Endjob.

Reimplemented from edm::EDAnalyzer.

Definition at line 58 of file DTDCSByLumiTask.cc.

References LogTrace.

58  {
59 
60  LogTrace("DTDQM|DTMonitorModule|DTDCSByLumiTask")
61  <<"[DTDCSByLumiTask] endjob called!"<<endl;
62 
63 }
#define LogTrace(id)
void DTDCSByLumiTask::endLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup setup 
)
protectedvirtual

By Lumi DCS DB Operation.

Reimplemented from edm::EDAnalyzer.

Definition at line 115 of file DTDCSByLumiTask.cc.

References DTHVRecordFound, first, edm::EventSetup::get(), hActiveUnits, hvStatus, prof2calltree::last, and theDTGeom.

115  {
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 }
edm::ESHandle< DTHVStatus > hvStatus
edm::ESHandle< DTGeometry > theDTGeom
bool first
Definition: L1TdeRCT.cc:75
std::vector< MonitorElement * > hActiveUnits
string DTDCSByLumiTask::topFolder ( ) const
private

Definition at line 193 of file DTDCSByLumiTask.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by bookHistos().

193  {
194 
195  return string("DT/EventInfo/DCSContents");
196 
197 }

Member Data Documentation

bool DTDCSByLumiTask::DTHVRecordFound
private

Definition at line 70 of file DTDCSByLumiTask.h.

Referenced by beginRun(), and endLuminosityBlock().

std::vector<MonitorElement*> DTDCSByLumiTask::hActiveUnits
private

Definition at line 77 of file DTDCSByLumiTask.h.

Referenced by beginLuminosityBlock(), bookHistos(), and endLuminosityBlock().

edm::ESHandle<DTHVStatus> DTDCSByLumiTask::hvStatus
private

Definition at line 75 of file DTDCSByLumiTask.h.

Referenced by endLuminosityBlock().

DQMStore* DTDCSByLumiTask::theDQMStore
private

Definition at line 72 of file DTDCSByLumiTask.h.

Referenced by bookHistos(), and DTDCSByLumiTask().

edm::ESHandle<DTGeometry> DTDCSByLumiTask::theDTGeom
private

Definition at line 73 of file DTDCSByLumiTask.h.

Referenced by beginRun(), and endLuminosityBlock().

int DTDCSByLumiTask::theEvents
private

Definition at line 67 of file DTDCSByLumiTask.h.

Referenced by analyze(), and ~DTDCSByLumiTask().

int DTDCSByLumiTask::theLumis
private

Definition at line 68 of file DTDCSByLumiTask.h.

Referenced by beginLuminosityBlock(), and ~DTDCSByLumiTask().