Skip to content

Commit f4ed2f7

Browse files
authored
Revert "Set automatic interaction rate from collision context"
This reverts commit a6f60e1.
1 parent ef670c8 commit f4ed2f7

File tree

4 files changed

+9
-27
lines changed

4 files changed

+9
-27
lines changed

Generators/include/Generators/TPCLoopersParam.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ struct GenTPCLoopersParam : public o2::conf::ConfigurableParamHelper<GenTPCLoope
3737
std::string scaler_compton = "${O2_ROOT}/share/Generators/egconfig/ScalerComptonParams.json"; // file with scaler parameters for Compton scattering
3838
std::string nclxrate = "ccdb://Users/m/mgiacalo/ClustersTrackRatio"; // file with clusters/rate information per orbit
3939
std::string colsys = "PbPb"; // collision system (PbPb or pp)
40-
int intrate = -1; // Automatic IR from collision context if -1, else user-defined interaction rate in Hz
40+
int intrate = 50000; // interaction rate
4141
bool flat_gas = true; // if true, the gas density is considered flat in the TPC volume
42-
unsigned int nFlatGasLoopers = 500; // number of loopers to be generated per event in case of flat gas
42+
int nFlatGasLoopers = 500; // number of loopers to be generated per event in case of flat gas
4343
float fraction_pairs = 0.08; // fraction of loopers
4444
float multiplier[2] = {1., 1.}; // multiplier for pairs and compton loopers for Poissonian and Gaussian sampling
4545
unsigned int fixedNLoopers[2] = {1, 1}; // fixed number of loopers coming from pairs and compton electrons - valid if flat gas is false and both Poisson and Gaussian params files are empty

Generators/include/TPCLoopers.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,6 @@ class GenTPCLoopers
9191

9292
void SetAdjust(const float &adjust);
9393

94-
unsigned int getNLoopers() const { return (mNLoopersPairs + mNLoopersCompton); }
95-
9694
private:
9795
std::unique_ptr<ONNXGenerator> mONNX_pair = nullptr;
9896
std::unique_ptr<ONNXGenerator> mONNX_compton = nullptr;
@@ -124,7 +122,6 @@ class GenTPCLoopers
124122
double mTimeLimit = 0.0; // Time limit for the current event
125123
double mTimeEnd = 0.0; // Time limit for the last event
126124
float mLoopsFractionPairs = 0.08; // Fraction of loopers from Pairs
127-
int mInteractionRate = 50000; // Interaction rate in Hz
128125
};
129126
#endif // GENERATORS_WITH_TPCLOOPERS
130127

Generators/src/Generator.cxx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ bool Generator::initLoopersGen()
107107
}
108108
}
109109
const auto& nFlatGasLoopers = loopersParam.nFlatGasLoopers;
110-
const auto& fraction_pairs = loopersParam.fraction_pairs;
110+
auto fraction_pairs = loopersParam.fraction_pairs;
111111
std::array<float, 2> multiplier = {loopersParam.multiplier[0], loopersParam.multiplier[1]};
112112
unsigned int nLoopersPairs = loopersParam.fixedNLoopers[0];
113113
unsigned int nLoopersCompton = loopersParam.fixedNLoopers[1];
@@ -166,6 +166,10 @@ bool Generator::initLoopersGen()
166166
LOG(fatal) << "Error: collision system must be either 'PbPb' or 'pp'";
167167
exit(1);
168168
} else {
169+
if (intrate <= 0) {
170+
LOG(fatal) << "Error: interaction rate must be positive!";
171+
exit(1);
172+
}
169173
mLoopersGen->SetRate(nclxrate, (colsys == "PbPb") ? true : false, intrate);
170174
mLoopersGen->SetAdjust(loopersParam.adjust_flatgas);
171175
}
@@ -213,10 +217,6 @@ Bool_t
213217
LOG(error) << "Failed to generate loopers event";
214218
return kFALSE;
215219
}
216-
if (mLoopersGen->getNLoopers() == 0) {
217-
LOG(warning) << "No loopers generated for this event";
218-
return kTRUE;
219-
}
220220
const auto& looperParticles = mLoopersGen->importParticles();
221221
if (looperParticles.empty()) {
222222
LOG(error) << "Failed to import loopers particles";

Generators/src/TPCLoopers.cxx

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -437,28 +437,13 @@ void GenTPCLoopers::SetRate(const std::string &rateFile, const bool &isPbPb = tr
437437
LOG(fatal) << "Error: Could not find fit function '" << fitName << "' in rate file!";
438438
exit(1);
439439
}
440-
mInteractionRate = intRate;
441-
if (mInteractionRate < 0) {
442-
mContextFile = std::filesystem::exists("collisioncontext.root") ? TFile::Open("collisioncontext.root") : nullptr;
443-
if (!mContextFile || mContextFile->IsZombie()) {
444-
LOG(fatal) << "Error: Interaction rate not provided and collision context file not found!";
445-
exit(1);
446-
}
447-
mCollisionContext = (o2::steer::DigitizationContext*)mContextFile->Get("DigitizationContext");
448-
mInteractionRate = std::floor(mCollisionContext->getDigitizerInteractionRate());
449-
LOG(info) << "Interaction rate retrieved from collision context: " << mInteractionRate << " Hz";
450-
if (mInteractionRate < 0) {
451-
LOG(fatal) << "Error: Invalid interaction rate retrieved from collision context!";
452-
exit(1);
453-
}
454-
}
455-
auto ref = static_cast<int>(std::floor(fit->Eval(mInteractionRate / 1000.))); // fit expects rate in kHz
440+
auto ref = static_cast<int>(std::floor(fit->Eval(intRate / 1000.))); // fit expects rate in kHz
456441
rate_file.Close();
457442
if (ref <= 0) {
458443
LOG(fatal) << "Computed flat gas number reference per orbit is <=0";
459444
exit(1);
460445
} else {
461-
LOG(info) << "Set flat gas number to " << ref << " loopers per orbit using " << fitName << " from " << mInteractionRate << " Hz interaction rate.";
446+
LOG(info) << "Set flat gas number to " << ref << " loopers per orbit using " << fitName << " from " << intRate << " Hz interaction rate.";
462447
auto flat = true;
463448
setFlatGas(flat, -1, ref);
464449
}

0 commit comments

Comments
 (0)