CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
ESDaqInfoTask Class Reference

#include <ESDaqInfoTask.h>

Inheritance diagram for ESDaqInfoTask:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 ESDaqInfoTask (const edm::ParameterSet &ps)
 Constructor. More...
 
 ~ESDaqInfoTask () override
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c) override
 Analyze. More...
 
void beginJob (void) override
 BeginJob. More...
 
void beginLuminosityBlock (const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &iSetup) override
 BeginLuminosityBlock. More...
 
void cleanup (void)
 Cleanup. More...
 
void endJob (void) override
 EndJob. More...
 
void reset (void)
 Reset. 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

int getFEDNumber (const int x, const int y)
 

Private Attributes

DQMStoredqmStore_
 
bool enableCleanup_
 
ESElectronicsMapperes_mapping_
 
int ESFedRangeMax_
 
int ESFedRangeMin_
 
bool ESOnFed_ [56]
 
MonitorElementmeESDaqActive_ [56]
 
MonitorElementmeESDaqActiveMap_
 
MonitorElementmeESDaqError_
 
MonitorElementmeESDaqFraction_
 
bool mergeRuns_
 
std::string prefixME_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 

Detailed Description

Definition at line 13 of file ESDaqInfoTask.h.

Constructor & Destructor Documentation

ESDaqInfoTask::ESDaqInfoTask ( const edm::ParameterSet ps)

Constructor.

Definition at line 30 of file ESDaqInfoTask.cc.

References edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), mps_fire::i, and Utilities::operator.

30  {
31 
33 
34  prefixME_ = ps.getUntrackedParameter<string>("prefixME", "");
35 
36  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
37 
38  mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);
39 
40  ESFedRangeMin_ = ps.getUntrackedParameter<int>("ESFedRangeMin", 520);
41  ESFedRangeMax_ = ps.getUntrackedParameter<int>("ESFedRangeMax", 575);
42 
43  meESDaqFraction_ = nullptr;
44  meESDaqActiveMap_ = nullptr;
45  meESDaqError_ = nullptr;
46 
47  for (int i = 0; i < 56; i++) {
48  meESDaqActive_[i] = nullptr;
49  }
50 
51  if (ps.exists("esMapping")){
52  edm::ParameterSet esMap=ps.getParameter<edm::ParameterSet>("esMapping");
53  es_mapping_ = new ESElectronicsMapper(esMap);
54  }else{
55  edm::LogError("ESDaqInfoTask")<<"preshower mapping pointer not initialized. Temporary.";
56  es_mapping_=nullptr;
57  }
58 
59 
60 
61 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::string prefixME_
Definition: ESDaqInfoTask.h:47
bool exists(std::string const &parameterName) const
checks if a parameter exists
MonitorElement * meESDaqActiveMap_
Definition: ESDaqInfoTask.h:55
MonitorElement * meESDaqError_
Definition: ESDaqInfoTask.h:57
DQMStore * dqmStore_
Definition: ESDaqInfoTask.h:45
MonitorElement * meESDaqActive_[56]
Definition: ESDaqInfoTask.h:54
MonitorElement * meESDaqFraction_
Definition: ESDaqInfoTask.h:53
ESElectronicsMapper * es_mapping_
Definition: ESDaqInfoTask.h:62
ESDaqInfoTask::~ESDaqInfoTask ( )
override

Destructor.

Definition at line 63 of file ESDaqInfoTask.cc.

63  {
64  delete es_mapping_;
65 }
ESElectronicsMapper * es_mapping_
Definition: ESDaqInfoTask.h:62

Member Function Documentation

void ESDaqInfoTask::analyze ( const edm::Event e,
const edm::EventSetup c 
)
overrideprotected

Analyze.

Definition at line 224 of file ESDaqInfoTask.cc.

References DEFINE_FWK_MODULE.

224  {
225 
226 }
void ESDaqInfoTask::beginJob ( void  )
overrideprotectedvirtual

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 67 of file ESDaqInfoTask.cc.

References trackerHits::histo, and mps_fire::i.

67  {
68 
69  char histo[200];
70 
71  if ( dqmStore_ ) {
72 
73  dqmStore_->setCurrentFolder(prefixME_ + "/EventInfo");
74 
75  sprintf(histo, "DAQSummary");
76  meESDaqFraction_ = dqmStore_->bookFloat(histo);
77  meESDaqFraction_->Fill(0.0);
78 
79  sprintf(histo, "DAQSummaryMap");
80  meESDaqActiveMap_ = dqmStore_->book2D(histo,histo, 80, 0.5, 80.5, 80, 0.5, 80.5);
81  meESDaqActiveMap_->setAxisTitle("Si X", 1);
82  meESDaqActiveMap_->setAxisTitle("Si Y", 2);
83 
84  dqmStore_->setCurrentFolder(prefixME_ + "/EventInfo/DAQContents");
85 
86  for (int i = 0; i < 56; i++) {
87  sprintf(histo, "EcalPreshower_%d", ESFedRangeMin_+i);
88  meESDaqActive_[i] = dqmStore_->bookFloat(histo);
89  meESDaqActive_[i]->Fill(0.0);
90 
91  ESOnFed_[i] = false;
92  for ( int x = 0; x < 80; x++ ) {
93  for ( int y = 0; y < 80; y++ ) {
94  if(getFEDNumber(x, y) == ESFedRangeMin_+i){
95  ESOnFed_[i] = true;
96  break;
97  }
98  }
99  if(ESOnFed_[i] == true) break;
100  }
101  }
102 
103  dqmStore_->setCurrentFolder(prefixME_ + "/ESIntegrityTask");
104  sprintf(histo, "DAQError");
105  meESDaqError_ = dqmStore_->book1D(histo, histo, 56, ESFedRangeMin_-0.5, ESFedRangeMax_+0.5);
106  meESDaqError_->setAxisTitle("FedID", 1);
107 
108  }
109 
110 }
bool ESOnFed_[56]
Definition: ESDaqInfoTask.h:64
int getFEDNumber(const int x, const int y)
Definition: ESDaqInfoTask.h:66
std::string prefixME_
Definition: ESDaqInfoTask.h:47
MonitorElement * meESDaqActiveMap_
Definition: ESDaqInfoTask.h:55
void Fill(long long x)
MonitorElement * meESDaqError_
Definition: ESDaqInfoTask.h:57
DQMStore * dqmStore_
Definition: ESDaqInfoTask.h:45
MonitorElement * meESDaqActive_[56]
Definition: ESDaqInfoTask.h:54
MonitorElement * meESDaqFraction_
Definition: ESDaqInfoTask.h:53
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void ESDaqInfoTask::beginLuminosityBlock ( const edm::LuminosityBlock lumiBlock,
const edm::EventSetup iSetup 
)
overrideprotected

BeginLuminosityBlock.

Definition at line 118 of file ESDaqInfoTask.cc.

References edm::EventSetup::find(), edm::eventsetup::heterocontainer::HCTypeTag::findType(), edm::EventSetup::get(), mps_fire::i, RunInfo::m_fed_in, and reset().

118  {
119 
120  this->reset();
121 
122  for (int x = 0; x < 80; ++x) {
123  for (int y = 0; y < 80; ++y) {
124  if( getFEDNumber(x, y) > 0 ) meESDaqActiveMap_->setBinContent( x+1, y+1, 0.0 );
125  else meESDaqActiveMap_->setBinContent( x+1, y+1, -1.0 );
126  }
127  }
128 
129  for (int i = 0; i < 56; i++) {
131  }
132 
134 
135  if( iSetup.find( recordKey ) ) {
136 
137  edm::ESHandle<RunInfo> sumFED;
138  iSetup.get<RunInfoRcd>().get(sumFED);
139 
140  std::vector<int> FedsInIds= sumFED->m_fed_in;
141 
142  float ESFedCount = 0.;
143 
144  for( unsigned int fedItr=0; fedItr<FedsInIds.size(); ++fedItr ) {
145 
146  int fedID=FedsInIds[fedItr];
147 
148  if ( fedID >= ESFedRangeMin_ && fedID <= ESFedRangeMax_ ) {
149 
150  if( ESOnFed_[fedID - ESFedRangeMin_] ) ESFedCount++;
151 
153 
154  if( meESDaqActiveMap_ ) {
155 
156  for (int x = 0; x < 80; x++) {
157  for (int y = 0; y < 80; y++) {
158  if (fedID == getFEDNumber(x, y))
159  meESDaqActiveMap_->setBinContent( x+1, y+1, 1.0 );
160  }
161  }
162 
163  }
164 
165  if( meESDaqFraction_ ) meESDaqFraction_->Fill( ESFedCount/40. );
166 
167  if( meESDaqError_ ){
168  for( int i = 0; i < 56; i++){
169  if( ESOnFed_[fedID-ESFedRangeMin_] ) meESDaqError_->setBinContent(i+1, 1.0);
170  else meESDaqError_->setBinContent(i+1, 2.0);
171  }
172  }
173 
174  }
175 
176  }
177 
178  } else {
179 
180  LogWarning("ESDaqInfoTask") << "Cannot find any RunInfoRcd" << endl;
181 
182  }
183 
184 }
bool ESOnFed_[56]
Definition: ESDaqInfoTask.h:64
void setBinContent(int binx, double content)
set content of bin (1-D)
int getFEDNumber(const int x, const int y)
Definition: ESDaqInfoTask.h:66
MonitorElement * meESDaqActiveMap_
Definition: ESDaqInfoTask.h:55
static HCTypeTag findType(char const *iTypeName)
find a type based on the types name, if not found will return default HCTypeTag
void Fill(long long x)
std::vector< int > m_fed_in
Definition: RunInfo.h:26
void reset(void)
Reset.
MonitorElement * meESDaqError_
Definition: ESDaqInfoTask.h:57
MonitorElement * meESDaqActive_[56]
Definition: ESDaqInfoTask.h:54
MonitorElement * meESDaqFraction_
Definition: ESDaqInfoTask.h:53
T get() const
Definition: EventSetup.h:63
boost::optional< eventsetup::EventSetupRecordGeneric > find(const eventsetup::EventSetupRecordKey &) const
Definition: EventSetup.cc:88
void ESDaqInfoTask::cleanup ( void  )
protected

Cleanup.

Definition at line 202 of file ESDaqInfoTask.cc.

References mps_fire::i.

Referenced by esMonitoring.FDJsonServer::handle_close().

202  {
203 
204  if ( dqmStore_ ) {
205 
206  dqmStore_->setCurrentFolder(prefixME_ + "/EventInfo");
207 
208  if ( meESDaqFraction_ ) dqmStore_->removeElement( meESDaqFraction_->getName() );
209 
210  if ( meESDaqActiveMap_ ) dqmStore_->removeElement( meESDaqActiveMap_->getName() );
211 
212  if ( meESDaqError_ ) dqmStore_->removeElement( meESDaqError_->getName() );
213 
214  dqmStore_->setCurrentFolder(prefixME_ + "/EventInfo/DAQContents");
215 
216  for (int i = 0; i < 56; i++) {
217  if ( meESDaqActive_[i] ) dqmStore_->removeElement( meESDaqActive_[i]->getName() );
218  }
219 
220  }
221 
222 }
std::string prefixME_
Definition: ESDaqInfoTask.h:47
const std::string & getName() const
get name of ME
MonitorElement * meESDaqActiveMap_
Definition: ESDaqInfoTask.h:55
MonitorElement * meESDaqError_
Definition: ESDaqInfoTask.h:57
DQMStore * dqmStore_
Definition: ESDaqInfoTask.h:45
MonitorElement * meESDaqActive_[56]
Definition: ESDaqInfoTask.h:54
MonitorElement * meESDaqFraction_
Definition: ESDaqInfoTask.h:53
void ESDaqInfoTask::endJob ( void  )
overrideprotectedvirtual

EndJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 112 of file ESDaqInfoTask.cc.

References edm::cleanup().

112  {
113 
114  if ( enableCleanup_ ) this->cleanup();
115 
116 }
void cleanup(void)
Cleanup.
int ESDaqInfoTask::getFEDNumber ( const int  x,
const int  y 
)
inlineprivate

Definition at line 66 of file ESDaqInfoTask.h.

66  {
67  int iz = (x < 40) ? 1 : 2;
68  int ip = (y >= 40) ? 1 : 2;
69  int ix = (x < 40) ? x : x - 40;
70  int iy = (y < 40) ? y :y - 40;
71  return (*es_mapping_).getFED( iz, ip, ix + 1, iy + 1);
72  }
void ESDaqInfoTask::reset ( void  )
protected

Reset.

Definition at line 187 of file ESDaqInfoTask.cc.

References mps_fire::i.

187  {
188 
190 
191  for (int i = 0; i < 56; i++) {
192  if ( meESDaqActive_[i] ) meESDaqActive_[i]->Reset();
193  }
194 
196 
198 
199 }
MonitorElement * meESDaqActiveMap_
Definition: ESDaqInfoTask.h:55
MonitorElement * meESDaqError_
Definition: ESDaqInfoTask.h:57
void Reset()
reset ME (ie. contents, errors, etc)
MonitorElement * meESDaqActive_[56]
Definition: ESDaqInfoTask.h:54
MonitorElement * meESDaqFraction_
Definition: ESDaqInfoTask.h:53

Member Data Documentation

DQMStore* ESDaqInfoTask::dqmStore_
private

Definition at line 45 of file ESDaqInfoTask.h.

bool ESDaqInfoTask::enableCleanup_
private

Definition at line 49 of file ESDaqInfoTask.h.

ESElectronicsMapper* ESDaqInfoTask::es_mapping_
private

Definition at line 62 of file ESDaqInfoTask.h.

int ESDaqInfoTask::ESFedRangeMax_
private

Definition at line 60 of file ESDaqInfoTask.h.

int ESDaqInfoTask::ESFedRangeMin_
private

Definition at line 59 of file ESDaqInfoTask.h.

bool ESDaqInfoTask::ESOnFed_[56]
private

Definition at line 64 of file ESDaqInfoTask.h.

MonitorElement* ESDaqInfoTask::meESDaqActive_[56]
private

Definition at line 54 of file ESDaqInfoTask.h.

MonitorElement* ESDaqInfoTask::meESDaqActiveMap_
private

Definition at line 55 of file ESDaqInfoTask.h.

MonitorElement* ESDaqInfoTask::meESDaqError_
private

Definition at line 57 of file ESDaqInfoTask.h.

MonitorElement* ESDaqInfoTask::meESDaqFraction_
private

Definition at line 53 of file ESDaqInfoTask.h.

bool ESDaqInfoTask::mergeRuns_
private

Definition at line 51 of file ESDaqInfoTask.h.

std::string ESDaqInfoTask::prefixME_
private

Definition at line 47 of file ESDaqInfoTask.h.