18#include <fairlogger/Logger.h>
25 mHistos = std::make_unique<ETCalibHistos>();
26 mBuffer = std::make_unique<RingBuffer>();
31 mRunStartTime =
other.mRunStartTime;
32 mBuffer = std::make_unique<RingBuffer>();
34 mEvOrbit =
other.mEvOrbit;
36 mPtMin =
other.mPtMin;
37 mEminHGTime =
other.mEminHGTime;
38 mEminLGTime =
other.mEminLGTime;
39 mFillDigitsTree =
other.mFillDigitsTree;
41 mHistos = std::make_unique<ETCalibHistos>();
46 LOG(info) <<
"Collected " << mDigits.size() <<
" CalibDigits";
49void PHOSEnergySlot::fill(
const gsl::span<const Cluster>&
clusters,
const gsl::span<const CluElement>& cluelements,
const gsl::span<const TriggerRecord>& cluTR)
54 if (mFillDigitsTree) {
57 for (
auto& tr : cluTR) {
59 if (mFillDigitsTree) {
64 h.mBC = tr.getBCData().bc;
65 mDigits.push_back(
h.mDataWord);
66 mDigits.push_back(tr.getBCData().orbit);
68 mEvBC = tr.getBCData().bc;
70 int firstCluInEvent = tr.getFirstEntry();
71 int lastCluInEvent = firstCluInEvent + tr.getNumberOfObjects();
74 const float minCluE = 1.5;
76 for (
int i = firstCluInEvent;
i < lastCluInEvent;
i++) {
83 good &= (lastCluInEvent - firstCluInEvent > 1);
88 mBuffer->startNewEvent();
89 for (
int i = firstCluInEvent;
i < lastCluInEvent;
i++) {
94 fillTimeMassHisto(
clu, cluelements);
96 if (!mFillDigitsTree) {
102 for (uint32_t idig = firstCE; idig < lastCE; idig++) {
107 short absId = ce.
absId;
122 LOG(important) <<
"Too many clusters per event:" <<
i - firstCluInEvent <<
", apply more strict selection; clusters with same indexes will appear";
134void PHOSEnergySlot::fillTimeMassHisto(
const Cluster&
clu,
const gsl::span<const CluElement>& cluelements)
142 for (uint32_t idig = firstCE; idig < lastCE; idig++) {
144 short absId = ce.
absId;
150 if (ce.
energy > mEminHGTime) {
154 int ddl = (relid[0] - 1) * 4 + (relid[1] - 1) / 16 - 2;
161 if (ce.
energy > mEminLGTime) {
176 const float para = 0.925;
177 const float parb = 6.52;
179 posX -= posX *
depth / 460.;
180 posZ -= posZ *
depth / 460.;
187 vec3 *= e / vec3.Mag();
188 TLorentzVector
v(vec3.X(), vec3.Y(), vec3.Z(), e);
190 bool isGood = checkCluster(
clu);
191 for (
short ip = mBuffer->size(); ip--;) {
192 const TLorentzVector& vp = mBuffer->getEntry(ip);
193 TLorentzVector
sum =
v + vp;
194 if (mBuffer->isCurrentEvent(ip)) {
198 if (
sum.Pt() > mPtMin) {
205 if (
sum.Pt() > mPtMin) {
212 if (isGood && e > 0.2) {
213 mBuffer->addEntry(
v);
217bool PHOSEnergySlot::checkCluster(
const Cluster&
clu)
230float PHOSEnergySlot::Nonlinearity(
float en)
233 const double a = 9.34913e-01;
234 const double b = 2.33e-03;
235 const double c = -8.10e-05;
236 const double d = 3.2e-02;
237 const double f = -8.0e-03;
238 const double g = 1.e-01;
239 const double h = 2.e-01;
240 const double k = -1.48e-04;
241 const double l = 0.194;
242 const double m = 0.0025;
244 return en * (
a +
b * en +
c * en * en + d / en +
f / ((en -
g) * (en -
g) +
h) + k / ((en - l) * (en - l) +
m));
254 mHistos = std::make_unique<ETCalibHistos>();
263 mHistos->merge(
c->getCollectedHistos());
269 auto& slot = front ? cont.emplace_front(tstart, tend) : cont.emplace_back(tstart, tend);
270 slot.setContainer(std::make_unique<es>());
271 slot.getContainer()->setFillDigitsTree(mFillDigitsTree);
272 slot.getContainer()->setBadMap(mBadMap);
273 slot.getContainer()->setCalibration(mCalibParams);
274 slot.getContainer()->setCuts(mPtMin, mEminHGTime, mEminLGTime, mDigitEmin, mClusterEmin);
279 const gsl::span<const CluElement>& cluelements,
280 const gsl::span<const TriggerRecord>& cluTR,
281 std::vector<uint32_t>& outputDigits)
286 slotTF.getContainer()->setRunStartTime(
tf);
287 slotTF.getContainer()->fill(
clusters, cluelements, cluTR);
289 if (mFillDigitsTree) {
290 auto tmpD = slotTF.getContainer()->getCollectedDigits();
291 outputDigits.insert(outputDigits.end(), tmpD.begin(), tmpD.end());
Utils and constants for calibration and related workflows.
Class for time synchronization of RawReader instances.
o2::calibration::TFType TFType
Slot & getSlotForTF(TFType tf)
const Container * getContainer() const
TFType getTFStart() const
bool isChannelGood(short channelID) const
Get the status of a certain cell.
float getHGLGRatio(short cellID) const
Get High Gain to Low Gain ratio calibration coefficients.
float getGain(short cellID) const
Get High Gain energy calibration coefficients.
Contains PHOS cluster parameters.
uint32_t getFirstCluEl() const
int getMultiplicity() const
void getLocalPosition(float &posX, float &posZ) const
uint32_t getLastCluEl() const
float getCoreEnergy() const
static void relPosToAbsId(char module, float x, float z, short &absId)
void local2Global(char module, float x, float z, TVector3 &globaPos) const
static bool absToRelNumbering(short absId, char *relid)
static Geometry * GetInstance()
bool process(uint64_t tf, const gsl::span< const Cluster > &clusters, const gsl::span< const CluElement > &cluelements, const gsl::span< const TriggerRecord > &cluTR, std::vector< uint32_t > &outputDigits)
void finalizeSlot(Slot &slot) final
Slot & emplaceNewSlot(bool front, TFType tstart, TFType tend) final
static constexpr short kMaxCluInEvent
PHOSEnergySlot()
maximal number of clusters per event to separate digits from them (7 bits in digit map)
void fill(const gsl::span< const Cluster > &clusters, const gsl::span< const CluElement > &cluelements, const gsl::span< const TriggerRecord > &cluTR)
float sum(float s, o2::dcs::DataPointValue v)
GLboolean GLboolean GLboolean b
GLint GLint GLsizei GLsizei GLsizei depth
GLboolean GLboolean GLboolean GLboolean a
std::unique_ptr< GPUReconstructionTimeframe > tf
VectorOfTObjectPtrs other
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
std::vector< Cluster > clusters
uint32_t mHgLg
Bit 24: LG/HG.
uint32_t mCluster
Bits 25-32: index of cluster in event.
uint32_t mAddress
Bits 0 - 13: Hardware address.
uint32_t mAdcAmp
Bits 14 - 23: ADC counts.