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 331 of file MakeLArCellFromRaw.cxx.

334 {
335 // LArCell was made with energy = 50.
336  double en= 50. * GeV ;
337 // cell->setEnergy(en);
338 
339  // apply corrections.
340  for (const CaloCellCorrection* corr : vCorr)
341  {
342  corr->MakeCorrection (cell, ctx);
343  }
344 
345  double c= cell->energy()/en;
346  return c;
347 }

◆ getLArCell() [1/4]

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

Definition at line 254 of file MakeLArCellFromRaw.cxx.

255 {
256  return getLArCell(id, e, t, q, CaloGain::UNKNOWNGAIN);
257 
258 }

◆ getLArCell() [2/4]

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

Definition at line 262 of file MakeLArCellFromRaw.cxx.

263 {
264 // GU to change
265 
266  HWIdentifier feb = m_onlineID->feb_Id(id);
267  unsigned int chan = m_onlineID->channel(id);
268  unsigned int tt; // not needed for this method.
269 // unsigned int ifeb = m_onlineID->feb_Hash(feb);
270  return getLArCell(feb.get_identifier32().get_compact() , chan , e, t, q, g, tt) ;
271 }

◆ 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 282 of file MakeLArCellFromRaw.cxx.

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

◆ 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 274 of file MakeLArCellFromRaw.cxx.

276 {
277  return getLArCell(feb, chan ,e, t, q, CaloGain::UNKNOWNGAIN, ttId );
278 
279 }

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

◆ setThreshold()

void MakeLArCellFromRaw::setThreshold ( float  t)

Definition at line 351 of file MakeLArCellFromRaw.cxx.

352 {
353  m_ethreshold = t;
354  return;
355 }

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
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:282
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:331
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:423
CaloCellCorrection
Definition: CaloCellCorrection.h:51
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
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
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
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:128
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:1967
Identifier32::get_compact
value_type get_compact(void) const
Get the compact id.
Definition: Identifier32.h:171
ReadCellNoiseFromCool.chan
chan
Definition: ReadCellNoiseFromCool.py:52
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
python.CaloCondTools.g
g
Definition: CaloCondTools.py:15
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
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:1483
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
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
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
Identifier::get_identifier32
Identifier32 get_identifier32(void) const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
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
GeV
#define GeV
Definition: CaloTransverseBalanceVecMon.cxx:30
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