ATLAS Offline Software
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
MakeLArCellFromRaw Class Reference

Building LArCell objects from LArRawChannel. More...

#include <MakeLArCellFromRaw.h>

Collaboration diagram for MakeLArCellFromRaw:

Classes

struct  CellInfo
 

Public Member Functions

 MakeLArCellFromRaw ()
 constructor More...
 
 ~MakeLArCellFromRaw ()
 destructor More...
 
void initialize (const LArRoIMap &roiMap, const LArOnOffIdMapping &onOffMap, const CaloDetDescrManager &man, const std::vector< const CaloCellCorrection * > *pCorr, unsigned int poolMaxSize=190000)
 initialize the internal map More...
 
LArCellgetLArCell (unsigned int feb, unsigned int chan, int e, int t, int q, CaloGain::CaloGain caloGain, unsigned int &ttId) const
 access by Identifier More...
 
LArCellgetLArCell (const HWIdentifier &id, int e, int t, int q, CaloGain::CaloGain g) const
 
LArCellgetLArCell (unsigned int feb, unsigned int chan, int e, int t, int q, unsigned int &ttId) const
 
LArCellgetLArCell (const HWIdentifier &id, int e, int t, int q) const
 
void setThreshold (float t)
 

Private Types

typedef std::vector< CellInfoCELL_VEC
 
typedef std::map< unsigned int, CELL_VECCELL_MAP
 

Private Member Functions

double getCorrection (LArCell *cell, const std::vector< const CaloCellCorrection * > &vCorr, const EventContext &ctx) const
 

Private Attributes

CELL_MAP m_cellMap
 
size_t m_poolMaxSize
 
IMessageSvc * m_msgSvc
 
const LArOnlineIDm_onlineID
 
float m_ethreshold
 

Detailed Description

Building LArCell objects from LArRawChannel.

e_threshold:          energy threshold

Definition at line 30 of file MakeLArCellFromRaw.h.

Member Typedef Documentation

◆ CELL_MAP

typedef std::map<unsigned int, CELL_VEC > MakeLArCellFromRaw::CELL_MAP
private

Definition at line 92 of file MakeLArCellFromRaw.h.

◆ CELL_VEC

typedef std::vector<CellInfo> MakeLArCellFromRaw::CELL_VEC
private

Definition at line 89 of file MakeLArCellFromRaw.h.

Constructor & Destructor Documentation

◆ MakeLArCellFromRaw()

MakeLArCellFromRaw::MakeLArCellFromRaw ( )

constructor

Definition at line 31 of file MakeLArCellFromRaw.cxx.

32  : m_poolMaxSize(0),
33  m_msgSvc (nullptr),
34  m_onlineID (nullptr),
35  m_ethreshold(-1.e5)
36 {
37 }

◆ ~MakeLArCellFromRaw()

MakeLArCellFromRaw::~MakeLArCellFromRaw ( )

destructor

Definition at line 40 of file MakeLArCellFromRaw.cxx.

41 {
42  return ;
43 }

Member Function Documentation

◆ getCorrection()

double MakeLArCellFromRaw::getCorrection ( LArCell cell,
const std::vector< const CaloCellCorrection * > &  vCorr,
const EventContext &  ctx 
) const
private

Definition at line 321 of file MakeLArCellFromRaw.cxx.

324 {
325 // LArCell was made with energy = 50.
326  double en= 50. * GeV ;
327 // cell->setEnergy(en);
328 
329  // apply corrections.
330  for (const CaloCellCorrection* corr : vCorr)
331  {
332  corr->MakeCorrection (cell, ctx);
333  }
334 
335  double c= cell->energy()/en;
336  return c;
337 }

◆ getLArCell() [1/4]

LArCell * MakeLArCellFromRaw::getLArCell ( const HWIdentifier id,
int  e,
int  t,
int  q 
) const

Definition at line 244 of file MakeLArCellFromRaw.cxx.

245 {
246  return getLArCell(id, e, t, q, CaloGain::UNKNOWNGAIN);
247 
248 }

◆ getLArCell() [2/4]

LArCell * MakeLArCellFromRaw::getLArCell ( const HWIdentifier id,
int  e,
int  t,
int  q,
CaloGain::CaloGain  g 
) const

Definition at line 252 of file MakeLArCellFromRaw.cxx.

253 {
254 // GU to change
255 
256  HWIdentifier feb = m_onlineID->feb_Id(id);
257  unsigned int chan = m_onlineID->channel(id);
258  unsigned int tt; // not needed for this method.
259 // unsigned int ifeb = m_onlineID->feb_Hash(feb);
260  return getLArCell(feb.get_identifier32().get_compact() , chan , e, t, q, g, tt) ;
261 }

◆ getLArCell() [3/4]

LArCell * MakeLArCellFromRaw::getLArCell ( unsigned int  feb,
unsigned int  chan,
int  e,
int  t,
int  q,
CaloGain::CaloGain  caloGain,
unsigned int &  ttId 
) const

access by Identifier

Definition at line 272 of file MakeLArCellFromRaw.cxx.

274 {
275 
276  CELL_MAP::const_iterator it =m_cellMap.find( feb );
277 
278  if(it == m_cellMap.end()){
279  MsgStream log(m_msgSvc, "MakeLArCellFromRaw");
280  log << MSG::ERROR <<" MakeLArCellFromRaw ERROR, failed to find existing cells. "<< endmsg;
281  std::cout <<std::hex<<"FEBID = "<< feb <<std::dec<< std::endl ;
282  //DR assert(0);
283  return nullptr;
284  }
285 
286  const CELL_VEC& cellVec = (*it).second;
287  if(cellVec.size()<= chan){
288  MsgStream log(m_msgSvc, "MakeLArCellFromRaw");
289  log << MSG::FATAL <<" MakeLArCellFromRaw ERROR, channel number= "<<chan<< endmsg ;
290  assert(0);
291  return nullptr;
292  }
293 
294  const CellInfo& info = cellVec[chan] ;
295  // do not create cell if it is not connected.
296  if(info.elem == nullptr) return nullptr;
297 
298  //remove /1000 (GeV->MeV)
299  double de = e * info.eCorr;
300  LArCell* cell =nullptr;
301 
302  // DR convert time from ps (in LArRawChannel ) to ns
303  double time = t/1000.0;
304 
305  if (m_poolMaxSize > 0) {
307  cell = new ( pool.nextElementPtr()) LArCell(info.elem,de,time,q,g);
308  }
309  else
310  {
311  cell = new LArCell(info.elem,de,time,q,g);
312  }
313 
314  ttId = info.tt;
315 
316  return cell;
317 
318 }

◆ getLArCell() [4/4]

LArCell * MakeLArCellFromRaw::getLArCell ( unsigned int  feb,
unsigned int  chan,
int  e,
int  t,
int  q,
unsigned int &  ttId 
) const

Definition at line 264 of file MakeLArCellFromRaw.cxx.

266 {
267  return getLArCell(feb, chan ,e, t, q, CaloGain::UNKNOWNGAIN, ttId );
268 
269 }

◆ initialize()

void MakeLArCellFromRaw::initialize ( const LArRoIMap roiMap,
const LArOnOffIdMapping onOffMap,
const CaloDetDescrManager man,
const std::vector< const CaloCellCorrection * > *  pCorr,
unsigned int  poolMaxSize = 190000 
)

initialize the internal map

Definition at line 45 of file MakeLArCellFromRaw.cxx.

49 {
50  const EventContext& ctx = Gaudi::Hive::currentContext();
51 
52  m_poolMaxSize = poolMaxSize;
53 
54  MsgStream log(Athena::getMessageSvc(), "MakeLArCellFromRaw");
55 
56  log << MSG::INFO <<" initializing MakeLArCellFromRaw"<< endmsg ;
57 
58  if(pCorr) log <<MSG::INFO <<" Number of Corrections "<< pCorr->size()<< endmsg ;
59 
60 
61  SmartIF<StoreGateSvc> detStore{Gaudi::svcLocator( )->service("DetectorStore")};
62  if (!detStore)
63  {
64  log << MSG::ERROR << "MakeLArCellFromRaw ERROR cannot retrieve DetectorStore " << endmsg;
65  return;
66  }
67 
68 
69  // create DataPool if requested
70  if (poolMaxSize!=0) {
71  log << MSG::INFO << "MakeLArCellFromRaw Creating DataPool<LArCell> of size " << poolMaxSize << endmsg ;
72  }else{
73  log << MSG::INFO << "MakeLArCellFromRaw do not use DataPool" << endmsg ;
74  }
75 
76 
77  const CaloCell_ID* calo_id = man.getCaloCell_ID();
78  const LArEM_ID& em_id = *calo_id->em_idHelper();
79  const LArHEC_ID& hec_id = *calo_id->hec_idHelper();
80  const LArFCAL_ID& fcal_id = *calo_id->fcal_idHelper();
81 
82  if (detStore->retrieve(m_onlineID, "LArOnlineID").isFailure()) {
83  log <<MSG::ERROR << "cannot find LArOnlineID in MakeLArCellFromRaw " << endmsg;
84  }
85 
86 
87  int n_em = 0 ;
88  int n_hec = 0 ;
89  int n_fcal = 0 ;
90 
91  int n_em_err = 0 ;
92  int n_hec_err = 0 ;
93  int n_fcal_err = 0 ;
94 
95 
96  const std::vector<Identifier>& emIds = em_id.channel_ids();
97  const std::vector<Identifier>& hecIds = hec_id.channel_ids();
98  const std::vector<Identifier>& fcalIds = fcal_id.channel_ids();
99 
100  double en=50. * GeV;
101  double time=0;
102  double qu=0;
103 
104  CellInfo info0;
105  info0.eta=0;
106  info0.phi=0;
107  info0.x=0;
108  info0.y=0;
109  info0.z=0;
110  info0.fcal=false;
111  info0.tt=0;
112  info0.eCorr=1.;
113  info0.elem = nullptr ;
114 
115  // EM
116  std::vector<Identifier>::const_iterator it = emIds.begin();
117  std::vector<Identifier>::const_iterator it2 = emIds.end();
118  for(; it!=it2;++it)
119  {
120  const Identifier& chan_id = *it ;
121 
122  try{
123 
124  HWIdentifier sigId = onOffMap.createSignalChannelID(chan_id);
125  HWIdentifier feb = m_onlineID->feb_Id(sigId);
126  CELL_VEC::size_type chan = m_onlineID->channel(sigId);
127  CELL_VEC& cellVec= m_cellMap[ feb.get_identifier32().get_compact() ] ;
128  if (cellVec.empty())cellVec.resize(128,info0);
129 
130  CellInfo& cell = cellVec[chan] ;
131 
132  cell.tt = roiMap.trigTowerID(sigId);
133 
134  const CaloDetDescrElement* caloDDE =man.get_element( chan_id);
135 
136  cell.id = chan_id ;
137  cell.eta = caloDDE->eta();
138  cell.phi = caloDDE->phi();
139  cell.fcal= false;
140  cell.elem =caloDDE;
141 // to compute correction, assume that cell is in mid gain
143 
144  ++n_em;
145  if(pCorr) {
146  // make a fake LArCell, and get the correction factor.
147  LArCell larCell(caloDDE,en,time,qu,g);
148  cell.eCorr = getCorrection(&larCell, *pCorr, ctx);
149  }
150  } catch (LArID_Exception& ex){
151  ++n_em_err;
152  }
153  } // end of EM
154 
155 
156 
157  // HEC
158  it = hecIds.begin();
159  it2 = hecIds.end();
160  for(; it!=it2;++it)
161  {
162  const Identifier& chan_id = *it ;
163 
164  try{
165 
166  HWIdentifier sigId = onOffMap.createSignalChannelID(chan_id);
167 // to change using LArOnline methods
168  HWIdentifier feb = m_onlineID->feb_Id(sigId);
169  CELL_VEC::size_type chan = m_onlineID->channel(sigId);
170  CELL_VEC& cellVec= m_cellMap[ feb.get_identifier32().get_compact() ] ;
171  if (cellVec.empty())cellVec.resize(128,info0);
172 
173  CellInfo& cell = cellVec[chan] ;
174 
175  cell.tt = roiMap.trigTowerID(sigId);
176 
177  const CaloDetDescrElement* caloDDE =man.get_element( chan_id);
178 
179  cell.id = chan_id ;
180  cell.eta = caloDDE->eta();
181  cell.phi = caloDDE->phi();
182  cell.fcal= false;
183  cell.elem =caloDDE;
185 
186  if(pCorr) {
187  // make a fake LArCell, and get the correction factor.
188  LArCell larCell(caloDDE,en,time,qu,g);
189  cell.eCorr = getCorrection(&larCell, *pCorr, ctx);
190  }
191  ++n_hec;
192  } catch (LArID_Exception& ex){
193  ++n_hec_err;
194  }
195  } // end of HEC
196 
197  // FCAL
198  it = fcalIds.begin();
199  it2 = fcalIds.end();
200  for(; it!=it2;++it)
201  {
202  const Identifier& chan_id = *it ;
203 
204  try{
205 
206  HWIdentifier sigId = onOffMap.createSignalChannelID(chan_id);
207 // GU to change to use LArOnlineID method
208  HWIdentifier feb = m_onlineID->feb_Id(sigId);
209  CELL_VEC::size_type chan = m_onlineID->channel(sigId);
210  CELL_VEC& cellVec= m_cellMap[ feb.get_identifier32().get_compact() ] ;
211  if (cellVec.empty())cellVec.resize(128,info0);
212 
213  CellInfo& cell = cellVec[chan] ;
214 
215  cell.tt = roiMap.trigTowerID(sigId);
216 
217  const CaloDetDescrElement* caloDDE =man.get_element( chan_id);
218 
219  cell.id = chan_id ;
220  cell.eta = caloDDE->eta();
221  cell.phi = caloDDE->phi();
222  cell.fcal= false;
223  cell.elem =caloDDE;
225 
226  if(pCorr) {
227  // make a fake LArCell, and get the correction factor.
228  LArCell larCell(caloDDE,en,time,qu,g);
229  cell.eCorr = getCorrection(&larCell, *pCorr, ctx);
230  }
231  ++n_fcal;
232  } catch (LArID_Exception& ex){
233  ++n_fcal_err;
234  }
235  } // end of FCAL
236 
237 
238  log <<MSG::INFO <<" number of em, hec, fcal cells="<<n_em<<" "<<n_hec<<" "<<n_fcal<<endmsg;
239  log <<MSG::INFO<<" number of exceptions for em,hec,fcal="<<n_em_err<<" "<<n_hec_err<<" "<<n_fcal_err<< endmsg;
240  log <<MSG::INFO<<" done with initializing MakeLArCellFromRaw"<< endmsg;
241  return;
242 }

◆ setThreshold()

void MakeLArCellFromRaw::setThreshold ( float  t)

Definition at line 341 of file MakeLArCellFromRaw.cxx.

342 {
343  m_ethreshold = t;
344  return;
345 }

Member Data Documentation

◆ m_cellMap

CELL_MAP MakeLArCellFromRaw::m_cellMap
private

Definition at line 94 of file MakeLArCellFromRaw.h.

◆ m_ethreshold

float MakeLArCellFromRaw::m_ethreshold
private

Definition at line 101 of file MakeLArCellFromRaw.h.

◆ m_msgSvc

IMessageSvc* MakeLArCellFromRaw::m_msgSvc
private

Definition at line 97 of file MakeLArCellFromRaw.h.

◆ m_onlineID

const LArOnlineID* MakeLArCellFromRaw::m_onlineID
private

Definition at line 99 of file MakeLArCellFromRaw.h.

◆ m_poolMaxSize

size_t MakeLArCellFromRaw::m_poolMaxSize
private

Definition at line 96 of file MakeLArCellFromRaw.h.


The documentation for this class was generated from the following files:
grepfile.info
info
Definition: grepfile.py:38
CellInfo::z
float z
Definition: TileMuonFitter.h:66
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
GeV
#define GeV
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:17
MakeLArCellFromRaw::getLArCell
LArCell * getLArCell(unsigned int feb, unsigned int chan, int e, int t, int q, CaloGain::CaloGain caloGain, unsigned int &ttId) const
access by Identifier
Definition: MakeLArCellFromRaw.cxx:272
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:19
CaloCell_ID::em_idHelper
const LArEM_ID * em_idHelper() const
access to EM idHelper
Definition: CaloCell_ID.h:63
CaloGain::UNKNOWNGAIN
@ UNKNOWNGAIN
Definition: CaloGain.h:20
MakeLArCellFromRaw::getCorrection
double getCorrection(LArCell *cell, const std::vector< const CaloCellCorrection * > &vCorr, const EventContext &ctx) const
Definition: MakeLArCellFromRaw.cxx:321
MakeLArCellFromRaw::m_onlineID
const LArOnlineID * m_onlineID
Definition: MakeLArCellFromRaw.h:99
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
CaloDetDescrManager_Base::get_element
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
Definition: CaloDetDescrManager.cxx:159
pool
pool namespace
Definition: libname.h:15
skel.it
it
Definition: skel.GENtoEVGEN.py:396
CaloCellCorrection
Definition: CaloCellCorrection.h:51
Identifier::get_identifier32
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
LArHEC_ID
Helper class for LArHEC offline identifiers.
Definition: LArHEC_ID.h:85
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
MakeLArCellFromRaw::CELL_VEC
std::vector< CellInfo > CELL_VEC
Definition: MakeLArCellFromRaw.h:89
HWIdentifier
Definition: HWIdentifier.h:13
Identifier32::get_compact
value_type get_compact() const
Get the compact id.
Definition: Identifier32.h:44
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
CaloCell_ID::hec_idHelper
const LArHEC_ID * hec_idHelper() const
access to HEC idHelper
Definition: CaloCell_ID.h:69
CellInfo::x
float x
Definition: TileMuonFitter.h:66
LArFCAL_Base_ID::channel_ids
const std::vector< Identifier > & channel_ids() const
provide acces to channel id vector, accessed via hash
LArOnlineID_Base::channel
int channel(const HWIdentifier id) const
Return the channel number of a hardware cell identifier channel = [0,127] in all FEB.
Definition: LArOnlineID_Base.cxx:1963
ReadCellNoiseFromCool.chan
chan
Definition: ReadCellNoiseFromCool.py:52
python.CaloCondTools.g
g
Definition: CaloCondTools.py:15
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
CellInfo
Definition: TileMuonFitter.h:63
CaloCell_ID
Helper class for offline cell identifiers.
Definition: CaloCell_ID.h:34
MakeLArCellFromRaw::m_ethreshold
float m_ethreshold
Definition: MakeLArCellFromRaw.h:101
LArOnOffIdMapping::createSignalChannelID
HWIdentifier createSignalChannelID(const Identifier &id) const
create a HWIdentifier from an Identifier (not inline)
Definition: LArOnOffIdMapping.h:126
LArOnlineID_Base::feb_Id
HWIdentifier feb_Id(int barrel_ec, int pos_neg, int feedthrough, int slot) const
Create feb_Id from fields.
Definition: LArOnlineID_Base.cxx:1479
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
MakeLArCellFromRaw::m_msgSvc
IMessageSvc * m_msgSvc
Definition: MakeLArCellFromRaw.h:97
PlotCalibFromCool.en
en
Definition: PlotCalibFromCool.py:399
LArCell
Data object for LAr calorimeter readout cell.
Definition: LArCell.h:53
CaloGain::CaloGain
CaloGain
Definition: CaloGain.h:11
CaloGain::LARMEDIUMGAIN
@ LARMEDIUMGAIN
Definition: CaloGain.h:18
MakeLArCellFromRaw::m_poolMaxSize
size_t m_poolMaxSize
Definition: MakeLArCellFromRaw.h:96
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
CellInfo::y
float y
Definition: TileMuonFitter.h:66
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
DataPool
a typed memory pool that saves time spent allocation small object. This is typically used by containe...
Definition: DataPool.h:47
CaloDetDescrManager::getCaloCell_ID
const CaloCell_ID * getCaloCell_ID() const
get calo cell ID helper
Definition: CaloDetDescrManager.cxx:1590
extractSporadic.q
list q
Definition: extractSporadic.py:98
MakeLArCellFromRaw::m_cellMap
CELL_MAP m_cellMap
Definition: MakeLArCellFromRaw.h:94
CaloDetDescrElement::eta
float eta() const
cell eta
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:344
LArEM_ID
Helper class for LArEM offline identifiers.
Definition: LArEM_ID.h:118
CaloDetDescrElement::phi
float phi() const
cell phi
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:346
LArRoIMap::trigTowerID
TT_ID trigTowerID(const Identifier &channel_id) const
Translate offline channel identifier to trigger tower ID.
Definition: LArRoIMap.cxx:32
LArEM_Base_ID::channel_ids
const std::vector< Identifier > & channel_ids() const
provide access to channel id vector, accessed via hash
LArHEC_Base_ID::channel_ids
const std::vector< Identifier > & channel_ids() const
provide access to channel id vector, accessed via hash
LArFCAL_ID
Helper class for LArFCAL offline identifiers.
Definition: LArFCAL_ID.h:60
TileDCSDataPlotter.tt
tt
Definition: TileDCSDataPlotter.py:874
python.compressB64.c
def c
Definition: compressB64.py:93
LArID_Exception
Exception class for LAr Identifiers.
Definition: LArID_Exception.h:20
CaloCell_ID::fcal_idHelper
const LArFCAL_ID * fcal_idHelper() const
access to FCAL idHelper
Definition: CaloCell_ID.h:75
Identifier
Definition: IdentifierFieldParser.cxx:14