CMS 3D CMS Logo

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

#include <TrackingAnalyzer.h>

Inheritance diagram for TrackingAnalyser:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 TrackingAnalyser (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~TrackingAnalyser ()
 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
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

void analyze (edm::Event const &e, edm::EventSetup const &eSetup)
 Analyze. More...
 
void beginJob ()
 BeginJob. More...
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &eSetup)
 Begin Luminosity Block. More...
 
void beginRun (edm::Run const &run, edm::EventSetup const &eSetup)
 BeginRun. More...
 
void checkTrackerFEDs (edm::Event const &e)
 
void endJob ()
 Endjob. More...
 
void endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &eSetup)
 End Luminosity Block. More...
 
void endRun (edm::Run const &run, edm::EventSetup const &eSetup)
 EndRun. More...
 

Private Attributes

TrackingActionExecutoractionExecutor_
 
edm::ESHandle< SiStripDetCablingdetCabling_
 
DQMStoredqmStore_
 
bool endLumiAnalysisOn_
 
edm::ESHandle< SiStripFedCablingfedCabling_
 
int fileSaveFrequency_
 
int globalStatusFilling_
 
std::ostringstream html_out_
 
unsigned long long m_cacheID_
 
int nEvents_
 
int nLumiSecs_
 
std::string outputFileName_
 
std::string outputFilePath_
 
edm::EDGetTokenT
< FEDRawDataCollection
rawDataToken_
 
int shiftReportFrequency_
 
int staticUpdateFrequency_
 
edm::ParameterSet tkMapPSet_
 
bool trackerFEDsFound_
 

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 &)
 
- 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)
 

Detailed Description

Definition at line 24 of file TrackingAnalyzer.h.

Constructor & Destructor Documentation

TrackingAnalyser::TrackingAnalyser ( const edm::ParameterSet ps)

Constructor.

Definition at line 46 of file TrackingAnalyzer.cc.

References actionExecutor_, BUF_SIZE, dtNoiseDBValidation_cfg::cerr, dqmStore_, endLumiAnalysisOn_, groupFilesInBlocks::fin, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), globalStatusFilling_, html_out_, recoMuon::in, cppFunctionSkipper::operator, rawDataToken_, shiftReportFrequency_, staticUpdateFrequency_, AlCaHLTBitMon_QueryRunRegistry::string, tkMapPSet_, and trackerFEDsFound_.

46  {
47 
48  // Get TkMap ParameterSet
49  tkMapPSet_ = ps.getParameter<edm::ParameterSet>("TkmapParameters");
50 
51  std::string localPath = std::string("DQM/TrackingMonitorClient/test/loader.html");
52  std::ifstream fin(edm::FileInPath(localPath).fullPath().c_str(), std::ios::in);
53  char buf[BUF_SIZE];
54 
55  if (!fin) {
56  std::cerr << "Input File: loader.html"<< " could not be opened!" << std::endl;
57  return;
58  }
59 
60  while (fin.getline(buf, BUF_SIZE, '\n')) { // pops off the newline character
61  html_out_ << buf ;
62  }
63  fin.close();
64 
65 
66 
67  edm::LogInfo("TrackingAnalyser") << " TrackingAnalyser::Creating TrackingAnalyser ";
68  staticUpdateFrequency_ = ps.getUntrackedParameter<int>("StaticUpdateFrequency",1);
69  globalStatusFilling_ = ps.getUntrackedParameter<int>("GlobalStatusFilling", 1);
70  shiftReportFrequency_ = ps.getUntrackedParameter<int>("ShiftReportFrequency", 1);
71 
72  edm::InputTag rawDataTag = ps.getUntrackedParameter<edm::InputTag>("RawDataTag");
73  rawDataToken_ = consumes<FEDRawDataCollection>(rawDataTag);
74 
75  // get back-end interface
77 
78 
79  // instantiate web interface
81  trackerFEDsFound_ = false;
82  endLumiAnalysisOn_ = false;
83 }
edm::EDGetTokenT< FEDRawDataCollection > rawDataToken_
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
DQMStore * dqmStore_
std::ostringstream html_out_
TrackingActionExecutor * actionExecutor_
edm::ParameterSet tkMapPSet_
#define BUF_SIZE
TrackingAnalyser::~TrackingAnalyser ( )
virtual

Destructor.

Definition at line 87 of file TrackingAnalyzer.cc.

87  {
88 
89  edm::LogInfo("TrackingAnalyser") << "TrackingAnalyser::Deleting TrackingAnalyser ";
90 
91 }

Member Function Documentation

void TrackingAnalyser::analyze ( edm::Event const &  e,
edm::EventSetup const &  eSetup 
)
privatevirtual

Analyze.

Implements edm::EDAnalyzer.

Definition at line 127 of file TrackingAnalyzer.cc.

References actionExecutor_, checkTrackerFEDs(), gather_cfg::cout, TrackingActionExecutor::createDummyShiftReport(), TrackingActionExecutor::createShiftReport(), dqmStore_, TrackingActionExecutor::fillDummyGlobalStatus(), TrackingActionExecutor::fillGlobalStatus(), globalStatusFilling_, nEvents_, shiftReportFrequency_, and trackerFEDsFound_.

127  {
128  std::cout << "[TrackingAnalyser::analyze] .. starting" << std::endl;
129  nEvents_++;
130  if (nEvents_ == 1 && globalStatusFilling_ > 0) {
132  if (!trackerFEDsFound_) {
135  } else {
138  }
139  }
140 
141 }
void checkTrackerFEDs(edm::Event const &e)
void createShiftReport(DQMStore *dqm_store)
DQMStore * dqmStore_
void fillGlobalStatus(DQMStore *dqm_store)
tuple cout
Definition: gather_cfg.py:121
TrackingActionExecutor * actionExecutor_
void TrackingAnalyser::beginJob ( void  )
privatevirtual

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 95 of file TrackingAnalyzer.cc.

References nEvents_, and nLumiSecs_.

95  {
96 
97  nLumiSecs_ = 0;
98  nEvents_ = 0;
99 }
void TrackingAnalyser::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  eSetup 
)
privatevirtual

Begin Luminosity Block.

Reimplemented from edm::EDAnalyzer.

Definition at line 121 of file TrackingAnalyzer.cc.

121  {
122  edm::LogInfo("TrackingAnalyser") <<"TrackingAnalyser:: Begin of LS transition";
123 }
void TrackingAnalyser::beginRun ( edm::Run const &  run,
edm::EventSetup const &  eSetup 
)
privatevirtual

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 103 of file TrackingAnalyzer.cc.

References actionExecutor_, gather_cfg::cout, TrackingActionExecutor::createGlobalStatus(), detCabling_, dqmStore_, fedCabling_, edm::EventSetup::get(), globalStatusFilling_, and m_cacheID_.

103  {
104  std::cout << "[TrackingAnalyser::beginRun] .. starting" << std::endl;
105  edm::LogInfo ("TrackingAnalyser") <<"TrackingAnalyser:: Begining of Run";
106 
107  // Check latest Fed cabling and create TrackerMapCreator
108  unsigned long long cacheID = eSetup.get<SiStripFedCablingRcd>().cacheIdentifier();
109  if (m_cacheID_ != cacheID) {
110  m_cacheID_ = cacheID;
111  edm::LogInfo("TrackingAnalyser") <<"TrackingAnalyser::beginRun: "
112  << " Change in Cabling, recrated TrackerMap";
113  eSetup.get<SiStripFedCablingRcd>().get(fedCabling_);
114  eSetup.get<SiStripDetCablingRcd>().get(detCabling_);
115  }
117 }
edm::ESHandle< SiStripDetCabling > detCabling_
unsigned long long m_cacheID_
DQMStore * dqmStore_
void createGlobalStatus(DQMStore *dqm_store)
edm::ESHandle< SiStripFedCabling > fedCabling_
tuple cout
Definition: gather_cfg.py:121
TrackingActionExecutor * actionExecutor_
void TrackingAnalyser::checkTrackerFEDs ( edm::Event const &  e)
private

Definition at line 181 of file TrackingAnalyzer.cc.

References FEDRawData::data(), FEDRawDataCollection::FEDData(), edm::Event::getByToken(), i, edm::HandleBase::isValid(), FEDNumbering::MAXSiPixelFEDID, FEDNumbering::MAXSiStripFEDID, FEDNumbering::MINSiPixelFEDID, FEDNumbering::MINSiStripFEDID, rawDataToken_, FEDRawData::size(), and trackerFEDsFound_.

Referenced by analyze().

181  {
182  edm::Handle<FEDRawDataCollection> rawDataHandle;
183  e.getByToken( rawDataToken_, rawDataHandle );
184  if ( !rawDataHandle.isValid() ) return;
185 
186  const FEDRawDataCollection& rawDataCollection = *rawDataHandle;
187  const int siStripFedIdMin = FEDNumbering::MINSiStripFEDID;
188  const int siStripFedIdMax = FEDNumbering::MAXSiStripFEDID;
189  const int siPixelFedIdMin = FEDNumbering::MINSiPixelFEDID;
190  const int siPixelFedIdMax = FEDNumbering::MAXSiPixelFEDID;
191 
192  unsigned int nFed = 0;
193  for (int i=siStripFedIdMin; i <= siStripFedIdMax; i++) {
194  if (rawDataCollection.FEDData(i).size() &&
195  rawDataCollection.FEDData(i).data() )
196  nFed++;
197  }
198  for (int i=siPixelFedIdMin; i <= siPixelFedIdMax; i++) {
199  if (rawDataCollection.FEDData(i).size() &&
200  rawDataCollection.FEDData(i).data() )
201  nFed++;
202  }
203 
204  trackerFEDsFound_ = (nFed > 0);
205 
206 }
edm::EDGetTokenT< FEDRawDataCollection > rawDataToken_
int i
Definition: DBlmapReader.cc:9
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
bool isValid() const
Definition: HandleBase.h:76
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
void TrackingAnalyser::endJob ( void  )
privatevirtual

Endjob.

Reimplemented from edm::EDAnalyzer.

Definition at line 175 of file TrackingAnalyzer.cc.

175  {
176  edm::LogInfo("TrackingAnalyser") <<"TrackingAnalyser:: endjob called!";
177 }
void TrackingAnalyser::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  eSetup 
)
privatevirtual

End Luminosity Block.

Reimplemented from edm::EDAnalyzer.

Definition at line 145 of file TrackingAnalyzer.cc.

References actionExecutor_, gather_cfg::cout, dqmStore_, endLumiAnalysisOn_, TrackingActionExecutor::fillDummyLSStatus(), TrackingActionExecutor::fillStatusAtLumi(), globalStatusFilling_, edm::LuminosityBlockBase::luminosityBlock(), nLumiSecs_, and trackerFEDsFound_.

145  {
146  edm::LogInfo ("TrackingAnalyser") <<"TrackingAnalyser:: End of LS transition, performing the DQM client operation";
147 
148  nLumiSecs_++;
149 
150  if (!trackerFEDsFound_) {
152  return;
153  }
154  endLumiAnalysisOn_ = true;
155 
156  std::cout << "====================================================== " << std::endl;
157  std::cout << " ===> Iteration # " << nLumiSecs_ << " " << lumiSeg.luminosityBlock() << std::endl;
158  std::cout << "====================================================== " << std::endl;
159  // Fill Global Status
160  if (globalStatusFilling_ > 0) {
162  }
163  endLumiAnalysisOn_ = false;
164 }
DQMStore * dqmStore_
void fillStatusAtLumi(DQMStore *dqm_store)
tuple cout
Definition: gather_cfg.py:121
TrackingActionExecutor * actionExecutor_
void TrackingAnalyser::endRun ( edm::Run const &  run,
edm::EventSetup const &  eSetup 
)
privatevirtual

EndRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 169 of file TrackingAnalyzer.cc.

169  {
170  edm::LogInfo ("TrackingAnalyser") <<"TrackingAnalyser:: End of Run";
171 }

Member Data Documentation

TrackingActionExecutor* TrackingAnalyser::actionExecutor_
private

Definition at line 79 of file TrackingAnalyzer.h.

Referenced by analyze(), beginRun(), endLuminosityBlock(), and TrackingAnalyser().

edm::ESHandle< SiStripDetCabling > TrackingAnalyser::detCabling_
private

Definition at line 78 of file TrackingAnalyzer.h.

Referenced by beginRun().

DQMStore* TrackingAnalyser::dqmStore_
private

Definition at line 64 of file TrackingAnalyzer.h.

Referenced by analyze(), beginRun(), endLuminosityBlock(), and TrackingAnalyser().

bool TrackingAnalyser::endLumiAnalysisOn_
private

Definition at line 85 of file TrackingAnalyzer.h.

Referenced by endLuminosityBlock(), and TrackingAnalyser().

edm::ESHandle< SiStripFedCabling > TrackingAnalyser::fedCabling_
private

Definition at line 77 of file TrackingAnalyzer.h.

Referenced by beginRun().

int TrackingAnalyser::fileSaveFrequency_
private

Definition at line 66 of file TrackingAnalyzer.h.

int TrackingAnalyser::globalStatusFilling_
private

Definition at line 68 of file TrackingAnalyzer.h.

Referenced by analyze(), beginRun(), endLuminosityBlock(), and TrackingAnalyser().

std::ostringstream TrackingAnalyser::html_out_
private

Definition at line 86 of file TrackingAnalyzer.h.

Referenced by TrackingAnalyser().

unsigned long long TrackingAnalyser::m_cacheID_
private

Definition at line 81 of file TrackingAnalyzer.h.

Referenced by beginRun().

int TrackingAnalyser::nEvents_
private

Definition at line 83 of file TrackingAnalyzer.h.

Referenced by analyze(), and beginJob().

int TrackingAnalyser::nLumiSecs_
private

Definition at line 82 of file TrackingAnalyzer.h.

Referenced by beginJob(), and endLuminosityBlock().

std::string TrackingAnalyser::outputFileName_
private

Definition at line 74 of file TrackingAnalyzer.h.

std::string TrackingAnalyser::outputFilePath_
private

Definition at line 73 of file TrackingAnalyzer.h.

edm::EDGetTokenT<FEDRawDataCollection> TrackingAnalyser::rawDataToken_
private

Definition at line 71 of file TrackingAnalyzer.h.

Referenced by checkTrackerFEDs(), and TrackingAnalyser().

int TrackingAnalyser::shiftReportFrequency_
private

Definition at line 69 of file TrackingAnalyzer.h.

Referenced by analyze(), and TrackingAnalyser().

int TrackingAnalyser::staticUpdateFrequency_
private

Definition at line 67 of file TrackingAnalyzer.h.

Referenced by TrackingAnalyser().

edm::ParameterSet TrackingAnalyser::tkMapPSet_
private

Definition at line 76 of file TrackingAnalyzer.h.

Referenced by TrackingAnalyser().

bool TrackingAnalyser::trackerFEDsFound_
private

Definition at line 84 of file TrackingAnalyzer.h.

Referenced by analyze(), checkTrackerFEDs(), endLuminosityBlock(), and TrackingAnalyser().