ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
LUCID_HitHelper Class Reference

#include <LUCID_HitHelper.h>

Inheritance diagram for LUCID_HitHelper:
Collaboration diagram for LUCID_HitHelper:

Public Member Functions

 LUCID_HitHelper ()
 
 ~LUCID_HitHelper ()
 
G4ThreeVector GetPreStepPoint (G4Step *aStep) const
 
G4ThreeVector GetPostStepPoint (G4Step *aStep) const
 
float GetPreStepTime (G4Step *aStep) const
 
float GetPostStepTime (G4Step *aStep) const
 
double GetWaveLength (double energy) const
 
double GetEnergy (double lambda) const
 
int GetTubNumber (G4Step *) const
 

Static Public Member Functions

static int GetVolNumber (const G4String &)
 

Private Member Functions

void InitializeField (const std::string &n, int vmn, int vmx)
 
void InitializeField (const std::string &n, int nb)
 
void SetFieldValue (const std::string &name, int n, HitID &targetID) const
 
int GetFieldValue (const std::string &name, HitID targetID) const
 
void PrintFields ()
 

Static Private Member Functions

static void Print (int id)
 
static void SetBit (int &i, int bitpos)
 
static void UnsetBit (int &i, int bitpos)
 
static void Store (int &id, int value, int first, int field)
 
static int Retrieve (int id, int first, int field)
 

Private Attributes

IdFields m_IDs
 
int m_currentStorage
 

Detailed Description

Definition at line 24 of file LUCID_HitHelper.h.

Constructor & Destructor Documentation

◆ LUCID_HitHelper()

LUCID_HitHelper::LUCID_HitHelper ( )
inline

Definition at line 28 of file LUCID_HitHelper.h.

28 {}

◆ ~LUCID_HitHelper()

LUCID_HitHelper::~LUCID_HitHelper ( )
inline

Definition at line 29 of file LUCID_HitHelper.h.

29 {}

Member Function Documentation

◆ GetEnergy()

double LUCID_HitHelper::GetEnergy ( double  lambda) const
inline

Definition at line 37 of file LUCID_HitHelper.h.

37 { return 2.*M_PI*CLHEP::hbarc/(CLHEP::eV*CLHEP::nm)/lambda; }

◆ GetFieldValue()

int HitIdHelper::GetFieldValue ( const std::string &  name,
HitID  targetID 
) const
inherited

Definition at line 48 of file HitIdHelper.cxx.

49 {
50  for (unsigned int i=0;i<m_IDs.size();i++)
51  {
52  if (m_IDs[i].fieldName==name)
53  {
54  int n=Retrieve(targetID,m_IDs[i].firstBit,m_IDs[i].nBits);
55  return n+m_IDs[i].vMin;
56  }
57  }
58  std::cout<<"HitIdHelper: field "<<name<<" not found: returning 0"<<
59  std::endl;
60  return 0;
61 }

◆ GetPostStepPoint()

G4ThreeVector LUCID_HitHelper::GetPostStepPoint ( G4Step *  aStep) const
inline

Definition at line 32 of file LUCID_HitHelper.h.

32 { return aStep->GetPostStepPoint()->GetPosition(); }

◆ GetPostStepTime()

float LUCID_HitHelper::GetPostStepTime ( G4Step *  aStep) const
inline

Definition at line 34 of file LUCID_HitHelper.h.

34 { return aStep->GetPostStepPoint()->GetGlobalTime(); }

◆ GetPreStepPoint()

G4ThreeVector LUCID_HitHelper::GetPreStepPoint ( G4Step *  aStep) const
inline

Definition at line 31 of file LUCID_HitHelper.h.

31 { return aStep->GetPreStepPoint()->GetPosition(); }

◆ GetPreStepTime()

float LUCID_HitHelper::GetPreStepTime ( G4Step *  aStep) const
inline

Definition at line 33 of file LUCID_HitHelper.h.

33 { return aStep->GetPreStepPoint()->GetGlobalTime(); }

◆ GetTubNumber()

int LUCID_HitHelper::GetTubNumber ( G4Step *  aStep) const

Definition at line 20 of file LUCID_HitHelper.cxx.

20  {
21 
22  G4String volName = aStep->GetTrack()->GetVolume()->GetName();
23 
24  int tubNumber = 100;
25 
26  if (!strcmp(volName.substr(5, 9).c_str(), "VesselGas")) tubNumber = -1;
27  else if (!strcmp(volName.substr(5, 7).c_str(), "TubeGas" )) tubNumber = atoi(volName.substr(12, 2).c_str());
28  else if (!strcmp(volName.substr(5, 3).c_str(), "Pmt" )) tubNumber = atoi(volName.substr( 8, 2).c_str());
29 
30  if (GetPreStepPoint(aStep).z() < 0) tubNumber += 20;
31 
32  return tubNumber;
33 }

◆ GetVolNumber()

int LUCID_HitHelper::GetVolNumber ( const G4String &  volName)
static

Definition at line 9 of file LUCID_HitHelper.cxx.

9  {
10 
11  int volNumber = 100;
12 
13  if (!strcmp(volName.substr(9, 9).c_str(), "VesselGas")) volNumber = GASVES;
14  else if (!strcmp(volName.substr(9, 7).c_str(), "TubeGas" )) volNumber = GASTUB;
15  else if (!strcmp(volName.substr(9, 3).c_str(), "Pmt" )) volNumber = QUARTZ;
16 
17  return volNumber;
18 }

◆ GetWaveLength()

double LUCID_HitHelper::GetWaveLength ( double  energy) const
inline

Definition at line 36 of file LUCID_HitHelper.h.

◆ InitializeField() [1/2]

void HitIdHelper::InitializeField ( const std::string &  n,
int  nb 
)
inherited

Definition at line 21 of file HitIdHelper.cxx.

22 {
23  int vmn=0;
24  int vmx=int(pow(2,nb))-1;
25  IdField id={n,vmn,vmx,nb,m_currentStorage+1};
26  m_IDs.push_back(id);
28  assert (m_currentStorage<33);
29 }

◆ InitializeField() [2/2]

void HitIdHelper::InitializeField ( const std::string &  n,
int  vmn,
int  vmx 
)
inherited

Definition at line 10 of file HitIdHelper.cxx.

11 {
12  int field = vmx -vmn+1;
13  int nb=1;
14  while (field>pow(2,nb)) nb++;
15  IdField id={n,vmn,vmx,nb,m_currentStorage+1};
16  m_IDs.push_back(id);
18  assert (m_currentStorage<33);
19 }

◆ Print()

void HitIdHelper::Print ( int  id)
staticinherited

Definition at line 73 of file HitIdHelper.cxx.

74 {
75  for (unsigned int i=0;i<8*sizeof(int);i++)
76  {
77  if ((id & (1u<<i))) std::cout<<"1";
78  else std::cout<<"0";
79  }
80  std::cout<<std::endl;
81 }

◆ PrintFields()

void HitIdHelper::PrintFields ( )
inherited

Definition at line 63 of file HitIdHelper.cxx.

64 {
65  for (unsigned int i=0;i<m_IDs.size();i++)
66  {
67  std::cout<<"-- Field "<<m_IDs[i].fieldName<<"\t["<<m_IDs[i].vMin
68  <<","<<m_IDs[i].vMax<<"]\tnBits "<<m_IDs[i].nBits
69  <<"\tfirst Bit "<<m_IDs[i].firstBit<<std::endl;
70  }
71 }

◆ Retrieve()

int HitIdHelper::Retrieve ( int  id,
int  first,
int  field 
)
staticprotectedinherited

Definition at line 106 of file HitIdHelper.cxx.

107 {
108  int j=0;
109  for (int i=0;i<field;i++)
110  SetBit(j,(i+first));
111  int l=id&j;
112  return l>>(first-1);
113 }

◆ SetBit()

void HitIdHelper::SetBit ( int &  i,
int  bitpos 
)
staticprotectedinherited

Definition at line 83 of file HitIdHelper.cxx.

84 {
85  int l=1;
86  l<<=(bitpos-1);
87  i|=l;
88 }

◆ SetFieldValue()

void HitIdHelper::SetFieldValue ( const std::string &  name,
int  n,
HitID targetID 
) const
inherited

Definition at line 31 of file HitIdHelper.cxx.

32 {
33  for (unsigned int i=0;i<m_IDs.size();i++)
34  {
35  if (m_IDs[i].fieldName==name)
36  {
37  if (n<m_IDs[i].vMin || n>m_IDs[i].vMax)
38  std::cout<<"HitIdHelper: field "<<name<<": supplied value "<<n<<
39  " is not within the allowed range ["<<m_IDs[i].vMin<<","<<m_IDs[i].vMax
40  <<"] : the result of this action is unpredictable "<<std::endl;
41  n-=m_IDs[i].vMin;
42  Store(targetID,n,m_IDs[i].firstBit,m_IDs[i].nBits);
43  break;
44  }
45  }
46 }

◆ Store()

void HitIdHelper::Store ( int &  id,
int  value,
int  first,
int  field 
)
staticprotectedinherited

Definition at line 97 of file HitIdHelper.cxx.

98 {
99  int l=0;
100  for (int i=0;i<field;i++)
101  UnsetBit(id,i+firstbit);
102  l=value<<(firstbit-1);
103  id |= l;
104 }

◆ UnsetBit()

void HitIdHelper::UnsetBit ( int &  i,
int  bitpos 
)
staticprotectedinherited

Definition at line 89 of file HitIdHelper.cxx.

90 {
91  int l=0;
92  SetBit(l,bitpos);
93  int k=~l;
94  i&=k;
95 }

Member Data Documentation

◆ m_currentStorage

int HitIdHelper::m_currentStorage
protectedinherited

Definition at line 35 of file HitIdHelper.h.

◆ m_IDs

IdFields HitIdHelper::m_IDs
protectedinherited

Definition at line 34 of file HitIdHelper.h.


The documentation for this class was generated from the following files:
HitIdHelper::m_IDs
IdFields m_IDs
Definition: HitIdHelper.h:34
IdField
Definition: HitIdHelper.h:13
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
M_PI
#define M_PI
Definition: ActiveFraction.h:11
athena.value
value
Definition: athena.py:124
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
HitIdHelper::SetBit
static void SetBit(int &i, int bitpos)
Definition: HitIdHelper.cxx:83
ReadOfcFromCool.field
field
Definition: ReadOfcFromCool.py:48
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
LUCID_HitHelper::GetPreStepPoint
G4ThreeVector GetPreStepPoint(G4Step *aStep) const
Definition: LUCID_HitHelper.h:31
GASTUB
#define GASTUB
Definition: LUCID_Constants.h:9
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
python.PhysicalConstants.hbarc
float hbarc
Definition: PhysicalConstants.py:73
lumiFormat.i
int i
Definition: lumiFormat.py:85
z
#define z
HitIdHelper::Store
static void Store(int &id, int value, int first, int field)
Definition: HitIdHelper.cxx:97
beamspotman.n
n
Definition: beamspotman.py:731
QUARTZ
#define QUARTZ
Definition: LUCID_Constants.h:10
HitIdHelper::UnsetBit
static void UnsetBit(int &i, int bitpos)
Definition: HitIdHelper.cxx:89
HitIdHelper::Retrieve
static int Retrieve(int id, int first, int field)
Definition: HitIdHelper.cxx:106
taskman.fieldName
fieldName
Definition: taskman.py:492
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
python.SystemOfUnits.eV
int eV
Definition: SystemOfUnits.py:155
GASVES
#define GASVES
Definition: LUCID_Constants.h:8
CalibCoolCompareRT.nm
nm
Definition: CalibCoolCompareRT.py:110
DeMoScan.first
bool first
Definition: DeMoScan.py:536
CxxUtils::atoi
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
Definition: Control/CxxUtils/Root/StringUtils.cxx:85
HitIdHelper::m_currentStorage
int m_currentStorage
Definition: HitIdHelper.h:35
hotSpotInTAG.nb
nb
Definition: hotSpotInTAG.py:164
pow
constexpr int pow(int base, int exp) noexcept
Definition: ap_fixedTest.cxx:15
fitman.k
k
Definition: fitman.py:528