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 
22 
28 
31 
33 
41 
42 #include <atomic>
43 
44 namespace hltJson {
45  //Struct for storing variables that must be written and reset every lumi section
46  struct lumiVars {
47  HistoJ<unsigned int> *processed; // # of events processed
48  HistoJ<unsigned int> *hltWasRun; // # of events where HLT[i] was run
49  HistoJ<unsigned int> *hltL1s; // # of events after L1 seed
50  HistoJ<unsigned int> *hltPre; // # of events after HLT prescale
51  HistoJ<unsigned int> *hltAccept; // # of events accepted by HLT[i]
52  HistoJ<unsigned int> *hltReject; // # of events rejected by HLT[i]
53  HistoJ<unsigned int> *hltErrors; // # of events with error in HLT[i]
54  HistoJ<unsigned int> *hltDatasets; // # of events accepted by each dataset
55 
56  std::string baseRunDir; //Base directory from EvFDaqDirector
57  std::string stHltJsd; //Definition file name for JSON with rates
58 
59  HistoJ<unsigned int> *L1Global; // Global # of Phyics, Cailibration and Random L1 triggers //DS
60  HistoJ<unsigned int> *L1Accept; // # of events accepted by L1T[i] //DS
61  HistoJ<unsigned int> *L1TechAccept; // # of events accepted by L1 Technical Triggers[i] //DS
62 
63  std::string stL1Jsd; //Definition file name for JSON with L1 rates //DS
64  };
65  //End lumi struct
66  //Struct for storing variable written once per run
67  struct runVars{
68  mutable std::atomic<bool> wroteFiles;
69  };
70 }//End hltJson namespace
71 
72 //
73 // class declaration
74 //
75 class TriggerJSONMonitoring : public edm::stream::EDAnalyzer <edm::RunCache<hltJson::runVars>, edm::LuminosityBlockSummaryCache<hltJson::lumiVars>>
76 {
77  public:
80  static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);
81 
82  void analyze(edm::Event const&,
83  edm::EventSetup const&);
84 
85  void beginRun(edm::Run const&,
86  edm::EventSetup const&);
87 
88  static std::shared_ptr<hltJson::runVars> globalBeginRun(edm::Run const&, edm::EventSetup const&, void const*){
89  std::shared_ptr<hltJson::runVars> rv(new hltJson::runVars);
90  rv->wroteFiles = false;
91  return rv;
92  }
93 
94  static void globalEndRun(edm::Run const& iRun, edm::EventSetup const&, RunContext const* iContext){ }
95 
97 
98  static std::shared_ptr<hltJson::lumiVars> globalBeginLuminosityBlockSummary(edm::LuminosityBlock const&,
99  edm::EventSetup const&,
100  LuminosityBlockContext const*);
101 
103  edm::EventSetup const&,
104  hltJson::lumiVars*) const;
105 
106 
108  edm::EventSetup const&,
109  LuminosityBlockContext const*,
111 
112  void resetRun(bool changed); //Reset run-related info
113  void resetLumi(); //Reset all counters
114 
116 
117  void writeL1DefJson(std::string path); //DS
118 
119  //Variables from cfg and associated tokens
120  edm::InputTag triggerResults_; // Input tag for TriggerResults
122 
123  edm::InputTag level1Results_; // Input tag for L1 GT Readout Record //DS
125 
126  //Variables that change at most once per run
127  HLTConfigProvider hltConfig_; // to get configuration for HLT
128  const L1GtTriggerMenu* m_l1GtMenu; // L1 trigger menu //DS
129  AlgorithmMap algorithmMap; // L1 algorithm map //DS
130  AlgorithmMap technicalMap; // L1 technical triggeral map //DS
131 
134 
135  std::string baseRunDir_; //Base directory from EvFDaqDirector
136 
137  // hltIndex_[ds][p] stores the hltNames_ index of the p-th path of the ds-th dataset
138  std::vector<std::vector<unsigned int> > hltIndex_;
139  std::vector<std::string> hltNames_; // list of HLT path names
140  std::vector<std::string> datasetNames_; // list of dataset names
141  std::vector<std::vector<std::string> > datasetContents_; // list of path names for each dataset
142 
143  std::vector<int> posL1s_; // pos # of last L1 seed
144  std::vector<int> posPre_; // pos # of last HLT prescale
145 
146  std::string stHltJsd_; //Definition file name for JSON with rates
147 
148  std::vector<std::string> L1AlgoNames_; // name of each L1 algorithm trigger //DS
149  std::vector<int> L1AlgoBitNumber_; // bit number of each L1 algo trigger //DS
150  std::vector<std::string> L1TechNames_; // name of each L1 technical trigger //DS
151  std::vector<int> L1TechBitNumber_; // bit number of each L1 tech trigger //DS
152  std::vector<std::string> L1GlobalType_; // experimentType: Physics, Calibration, Random //DS
153 
154  std::string stL1Jsd_; //Definition file name for JSON with L1 rates //DS
155 
156  //Variables that need to be reset at lumi section boundaries
157  unsigned int processed_; // # of events processed
158 
159  std::vector<unsigned int> hltWasRun_; // # of events where HLT[i] was run
160  std::vector<unsigned int> hltL1s_; // # of events after L1 seed
161  std::vector<unsigned int> hltPre_; // # of events after HLT prescale
162  std::vector<unsigned int> hltAccept_; // # of events accepted by HLT[i]
163  std::vector<unsigned int> hltReject_; // # of events rejected by HLT[i]
164  std::vector<unsigned int> hltErrors_; // # of events with error in HLT[i]
165 
166  std::vector<unsigned int> hltDatasets_; // # of events accepted by each dataset
167 
168  std::vector<unsigned int> L1Global_; // Global # of Physics, Calibration and Random L1 triggers //DS
169  std::vector<unsigned int> L1AlgoAccept_; // # of events accepted by L1T[i] //DS
170  std::vector<unsigned int> L1TechAccept_; // # of events accepted by L1 Technical Triggers[i] //DS
171 
172  private:
173 
174 };
175 #endif
std::vector< int > L1TechBitNumber_
TriggerJSONMonitoring(const edm::ParameterSet &)
static std::shared_ptr< hltJson::runVars > globalBeginRun(edm::Run const &, edm::EventSetup const &, void const *)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache > LuminosityBlockContext
Definition: EDAnalyzer.h:46
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1t_results
HistoJ< unsigned int > * L1TechAccept
std::atomic< bool > wroteFiles
HistoJ< unsigned int > * hltReject
std::vector< unsigned int > hltDatasets_
std::map< std::string, L1GtAlgorithm > AlgorithmMap
map containing the algorithms
static std::shared_ptr< hltJson::lumiVars > globalBeginLuminosityBlockSummary(edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
std::vector< unsigned int > L1AlgoAccept_
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_
const L1GtTriggerMenu * m_l1GtMenu
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.
HistoJ< unsigned int > * L1Accept
void endLuminosityBlockSummary(edm::LuminosityBlock const &, edm::EventSetup const &, hltJson::lumiVars *) const
std::vector< std::string > hltNames_
HLTConfigProvider hltConfig_
std::vector< int > L1AlgoBitNumber_
const L1GtTriggerMask * m_l1tTechMask
std::vector< std::string > datasetNames_
std::vector< std::string > L1GlobalType_
std::vector< unsigned int > hltReject_
HistoJ< unsigned int > * hltPre
std::vector< int > posL1s_
edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
std::vector< std::string > L1AlgoNames_
HistoJ< unsigned int > * hltDatasets
std::vector< unsigned int > L1TechAccept_
void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
const L1GtTriggerMask * m_l1tAlgoMask
static void globalEndRun(edm::Run const &iRun, edm::EventSetup const &, RunContext const *iContext)
void writeDefJson(std::string path)
std::vector< unsigned int > L1Global_
std::vector< unsigned int > hltWasRun_
std::vector< std::vector< std::string > > datasetContents_
std::vector< int > posPre_
HistoJ< unsigned int > * hltL1s
std::vector< std::string > L1TechNames_
void analyze(edm::Event const &, edm::EventSetup const &)
HistoJ< unsigned int > * L1Global
HistoJ< unsigned int > * hltWasRun
void writeL1DefJson(std::string path)
Definition: Run.h:41
std::vector< unsigned int > hltPre_