ATLAS Offline Software
Loading...
Searching...
No Matches
CosmicGenerator.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
55
56
57
58#ifndef GENERATORMODULESCOSMICGEN_H
59#define GENERATORMODULESCOSMICGEN_H
60
62
63#include "CLHEP/Vector/LorentzVector.h"
65
66#include <iostream>
67#include <fstream>
68#include <vector>
69#include <string>
70
71
72
74
76
77public:
78 CosmicGenerator(const std::string& name, ISvcLocator* pSvcLocator);
79 virtual ~CosmicGenerator() = default;
80 virtual StatusCode genInitialize();
81 virtual StatusCode callGenerator();
82 virtual StatusCode genFinalize();
83 virtual StatusCode fillEvt(HepMC::GenEvent* evt);
84
85 CLHEP::HepLorentzVector generateVertex(void);
86 CLHEP::HepLorentzVector generateVertexReweighted(void);
87
89 static CLHEP::HepRandomEngine* COSMIC_RANDOM_ENGINE;
90
91private:
92 // Migration to MeV and mm units: all conversions are done in this interface
93 // to the CosmicGun. The CosmicGun itself uses GeV units internally - to call
94 // the fortran code.
95 //
96
97 static constexpr float m_GeV = 1000.f; // FIXME Take from SystemOfUnits.h header?
98 static constexpr float m_mm = 10.f; // FIXME Take from SystemOfUnits.h header?
99
100 // event counter, used for event ID
101 int m_events{0};
104 std::vector<int> m_pdgCode;
105
106 IntegerProperty m_dsid{this, "Dsid", 999999, "Dataset ID number"};
107 FloatProperty m_emin{this, "emin", 10.*m_GeV};
108 FloatProperty m_emax{this, "emax", 100.*m_GeV};
109 FloatProperty m_ctcut{this, "ctcut", 0.35};
110 FloatProperty m_xlow{this, "xvert_low", 0.*m_mm};
111 FloatProperty m_xhig{this, "xvert_hig", 10.*m_mm};
112 FloatProperty m_zlow{this, "zvert_low", 0.*m_mm};
113 FloatProperty m_zhig{this, "zvert_hig", 10.*m_mm};
114 FloatProperty m_yval{this, "yvert_val", 81.*m_mm};
115 FloatProperty m_IPx{this, "IPx", 0.f};
116 FloatProperty m_IPy{this, "IPy", 0.f};
117 FloatProperty m_IPz{this, "IPz", 0.f};
118 FloatProperty m_radius{this, "Radius", 0.f};
119 FloatProperty m_zpos{this, "Zposition", 14500.f};
120 FloatProperty m_tmin{this, "tmin", 0.f};
121 FloatProperty m_tmax{this, "tmax", 0.f};
122 BooleanProperty m_cavOpt{this, "OptimizeForCavern", false};
123 IntegerProperty m_srOneOpt{this, "OptimizeForSR1", 0}; // Not a bool??
124 BooleanProperty m_srOnePixECOpt{this, "OptimizeForSR1PixelEndCap", false};
125 BooleanProperty m_swapYZAxis{this, "SwapYZAxis", false};
126 BooleanProperty m_muonECOpt{this, "OptimizeForMuonEndCap", false};
127 IntegerProperty m_printEvent{this, "PrintEvent", 10};
128 IntegerProperty m_printMod{this, "PrintMod", 100};
129
130 FloatProperty m_thetamin{this, "ThetaMin", 0.f};
131 FloatProperty m_thetamax{this, "ThetaMax", 1.f};
132 FloatProperty m_phimin{this, "PhiMin", -1.*M_PI};
133 FloatProperty m_phimax{this, "PhiMax", M_PI};
134
135 bool m_readfile{false};
136 StringProperty m_infile{this, "eventfile", "NONE"};
137 std::ifstream m_ffile;
138
139 // Event scalars, three-vectors, and four-vectors:
140 std::vector<CLHEP::HepLorentzVector> m_fourPos;
141 std::vector<CLHEP::HepLorentzVector> m_fourMom;
142 CLHEP::Hep3Vector m_center;
143 std::vector<HepMC::Polarization> m_polarization;
144
145 // Energy dependent position cut for muons to reach the detector.
146 bool exzCut(const CLHEP::Hep3Vector& pos,const CLHEP::HepLorentzVector& p);
147
148 // property for calling exzCut
149 BooleanProperty m_exzCut{this, "ExzCut", false};
150 // maximum r used in exzCut
151 FloatProperty m_rmax{this, "RMax", 10000000.f};
152
153 // Calculation of pathlength in rock and whether cosmic ray is aimed towards
154 // the pixel detector
155 double pathLengthInRock(double xgen, double ygen, double zgen, double theta, double phi);
156 bool pointsAtPixels(double xgen, double ygen, double zgen, double theta, double phi);
157
158 // New optimization options (November 2007)
159 BooleanProperty m_doPathlengthCut{this, "doPathLengthCut", false};
160 BooleanProperty m_doAimedAtPixelsCut{this, "doAimedAtPixelsCut", false};
161 BooleanProperty m_doReweighting{this, "doReweighting", false};
162 DoubleProperty m_energyCutThreshold{this, "energyCutThreshold", 1.0};
163 DoubleProperty m_ysurface{this, "ysurface", 81.*m_mm};
164 DoubleProperty m_rvertmax{this, "rvert_max", 300.*m_mm}; // replaces rectangle in case of reweighting
165 DoubleProperty m_pixelplanemaxx{this, "pixelplane_maxx", 1150.};
166 DoubleProperty m_pixelplanemaxz{this, "pixelplane_maxz", 1650.};
167};
168
169#endif
#define M_PI
Scalar phi() const
phi method
Scalar theta() const
theta method
BooleanProperty m_doAimedAtPixelsCut
FloatProperty m_thetamax
FloatProperty m_zhig
virtual ~CosmicGenerator()=default
std::vector< CLHEP::HepLorentzVector > m_fourPos
FloatProperty m_IPz
FloatProperty m_xhig
FloatProperty m_ctcut
BooleanProperty m_doPathlengthCut
BooleanProperty m_cavOpt
IntegerProperty m_printMod
BooleanProperty m_doReweighting
FloatProperty m_phimin
CLHEP::HepLorentzVector generateVertexReweighted(void)
FloatProperty m_phimax
virtual StatusCode genInitialize()
For initializing the generator, if required.
FloatProperty m_tmin
FloatProperty m_IPy
DoubleProperty m_ysurface
bool exzCut(const CLHEP::Hep3Vector &pos, const CLHEP::HepLorentzVector &p)
DoubleProperty m_pixelplanemaxx
FloatProperty m_emin
std::ifstream m_ffile
static constexpr float m_mm
FloatProperty m_zpos
IntegerProperty m_srOneOpt
bool pointsAtPixels(double xgen, double ygen, double zgen, double theta, double phi)
IntegerProperty m_printEvent
FloatProperty m_tmax
virtual StatusCode fillEvt(HepMC::GenEvent *evt)
For filling the HepMC event object.
StringProperty m_infile
BooleanProperty m_srOnePixECOpt
DoubleProperty m_energyCutThreshold
static CLHEP::HepRandomEngine * COSMIC_RANDOM_ENGINE
Static pointer to random number generator for use by.
CLHEP::HepLorentzVector generateVertex(void)
BooleanProperty m_exzCut
FloatProperty m_zlow
FloatProperty m_IPx
std::vector< HepMC::Polarization > m_polarization
DoubleProperty m_rvertmax
std::vector< CLHEP::HepLorentzVector > m_fourMom
CLHEP::Hep3Vector m_center
DoubleProperty m_pixelplanemaxz
FloatProperty m_emax
FloatProperty m_thetamin
virtual StatusCode callGenerator()
For calling the generator on each iteration of the event loop.
FloatProperty m_yval
CosmicGenerator(const std::string &name, ISvcLocator *pSvcLocator)
FloatProperty m_radius
BooleanProperty m_muonECOpt
static constexpr float m_GeV
BooleanProperty m_swapYZAxis
std::vector< int > m_pdgCode
FloatProperty m_rmax
virtual StatusCode genFinalize()
For finalising the generator, if required.
FloatProperty m_xlow
double pathLengthInRock(double xgen, double ygen, double zgen, double theta, double phi)
IntegerProperty m_dsid
GenModule(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition GenModule.cxx:14