Skip to content

Commit 8bed75e

Browse files
committed
TPC_MC_anchoring: Added per region relative gas gain to simulate the change in the voltage settings of GEMs
1 parent 1cd002b commit 8bed75e

File tree

6 files changed

+34
-29
lines changed

6 files changed

+34
-29
lines changed

Detectors/TPC/base/include/TPCBase/ParameterGEM.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ struct ParameterGEM : public o2::conf::ConfigurableParamHelper<ParameterGEM> {
5454
float AbsoluteGain[4] = {14.f, 8.f, 53.f, 240.f}; ///< Absolute gain
5555
float CollectionEfficiency[4] = {1.f, 0.2f, 0.25f, 1.f}; ///< Collection efficiency
5656
float ExtractionEfficiency[4] = {0.65f, 0.55f, 0.12f, 0.6f}; ///< Extraction efficiency
57+
float RelativeGainStack[4] = {1.f, 1.f, 1.f, 1.f}; ///< Relative gain of the stack per region (IROC, OROC1, OROC2, OROC3) for the EffectiveMode
5758
float TotalGainStack = 2000.f; ///< Total gain of the stack for the EffectiveMode
5859
float KappaStack = 1.205f; ///< Variable steering the energy resolution of the full stack for the EffectiveMode
5960
float EfficiencyStack = 0.528f; ///< Variable steering the single electron efficiency of the full stack for the EffectiveMode

Detectors/TPC/simulation/include/TPCSimulation/GEMAmplification.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,10 @@ class GEMAmplification
5555
int getStackAmplification(int nElectrons = 1);
5656

5757
/// Compute the number of electrons after amplification in an effective single-stage amplification
58+
/// \param region Readout region (0:IROC, 1:OROC1, 2:OROC2, 3:OROC3)
5859
/// \param nElectrons Number of electrons arriving at the first amplification stage (GEM1)
5960
/// \return Number of electrons after amplification in an effective single-stage amplification
60-
int getEffectiveStackAmplification(int nElectrons = 1);
61+
int getEffectiveStackAmplification(int region, int nElectrons = 1);
6162

6263
/// Compute the number of electrons after amplification in a full stack of four GEM foils
6364
/// taking into account local variations of the electron amplification
@@ -99,8 +100,8 @@ class GEMAmplification
99100
math_utils::RandomRing<> mRandomFlat;
100101
/// Container with random Polya distributions, one for each GEM in the stack
101102
std::array<math_utils::RandomRing<>, 4> mGain;
102-
/// Container with random Polya distributions for the full stack amplification
103-
math_utils::RandomRing<> mGainFullStack;
103+
/// Container with random Polya distributions for the full stack amplification per region (IROC, OROC1, OROC2, OROC3)
104+
std::array<math_utils::RandomRing<>, 4> mGainFullStack;
104105

105106
const ParameterGEM* mGEMParam; ///< Caching of the parameter class to avoid multiple CDB calls
106107
const ParameterGas* mGasParam; ///< Caching of the parameter class to avoid multiple CDB calls
@@ -118,7 +119,7 @@ inline int GEMAmplification::getStackAmplification(const CRU& cru, const PadPos&
118119
break;
119120
}
120121
case AmplificationMode::EffectiveMode: {
121-
return static_cast<int>(static_cast<float>(getEffectiveStackAmplification(nElectrons)) *
122+
return static_cast<int>(static_cast<float>(getEffectiveStackAmplification(static_cast<int>(cru.gemStack()), nElectrons)) *
122123
mGainMap->getValue(cru, pos.getRow(), pos.getPad()));
123124
break;
124125
}

Detectors/TPC/simulation/macro/toyCluster.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ void createDigitsFromSim(const char* inpFileSim = "o2sim_HitsTPC.root", const st
446446

447447
// convert electrons to ADC signal
448448
const GlobalPadNumber globalPad = mapper.globalPadNumber(digiPadPos.getGlobalPadPos());
449-
const float adcsignal = sampaProcessing.getADCvalue(static_cast<float>((nEleGEM == -1) ? static_cast<int>(gemAmplification.getEffectiveStackAmplification()) : nEleGEM));
449+
const float adcsignal = sampaProcessing.getADCvalue(static_cast<float>((nEleGEM == -1) ? static_cast<int>(gemAmplification.getEffectiveStackAmplification(static_cast<int>(cru.gemStack()))) : nEleGEM));
450450
sampaProcessing.getShapedSignal(adcsignal, driftTime, signalArray);
451451

452452
// set up MC label

Detectors/TPC/simulation/src/GEMAmplification.cxx

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -73,28 +73,31 @@ GEMAmplification::GEMAmplification()
7373
delete polyaDistribution;
7474
}
7575

76-
/// Set the polya distribution for the full stack
76+
/// Set the polya distribution for the full stack per region (IROC, OROC1, OROC2, OROC3)
7777
const float gainStack = mGEMParam->TotalGainStack;
7878
const float kappaStack = mGEMParam->KappaStack;
7979
const float effStack = mGEMParam->EfficiencyStack;
8080
// Correct for electron losses occurring when changing kappa and the efficiency
81-
const float sStack = gainStack / (kappaStack * effStack);
82-
polya % kappaStack % sStack % sStack % (kappaStack - 1) % sStack;
83-
std::string name = polya.str();
84-
o2::math_utils::CachingTF1* polyaDistribution = nullptr;
85-
if (!cacheexists) {
86-
polyaDistribution = new o2::math_utils::CachingTF1("polya", name.c_str(), 0, 25.f * gainStack);
87-
polyaDistribution->SetNpx(50000);
88-
} else {
89-
polyaDistribution = (o2::math_utils::CachingTF1*)outfile->Get("polyaStack");
90-
}
91-
mGainFullStack.initialize(*polyaDistribution);
81+
for (int i = 0; i < 4; ++i) {
82+
const float gainStackPerRegion = mGEMParam->RelativeGainStack[i] * gainStack;
83+
LOG(info) << "TPC: Region: " << i << " Gain: " << gainStackPerRegion;
84+
const float sStack = gainStackPerRegion / (kappaStack * effStack);
85+
polya % kappaStack % sStack % sStack % (kappaStack - 1) % sStack;
86+
std::string name = polya.str();
87+
o2::math_utils::CachingTF1* polyaDistribution = nullptr;
88+
if (!cacheexists) {
89+
polyaDistribution = new o2::math_utils::CachingTF1("polya", name.c_str(), 0, 25.f * gainStackPerRegion);
90+
polyaDistribution->SetNpx(50000);
91+
} else {
92+
polyaDistribution = (o2::math_utils::CachingTF1*)outfile->Get(TString::Format("polyaStack%d", i).Data());
93+
}
94+
mGainFullStack[i].initialize(*polyaDistribution);
9295

93-
if (!cacheexists) {
94-
outfile->WriteTObject(polyaDistribution, "polyaStack");
96+
if (!cacheexists) {
97+
outfile->WriteTObject(polyaDistribution, TString::Format("polyaStack%d", i).Data());
98+
}
99+
delete polyaDistribution;
95100
}
96-
delete polyaDistribution;
97-
98101
if (outfile) {
99102
outfile->Close();
100103
}
@@ -122,17 +125,17 @@ int GEMAmplification::getStackAmplification(int nElectrons)
122125
return nElectronsGEM4;
123126
}
124127

125-
int GEMAmplification::getEffectiveStackAmplification(int nElectrons)
128+
int GEMAmplification::getEffectiveStackAmplification(int region, int nElectrons)
126129
{
127130
/// We start with an arbitrary number of electrons given to the first amplification stage
128131
/// The amplification in the GEM stack is handled for each electron individually and the amplification
129-
/// in the stack is handled in an effective manner
132+
/// in the stack is handled in an effective manner for different regions (IROC, OROC1, OROC2, OROC3)
130133
int nElectronsGEM = 0;
131134
for (int i = 0; i < nElectrons; ++i) {
132135
if (mRandomFlat.getNextValue() > mGEMParam->EfficiencyStack) {
133136
continue;
134137
}
135-
nElectronsGEM += mGainFullStack.getNextValue();
138+
nElectronsGEM += mGainFullStack[region].getNextValue();
136139
}
137140
return nElectronsGEM;
138141
}

Detectors/TPC/simulation/test/testTPCGEMAmplification.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ BOOST_AUTO_TEST_CASE(GEMamplification_effective_test)
7373
const int nEleIn = 158; /// Number of electrons liberated in Ne-CO2-N2 by an incident Fe-55 photon
7474

7575
for (int i = 0; i < 500000; ++i) {
76-
hTest.Fill(gemStack.getEffectiveStackAmplification(nEleIn));
76+
hTest.Fill(gemStack.getEffectiveStackAmplification(0, nEleIn));
7777
}
7878

7979
hTest.Fit("gaus", "Q0");

Detectors/TPC/spacecharge/macro/createSCHistosFromHits.C

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ void createSCHistosFromHits(const int ionDriftTime = 200, const int nEvIon = 1,
366366
const auto pad = static_cast<size_t>(padPos.getPad());
367367
const CRU cru = digiPadPos.getCRU();
368368

369-
const int gain = static_cast<int>(gemAmplification.getEffectiveStackAmplification() * gainMap.getValue(cru, row, pad));
369+
const int gain = static_cast<int>(gemAmplification.getEffectiveStackAmplification(static_cast<int>(cru.gemStack())) * gainMap.getValue(cru, row, pad));
370370
if (gain == 0) {
371371
continue;
372372
}
@@ -399,9 +399,9 @@ void createSCHistosFromHits(const int ionDriftTime = 200, const int nEvIon = 1,
399399
const float chargeEpsilon = vecCalCharge[zbinIDC].getValue(cru, row, pad) + epsilon;
400400
((CalPadArr&)(vecCalCharge[zbinIDC].getCalArray(static_cast<size_t>(cru.roc().getRoc())))).setValue(rowRoc, pad, chargeEpsilon);
401401
} // electron loop
402-
} // hit loop
403-
} // track loop
404-
} // sector loop
402+
} // hit loop
403+
} // track loop
404+
} // sector loop
405405

406406
for (int isec = 0; isec < ::Sector::MAXSECTOR; ++isec) {
407407
delete arrSectors[isec];

0 commit comments

Comments
 (0)