CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TriggerJSONMonitoring.h
Go to the documentation of this file.
1 #ifndef JSONMonitoring_TriggerJSONMonitoring_h
2 #define JSONMonitoring_TriggerJSONMonitoring_h
3 
21 
27 
30 
32 
33 namespace hltJson {
34  //Struct for storing variables that must be written and reset every lumi section
35  struct lumiVars {
36  HistoJ<unsigned int> *processed; // # of events processed
37 
38  HistoJ<unsigned int> *hltWasRun; // # of events where HLT[i] was run
39  HistoJ<unsigned int> *hltL1s; // # of events after L1 seed
40  HistoJ<unsigned int> *hltPre; // # of events after HLT prescale
41  HistoJ<unsigned int> *hltAccept; // # of events accepted by HLT[i]
42  HistoJ<unsigned int> *hltReject; // # of events rejected by HLT[i]
43  HistoJ<unsigned int> *hltErrors; // # of events with error in HLT[i]
44 
45  HistoJ<unsigned int> *hltDatasets; // # of events accepted by each dataset
46 
47  //Names and directories aren't changed at lumi section boundaries,
48  //but they need to be in this struct to be write JSON files at the end
49  HistoJ<std::string> *hltNames; // list of HLT path names
50  HistoJ<std::string> *datasetNames; // list of dataset names
51 
52  std::string baseRunDir; //Base directory from EvFDaqDirector
53  std::string jsonRateDefFile; //Definition file name for JSON with rates
54  std::string jsonLegendDefFile; //Definition file name for JSON with legend of names
55  };
56 }//End hltJson namespace
57 
58 //
59 // class declaration
60 //
61 class TriggerJSONMonitoring : public edm::stream::EDAnalyzer <edm::LuminosityBlockSummaryCache<hltJson::lumiVars>>
62 {
63  public:
66  static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);
67 
68  void analyze(edm::Event const&,
69  edm::EventSetup const&);
70 
71  void beginRun(edm::Run const&,
72  edm::EventSetup const&);
73 
75 
76  static std::shared_ptr<hltJson::lumiVars> globalBeginLuminosityBlockSummary(edm::LuminosityBlock const&,
77  edm::EventSetup const&,
78  LuminosityBlockContext const*);
79 
81  edm::EventSetup const&,
82  hltJson::lumiVars*) const;
83 
84 
86  edm::EventSetup const&,
87  LuminosityBlockContext const*,
89 
90  void resetRun(bool changed); //Reset run-related info
91  void resetLumi(); //Reset all counters
92 
94  void writeDefLegJson(std::string path);
95 
96  //Variables from cfg and associated tokens
97  edm::InputTag triggerResults_; // Input tag for TriggerResults
99 
100  //Variables that change at most once per run
101  HLTConfigProvider hltConfig_; // to get configuration for HLT
102 
103  std::string baseRunDir_; //Base directory from EvFDaqDirector
104 
105  // hltIndex_[ds][p] stores the hltNames_ index of the p-th path of the ds-th dataset
106  std::vector<std::vector<unsigned int> > hltIndex_;
107  std::vector<std::string> hltNames_; // list of HLT path names
108  std::vector<std::string> datasetNames_; // list of dataset names
109  std::vector<std::vector<std::string> > datasetContents_; // list of path names for each dataset
110 
111  std::vector<int> posL1s_; // pos # of last L1 seed
112  std::vector<int> posPre_; // pos # of last HLT prescale
113 
114  std::string jsonRateDefFile_; //Definition file name for JSON with rates
115  std::string jsonLegendDefFile_; //Definition file name for JSON with legend of names
116 
117  //Variables that need to be reset at lumi section boundaries
118  unsigned int processed_; // # of events processed
119 
120  std::vector<unsigned int> hltWasRun_; // # of events where HLT[i] was run
121  std::vector<unsigned int> hltL1s_; // # of events after L1 seed
122  std::vector<unsigned int> hltPre_; // # of events after HLT prescale
123  std::vector<unsigned int> hltAccept_; // # of events accepted by HLT[i]
124  std::vector<unsigned int> hltReject_; // # of events rejected by HLT[i]
125  std::vector<unsigned int> hltErrors_; // # of events with error in HLT[i]
126 
127  std::vector<unsigned int> hltDatasets_; // # of events accepted by each dataset
128 
129  private:
130 
131 };
132 #endif
HistoJ< std::string > * datasetNames
TriggerJSONMonitoring(const edm::ParameterSet &)
void resetRun(bool changed)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
HistoJ< unsigned int > * hltReject
std::vector< unsigned int > hltDatasets_
static std::shared_ptr< hltJson::lumiVars > globalBeginLuminosityBlockSummary(edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
HistoJ< unsigned int > * hltErrors
std::vector< unsigned int > hltErrors_
static void globalEndLuminosityBlockSummary(edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, hltJson::lumiVars *)
void beginRun(edm::Run const &, edm::EventSetup const &)
HistoJ< unsigned int > * processed
std::vector< unsigned int > hltL1s_
std::vector< std::vector< unsigned int > > hltIndex_
HistoJ< unsigned int > * hltAccept
std::vector< unsigned int > hltAccept_
tuple path
else: Piece not in the list, fine.
void endLuminosityBlockSummary(edm::LuminosityBlock const &, edm::EventSetup const &, hltJson::lumiVars *) const
std::vector< std::string > hltNames_
HLTConfigProvider hltConfig_
std::vector< std::string > datasetNames_
std::vector< unsigned int > hltReject_
HistoJ< unsigned int > * hltPre
std::vector< int > posL1s_
edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
HistoJ< unsigned int > * hltDatasets
void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
HistoJ< std::string > * hltNames
void writeDefJson(std::string path)
std::vector< unsigned int > hltWasRun_
std::vector< std::vector< std::string > > datasetContents_
std::vector< int > posPre_
HistoJ< unsigned int > * hltL1s
void analyze(edm::Event const &, edm::EventSetup const &)
HistoJ< unsigned int > * hltWasRun
void writeDefLegJson(std::string path)
Definition: Run.h:41
std::vector< unsigned int > hltPre_