PPMSimBSMon.h 9.25 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/

// ********************************************************************
//
// NAME:     PPMSimBSMon.h
// PACKAGE:  TrigT1CaloMonitoring
//
// AUTHOR:   Peter Faulkner
//           Sky French
//	     
//
// ********************************************************************
#ifndef PPMSIMBSMON_H
#define PPMSIMBSMON_H

#include <string>
#include <vector>

#include "GaudiKernel/ToolHandle.h"
Dmitry Popov's avatar
Dmitry Popov committed
22
#include "GaudiKernel/ServiceHandle.h"
23
24

#include "AthenaMonitoring/ManagedMonitorToolBase.h"
25
#include "xAODTrigL1Calo/TriggerTowerContainer.h"
26

27
28
29
class TH2F_LW;
class TH2I_LW;

Dmitry Popov's avatar
Dmitry Popov committed
30
31
32
class L1CaloCondSvc;
class L1CaloRunParametersContainer;

33
// ============================================================================
34
namespace LVL1 {
35
36
37
38
39
40
41
// ============================================================================
// Forward declarations:
// ============================================================================
class TriggerTower;
class IL1TriggerTowerTool;
class ITrigT1CaloMonErrorTool;
class TrigT1CaloLWHistogramTool;
Dmitry Popov's avatar
Dmitry Popov committed
42
43
44



45
// ============================================================================
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133

/** Cross-check of PPM LUT data with simulation.
 *
 *  Compares LUT from data with LUT simulated from FADC counts.
 *
 *  <b>ROOT Histogram Directories:</b>
 *
 *  <table>
 *  <tr><th> Directory                                                 </th><th> Contents                                               </th></tr>
 *  <tr><td> @c L1Calo/PPM/Errors/Data_Simulation/PPMLUTSim            </td><td> Eta-phi maps of data/simulation matches and mismatches </td></tr>
 *  <tr><td> @c L1Calo/PPM/Errors/Data_Simulation/MismatchEventNumbers </td><td> Event numbers of mismatches                            </td></tr>
 *  </table>
 *
 *  <b>Notes on Particular Histograms:</b>
 *
 *  <table>
 *  <tr><th> Histogram                                       </th><th> Comment                                                  </th></tr>
 *  <tr><td> @c L1Calo/PPM/Errors/Data_Simulation/PPMLUTSim/ <br>
 *           @c ppm_{em|had}_2d_etaPhi_tt_lut_SimNoData      </td><td> Will always be empty if there are less than 7 ADC slices </td></tr>
 *  </table>
 *
 *  <b>Custom Merges Used (Tier0):</b>
 *
 *  <table>
 *  <tr><th> Merge                                    </th><th> Used For                    </th></tr>
 *  <tr><td> @ref MergesUsedsection "@c eventSample " </td><td> Mismatch event number plots </td></tr>
 *  </table>
 *
 *  <b>StoreGate Containers Used:</b>
 *
 *  <table>
 *  <tr><th> Container                    </th><th> Comment                                  </th></tr>
 *  <tr><td> @c DataVector
 *           @c <LVL1::TriggerTower>      </td><td> PPM data                                 </td></tr>
 *  <tr><td> @c std::vector<int>          <br>
 *           @c "L1CaloPPMMismatchVector" </td><td> Output.
 *                                                  Error summary bits for global histograms </td></tr>
 *  </table>
 *
 *  <b>Tools Used:</b>
 *
 *  <table>
 *  <tr><th> Tool                         </th><th> Description          </th></tr>
 *  <tr><td> @c LVL1::IL1TriggerTowerTool </td><td> @copydoc m_ttTool    </td></tr>
 *  <tr><td> @c TrigT1CaloMonErrorTool    </td><td> @copydoc m_errorTool </td></tr>
 *  <tr><td> @c TrigT1CaloLWHistogramTool </td><td> @copydoc m_histTool  </td></tr>
 *  </table>
 *
 *  <b>JobOption Properties:</b>
 *
 *  <table>
 *  <tr><th> Property                </th><th> Description                     </th></tr>
 *  <tr><td> @c TriggerTowerLocation </td><td> @copydoc m_triggerTowerLocation </td></tr>
 *  <tr><td> @c RootDirectory        </td><td> @copydoc m_rootDir              </td></tr>
 *  <tr><td> @c SimulationADCCut     </td><td> @copydoc m_simulationADCCut     </td></tr>
 *  </table>
 *
 *  <b>Related Documentation:</b>
 *
 *  <a href="http://hepwww.rl.ac.uk/Atlas-L1/Modules/PPr/PPMod_Wrup.pdf">
 *  The Pre-Processor Module (PPM) for the ATLAS Level-1 Calorimeter Trigger</a><br>
 *  <a href="http://hepwww.rl.ac.uk/Atlas-L1/Modules/ROD/ROD-spec-version1_2_2.pdf">
 *  ATLAS Level-1 Calorimeter Trigger - Read-out Driver</a>
 *
 *  @authors Peter Faulkner, Sky French
 *
 */

class PPMSimBSMon: public ManagedMonitorToolBase
{

public:
  
  PPMSimBSMon(const std::string & type, const std::string & name,
		       const IInterface* parent);
    

  virtual ~PPMSimBSMon();

  virtual StatusCode initialize();
  virtual StatusCode finalize();  
  virtual StatusCode bookHistogramsRecurrent();
  virtual StatusCode fillHistograms();
  virtual StatusCode procHistograms();

private:

  typedef std::vector<int> ErrorVector;
Dmitry Popov's avatar
Dmitry Popov committed
134
135

  StatusCode retrieveConditions();
136
  
137
138
139
140
  /// Fill error event number histogram
  void  fillEventSample(int crate, int module);

  /// Simulate LUT data from FADC data
141
  void simulateAndCompare(const xAOD::TriggerTowerContainer* ttIn);
142
143
144
145

  /// LUT simulation tool
  ToolHandle<LVL1::IL1TriggerTowerTool> m_ttTool;
  /// Corrupt event veto tool
146
  ToolHandle<ITrigT1CaloMonErrorTool>    m_errorTool;
147
148
  /// Histogram helper tool
  ToolHandle<TrigT1CaloLWHistogramTool> m_histTool;
Dmitry Popov's avatar
Dmitry Popov committed
149
150
151
152
153

  /// L1Calo conditions                                                                               
  ServiceHandle<L1CaloCondSvc> m_l1CondSvc;

  /// Database container
Shaun Roe's avatar
Shaun Roe committed
154
  L1CaloRunParametersContainer* m_runParametersContainer{};
Dmitry Popov's avatar
Dmitry Popov committed
155

156
157
158
159
160
161
162
  /// Root directory name
  std::string m_rootDir;

  /// Trigger Tower container StoreGate key
  std::string m_triggerTowerLocation;

  /// Cut on ADC digits for re-simulation
Shaun Roe's avatar
Shaun Roe committed
163
  int m_simulationADCCut{};
164
  /// Histograms booked flag
Shaun Roe's avatar
Shaun Roe committed
165
  bool m_histBooked{};
166
167
168
169
170

  //=======================
  //   Match/Mismatch plots
  //=======================

171
  // LUT-CP
Shaun Roe's avatar
Shaun Roe committed
172
173
174
175
176
177
178
179
  TH2F_LW* m_h_ppm_em_2d_etaPhi_tt_lutCp_SimEqData{};  ///< PPM LUT EM Data/Simulation Non-zero Matches
  TH2F_LW* m_h_ppm_em_2d_etaPhi_tt_lutCp_SimNeData{};  ///< PPM LUT EM Data/Simulation Non-zero Mismatches
  TH2F_LW* m_h_ppm_em_2d_etaPhi_tt_lutCp_SimNoData{};  ///< PPM LUT EM Simulation but no Data
  TH2F_LW* m_h_ppm_em_2d_etaPhi_tt_lutCp_DataNoSim{};  ///< PPM LUT EM Data but no Simulation
  TH2F_LW* m_h_ppm_had_2d_etaPhi_tt_lutCp_SimEqData{}; ///< PPM LUT HAD Data/Simulation Non-zero Matches
  TH2F_LW* m_h_ppm_had_2d_etaPhi_tt_lutCp_SimNeData{}; ///< PPM LUT HAD Data/Simulation Non-zero Mismatches
  TH2F_LW* m_h_ppm_had_2d_etaPhi_tt_lutCp_SimNoData{}; ///< PPM LUT HAD Simulation but no Data
  TH2F_LW* m_h_ppm_had_2d_etaPhi_tt_lutCp_DataNoSim{}; ///< PPM LUT HAD Data but no Simulation
180
181
  
  // LUT-JEP
Shaun Roe's avatar
Shaun Roe committed
182
183
184
185
186
187
188
189
  TH2F_LW* m_h_ppm_em_2d_etaPhi_tt_lutJep_SimEqData{};  ///< PPM LUT EM Data/Simulation Non-zero Matches
  TH2F_LW* m_h_ppm_em_2d_etaPhi_tt_lutJep_SimNeData{};  ///< PPM LUT EM Data/Simulation Non-zero Mismatches
  TH2F_LW* m_h_ppm_em_2d_etaPhi_tt_lutJep_SimNoData{};  ///< PPM LUT EM Simulation but no Data
  TH2F_LW* m_h_ppm_em_2d_etaPhi_tt_lutJep_DataNoSim{};  ///< PPM LUT EM Data but no Simulation
  TH2F_LW* m_h_ppm_had_2d_etaPhi_tt_lutJep_SimEqData{}; ///< PPM LUT HAD Data/Simulation Non-zero Matches
  TH2F_LW* m_h_ppm_had_2d_etaPhi_tt_lutJep_SimNeData{}; ///< PPM LUT HAD Data/Simulation Non-zero Mismatches
  TH2F_LW* m_h_ppm_had_2d_etaPhi_tt_lutJep_SimNoData{}; ///< PPM LUT HAD Simulation but no Data
  TH2F_LW* m_h_ppm_had_2d_etaPhi_tt_lutJep_DataNoSim{}; ///< PPM LUT HAD Data but no Simulation
190
191

  // BCID
Shaun Roe's avatar
Shaun Roe committed
192
193
194
195
196
197
198
199
  TH2F_LW* m_h_ppm_2d_etaPhi_tt_peakf_NonZeroMatches{};   ///< PPM PEAKFINDER BCID Data/Simulation Non-zero Matches
  TH2F_LW* m_h_ppm_2d_etaPhi_tt_peakf_ZeroMatches{};      ///< PPM PEAKFINDER BCID Data/Simulation Zero Matches
  TH2F_LW* m_h_ppm_2d_etaPhi_tt_peakf_SimNoData{};        ///< PPM PEAKFINDER BCID Data/Simulation Simulation but no Data
  TH2F_LW* m_h_ppm_2d_etaPhi_tt_peakf_DataNoSim{};        ///< PPM PEAKFINDER BCID Data/Simulation Data but no Simulation
  TH2F_LW* m_h_ppm_2d_etaPhi_tt_satBcid_NonZeroMatches{}; ///< PPM SATURATED BCID Data/Simulation Non-zero Matches
  TH2F_LW* m_h_ppm_2d_etaPhi_tt_satBcid_ZeroMatches{};    ///< PPM SATURATED BCID Data/Simulation Zero Matches
  TH2F_LW* m_h_ppm_2d_etaPhi_tt_satBcid_SimNoData{};      ///< PPM SATURATED BCID Data/Simulation Simulation but no Data
  TH2F_LW* m_h_ppm_2d_etaPhi_tt_satBcid_DataNoSim{};      ///< PPM SATURATED BCID Data/Simulation Data but no Simulation
200
201
  
  // Mismatch Event Number Histograms
Shaun Roe's avatar
Shaun Roe committed
202
203
204
205
  TH2I_LW* m_h_ppm_2d_LUT_MismatchEvents_cr0cr1{};   ///< PPM LUT Mismatch Event Numbers Crates 0 and 1
  TH2I_LW* m_h_ppm_2d_LUT_MismatchEvents_cr2cr3{};   ///< PPM LUT Mismatch Event Numbers Crates 2 and 3
  TH2I_LW* m_h_ppm_2d_LUT_MismatchEvents_cr4cr5{};   ///< PPM LUT Mismatch Event Numbers Crates 4 and 5
  TH2I_LW* m_h_ppm_2d_LUT_MismatchEvents_cr6cr7{};   ///< PPM LUT Mismatch Event Numbers Crates 6 and 7
206
  
207
  // Mismatch Event Number Histograms for LUT-JEP
208
209
210
211
  //TH2I_LW* m_h_ppm_2d_LUTJEP_MismatchEvents_cr0cr1;   ///< PPM LUT-JEP Mismatch Event Numbers Crates 0 and 1
  //TH2I_LW* m_h_ppm_2d_LUTJEP_MismatchEvents_cr2cr3;   ///< PPM LUT-JEP Mismatch Event Numbers Crates 2 and 3
  //TH2I_LW* m_h_ppm_2d_LUTJEP_MismatchEvents_cr4cr5;   ///< PPM LUT-JEP Mismatch Event Numbers Crates 4 and 5
  //TH2I_LW* m_h_ppm_2d_LUTJEP_MismatchEvents_cr6cr7;   ///< PPM LUT-JEP Mismatch Event Numbers Crates 6 and 7
212
  
213
214
};

215
216
217
218
// ============================================================================
}  // end namespace
// ============================================================================

219
#endif