Project
Loading...
Searching...
No Matches
PHOSEnergyCalibrator.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#ifndef O2_CALIBRATION_PHOSENERGY_CALIBRATOR_H
13#define O2_CALIBRATION_PHOSENERGY_CALIBRATOR_H
14
17
18#include "Framework/Task.h"
26#include "PHOSBase/Geometry.h"
28
29#include <TLorentzVector.h>
30#include <TVector3.h>
31#include <array>
32
33using namespace o2::framework;
34
35namespace o2
36{
37namespace phos
38{
39
40// structure used to store digit info for re-calibration
50// Event header for energy calibraton. Allow accessing external info with vertex position and collision time
53 struct {
56 };
57};
58
60{
61
62 public:
63 static constexpr short kMaxCluInEvent = 128;
64
67
68 ~PHOSEnergySlot() = default;
69
70 void print() const;
71 void fill(const gsl::span<const Cluster>& clusters, const gsl::span<const CluElement>& cluelements, const gsl::span<const TriggerRecord>& cluTR);
72 void fill(const gsl::span<const Cluster>& /*c*/){}; // not used
73 void merge(const PHOSEnergySlot* /*prev*/) {} // not used
74 void clear();
75
76 const ETCalibHistos* getCollectedHistos() const { return mHistos.get(); }
77 const std::vector<uint32_t>& getCollectedDigits() const { return mDigits; }
78
79 void setRunStartTime(long tf) { mRunStartTime = tf; }
80 void setFillDigitsTree(bool toFill) { mFillDigitsTree = toFill; }
81 void setCalibration(const CalibParams* c) { mCalibParams = c; }
82 void setBadMap(const BadChannelsMap* map) { mBadMap = map; }
83 void setCuts(float ptMin, float eminHGTime, float eminLGTime, float eDigMin, float eCluMin)
84 {
85 mPtMin = ptMin;
86 mEminHGTime = eminHGTime;
87 mEminLGTime = eminLGTime;
88 mDigitEmin = eDigMin;
89 mClusterEmin = eCluMin;
90 }
91
92 private:
93 void fillTimeMassHisto(const Cluster& clu, const gsl::span<const CluElement>& cluelements);
94 bool checkCluster(const Cluster& clu);
95 float Nonlinearity(float en);
96
97 long mRunStartTime = 0;
98 std::unique_ptr<RingBuffer> mBuffer;
99 const CalibParams* mCalibParams;
100 const BadChannelsMap* mBadMap;
101 Geometry* mGeom;
102 std::unique_ptr<ETCalibHistos> mHistos;
103 uint32_t mEvBC = 0;
104 uint32_t mEvOrbit = 0;
105 uint32_t mEvent = 0;
106 float mPtMin = 2.;
107 float mEminHGTime = 2.;
108 float mEminLGTime = 6.;
109 float mDigitEmin = 0.005;
110 float mClusterEmin = 0.4;
111 bool mFillDigitsTree = false;
112 std::vector<uint32_t> mDigits;
113};
114
115class PHOSEnergyCalibrator final : public o2::calibration::TimeSlotCalibration<o2::phos::PHOSEnergySlot>
116{
118
119 public:
121
122 bool hasEnoughData(const Slot& slot) const final { return true; } // no need to merge Slots
123 void initOutput() final {}
124 void finalizeSlot(Slot& slot) final;
125 Slot& emplaceNewSlot(bool front, TFType tstart, TFType tend) final;
126 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);
127
128 void endOfStream();
129
130 const ETCalibHistos* getCollectedHistos() const { return mHistos.get(); }
131 void setFillDigitsTree(bool toFill) { mFillDigitsTree = toFill; }
132 void setCalibration(const CalibParams* c) { mCalibParams = c; }
133 void setBadMap(const BadChannelsMap* map) { mBadMap = map; }
134 void setCuts(float ptMin, float eminHGTime, float eminLGTime, float eDigMin, float eCluMin)
135 {
136 mPtMin = ptMin;
137 mEminHGTime = eminHGTime;
138 mEminLGTime = eminLGTime;
139 mDigitEmin = eDigMin;
140 mClusterEmin = eCluMin;
141 }
142
143 private:
144 bool calculateCalibrations();
145
146 private:
147 long mRunStartTime = 0;
148 float mPtMin = 2.;
149 float mEminHGTime = 1.5;
150 float mEminLGTime = 5.5;
151 float mDigitEmin = 0.05;
152 float mClusterEmin = 0.4;
153 const CalibParams* mCalibParams = nullptr;
154 const BadChannelsMap* mBadMap = nullptr;
155 bool mFillDigitsTree = false;
156 std::unique_ptr<ETCalibHistos> mHistos;
157};
158
159} // namespace phos
160} // namespace o2
161
162#endif
unsigned int uint32_t
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to process
uint64_t TFType
uint32_t c
Definition RawData.h:2
Device to collect energy and time PHOS energy and time calibration.
CCDB container for bad (masked) channels in PHOS.
Contains PHOS cluster parameters.
Definition Cluster.h:39
void setCalibration(const CalibParams *c)
void setBadMap(const BadChannelsMap *map)
const ETCalibHistos * getCollectedHistos() const
void setCuts(float ptMin, float eminHGTime, float eminLGTime, float eDigMin, float eCluMin)
Slot & emplaceNewSlot(bool front, TFType tstart, TFType tend) final
bool hasEnoughData(const Slot &slot) const final
static constexpr short kMaxCluInEvent
void setCalibration(const CalibParams *c)
const ETCalibHistos * getCollectedHistos() const
void setCuts(float ptMin, float eminHGTime, float eminLGTime, float eDigMin, float eCluMin)
const std::vector< uint32_t > & getCollectedDigits() const
PHOSEnergySlot()
maximal number of clusters per event to separate digits from them (7 bits in digit map)
void setBadMap(const BadChannelsMap *map)
void fill(const gsl::span< const Cluster > &clusters, const gsl::span< const CluElement > &cluelements, const gsl::span< const TriggerRecord > &cluTR)
void merge(const PHOSEnergySlot *)
void setFillDigitsTree(bool toFill)
void fill(const gsl::span< const Cluster > &)
Defining ITS Vertex explicitly as messageable.
Definition Cartesian.h:288
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::unique_ptr< GPUReconstructionTimeframe > tf
VectorOfTObjectPtrs other
Cluster clu
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.
uint32_t mMarker
Bits 0 - 13: non-existing address to separate events 16383.
uint32_t mBC
Bits 14-32: event BC (16bit in InterationRecord. Orbit (32bit) will be stored in next word)