Skip to content
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
93 changes: 49 additions & 44 deletions DataFormats/DTDigi/interface/DTDigi.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,67 +14,72 @@

#include <cstdint>

class DTDigi {
public:
// typedef uint32_t ChannelType;
namespace io_v1 {
class DTDigi {
public:
// typedef uint32_t ChannelType;

/// Construct from the wire#, the TDC counts and the digi number.
/// number should identify uniquely multiple digis in the same cell.
explicit DTDigi(int wire, int nTDC, int number = 0, int base = 32);
/// Construct from the wire#, the TDC counts and the digi number.
/// number should identify uniquely multiple digis in the same cell.
explicit DTDigi(int wire, int nTDC, int number = 0, int base = 32);

// Construct from the wire#, the time (ns) and the digi number.
// time is converted in TDC counts (1 TDC = 25./base ns)
// number should identify uniquely multiple digis in the same cell.
explicit DTDigi(int wire, double tdrift, int number = 0, int base = 32);
// Construct from the wire#, the time (ns) and the digi number.
// time is converted in TDC counts (1 TDC = 25./base ns)
// number should identify uniquely multiple digis in the same cell.
explicit DTDigi(int wire, double tdrift, int number = 0, int base = 32);

// Construct from channel and counts.
// explicit DTDigi (ChannelType channel, int nTDC);
// Construct from channel and counts.
// explicit DTDigi (ChannelType channel, int nTDC);

/// Default construction.
DTDigi();
/// Default construction.
DTDigi();

/// Digis are equal if they are on the same cell and have same TDC count
bool operator==(const DTDigi& digi) const;
/// Digis are equal if they are on the same cell and have same TDC count
bool operator==(const DTDigi& digi) const;

// The channel identifier and the digi number packed together
// ChannelType channel() const ;
// The channel identifier and the digi number packed together
// ChannelType channel() const ;

/// Return wire number
int wire() const;
/// Return wire number
int wire() const;

/// Identifies different digis within the same cell
int number() const;
/// Identifies different digis within the same cell
int number() const;

/// Get time in ns
double time() const;
/// Get time in ns
double time() const;

/// Get raw TDC count
int32_t countsTDC() const;
/// Get raw TDC count
int32_t countsTDC() const;

/// Get the TDC unit value in ns
double tdcUnit() const;
/// Get the TDC unit value in ns
double tdcUnit() const;

/// Get the TDC base (counts per BX)
int tdcBase() const;
/// Get the TDC base (counts per BX)
int tdcBase() const;

/// Print content of digi
void print() const;
/// Print content of digi
void print() const;

private:
friend class testDTDigis;
private:
friend class testDTDigis;

// The value of one TDC count in ns
static const double reso;
// The value of one TDC count in ns
static const double reso;

int32_t theCounts; // TDC count, in units given by 1/theTDCBase
uint16_t theWire; // channel number
uint8_t theNumber; // counter for digis in the same cell
uint8_t theTDCBase; // TDC base (counts per BX; 32 in Ph1 or 30 in Ph2)
};
int32_t theCounts; // TDC count, in units given by 1/theTDCBase
uint16_t theWire; // channel number
uint8_t theNumber; // counter for digis in the same cell
uint8_t theTDCBase; // TDC base (counts per BX; 32 in Ph1 or 30 in Ph2)
};
} // namespace io_v1
using DTDigi = io_v1::DTDigi;

#include <iostream>
#include <cstdint>
inline std::ostream& operator<<(std::ostream& o, const DTDigi& digi) {
return o << " " << digi.wire() << " " << digi.time() << " " << digi.number();
}
namespace io_v1 {
inline std::ostream& operator<<(std::ostream& o, const DTDigi& digi) {
return o << " " << digi.wire() << " " << digi.time() << " " << digi.number();
}
} // namespace io_v1
#endif
5 changes: 4 additions & 1 deletion DataFormats/DTDigi/interface/DTDigiFwd.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#ifndef DataFormats_DTDigi_DTDigiFwd_h
#define DataFormats_DTDigi_DTDigiFwd_h

class DTDigi;
namespace io_v1 {
class DTDigi;
}
using DTDigi = io_v1::DTDigi;

#endif
67 changes: 35 additions & 32 deletions DataFormats/DTDigi/interface/DTuROSControlData.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,60 +100,63 @@ class DTuROSROSData {
std::vector<int> error_;
};

class DTuROSFEDData {
public:
/// Constructor
DTuROSFEDData() : header1_(0), header2_(0), trailer_(0), fed_(-1), nslots_(0), evtLgth_(0) {
for (int i = 0; i < DOCESLOTS; i++)
rsize_[i] = 0;
}
namespace io_v1 {
class DTuROSFEDData {
public:
/// Constructor
DTuROSFEDData() : header1_(0), header2_(0), trailer_(0), fed_(-1), nslots_(0), evtLgth_(0) {
for (int i = 0; i < DOCESLOTS; i++)
rsize_[i] = 0;
}

/// Destructor
~DTuROSFEDData() {}
/// Destructor
~DTuROSFEDData() {}

void setfed(int fed) { fed_ = fed; }
void setfed(int fed) { fed_ = fed; }

void setheader1(long dword) { header1_ = dword; }
void setheader1(long dword) { header1_ = dword; }

void setheader2(long dword) { header2_ = dword; }
void setheader2(long dword) { header2_ = dword; }

void settrailer(long dword) { trailer_ = dword; }
void settrailer(long dword) { trailer_ = dword; }

void setnslots(int nslots) { nslots_ = nslots; }
void setnslots(int nslots) { nslots_ = nslots; }

void setevtlgth(int evtLgth) { evtLgth_ = evtLgth; }
void setevtlgth(int evtLgth) { evtLgth_ = evtLgth; }

void setslotsize(int slot, int size) { rsize_[slot - 1] = size; }
void setslotsize(int slot, int size) { rsize_[slot - 1] = size; }

void setuROS(int slot, DTuROSROSData rwords) { rdata_[slot - 1] = rwords; }
void setuROS(int slot, DTuROSROSData rwords) { rdata_[slot - 1] = rwords; }

int getfed() const { return fed_; }
int getfed() const { return fed_; }

long getheader1() const { return header1_; }
long getheader1() const { return header1_; }

long getheader2() const { return header2_; }
long getheader2() const { return header2_; }

long gettrailer() const { return trailer_; }
long gettrailer() const { return trailer_; }

int getnslots() const { return nslots_; }
int getnslots() const { return nslots_; }

int getevtlgth() const { return evtLgth_; }
int getevtlgth() const { return evtLgth_; }

int getslotsize(int slot) const { return rsize_[slot - 1]; }
int getslotsize(int slot) const { return rsize_[slot - 1]; }

int getBXId() const { return (getheader1() >> 20) & 0xFFF; }
int getBXId() const { return (getheader1() >> 20) & 0xFFF; }

int getTTS() const { return (gettrailer() >> 4) & 0xF; }
int getTTS() const { return (gettrailer() >> 4) & 0xF; }

DTuROSROSData getuROS(int slot) const { return rdata_[slot - 1]; }
DTuROSROSData getuROS(int slot) const { return rdata_[slot - 1]; }

private:
long header1_, header2_, trailer_;
private:
long header1_, header2_, trailer_;

int fed_, nslots_, evtLgth_, rsize_[DOCESLOTS];
int fed_, nslots_, evtLgth_, rsize_[DOCESLOTS];

DTuROSROSData rdata_[DOCESLOTS];
};
DTuROSROSData rdata_[DOCESLOTS];
};
} // namespace io_v1
using DTuROSFEDData = io_v1::DTuROSFEDData;

typedef std::vector<DTuROSFEDData> DTuROSFEDDataCollection;
#endif
5 changes: 4 additions & 1 deletion DataFormats/DTDigi/interface/DTuROSFEDDataFwd.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#ifndef DataFormats_DTDigi_DTuROSFEDDataFwd_h
#define DataFormats_DTDigi_DTuROSFEDDataFwd_h

class DTuROSFEDData;
namespace io_v1 {
class DTuROSFEDData;
}
using DTuROSFEDData = io_v1::DTuROSFEDData;

#endif
58 changes: 30 additions & 28 deletions DataFormats/DTDigi/src/DTDigi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,45 @@

using namespace std;

DTDigi::DTDigi(int wire, int nTDC, int number, int base)
: theCounts(nTDC), theWire(wire), theNumber(number), theTDCBase(base) {
if (number > 255 || number < 0 || !(base == 30 || base == 32)) {
throw cms::Exception("BadConfig") << "DTDigi ctor: invalid parameters: number: " << number << " base: " << base;
namespace io_v1 {
DTDigi::DTDigi(int wire, int nTDC, int number, int base)
: theCounts(nTDC), theWire(wire), theNumber(number), theTDCBase(base) {
if (number > 255 || number < 0 || !(base == 30 || base == 32)) {
throw cms::Exception("BadConfig") << "DTDigi ctor: invalid parameters: number: " << number << " base: " << base;
}
}
}

DTDigi::DTDigi(int wire, double tdrift, int number, int base)
: theCounts(static_cast<int>(tdrift / 25. * base)), theWire(wire), theNumber(number), theTDCBase(base) {
if (number > 255 || number < 0 || !(base == 30 || base == 32)) {
throw cms::Exception("BadConfig") << "DTDigi ctor: invalid parameters: number: " << number << " base: " << base;
DTDigi::DTDigi(int wire, double tdrift, int number, int base)
: theCounts(static_cast<int>(tdrift / 25. * base)), theWire(wire), theNumber(number), theTDCBase(base) {
if (number > 255 || number < 0 || !(base == 30 || base == 32)) {
throw cms::Exception("BadConfig") << "DTDigi ctor: invalid parameters: number: " << number << " base: " << base;
}
}
}

DTDigi::DTDigi() : theCounts(0), theWire(0), theNumber(0), theTDCBase(32) {}
DTDigi::DTDigi() : theCounts(0), theWire(0), theNumber(0), theTDCBase(32) {}

// Comparison
bool DTDigi::operator==(const DTDigi& digi) const {
if (theWire != digi.wire() ||
// theNumber != digi.number() || //FIXME required ??
theCounts != digi.countsTDC())
return false;
return true;
}
// Comparison
bool DTDigi::operator==(const DTDigi& digi) const {
if (theWire != digi.wire() ||
// theNumber != digi.number() || //FIXME required ??
theCounts != digi.countsTDC())
return false;
return true;
}

double DTDigi::time() const { return theCounts * 25. / theTDCBase; }
double DTDigi::time() const { return theCounts * 25. / theTDCBase; }

int32_t DTDigi::countsTDC() const { return theCounts; }
int32_t DTDigi::countsTDC() const { return theCounts; }

int DTDigi::wire() const { return theWire; }
int DTDigi::wire() const { return theWire; }

int DTDigi::number() const { return theNumber; }
int DTDigi::number() const { return theNumber; }

double DTDigi::tdcUnit() const { return 25. / theTDCBase; }
double DTDigi::tdcUnit() const { return 25. / theTDCBase; }

int DTDigi::tdcBase() const { return theTDCBase; }
int DTDigi::tdcBase() const { return theTDCBase; }

void DTDigi::print() const {
cout << "Wire " << wire() << " Digi # " << number() << " Drift time (ns) " << time() << endl;
}
void DTDigi::print() const {
cout << "Wire " << wire() << " Digi # " << number() << " Drift time (ns) " << time() << endl;
}
} // namespace io_v1
25 changes: 12 additions & 13 deletions DataFormats/DTDigi/src/classes_def.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<lcgdict>
<class name="DTDigi" ClassVersion="11">
<version ClassVersion="11" checksum="1984707097"/>
<version ClassVersion="10" checksum="942813146"/>
</class>
<class name="std::vector<DTDigi>"/>
<class name="std::map<DTLayerId,std::vector<DTDigi> >"/>
<class name="std::pair<DTLayerId,std::vector<DTDigi> >"/>
<class name="MuonDigiCollection<DTLayerId,DTDigi>"/>
<class name="edm::Wrapper<MuonDigiCollection<DTLayerId,DTDigi>>" splitLevel="0"/>
<class name="io_v1::DTDigi" ClassVersion="3">
<version ClassVersion="3" checksum="2407977881"/>
</class>
<class name="std::vector<io_v1::DTDigi>"/>
<class name="std::map<DTLayerId,std::vector<io_v1::DTDigi> >"/>
<class name="std::pair<DTLayerId,std::vector<io_v1::DTDigi> >"/>
<class name="MuonDigiCollection<DTLayerId,io_v1::DTDigi>"/>
<class name="edm::Wrapper<MuonDigiCollection<DTLayerId,io_v1::DTDigi>>" splitLevel="0"/>

<class name="DTLocalTrigger" ClassVersion="10">
<version ClassVersion="10" checksum="3765470897"/>
Expand All @@ -22,11 +21,11 @@
<version ClassVersion="3" checksum="3011150516"/>
</class>

<class name="DTuROSFEDData" ClassVersion="3">
<version ClassVersion="3" checksum="3629689818"/>
<class name="io_v1::DTuROSFEDData" ClassVersion="3">
<version ClassVersion="3" checksum="882877530"/>
</class>
<class name="std::vector<DTuROSFEDData>"/>
<class name="edm::Wrapper<std::vector<DTuROSFEDData>>" splitLevel="0"/>
<class name="std::vector<io_v1::DTuROSFEDData>"/>
<class name="edm::Wrapper<std::vector<io_v1::DTuROSFEDData>>" splitLevel="0"/>

<class name="DTDDUData" ClassVersion="10">
<version ClassVersion="10" checksum="3247221019"/>
Expand Down
Loading