6 #include <evt/ShowerSimData.h>
7 #include <evt/GaisserHillas6Parameter.h>
8 #include <utl/Particle.h>
9 #include <utl/NucleusProperties.h>
10 #include <utl/TabulatedFunction.h>
11 #include <utl/ErrorLogger.h>
12 #include <utl/AugerUnits.h>
14 #include <io/CONEXStructures.h>
15 #include <io/CONEXIOException.h>
27 CONEXShower::CONEXShower(
const int nSlices) :
31 fdEdX(new float[fNX]),
33 fNgam(new float[fNX]),
34 fNele(new float[fNX]),
35 fMuProd(new float[fNX])
107 const char*
const err =
"Unkown primary particle type !";
123 const std::vector<io::CONEXLeadingParticles> conexLPvector,
124 const float conexFileVersion,
128 if (conexFileVersion < 2.5) {
142 const double a = conexShower.
fP1 *
g/
cm2;
143 const double b = conexShower.
fP2;
144 const double c = conexShower.
fP3 /
g*
cm2;
145 const double A = a + xShift*(-b + c * xShift);
146 const double B = b - 2 * c * xShift;
154 const bool hasValidGHfit = (conexShower.
fChi2 > 0 && conexShower.
fChi2 < 1e13);
163 double energyDepositSum = 0.;
164 const int nSlice = conexShower.
fNX;
167 double thisX = 5 *
g/
cm2;
168 const double deltaX = 50 *
g/
cm2;
169 while (thisX < xShift) {
175 if (conexFileVersion >= 1.1)
182 for (
int i = 0; i < nSlice; ++i) {
185 double slantDepthMin = 0;
186 if (conexFileVersion >= 2.0) {
187 slantDepthMin = conexShower.
fX[i] *
g/
cm2;
189 const double slantDepthMax = conexShower.
fX[i+1] *
g/
cm2;
190 binWidth = slantDepthMax - slantDepthMin;
194 const double slantDepthMax = conexHeader.
fFirstDepth + conexHeader.
fDelX*(i+1) *
g/cm2;
195 binWidth = slantDepthMax - slantDepthMin;
198 if (slantDepthMin + xShift < 0)
201 slantDepthMin += xShift;
203 const double maxDepthProfile = conexShower.
fX[nSlice-1]*
g/
cm2;
204 if (conexShower.
fZenith > 90 && slantDepthMin > maxDepthProfile)
207 float nCharged =
max(0.f, conexShower.
fN[i]);
208 float nMuons =
max(0.f, conexShower.
fNmu[i]);
212 if (conexFileVersion >= 1.1) {
213 nElectron =
max(0.f, conexShower.
fNele[i]);
214 nGamma =
max(0.f, conexShower.
fNgam[i]);
216 nElectron =
max(0.f, nCharged - nMuons);
218 thisX = slantDepthMin;
219 profile.
PushBack(slantDepthMin, nCharged);
220 muonProfile.
PushBack(slantDepthMin, nMuons);
221 gammaProfile.
PushBack(slantDepthMin, nGamma);
222 electronProfile.
PushBack(slantDepthMin, nElectron);
224 energyDepositSum +=
max(0., conexShower.
fdEdX[i] *
GeV/
g*cm2 * binWidth);
226 if (conexFileVersion >= 1.1)
245 const double kGround = 0.61;
263 if (conexFileVersion >= 1.1) {
278 err <<
"CONEX shower with invalid GH fit: Xmax=" << gh.
GetXMax()/
g*cm2
299 const std::vector<io::CONEXLeadingParticles>& lpVector,
302 particleNode.
SetParentId(lpVector.at(counter).GetParentId());
304 particleNode.
SetEnergyCM(lpVector.at(counter).GetEnergyCM() *
GeV);
305 particleNode.
SetKinel(lpVector.at(counter).GetKinel());
307 particleNode.
SetTargetMass(lpVector.at(counter).GetTargetMass());
308 particleNode.
SetDepth(lpVector.at(counter).GetDepth() *
g/
cm2);
309 particleNode.
SetHeight(lpVector.at(counter).GetHeight() *
m);
313 if (counter > lpVector.size() - 1)
321 for (
unsigned i = 0; i < lpVector.at(counter - 1).GetParticleIds().size(); ++i) {
323 dummyParticle.
SetParentId(lpVector.at(counter - 1).GetParticleIds()[i]);
324 dummyParticle.
SetParentEnergy(lpVector.at(counter - 1).GetParticleEnergies()[i] *
GeV);
void SetMultiplicity(const int mult)
Wrapper for CONEX header shower profile data.
Class to hold collection (x,y) points and provide interpolation between them.
void SetKinel(const double kinel)
void SetEnergyCutoff(const double energy, const ProfileType type=eElectron)
Set the enegy cutoff for which the profile of charged particles was calculated.
void SetXMax(const double xMax, const double error)
void SetDepth(const double depth)
void SetGroundParticleCoordinateSystemAzimuth(const double azimuth)
Set the azimuth angle of the shower. Angle in x-y plane wrt. to the x axis (0 is from east)...
void MakeGHParameters(const evt::VGaisserHillasParameter &ghPar)
Make the Gaisser-Hillas parameters of the shower.
void PushBack(const double x, const double y)
double pow(const double x, const unsigned int i)
void SetB(const double b, const double error)
Interface class to access Shower Simulated parameters.
void MakeLongitudinalProfile(const utl::TabulatedFunction &lp, const ProfileType type=eCharged)
Make the longitudinal charge profile of the shower.
void SetXZero(const double xZero, const double error)
void SetCalorimetricEnergy(const double energy)
Set the calorimetric energy of the shower.
void SetC(const double c, const double error)
void SetEnergy(const double theEnergy)
Set the energy of the shower primary particle.
void SetTargetMass(const int targetMass)
void SetChiSquare(const double chi, const unsigned int ndof)
std::vector< GenParticle > & GetDaughterParticles()
void SetXFirst(const double xFirst)
Set depth of first interaction.
void SetNMax(const double nMax, const double error, const bool isEnergyDeposit=false)
Base for exceptions in the CORSIKA reader.
void SetParentId(const int parentId)
void SetA(const double a, const double error)
void SetParentEnergy(const double parentEnergy)
static int TypeCode(const unsigned int charge, const unsigned int atomicNumber)
Calculate the particle type code from Z and A.
void FillShowerSimDataFromConex(const CONEXHeader &conexHeader, const CONEXShower &conexShower, evt::ShowerSimData &)
void AddDaughterParticle(GenParticle &parttemp)
void SetPrimaryParticle(const int type)
Set the type of the shower primary particle.
void SetGroundParticleCoordinateSystemZenith(const double zenith)
Set the zenith angle of the shower. Room angle between z-axis and direction from where the shower is ...
bool HasGHParameters() const
Check initialization of the Gaisser-Hillas parameters.
void FillInteractionData(evt::GenParticle &interactionTree, const std::vector< io::CONEXLeadingParticles > &lpVector, unsigned counter=0)
void SetEnergyCM(const double energyCM)
void FillShowerProfileDataFromConex(const CONEXHeader &conexHeader, const CONEXShower &conexShower, const std::vector< io::CONEXLeadingParticles > conexLPvector, const float conexFileVersion, evt::ShowerSimData &, const double xShift=0)
void SetParticleTree(const evt::GenParticle &partTree)
Set the tree of particles in the first few generations.
void SetVectorLength(const int n)
void SetXInject(const double xInject)
Set depth of particle injection.
#define ERROR(message)
Macro for logging error messages.
void SetHeight(const double height)
Gaisser-Hillas with 6 parameters (CORSIKA)
double GetChiSquare() const
bool HasLongitudinalProfile(const ProfileType type=eCharged) const
Check initialization of the longitudinal profile.
bool HasParticleTree() const
Check if the MC data have been filled in.