ATLAS Offline Software
Loading...
Searching...
No Matches
ALFA_BeamTransport Class Reference

This is the ALFA Beam Transport package. More...

#include <ALFA_BeamTransport.h>

Inheritance diagram for ALFA_BeamTransport:
Collaboration diagram for ALFA_BeamTransport:

Public Member Functions

 ALFA_BeamTransport (const std::string &name, ISvcLocator *pSvcLocator)
 Standard Athena-Algorithm Constructor.
 ~ALFA_BeamTransport ()
 Default Destructor.
StatusCode initialize ()
 standard Athena-Algorithm method
StatusCode execute ()
 standard Athena-Algorithm method
StatusCode finalize ()
 standard Athena-Algorithm method
int SelectParticles (HepMC::GenEvent *evt)
 Selects particles for beam transported Sets event status code of outgoing particles from generator to status != 1.
int DoBeamTracking (int evt_number)
 Function which calls BeamTrack class to calcualte Position at RPs.
int TransportSelectedParticle (HepMC::GenEvent &evt, int evt_number)
 This function is event selection, tracking and HepMC save ine one function.
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

SG::ReadHandleKey< McEventCollectionm_MCKey
SG::ReadHandleKey< xAOD::EventInfom_eventInfoKey
FPConfig m_FPConfig
FPTracker::Particle m_Particle1
FPTracker::Particle m_Particle2
ALFA_BeamTrack m_BeamTracker
FPTracker::Point m_PosRP1
FPTracker::Point m_PosRP3
FPTracker::Point m_MomRP1
FPTracker::Point m_MomRP3
double m_EnergyRP1 = 0.0
double m_EnergyRP3 = 0.0
std::string m_FPOutputBeam1
std::string m_FPOutputBeam2
int m_pcount = 0
int m_pint = 0
double m_EtaCut
double m_XiCut
std::ofstream m_FileBeam1
std::ofstream m_FileBeam2
bool m_WriteDebugOutput
DataObjIDColl m_extendedExtraObjects
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

This is the ALFA Beam Transport package.

It is an interface which uses FPTracker for beamtransportation. Getting from the HepMC eventrecord the particle data at the IP it calculates the particle porition at the first RP.

Author
Daniel Pelikan danie.nosp@m.l.pe.nosp@m.likan.nosp@m.@cer.nosp@m.n.ch

Definition at line 45 of file ALFA_BeamTransport.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ ALFA_BeamTransport()

ALFA_BeamTransport::ALFA_BeamTransport ( const std::string & name,
ISvcLocator * pSvcLocator )

Standard Athena-Algorithm Constructor.

Definition at line 35 of file ALFA_BeamTransport.cxx.

36 :
37 AthAlgorithm(name,pSvcLocator)
38{
39 declareProperty("ConfDir", m_FPConfig.ConfDir="./config");
40 declareProperty("UseALFA", m_FPConfig.UseALFA=true);
41 declareProperty("Debug", m_WriteDebugOutput=false);
42 declareProperty("IP",m_FPConfig.IP = 1);
43 declareProperty("UseAper",m_FPConfig.useaper = true);
44 declareProperty("apermb",m_FPConfig.apermb = 0.);
45 declareProperty("xcol1",m_FPConfig.xcol1 = 999.);//999e-4 but we need open collimators
46 declareProperty("xcol2",m_FPConfig.xcol2 = 999.);//999e-4
47 declareProperty("BeamEnergy",m_FPConfig.pbeam0 = 7000.);//beam energy
48 declareProperty("RPDistance",m_FPConfig.RPDistance = 237.398);
49 declareProperty("absZMagMax",m_FPConfig.absZMagMax = 500.);//dont read magnets after this value
50
51 //Cuts for production
52 declareProperty("EtaCut",m_EtaCut = 8.);
53 declareProperty("XiCut",m_XiCut = 0.2);
54
55 declareProperty("FPOutputBeam1", m_FPOutputBeam1="Beam1");
56 declareProperty("FPOutputBeam2", m_FPOutputBeam2="Beam2");
57
58}
AthAlgorithm()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ ~ALFA_BeamTransport()

ALFA_BeamTransport::~ALFA_BeamTransport ( )

Default Destructor.

Definition at line 60 of file ALFA_BeamTransport.cxx.

60{}

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ DoBeamTracking()

int ALFA_BeamTransport::DoBeamTracking ( int evt_number)

Function which calls BeamTrack class to calcualte Position at RPs.

Definition at line 174 of file ALFA_BeamTransport.cxx.

175{
176 //do particle tracking for beam 1
177
178 //tracking funktion
179 m_BeamTracker.ALFA_BeamTrack::CalculatePosRP(m_Particle1);//calculates position and momentum at RP1
180 //Position at RP
181 m_PosRP1=m_BeamTracker.ALFA_BeamTrack::PosRP();
182 //Momentum at RP
183 m_MomRP1=m_BeamTracker.ALFA_BeamTrack::MomRP();
184
185 //do particle tracking for beam 2
186
187 //tracking funktion
188 m_BeamTracker.ALFA_BeamTrack::CalculatePosRP(m_Particle2);//gives position and momentum at RP3
189 //Position at RP
190 m_PosRP3=m_BeamTracker.ALFA_BeamTrack::PosRP();
191 //Momentum at RP
192 m_MomRP3=m_BeamTracker.ALFA_BeamTrack::MomRP();
193
194 //Write Output
196 {
197 m_FileBeam1 << evt_number << "\t" << std::setprecision(17)
198 << m_PosRP1.x() << std::setprecision(17) << "\t"
199 << m_PosRP1.y() << "\t" << std::setprecision(17)
200 << m_PosRP1.z() << "\t" << std::setprecision(17)
201 << m_MomRP1.x() << std::setprecision(17) << "\t"
202 << m_MomRP1.y() << "\t" << std::setprecision(17)
203 << m_MomRP1.z() << "\t" << std::setprecision(17)
204 << m_EnergyRP1 << std::endl;
205 m_FileBeam2 << evt_number << "\t" << std::setprecision(17)
206 << m_PosRP3.x() << std::setprecision(17) << "\t"
207 << m_PosRP3.y() << "\t" << std::setprecision(17)
208 << m_PosRP3.z() << "\t" << std::setprecision(17)
209 << m_MomRP3.x() << std::setprecision(17) << "\t"
210 << m_MomRP3.y() << "\t" << std::setprecision(17)
211 << m_MomRP3.z() << "\t" << std::setprecision(17)
212 << m_EnergyRP3 << std::endl;
213 }
214
215 return true;
216}
FPTracker::Point m_PosRP3
ALFA_BeamTrack m_BeamTracker
FPTracker::Particle m_Particle1
FPTracker::Point m_PosRP1
FPTracker::Particle m_Particle2
FPTracker::Point m_MomRP3
FPTracker::Point m_MomRP1

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode ALFA_BeamTransport::execute ( )

standard Athena-Algorithm method

Definition at line 108 of file ALFA_BeamTransport.cxx.

109{
110 // Code entered here will be executed once per event
111 ATH_MSG_DEBUG ("Executing " << name() << "...");
112 //-----------------------------------------------------------------------------------------
113 int run_number;
114 uint64_t evt_number;
115
116 //Set particles counter to zero!
117 //counter for particles marked as outgoing in event record
118 m_pcount=0;
119 //counter for particles marked as incomming in event record
120 m_pint=0;
121
122 //Load event info
123 SG::ReadHandle<xAOD::EventInfo> eventInfo (m_eventInfoKey,getContext());
124 if(!eventInfo.isValid()) {
125 ATH_MSG_ERROR("Could not retrieve EventInfo");
126 return StatusCode::FAILURE;
127 }
128 else {
129 run_number=eventInfo->runNumber();
130 evt_number=eventInfo->eventNumber();
131
132 ATH_MSG_DEBUG("run: " << run_number << " event: " << evt_number);
133 }
134
135 SG::ReadHandle<McEventCollection> mcColl(m_MCKey, getContext());
136 if (!mcColl.isValid()) {
137 ATH_MSG_WARNING("Could not retrieve McEventCollection: " << m_MCKey);
138 return StatusCode::SUCCESS;
139 }
140 // Loop over all events in McEventCollectio
141 ATH_MSG_INFO("successful load of HepMC info");
142 for (const HepMC::GenEvent* itr : *mcColl){
143 HepMC::GenEvent evt = (*itr);
144 MC::MeVToGeV(&evt); //Only scales momenta and masses
145 HepMC::Print::line(std::cout, evt);
146
147 // Select final state particle from event generator
148 // set event status !=1 (final state)
149 // fill member variables with particle data
150 // ALFA_BeamTransport::SelectParticles(evt);
151
152 // There should be a check if the first particle is really the
153 // particle for beam 1!!!!
154
155 // run Funktion which does the beamtracking
156 // ALFA_BeamTransport::DoBeamTracking(evt_number);
157
158
159 TransportSelectedParticle(evt, evt_number);
160
161 // Print new data collection on screen
162 HepMC::Print::line(std::cout, evt);
163 }
164
165 ATH_MSG_INFO("after running the process function");
166
167 //-----------------------------------------------------------------------------------------
168
169 return StatusCode::SUCCESS;
170}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
int TransportSelectedParticle(HepMC::GenEvent &evt, int evt_number)
This function is event selection, tracking and HepMC save ine one function.
SG::ReadHandleKey< McEventCollection > m_MCKey
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
void line(std::ostream &os, const GenEvent &e)
Definition GenEvent.h:676
void MeVToGeV(HepMC::GenEvent *evt)

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 50 of file AthAlgorithm.cxx.

51{
52 // If we didn't find any symlinks to add, just return the collection
53 // from the base class. Otherwise, return the extended collection.
54 if (!m_extendedExtraObjects.empty()) {
56 }
57 return Algorithm::extraOutputDeps();
58}
DataObjIDColl m_extendedExtraObjects

◆ finalize()

StatusCode ALFA_BeamTransport::finalize ( )

standard Athena-Algorithm method

Definition at line 95 of file ALFA_BeamTransport.cxx.

96{
97 // close outputfiles for FPTracker
99 m_FileBeam1.close();
100 m_FileBeam2.close();
101 }
102 // Code entered here will be executed once at the end of the program run.
103 return StatusCode::SUCCESS;
104}

◆ initialize()

StatusCode ALFA_BeamTransport::initialize ( )

standard Athena-Algorithm method

Definition at line 63 of file ALFA_BeamTransport.cxx.

64{
65 ATH_MSG_INFO("Initializing " << name() << "...");
66 ATH_CHECK(m_eventInfoKey.initialize());
67 ATH_CHECK(m_MCKey.initialize());
68 // open files for beamtracking output
69 // string in char
70 char* cBeam1Name = new char[m_FPOutputBeam1.length()];
71 strcpy(cBeam1Name, m_FPOutputBeam1.c_str());
72 char* cBeam2Name = new char[m_FPOutputBeam2.length()];
73 strcpy(cBeam2Name, m_FPOutputBeam2.c_str());
74
76 m_FileBeam1.open(cBeam1Name);
77 m_FileBeam2.open(cBeam2Name);
78 }
79
80 //delete char arrays
81 delete[] cBeam1Name;
82 delete[] cBeam2Name;
83
84 //Initialisation of FPTracker
85 m_BeamTracker.ALFA_BeamTrack::initialize(m_FPConfig);
86
87 //-----------------------------------------------------------------------------------------
88 ATH_MSG_INFO( name() << " initialize()" );
89 ATH_MSG_INFO( "initialize() successful in " << name() );
90 return StatusCode::SUCCESS;
91}
#define ATH_CHECK
Evaluate an expression and check for errors.

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg()

MsgStream & AthCommonMsg< Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ SelectParticles()

int ALFA_BeamTransport::SelectParticles ( HepMC::GenEvent * evt)

Selects particles for beam transported Sets event status code of outgoing particles from generator to status != 1.

◆ sysInitialize()

StatusCode AthAlgorithm::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, and PyAthena::Alg.

Definition at line 66 of file AthAlgorithm.cxx.

66 {
68
69 if (sc.isFailure()) {
70 return sc;
71 }
72 ServiceHandle<ICondSvc> cs("CondSvc",name());
73 for (auto h : outputHandles()) {
74 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
75 // do this inside the loop so we don't create the CondSvc until needed
76 if ( cs.retrieve().isFailure() ) {
77 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
78 return StatusCode::SUCCESS;
79 }
80 if (cs->regHandle(this,*h).isFailure()) {
81 sc = StatusCode::FAILURE;
82 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
83 << " with CondSvc");
84 }
85 }
86 }
87 return sc;
88}
static Double_t sc
virtual StatusCode sysInitialize() override
Override sysInitialize.
AthCommonDataStore(const std::string &name, T... args)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ TransportSelectedParticle()

int ALFA_BeamTransport::TransportSelectedParticle ( HepMC::GenEvent & evt,
int evt_number )

This function is event selection, tracking and HepMC save ine one function.

Definition at line 218 of file ALFA_BeamTransport.cxx.

218 {
219 HepMC::GenParticlePtr p1{nullptr};
220 HepMC::GenParticlePtr p2{nullptr};
221
222 std::vector<FPTracker::Point> PosAtRP1;
223 std::vector<FPTracker::Point> PosAtRP3;
224 std::vector<FPTracker::Point> MomAtPR1;
225 std::vector<FPTracker::Point> MomAtPR3;
226 std::vector<double> EnergyRP1;
227 std::vector<double> EnergyRP3;
228
229
230 double mom=0.;
231 double eta=0.;
232 double theta=0.;
233
234 // First we have to select the final state particles from the MC
235 for (const HepMC::GenParticlePtr& p : evt) {
236
237 // Simple Eta Pt cut to remove particles from BeamTransportation which
238 // have no chance to reach RP plane
239 mom = std::sqrt(std::pow(p->momentum().px(), 2) +
240 std::pow(p->momentum().py(), 2) +
241 std::pow(p->momentum().pz(), 2));
242 theta = std::acos(std::abs(p->momentum().pz()) / mom);
243 eta = -std::log(std::tan(theta / 2));
244
245 if (MC::isStable(p) && (!p->end_vertex())) {
246
247 int pid = p->pdg_id();
248 if (eta > m_EtaCut && 1 - std::abs(mom / m_FPConfig.pbeam0) < m_XiCut) {
249
250 // save a copy of the particles which passed the cut
251 HepMC::FourVector Position = p->production_vertex()->position();
252 HepMC::FourVector Momentum = p->momentum();
253 HepMC::GenVertexPtr Vertex = HepMC::newGenVertexPtr(Position); // copy of the vertex
255
256 Vertex->add_particle_out(std::move(Particle));
257 evt.add_vertex(std::move(Vertex));
258
259 // select direction of particle
260 if (p->momentum().pz() > 0. && pid == 2212) { // Beam1 TODO Tracking only works for protons!!!!
261 p1 = p;
262 // now we want to track the final particle if it's a protons
263 // Positions are given in mm FPTracker needs them in meter
264 m_Particle1 = FPTracker::Particle(
265 p1->production_vertex()->position().x() / 1000.,
266 p1->production_vertex()->position().y() / 1000.,
267 p1->production_vertex()->position().z() / 1000.,
268 p1->momentum().px(),
269 p1->momentum().py(),
270 p1->momentum().pz());
271
272 // do particle tracking for beam 1
273
274 // tracking funktion
275 m_BeamTracker.ALFA_BeamTrack::CalculatePosRP(m_Particle1); // calculates position and momentum at RP1
276 // Position at RP
277 m_PosRP1 = m_BeamTracker.ALFA_BeamTrack::PosRP();
278 PosAtRP1.push_back(m_PosRP1);
279 // Momentum at RP
280 m_MomRP1 = m_BeamTracker.ALFA_BeamTrack::MomRP();
281 MomAtPR1.push_back(m_MomRP1);
282 // no Energy change between IP and RP
283 m_EnergyRP1 = p1->momentum().e();
284 EnergyRP1.push_back(m_EnergyRP1);
285 if (m_WriteDebugOutput) {
286 m_FileBeam1 << evt_number << "\t" << std::setprecision(17)
287 << m_PosRP1.x() << std::setprecision(17) << "\t"
288 << m_PosRP1.y() << "\t" << std::setprecision(17)
289 << m_PosRP1.z() << "\t" << std::setprecision(17)
290 << m_MomRP1.x() << std::setprecision(17) << "\t"
291 << m_MomRP1.y() << "\t" << std::setprecision(17)
292 << m_MomRP1.z() << "\t" << std::setprecision(17)
293 << m_EnergyRP1 << std::endl;
294 }
295
296 } else if (p->momentum().pz() < 0. && pid == 2212) { // beam 2
297 p2 = p;
298
299 m_Particle2 = FPTracker::Particle(
300 p2->production_vertex()->position().x() / 1000.,
301 p2->production_vertex()->position().y() / 1000.,
302 p2->production_vertex()->position().z() / 1000.,
303 p2->momentum().px(),
304 p2->momentum().py(),
305 p2->momentum().pz());
306 // tracking funktion
307 m_BeamTracker.ALFA_BeamTrack::CalculatePosRP(m_Particle2); // gives position and momentum at RP3
308 // Position at RP
309 m_PosRP3 = m_BeamTracker.ALFA_BeamTrack::PosRP();
310 PosAtRP3.push_back(m_PosRP3);
311 // Momentum at RP
312 m_MomRP3 = m_BeamTracker.ALFA_BeamTrack::MomRP();
313 MomAtPR3.push_back(m_MomRP3);
314
315 m_EnergyRP3 = p2->momentum().e();
316 EnergyRP3.push_back(m_EnergyRP3);
317 // Write Output
318 if (m_WriteDebugOutput) {
319 m_FileBeam2 << evt_number << "\t" << std::setprecision(17)
320 << m_PosRP3.x() << std::setprecision(17) << "\t"
321 << m_PosRP3.y() << "\t" << std::setprecision(17)
322 << m_PosRP3.z() << "\t" << std::setprecision(17)
323 << m_MomRP3.x() << std::setprecision(17) << "\t"
324 << m_MomRP3.y() << "\t" << std::setprecision(17)
325 << m_MomRP3.z() << "\t" << std::setprecision(17)
326 << m_EnergyRP3 << std::endl;
327 }
328
329 } else {
330 ATH_MSG_ERROR("Strange: Particle rests at IP");
331 }
332
333 if (pid == 2212) { // Find the protons
334 m_pcount++;
335 if (m_pcount > 2) {
336 ATH_MSG_ERROR("Strange: More than two protons in this event!");
337 }
338 }
339 }
340 }
341 }
342
343 //from here the transported particles are added to HepMC
344
345 ATH_MSG_INFO("Add transproted particle into HepMC event record Beam 1");
346 //Add Data for HepMC Collection
347
348 for(int i=0;i<(int)PosAtRP1.size();i++){//Beam1
349 //The factor 1000 comes from the fact that HepMC saves length in mm
350 HepMC::FourVector PositionVectorRP1 = HepMC::FourVector(PosAtRP1.at(i).x()*1000.,PosAtRP1.at(i).y()*1000.,PosAtRP1.at(i).z()*1000.,0.*1000.);
351 HepMC::FourVector MomentumVectorRP1 = HepMC::FourVector(MomAtPR1.at(i).x(),MomAtPR1.at(i).y(),MomAtPR1.at(i).z(),EnergyRP1.at(i));
352
353 HepMC::GenVertexPtr VertexRP1 = HepMC::newGenVertexPtr(PositionVectorRP1);
354 HepMC::GenParticlePtr ParticleRP1 = HepMC::newGenParticlePtr(MomentumVectorRP1,2212,1); //save the transported particle with status code 1 (added 120124) preview was 201
355 //Add particle to vertex
356 VertexRP1->add_particle_out(std::move(ParticleRP1));
357 //add new vertex to HepMC event record
358 if(m_PosRP1.x()!=-99){ // add vertex to event record if the particle in the first beam was not lost
359 evt.add_vertex(std::move(VertexRP1));
360 }
361 }
362 ATH_MSG_INFO ("Add transproted particle into HepMC event record Beam 2" );
363 for(int i=0;i<(int)PosAtRP3.size();i++){
364 HepMC::FourVector PositionVectorRP3 = HepMC::FourVector(PosAtRP3.at(i).x()*1000.,PosAtRP3.at(i).y()*1000.,PosAtRP3.at(i).z()*1000.,0.*1000.);
365 HepMC::FourVector MomentumVectorRP3 = HepMC::FourVector(MomAtPR3.at(i).x(),MomAtPR3.at(i).y(),MomAtPR3.at(i).z(),EnergyRP3.at(i));
366 HepMC::GenVertexPtr VertexRP3 = HepMC::newGenVertexPtr(PositionVectorRP3);
367 HepMC::GenParticlePtr ParticleRP3 = HepMC::newGenParticlePtr(MomentumVectorRP3,2212,1);//save the transported particle with status code 1 (added 120124) preview was 201
368 VertexRP3->add_particle_out(std::move(ParticleRP3));
369 if (m_PosRP3.x() != -99) { // add vertex to event record if the // particle in the second beam was not lost
370 evt.add_vertex(std::move(VertexRP3));
371 }
372 }
373
374 MC::GeVToMeV(&evt); //Only scales momenta and masses
375 return true;
376}
Scalar eta() const
pseudorapidity method
Scalar theta() const
theta method
boost::graph_traits< boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS > >::vertex_descriptor Vertex
HepMC::GenVertex * GenVertexPtr
Definition GenVertex.h:59
GenVertexPtr newGenVertexPtr(const HepMC::FourVector &pos=HepMC::FourVector(0.0, 0.0, 0.0, 0.0), const int i=0)
Definition GenVertex.h:64
GenParticlePtr newGenParticlePtr(const HepMC::FourVector &mom=HepMC::FourVector(0.0, 0.0, 0.0, 0.0), int pid=0, int status=0)
Definition GenParticle.h:39
GenParticle * GenParticlePtr
Definition GenParticle.h:37
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
void GeVToMeV(HepMC::GenEvent *evt)
Particle_v1 Particle
Define the latest version of the particle class.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_BeamTracker

ALFA_BeamTrack ALFA_BeamTransport::m_BeamTracker
private

Definition at line 91 of file ALFA_BeamTransport.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_EnergyRP1

double ALFA_BeamTransport::m_EnergyRP1 = 0.0
private

Definition at line 99 of file ALFA_BeamTransport.h.

◆ m_EnergyRP3

double ALFA_BeamTransport::m_EnergyRP3 = 0.0
private

Definition at line 100 of file ALFA_BeamTransport.h.

◆ m_EtaCut

double ALFA_BeamTransport::m_EtaCut
private

Definition at line 112 of file ALFA_BeamTransport.h.

◆ m_eventInfoKey

SG::ReadHandleKey<xAOD::EventInfo> ALFA_BeamTransport::m_eventInfoKey
private
Initial value:
{ this,
"EvtInfo",
"EventInfo",
"EventInfo name" }

Definition at line 79 of file ALFA_BeamTransport.h.

79 { this,
80 "EvtInfo",
81 "EventInfo",
82 "EventInfo name" };

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.h.

◆ m_FileBeam1

std::ofstream ALFA_BeamTransport::m_FileBeam1
private

Definition at line 116 of file ALFA_BeamTransport.h.

◆ m_FileBeam2

std::ofstream ALFA_BeamTransport::m_FileBeam2
private

Definition at line 117 of file ALFA_BeamTransport.h.

◆ m_FPConfig

FPConfig ALFA_BeamTransport::m_FPConfig
private

Definition at line 86 of file ALFA_BeamTransport.h.

◆ m_FPOutputBeam1

std::string ALFA_BeamTransport::m_FPOutputBeam1
private

Definition at line 102 of file ALFA_BeamTransport.h.

◆ m_FPOutputBeam2

std::string ALFA_BeamTransport::m_FPOutputBeam2
private

Definition at line 103 of file ALFA_BeamTransport.h.

◆ m_MCKey

SG::ReadHandleKey<McEventCollection> ALFA_BeamTransport::m_MCKey
private
Initial value:
{
this,
"McEventCollectionName",
"GEN_EVENT",
"MC Event Collection name"
}

Definition at line 72 of file ALFA_BeamTransport.h.

72 {
73 this,
74 "McEventCollectionName",
75 "GEN_EVENT",
76 "MC Event Collection name"
77 };

◆ m_MomRP1

FPTracker::Point ALFA_BeamTransport::m_MomRP1
private

Definition at line 96 of file ALFA_BeamTransport.h.

◆ m_MomRP3

FPTracker::Point ALFA_BeamTransport::m_MomRP3
private

Definition at line 97 of file ALFA_BeamTransport.h.

◆ m_Particle1

FPTracker::Particle ALFA_BeamTransport::m_Particle1
private

Definition at line 89 of file ALFA_BeamTransport.h.

◆ m_Particle2

FPTracker::Particle ALFA_BeamTransport::m_Particle2
private

Definition at line 90 of file ALFA_BeamTransport.h.

◆ m_pcount

int ALFA_BeamTransport::m_pcount = 0
private

Definition at line 108 of file ALFA_BeamTransport.h.

◆ m_pint

int ALFA_BeamTransport::m_pint = 0
private

Definition at line 110 of file ALFA_BeamTransport.h.

◆ m_PosRP1

FPTracker::Point ALFA_BeamTransport::m_PosRP1
private

Definition at line 93 of file ALFA_BeamTransport.h.

◆ m_PosRP3

FPTracker::Point ALFA_BeamTransport::m_PosRP3
private

Definition at line 94 of file ALFA_BeamTransport.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.

◆ m_WriteDebugOutput

bool ALFA_BeamTransport::m_WriteDebugOutput
private

Definition at line 119 of file ALFA_BeamTransport.h.

◆ m_XiCut

double ALFA_BeamTransport::m_XiCut
private

Definition at line 113 of file ALFA_BeamTransport.h.


The documentation for this class was generated from the following files: