ATLAS Offline Software
Loading...
Searching...
No Matches
LArG4SimpleSD.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef LARG4CODE_LARG4SIMPLESD_H
6#define LARG4CODE_LARG4SIMPLESD_H
7
8#include "G4VSensitiveDetector.hh"
9
11
12#include "LArSimEvent/LArHit.h"
13#include "CLHEP/Units/SystemOfUnits.h"
14#include <gtest/gtest_prod.h>
15
16// Forward declarations
17class LArEM_ID;
18class LArFCAL_ID;
19class LArHEC_ID;
20
23class G4HCofThisEvent;
24
25class StoreGateSvc;
26
27
37class LArG4SimpleSD : public G4VSensitiveDetector
38{
39FRIEND_TEST( LArG4SimpleSDtest, ProcessHits );
40FRIEND_TEST( LArG4SimpleSDtest, setupHelpers );
41FRIEND_TEST( LArG4SimpleSDtest, getTimeBin );
42FRIEND_TEST( LArG4SimpleSDtest, SimpleHit );
43FRIEND_TEST( LArG4SimpleSDtest, ConvertID );
44public:
45
51
53 LArG4SimpleSD(G4String a_name, ILArCalculatorSvc* calc,
54 std::string hitCollectionName,
55 const std::string& type="Default",
56 const float width=2.5*CLHEP::ns);
57
59 LArG4SimpleSD(G4String a_name, StoreGateSvc* detStore,
60 std::string hitCollectionName);
61
63 virtual ~LArG4SimpleSD();
64
66 void Initialize(G4HCofThisEvent*) override;
67
69 G4bool ProcessHits(G4Step* a_step, G4TouchableHistory*) override;
70
72 G4bool SimpleHit( const LArG4Identifier& lar_id , G4double time , G4double energy );
73
75 void setupHelpers( const LArEM_ID* EM ,
76 const LArFCAL_ID* FCAL ,
77 const LArHEC_ID* HEC ) {
78 m_larEmID = EM;
79 m_larFcalID = FCAL;
80 m_larHecID = HEC;
81 }
82
84 Identifier ConvertID(const LArG4Identifier& a_ident) const;
85
86protected:
88 G4int getTimeBin(G4double time) const;
89
92
95
96 // Two types of LAr hit time binning
97 // 1. 'Default'
98 //
99 // All negative times to the bin 0
100 // 0 <= time < 10 by 2.5ns
101 // 10 <= time < 50 by 10ns
102 // 50 <= time < 100 by 25ns
103 // All others to the bin 14
104 //
105 //
106 // 2. 'Uniform'
107 //
108 // Old style time binning by 2.5ns
110
113
118
120
121private:
123 std::string m_hitSourceName;
124
125};
126
127#endif
const double width
Helper class for LArEM offline identifiers.
Definition LArEM_ID.h:111
Helper class for LArFCAL offline identifiers.
Definition LArFCAL_ID.h:49
FRIEND_TEST(LArG4SimpleSDtest, ConvertID)
FRIEND_TEST(LArG4SimpleSDtest, SimpleHit)
std::string m_hitCollectionName
const LArHEC_ID * m_larHecID
LArG4SimpleSD::LArHitTimeBins m_timeBinType
const LArFCAL_ID * m_larFcalID
G4int m_numberInvalidHits
Count the number of invalid hits.
G4bool ProcessHits(G4Step *a_step, G4TouchableHistory *) override
Main processing method.
void setupHelpers(const LArEM_ID *EM, const LArFCAL_ID *FCAL, const LArHEC_ID *HEC)
Sets the ID helper pointers.
Identifier ConvertID(const LArG4Identifier &a_ident) const
Helper function for making "real" identifiers from LArG4Identifiers.
const LArEM_ID * m_larEmID
Pointers to the identifier helpers.
G4float m_timeBinWidth
Width of the time bins for summing hits - for the uniform binning.
LArHitContainerBuilder * getHitContainer() const
LArG4SimpleSD(G4String a_name, StoreGateSvc *detStore, std::string hitCollectionName)
Alternative constructor, particularly for fast simulations.
virtual ~LArG4SimpleSD()
Destructor.
FRIEND_TEST(LArG4SimpleSDtest, getTimeBin)
std::string m_hitSourceName
ILArCalculatorSvc * m_calculator
Member variable - the calculator we'll use.
LArG4SimpleSD(G4String a_name, ILArCalculatorSvc *calc, std::string hitCollectionName, const std::string &type="Default", const float width=2.5 *CLHEP::ns)
Constructor.
G4int getTimeBin(G4double time) const
Helper method for time info.
FRIEND_TEST(LArG4SimpleSDtest, setupHelpers)
void Initialize(G4HCofThisEvent *) override
Register this regular SD with the event-owned builder.
FRIEND_TEST(LArG4SimpleSDtest, ProcessHits)
G4bool SimpleHit(const LArG4Identifier &lar_id, G4double time, G4double energy)
First method translates to this - also for fast sims.
Helper class for LArHEC offline identifiers.
Definition LArHEC_ID.h:76
Event-owned builder for standard LAr hits.
The Athena Transient Store API.