ATLAS Offline Software
AFP_Raw2DigiTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef AFP_RAW2DIGITOOL_H
6 #define AFP_RAW2DIGITOOL_H
7 
11 #include "xAODForward/AFPToFHit.h"
14 #include <string>
15 #include "TF1.h"
16 
17 class AFP_Raw2DigiTool : public extends<AthAlgTool, IAFP_Raw2DigiTool>
18 {
19 public:
20  AFP_Raw2DigiTool(const std::string &type, const std::string &name, const IInterface *parent);
21 
23  virtual ~AFP_Raw2DigiTool() override;
24 
26  virtual StatusCode initialize() override;
27 
29  StatusCode recoSiHits(const EventContext &ctx) const override;
30 
32  StatusCode recoToFHits(const EventContext &ctx) const override;
33 
34  StatusCode recoAll(const EventContext &ctx) const override;
35 
36 
38  virtual StatusCode finalize() override;
39 
42  unsigned int decodeTimeOverThresholdSi (const unsigned int input, const unsigned int discConfig) const;
43 
44 protected:
45  SG::ReadHandleKey<AFP_RawContainer> m_rawDataContainerName{this, "rawDataContainerName", "AFP_RawData"};
46  SG::WriteHandleKey<xAOD::AFPSiHitContainer> m_AFPSiHitsContainerName{this, "AFPSiHitsContainerName", "AFPSiHitContainer"};
47  SG::WriteHandleKey<xAOD::AFPToFHitContainer> m_AFPHitsContainerNameToF{this, "AFPHitsContainerNameToF", "AFPToFHitContainer"};
48 
52  static constexpr double s_timeConversionFactor = 25./1024.;
53 
57  static constexpr double s_pulseLengthFactor = 0.521;
58 
62  Gaudi::Property<std::string> m_totToChargeTransfExpr{this, "TotToChargeTransfExpr", "1909 + x*363 + x*x*141", "Function that transforms time-over-threshold to charge"};
63  Gaudi::Property<std::string> m_totToChargeTransfName{this, "TotToChargeTransfName", "TotToChargeTransfFunction", "Name of the function that transforms time-over-threshold to charge"};
65 
67  void newXAODHitToF (xAOD::AFPToFHitContainer* tofHitContainer, const AFP_ToFRawCollection& collection, const AFP_ToFRawData& data, const EventContext& ctx) const;
68 
70  void newXAODHitSi (xAOD::AFPSiHitContainer* xAODSiHit, const AFP_SiRawCollection& collection, const AFP_SiRawData& data) const;
71 
77  void setBarAndTrainID(xAOD::AFPToFHit* tofHit, const EventContext& ctx) const;
78 
79 private:
80 
81  // TODO: this should go to the database at some moment
82  // @brief mapping of channels to trainID and barID
83  //
84  // indices are: runID (Run2, Run3 till 12 Oct 2002, Run3 since 12 Oct 2022); hptdcID (1,2); channel (0...11)
85  // channels 1,4,7,10 shouldn't exist; Run2 data has channels 1 and 4 as well, this is a known problem
86  const int m_channel2train[3][2][12]={{{0,-2,1,0,-2,1, 0,-1,1,0,-1,1}, {2,-2,3,2,-2,3, 2,-1,3,2,-1,3}},
87  {{1,-1,0,1,-1,0, 1,-1,0,1,-1,0}, {3,-1,2,3,-1,2, 3,-1,2,3,-1,2}},
88  {{1,-1,3,1,-1,3, 1,-1,3,1,-1,3}, {0,-1,2,0,-1,2, 0,-1,2,0,-1,2}}};
89  const int m_channel2bar[3][2][12] = {{{0,-2,2,3,-2,1, 2,-1,0,1,-1,3}, {0,-2,2,3,-2,1, 2,-1,0,1,-1,3}},
90  {{0,-1,2,3,-1,1, 2,-1,0,1,-1,3}, {0,-1,2,3,-1,1, 2,-1,0,1,-1,3}},
91  {{0,-1,2,3,-1,1, 2,-1,0,1,-1,3}, {0,-1,2,3,-1,1, 2,-1,0,1,-1,3}}};
92 };
93 #endif
AFP_Raw2DigiTool::recoAll
StatusCode recoAll(const EventContext &ctx) const override
Definition: AFP_Raw2DigiTool.cxx:42
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
IAFP_Raw2DigiTool.h
Header file for interface IAFP_Raw2DigiTool
AFP_Raw2DigiTool::decodeTimeOverThresholdSi
unsigned int decodeTimeOverThresholdSi(const unsigned int input, const unsigned int discConfig) const
Method that decodes raw information about time-over-threshold to number of clock ticks.
Definition: AFP_Raw2DigiTool.cxx:231
AFP_Raw2DigiTool::finalize
virtual StatusCode finalize() override
Does nothing.
Definition: AFP_Raw2DigiTool.cxx:108
AFP_Raw2DigiTool::AFP_Raw2DigiTool
AFP_Raw2DigiTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: AFP_Raw2DigiTool.cxx:20
AFP_Raw2DigiTool::~AFP_Raw2DigiTool
virtual ~AFP_Raw2DigiTool() override
Does nothing.
Definition: AFP_Raw2DigiTool.cxx:27
AFP_Raw2DigiTool::m_AFPHitsContainerNameToF
SG::WriteHandleKey< xAOD::AFPToFHitContainer > m_AFPHitsContainerNameToF
Definition: AFP_Raw2DigiTool.h:47
AFP_Raw2DigiTool::newXAODHitToF
void newXAODHitToF(xAOD::AFPToFHitContainer *tofHitContainer, const AFP_ToFRawCollection &collection, const AFP_ToFRawData &data, const EventContext &ctx) const
Method that creates a new AFPToFHit and sets it valus according to data.
Definition: AFP_Raw2DigiTool.cxx:116
AFP_Raw2DigiTool::recoToFHits
StatusCode recoToFHits(const EventContext &ctx) const override
Creates xAOD for time-of-flight detector.
Definition: AFP_Raw2DigiTool.cxx:78
AFPToFHit.h
AFP_RawContainer.h
AFP_ToFRawData_v2
Class representing data record for time-of-flight detectors.
Definition: AFP_ToFRawData_v2.h:22
AFP_Raw2DigiTool::setBarAndTrainID
void setBarAndTrainID(xAOD::AFPToFHit *tofHit, const EventContext &ctx) const
Method mapping hptdcID and hptdcChannel to train ID and bar in train ID.
Definition: AFP_Raw2DigiTool.cxx:191
SG::ReadHandleKey< AFP_RawContainer >
AFP_Raw2DigiTool::newXAODHitSi
void newXAODHitSi(xAOD::AFPSiHitContainer *xAODSiHit, const AFP_SiRawCollection &collection, const AFP_SiRawData &data) const
Method that creates a new AFPSiHit and sets it valus according to data.
Definition: AFP_Raw2DigiTool.cxx:147
AFP_Raw2DigiTool::s_timeConversionFactor
static constexpr double s_timeConversionFactor
Factor converting signal to time.
Definition: AFP_Raw2DigiTool.h:52
xAOD::AFPToFHit_v1
Class representing a hit in ToF detector.
Definition: AFPToFHit_v1.h:20
AFP_Raw2DigiTool::initialize
virtual StatusCode initialize() override
Does nothing.
Definition: AFP_Raw2DigiTool.cxx:29
AFP_Raw2DigiTool::m_totToChargeTransfName
Gaudi::Property< std::string > m_totToChargeTransfName
Definition: AFP_Raw2DigiTool.h:63
AFP_Raw2DigiTool::m_AFPSiHitsContainerName
SG::WriteHandleKey< xAOD::AFPSiHitContainer > m_AFPSiHitsContainerName
Definition: AFP_Raw2DigiTool.h:46
AFP_RawCollection
Class representing collection of silicon detector data.
Definition: AFP_RawCollection.h:14
SG::WriteHandleKey
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition: StoreGate/StoreGate/WriteHandleKey.h:40
AFP_Raw2DigiTool::m_rawDataContainerName
SG::ReadHandleKey< AFP_RawContainer > m_rawDataContainerName
Definition: AFP_Raw2DigiTool.h:45
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
AthAlgTool.h
AFP_Raw2DigiTool::m_totToChargeTransfExpr
Gaudi::Property< std::string > m_totToChargeTransfExpr
Function that transforms time-over-threshold to charge.
Definition: AFP_Raw2DigiTool.h:62
test_pyathena.parent
parent
Definition: test_pyathena.py:15
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
AFP_SiRawData
Class representing data record for silicon detectors.
Definition: AFP_SiRawData.h:17
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
AFPSiHitContainer.h
AFP_Raw2DigiTool
Definition: AFP_Raw2DigiTool.h:18
AFP_Raw2DigiTool::m_channel2train
const int m_channel2train[3][2][12]
Definition: AFP_Raw2DigiTool.h:86
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
AFP_Raw2DigiTool::recoSiHits
StatusCode recoSiHits(const EventContext &ctx) const override
Creates xAOD for silicon detector.
Definition: AFP_Raw2DigiTool.cxx:50
AFP_Raw2DigiTool::m_totToChargeTransformation
TF1 m_totToChargeTransformation
Definition: AFP_Raw2DigiTool.h:64
AFP_Raw2DigiTool::m_channel2bar
const int m_channel2bar[3][2][12]
Definition: AFP_Raw2DigiTool.h:89
AFPToFHitContainer.h
AFP_Raw2DigiTool::s_pulseLengthFactor
static constexpr double s_pulseLengthFactor
Factor converting pulse length to time.
Definition: AFP_Raw2DigiTool.h:57