ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
ForwardDetectors
ForwardTransportSvc
src
ForwardTransportSvc.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "GaudiKernel/ITHistSvc.h"
6
#include "GaudiKernel/SystemOfUnits.h"
7
#include "GaudiKernel/PhysicalConstants.h"
8
#include "
GeneratorObjects/McEventCollection.h
"
9
10
#include "
ForwardTransportSvc.h
"
11
#include "
ForwardTransportSvc/IForwardTransportSvc.h
"
12
#include "
ForwardTracker/TwissFile.h
"
13
14
#include <fstream>
15
#include "TTree.h"
16
17
ForwardTransportSvc::ForwardTransportSvc
(
const
std::string& name, ISvcLocator* svc) :
18
base_class(name,svc)
19
{
20
declareProperty(
"TwissFile1"
,
m_cData
.twissFile1);
21
declareProperty(
"TwissFile2"
,
m_cData
.twissFile2);
22
declareProperty(
"PositionC1"
,
m_cData
.positionC1);
23
declareProperty(
"PositionC2"
,
m_cData
.positionC2);
24
declareProperty(
"ApertureC1"
,
m_cData
.apertureC1);
25
declareProperty(
"ApertureC2"
,
m_cData
.apertureC2);
26
declareProperty(
"EndMarker"
,
m_cData
.endMarker);
27
}
28
29
StatusCode
ForwardTransportSvc::initialize
() {
30
31
ATH_MSG_INFO
(
"ForwardTransportSvc::initialize"
);
32
return
StatusCode::SUCCESS;
33
}
34
35
bool
ForwardTransportSvc::selectedParticle
(G4ThreeVector momentum,
int
pid) {
36
37
std::ifstream pfile(
m_cData
.twissFile1.c_str());
38
double
beamEnergy =
ForwardTracker::GetBeamEnergy
(pfile)*Gaudi::Units::GeV;
39
40
double
eta
= fabs(momentum.pseudoRapidity());
41
double
xi = momentum.mag()/beamEnergy;
42
43
ATH_MSG_INFO
(
" pseudoRapidity: "
<< std::setprecision(9) <<
eta
);
44
ATH_MSG_INFO
(
" p/beamEnergy: "
<< std::setprecision(9) << xi);
45
46
if
(
eta
<
m_etaCut
)
return
false
;
47
if
(xi <
m_xiCut
)
return
false
;
48
49
if
(
m_transportFlag
) {
50
51
if
(pid == 2212)
return
true
;
// proton
52
}
53
else
{
54
55
if
(pid == 2112)
return
true
;
// neutron
56
if
(pid == 22)
return
true
;
// gamma
57
if
(pid == 3122)
return
true
;
// lambda
58
}
59
60
return
false
;
61
}
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ForwardTransportSvc.h
IForwardTransportSvc.h
McEventCollection.h
TwissFile.h
ForwardTransportSvc::initialize
virtual StatusCode initialize()
Definition
ForwardTransportSvc.cxx:29
ForwardTransportSvc::selectedParticle
virtual bool selectedParticle(G4ThreeVector mom, int pid)
Definition
ForwardTransportSvc.cxx:35
ForwardTransportSvc::m_etaCut
DoubleProperty m_etaCut
Definition
ForwardTransportSvc.h:29
ForwardTransportSvc::m_xiCut
DoubleProperty m_xiCut
Definition
ForwardTransportSvc.h:30
ForwardTransportSvc::m_cData
ForwardTracker::ConfigData m_cData
Definition
ForwardTransportSvc.h:27
ForwardTransportSvc::m_transportFlag
BooleanProperty m_transportFlag
Definition
ForwardTransportSvc.h:28
ForwardTransportSvc::ForwardTransportSvc
ForwardTransportSvc(const std::string &name, ISvcLocator *svc)
Definition
ForwardTransportSvc.cxx:17
ForwardTracker::GetBeamEnergy
double GetBeamEnergy(std::ifstream &)
Definition
TwissFile.cxx:112
Generated on
for ATLAS Offline Software by
1.17.0