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 Attributes
ESFEDIntegrityTask Class Reference

#include <ESFEDIntegrityTask.h>

Inheritance diagram for ESFEDIntegrityTask:
DQMEDAnalyzer edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 ESFEDIntegrityTask (const edm::ParameterSet &ps)
 
virtual ~ESFEDIntegrityTask ()
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer (void)
 
virtual void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
virtual void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) 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) override
 Analyze. More...
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void endJob ()
 
- Protected Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 Attributes

edm::EDGetTokenT
< ESRawDataCollection
dccCollections_
 
bool debug_
 
std::string fedDirName_
 
edm::EDGetTokenT
< FEDRawDataCollection
FEDRawDataCollection_
 
int ievt_
 
MonitorElementmeESFedsEntries_
 
MonitorElementmeESFedsFatal_
 
MonitorElementmeESFedsNonFatal_
 
std::string prefixME_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr
< dqmDetails::NoCache
globalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr
< dqmDetails::NoCache
globalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Detailed Description

Definition at line 15 of file ESFEDIntegrityTask.h.

Constructor & Destructor Documentation

ESFEDIntegrityTask::ESFEDIntegrityTask ( const edm::ParameterSet ps)

Definition at line 26 of file ESFEDIntegrityTask.cc.

References edm::ParameterSet::getParameter(), and edm::ParameterSet::getUntrackedParameter().

26  {
27 
28  prefixME_ = ps.getUntrackedParameter<string>("prefixME", "");
29  fedDirName_ = ps.getUntrackedParameter<string>("FEDDirName", "FEDIntegrity");
30  debug_ = ps.getUntrackedParameter<bool>("debug", false);
31 
32  dccCollections_ = consumes<ESRawDataCollection>(ps.getParameter<InputTag>("ESDCCCollections"));
33  FEDRawDataCollection_ = consumes<FEDRawDataCollection>(ps.getParameter<edm::InputTag>("FEDRawDataCollection"));
34 
35  meESFedsEntries_ = 0;
36  meESFedsFatal_ = 0;
38 
39  ievt_ = 0;
40 
41 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * meESFedsFatal_
edm::EDGetTokenT< FEDRawDataCollection > FEDRawDataCollection_
edm::EDGetTokenT< ESRawDataCollection > dccCollections_
MonitorElement * meESFedsEntries_
MonitorElement * meESFedsNonFatal_
virtual ESFEDIntegrityTask::~ESFEDIntegrityTask ( )
inlinevirtual

Definition at line 20 of file ESFEDIntegrityTask.h.

20 {}

Member Function Documentation

void ESFEDIntegrityTask::analyze ( const edm::Event e,
const edm::EventSetup c 
)
overrideprotectedvirtual

Analyze.

Implements edm::stream::EDAnalyzerBase.

Definition at line 66 of file ESFEDIntegrityTask.cc.

References gather_cfg::cout, FEDRawData::data(), ESDCCHeaderBlock::fedId(), ESDCCHeaderBlock::getBX(), edm::Event::getByToken(), ESDCCHeaderBlock::getDCCErrors(), ESDCCHeaderBlock::getFEChannelStatus(), ESDCCHeaderBlock::getLV1(), ESDCCHeaderBlock::getOptoRX0(), ESDCCHeaderBlock::getOptoRX1(), ESDCCHeaderBlock::getOptoRX2(), ESDCCHeaderBlock::getOrbitNumber(), i, FEDHeader::lvl1ID(), and FEDRawData::size().

66  {
67 
68  ievt_++;
69 
70  int gt_L1A = 0;
71  // int gt_OrbitNumber = 0, gt_BX = 0;
72  int esDCC_L1A_MostFreqCounts = 0;
73  int esDCC_BX_MostFreqCounts = 0;
74  int esDCC_OrbitNumber_MostFreqCounts = 0;
75  int gtFedDataSize = 0;
76 
78  Handle<FEDRawDataCollection> allFedRawData;
79 
80  if ( e.getByToken(FEDRawDataCollection_, allFedRawData) ) {
81 
82  // ES FEDs
83  for (int esFED=520; esFED<=575; ++esFED) {
84 
85  const FEDRawData& fedData = allFedRawData->FEDData(esFED);
86  int length = fedData.size()/sizeof(uint64_t);
87 
88  if ( length > 0 )
89  if ( meESFedsEntries_ ) meESFedsEntries_->Fill(esFED);
90  }
91 
92  // GT FED data
93  const FEDRawData& gtFedData = allFedRawData->FEDData(812);
94 
95  gtFedDataSize = gtFedData.size()/sizeof(uint64_t);
96 
97  if ( gtFedDataSize > 0 ) {
98 
99  FEDHeader header(gtFedData.data());
100 
101  gt_L1A = header.lvl1ID();
102  //gt_OrbitNumber = e.orbitNumber();
103  //gt_BX = e.bunchCrossing();
104  } else {
105 
106  map<int, int> esDCC_L1A_FreqMap;
107  map<int, int> esDCC_BX_FreqMap;
108  map<int, int> esDCC_OrbitNumber_FreqMap;
109 
110  if ( e.getByToken(dccCollections_, dccs) ) {
111 
112  for (ESRawDataCollection::const_iterator dccItr = dccs->begin(); dccItr != dccs->end(); ++dccItr) {
113  ESDCCHeaderBlock esdcc = (*dccItr);
114 
115  esDCC_L1A_FreqMap[esdcc.getLV1()]++;
116  esDCC_BX_FreqMap[esdcc.getBX()]++;
117  esDCC_OrbitNumber_FreqMap[esdcc.getOrbitNumber()]++;
118 
119  if (esDCC_L1A_FreqMap[esdcc.getLV1()] > esDCC_L1A_MostFreqCounts) {
120  esDCC_L1A_MostFreqCounts = esDCC_L1A_FreqMap[esdcc.getLV1()];
121  gt_L1A = esdcc.getLV1();
122  }
123 
124  if (esDCC_BX_FreqMap[esdcc.getBX()] > esDCC_BX_MostFreqCounts) {
125  esDCC_BX_MostFreqCounts = esDCC_BX_FreqMap[esdcc.getBX()];
126  //gt_BX = esdcc.getBX();
127  }
128 
129  if (esDCC_OrbitNumber_FreqMap[esdcc.getOrbitNumber()] > esDCC_OrbitNumber_MostFreqCounts) {
130  esDCC_OrbitNumber_MostFreqCounts = esDCC_OrbitNumber_FreqMap[esdcc.getOrbitNumber()];
131  //gt_OrbitNumber = esdcc.getOrbitNumber();
132  }
133 
134  }
135  } else {
136  LogWarning("ESFEDIntegrityTask") << "dccCollections not available";
137  }
138 
139  }
140 
141  } else {
142  LogWarning("ESFEDIntegrityTask") << "FEDRawDataCollection not available";
143  }
144 
145  vector<int> fiberStatus;
146  if ( e.getByToken(dccCollections_, dccs) ) {
147  for (ESRawDataCollection::const_iterator dccItr = dccs->begin(); dccItr != dccs->end(); ++dccItr) {
148  ESDCCHeaderBlock dcc = (*dccItr);
149 
150  if (dcc.getDCCErrors() > 0) {
151 
152  if ( meESFedsFatal_ ) meESFedsFatal_->Fill(dcc.fedId());
153 
154  } else {
155  if (debug_) cout<<dcc.fedId()<<" "<<dcc.getOptoRX0()<<" "<<dcc.getOptoRX1()<<" "<<dcc.getOptoRX2()<<endl;
156  fiberStatus = dcc.getFEChannelStatus();
157 
158  if (dcc.getOptoRX0() == 128) {
159  meESFedsNonFatal_->Fill(dcc.fedId(), 1./3.);
160  } else if (dcc.getOptoRX0() == 129) {
161  for (unsigned int i=0; i<12; ++i) {
162  if (fiberStatus[i]==8 || fiberStatus[i]==10 || fiberStatus[i]==11 || fiberStatus[i]==12)
163  if ( meESFedsNonFatal_ ) meESFedsNonFatal_->Fill(dcc.fedId(), 1./12.);
164  }
165  }
166  if (dcc.getOptoRX1() == 128) {
167  meESFedsNonFatal_->Fill(dcc.fedId(), 1./3.);
168  } else if (dcc.getOptoRX1() == 129) {
169  for (unsigned int i=12; i<24; ++i) {
170  if (fiberStatus[i]==8 || fiberStatus[i]==10 || fiberStatus[i]==11 || fiberStatus[i]==12)
171  if ( meESFedsNonFatal_ ) meESFedsNonFatal_->Fill(dcc.fedId(), 1./12.);
172  }
173  }
174  if (dcc.getOptoRX2() == 128) {
175  meESFedsNonFatal_->Fill(dcc.fedId(), 1./3.);
176  } else if (dcc.getOptoRX2() == 129){
177  for (unsigned int i=24; i<36; ++i) {
178  if (fiberStatus[i]==8 || fiberStatus[i]==10 || fiberStatus[i]==11 || fiberStatus[i]==12)
179  if ( meESFedsNonFatal_ ) meESFedsNonFatal_->Fill(dcc.fedId(), 1./12.);
180  }
181  }
182  }
183 
184  if (dcc.getLV1() != gt_L1A) meESFedsNonFatal_->Fill(dcc.fedId());
185  //if (dcc.getBX() != gt_BX) meESFedsNonFatal_->Fill(dcc.fedId());
186  //if (dcc.getOrbitNumber() != gt_OrbitNumber) meESFedsNonFatal_->Fill(dcc.fedId());
187  }
188  }
189 
190  //for (ESLocalRawDataCollection::const_iterator kItr = kchips->begin(); kItr != kchips->end(); ++kItr) {
191 
192  //ESKCHIPBlock kchip = (*kItr);
193 
194  //Int_t nErr = 0;
195  //if (kchip.getFlag1() > 0) nErr++;
196  //if (kchip.getFlag2() > 0) nErr++;
197  //if (kchip.getBC() != kchip.getOptoBC()) nErr++;
198  //if (kchip.getEC() != kchip.getOptoEC()) nErr++;
199  //if (nErr>0) meESFedsNonFatal_->Fill(dcc.fedId());
200  //}
201 
202 }
int i
Definition: DBlmapReader.cc:9
int getLV1() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
std::vector< ESDCCHeaderBlock >::const_iterator const_iterator
int getOptoRX0() const
int getOptoRX1() const
MonitorElement * meESFedsFatal_
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
const std::vector< int > & getFEChannelStatus() const
void Fill(long long x)
int getBX() const
edm::EDGetTokenT< FEDRawDataCollection > FEDRawDataCollection_
int getOrbitNumber() const
edm::EDGetTokenT< ESRawDataCollection > dccCollections_
unsigned long long uint64_t
Definition: Time.h:15
int getDCCErrors() const
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
tuple cout
Definition: gather_cfg.py:121
const int fedId() const
int lvl1ID()
Level-1 event number generated by the TTC system.
Definition: FEDHeader.cc:20
int getOptoRX2() const
MonitorElement * meESFedsEntries_
MonitorElement * meESFedsNonFatal_
void ESFEDIntegrityTask::bookHistograms ( DQMStore::IBooker iBooker,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprotectedvirtual

Implements DQMEDAnalyzer.

Definition at line 44 of file ESFEDIntegrityTask.cc.

References DQMStore::IBooker::book1D(), timingPdfMaker::histo, and DQMStore::IBooker::setCurrentFolder().

45 {
46  char histo[200];
47 
48  iBooker.setCurrentFolder(prefixME_ + "/" + fedDirName_);
49 
50  sprintf(histo, "FEDEntries");
51  meESFedsEntries_ = iBooker.book1D(histo, histo, 56, 520, 576);
52 
53  sprintf(histo, "FEDFatal");
54  meESFedsFatal_ = iBooker.book1D(histo, histo, 56, 520, 576);
55 
56  sprintf(histo, "FEDNonFatal");
57  meESFedsNonFatal_ = iBooker.book1D(histo, histo, 56, 520, 576);
58 }
MonitorElement * meESFedsFatal_
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
MonitorElement * meESFedsEntries_
MonitorElement * meESFedsNonFatal_
void ESFEDIntegrityTask::endJob ( void  )
protected

Definition at line 60 of file ESFEDIntegrityTask.cc.

60  {
61 
62  LogInfo("ESFEDIntegrityTask") << "analyzed " << ievt_ << " events";
63 
64 }

Member Data Documentation

edm::EDGetTokenT<ESRawDataCollection> ESFEDIntegrityTask::dccCollections_
private

Definition at line 39 of file ESFEDIntegrityTask.h.

bool ESFEDIntegrityTask::debug_
private

Definition at line 37 of file ESFEDIntegrityTask.h.

std::string ESFEDIntegrityTask::fedDirName_
private

Definition at line 36 of file ESFEDIntegrityTask.h.

edm::EDGetTokenT<FEDRawDataCollection> ESFEDIntegrityTask::FEDRawDataCollection_
private

Definition at line 40 of file ESFEDIntegrityTask.h.

int ESFEDIntegrityTask::ievt_
private

Definition at line 33 of file ESFEDIntegrityTask.h.

MonitorElement* ESFEDIntegrityTask::meESFedsEntries_
private

Definition at line 42 of file ESFEDIntegrityTask.h.

MonitorElement* ESFEDIntegrityTask::meESFedsFatal_
private

Definition at line 43 of file ESFEDIntegrityTask.h.

MonitorElement* ESFEDIntegrityTask::meESFedsNonFatal_
private

Definition at line 44 of file ESFEDIntegrityTask.h.

std::string ESFEDIntegrityTask::prefixME_
private

Definition at line 35 of file ESFEDIntegrityTask.h.