ATLAS Offline Software
Loading...
Searching...
No Matches
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
14#include <string>
15#include "TF1.h"
16
17class AFP_Raw2DigiTool : public extends<AthAlgTool, IAFP_Raw2DigiTool>
18{
19public:
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
44protected:
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
79private:
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_RawCollection< AFP_SiRawData > AFP_SiRawCollection
Class representing collection of silicon detector data.
AFP_RawCollection< AFP_ToFRawData > AFP_ToFRawCollection
AFP_ToFRawData_v2 AFP_ToFRawData
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
Header file for interface IAFP_Raw2DigiTool.
AFP_Raw2DigiTool(const std::string &type, const std::string &name, const IInterface *parent)
SG::WriteHandleKey< xAOD::AFPToFHitContainer > m_AFPHitsContainerNameToF
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.
virtual StatusCode finalize() override
Does nothing.
Gaudi::Property< std::string > m_totToChargeTransfName
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.
virtual ~AFP_Raw2DigiTool() override
Does nothing.
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.
static constexpr double s_pulseLengthFactor
Factor converting pulse length to time.
StatusCode recoToFHits(const EventContext &ctx) const override
Creates xAOD for time-of-flight detector.
static constexpr double s_timeConversionFactor
Factor converting signal to time.
Gaudi::Property< std::string > m_totToChargeTransfExpr
Function that transforms time-over-threshold to charge.
SG::ReadHandleKey< AFP_RawContainer > m_rawDataContainerName
SG::WriteHandleKey< xAOD::AFPSiHitContainer > m_AFPSiHitsContainerName
void setBarAndTrainID(xAOD::AFPToFHit *tofHit, const EventContext &ctx) const
Method mapping hptdcID and hptdcChannel to train ID and bar in train ID.
virtual StatusCode initialize() override
Does nothing.
const int m_channel2train[3][2][12]
const int m_channel2bar[3][2][12]
StatusCode recoAll(const EventContext &ctx) const override
StatusCode recoSiHits(const EventContext &ctx) const override
Creates xAOD for silicon detector.
Class representing data record for silicon detectors.
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
AFPSiHitContainer_v2 AFPSiHitContainer
AFPToFHitContainer_v1 AFPToFHitContainer
AFPToFHit_v1 AFPToFHit
Definition AFPToFHit.h:12