MistimedStreamMon.h 4.08 KB
Newer Older
Dmitry Popov's avatar
Dmitry Popov committed
1
/*
2
  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
Dmitry Popov's avatar
Dmitry Popov committed
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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
*/

// ********************************************************************
//
// NAME:        MistimedStreamMon.h
// PACKAGE:     TrigT1CaloMonitoring
//
// Author:      Julia I. Djuvsland (julia.djuvsland@kip.uni-heidelberg.de)
//              Sebastian M. Weber (sebastian.weber@kip.uni-heidelberg.de)
//              Universitaet Heidelberg
//
// ********************************************************************

#ifndef TRIGT1CALOMONITORING_MISTIMEDSTREAMMON_H
#define TRIGT1CALOMONITORING_MISTIMEDSTREAMMON_H

#include <string>
#include <vector>

#include "AthenaMonitoring/ManagedMonitorToolBase.h"
#include "GaudiKernel/ToolHandle.h"
#include "GaudiKernel/ServiceHandle.h"

#include "xAODTrigL1Calo/TriggerTower.h"
#include "xAODTrigL1Calo/TriggerTowerContainer.h"

class TH1F_LW;

class L1CaloCondSvc;
class L1CaloRunParametersContainer;
class L1CaloReadoutConfigContainer;

class StatusCode;
class EventInfo;
class ITHistSvc;

namespace Trig {
  class TrigDecisionTool;
}

// ============================================================================
namespace LVL1 {
// ============================================================================
// Forward declarations:
// ============================================================================
class IL1TriggerTowerTool;
class ITrigT1CaloMonErrorTool;
class TrigT1CaloLWHistogramTool;

/** This class monitors events that fired the trigger HLT_mistimemonj400
 *  to spot potential late or mistimed trigger towers, but will also pick up noise
 *
 *  <b>ROOT Histogram Directories (Tier0):</b>
 *
 *  <table>
 *  <tr><th> Directory                                    </th><th> Contents               </th></tr>
 *  <tr><td> @c L1Calo/MistimedStream/EventsPerLumiBlock  </td><td> Selected events per lumiblock <br>
 *  </table>
 *
 *
 *  @authors Julia I. Djuvsland, Sebastian M. Weber
 *
 * */

class MistimedStreamMon: public ManagedMonitorToolBase
{

 public:
  
  MistimedStreamMon(const std::string & type, const std::string & name,const IInterface* parent);
  virtual ~MistimedStreamMon();

  virtual StatusCode initialize();
  virtual StatusCode finalize();
  virtual StatusCode bookHistogramsRecurrent();
  virtual StatusCode fillHistograms();
  
private:
    
  StatusCode retrieveConditions();
  void fillEtaPhiMap(TH2F* hist, double eta, double phi, double weight, bool shrinkEtaBins = true);
  TH2F* createEtaPhiMap(std::string name, std::string title, bool isHADLayer = false, bool shrinkEtaBins = true);
  bool pulseQuality(std::vector<uint16_t> ttPulse, int peakSlice);
   
  /// Tool to retrieve bytestream errors
  ToolHandle<ITrigT1CaloMonErrorTool>   m_errorTool;
  /// Histogram helper tool
  ToolHandle<TrigT1CaloLWHistogramTool> m_histTool;
  /// TT simulation tool for Identifiers
  ToolHandle<LVL1::IL1TriggerTowerTool> m_ttTool;
  /// Tool to retrieve the trigger decision
  ToolHandle<Trig::TrigDecisionTool> m_trigDec;

  /// Histograms booked flag
Shaun Roe's avatar
Shaun Roe committed
97
  bool m_histBooked{};
Dmitry Popov's avatar
Dmitry Popov committed
98
99
100
101
  // Histograms
  
  // Overview histos
  // Overall selected events and cut flow of analysis
Shaun Roe's avatar
Shaun Roe committed
102
  TH1F_LW* m_h_1d_cutFlow_mistimedStreamAna{};  
Dmitry Popov's avatar
Dmitry Popov committed
103
  // Selected events per lumi block
Shaun Roe's avatar
Shaun Roe committed
104
  TH1F_LW* m_h_1d_selectedEvents_mistimedStreamAna{};
Dmitry Popov's avatar
Dmitry Popov committed
105
106
107
108
109
110
111
112
113
    
  //Variables for the properties
  /// Root directory
  std::string m_PathInRootFile;
  /// xAODTriggerTower Container key
  std::string m_xAODTriggerTowerContainerName;
  /// L1Calo conditions                                                                               
  ServiceHandle<L1CaloCondSvc> m_l1CondSvc;
  /// Database container for the run parameters
Shaun Roe's avatar
Shaun Roe committed
114
  L1CaloRunParametersContainer* m_runParametersContainer{};
Dmitry Popov's avatar
Dmitry Popov committed
115
  /// Database container for the readout configuration
Shaun Roe's avatar
Shaun Roe committed
116
  L1CaloReadoutConfigContainer* m_readoutConfigContainer{};
Dmitry Popov's avatar
Dmitry Popov committed
117
118

  //Control maximum number of histograms per job
Shaun Roe's avatar
Shaun Roe committed
119
120
  int m_maxHistos{};
  int m_curHistos{};
Dmitry Popov's avatar
Dmitry Popov committed
121
122
123
124
125
126
127
128
129
130
  
  //  Athena hist service
  ServiceHandle<ITHistSvc> m_thistSvc;
};

// ============================================================================
}  // end namespace
// ============================================================================

#endif