32 for (
auto&
col : mDigits) {
33 if (
col.deId == deId &&
col.columnId == stripIndex.
column) {
34 col.addStrip(stripIndex.
strip, cathode, stripIndex.
line);
39 mDigits.emplace_back(ColumnData{(uint8_t)deId, (uint8_t)stripIndex.
column});
40 mDigits.back().addStrip(stripIndex.
strip, cathode, stripIndex.
line);
44bool Digitizer::addBPStrips(
double xPos,
double yPos,
int deId,
double prob,
double xOffset)
51 if (!mResponse.
isFired(prob, std::abs(xOffset), 0, deId)) {
55 Mapping::MpStripIndex stripIndex = mMapping.
stripByPosition(xPos + 1.01 * xOffset, yPos, 0, deId,
false);
57 if (!stripIndex.isValid()) {
60 addStrip(stripIndex, 0, deId);
61 MpArea
area = mMapping.
stripByLocation(stripIndex.strip, 0, stripIndex.line, stripIndex.column, deId);
62 std::array<double, 2> dist = {
area.getYmax() - yPos, yPos -
area.getYmin()};
63 addNeighbours(stripIndex, 0, deId, prob, dist, xOffset);
68bool Digitizer::addNeighbours(
const Mapping::MpStripIndex& stripIndex,
int cathode,
int deId,
double prob,
69 const std::array<double, 2>& initialDist,
double xOffset)
73 double xOffset2 = xOffset * xOffset;
74 for (
int idir = 0; idir < 2; ++idir) {
77 double dist = initialDist[idir];
78 Mapping::MpStripIndex neigh = mMapping.
nextStrip(stripIndex, cathode, deId, idir);
79 while (neigh.isValid() && mResponse.
isFired(prob, std::sqrt(dist * dist + xOffset2), cathode, deId)) {
80 addStrip(neigh, cathode, deId);
81 dist += mMapping.
getStripSize(neigh.strip, cathode, neigh.column, deId);
82 neigh = mMapping.
nextStrip(neigh, cathode, deId, idir);
89bool Digitizer::hitToDigits(
const Hit& hit)
97 auto midPt = hit.middlePoint();
98 int deId = hit.GetDetectorID();
99 math_utils::Point3D<double> localPoint = mTransformer.
globalToLocal(deId, (
double)midPt.x(), (
double)midPt.y(), (
double)midPt.z());
102 Mapping::MpStripIndex stripIndex = mMapping.
stripByPosition(localPoint.x(), localPoint.y(), 0, deId);
105 bool isEfficientBP, isEfficientNBP;
106 if (!mEfficiencyResponse.
isEfficient(deId, stripIndex.column, stripIndex.line, isEfficientBP, isEfficientNBP)) {
111 double prob = mRandom(mGenerator);
114 addStrip(stripIndex, 0, deId);
115 MpArea
area = mMapping.
stripByLocation(stripIndex.strip, 0, stripIndex.line, stripIndex.column, deId);
117 std::array<double, 2> dist = {
area.getYmax() - localPoint.y(), localPoint.y() -
area.getYmin()};
118 addNeighbours(stripIndex, 0, deId, prob, dist);
120 addBPStrips(localPoint.x(), localPoint.y(), deId, prob,
area.getXmin() - localPoint.x());
122 addBPStrips(localPoint.x(), localPoint.y(), deId, prob,
area.getXmax() - localPoint.x());
126 if (isEfficientNBP) {
127 stripIndex = mMapping.
stripByPosition(localPoint.x(), localPoint.y(), 1, deId);
128 addStrip(stripIndex, 1, deId);
129 MpArea
area = mMapping.
stripByLocation(stripIndex.strip, 1, stripIndex.line, stripIndex.column, deId);
131 std::array<double, 2> dist = {
area.getXmax() - localPoint.x(), localPoint.x() -
area.getXmin()};
132 addNeighbours(stripIndex, 1, deId, prob, dist);
144 int firstStrip = 0, lastStrip = 0;
146 for (
auto& hit : hits) {
149 for (
auto& digit : mDigits) {
150 digitStore.emplace_back(digit);
151 for (
int icathode = 0; icathode < 2; ++icathode) {
152 if (getLabelLimits(icathode, digit, firstStrip, lastStrip)) {
153 MCLabel label(hit.GetTrackID(), mEventID, mSrcID, digit.deId, digit.columnId, icathode, firstStrip, lastStrip);
162bool Digitizer::getLabelLimits(
int cathode,
const ColumnData&
col,
int& firstStrip,
int& lastStrip)
const
165 int nLines = (cathode == 0) ? 4 : 1;
167 firstStrip = invalid, lastStrip = invalid;
168 for (
int iline = 0; iline < nLines; ++iline) {
169 for (
int istrip = 0; istrip < 16; ++istrip) {
170 if (
col.isStripFired(istrip, cathode, iline)) {
172 if (firstStrip == invalid) {
173 firstStrip = lastStrip;
175 }
else if (firstStrip != invalid) {
180 return (firstStrip != invalid);
bool isEfficient(int deId, int columnId, int line, bool &isEfficientBP, bool &isEfficientNBP)
bool isFired(double prob, double distance, int cathode, int deId, double theta=0.) const
Checks if the strip at a certain distance from the impact point is fired given a probability prob.
void process(const std::vector< Hit > &hits, std::vector< ColumnData > &digitStore, o2::dataformats::MCTruthContainer< MCLabel > &mcContainer)
Digitizer(const ChamberResponse &chamberResponse, const ChamberEfficiencyResponse &efficiencyResponse, const GeometryTransformer &transformer)
static int getStrip(int strip, int line)
Gets the strip.
MpStripIndex stripByPosition(double xPos, double yPos, int cathode, int deId, bool warn=true) const
double getStripSize(int strip, int cathode, int column, int deId) const
MpArea stripByLocation(int strip, int cathode, int line, int column, int deId, bool warn=true) const
MpStripIndex nextStrip(const MpStripIndex &stripIndex, int cathode, int deId, bool descending=false) const
GLuint GLsizei const GLchar * label
Digitizer createDefaultDigitizer()
ChamberEfficiencyResponse createDefaultChamberEfficiencyResponse()
GeometryTransformer createDefaultTransformer()
ChamberResponse createDefaultChamberResponse()
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Defining DataPointCompositeObject explicitly as copiable.
Column data structure for MID.
Indexes required to define a strip in the detection element.
int strip
Line of the local board in the column.
int line
Column in the DE.