Skip to content

Commit

Permalink
Pileup simulation/reconstruction fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitri Peresunko authored and Dmitri Peresunko committed Jan 21, 2021
1 parent 43d521b commit b55e86b
Show file tree
Hide file tree
Showing 15 changed files with 391 additions and 526 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class CPVBadMapCalibDevice : public o2::framework::Task
std::string mPath{"./"}; ///< path and name of file with collected histograms
std::unique_ptr<BadChannelMap> mBadMap; /// Final calibration object
std::array<char, o2::cpv::Geometry::kNCHANNELS> mMapDiff; /// difference between new and old map
ClassDefNV(CPVBadMapCalibDevice, 1);
};

o2::framework::DataProcessorSpec getBadMapCalibSpec(bool useCCDB, bool forceUpdate, std::string path, short method);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ class CPVGainCalibDevice : public o2::framework::Task
std::unique_ptr<CalibParams> mCalibParams; /// Final calibration object
std::unique_ptr<TH2F> mMean; /// Mean values in High Gain channels
std::array<short, o2::cpv::Geometry::kNCHANNELS> mGainRatio; /// Gain variation wrt previous map
ClassDefNV(CPVGainCalibDevice, 1);
};

o2::framework::DataProcessorSpec getGainCalibSpec(bool useCCDB, bool forceUpdate, std::string path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,40 +173,6 @@ void CPVPedestalCalibDevice::checkPedestals()
// }
}

//
// Method to compare new pedestals and latest in ccdb
// Do not update existing object automatically if difference is too strong
// create object with validity range if far future (?) and send warning (e-mail?) to operator
// if (mUseCCDB) { // read calibration objects from ccdb
// LHCphase lhcPhaseObjTmp;
/*
// for now this part is not implemented; below, the sketch of how it should be done
if (mAttachToLHCphase) {
// if I want to take the LHCclockphase just produced, I need to loop over what the previous spec produces:
int nSlots = pc.inputs().getNofParts(0);
assert(pc.inputs().getNofParts(1) == nSlots);
int lhcphaseIndex = -1;
for (int isl = 0; isl < nSlots; isl++) {
const auto wrp = pc.inputs().get<CcdbObjectInfo*>("clbInfo", isl);
if (wrp->getStartValidityTimestamp() > tfcounter) { // replace tfcounter with the timestamp of the TF
lhxphaseIndex = isl - 1;
break;
}
}
if (lhcphaseIndex == -1) {
// no new object found, use CCDB
auto lhcPhase = pc.inputs().get<LHCphase*>("tofccdbLHCphase");
lhcPhaseObjTmp = std::move(*lhcPhase);
}
else {
const auto pld = pc.inputs().get<gsl::span<char>>("clbPayload", lhcphaseIndex); // this is actually an image of TMemFile
// now i need to make a LHCphase object; Ruben suggested how, I did not try yet
// ...
}
}
*/

o2::framework::DataProcessorSpec o2::cpv::getPedestalCalibSpec(bool useCCDB, bool forceUpdate, std::string path)
{

Expand All @@ -220,34 +186,3 @@ o2::framework::DataProcessorSpec o2::cpv::getPedestalCalibSpec(bool useCCDB, boo
o2::framework::adaptFromTask<CPVPedestalCalibDevice>(useCCDB, forceUpdate, path),
o2::framework::Options{}};
}

// //============================================================
// DataProcessorSpec getTOFChannelCalibDeviceSpec(bool useCCDB){
// using device = o2::calibration::TOFChannelCalibDevice;
// using clbUtils = o2::calibration::Utils;

// std::vector<OutputSpec> outputs;
// outputs.emplace_back(ConcreteDataTypeMatcher{clbUtils::gDataOriginCLB, clbUtils::gDataDescriptionCLBPayload});
// outputs.emplace_back(ConcreteDataTypeMatcher{clbUtils::gDataOriginCLB, clbUtils::gDataDescriptionCLBInfo});

// std::vector<InputSpec> inputs;
// inputs.emplace_back("input", "TOF", "CALIBDATA");
// if (useCCDB) {
// inputs.emplace_back("tofccdbLHCphase", o2::header::gDataOriginTOF, "LHCphase");
// inputs.emplace_back("tofccdbChannelCalib", o2::header::gDataOriginTOF, "ChannelCalib");
// inputs.emplace_back("startTimeLHCphase", o2::header::gDataOriginTOF, "StartLHCphase");
// inputs.emplace_back("startTimeChCalib", o2::header::gDataOriginTOF, "StartChCalib");
// }

// return DataProcessorSpec{
// "calib-tofchannel-calibration",
// inputs,
// outputs,
// AlgorithmSpec{adaptFromTask<device>(useCCDB, attachChannelOffsetToLHCphase)},
// Options{
// {"min-entries", VariantType::Int, 500, {"minimum number of entries to fit channel histos"}},
// {"nbins", VariantType::Int, 1000, {"number of bins for t-texp"}},
// {"range", VariantType::Float, 24000.f, {"range for t-text"}},
// {"do-TOF-channel-calib-in-test-mode", VariantType::Bool, false, {"to run in test mode for simplification"}},
// {"ccdb-path", VariantType::String, "http://ccdb-test.cern.ch:8080", {"Path to CCDB"}}}};
// }
24 changes: 8 additions & 16 deletions Detectors/CPV/simulation/include/CPVSimulation/Digitizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,19 @@ class Digitizer : public TObject
void finish();

/// Steer conversion of hits to digits
void process(const std::vector<Hit>* hitsBg, const std::vector<Hit>* hitsS, std::vector<Digit>& digits, o2::dataformats::MCTruthContainer<o2::MCCompLabel>& labels);

void setEventTime(double t);
double getEventTime() const { return mEventTime; }

void setCurrEvID(int v);
int getCurrEvID() const { return mCurrEvID; }
void processHits(const std::vector<Hit>* mHits, const std::vector<Digit>& digitsBg,
std::vector<Digit>& digitsOut, o2::dataformats::MCTruthContainer<o2::MCCompLabel>& mLabels,
int source, int entry, double dt);

protected:
float simulateNoise();
void addNoisyChannels(int start, int end, std::vector<Digit>& digitsOut);
float uncalibrate(float e, int absId);
float simulateNoise();

private:
const CalibParams* mCalibParams = nullptr; //! Calibration coefficients
double mEventTime = 0; ///< global event time
uint mROFrameMin = 0; ///< lowest RO frame of current digits
uint mROFrameMax = 0; ///< highest RO frame of current digits
int mCurrSrcID = 0; ///< current MC source from the manager
int mCurrEvID = 0; ///< current event ID from the manager

ClassDefOverride(Digitizer, 1);
std::unique_ptr<CalibParams> mCalibParams; /// Calibration coefficients

ClassDefOverride(Digitizer, 2);
};
} // namespace cpv
} // namespace o2
Expand Down

0 comments on commit b55e86b

Please sign in to comment.