Skip to content

Commit

Permalink
using lab config
Browse files Browse the repository at this point in the history
  • Loading branch information
martinunland committed Aug 1, 2024
1 parent a1e7598 commit 5f785a0
Show file tree
Hide file tree
Showing 6 changed files with 259 additions and 102 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
0.0 26.8288
0.6710674700000041 26.831623
1.0240674699999985 26.831045
1.3760674700000024 26.830467000000002
1.729067470000004 26.829889
2.0810674700000007 26.829311
2.532067470000001 26.808510000000002
3.080067470000003 26.767490000000002
3.354067470000004 26.686790000000002
3.7850674700000013 26.70615
4.137067469999998 26.70557
4.49006747 26.704990000000002
4.87106747 26.584
5.19406747 26.583470000000002
5.547067470000002 26.582890000000003
5.8990674699999985 26.52213
6.163067470000001 26.46151
6.5650674700000025 26.44079
7.074067470000003 26.39983
7.387067469999998 26.31907
7.895067470000001 26.217930000000003
8.248067470000002 26.21735
8.600067469999999 26.096410000000002
8.992067470000002 26.0757
9.579067469999998 25.95437
10.166067470000002 25.833000000000002
10.753067469999998 25.7117
11.30106747 25.590400000000002
11.77006747 25.4693
12.24006747 25.348200000000002
12.70906747 25.227
13.17906747 25.105900000000002
13.707067469999998 24.9445
14.11806747 24.8837
14.54806747 24.7024
14.88006747 24.6417
15.291067470000002 24.5206
15.643067469999998 24.399700000000003
15.995067470000002 24.2787
16.34706747 24.1578
16.699067470000003 24.0368
17.05106747 23.9159
17.403067470000003 23.794900000000002
17.814067469999998 23.6538
18.04806747 23.493000000000002
18.34106747 23.4323
18.796067470000004 23.251
19.339067470000003 23.049500000000002
19.573067469999998 22.8886
19.96906747 22.7676
20.36506747 22.5864
20.790067470000004 22.4051
21.23406747 22.2038
21.449067470000003 22.042900000000003
21.845067470000004 21.9219
22.32906747 21.6804
22.79806747 21.4389
23.26706747 21.197400000000002
23.736067470000002 20.9559
24.205067469999996 20.7144
24.674067470000004 20.4728
25.103067470000006 20.2314
25.494067469999997 19.990000000000002
25.924067470000004 19.7486
26.314067470000005 19.5072
26.764067470000008 19.265700000000002
27.09606747 19.064600000000002
27.44706747 18.8232
27.799067470000004 18.5819
28.267067469999994 18.3003
28.619067469999997 18.059
28.970067469999996 17.817700000000002
29.361067470000002 17.576300000000003
29.653067470000003 17.3351
29.91706747 17.1842
30.151067469999994 16.9128
30.532067469999994 16.7318
31.000067469999998 16.3698
31.469067470000006 16.007800000000003
31.937067469999995 15.645800000000001
32.40606747 15.283800000000001
32.698067470000005 14.982800000000001
33.10806747 14.680800000000001
33.40006747 14.379800000000001
33.81006747 14.077800000000002
34.103067470000006 13.8368
34.51206747 13.354800000000001
35.01906747 12.872800000000002
35.39006747 12.5708
35.72106747 12.269800000000002
35.916067469999994 12.0288
36.42306747 11.6668
36.73506747 11.3048
37.02706747 10.943800000000001
37.37806747 10.581800000000001
37.690067469999995 10.2198
37.98206747 9.858800000000002
38.25406747 9.4968
38.449067469999996 9.1358
38.662067470000004 8.773800000000001
38.86606747 8.4128
39.03106747 8.050800000000002
39.16706747 7.689800000000002
39.38006747000001 7.328800000000001
39.51606747 6.966799999999999
39.592067469999996 6.605800000000002
39.689067470000005 6.2448000000000015
39.80406747 5.8828
39.82206747 5.5218000000000025
39.87906747 5.160800000000002
39.937067469999995 4.799800000000001
47 changes: 31 additions & 16 deletions simulations/QE_calibration/OMSim_QE_calibration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ void runQEbeamSimulationVaryingAbsorptionLength()
lAnalysisManager.writeHeader("Wavelength", "Abs. length");

std::vector<double> lWavelengths = Tools::linspace(275, 750, 96);
std::vector<double> lAbsLengths = Tools::logspace(-9, -4, 20);
std::vector<double> lAbsLengths = Tools::logspace(-8.5, -5, 20);

for (const auto &wavelength : lWavelengths)
{
lScanner->setWavelength(wavelength);

for (const auto &abslength : lAbsLengths)
{
modifyPhotocathodeAbsorptionLength(abslength*m);

lScanner->runBeam(0, 0);
lAnalysisManager.writeScan(wavelength, abslength/m);
lScanner->runErlangenQEBeam();
lAnalysisManager.writeScan(wavelength, abslength);
lHitManager.reset();
}
}
Expand All @@ -73,28 +73,40 @@ void runQEbeamSimulation()
for (const auto &wavelength : lWavelengths)
{
lScanner->setWavelength(wavelength);
lScanner->runBeam(0, 0);
lScanner->runErlangenQEBeam();
lAnalysisManager.writeScan(wavelength);
lHitManager.reset();

}
}

void print_result(const std::vector<double>& counts, const std::vector<double>& edges) {
std::cout << "Counts: ";
for (const auto& count : counts) {
std::cout << count << " ";
}
std::cout << "\nEdges: ";
for (const auto& edge : edges) {
std::cout << std::fixed << std::setprecision(2) << edge << " ";
}
std::cout << std::endl << std::endl;
}

void runXYZfrontalScan()
{
OMSimEffectiveAreaAnalyisis lAnalysisManager;
OMSimCommandArgsTable &lArgs = OMSimCommandArgsTable::getInstance();
OMSimHitManager &lHitManager = OMSimHitManager::getInstance();

Beam *lScanner = new Beam(0.3, lArgs.get<G4double>("distance"));
lScanner->configureZCorrection_PicoQuant();
lAnalysisManager.mOutputFileName = lArgs.get<std::string>("output_file") + ".dat";
lScanner->setWavelength(459);

std::vector<double> lX = Tools::arange(-41, 42, 1);
double lRlim = 42;

for (const auto &x : lX)
{
for (const auto &y : lX)
{
if (std::sqrt(x*x+y*y)< lRlim)
{
lScanner->runBeamPicoQuantSetup(x, y);
lAnalysisManager.writeHitPositionHistogram(x,y);
lHitManager.reset();
}
}
}
}

/**
Expand Down Expand Up @@ -137,16 +149,19 @@ int main(int pArgumentCount, char *pArgumentVector[])
{
//Vary absorption length of photocathode for different wavelengths to determine amount of detected photons
runQEbeamSimulationVaryingAbsorptionLength();
break;
}
case 1:
{
//After fitting the QE vs abs. length curves and making the corresponding parameter files, check that QE is being mapped correctly
runQEbeamSimulation();
break;
}
case 2:
{
//Scan photocathode to save absorption position. Needed to calculate collection efficiency weight.
runXYZfrontalScan();
break;
}
}

Expand Down
18 changes: 10 additions & 8 deletions simulations/QE_calibration/include/OMSimBeam.hh
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,26 @@
#define OMSimBeam_h 1

#include "globals.hh"

#include "TGraph.h"
class Beam
{
public:

Beam(G4double pBeamRadius, G4double pBeamDistance);
~Beam();

void runBeam(G4double pPhi, G4double pTheta);
void runBeam(double pX, double pY, double pZ);
void runErlangenQEBeam();
void runBeamPicoQuantSetup(double pX, double pY);
void setWavelength(double pWavelength);
void configureZCorrection_PicoQuant();
private:

void configurePosCoordinates();
void configureAngCoordinates();
void configureAngScan();
void configureXYZScan(double pX, double pY, double pZ);
void setXYZ(double x, double y, double z);

void configureErlangenQESetup();
void configureXYZScan_NKTLaser();
void configureXYZScan_PicoQuantSetup();

TGraph* mZcorrection;
G4double mBeamRadius;
G4double mBeamDistance;
G4double mWavelength;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public:
void writeScan(Args... args);
template <typename... Args>
void writeHeader(Args... args);

void writeHitPositionHistogram(double x, double y);
effectiveAreaResult calculateEffectiveArea(double pHits);
G4String mOutputFileName;
};
Expand Down
Loading

0 comments on commit 5f785a0

Please sign in to comment.