forked from preghenella/AEGIS
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from shahor02/pr_fixCosm
Fix memory corruption and ITS acceptance limits
- Loading branch information
Showing
2 changed files
with
12 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,8 +13,8 @@ | |
// Origin: [email protected] | ||
// Modifications for O2: [email protected] | ||
|
||
#include <TParticle.h> | ||
#include <TRandom.h> | ||
#include <TParticle.h> | ||
#include <TVirtualMC.h> | ||
#include <TGeoGlobalMagField.h> | ||
#include "GeneratorCosmics.h" | ||
|
@@ -53,10 +53,8 @@ void GeneratorCosmics::GenerateEvent() | |
if (!mFieldIsSet && !detectField()) { | ||
throw std::runtime_error("Failed to fetch magnetic field"); | ||
} | ||
|
||
fParticles->Clear(); | ||
fParticles->Clear(); | ||
int npart = 0; | ||
std::unique_ptr<TParticle> part; | ||
// | ||
while (npart < mNPart) { // until needed numbe of muons generated | ||
int trials = 0; | ||
|
@@ -138,11 +136,9 @@ void GeneratorCosmics::GenerateEvent() | |
} | ||
|
||
auto etot = std::sqrt(MuMass * MuMass + ptot * ptot); | ||
part = std::make_unique<TParticle>(pdg, 1, -1, -1, -1, -1, p[0], p[1], p[2], etot, r[0], r[1], r[2], 0); | ||
fParticles->Add( new TParticle(pdg, 1, -1, -1, -1, -1, p[0], p[1], p[2], etot, r[0], r[1], r[2], 0) ); | ||
break; | ||
} while (1); | ||
|
||
fParticles->Add(part.get()); | ||
npart++; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,8 +16,8 @@ | |
// Origin: [email protected] | ||
// Modifications for O2: [email protected] | ||
|
||
#include "TGenerator.h" | ||
#include "TClonesArray.h" | ||
#include <TGenerator.h> | ||
#include <TClonesArray.h> | ||
#include <TF1.h> | ||
|
||
// Generates requested number of cosmic muons per call, requiring them to pass through | ||
|
@@ -72,19 +72,18 @@ class GeneratorCosmics : public TGenerator | |
mXAcc = x < 1 ? 1. : x; | ||
mZAcc = z < 1 ? 1. : z; | ||
} | ||
void requireITS0() { requireXZAccepted(2.7, 27.1); } | ||
void requireITS1() { requireXZAccepted(3.5, 27.1); } | ||
void requireITS2() { requireXZAccepted(4.3, 27.1); } | ||
void requireITS3() { requireXZAccepted(19.8, 84.3); } | ||
void requireITS4() { requireXZAccepted(24.8, 84.3); } | ||
void requireITS5() { requireXZAccepted(34.6, 147.5); } | ||
void requireITS6() { requireXZAccepted(39.5, 147.5); } | ||
void requireITS0() { requireXZAccepted(2.23, 15.56); } | ||
void requireITS1() { requireXZAccepted(3.00, 15.56); } | ||
void requireITS2() { requireXZAccepted(3.78, 15.56); } | ||
void requireITS3() { requireXZAccepted(19.55, 43.77); } | ||
void requireITS4() { requireXZAccepted(24.54, 43.77); } | ||
void requireITS5() { requireXZAccepted(34.38, 75.08); } | ||
void requireITS6() { requireXZAccepted(39.33, 75.08); } | ||
void requireTPC() { requireXZAccepted(250, 250); } | ||
|
||
bool getXZatOrigin(float& xpos, float& zpos, const float r[3], const float p[3], int q) const; | ||
|
||
private: | ||
|
||
bool detectField(); | ||
|
||
GenParamType mParam = GenParamType::ParamTPC; | ||
|