Algorithm execute method.
54{
55
56
60 if ( not noise_per_cell_handle.isValid() ) {
61 ATH_MSG_DEBUG(
"Found invalid read handle for CaloNoiseSigmaDiff");
62 return StatusCode::FAILURE;
63 }
64 noise_per_cell = noise_per_cell_handle.cptr();
65 }
66
67
68 const CaloBCIDAverage* caloLumiBCID = nullptr;
70 SG::ReadHandle<CaloBCIDAverage> caloLumiBCIDHandle(
m_bcidAvgKey, context);
71 if ( not caloLumiBCIDHandle.isValid() ) {
72 ATH_MSG_DEBUG(
"Found invalid read handle for CaloBCIDAverage");
73 return StatusCode::FAILURE;
74 }
75 caloLumiBCID = caloLumiBCIDHandle.cptr();
76 }
77
78 const CaloCell_SuperCell_ID * calo_sc_id =
m_calo_id_manager->getCaloCell_SuperCell_ID();
80
83
85 DataPool<CaloCell> dataPool;
88
90 if ( not cellsHandle.isValid() ) {
92 return StatusCode::FAILURE;
93 }
94
95 const CaloCellContainer*
cells = cellsHandle.cptr();
97
98 std::vector<float> energies (hash_max,0);
99 std::vector<float> enTime (hash_max,0);
100 std::vector<float> enForTime (hash_max,0);
101 std::vector<bool> timeDef (hash_max,false);
102 std::vector<uint16_t> gains (hash_max,0);
103 std::vector<uint16_t>
qualities (hash_max,0);
104 std::vector<float> sigma_noise_per_scell(hash_max,0);
105
106 for (const CaloCell* cell : *cells) {
107 Identifier cell_id =
cell->ID();
108 Identifier sCellID =
m_scidtool->offlineToSuperCellID (cell_id);
109
111
112
113 continue;
114 }
115 IdentifierHash
hash, cell_hash;
117 assert (hash < energies.size() );
118 float pedestalshift = 0.0;
120 energies[
hash] +=
cell->energy() + pedestalshift;
123 sigma_noise_per_scell[
hash]+=(*noise_per_cell)[cell_hash];
124 }
126 if ( ((prov & 0x2000) == 0x2000) && (
cell->et()>50) ) {
127
128 timeDef[
hash] =
true;
131 }
132
133 gains[
hash] = std::max(gains[hash],(uint16_t)
cell->gain());
136 }else
137 {
139 }
140
142
144 int side = tile_cell_id->
side (cell_id);
145 int module = tile_cell_id->module (cell_id);
146 int tower = tile_cell_id->
tower (cell_id);
147
152 int tower1= tower;
153 int tower2= tower-1;
154
155 if (tower ==0){
156 side1 = -1;
157 side2 = 1;
158 tower1=0;
159 tower2=0;
160 }
161 if (tower==10){
164 }
165
166
167 Identifier sc_id1 = tile_sc_id->
cell_id(section1,side1,module,tower1,0);
168 Identifier sc_id2 = tile_sc_id->
cell_id(section2,side2,module,tower2,0);
169
170
173
174 energies[hash1] +=
cell->energy()*0.5;
175 energies[hash2] +=
cell->energy()*0.5;
176 }
177
178
179 }
180
182 auto superCellContainer = std::make_unique<CaloCellContainer> ();
183
184 SG::ReadCondHandle<CaloSuperCellDetDescrManager> caloSuperCellMgrHandle{
m_caloSuperCellMgrKey, context};
185 const CaloSuperCellDetDescrManager* caloMgr = *caloSuperCellMgrHandle;
186
187 superCellContainer->reserve(energies.size());
188
190 for (
unsigned int i=0;
i < energies.size();
i++) {
191
192 const CaloDetDescrElement* dde = caloMgr->
get_element (i);
193 if (!dde) {
194
195 continue;
196 }
197
198
199 float add_noise = 0.0;
201 if ( (!dde->
is_tile()) && (sigma_noise_per_scell[hash] > 0.0) ){
202 std::normal_distribution<double> distribution(0.0,sigma_noise_per_scell[hash] );
203 add_noise = distribution(generator);
204 }
205 energies[
i]+=add_noise;
206
207
208 CaloCell*
ss =
new CaloCell();
210 ss->setEnergy( energies[i] );
212 if ( timeDef[i] ){
213 float time = enTime[
i] / enForTime[
i];
219 }
else ss->setTime( 999.0 );
220
223 {
224 ss->setProvenance( 0 );
226 }
227 else
228 {
229 ss->setProvenance( prov );
231 }
232 superCellContainer->push_back(
ss);
233
234 }
235 ATH_CHECK( scellContainerHandle.record( std::move(superCellContainer) ) );
236
237 return StatusCode::SUCCESS;
238}
#define ATH_CHECK
Evaluate an expression and check for errors.
std::vector< float > CaloNoiseSigmaDiff
NAME : CaloNoiseSigmaDiff.h PACKAGE : Calorimeter/CaloConditions.
float et(const xAOD::jFexSRJetRoI *j)
static const std::vector< std::string > qualities
float average(const Identifier &id) const
size_type calo_cell_hash_max() const
cell 'global' hash table max size
bool is_tile(const Identifier id) const
test if the id belongs to the Tiles
IdentifierHash calo_cell_hash(const Identifier cellId) const
create hash id from 'global' cell id
IdentifierHash calo_hash() const
cell calo hash
bool is_tile() const
cell belongs to Tile
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
void reserve(unsigned int size)
Set the desired capacity.
unsigned int allocated()
return size already allocated OK
bool is_valid() const
Check if id is in a valid state.
SG::ReadCondHandleKey< CaloSuperCellDetDescrManager > m_caloSuperCellMgrKey
Gaudi::Property< bool > m_addBCID
SG::WriteHandleKey< CaloCellContainer > m_sCellContainerKey
Property: SG key for the output supercell LAr channel container.
SG::ReadHandleKey< CaloCellContainer > m_cellContainerKey
Property: SG key for the input calorimeter cell container.
ToolHandle< ICaloSuperCellIDTool > m_scidtool
Property: Offline / supercell mapping tool.
SG::ReadCondHandleKey< CaloNoiseSigmaDiff > m_noise_per_cell_Key
Property SG Key for the Expected Noise Sigma diff in diff gains.
SG::ReadHandleKey< CaloBCIDAverage > m_bcidAvgKey
Property SG Key for the CaloLumiBCID.
Gaudi::Property< bool > m_compNoise
int tower(const Identifier &id) const
Identifier cell_id(const Identifier &any_id) const
int side(const Identifier &id) const
int section(const Identifier &id) const
int sampling(const Identifier &id) const
time(flags, cells_name, *args, **kw)
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
generator
Configure Herwig7 These are the commands corresponding to what would go into the regular Herwig infil...