Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions 16 DataFormats/Detectors/CPV/include/DataFormatsCPV/Cluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Cluster

public:
Cluster() = default;
Cluster(char mult, char mod, char exMax, float x, float z, float e) : mMulDigit(mult), mModule(mod), mNExMax(exMax), mLocalPosX(x), mLocalPosZ(z), mEnergy(e) {}
Cluster(unsigned char mult, char mod, char exMax, float x, float z, float e) : mMulDigit(mult), mModule(mod), mNExMax(exMax), mLocalPosX(x), mLocalPosZ(z), mEnergy(e) {}
Cluster(const Cluster& clu) = default;

~Cluster() = default;
Expand Down Expand Up @@ -85,7 +85,7 @@ class Cluster
uint8_t getPackedClusterStatus() const
{
CluStatus s = {0};
s.multiplicity = mMulDigit;
s.multiplicity = std::min(mMulDigit, static_cast<unsigned char>(31)); //5 bits available
s.module = mModule;
s.unfolded = mNExMax > 1;
return s.mBits;
Expand All @@ -107,12 +107,12 @@ class Cluster
}

protected:
char mMulDigit = 0; ///< Digit nultiplicity
char mModule = 0; ///< Module number
char mNExMax = -1; ///< number of (Ex-)maxima before unfolding
float mLocalPosX = 0.; ///< Center of gravity position in local module coordunates (phi direction)
float mLocalPosZ = 0.; ///< Center of gravity position in local module coordunates (z direction)
float mEnergy = 0.; ///< full energy of a cluster
unsigned char mMulDigit = 0; ///< Digit nultiplicity
char mModule = 0; ///< Module number
char mNExMax = -1; ///< number of (Ex-)maxima before unfolding
float mLocalPosX = 0.; ///< Center of gravity position in local module coordunates (phi direction)
float mLocalPosZ = 0.; ///< Center of gravity position in local module coordunates (z direction)
float mEnergy = 0.; ///< full energy of a cluster

ClassDefNV(Cluster, 1);
};
Expand Down
21 changes: 10 additions & 11 deletions 21 DataFormats/Detectors/CPV/include/DataFormatsCPV/Digit.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,8 @@ class Digit : public DigitBase
/// particle in case of MC \return constructed Digit
Digit(unsigned short cell, float amplitude, int label);

/// \brief Digit constructor from Hit
/// \param CPV Hit
/// \return constructed Digit
Digit(const Hit& hit, int label);

~Digit() = default; // override

/// \brief Replace content of this digit with new one, from hit
/// \param CPV Hit
/// \return
void fillFromHit(const Hit& hit);

/// \brief Comparison oparator, based on time and absId
/// \param another CPV Digit
/// \return result of comparison: first time, if time same, then absId
Expand Down Expand Up @@ -89,7 +79,7 @@ class Digit : public DigitBase
bool canAdd(const Digit other) const;
/// \brief if addable, adds energy and list of primaries.
/// \param another CPV Digit
/// \return digit with sum of energies and longer list of primaries
/// \return digit with sum of energies
Digit& operator+=(const Digit& other); //

/// \brief Absolute sell id
Expand All @@ -103,6 +93,15 @@ class Digit : public DigitBase
/// \brief index of entry in MCLabels array
/// \return ndex of entry in MCLabels array
int getLabel() const { return mLabel; }
void setLabel(int l) { mLabel = l; }

//put all parameters to default
void reset()
{
mAbsId = 0;
mLabel = -1;
mAmplitude = 0.;
}

void PrintStream(std::ostream& stream) const;

Expand Down
90 changes: 62 additions & 28 deletions 90 DataFormats/Detectors/CPV/include/DataFormatsCPV/RawFormats.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,43 +17,77 @@ namespace o2
namespace cpv
{

//Pack information into 24 bit words
union PadWord {
uint32_t mDataWord;
struct {
uint32_t charge : 11; ///< Bits 0 - 10 : charge
uint32_t address : 6; ///< Bits 12 - 17 : address (0..47)
uint32_t dilogic : 4; ///< Bits 18 - 21 : dilogic (1..10)
uint32_t row : 6; ///< Bits 22 - 26 : raw (1..24)
uint32_t zero : 1; ///< Bits 27 - 27 : zeroed so we can distinguish it from the EoE
uint32_t charge : 12; ///< Bits 0 - 11 : charge
uint32_t address : 6; ///< Bits 12 - 17 : address (0..47)
uint32_t gas : 3; ///< Bits 18 - 20 : gasiplex (1..10)
uint32_t dil : 2; ///< Bits 21 - 22 : dilogic (1..24)
uint32_t zero : 1; ///< Bits 23 - 23 : zeroed
};
char bytes[4];
};

union EoEWord {
uint32_t mDataWord;
struct {
uint32_t nword : 7; ///< Bits 0 - 6 : word counter (0...47)
uint32_t en : 11; ///< Bits 7 - 17 : event number -- not used
uint32_t dilogic : 4; ///< Bits 18 - 21 : dilogic (1..10)
uint32_t row : 6; ///< Bits 22 - 26 : raw (1..24)
uint32_t checkbit : 1; ///< Bits 27 - 27 : bit 27 is always 1 by definition of EoE
};
};
class cpvword
{
public:
cpvword() = default;
cpvword(std::vector<char>::const_iterator b, std::vector<char>::const_iterator e)
{ //Reading
//resposibility of coller to esure that
//array will not end while reading
for (int i = 0; i < 16 && b != e; i++, b++) {
bytes[i] = *b;
}
}
~cpvword() = default;
bool isOK() const
{
return (bytes[9] < static_cast<unsigned char>(24)) &&
(bytes[15] == 0) && (bytes[14] == 0) && (bytes[13] == 0) && (bytes[12] == 0) && (bytes[11] == 0) && (bytes[10] == 0);
}
short ccId() const { return short(bytes[9]); }
uint32_t cpvPadWord(int i) const
{
PadWord p = {0};
p.bytes[0] = bytes[3 * i];
p.bytes[1] = bytes[3 * i + 1];
p.bytes[2] = bytes[3 * i + 2];
return p.mDataWord;
}

union SegMarkerWord {
uint32_t mDataWord;
struct {
uint32_t row : 8; ///< Bits 0 - 7 : segment 0,1,2 charge
uint32_t nwords : 12; ///< Bits 8 - 19 : number of words in the segment
uint32_t marker : 12; ///< Bits 20 - 31: ab0 the segment marker word
};
public:
unsigned char bytes[16] = {0};
};

union RowMarkerWord {
uint32_t mDataWord;
struct {
uint32_t marker : 16; ///< Bits 0,15); //the marker word
uint32_t nwords : 16; ///< Bits 16 - 31 : number of words written after row marker (digits and EoE)
};
class cpvtrailer
{
public:
cpvtrailer() = default;
cpvtrailer(std::vector<char>::const_iterator b, std::vector<char>::const_iterator e)
{ //reading
for (int i = 0; i < 16 && b != e; i++, b++) {
bytes[i] = *b;
}
}
cpvtrailer(unsigned short wordCounter)
{ //writing
for (int i = 10; i < 16; i++) {
bytes[i] = 0;
}
bytes[9] = char(0xf0);
bytes[1] = (wordCounter & 0xff00) >> 8;
bytes[0] = (wordCounter & 0x00ff);
}
~cpvtrailer() = default;
bool isOK() const { return (bytes[9] == 0xf0) && (bytes[10] == 0) && (bytes[11] == 0) && (bytes[12] == 0) && (bytes[13] == 0) && (bytes[14] == 0) && (bytes[15] == 0); }
short status() const { return short(bytes[8]); }
unsigned short wordCounter() const { return bytes[0] + (bytes[1] << 8); }

public:
unsigned char bytes[16] = {0};
};

} // namespace cpv
Expand Down
9 changes: 0 additions & 9 deletions 9 DataFormats/Detectors/CPV/src/Digit.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,6 @@ Digit::Digit(unsigned short absId, float amplitude, int label)
: DigitBase(0), mAmplitude(amplitude), mAbsId(absId), mLabel(label)
{
}
Digit::Digit(const Hit& hit, int label) : mAbsId(hit.GetDetectorID()), mAmplitude(hit.GetEnergyLoss()), mLabel(label)
{
}
void Digit::fillFromHit(const Hit& hit)
{
mAbsId = hit.GetDetectorID();
mAmplitude = hit.GetEnergyLoss();
}

bool Digit::canAdd(const Digit other) const
{
return (mAbsId == other.getAbsId() && fabs(getTimeStamp() - other.getTimeStamp()) <= kTimeGate);
Expand Down
12 changes: 12 additions & 0 deletions 12 DataFormats/Detectors/PHOS/include/DataFormatsPHOS/Digit.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ class Digit : public DigitBase
/// \return digit with sum of energies and longer list of primaries
Digit& operator+=(const Digit& other); //

void addEnergyTime(float energy, float time);

/// \brief Absolute sell id
short getAbsId() const { return mAbsId; }
void setAbsId(short cellId) { mAbsId = cellId; }
Expand All @@ -111,6 +113,16 @@ class Digit : public DigitBase
/// \brief index of entry in MCLabels array
/// \return ndex of entry in MCLabels array
int getLabel() const { return mLabel; }
void setLabel(int l) { mLabel = l; }

void reset()
{
mIsHighGain = true;
mAbsId = 0;
mLabel = -1;
mAmplitude = 0;
mTime = 0;
}

void PrintStream(std::ostream& stream) const;

Expand Down
9 changes: 9 additions & 0 deletions 9 DataFormats/Detectors/PHOS/src/Digit.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ Digit& Digit::operator+=(const Digit& other)

return *this;
}
void Digit::addEnergyTime(float energy, float time)
{
// Adds the amplitude of digits
// TODO: What about time? Should we assign time of more energetic digit? More complicated treatment?
if (mAmplitude < energy) {
mTime = time;
}
mAmplitude += energy;
}

void Digit::PrintStream(std::ostream& stream) const
{
Expand Down
18 changes: 15 additions & 3 deletions 18 Detectors/CPV/base/include/CPVBase/Geometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ class Geometry
static constexpr float kCPVPadSizeZ = 2.1093;
//for hwaddress
static constexpr short kNPAD = 48;
static constexpr short kNDilogic = 10;
static constexpr short kNDilogic = 4;
static constexpr short kNGas = 5;
static constexpr short kNRow = 16;
static constexpr short kNMod = 4;

Expand Down Expand Up @@ -87,15 +88,26 @@ class Geometry
static void absIdToRelPosInModule(unsigned short absId, float& x, float& z);
static bool relToAbsNumbering(const short* relId, unsigned short& absId);

static void hwaddressToAbsId(short ddl, short row, short dilogic, short hw, unsigned short& absId);
static void absIdToHWaddress(unsigned short absId, short& ddl, short& row, short& dilogic, short& hw);
static void hwaddressToAbsId(short ccId, short dil, short gas, short pad, unsigned short& absId);
static void absIdToHWaddress(unsigned short absId, short& ccId, short& dil, short& gas, short& pad);

static unsigned short getTotalNPads() { return kNCHANNELS; }
static bool IsPadExists(unsigned short absId)
{
return absId >= 0 && absId < getTotalNPads();
} // TODO: evaluate from real geometry

//Pad map per 3Gassiplex
//Fixed mapping
static constexpr short mPadMap[6][8] = {11, 9, 7, 17, 47, 43, 41, 39,
15, 13, 5, 23, 45, 37, 35, 33,
14, 12, 4, 25, 46, 38, 34, 32,
10, 6, 2, 27, 21, 16, 40, 36,
8, 1, 0, 28, 24, 20, 18, 42,
3, 31, 30, 29, 26, 22, 19, 44};
static constexpr short mPadToZ[48] = {4, 4, 3, 5, 2, 1, 3, 0, 4, 0, 3, 0, 2, 1, 2, 1, 3, 0, 4, 5, 4, 3, 5, 1, 4, 2, 5, 3, 4, 5, 5, 5, 2, 1, 2, 1, 3, 1, 2, 0, 3, 0, 4, 0, 5, 1, 2, 0};
static constexpr short mPadToPhi[48] = {2, 1, 2, 0, 2, 2, 1, 2, 0, 1, 0, 0, 1, 1, 0, 0, 5, 3, 6, 6, 5, 4, 5, 3, 4, 3, 4, 3, 3, 3, 2, 1, 7, 7, 6, 6, 7, 5, 5, 7, 6, 6, 7, 5, 7, 4, 4, 4};

ClassDefNV(Geometry, 1);
};
} // namespace cpv
Expand Down
62 changes: 31 additions & 31 deletions 62 Detectors/CPV/base/src/Geometry.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -101,52 +101,52 @@ bool Geometry::relToAbsNumbering(const short* relId, unsigned short& absId)

return true;
}
void Geometry::hwaddressToAbsId(short /*ddl*/, short row, short dilog, short hw, unsigned short& absId)
void Geometry::hwaddressToAbsId(short ccId, short dil, short gas, short pad, unsigned short& absId)
{
short mod = row / 16;
row = row % 16;
short relid[3] = {short(mod + 2), short(8 * row + hw % 8), short(6 * dilog + hw / 8)};

short pZ = mPadToZ[pad];
short pPhi = mPadToPhi[pad];
short relid[3] = {short(ccId / 8 + 2), short((ccId % 8) * 16 + (dil / 2) * 8 + 7 - pPhi), short((dil % 2) * 30 + gas * 6 + pZ)};

relToAbsNumbering(relid, absId);
}

void Geometry::absIdToHWaddress(unsigned short absId, short& mod, short& row, short& dilogic, short& hw)
void Geometry::absIdToHWaddress(unsigned short absId, short& ccId, short& dil, short& gas, short& pad)
{
// Convert absId to hw address
// Arguments: w32,mod,row,dilogic,address where to write the results
// return row in range 0...47, packing rows from all modules in common numeration
// Arguments: ccId: 0 -- 7 - mod 2; 8...15 mod 3; 16...23 mod 4
//dilogic: 0..3, gas=0..5, pad:0..47

short relid[3];
absToRelNumbering(absId, relid);

mod = relid[0]; // DDL# 2..4
row = relid[1] / 8; // row# 0..16
dilogic = relid[2] / 6; // Dilogic# 0..10
hw = relid[1] % 8 + 8 * (relid[2] % 6); // Address 0..47

if (hw < 0 || hw > kNPAD) {
LOG(ERROR) << "Wrong hw address: hw=" << hw << " > kNPAD=" << kNPAD;
hw = 0;
dilogic = 0;
row = 0;
mod = 0;
ccId = (relid[0] - 2) * 8 + relid[1] / 16;
dil = 2 * ((relid[1] % 16) / 8) + relid[2] / 30; // Dilogic# 0..3
gas = (relid[2] % 30) / 6; // gasiplex# 0..4
pad = mPadMap[relid[2] % 6][7 - relid[1] % 8]; // pad 0..47

if (pad < 0 || pad > kNPAD) {
LOG(ERROR) << "Wrong pad address: pad=" << pad << " > kNPAD=" << kNPAD;
pad = 0;
dil = 0;
gas = 0;
ccId = 0;
return;
}
if (dilogic < 0 || dilogic > kNDilogic) {
LOG(ERROR) << "Wrong dilogic address: dilogic=" << dilogic << " > kNDilogic=" << kNDilogic;
hw = 0;
dilogic = 0;
row = 0;
mod = 0;
if (dil < 0 || dil >= kNDilogic) {
LOG(ERROR) << "Wrong dil address: dil=" << dil << " > kNDilogic=" << kNDilogic;
pad = 0;
dil = 0;
gas = 0;
ccId = 0;
return;
}
if (row < 0 || row > kNRow) {
LOG(ERROR) << "Wrong row address: row=" << row << " > kNRow=" << kNRow;
hw = 0;
dilogic = 0;
row = 0;
mod = 0;
if (gas < 0 || gas >= kNGas) {
LOG(ERROR) << "Wrong gasiplex address: gas=" << gas << " > kNGas=" << kNGas;
pad = 0;
dil = 0;
gas = 0;
ccId = 0;
return;
}
row += (mod - 2) * 16;
}
2 changes: 1 addition & 1 deletion 2 Detectors/CPV/calib/include/CPVCalib/BadChannelMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class BadChannelMap
void PrintStream(std::ostream& stream) const;

private:
static constexpr unsigned short NCHANNELS = 30720; ///< Number of channels in modules 1-4 starting from 0 (4*128*60)
static constexpr unsigned short NCHANNELS = 23040; ///< Number of channels in modules 2-4 starting from 0 (3*128*60)
std::bitset<NCHANNELS> mBadCells; ///< Container for bad cells, 1 means bad sell

ClassDefNV(BadChannelMap, 1);
Expand Down
4 changes: 2 additions & 2 deletions 4 Detectors/CPV/calib/include/CPVCalib/CalibParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ class CalibParams
bool setGain(TH2* h, short module);

private:
static constexpr short NCHANNELS = 28673; ///< Number of channels starting from 1
static constexpr short NCHANNELS = 23040; ///< Number of channels starting from 0
std::array<float, NCHANNELS> mGainCalib; ///< Container for the gain calibration coefficients
ClassDefNV(CalibParams, 1);
ClassDefNV(CalibParams, 2);
};

} // namespace cpv
Expand Down
2 changes: 1 addition & 1 deletion 2 Detectors/CPV/calib/src/CalibParams.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ CalibParams::CalibParams(short /*dummy*/)
bool CalibParams::setGain(TH2* h, short module)
{
const short MAXX = 128,
MAXZ = 56;
MAXZ = 60;
if (!h) {
LOG(ERROR) << "no input histogam";
return false;
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.