ATLAS Offline Software
Loading...
Searching...
No Matches
LArRodEncoder Class Reference

This class provides conversion from LArRawChannel and LArDigit to ROD format. More...

#include <LArRodEncoder.h>

Collaboration diagram for LArRodEncoder:

Classes

struct  FebData_t

Public Member Functions

 LArRodEncoder (const LArOnlineID &onlineHelper, const CaloDetDescrManager &calodd, const LArOnOffIdMapping &onOffIdMapping, LArRodBlockStructure *BlStruct)
 ~LArRodEncoder ()
void add (const LArRawChannel *rc)
void add (const LArDigit *digit)
void add (const LArDigit *dg, const int gain)
void add (const LArCalibDigit *dg, const int gain)
void clear ()
void fillROD (std::vector< uint32_t > &v, MsgStream &logstr, const CaloNoise &noise, double nsigma)

Private Attributes

std::map< uint32_t, FebData_tm_mFEB
const LArOnlineIDm_onlineHelper
const CaloDetDescrManagerm_CaloDetDescrManager
const LArOnOffIdMappingm_onOffIdMapping
LArRodBlockStructurem_BlStruct

Detailed Description

This class provides conversion from LArRawChannel and LArDigit to ROD format.

Author
H. Ma
Version
0-0-1 , Oct 7, 2002

Modified, Jan 02, 2003 Split from LArROD_Decoder.

Modified, Jul 08 2003 Walter Lampl Read ByteStream for LArDigits and LArRawChannel

Modified, Jul 17 2003 Remi Lafaye Split with LArRODBlockStructure

  • LArROD_Encoder = Athena world only
  • LArRODBlockStructure = ROD format only It might be less CPU efficient Althought it will be easier to update

Modified, Nov 10 2005 D.O. Damazio New LArRodBlockPhysics (Bertrand Laforge format).

Definition at line 50 of file LArRodEncoder.h.

Constructor & Destructor Documentation

◆ LArRodEncoder()

LArRodEncoder::LArRodEncoder ( const LArOnlineID & onlineHelper,
const CaloDetDescrManager & calodd,
const LArOnOffIdMapping & onOffIdMapping,
LArRodBlockStructure * BlStruct )

Definition at line 19 of file LArRodEncoder.cxx.

23 : m_onlineHelper (onlineHelper),
24 m_CaloDetDescrManager (calodd),
25 m_onOffIdMapping (onOffIdMapping),
26 m_BlStruct (BlStruct)
27{
28}
const LArOnlineID & m_onlineHelper
const CaloDetDescrManager & m_CaloDetDescrManager
LArRodBlockStructure * m_BlStruct
const LArOnOffIdMapping & m_onOffIdMapping

◆ ~LArRodEncoder()

LArRodEncoder::~LArRodEncoder ( )

Definition at line 31 of file LArRodEncoder.cxx.

32{
33 clear();
34}

Member Function Documentation

◆ add() [1/4]

void LArRodEncoder::add ( const LArCalibDigit * dg,
const int gain )

Definition at line 64 of file LArRodEncoder.cxx.

65{
66 uint32_t FEB_ID = (m_onlineHelper.feb_Id(dg->hardwareID()).get_identifier32().get_compact());
67 m_mFEB[FEB_ID].vLArCalibDigit[gain].push_back(dg);
68}
std::map< uint32_t, FebData_t > m_mFEB
setEventNumber uint32_t

◆ add() [2/4]

void LArRodEncoder::add ( const LArDigit * dg,
const int gain )

Definition at line 56 of file LArRodEncoder.cxx.

57{
58 uint32_t FEB_ID = (m_onlineHelper.feb_Id(dg->hardwareID()).get_identifier32().get_compact());
59 m_mFEB[FEB_ID].vLArDigitFixed[gain].push_back(dg);
60}

◆ add() [3/4]

void LArRodEncoder::add ( const LArDigit * digit)

Definition at line 48 of file LArRodEncoder.cxx.

49{
50 uint32_t FEB_ID = (m_onlineHelper.feb_Id(dg->hardwareID()).get_identifier32().get_compact());
51 m_mFEB[FEB_ID].vLArDigit.push_back(dg);
52}

◆ add() [4/4]

void LArRodEncoder::add ( const LArRawChannel * rc)

Definition at line 37 of file LArRodEncoder.cxx.

38{
39 uint32_t FEB_ID = (m_onlineHelper.feb_Id(rc->channelID()).get_identifier32().get_compact());
40 if ( m_mFEB[FEB_ID].vLArRC.empty() ){
41 m_mFEB[FEB_ID].vLArRC.resize(128,0);
42 }
43 uint32_t chan = m_BlStruct->FebToRodChannel(m_onlineHelper.channel( rc->channelID() ) );
44 m_mFEB[FEB_ID].vLArRC[chan]=rc;
45}
static Double_t rc

◆ clear()

void LArRodEncoder::clear ( )

Definition at line 71 of file LArRodEncoder.cxx.

72{
73 m_mFEB.clear();
74}

◆ fillROD()

void LArRodEncoder::fillROD ( std::vector< uint32_t > & v,
MsgStream & logstr,
const CaloNoise & noise,
double nsigma )

Definition at line 79 of file LArRodEncoder.cxx.

80{
81 if (!m_BlStruct)
82 {
83 logstr << MSG::ERROR << "No LArRodBlockStructure defined! Can't encode fragment!" << endmsg;
84 return;
85 }
86 m_BlStruct->initializeFragment(v); //Makes new Fragment or splits v into existing Feb-Blocks
87 std::map<uint32_t,FebData_t>::iterator it=m_mFEB.begin();
88 std::map<uint32_t,FebData_t>::iterator it_end=m_mFEB.end();
89 // The sort alorithm for the vectors inside the data object of the map fails
90 // when I use const_iterator at this point. Don't ask me why
91 for(;it!=it_end;++it) {
92 m_BlStruct->initializeFEB(it->first); // Set FEB id
93 // ************* Energy Block *************
94 if (m_BlStruct->canSetEnergy() && it->second.vLArRC.size()>0) {
95 // compute Ex, Ey for this FEB : initialisation phase
96 {
97 double Ex=0;
98 double Ey=0;
99 double Ez=0;
100 double SumE=0;
101 Identifier myofflineID;
102
103 for (const LArRawChannel *theChannel : it->second.vLArRC) {
104 if ( theChannel != nullptr ){
105 int cId = m_onlineHelper.channel(theChannel->hardwareID());
106
107 int e=theChannel->energy();
108 uint32_t quality = theChannel->quality();
109 m_BlStruct->setNextEnergy(cId,e, theChannel->time(),
110 quality,theChannel->gain());
111
112 // you convert from hardwareID to offline channle ID hash (???)
113 myofflineID = m_onOffIdMapping.cnvToIdentifier(theChannel->hardwareID()) ;
114 const CaloDetDescrElement* caloDDE = m_CaloDetDescrManager.get_element(myofflineID);
115 // This is probably NOT what one wants. You want the cell gain!
116 double cellnoise = noise.getNoise(myofflineID,theChannel->gain());
117 if( e > (nsigma*cellnoise) && (quality != 65535 ) ){
118 double aux=caloDDE->sinTh();
119 double aux_z=tanh(caloDDE->eta());
120 Ex += e*aux*caloDDE->cosPhi();
121 Ey += e*aux*caloDDE->sinPhi();
122 Ez += e*aux_z;
123 SumE += e;
124 }
125 } // End of if to check for the LArRawChannel existence
126 } // end of chit loop
127 // Set after the loop finishes
128 m_BlStruct->setEx(Ex);
129 m_BlStruct->setEy(Ey);
130 m_BlStruct->setEz(Ez);
131 m_BlStruct->setSumE(SumE);
132 }
133 }//End canSetEnergy
134 // try to include samples together with data
135 if (m_BlStruct->canIncludeRawData() && it->second.vLArDigit.size()>0) {
136 // Order channels according to ROD numbering
137 m_BlStruct->sortDataVector(it->second.vLArDigit);
138 for (const LArDigit* digit : it->second.vLArDigit) {
139 int cId = m_onlineHelper.channel(digit->hardwareID());
140 m_BlStruct->setRawData(cId, digit->samples(), digit->gain());
141 } // end of for digits
142 } // End of can Include Raw Data check
143 // ************** Raw Data Block ***********
144 if (m_BlStruct->canSetRawData() && it->second.vLArDigit.size()>0) {
145 m_BlStruct->sortDataVector(it->second.vLArDigit);
146 std::vector<const LArDigit*>::const_iterator digit_it = it->second.vLArDigit.begin();
147 std::vector<const LArDigit*>::const_iterator digit_it_end=it->second.vLArDigit.end();
148 if(digit_it!=digit_it_end) { //Container not empty
149 m_BlStruct->setNumberOfSamples((*digit_it)->samples().size());
150 for (;digit_it!=digit_it_end;++digit_it) {
151 int cId = m_onlineHelper.channel((*digit_it)->hardwareID());
152 m_BlStruct->setRawData(cId, (*digit_it)->samples(), (*digit_it)->gain());
153 }
154 }// end container not empty
155 }// end if can set raw data
156
157 // ************** Fixed Gain Data Block ***********
158 if (m_BlStruct->canSetRawDataFixed()) {
159 for (int i=0;i<3;i++) { //Loop over three gains
160 m_BlStruct->sortDataVector(it->second.vLArDigitFixed[i]);
161 std::vector<const LArDigit*>::const_iterator digit_it = it->second.vLArDigitFixed[i].begin();
162 std::vector<const LArDigit*>::const_iterator digit_it_end=it->second.vLArDigitFixed[i].end();
163 if(digit_it!=digit_it_end) {//Container not empty
164 m_BlStruct->setNumberOfSamples((*digit_it)->samples().size());
165 for (;digit_it!=digit_it_end;++digit_it) {
166 int cId = m_onlineHelper.channel((*digit_it)->hardwareID());
167 m_BlStruct->setRawDataFixed(cId, (*digit_it)->samples(), (*digit_it)->gain());
168 }
169 } //end Container not empty
170 } // end loop over three gains
171 } // end can set raw data fixed
172
173 // ************** Calibration Digit Block ***********
174 if (m_BlStruct->canSetCalibration()) {
175 for (int i=0;i<3;i++) { //Loop over three gains
176 m_BlStruct->sortDataVector(it->second.vLArCalibDigit[i]);
177 std::vector<const LArCalibDigit*>::const_iterator digit_it = it->second.vLArCalibDigit[i].begin();
178 std::vector<const LArCalibDigit*>::const_iterator digit_it_end=it->second.vLArCalibDigit[i].end();
179 if(digit_it!=digit_it_end) {//Container not empty
180 m_BlStruct->setNumberOfSamples((*digit_it)->samples().size());
181 m_BlStruct->setDelay((*digit_it)->delay());
182 m_BlStruct->setDAC((*digit_it)->DAC());
183 for (;digit_it!=digit_it_end;++digit_it) {
184 int cId = m_onlineHelper.channel((*digit_it)->hardwareID());
185 m_BlStruct->setRawDataFixed(cId, (*digit_it)->samples(), (*digit_it)->gain());
186 if ((*digit_it)->isPulsed())
187 m_BlStruct->setPulsed(cId);
188 }
189 } //End Container not empty
190 }// end loop over three gains
191 } //end can set calibration
192
193 m_BlStruct->finalizeFEB();
194 }// end iterating over FEB-map
195 m_BlStruct->concatinateFEBs();
196}
#define endmsg
float cosPhi() const
for fast px py pz computation
float sinTh() const
for algorithm working in transverse Energy
float sinPhi() const
for fast px py pz computation
const HWIdentifier & hardwareID() const
CaloGain::CaloGain gain() const
int time() const
uint16_t quality() const
int energy() const

Member Data Documentation

◆ m_BlStruct

LArRodBlockStructure* LArRodEncoder::m_BlStruct
private

Definition at line 94 of file LArRodEncoder.h.

◆ m_CaloDetDescrManager

const CaloDetDescrManager& LArRodEncoder::m_CaloDetDescrManager
private

Definition at line 92 of file LArRodEncoder.h.

◆ m_mFEB

std::map<uint32_t,FebData_t> LArRodEncoder::m_mFEB
private

Definition at line 89 of file LArRodEncoder.h.

◆ m_onlineHelper

const LArOnlineID& LArRodEncoder::m_onlineHelper
private

Definition at line 91 of file LArRodEncoder.h.

◆ m_onOffIdMapping

const LArOnOffIdMapping& LArRodEncoder::m_onOffIdMapping
private

Definition at line 93 of file LArRodEncoder.h.


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