@@ -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}
0 commit comments