Helper class to calculate cluster kinematics based on cells.
223 {
224
225
226
227
228
229
230
231
232
233
234
235
236
238 if (!cccl || cccl->
size()==0)
return;
239
240 double posNorm = 0;
241 int nBarrel = 0;
242 int nEndcap = 0;
243 double timeNorm = 0.;
244
245 std::array<double,CaloSampling::Unknown> posSamNorm{};
246
247 CellAccum accum (posNorm, posSamNorm, nBarrel, nEndcap, timeNorm, useGPUCriteria);
248
249 if (useweight)
250 accumCells (cccl, accum, AccumWeight(), useGPUCriteria);
251 else
252 accumCells (cccl, accum, AccumNoWeight(), useGPUCriteria);
253
254 if ( posNorm != 0. ) {
255 double inorm = 1 / posNorm;
256 clu->
setEta(accum.theNewEta * inorm);
258 }
259 else {
262 }
263
264 clu->
setE(accum.theNewEnergy);
266
267 if ( timeNorm != 0. ) {
268 clu->
setTime(accum.theNewTime/timeNorm);
269
270
271
272
274 } else {
277 }
278
279
280
282 for(
int i=0;
i<(
int)CaloSampling::Unknown;
i++) {
283 if (accum.PresenceInSample[i])
284 samplingPattern |= (0x1U<<
i);
285 }
287
290 }
291
293
295
296 if ( !updateLayers ) return;
297
298
299 for(
int i=0;
i<(
int)CaloSampling::Unknown;
i++) {
300 if ( !accum.PresenceInSample[i] ) continue;
301 if ( posSamNorm[i] != 0 ) {
302 const double inorm = 1 / posSamNorm[
i];
303 accum.EtaInSample[
i] *= inorm;
305 }
306 }
307
308
309
310 for(
int i=0;
i<(
int)CaloSampling::Unknown;
i++) {
311 if ( !accum.PresenceInSample[i] ) continue;
312
314 clu->
setEnergy(sam,accum.EnergyInSample[i]);
315
316 clu->
setEta(sam,accum.EtaInSample[i]);
317 clu->
setPhi(sam,accum.PhiInSample[i]);
318
319 clu->
setEmax(sam,accum.MaxEnergyInSample[i]);
320 clu->
setEtamax(sam,accum.EtaMaxEnergyInSample[i]);
321 clu->
setPhimax(sam,accum.PhiMaxEnergyInSample[i]);
322 }
323
324 }
size_t size() const
size method
static double fix(double phi)
void setSecondTime(flt_t stime)
Set second moment of cell timing distribution.
bool setPhi(const CaloSample sampling, const float phi)
Set in a given sampling. Returns false if the sample isn't part of the cluster.
const CaloClusterCellLink * getCellLinks() const
Get a pointer to the CaloClusterCellLink object (const version)
flt_t time() const
Access cluster time.
void setTime(flt_t)
Set cluster time.
bool setPhimax(const CaloSample sampling, const float phiMax)
Set the phi of the cell with the highest energy in a particular sampling.
bool setEta(const CaloSample sampling, const float eta)
Set in a given sampling. Returns false if the sample isn't part of the cluster.
bool setEmax(const CaloSample sampling, const float eMax)
Set the Energy of the cell with the highest energy in a particular sampling.
bool setEnergy(const CaloSample sampling, const float e)
Set energy for a given sampling. Returns false if the sample isn't part of the cluster.
void setSamplingPattern(const unsigned sp, const bool clearSamplingVars=false)
Set sampling pattern (one bit per sampling.
bool setEtamax(const CaloSample sampling, const float etaMax)
Set the eta of the cell with the highest energy in a particular sampling.
void clearSamplingData()
Clear the sampling data.
unsigned samplingPattern() const
Access to sampling pattern (one bit per sampling) (Method may be removed later)
void setM(flt_t)
Set Mass for the current signal state.