ATLAS Offline Software
LArRTMParamExtractor.h
Go to the documentation of this file.
1 //Dear emacs, this is -*- c++ -*-
2 
3 /*
4  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 
8 /*
9  * LArRTMParamExtractor
10  *
11  * This algorithm reads LArCaliWaveContainers and extract from each of the
12  * LArCaliWaves the LArCaliPulseParams and LArDetCellParams parameters
13  * according to the corresponding RTM algorithms.
14  *
15  * Author: Marco.Delmastro@cen.ch
16  *
17  */
18 
19 #ifndef LArRTMPARAMEXTRACTOR_H
20 #define LArRTMPARAMEXTRACTOR_H
21 
22 #include <string>
23 #include <vector>
24 #include <atomic>
25 
27 #include "GaudiKernel/ToolHandle.h"
29 #include "tbb/blocked_range.h"
30 #include "tbb/global_control.h"
34 #include <memory>
35 
37 
38 
39 class LArWFParamTool;
40 
42  //Acutally this algo can do internal multi-threading at finalize
43  //but not the way regular athenaMT works, so the thread-safety checker complains
44 
45  public:
46 
47  LArRTMParamExtractor(const std::string & name, ISvcLocator * pSvcLocator);
48 
50 
52  StatusCode execute() {return StatusCode::SUCCESS;}
53  StatusCode stop();
54  StatusCode finalize(){return StatusCode::SUCCESS;}
55 
56  private:
57 
58  SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey{this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"};
59  SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKeySC{this,"ScCablingKey","LArOnOffIdMapSC","SG Key of SC LArOnOffIdMapping object"};
60 
61  ToolHandle<LArWFParamTool> m_larWFParamTool{this,"LArWFParamTool","LArWFParamTool"};
62 
63  std::vector<std::string> m_keylist;
64  bool m_isSC;
65  bool m_testmode, m_dumpOmegaScan, m_dumpResOscill;
66  std::string m_omegaScanKey, m_resOscillKeyBefore, m_resOscillKeyAfter;
67 
69  std::vector<int> m_DAC;
70 
71  bool m_extractTcal, m_extractFstep, m_extractOmega0, m_extractTaur ;
72  float m_defaultTcal, m_defaultFstep, m_defaultOmega0, m_defaultTaur ;
73 
75 
76  std::string m_suffixRetrievedCaliPulse, m_suffixRetrievedDetCell;
77  std::string m_keyRetrievedCaliPulse, m_keyRetrievedDetCell ;
78 
79  std::string m_suffixExtractedCaliPulse, m_suffixExtractedDetCell;
80  std::string m_keyExtractedCaliPulse, m_keyExtractedDetCell ;
81 
82  // Grouping type
83  std::string m_groupingType;
84 
85  // FT selection
86  std::vector<int> m_FT;
87  int m_PosNeg;
88  // Slot selection
89  std::vector<int> m_Slot;
90  // Calib line selection
92  int m_Cline;
93 
94 
95  //Elements for TBB
96 
98  mutable std::atomic<unsigned> m_counter{0};
99 
100  class helperParams {
101  public:
102  helperParams(const LArCaliWave* cw, const HWIdentifier id, const unsigned g) :
103  caliWave(cw), chid(id),gain(g) {};
104 
105  const LArCaliWave* caliWave; //Input object
106  std::optional<LArCaliWave> omegaScan; //optional output object
107  std::optional<LArCaliWave> resOscill0; //optional output object
108  std::optional<LArCaliWave> resOscill1; //optional output object
109  LArWFParams wfParams; //Outut object
111  unsigned gain;
112  bool success=true;
113  };
114 
116  //The way this class gets used is actually thread-safe
117  public:
118  //Looper() = delete;
119  Looper(std::vector<helperParams>* p, const LArOnOffIdMapping* cabling, const LArWFParamTool* t,
120  MsgStream& ms,std::atomic<unsigned>& cnt ) :
121  m_tbbparams(p), m_cabling(cabling), m_tool(t),
122  m_msg(ms), m_counter(cnt) {};
123 
124  void operator() (const tbb::blocked_range<size_t>& r) const;
125 
126  private:
127  std::vector<helperParams>* m_tbbparams;
130  MsgStream& m_msg;
131  std::atomic<unsigned>& m_counter;
132  };
133 
134 
135 
136 };
137 
138 #endif
LArRTMParamExtractor::helperParams::caliWave
const LArCaliWave * caliWave
Definition: LArRTMParamExtractor.h:103
LArRTMParamExtractor::helperParams::resOscill0
std::optional< LArCaliWave > resOscill0
Definition: LArRTMParamExtractor.h:107
beamspotman.r
def r
Definition: beamspotman.py:676
LArRTMParamExtractor::m_isSC
bool m_isSC
Definition: LArRTMParamExtractor.h:64
LArRTMParamExtractor::m_ignoreDACselection
bool m_ignoreDACselection
Definition: LArRTMParamExtractor.h:68
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
ATLAS_NOT_THREAD_SAFE
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
Definition: checker_macros.h:212
LArRTMParamExtractor::execute
StatusCode execute()
Definition: LArRTMParamExtractor.h:52
LArRTMParamExtractor::Looper
Definition: LArRTMParamExtractor.h:115
LArRTMParamExtractor::m_DAC
std::vector< int > m_DAC
Definition: LArRTMParamExtractor.h:69
LArRTMParamExtractor::m_resOscillKeyBefore
std::string m_resOscillKeyBefore
Definition: LArRTMParamExtractor.h:66
initialize
void initialize()
Definition: run_EoverP.cxx:894
LArRTMParamExtractor::m_keyExtractedDetCell
std::string m_keyExtractedDetCell
Definition: LArRTMParamExtractor.h:80
CaloCondBlobAlgs_fillNoiseFromASCII.gain
gain
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:110
LArRTMParamExtractor::helperParams::chid
HWIdentifier chid
Definition: LArRTMParamExtractor.h:110
ReadCellNoiseFromCool.cabling
cabling
Definition: ReadCellNoiseFromCool.py:154
LArRTMParamExtractor::m_PosNeg
int m_PosNeg
Definition: LArRTMParamExtractor.h:87
LArWFParams
Definition: LArWFParams.h:20
PixelModuleFeMask_create_db.stop
int stop
Definition: PixelModuleFeMask_create_db.py:76
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
HWIdentifier
Definition: HWIdentifier.h:13
LArCaliWave.h
python.SystemOfUnits.ms
int ms
Definition: SystemOfUnits.py:132
LArRTMParamExtractor::Looper::m_tool
const LArWFParamTool * m_tool
Definition: LArRTMParamExtractor.h:129
LArRTMParamExtractor::helperParams::resOscill1
std::optional< LArCaliWave > resOscill1
Definition: LArRTMParamExtractor.h:108
LArRTMParamExtractor::m_Slot
std::vector< int > m_Slot
Definition: LArRTMParamExtractor.h:89
LArRTMParamExtractor::Looper::m_cabling
const LArOnOffIdMapping * m_cabling
Definition: LArRTMParamExtractor.h:128
LArRTMParamExtractor
Definition: LArRTMParamExtractor.h:41
AthAlgorithm.h
LArCaliWave
Definition: LArCaliWave.h:44
LArOnOffIdMapping.h
LArRTMParamExtractor::m_recoverEmptyDB
bool m_recoverEmptyDB
Definition: LArRTMParamExtractor.h:74
python.CaloCondTools.g
g
Definition: CaloCondTools.py:15
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
LArRTMParamExtractor::m_nThreads
int m_nThreads
Definition: LArRTMParamExtractor.h:97
LArRTMParamExtractor::m_suffixExtractedDetCell
std::string m_suffixExtractedDetCell
Definition: LArRTMParamExtractor.h:79
LArRTMParamExtractor::Looper::m_tbbparams
std::vector< helperParams > * m_tbbparams
Definition: LArRTMParamExtractor.h:127
LArRTMParamExtractor::m_FT
std::vector< int > m_FT
Definition: LArRTMParamExtractor.h:86
LArRTMParamExtractor::m_extractTcal
bool m_extractTcal
Definition: LArRTMParamExtractor.h:71
LArRTMParamExtractor::m_defaultTcal
float m_defaultTcal
Definition: LArRTMParamExtractor.h:72
AthAlgorithm
Definition: AthAlgorithm.h:47
LArRTMParamExtractor::helperParams::gain
unsigned gain
Definition: LArRTMParamExtractor.h:111
LArRTMParamExtractor::m_keylist
std::vector< std::string > m_keylist
Definition: LArRTMParamExtractor.h:63
LArRTMParamExtractor::finalize
StatusCode finalize()
Definition: LArRTMParamExtractor.h:54
LArRTMParamExtractor::helperParams::omegaScan
std::optional< LArCaliWave > omegaScan
Definition: LArRTMParamExtractor.h:106
LArWFParamTool
Definition: LArWFParamTool.h:29
LArRTMParamExtractor::m_Cline
int m_Cline
Definition: LArRTMParamExtractor.h:92
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:194
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
LArRTMParamExtractor::helperParams
Definition: LArRTMParamExtractor.h:100
LArRTMParamExtractor::helperParams::wfParams
LArWFParams wfParams
Definition: LArRTMParamExtractor.h:109
LArRTMParamExtractor::m_keyRetrievedDetCell
std::string m_keyRetrievedDetCell
Definition: LArRTMParamExtractor.h:77
SG::ReadCondHandleKey< LArOnOffIdMapping >
LArRTMParamExtractor::Looper::m_msg
MsgStream & m_msg
Definition: LArRTMParamExtractor.h:130
trigbs_pickEvents.cnt
cnt
Definition: trigbs_pickEvents.py:71
LArRTMParamExtractor::Looper::m_counter
std::atomic< unsigned > & m_counter
Definition: LArRTMParamExtractor.h:131
LArRTMParamExtractor::m_testmode
bool m_testmode
Definition: LArRTMParamExtractor.h:65
LArWFParams.h
LArWFParamTool.h
LArRTMParamExtractor::~LArRTMParamExtractor
~LArRTMParamExtractor()
LArRTMParamExtractor::helperParams::helperParams
helperParams(const LArCaliWave *cw, const HWIdentifier id, const unsigned g)
Definition: LArRTMParamExtractor.h:102
LArRTMParamExtractor::m_suffixRetrievedDetCell
std::string m_suffixRetrievedDetCell
Definition: LArRTMParamExtractor.h:76
LArRTMParamExtractor::Looper::Looper
Looper(std::vector< helperParams > *p, const LArOnOffIdMapping *cabling, const LArWFParamTool *t, MsgStream &ms, std::atomic< unsigned > &cnt)
Definition: LArRTMParamExtractor.h:119
LArRTMParamExtractor::m_groupingType
std::string m_groupingType
Definition: LArRTMParamExtractor.h:83
checker_macros.h
Define macros for attributes used to control the static checker.
LArRTMParamExtractor::m_Calibselection
bool m_Calibselection
Definition: LArRTMParamExtractor.h:91
LArOnOffIdMapping
Definition: LArOnOffIdMapping.h:20