ATLAS Offline Software
Loading...
Searching...
No Matches
JiveXML::CaloFCalRetriever Class Reference

Retrieves all Calo Cluster objects. More...

#include <CaloFCalRetriever.h>

Inheritance diagram for JiveXML::CaloFCalRetriever:
Collaboration diagram for JiveXML::CaloFCalRetriever:

Public Member Functions

virtual StatusCode retrieve (ToolHandle< IFormatTool > &FormatTool) override
 Retrieve all the data.
const DataMap getFCalData (const CaloCellContainer *cellContainer)
 Retrieve FCal cell location and details.
virtual std::string dataTypeName () const override
 Return the name of the data type.
virtual StatusCode initialize () override
 Default AthAlgTool methods.

Private Attributes

const CaloCell_IDm_calocell_id {}
SG::ReadCondHandleKey< LArOnOffIdMappingm_cablingKey {this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"}
SG::ReadCondHandleKey< LArADC2MeVm_adc2mevKey { this, "ADC2MeVKey", "LArADC2MeV", "SG Key of the LArADC2MeV CDO" }
SG::ReadHandleKey< CaloCellContainerm_sgKey {this, "StoreGateKey", "AllCalo", "Name of the CaloCellContainer"}
Gaudi::Property< double > m_cellThreshold {this, "FCallCellThreshold", 50.}
 for properties
Gaudi::Property< int > m_cellEnergyPrec {this, "CellEnergyPrec", 3}
Gaudi::Property< int > m_cellTimePrec {this, "CellTimePrec", 3}
Gaudi::Property< bool > m_fcal {this, "RetrieveFCal", true}
Gaudi::Property< bool > m_doFCalCellDetails {this, "DoFCalCellDetails", false}
Gaudi::Property< bool > m_cellConditionCut {this, "CellConditionCut", false}
Gaudi::Property< std::vector< Identifier::value_type > > m_LArChannelsToIgnoreM5 {this, "LArChannelsToIgnoreM5", {}}
Gaudi::Property< bool > m_doMaskLArChannelsM5 {this, "DoMaskLArChannelsM5", false}
Gaudi::Property< bool > m_doBadFCal {this, "DoBadFCal", false}

Detailed Description

Retrieves all Calo Cluster objects.

  • Properties
    • StoreGateKey: default is 'AllCalo'. Don't change.
    • FCallCellThreshold: default is 50 (MeV)
    • RetrieveFCal: general flag, default is true
    • DoFCalCellDetails: default is false
    • CellConditionCut: default is false
    • LArChannelsToIgnoreM5: default is empty (none ignored). Input: vector of cells
      • DoMaskLArChannelsM5: default is false (none masked)
      • CellEnergyPrec: precision in int, default is 3 digits
      • CellTimePrec: precision in int, default is 3 digits
  • Retrieved Data
    • location in x, y
    • numCells: number of cells in each cluster
    • cells: identifier and adc counts of each cell

Definition at line 47 of file CaloFCalRetriever.h.

Member Function Documentation

◆ dataTypeName()

virtual std::string JiveXML::CaloFCalRetriever::dataTypeName ( ) const
inlineoverridevirtual

Return the name of the data type.

Definition at line 58 of file CaloFCalRetriever.h.

58{ return "FCAL"; };

◆ getFCalData()

const DataMap JiveXML::CaloFCalRetriever::getFCalData ( const CaloCellContainer * cellContainer)

Retrieve FCal cell location and details.

Parameters
FormatToolthe tool that will create formated output from the DataMap

Definition at line 69 of file CaloFCalRetriever.cxx.

69 {
70
71 ATH_MSG_DEBUG( "getFCalData()" );
72 const EventContext& ctx = Gaudi::Hive::currentContext();
73
75
76 DataVect x; x.reserve(cellContainer->size());
77 DataVect y; y.reserve(cellContainer->size());
78 DataVect z; z.reserve(cellContainer->size());
79 DataVect dx; dx.reserve(cellContainer->size());
80 DataVect dy; dy.reserve(cellContainer->size());
81 DataVect dz; dz.reserve(cellContainer->size());
82
83 DataVect energy; energy.reserve(cellContainer->size());
84 DataVect idVec; idVec.reserve(cellContainer->size());
85 DataVect channel; channel.reserve(cellContainer->size());
86 DataVect feedThrough; feedThrough.reserve(cellContainer->size());
87 DataVect slot; slot.reserve(cellContainer->size());
88 DataVect sub; sub.reserve(cellContainer->size());
89
90 DataVect cellTimeVec; cellTimeVec.reserve(cellContainer->size());
91 DataVect cellGain; cellGain.reserve(cellContainer->size());
92 DataVect cellPedestal; cellPedestal.reserve(cellContainer->size());
93 DataVect adc2Mev; adc2Mev.reserve(cellContainer->size());
94 DataVect BadCell; BadCell.reserve(cellContainer->size());
95
96 char rndStr[30]; // for rounding (3 digit precision)
97
100
101 SG::ReadCondHandle<LArOnOffIdMapping> cablingHdl{m_cablingKey};
102 const LArOnOffIdMapping* cabling{*cablingHdl};
103
104 if(!cabling) {
105 ATH_MSG_WARNING( "Do not have cabling mapping from key " << m_cablingKey.key() );
106 return DataMap;
107 }
108
109 const ILArPedestal* larPedestal = nullptr;
111 if( detStore()->retrieve(larPedestal).isFailure() ){
112 ATH_MSG_ERROR( "in getFCalData(), Could not retrieve LAr Pedestal" );
113 }
114 }
115
116 const LArOnlineID* onlineId;
117 if ( detStore()->retrieve(onlineId, "LArOnlineID").isFailure()) {
118 ATH_MSG_ERROR( "in getFCalData(),Could not get LArOnlineID!" );
119 }
120
121 const LArADC2MeV* adc2mev = nullptr;
123 SG::ReadCondHandle<LArADC2MeV> adc2mevH (m_adc2mevKey, ctx);
124 adc2mev = *adc2mevH;
125 }
126
127 double energyGeV, xmm, ymm, zmm, dxmm, dymm, dzmm, cellTime;
128 double energyAllLArFcal = 0.;
129
130 for(;it1!=it2;++it1){
131
132 if((*it1)->badcell()) BadCell.push_back(1);
133 else if((*it1)->energy()>= m_cellThreshold) BadCell.push_back(0);
134 else BadCell.push_back(-1);
135
136 if ((((*it1)->provenance()&0xFF)!=0xA5)&&m_cellConditionCut) continue; // check full conditions for FCal
137 Identifier cellid = (*it1)->ID();
138
139 HWIdentifier LArhwid = cabling->createSignalChannelIDFromHash((*it1)->caloDDE()->calo_hash());
140
141 //ignore FCal cells that are to be masked
143 bool maskChannel = false;
144 for (size_t i = 0; i < m_LArChannelsToIgnoreM5.size(); i++){
145 if (cellid == m_LArChannelsToIgnoreM5[i]){
146 maskChannel = true;
147 break; // exit loop over bad channels
148 }
149 }
150 if (maskChannel) continue; // continue loop over all channels
151 }
152
153 energyGeV = (*it1)->energy()*(1./GeV);
154 energy.emplace_back( gcvt( energyGeV, m_cellEnergyPrec, rndStr) );
155 energyAllLArFcal += energyGeV;
156 idVec.emplace_back((Identifier::value_type)(*it1)->ID().get_compact() );
157
158 xmm = (*it1)->x()*0.1;
159 ymm = (*it1)->y()*0.1;
160 zmm = (*it1)->z()*0.1;
161 x.emplace_back( gcvt( xmm, 4, rndStr) );
162 y.emplace_back( gcvt( ymm, 4, rndStr) );
163 z.emplace_back( gcvt( zmm, 4, rndStr) );
164
165 channel.emplace_back(onlineId->channel(LArhwid));
166 feedThrough.emplace_back(onlineId->feedthrough(LArhwid));
167 slot.emplace_back(onlineId->slot(LArhwid));
168
170 cellTime = (*it1)->time();
171 cellTimeVec.emplace_back( gcvt( cellTime, m_cellTimePrec, rndStr) );
172 cellGain.emplace_back( (*it1)->gain() );
173
174 int fcalgain = (*it1)->gain();
175 float pedestal=larPedestal->pedestal(LArhwid,fcalgain);
176 float pedvalue=0;
177 if (pedestal >= (1.0+LArElecCalib::ERRORCODE)) pedvalue = pedestal;
178 else pedvalue = 0;
179 cellPedestal.emplace_back(pedvalue);
180
181 LArVectorProxy polynom_adc2mev = adc2mev->ADC2MEV(cellid,fcalgain);
182 if (polynom_adc2mev.size()==0){ adc2Mev.emplace_back(-1); }
183 else{ adc2Mev.emplace_back(polynom_adc2mev[1]); }
184 }
185
186 const CaloDetDescrElement* elt = (*it1)->caloDDE();
187
188 dxmm = elt->dx()*0.1;
189 dymm = elt->dy()*0.1;
190 dzmm = elt->dz()*0.1;
191 dx.emplace_back( gcvt( dxmm, 4, rndStr) );
192 dy.emplace_back( gcvt( dymm, 4, rndStr) );
193 dz.emplace_back( gcvt( dzmm, 4, rndStr) );
194
195 if(m_calocell_id->pos_neg(cellid)==2)
196 sub.emplace_back(1);
197 else
198 sub.emplace_back(0);
199 }
200
201 ATH_MSG_DEBUG( " Total energy in FCAL (LAr) in GeV : " << energyAllLArFcal );
202
203 // write values into DataMap
204 const auto nEntries = x.size();
205 DataMap["x"] = std::move(x);
206 DataMap["y"] = std::move(y);
207 DataMap["z"] = std::move(z);
208 DataMap["dx"] = std::move(dx);
209 DataMap["dy"] = std::move(dy);
210 DataMap["dz"] = std::move(dz);
211 DataMap["energy"] = std::move(energy);
212 DataMap["id"] = std::move(idVec);
213 DataMap["channel"] = std::move(channel);
214 DataMap["feedThrough"] = std::move(feedThrough);
215 DataMap["slot"] = std::move(slot);
216 //Bad Cells
217 if (m_doBadFCal) {
218 DataMap["BadCell"] = std::move(BadCell);
219 } DataMap["sub"] = std::move(sub);
220
221 // adc counts
223 DataMap["cellTime"] = std::move(cellTimeVec);
224 DataMap["cellGain"] = std::move(cellGain);
225 DataMap["cellPedestal"] = std::move(cellPedestal);
226 DataMap["adc2Mev"] = std::move(adc2Mev);
227 }
228 //Be verbose
229 ATH_MSG_DEBUG( dataTypeName() << " retrieved with " << nEntries << " entries" );
230
231 //All collections retrieved okay
232 return DataMap;
233
234 } // getFCalData
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
#define y
#define x
#define z
CaloCellContainer::const_iterator beginConstCalo(CaloCell_ID::SUBCALO caloNum) const
get const iterators on cell of just one calo
CaloCellContainer::const_iterator endConstCalo(CaloCell_ID::SUBCALO caloNum) const
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
size_type size() const noexcept
Returns the number of elements in the collection.
virtual float pedestal(const HWIdentifier &id, int gain) const =0
SG::ReadCondHandleKey< LArADC2MeV > m_adc2mevKey
Gaudi::Property< bool > m_doBadFCal
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
Gaudi::Property< int > m_cellTimePrec
Gaudi::Property< bool > m_doMaskLArChannelsM5
Gaudi::Property< int > m_cellEnergyPrec
Gaudi::Property< bool > m_cellConditionCut
virtual StatusCode retrieve(ToolHandle< IFormatTool > &FormatTool) override
Retrieve all the data.
Gaudi::Property< double > m_cellThreshold
for properties
const CaloCell_ID * m_calocell_id
virtual std::string dataTypeName() const override
Return the name of the data type.
Gaudi::Property< std::vector< Identifier::value_type > > m_LArChannelsToIgnoreM5
Gaudi::Property< bool > m_doFCalCellDetails
const LArVectorProxy ADC2MEV(const HWIdentifier &id, int gain) const
Definition LArADC2MeV.h:32
int feedthrough(const HWIdentifier id) const
Return the feedthrough of a hardware cell identifier : feedthrough = [0,31] Barrel - A/C side or H/...
int slot(const HWIdentifier id) const
Return the slot number of a hardware cell identifier: slot = [1,15] Slot-ID in top part of the crat...
int channel(const HWIdentifier id) const
Return the channel number of a hardware cell identifier channel = [0,127] in all FEB.
std::map< std::string, DataVect > DataMap
Definition DataType.h:59
std::vector< DataType > DataVect
Defines a map with a key and a vector of DataType objects e.g.
Definition DataType.h:58

◆ initialize()

StatusCode JiveXML::CaloFCalRetriever::initialize ( )
overridevirtual

Default AthAlgTool methods.

Initialise the Tool.

Definition at line 29 of file CaloFCalRetriever.cxx.

29 {
30
31 ATH_MSG_DEBUG( "Initialising Tool" );
32 ATH_CHECK( detStore()->retrieve (m_calocell_id, "CaloCell_ID") );
33
34 ATH_CHECK( m_sgKey.initialize() );
35 ATH_CHECK( m_cablingKey.initialize() );
37
38 return StatusCode::SUCCESS;
39 }
#define ATH_CHECK
Evaluate an expression and check for errors.
SG::ReadHandleKey< CaloCellContainer > m_sgKey

◆ retrieve()

StatusCode JiveXML::CaloFCalRetriever::retrieve ( ToolHandle< IFormatTool > & FormatTool)
overridevirtual

Retrieve all the data.

FCal data retrieval from default collection.

Definition at line 44 of file CaloFCalRetriever.cxx.

44 {
45
46 ATH_MSG_DEBUG( "in retrieve()" );
47
48 SG::ReadHandle<CaloCellContainer> cellContainer(m_sgKey);
49 if (!cellContainer.isValid()){
50 ATH_MSG_WARNING( "Could not retrieve Calorimeter Cells " );
51 }
52 else{
53 if(m_fcal){
54 DataMap data = getFCalData(&(*cellContainer));
55 ATH_CHECK( FormatTool->AddToEvent(dataTypeName(), m_sgKey.key(), &data) );
56 ATH_MSG_DEBUG( "FCal retrieved" );
57 }
58 }
59
60 //FCal cells retrieved okay
61 return StatusCode::SUCCESS;
62 }
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
Gaudi::Property< bool > m_fcal
const DataMap getFCalData(const CaloCellContainer *cellContainer)
Retrieve FCal cell location and details.

Member Data Documentation

◆ m_adc2mevKey

SG::ReadCondHandleKey<LArADC2MeV> JiveXML::CaloFCalRetriever::m_adc2mevKey { this, "ADC2MeVKey", "LArADC2MeV", "SG Key of the LArADC2MeV CDO" }
private

Definition at line 68 of file CaloFCalRetriever.h.

69{ this, "ADC2MeVKey", "LArADC2MeV", "SG Key of the LArADC2MeV CDO" };

◆ m_cablingKey

SG::ReadCondHandleKey<LArOnOffIdMapping> JiveXML::CaloFCalRetriever::m_cablingKey {this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"}
private

Definition at line 66 of file CaloFCalRetriever.h.

67{this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"};

◆ m_calocell_id

const CaloCell_ID* JiveXML::CaloFCalRetriever::m_calocell_id {}
private

Definition at line 64 of file CaloFCalRetriever.h.

64{};

◆ m_cellConditionCut

Gaudi::Property<bool> JiveXML::CaloFCalRetriever::m_cellConditionCut {this, "CellConditionCut", false}
private

Definition at line 79 of file CaloFCalRetriever.h.

79{this, "CellConditionCut", false};

◆ m_cellEnergyPrec

Gaudi::Property<int> JiveXML::CaloFCalRetriever::m_cellEnergyPrec {this, "CellEnergyPrec", 3}
private

Definition at line 75 of file CaloFCalRetriever.h.

75{this, "CellEnergyPrec", 3};

◆ m_cellThreshold

Gaudi::Property<double> JiveXML::CaloFCalRetriever::m_cellThreshold {this, "FCallCellThreshold", 50.}
private

for properties

Definition at line 74 of file CaloFCalRetriever.h.

74{this, "FCallCellThreshold", 50.};

◆ m_cellTimePrec

Gaudi::Property<int> JiveXML::CaloFCalRetriever::m_cellTimePrec {this, "CellTimePrec", 3}
private

Definition at line 76 of file CaloFCalRetriever.h.

76{this, "CellTimePrec", 3};

◆ m_doBadFCal

Gaudi::Property<bool> JiveXML::CaloFCalRetriever::m_doBadFCal {this, "DoBadFCal", false}
private

Definition at line 82 of file CaloFCalRetriever.h.

82{this, "DoBadFCal", false};

◆ m_doFCalCellDetails

Gaudi::Property<bool> JiveXML::CaloFCalRetriever::m_doFCalCellDetails {this, "DoFCalCellDetails", false}
private

Definition at line 78 of file CaloFCalRetriever.h.

78{this, "DoFCalCellDetails", false};

◆ m_doMaskLArChannelsM5

Gaudi::Property<bool> JiveXML::CaloFCalRetriever::m_doMaskLArChannelsM5 {this, "DoMaskLArChannelsM5", false}
private

Definition at line 81 of file CaloFCalRetriever.h.

81{this, "DoMaskLArChannelsM5", false};

◆ m_fcal

Gaudi::Property<bool> JiveXML::CaloFCalRetriever::m_fcal {this, "RetrieveFCal", true}
private

Definition at line 77 of file CaloFCalRetriever.h.

77{this, "RetrieveFCal", true};

◆ m_LArChannelsToIgnoreM5

Gaudi::Property<std::vector<Identifier::value_type> > JiveXML::CaloFCalRetriever::m_LArChannelsToIgnoreM5 {this, "LArChannelsToIgnoreM5", {}}
private

Definition at line 80 of file CaloFCalRetriever.h.

80{this, "LArChannelsToIgnoreM5", {}};

◆ m_sgKey

SG::ReadHandleKey<CaloCellContainer> JiveXML::CaloFCalRetriever::m_sgKey {this, "StoreGateKey", "AllCalo", "Name of the CaloCellContainer"}
private

Definition at line 70 of file CaloFCalRetriever.h.

71{this, "StoreGateKey", "AllCalo", "Name of the CaloCellContainer"};

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