ATLAS Offline Software
Loading...
Searching...
No Matches
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"
9
10#include "ForwardTransportSvc.h"
13
14#include <fstream>
15#include "TTree.h"
16
17ForwardTransportSvc::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
30
31 ATH_MSG_INFO("ForwardTransportSvc::initialize");
32 return StatusCode::SUCCESS;
33}
34
35bool 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}
Scalar eta() const
pseudorapidity method
#define ATH_MSG_INFO(x)
virtual StatusCode initialize()
virtual bool selectedParticle(G4ThreeVector mom, int pid)
ForwardTracker::ConfigData m_cData
BooleanProperty m_transportFlag
ForwardTransportSvc(const std::string &name, ISvcLocator *svc)
double GetBeamEnergy(std::ifstream &)