ATLAS Offline Software
TileRawChannelBuilder.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TILERECUTILS_ITILERAWCHANNELBUILDER_H
6 #define TILERECUTILS_ITILERAWCHANNELBUILDER_H
7 
8 /********************************************************************
9  *
10  * NAME: TileRawChanelBuilder
11  * PACKAGE: offline/TileCalorimeter/TileRecUtils
12  *
13  * AUTHOR : K. Gellerstedt
14  * CREATED: Nov 17 2003
15  *
16  * PURPOSE: Interface for builder algorithms
17  *
18  * Input: TileDigitsContainer
19  * Output: Container with TileRawChannels
20  * Parameters:
21  * TileRawChannelContainer - Name of output container
22  *
23  ********************************************************************/
24 
25 // Tile includes
31 #include "TileEvent/TileDQstatus.h"
37 
38 // Atlas includes
40 
41 //Gaudi includes
42 #include "GaudiKernel/ToolHandle.h"
43 #include "GaudiKernel/ServiceHandle.h"
45 
46 #include <utility>
47 #include <vector>
48 #include <memory>
49 
50 class TileDigits;
51 class TileRawChannel;
52 class TileID;
53 class TileHWID;
54 class TileInfo;
55 class StoreGateSvc;
56 
57 typedef std::vector<std::pair<TileRawChannel*, const TileDigits*> > Overflows_t;
58 
60  public:
61  TileRawChannelBuilder(const std::string& type, const std::string& name,
62  const IInterface* parent);
63 
64  virtual ~TileRawChannelBuilder();
65 
66  // Algorithm tool virtual methods
67  virtual StatusCode initialize();
68  //virtual StatusCode execute();
69  virtual StatusCode finalize();
70 
75  virtual StatusCode createContainer(const EventContext& ctx);
76 
82  virtual TileRawChannel* rawChannel(const TileDigits* digits, const EventContext& ctx);
83 
87  virtual StatusCode commitContainer(const EventContext& ctx);
88 
89  void initLog(const EventContext& ctx);
90  void endLog();
91 
92  // process all digits from one collection and store results in internal container
93  StatusCode build (const TileDigitsCollection* collection, const EventContext& ctx);
94 
98  static const InterfaceID& interfaceID();
99 
100  static double correctAmp(double phase, bool of2 = true);
101 
102  static double correctTime( double phase, bool of2 = true);
103 
104  static int CorruptedData(int ros, int drawer, int channel, int gain,
105  const std::vector<float> & digits, float &dmin, float &dmax, float ADCmaxMinusEps, float ADCmaskValueMinusEps);
106 
107  static const char* BadPatternName(float ped);
108 
109  void resetDrawer();
110  void resetOverflows(void);
112  std::string getTileRawChannelContainerID(void);
113 
114  protected:
115  // FIXME: Get rid of this abomination.
116  friend class TileHid2RESrcID;
117 
118  // properties
119  // DQ status.
121  "TileDQstatus",
122  "TileDQstatus key"};
123 
124  // DSP container. Only used of m_useDSP is set.
126  {this, "DSPContainer", "", "DSP Container key"};
127 
128  // name of TDS container with output TileRawChannels
129  SG::WriteHandleKey<TileRawChannelContainer> m_rawChannelContainerKey{this,"TileRawChannelContainer","TileRawChannelFiltered",
130  "Output Tile raw channels container key"};
131 
132  // RawChannelContainer
133  std::unique_ptr<TileMutableRawChannelContainer> m_rawChannelCnt;
134 
135  // parameters for RawChannelContainer
138  unsigned int m_bsflags;
139  // parameter to determine which sample to start with the analysis
141  // Should energy be calibrated
143 
144  // Should time be calibrated (delta added from laser run)
146 
147 
148  // Use DSP noise correction for incomplete containers
149  bool m_useDSP;
150 
151  // thresholds for parabolic amplitude correction (used in optimal filter without iterations)
155 
156  // runType used to override value of trigType in event
158 
159  // Tile objects
160  const TileID* m_tileID;
162 
163  ToolHandleArray<ITileRawChannelTool> m_noiseFilterTools{this,
164  "NoiseFilterTools", {}, "Tile noise filter tools"};
165 
166  ToolHandle<TileCondToolEmscale> m_tileToolEmscale{this,
167  "TileCondToolEmscale", "TileCondToolEmscale", "Tile EM scale calibration tool"};
168 
169  ToolHandle<TileCondToolTiming> m_tileToolTiming{this,
170  "TileCondToolTiming", "TileCondToolTiming", "Tile timing tool"};
171 
172  ToolHandle<TileCondIdTransforms> m_tileIdTransforms{this,
173  "TileCondIdTransforms", "TileCondIdTransforms",
174  "Tile tool to tranlate hardware identifier to the drawerIdx, channel, and adc"};
175 
180  "TileCablingSvc", "TileCablingSvc", "The Tile cabling service"};
181 
183 
184  Gaudi::Property<std::vector<int>> m_demoFragIDs{this,
185  "DemoFragIDs", {}, "List of Tile frag IDs with new electronics (demonstrator)"};
186 
188  bool m_idophys; // Phys fitting
189  bool m_idolas; // Laser fitting
190  bool m_idoped; // Ped run, phys fitting
191  bool m_idocis; // CIS fitting
192  int m_cischan; // which channel is fired by CIS
193  double m_capdaq; // Capacitor
194 
195  unsigned int m_evtCounter;
196  unsigned int m_chCounter;
197 
198  int m_nChL;
199  int m_nChH;
200  double m_RChSumL;
201  double m_RChSumH;
202 
205 
206  static const int MAX_CHANNELS = 48;
207  static const int MAX_DMUS = 16;
209  int m_lastDrawer = -1;
210  bool m_badDrawer = false;
211 
213 
214  // TileInfo
215  std::string m_infoName;
218  float m_f_ADCmax;
223 
224 private:
225  // find all bad patterns in a drawer and fill internal static arrays
226  void fill_drawer_errors(const EventContext& ctx,
227  const TileDigitsCollection* collection);
228 
229 };
230 
231 #endif
TileRawChannelBuilder::CorruptedData
static int CorruptedData(int ros, int drawer, int channel, int gain, const std::vector< float > &digits, float &dmin, float &dmax, float ADCmaxMinusEps, float ADCmaskValueMinusEps)
Definition: TileRawChannelBuilder.cxx:723
TileRawChannelBuilder::m_i_ADCmax
int m_i_ADCmax
Definition: TileRawChannelBuilder.h:217
TileCablingSvc.h
ReadOfcFromCool.phase
phase
Definition: ReadOfcFromCool.py:127
TileRawChannelBuilder::resetDrawer
void resetDrawer()
Definition: TileRawChannelBuilder.cxx:29
TileRawChannelBuilder::m_dataPoollSize
int m_dataPoollSize
Definition: TileRawChannelBuilder.h:204
TileDigitsCollection.h
TileRawChannelBuilder::TileRawChannelBuilder
TileRawChannelBuilder(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.
Definition: TileRawChannelBuilder.cxx:49
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:24
TileRawChannelBuilder::m_noiseFilterTools
ToolHandleArray< ITileRawChannelTool > m_noiseFilterTools
Definition: TileRawChannelBuilder.h:163
TileRawChannelBuilder::m_tileToolEmscale
ToolHandle< TileCondToolEmscale > m_tileToolEmscale
Definition: TileRawChannelBuilder.h:166
TileRawChannelBuilder::m_chCounter
unsigned int m_chCounter
Definition: TileRawChannelBuilder.h:196
TileRawChannelBuilder::m_ampMinThresh
float m_ampMinThresh
correct amplitude if it's above amplitude threshold (in ADC counts)
Definition: TileRawChannelBuilder.h:152
TileRawChannelBuilder::m_calibrateEnergy
bool m_calibrateEnergy
Definition: TileRawChannelBuilder.h:142
TileRawChannelBuilder::m_cabling
const TileCablingService * m_cabling
TileCabling instance.
Definition: TileRawChannelBuilder.h:182
ITileRawChannelTool.h
TileRawChannelBuilder::finalize
virtual StatusCode finalize()
Definition: TileRawChannelBuilder.cxx:228
TileRawChannelBuilder::m_tileHWID
const TileHWID * m_tileHWID
Definition: TileRawChannelBuilder.h:161
TileFragHash::TYPE
TYPE
initialize
Definition: TileFragHash.h:33
CaloCondBlobAlgs_fillNoiseFromASCII.gain
gain
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:110
TileRawChannelBuilder::m_rawChannelCnt
std::unique_ptr< TileMutableRawChannelContainer > m_rawChannelCnt
Definition: TileRawChannelBuilder.h:133
TileRawChannelBuilder::m_f_ADCmaxPlus1
float m_f_ADCmaxPlus1
Definition: TileRawChannelBuilder.h:220
TileRawChannelBuilder::m_useDSP
bool m_useDSP
Definition: TileRawChannelBuilder.h:149
TileRawChannelBuilder::initialize
virtual StatusCode initialize()
Initializer.
Definition: TileRawChannelBuilder.cxx:98
TileFragHash.h
TileRawChannelBuilder::m_runType
int m_runType
Definition: TileRawChannelBuilder.h:157
TileRawChannelBuilder::m_cablingSvc
ServiceHandle< TileCablingSvc > m_cablingSvc
Name of Tile cabling service.
Definition: TileRawChannelBuilder.h:179
TileRawChannelBuilder::m_notUpgradeCabling
bool m_notUpgradeCabling
Definition: TileRawChannelBuilder.h:212
TileRawChannelBuilder::m_ADCmaxMinusEps
float m_ADCmaxMinusEps
Definition: TileRawChannelBuilder.h:221
TileInfo
Definition: TileInfo.h:49
SG::ReadHandleKey< TileDQstatus >
TileRawChannelBuilder::interfaceID
static const InterfaceID & interfaceID()
AlgTool InterfaceID.
Definition: TileRawChannelBuilder.cxx:24
TileCondToolTiming.h
TileRawChannelBuilder::m_demoFragIDs
Gaudi::Property< std::vector< int > > m_demoFragIDs
Definition: TileRawChannelBuilder.h:184
TileRawChannelBuilder::~TileRawChannelBuilder
virtual ~TileRawChannelBuilder()
Destructor.
Definition: TileRawChannelBuilder.cxx:92
TileRawChannelBuilder::m_tileToolTiming
ToolHandle< TileCondToolTiming > m_tileToolTiming
Definition: TileRawChannelBuilder.h:169
Example_ReadSampleNoise.drawer
drawer
Definition: Example_ReadSampleNoise.py:39
TileRawChannelBuilder::m_ADCmaskValueMinusEps
float m_ADCmaskValueMinusEps
indicates channels which were masked in background dataset
Definition: TileRawChannelBuilder.h:222
TileRawChannelBuilder::m_cischan
int m_cischan
Definition: TileRawChannelBuilder.h:192
TileRawChannelBuilder::m_DSPContainerKey
SG::ReadHandleKey< TileRawChannelContainer > m_DSPContainerKey
Definition: TileRawChannelBuilder.h:126
Overflows_t
std::vector< std::pair< TileRawChannel *, const TileDigits * > > Overflows_t
Definition: TileRawChannelBuilder.h:55
TileHid2RESrcID
This class provides conversion between fragment ID and RESrcID.
Definition: TileHid2RESrcID.h:28
TileRawChannelContainer.h
TileHWID
Helper class for TileCal online (hardware) identifiers.
Definition: TileHWID.h:49
TileRawChannelBuilder::m_rChType
TileFragHash::TYPE m_rChType
Definition: TileRawChannelBuilder.h:136
TileRawChannelBuilder::m_lastDrawer
int m_lastDrawer
Definition: TileRawChannelBuilder.h:209
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:125
TileRawChannelBuilder::m_nChL
int m_nChL
Definition: TileRawChannelBuilder.h:198
TileRawChannelBuilder::m_overflows
Overflows_t m_overflows
Definition: TileRawChannelBuilder.h:203
SG::WriteHandleKey< TileRawChannelContainer >
TileCondToolEmscale.h
TileRawChannelBuilder::m_bsflags
unsigned int m_bsflags
Definition: TileRawChannelBuilder.h:138
TileID
Helper class for TileCal offline identifiers.
Definition: TileID.h:68
TileRawChannelBuilder::m_capdaq
double m_capdaq
Definition: TileRawChannelBuilder.h:193
TileRawChannelBuilder::m_rawChannelContainerKey
SG::WriteHandleKey< TileRawChannelContainer > m_rawChannelContainerKey
Definition: TileRawChannelBuilder.h:129
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TileRawChannelBuilder::build
StatusCode build(const TileDigitsCollection *collection, const EventContext &ctx)
Definition: TileRawChannelBuilder.cxx:492
TileRawChannelBuilder::m_tileIdTransforms
ToolHandle< TileCondIdTransforms > m_tileIdTransforms
Definition: TileRawChannelBuilder.h:172
TileRawChannelBuilder::m_nChH
int m_nChH
Definition: TileRawChannelBuilder.h:199
AthAlgTool.h
TileRawChannel
Definition: TileRawChannel.h:35
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TileRawChannelBuilder::m_idophys
bool m_idophys
Definition: TileRawChannelBuilder.h:188
TileRawChannelBuilder::m_RChSumL
double m_RChSumL
Definition: TileRawChannelBuilder.h:200
TileRawChannelBuilder::m_rChUnit
TileRawChannelUnit::UNIT m_rChUnit
Definition: TileRawChannelBuilder.h:137
TileRawChannelBuilder::fill_drawer_errors
void fill_drawer_errors(const EventContext &ctx, const TileDigitsCollection *collection)
Definition: TileRawChannelBuilder.cxx:300
TileRawChannelBuilder
Definition: TileRawChannelBuilder.h:59
maskDeadModules.ros
ros
Definition: maskDeadModules.py:35
TileCablingService
Definition: TileCablingService.h:23
TileDQstatus.h
Information produced by TileDQstatusAlg (used to be done by TileBeamInfoProvider).
TileRawChannelUnit::UNIT
UNIT
Definition: TileRawChannelUnit.h:16
TileRawChannelBuilder::MAX_CHANNELS
static const int MAX_CHANNELS
Definition: TileRawChannelBuilder.h:206
TileRawChannelBuilder::createContainer
virtual StatusCode createContainer(const EventContext &ctx)
Create container in SG with name given by parameter (m_rawChannelContainerKey)
Definition: TileRawChannelBuilder.cxx:233
TileRawChannelBuilder::m_correctTime
bool m_correctTime
Definition: TileRawChannelBuilder.h:145
TileCondIdTransforms.h
TileRawChannelBuilder::m_tileInfo
const TileInfo * m_tileInfo
Definition: TileRawChannelBuilder.h:216
TileRawChannelBuilder::resetOverflows
void resetOverflows(void)
Definition: TileRawChannelBuilder.cxx:34
WriteHandleKey.h
Property holding a SG store/key/clid from which a WriteHandle is made.
TileRawChannelBuilder::m_f_ADCmax
float m_f_ADCmax
Definition: TileRawChannelBuilder.h:218
TileDigitsCollection
Definition: TileDigitsCollection.h:18
TileRawChannelBuilder::correctAmp
static double correctAmp(double phase, bool of2=true)
Amplitude correction factor according to the time when using weights for tau=0 without iterations.
Definition: TileRawChannelBuilder.cxx:646
TileRawChannelBuilder::m_tileID
const TileID * m_tileID
Definition: TileRawChannelBuilder.h:160
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TileDigits
Definition: TileDigits.h:30
TileRawChannelBuilder::m_i_ADCmaxPlus1
int m_i_ADCmaxPlus1
Definition: TileRawChannelBuilder.h:219
TileRawChannelBuilder::m_timeMaxThresh
float m_timeMaxThresh
correct amplitude is time is below time max threshold
Definition: TileRawChannelBuilder.h:154
TileRawChannelBuilder::BadPatternName
static const char * BadPatternName(float ped)
Definition: TileRawChannelBuilder.cxx:458
TileRawChannelBuilder::m_infoName
std::string m_infoName
Definition: TileRawChannelBuilder.h:215
TileRawChannelBuilder::rawChannel
virtual TileRawChannel * rawChannel(const TileDigits *digits, const EventContext &ctx)
Builder virtual method to be implemented by subclasses.
Definition: TileRawChannelBuilder.cxx:291
TileRawChannelUnit.h
Example_ReadSampleNoise.ped
ped
Definition: Example_ReadSampleNoise.py:45
TileRawChannelBuilder::correctTime
static double correctTime(double phase, bool of2=true)
Time correction factor.
Definition: TileRawChannelBuilder.cxx:705
TileMutableRawChannelContainer.h
Helper for holding non-const raw data prior to recording in SG.
TileRawChannelBuilder::m_badDrawer
bool m_badDrawer
Definition: TileRawChannelBuilder.h:210
TileRawChannelBuilder::getTileRawChannelContainerID
std::string getTileRawChannelContainerID(void)
Definition: TileRawChannelBuilder.cxx:42
TileRawChannelBuilder::commitContainer
virtual StatusCode commitContainer(const EventContext &ctx)
Commit RawChannelContiner in SG and make const.
Definition: TileRawChannelBuilder.cxx:544
TileRawChannelBuilder::m_evtCounter
unsigned int m_evtCounter
Definition: TileRawChannelBuilder.h:195
TileRawChannelBuilder::m_DQstatusKey
SG::ReadHandleKey< TileDQstatus > m_DQstatusKey
Definition: TileRawChannelBuilder.h:120
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TileRawChannelBuilder::initLog
void initLog(const EventContext &ctx)
Definition: TileRawChannelBuilder.cxx:246
TileRawChannelBuilder::m_RChSumH
double m_RChSumH
Definition: TileRawChannelBuilder.h:201
TileRawChannelBuilder::MAX_DMUS
static const int MAX_DMUS
Definition: TileRawChannelBuilder.h:207
TileRawChannelBuilder::m_firstSample
int m_firstSample
Definition: TileRawChannelBuilder.h:140
TileRawChannelBuilder::m_idocis
bool m_idocis
Definition: TileRawChannelBuilder.h:191
AthAlgTool
Definition: AthAlgTool.h:26
TileRawChannelBuilder::endLog
void endLog()
Definition: TileRawChannelBuilder.cxx:639
TileRawChannelBuilder::m_trigType
int m_trigType
Definition: TileRawChannelBuilder.h:187
TileRawChannelBuilder::getOverflowedChannels
Overflows_t & getOverflowedChannels(void)
Definition: TileRawChannelBuilder.cxx:38
TileRawChannelBuilder::m_timeMinThresh
float m_timeMinThresh
correct amplitude is time is above time min threshold
Definition: TileRawChannelBuilder.h:153
TileRawChannelBuilder::m_idolas
bool m_idolas
Definition: TileRawChannelBuilder.h:189
TileRawChannelBuilder::m_idoped
bool m_idoped
Definition: TileRawChannelBuilder.h:190
TileRawChannelBuilder::m_error
int m_error[MAX_CHANNELS]
Definition: TileRawChannelBuilder.h:208
ServiceHandle< TileCablingSvc >