CMS 3D CMS Logo

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

#include <TrackingAnalyzer.h>

Inheritance diagram for TrackingAnalyser:
DQMEDHarvester edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 TrackingAnalyser (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~TrackingAnalyser ()
 Destructor. More...
 
- Public Member Functions inherited from DQMEDHarvester
virtual void analyze (edm::Event const &, edm::EventSetup const &) final
 
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
 DQMEDHarvester (void)
 
virtual void endJob () final
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
virtual void endRun (edm::Run const &, edm::EventSetup const &)
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 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 & itemsToGetFromEvent () 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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void beginJob ()
 BeginJob. More...
 
void beginRun (edm::Run const &run, edm::EventSetup const &eSetup)
 BeginRun. More...
 
void checkTrackerFEDsInLS (DQMStore::IGetter &igetter, double iLS)
 
void checkTrackerFEDsWdataInLS (DQMStore::IGetter &igetter, double iLS)
 
void dqmBeginLuminosityBlock (DQMStore::IBooker &ibooker_, DQMStore::IGetter &igetter_, edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &eSetup)
 Begin Luminosity Block. More...
 
void dqmEndJob (DQMStore::IBooker &ibooker_, DQMStore::IGetter &igetter_)
 Endjob. More...
 
void dqmEndLuminosityBlock (DQMStore::IBooker &ibooker_, DQMStore::IGetter &igetter_, edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &eSetup)
 End Luminosity Block. More...
 

Private Attributes

TrackingActionExecutoractionExecutor_
 
edm::ESHandle< SiStripDetCablingdetCabling_
 
edm::ESHandle< SiStripFedCablingfedCabling_
 
int fileSaveFrequency_
 
int globalStatusFilling_
 
std::ostringstream html_out_
 
unsigned long long m_cacheID_
 
std::string nFEDinfoDir_
 
std::string nFEDinVsLSname_
 
std::string nFEDinWdataVsLSname_
 
int nLumiSecs_
 
std::string outputFileName_
 
std::string outputFilePath_
 
edm::EDGetTokenT< FEDRawDataCollectionrawDataToken_
 
int shiftReportFrequency_
 
int staticUpdateFrequency_
 
edm::ParameterSet tkMapPSet_
 
bool trackerFEDsFound_
 
bool trackerFEDsWdataFound_
 
bool verbose_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 25 of file TrackingAnalyzer.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 43 of file TrackingAnalyzer.cc.

References actionExecutor_, BUF_SIZE, MessageLogger_cfi::cerr, gather_cfg::cout, groupFilesInBlocks::fin, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), globalStatusFilling_, html_out_, recoMuon::in, nFEDinfoDir_, nFEDinVsLSname_, nFEDinWdataVsLSname_, rawDataToken_, shiftReportFrequency_, staticUpdateFrequency_, AlCaHLTBitMon_QueryRunRegistry::string, trackerFEDsFound_, trackerFEDsWdataFound_, and verbose_.

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

Destructor.

Definition at line 86 of file TrackingAnalyzer.cc.

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

Member Function Documentation

void TrackingAnalyser::beginJob ( void  )
privatevirtual

BeginJob.

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 94 of file TrackingAnalyzer.cc.

References nLumiSecs_.

94  {
95 
96  nLumiSecs_ = 0;
97 }
void TrackingAnalyser::beginRun ( edm::Run const &  run,
edm::EventSetup const &  eSetup 
)
privatevirtual

BeginRun.

Reimplemented from DQMEDHarvester.

Definition at line 101 of file TrackingAnalyzer.cc.

References gather_cfg::cout, detCabling_, fedCabling_, edm::EventSetup::get(), m_cacheID_, and verbose_.

101  {
102  edm::LogInfo ("TrackingAnalyser") <<"TrackingAnalyser:: Begining of Run";
103 
104  if (verbose_) std::cout << "[TrackingAnalyser::beginRun]" << std::endl;
105  // Check latest Fed cabling and create TrackerMapCreator
106  unsigned long long cacheID = eSetup.get<SiStripFedCablingRcd>().cacheIdentifier();
107  if (m_cacheID_ != cacheID) {
108  m_cacheID_ = cacheID;
109  edm::LogInfo("TrackingAnalyser") <<"TrackingAnalyser::beginRun: "
110  << " Change in Cabling, recrated TrackerMap";
111  eSetup.get<SiStripFedCablingRcd>().get(fedCabling_);
112  eSetup.get<SiStripDetCablingRcd>().get(detCabling_);
113  }
114 }
edm::ESHandle< SiStripDetCabling > detCabling_
unsigned long long m_cacheID_
edm::ESHandle< SiStripFedCabling > fedCabling_
void TrackingAnalyser::checkTrackerFEDsInLS ( DQMStore::IGetter igetter,
double  iLS 
)
private

Definition at line 179 of file TrackingAnalyzer.cc.

References gather_cfg::cout, DQMStore::IGetter::get(), MonitorElement::getBinContent(), MonitorElement::getTProfile(), nFEDinfoDir_, nFEDinVsLSname_, trackerFEDsFound_, and verbose_.

Referenced by dqmEndLuminosityBlock().

180 {
181 
182  double nFEDinLS = 0.;
183  MonitorElement* tmpME = igetter.get(nFEDinfoDir_+"/"+nFEDinVsLSname_);
184  if (tmpME) {
185  TProfile* tmpP = tmpME->getTProfile();
186  size_t ibin = tmpP->GetXaxis()->FindBin(iLS);
187  if (verbose_) std::cout << "iLS: " << iLS << " ibin: " << ibin;
188  nFEDinLS = tmpME->getBinContent(ibin);
189  if (verbose_) std::cout << " ---> nFEDinLS: " << nFEDinLS;
190  }
191 
192  trackerFEDsFound_ = (nFEDinLS>0);
193  if (verbose_) std::cout << " ---> trackerFEDsFound_: " << trackerFEDsFound_ << std::endl;
194 }
std::string nFEDinfoDir_
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:305
std::string nFEDinVsLSname_
double getBinContent(int binx) const
get content of bin (1-D)
TProfile * getTProfile(void) const
void TrackingAnalyser::checkTrackerFEDsWdataInLS ( DQMStore::IGetter igetter,
double  iLS 
)
private

Definition at line 196 of file TrackingAnalyzer.cc.

References gather_cfg::cout, DEFINE_FWK_MODULE, DQMStore::IGetter::get(), MonitorElement::getBinContent(), MonitorElement::getTProfile(), nFEDinfoDir_, nFEDinWdataVsLSname_, trackerFEDsWdataFound_, and verbose_.

Referenced by dqmEndLuminosityBlock().

197 {
198 
199  double nFEDinLS = 0.;
200  MonitorElement* tmpME = igetter.get(nFEDinfoDir_+"/"+nFEDinWdataVsLSname_);
201  if (verbose_) std::cout << "found " << nFEDinfoDir_ << "/" << nFEDinWdataVsLSname_ << " ? " << (tmpME ? "YES" : "NOPE") << std::endl;
202  if (tmpME) {
203  TProfile* tmpP = tmpME->getTProfile();
204  size_t ibin = tmpP->GetXaxis()->FindBin(iLS);
205  if (verbose_) std::cout << "iLS: " << iLS << " ibin: " << ibin;
206  nFEDinLS = tmpME->getBinContent(ibin);
207  if (verbose_) std::cout << " ---> nFEDinLS: " << nFEDinLS;
208  }
209 
210  trackerFEDsWdataFound_ = (nFEDinLS>0);
211  if (verbose_) std::cout << " ---> trackerFEDsWdataFound_: " << trackerFEDsWdataFound_ << std::endl;
212 }
std::string nFEDinfoDir_
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:305
std::string nFEDinWdataVsLSname_
double getBinContent(int binx) const
get content of bin (1-D)
TProfile * getTProfile(void) const
void TrackingAnalyser::dqmBeginLuminosityBlock ( DQMStore::IBooker ibooker_,
DQMStore::IGetter igetter_,
edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  eSetup 
)
private

Begin Luminosity Block.

Definition at line 118 of file TrackingAnalyzer.cc.

References gather_cfg::cout, and verbose_.

118  {
119  edm::LogInfo("TrackingAnalyser") <<"TrackingAnalyser:: Begin of LS transition";
120  if (verbose_) std::cout << "[TrackingAnalyser::dqmBeginLuminosityBlock]" << std::endl;
121 }
void TrackingAnalyser::dqmEndJob ( DQMStore::IBooker ibooker_,
DQMStore::IGetter igetter_ 
)
privatevirtual

Endjob.

Implements DQMEDHarvester.

Definition at line 164 of file TrackingAnalyzer.cc.

References actionExecutor_, gather_cfg::cout, TrackingActionExecutor::createGlobalStatus(), TrackingActionExecutor::fillGlobalStatus(), globalStatusFilling_, and verbose_.

164  {
165  edm::LogInfo("TrackingAnalyser") <<"TrackingAnalyser:: endjob called!";
166  if (verbose_) std::cout << "[TrackingAnalyser::dqmEndJob]" << std::endl;
167 
169  // Fill Global Status
170  if (globalStatusFilling_ > 0) {
171  actionExecutor_->fillGlobalStatus(ibooker_,igetter_);
172  }
173 
174 
175 }
void fillGlobalStatus(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
void createGlobalStatus(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
TrackingActionExecutor * actionExecutor_
void TrackingAnalyser::dqmEndLuminosityBlock ( DQMStore::IBooker ibooker_,
DQMStore::IGetter igetter_,
edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  eSetup 
)
privatevirtual

End Luminosity Block.

Reimplemented from DQMEDHarvester.

Definition at line 126 of file TrackingAnalyzer.cc.

References actionExecutor_, checkTrackerFEDsInLS(), checkTrackerFEDsWdataInLS(), gather_cfg::cout, TrackingActionExecutor::createDummyShiftReport(), TrackingActionExecutor::createGlobalStatus(), TrackingActionExecutor::createShiftReport(), TrackingActionExecutor::fillDummyGlobalStatus(), TrackingActionExecutor::fillDummyLSStatus(), TrackingActionExecutor::fillGlobalStatus(), globalStatusFilling_, edm::LuminosityBlockBase::id(), edm::LuminosityBlockBase::luminosityBlock(), edm::LuminosityBlockID::luminosityBlock(), nLumiSecs_, shiftReportFrequency_, trackerFEDsFound_, trackerFEDsWdataFound_, and verbose_.

126  {
127  edm::LogInfo ("TrackingAnalyser") <<"TrackingAnalyser:: End of LS transition, performing the DQM client operation";
128  if (verbose_) std::cout << "[TrackingAnalyser::endLuminosityBlock]" << std::endl;
129  nLumiSecs_++;
130 
131  if (verbose_) std::cout << "[TrackingAnalyser::endLuminosityBlock] globalStatusFilling_ " << (globalStatusFilling_ ? "YES" : "NOPE") << std::endl;
133 
134  double iLS = lumiSeg.id().luminosityBlock();
135  checkTrackerFEDsInLS(igetter_,iLS);
136  checkTrackerFEDsWdataInLS(igetter_,iLS);
137  if (verbose_) std::cout << "[TrackingAnalyser::endLuminosityBlock] trackerFEDsFound_ " << (trackerFEDsFound_ ? "YES" : "NOPE") << std::endl;
138  if (verbose_) std::cout << "[TrackingAnalyser::endLuminosityBlock] trackerFEDsWdataFound_ " << (trackerFEDsWdataFound_ ? "YES" : "NOPE") << std::endl;
139 
140  if (!trackerFEDsFound_) {
143  } else {
145  actionExecutor_->fillGlobalStatus(ibooker_,igetter_);
146  if (shiftReportFrequency_ != -1) actionExecutor_->createShiftReport(ibooker_,igetter_);
147  }
148  }
149 
150  if (!trackerFEDsFound_) {
152  return;
153  }
154 
155  if (verbose_) std::cout << "====================================================== " << std::endl;
156  if (verbose_) std::cout << " ===> Iteration # " << nLumiSecs_ << " " << lumiSeg.luminosityBlock() << std::endl;
157  if (verbose_) std::cout << "====================================================== " << std::endl;
158 
159 }
void fillGlobalStatus(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
void createShiftReport(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
void createGlobalStatus(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
void checkTrackerFEDsWdataInLS(DQMStore::IGetter &igetter, double iLS)
TrackingActionExecutor * actionExecutor_
void checkTrackerFEDsInLS(DQMStore::IGetter &igetter, double iLS)

Member Data Documentation

TrackingActionExecutor* TrackingAnalyser::actionExecutor_
private

Definition at line 75 of file TrackingAnalyzer.h.

Referenced by dqmEndJob(), dqmEndLuminosityBlock(), and TrackingAnalyser().

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

Definition at line 74 of file TrackingAnalyzer.h.

Referenced by beginRun().

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

Definition at line 73 of file TrackingAnalyzer.h.

Referenced by beginRun().

int TrackingAnalyser::fileSaveFrequency_
private

Definition at line 62 of file TrackingAnalyzer.h.

int TrackingAnalyser::globalStatusFilling_
private

Definition at line 64 of file TrackingAnalyzer.h.

Referenced by dqmEndJob(), dqmEndLuminosityBlock(), and TrackingAnalyser().

std::ostringstream TrackingAnalyser::html_out_
private

Definition at line 81 of file TrackingAnalyzer.h.

Referenced by TrackingAnalyser().

unsigned long long TrackingAnalyser::m_cacheID_
private

Definition at line 77 of file TrackingAnalyzer.h.

Referenced by beginRun().

std::string TrackingAnalyser::nFEDinfoDir_
private
std::string TrackingAnalyser::nFEDinVsLSname_
private

Definition at line 84 of file TrackingAnalyzer.h.

Referenced by checkTrackerFEDsInLS(), and TrackingAnalyser().

std::string TrackingAnalyser::nFEDinWdataVsLSname_
private

Definition at line 85 of file TrackingAnalyzer.h.

Referenced by checkTrackerFEDsWdataInLS(), and TrackingAnalyser().

int TrackingAnalyser::nLumiSecs_
private

Definition at line 78 of file TrackingAnalyzer.h.

Referenced by beginJob(), and dqmEndLuminosityBlock().

std::string TrackingAnalyser::outputFileName_
private

Definition at line 70 of file TrackingAnalyzer.h.

std::string TrackingAnalyser::outputFilePath_
private

Definition at line 69 of file TrackingAnalyzer.h.

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

Definition at line 67 of file TrackingAnalyzer.h.

Referenced by TrackingAnalyser().

int TrackingAnalyser::shiftReportFrequency_
private

Definition at line 65 of file TrackingAnalyzer.h.

Referenced by dqmEndLuminosityBlock(), and TrackingAnalyser().

int TrackingAnalyser::staticUpdateFrequency_
private

Definition at line 63 of file TrackingAnalyzer.h.

Referenced by TrackingAnalyser().

edm::ParameterSet TrackingAnalyser::tkMapPSet_
private

Definition at line 72 of file TrackingAnalyzer.h.

bool TrackingAnalyser::trackerFEDsFound_
private
bool TrackingAnalyser::trackerFEDsWdataFound_
private
bool TrackingAnalyser::verbose_
private