LDMX Software
ldmx::HgcrocTrigDigi Class Reference

Contains the trigger output for a single trigger hgcroc channel. More...

#include <HgcrocTrigDigi.h>

Public Member Functions

 HgcrocTrigDigi ()=default
 Default Constructor.
 
 HgcrocTrigDigi (uint32_t tid, uint8_t tp=0)
 Preferred Constructor.
 
virtual ~HgcrocTrigDigi ()=default
 Destructor.
 
bool operator< (const HgcrocTrigDigi &digi)
 Sort the collection to trig digis by the raw ID.
 
uint32_t getId () const
 Get the id of the digi.
 
void setPrimitive (uint8_t tp)
 Set the trigger primitive (7 bits) for the given link on a channel @params[in] tp the value of the trigger primitive.
 
uint8_t getPrimitive () const
 Get the trigger primitive (7 bits) for the given link on a channel.
 
uint32_t linearPrimitive () const
 Get the linearized value of the trigger primitive.
 

Static Public Member Functions

static uint8_t linear2Compressed (uint32_t lin)
 Static conversion from 18b linear -> compressed.
 
static uint32_t compressed2Linear (uint8_t comp)
 Static conversion from compressed -> linear 18b.
 

Private Member Functions

 ClassDef (HgcrocTrigDigi, 2)
 ROOT Dictionary class definition macro.
 

Private Attributes

uint32_t tid_ {0}
 the raw ID for this trigger channel
 
uint8_t tp_ {0}
 the compressed 7bit trigger primitive value for this channel
 

Friends

std::ostream & operator<< (std::ostream &o, const HgcrocTrigDigi &d)
 Stream the input digi.
 
std::ostream & operator<< (std::ostream &o, const HgcrocTrigDigiCollection &c)
 Stream the input digi collection.
 

Detailed Description

Contains the trigger output for a single trigger hgcroc channel.

Definition at line 24 of file HgcrocTrigDigi.h.

Constructor & Destructor Documentation

◆ HgcrocTrigDigi() [1/2]

ldmx::HgcrocTrigDigi::HgcrocTrigDigi ( )
default

Default Constructor.

Needed for ROOT dictionary definition, suggested to not use this constructor.

◆ HgcrocTrigDigi() [2/2]

ldmx::HgcrocTrigDigi::HgcrocTrigDigi ( uint32_t tid,
uint8_t tp = 0 )

Preferred Constructor.

Defines the trigger group ID and the trigger primitive value.

Parameters
[in]tidraw trigger group ID
[in]tptrigger primitive value

Definition at line 8 of file HgcrocTrigDigi.cxx.

8: tid_(tid), tp_{tp} {}
uint32_t tid_
the raw ID for this trigger channel
uint8_t tp_
the compressed 7bit trigger primitive value for this channel

◆ ~HgcrocTrigDigi()

virtual ldmx::HgcrocTrigDigi::~HgcrocTrigDigi ( )
virtualdefault

Destructor.

Needs to be defined for ROOT dictionary definition, does nothing right now.

Member Function Documentation

◆ compressed2Linear()

uint32_t ldmx::HgcrocTrigDigi::compressed2Linear ( uint8_t comp)
static

Static conversion from compressed -> linear 18b.

Parameters
[in]compcompressed 7bit ADC value
Returns
equivalent linearized 18bit ADC value

Definition at line 32 of file HgcrocTrigDigi.cxx.

32 {
33 uint32_t v1 = ((comp & 0x78) == 0)
34 ? (comp)
35 : ((0x8 | (comp & 0x7)) << ((comp >> 3) - 1));
36 uint8_t comp2 = comp + 1;
37 uint32_t v2 = ((comp2 & 0x78) == 0)
38 ? (comp2)
39 : ((0x8 | (comp2 & 0x7)) << ((comp2 >> 3) - 1));
40 return (v1 + v2) / 2;
41}

Referenced by linearPrimitive(), and hcal::HcalTrigPrimDigiProducer::produce().

◆ getId()

uint32_t ldmx::HgcrocTrigDigi::getId ( ) const
inline

Get the id of the digi.

Returns
raw trigger ID

Definition at line 67 of file HgcrocTrigDigi.h.

67{ return tid_; }

References tid_.

Referenced by ldmx::ecal::TrigPrimResolutionAnalyzer::analyze().

◆ getPrimitive()

uint8_t ldmx::HgcrocTrigDigi::getPrimitive ( ) const
inline

Get the trigger primitive (7 bits) for the given link on a channel.

Returns
the value of the trigger primitive

Definition at line 79 of file HgcrocTrigDigi.h.

79{ return tp_; }

References tp_.

Referenced by linearPrimitive().

◆ linear2Compressed()

uint8_t ldmx::HgcrocTrigDigi::linear2Compressed ( uint32_t lin)
static

Static conversion from 18b linear -> compressed.

Parameters
[in]linlinearized 18bit ADC value
Returns
equivalent compressed 7bit ADC value

Definition at line 10 of file HgcrocTrigDigi.cxx.

10 {
11 if (lin >= 0x40000) return 0x7F; // saturation
12 if (lin >= 0x20000) return 0x78 | ((lin >> 14) & 0x7);
13 if (lin >= 0x10000) return 0x70 | ((lin >> 13) & 0x7);
14 if (lin >= 0x8000) return 0x68 | ((lin >> 12) & 0x7);
15 if (lin >= 0x4000) return 0x60 | ((lin >> 11) & 0x7);
16 if (lin >= 0x2000) return 0x58 | ((lin >> 10) & 0x7);
17 if (lin >= 0x1000) return 0x50 | ((lin >> 9) & 0x7);
18 if (lin >= 0x800) return 0x48 | ((lin >> 8) & 0x7);
19 if (lin >= 0x400) return 0x40 | ((lin >> 7) & 0x7);
20 if (lin >= 0x200) return 0x38 | ((lin >> 6) & 0x7);
21 if (lin >= 0x100) return 0x30 | ((lin >> 5) & 0x7);
22 if (lin >= 0x80) return 0x28 | ((lin >> 4) & 0x7);
23 if (lin >= 0x40) return 0x20 | ((lin >> 3) & 0x7);
24 if (lin >= 0x20) return 0x18 | ((lin >> 2) & 0x7);
25 if (lin >= 0x10) return 0x10 | ((lin >> 1) & 0x7);
26 if (lin >= 0x08)
27 return 0x08 | ((lin >> 0) & 0x7);
28 else
29 return lin & 0x7;
30}

Referenced by ldmx::HgcrocTriggerCalculations::compressDigis().

◆ linearPrimitive()

uint32_t ldmx::HgcrocTrigDigi::linearPrimitive ( ) const
inline

Get the linearized value of the trigger primitive.

Returns
the linearized (unpacked) trigger primitive value

Definition at line 85 of file HgcrocTrigDigi.h.

static uint32_t compressed2Linear(uint8_t comp)
Static conversion from compressed -> linear 18b.
uint8_t getPrimitive() const
Get the trigger primitive (7 bits) for the given link on a channel.

References compressed2Linear(), and getPrimitive().

◆ operator<()

bool ldmx::HgcrocTrigDigi::operator< ( const HgcrocTrigDigi & digi)
inline

Sort the collection to trig digis by the raw ID.

Parameters
[in]danother digi to compare against
Returns
true if this ID is less than the other ID

Definition at line 61 of file HgcrocTrigDigi.h.

61{ return tid_ < digi.tid_; }

References tid_.

◆ setPrimitive()

void ldmx::HgcrocTrigDigi::setPrimitive ( uint8_t tp)
inline

Set the trigger primitive (7 bits) for the given link on a channel @params[in] tp the value of the trigger primitive.

Definition at line 73 of file HgcrocTrigDigi.h.

73{ tp_ = tp; }

References tp_.

Friends And Related Symbol Documentation

◆ operator<< [1/2]

std::ostream & operator<< ( std::ostream & o,
const HgcrocTrigDigi & d )
friend

Stream the input digi.

In one line, prints out the ID (in hex), the primitive (in hex), and the linearized primitive (in dec).

Parameters
[in]oostream to write to
[in]ddigi to write out
Returns
modified ostream

Definition at line 43 of file HgcrocTrigDigi.cxx.

43 {
44 s << "HgcrocTrigDigi { " << "(id : 0x" << std::hex << digi.getId() << std::dec
45 << ") ";
46 s << "0x" << std::hex << int(digi.getPrimitive()) << " (" << std::dec
47 << digi.linearPrimitive() << ") } ";
48 return s;
49}

◆ operator<< [2/2]

std::ostream & operator<< ( std::ostream & o,
const HgcrocTrigDigiCollection & c )
friend

Stream the input digi collection.

Prints out each digi member of the collection on a new line.

Parameters
[in]oostream to write to
[in]ccollection to write out
Returns
modified ostream

Definition at line 51 of file HgcrocTrigDigi.cxx.

52 {
53 s << "HgcrocTrigDigiCollection { " << std::endl;
54 for (auto digi : digis) s << " " << digi << std::endl;
55 s << "}";
56 return s;
57}

Member Data Documentation

◆ tid_

uint32_t ldmx::HgcrocTrigDigi::tid_ {0}
private

the raw ID for this trigger channel

Definition at line 131 of file HgcrocTrigDigi.h.

131{0};

Referenced by getId(), and operator<().

◆ tp_

uint8_t ldmx::HgcrocTrigDigi::tp_ {0}
private

the compressed 7bit trigger primitive value for this channel

Definition at line 133 of file HgcrocTrigDigi.h.

133{0};

Referenced by getPrimitive(), and setPrimitive().


The documentation for this class was generated from the following files: