ATLAS Offline Software
Loading...
Searching...
No Matches
CaloCluster.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5/********************************************************************
6
7NAME: CaloCluster.cxx
8PACKAGE: offline/Calorimeter/CaloRec
9
10AUTHORS: H. Ma
11CREATED: Apr 2001
12
13PURPOSE: Cluster base class.
14 Implements CaloCluster methods
15
16Updated: Redesign. May 21, 2001
17 CaloCluster is a concrete class
18
19Updated: Redesign. Feb 17, 2004 P Loch
20 Complete overhaul to accommodate navigation and 4-vector interfaces.
21
22Updated: Aug, 2004 sss
23 Fix phi range problem and a potential division by zero.
24
25Updated: 30 Jun, 2005 S.Menke
26 updateKine uses |E| instead of E for the position calculation
27 and updates all data members now
28
29********************************************************************/
30
31// basics
32#include "CaloEvent/CaloCluster.h"
33#include "CaloEvent/CaloCell.h"
35
36// cell links
39
40// data store
44
45// kinematics
47
48// data helpers
52
53// calculators
56
57#include "CxxUtils/prefetch.h"
58#include <vector>
59#include <algorithm>
60//#include <iostream>
61
62const double CaloCluster::m_errorValue = -999.;
63
65// Constructor //
67/*
68 *
69 * \param eta0 \f$ \eta \f$ of cluster seed, optional
70 * \param phi0 \f$ \varphi \f$ of cluster seed, optional
71 *
72 */
73CaloCluster::CaloCluster(double eta0 /*= 0*/, double phi0 /*= 0*/,
74 unsigned int varTypePattern,
75 unsigned int clusterSize)
78 m_dataStore(varTypePattern),
79 m_ownDataStore(false),
80 m_shower(nullptr),
81 m_basicSignal(0.),
82 m_time(0.),
84 m_barrel (false),
85 m_endcap (false),
86 m_clusterSize(clusterSize),
87 m_eta0 (eta0),
88 m_phi0 (phi0),
89 m_timeNorm(0.),
90 m_posNorm(0.),
92 m_nBarrel(0),
93 m_nEndcap(0),
94 m_lockPattern(0x00000000),
95 m_rawE(0.),
96 m_rawEta(0.),
97 m_rawPhi(0.),
98 m_rawM(0.),
99 m_altE(0.),
100 m_altEta(0.),
101 m_altPhi(0.),
102 m_altM(0.)
103{
105 m_badChannelData.clear();
106}
107
123 m_dataStore(pCluster->m_dataStore),
124 m_momentStore(pCluster->m_momentStore),
125 m_ownDataStore(true),
126 m_basicSignal(pCluster->m_basicSignal),
127 m_time(pCluster->m_time),
129 m_barrel(pCluster->m_barrel),
130 m_endcap(pCluster->m_endcap),
131 m_clusterSize(pCluster->m_clusterSize),
132 m_eta0(pCluster->m_eta0),
133 m_phi0(pCluster->m_phi0),
134 m_timeNorm(pCluster->m_timeNorm),
135 m_posNorm(pCluster->m_posNorm),
136 m_posSamNorm(pCluster->m_posSamNorm),
137 m_nBarrel(pCluster->m_nBarrel),
138 m_nEndcap(pCluster->m_nEndcap),
139 m_lockPattern(pCluster->m_lockPattern),
140 m_rawE(pCluster->m_rawE),
141 m_rawEta(pCluster->m_rawEta),
142 m_rawPhi(pCluster->m_rawPhi),
143 m_rawM(pCluster->m_rawM),
144 m_altE(pCluster->m_altE),
145 m_altEta(pCluster->m_altEta),
146 m_altPhi(pCluster->m_altPhi),
147 m_altM(pCluster->m_altM)
148{
149 signalstate_t s = pCluster->m_defSigState;
150 if (!this->hasSignalState(s)) s = statename_t::CALIBRATED;
151 this->setDefaultSignalState(s);
152 this->setSignalState(s);
153 // deep copy external data
154 bool isExternalShowerThere = false;
155 if ( pCluster->m_dataLink.isValid()) {
156 if (*(pCluster->m_dataLink) != nullptr) isExternalShowerThere = true;
157 }
158 CaloShower* pData = isExternalShowerThere
159 ? new CaloShower(*(pCluster->m_dataLink)) : new CaloShower();
160 m_shower = pData;
161 CaloCellLink* pLink = pCluster->getCellLink() != nullptr ? new CaloCellLink(pCluster->getCellLink()) : new CaloCellLink();
162 this->setStores(pData,pLink,
164 P4EEtaPhiM::setE(pCluster->m_e);
165 P4EEtaPhiM::setEta(pCluster->m_eta);
166 P4EEtaPhiM::setPhi(pCluster->m_phi);
167 P4EEtaPhiM::setM(pCluster->m_m);
168 this->setRecoStatus(pCluster->getRecoStatus());
169 m_badChannelData.reserve(pCluster->m_badChannelData.size());
170 for (unsigned int i=0;i<pCluster->m_badChannelData.size();i++) {
172 }
173}
174
176 : I4Momentum(rCluster),
177 P4EEtaPhiMBase(rCluster),
178 INavigable(rCluster),
179 IAthenaBarCode(rCluster),
180 INavigable4Momentum(rCluster),
181 CaloCompositeKineBase(rCluster),
183 ISignalState(),
184 m_dataStore(rCluster.m_dataStore),
186 m_ownDataStore(true),
188 m_time(rCluster.m_time),
190 m_barrel(rCluster.m_barrel),
191 m_endcap(rCluster.m_endcap),
193 m_eta0(rCluster.m_eta0),
194 m_phi0(rCluster.m_phi0),
195 m_timeNorm(rCluster.m_posNorm),
196 m_posNorm(rCluster.m_posNorm),
197 m_posSamNorm(rCluster.m_posSamNorm),
198 m_nBarrel(rCluster.m_nBarrel),
199 m_nEndcap(rCluster.m_nEndcap),
201 m_rawE(rCluster.m_rawE),
202 m_rawEta(rCluster.m_rawEta),
203 m_rawPhi(rCluster.m_rawPhi),
204 m_rawM(rCluster.m_rawM),
205 m_altE(rCluster.m_altE),
206 m_altEta(rCluster.m_altEta),
207 m_altPhi(rCluster.m_altPhi),
208 m_altM(rCluster.m_altM)
209{
210 signalstate_t s = rCluster.m_defSigState;
211 if (!this->hasSignalState(s)) s = statename_t::CALIBRATED;
212 this->setDefaultSignalState(s);
213 this->setSignalState(s);
214 // deep copy external data
215 bool isExternalShowerThere = false;
216 if ( rCluster.m_dataLink.isValid()) {
217 if (*(rCluster.m_dataLink) != nullptr) isExternalShowerThere = true;
218 }
219 CaloShower* pData = isExternalShowerThere
220 ? new CaloShower(*(rCluster.m_dataLink)) : new CaloShower();
221 m_shower = pData;
222 CaloCellLink* pLink = rCluster.getCellLink() != nullptr ? new CaloCellLink(rCluster.getCellLink()) : new CaloCellLink();
223 this->setStores(pData,pLink,
225 // energy etc may be corrected, so overwrite!
226 P4EEtaPhiM::setE(rCluster.m_e);
227 P4EEtaPhiM::setEta(rCluster.m_eta);
228 P4EEtaPhiM::setPhi(rCluster.m_phi);
229 P4EEtaPhiM::setM(rCluster.m_m);
230 this->setRecoStatus(rCluster.getRecoStatus());
231 m_badChannelData.reserve(rCluster.m_badChannelData.size());
232 for (unsigned int i=0;i<rCluster.m_badChannelData.size();i++) {
234 }
235}
236
238// Destructor //
240
249{
250 // If we own the store, the link holds the pointer directly.
251 if ( m_ownDataStore ) delete m_dataLink.cachedElement();
252}
253
254
263void CaloCluster::updateKine(const CaloCell* theCell, double weight)
264{
265
266 // update global kinematics
267 //
268 // for the update of the position the normalization is not a trival
269 // thing. The previous implementation used the sum of weighted
270 // energies as normalization. This leads to unphysical eta and phi
271 // values in case negative energies are added in. The new algorithm
272 // takes therefore |E| instead of E which gives the same eta and phi
273 // as before for the 2 cases where all cells are negative or all
274 // cells are positive. In the mixed case it will give the direction
275 // of activity in the calorimeter.
276
277 if (!theCell->caloDDE()) return;
278
279 double theEnergyNoWeight = theCell->e();
280 double theEnergy = weight * theEnergyNoWeight;
281 double cellEta = theCell->eta();
282 double cellPhi = theCell->phi();
283 // weight might be negative for removing cells
284 // therefore the AbsEnergy can be negative ...
285 double theAbsEnergy = weight * fabs(theEnergyNoWeight);
286 double thePhi = proxim(cellPhi,this->phi());
287 double theNewEta =
288 m_posNorm * this->eta() + theAbsEnergy * cellEta;
289 double theNewPhi = m_posNorm * this->phi() + theAbsEnergy * thePhi;
290 double theNewEnergy = this->e() + theEnergy;
291 m_posNorm += theAbsEnergy;
292
293 if ( m_posNorm != 0. )
294 {
295 this->setEta(theNewEta/m_posNorm);
296 this->setPhi(CaloPhiRange::fix (theNewPhi/m_posNorm));
297 }
298 else
299 {
300 this->setEta(0);
301 this->setPhi(0);
302 }
303
304 this->setE(theNewEnergy);
305
306 // calculate the cluster time from cells which provide a time
307 // two modes are under discussion - either use an energy^2 weighted
308 // average (sigma_t ~ 1/E) or just the time of the leading cell
309 // for now the energy^2 weighted average is implemented ...
310
311 // need sampling number already for time
312 CaloSampling::CaloSample sam = theCell->caloDDE()->getSampling();
313 // unknown sampling
314 if ( sam == CaloSampling::Unknown ) return;
315
316 unsigned pmask = 0;
317 if (sam != CaloSampling::PreSamplerB &&
318 sam != CaloSampling::PreSamplerE)
319 {
320 if ( theCell->caloDDE()->is_tile() )
321 pmask = 0x8080;
322 else
323 pmask = 0x2000;
324 }
325
326 // Is time defined?
327 if ( theCell->provenance() & pmask ) {
328 // keep the sign of weight for the time norm in case a cell is removed
329 double theTimeNorm = fabs(weight) * theEnergy * theEnergyNoWeight;
330
331 double theNewTime = m_timeNorm * this->getTime()
332 + theTimeNorm * theCell->time();
333
334 m_timeNorm += theTimeNorm;
335
336 if ( m_timeNorm != 0. )
337 {
338 this->setTime(theNewTime/m_timeNorm);
339 }
340 else
341 {
342 this->setTime(0);
343 }
344 }
345
347 // Check Sampling Variable Updates //
349
350 // no update required
351 if ( this->allLocked() ) return;
352
353 // update sampling quantities
354
355 // This has gotten a bit more involved. To handle the stores for the
356 // data correctly, a pointer to each store (can be different for each
357 // variable type) has to be retrieved first (internal function). As all
358 // variables need the sampling energy, we start with this store. Note that
359 // the store for each variable can be defined by calling the corresponding
360 // set method before the first \a updateKine invocation.
361
363 // Energy in Sampling //
365
367 if ( ! this->isLocked(typeE) )
368 {
369 CaloSamplingData* pEStore = this->getDataStore(typeE,true);
370 if ( pEStore != nullptr )
371 {
372 // note that this is a reference to a modifiable data word!
373 pEStore->retrieveData(typeE,sam) += theEnergy;
374 }
375 }
376
377 double theOldNorm(m_posSamNorm[sam]);
378 m_posSamNorm[sam]+=theAbsEnergy;
379 double theNewNorm(m_posSamNorm[sam]);
380
382 // Azimuth //
384
385 // azimuth
387 if ( ! this->isLocked(typePhi) )
388 {
389 // central azimuth
390 CaloSamplingData* pPhiStore = this->getDataStore(typePhi,true);
391 if ( pPhiStore != nullptr )
392 {
393 double& refPhiSamp = pPhiStore->retrieveData(typePhi,sam);
394 thePhi = proxim(cellPhi,refPhiSamp);
395 theNewPhi = theNewNorm != 0.
396 ? CaloPhiRange::fix((theOldNorm*refPhiSamp+theAbsEnergy*thePhi)/theNewNorm)
397 : double(0);
398
399 // spread in azimuth
402 if ( ! this->isLocked(typeDPhi) )
403 {
404 CaloSamplingData* pDPhiStore = this->getDataStore(typeDPhi,true);
405 if ( pDPhiStore != nullptr )
406 {
407 // non-const reference -> modification in place!
408 double& refDPhiSamp = pDPhiStore->retrieveData(typeDPhi,sam);
409 double wP2
410 = theOldNorm *
411 ( refDPhiSamp*refDPhiSamp + refPhiSamp*refPhiSamp)
412 + theAbsEnergy * thePhi * thePhi;
413 refDPhiSamp = theNewNorm != 0.
414 ? wP2 / theNewNorm - theNewPhi*theNewPhi
415 : double(0);
416 if ( refDPhiSamp > 0. )
417 {
418 refDPhiSamp = sqrt(refDPhiSamp);
419 }
420 else
421 {
422 refDPhiSamp = double(0);
423 }
424 }
425 }
426 // save the new phi value
427 refPhiSamp = theNewPhi;
428 }
429 }
430
432 // Rapidity //
434
435
436 // rapidity
438 if ( ! this->isLocked(typeEta) )
439 {
440 CaloSamplingData* pEtaStore = this->getDataStore(typeEta,true);
441 if ( pEtaStore != nullptr )
442 {
443 double& refEtaSamp = pEtaStore->retrieveData(typeEta,sam);
444 double theNewEta = theNewNorm != 0.
445 ? (theOldNorm*refEtaSamp+theAbsEnergy* cellEta)/theNewNorm
446 : double(0);
447
448 // spread in eta
451 if ( ! this->isLocked(typeDEta) )
452 {
453 CaloSamplingData* pDEtaStore = this->getDataStore(typeDEta,true);
454 if ( pDEtaStore != nullptr )
455 {
456 double& refDEtaSamp = pDEtaStore->retrieveData(typeDEta,sam);
457 double wE2 = theOldNorm * (refDEtaSamp * refDEtaSamp +
458 refEtaSamp * refEtaSamp )
459 + theAbsEnergy * cellEta * cellEta;
460 refDEtaSamp = theNewNorm != 0
461 ? wE2 / theNewNorm - theNewEta * theNewEta
462 : double(0);
463 if ( refDEtaSamp > 0. )
464 {
465 refDEtaSamp = sqrt(refDEtaSamp);
466 }
467 else
468 {
469 refDEtaSamp = double(0.0);
470 }
471 }
472 }
473 // save the new eta value
474 refEtaSamp = theNewEta;
475 }
476 }
477
479 // Maximum Energy Cell //
481
483 if ( ! this->isLocked(typeEMax) )
484 {
485 CaloSamplingData* pEMaxStore = this->getDataStore(typeEMax,true);
486 if ( pEMaxStore != nullptr )
487 {
488 double& refEMaxSamp = pEMaxStore->retrieveData(typeEMax,sam);
489 if ( refEMaxSamp < theEnergy )
490 {
491 // set new maximum energy
492 refEMaxSamp = theEnergy;
493 // set new eta
496 if ( ! this->isLocked(typeEtaMax) )
497 {
498 CaloSamplingData* pEtaMaxStore =
499 this->getDataStore(typeEtaMax,true);
500 if ( pEtaMaxStore != nullptr )
501 {
502 pEtaMaxStore->retrieveData(typeEtaMax,sam) =
503 cellEta;
504 }
505 }
506 // set new phi
509 if ( ! this->isLocked(typePhiMax) )
510 {
511 CaloSamplingData* pPhiMaxStore =
512 this->getDataStore(typePhiMax,true);
513 if ( pPhiMaxStore != nullptr )
514 {
515 pPhiMaxStore->retrieveData(typePhiMax,sam) = thePhi;
516 }
517 } // lock on phi of maximum sampling signal
518 } // maximum condition
519 } // data store pointer
520 } // lock on max energy
521
522 if ( theEnergy != 0)
523 {
524 // check sampling bit
527 // count cells in endcap
528
529 switch(sam)
530 {
531 case CaloSampling::PreSamplerE:
532 case CaloSampling::EME1:
533 case CaloSampling::EME2:
534 case CaloSampling::EME3:
535 case CaloSampling::HEC0:
536 case CaloSampling::HEC1:
537 case CaloSampling::HEC2:
538 case CaloSampling::HEC3:
539 case CaloSampling::FCAL0:
540 case CaloSampling::FCAL1:
541 case CaloSampling::FCAL2:
542 m_nEndcap += (weight<0?-1:1);
543 break;
544 default:
545 m_nBarrel += (weight<0?-1:1);
546 break;
547 }
548 }
549
550 if ( m_nBarrel < 0 ) m_nBarrel = 0;
551 if ( m_nEndcap < 0 ) m_nEndcap = 0;
552
553 m_barrel = (m_nBarrel>0);
554 m_endcap = (m_nEndcap>0);
555}
556
557
558namespace {
559
560
561// This is factored out in order to allow instantiating the cell loop
562// in versions that both use and do not use cell weights. In the no-weights
563// case, the weight is a compile-time constant of 1, so all operations
564// involving it will be optimized away.
565
566
567struct CellAccum
568{
569 CellAccum (double& the_posNorm,
570 std::vector<double>& the_posSamNorm,
571 int& the_nBarrel,
572 int& the_nEndcap,
573 double& the_timeNorm)
574 : EnergyInSample(),
575 EtaInSample(),
576 PhiInSample(),
577 MaxEnergyInSample(),
578 EtaMaxEnergyInSample(),
579 PhiMaxEnergyInSample(),
580 PresenceInSample(),
581 theNewEnergy(0),
582 theNewTime(0),
583 theNewEta(0),
584 theNewPhi(0),
585 phi0(-999),
586 posNorm (the_posNorm),
587 posSamNorm (the_posSamNorm),
588 nBarrel (the_nBarrel),
589 nEndcap (the_nEndcap),
590 timeNorm (the_timeNorm)
591 {}
592 double EnergyInSample[CaloSampling::Unknown];
593 double EtaInSample[CaloSampling::Unknown];
594 double PhiInSample[CaloSampling::Unknown];
595 double MaxEnergyInSample[CaloSampling::Unknown];
596 double EtaMaxEnergyInSample[CaloSampling::Unknown];
597 double PhiMaxEnergyInSample[CaloSampling::Unknown];
598 bool PresenceInSample[CaloSampling::Unknown];
599 double theNewEnergy;
600 double theNewTime;
601 double theNewEta;
602 double theNewPhi;
603 double phi0;
604
605 double& posNorm;
606 std::vector<double>& posSamNorm;
607 int& nBarrel;
608 int& nEndcap;
609 double& timeNorm;
610};
611
612
613struct AccumWeight
614{
615 AccumWeight (const CaloCluster& cl) : m_cl (cl) {}
616
617 double operator() (const CaloCell& cell) const
618 {
619 return m_cl.getCellWeight (&cell);
620 }
621
622 const CaloCluster& m_cl;
623};
624
625
626struct AccumNoWeight
627{
628 double operator() (const CaloCell&) const { return 1; }
629};
630
631
632template <class WEIGHT>
633inline
634void accumCell (const CaloCell& cell, CellAccum& accum, const WEIGHT& w)
635{
636 const CaloDetDescrElement* dde = cell.caloDDE();
637 if (!dde) return;
638 double weight = w (cell);
639 double fabsweight = fabs (weight);
640
641 double theEnergyNoWeight = cell.e();
642 double theEnergy = weight * theEnergyNoWeight;
643 // weight might be negative for removing cells
644 // therefore the AbsEnergy can be negative ...
645 double theAbsEnergy = weight * fabs(theEnergyNoWeight);
646
648 accum.PresenceInSample[sam] = true;
649 double cellEta = dde->eta();
650 double cellPhi = dde->phi();
651
652 accum.EnergyInSample[sam] += theEnergy;
653 accum.theNewEnergy += theEnergy;
654 double thePhi;
655 if (accum.phi0 < -900) {
656 thePhi = accum.phi0 = cellPhi;
657 }
658 else
659 thePhi = proxim (cellPhi, accum.phi0);
660
661 accum.theNewEta += theAbsEnergy * cellEta;
662 accum.theNewPhi += theAbsEnergy * thePhi;
663 if ( accum.MaxEnergyInSample[sam] < theEnergy ) {
664 accum.MaxEnergyInSample[sam] = theEnergy;
665 accum.EtaMaxEnergyInSample[sam] = cellEta;
666 accum.PhiMaxEnergyInSample[sam] = cellPhi;
667 }
668
669 accum.posSamNorm[sam] += theAbsEnergy;
670 accum.posNorm += theAbsEnergy;
671
672 accum.EtaInSample[sam] += theAbsEnergy * cellEta;
673 accum.PhiInSample[sam] += theAbsEnergy * thePhi;
674
675 if ( theEnergy != 0)
676 {
677 // count cells in endcap
678 switch(sam)
679 {
680 case CaloSampling::PreSamplerE:
681 case CaloSampling::EME1:
682 case CaloSampling::EME2:
683 case CaloSampling::EME3:
684 case CaloSampling::HEC0:
685 case CaloSampling::HEC1:
686 case CaloSampling::HEC2:
687 case CaloSampling::HEC3:
688 case CaloSampling::FCAL0:
689 case CaloSampling::FCAL1:
690 case CaloSampling::FCAL2:
691 accum.nEndcap += (weight<0?-1:1);
692 break;
693 case CaloSampling::EMB1:
694 case CaloSampling::EMB2:
695 default:
696 accum.nBarrel += (weight<0?-1:1);
697 break;
698 }
699
700 if (sam != CaloSampling::PreSamplerB &&
701 sam != CaloSampling::PreSamplerE)
702 {
703 unsigned int pmask = dde->is_tile() ? 0x8080 : 0x2000;
704
705 // Is time defined?
706 if ( cell.provenance() & pmask ) {
707 // keep the sign of weight for the time norm in case a cell is removed
708 double theTimeNorm = fabsweight * theEnergy * theEnergyNoWeight;
709 accum.theNewTime += theTimeNorm * cell.time();
710 accum.timeNorm += theTimeNorm;
711 }
712 }
713 }
714}
715
716
717template <class WEIGHT>
718inline
719void accumCells (CaloCluster& cl, CellAccum& accum, const WEIGHT& w)
720{
721 for (const CaloCell* c : cl)
723
726 for (; it != end; ++it) {
727 CaloPrefetch::nextDDE(it, end);
728 accumCell (**it, accum, w);
729 }
730}
731
732
733} // anonymous namespace
734
735
736void CaloCluster::calculateKine(const bool useweight,const bool updateLayers)
737{
738 //static CaloPhiRange range;
739
740 // update global kinematics
741 //
742 // for the update of the position the normalization is not a trival
743 // thing. The previous implementation used the sum of weighted
744 // energies as normalization. This leads to unphysical eta and phi
745 // values in case negative energies are added in. The new algorithm
746 // takes therefore |E| instead of E which gives the same eta and phi
747 // as before for the 2 cases where all cells are negative or all
748 // cells are positive. In the mixed case it will give the direction
749 // of activity in the calorimeter.
750
751 m_posNorm = 0;
752 m_nBarrel = 0;
753 m_nEndcap = 0;
754 m_timeNorm = 0.;
755
756 std::fill (m_posSamNorm.begin(), m_posSamNorm.end(), 0);
757
759 accum.theNewPhi = this->phi();
760 if (useweight)
761 accumCells (*this, accum, AccumWeight(this));
762 else
763 accumCells (*this, accum, AccumNoWeight());
764
765 if ( m_posNorm != 0. )
766 {
767 double inorm = 1 / m_posNorm;
768 this->setEta(accum.theNewEta * inorm);
769 this->setPhi(CaloPhiRange::fix(accum.theNewPhi * inorm));
770 }
771 else
772 {
773 this->setEta(0);
774 this->setPhi(0);
775 }
776
777 this->setE(accum.theNewEnergy);
778
779 if ( m_timeNorm != 0. )
780 this->setTime(accum.theNewTime/m_timeNorm);
781 else
782 this->setTime(0);
783
784
786 // Check Sampling Variable Updates //
788
789 if ( !updateLayers ) return;
790 if ( this->allLocked() ) return;
791 // update sampling quantities
792
793 for(int i=0;i<(int)CaloSampling::Unknown;i++) {
794 if ( !accum.PresenceInSample[i] ) continue;
795 // check sampling bit
798 if ( m_posSamNorm[i] != 0 ) {
799 double inorm = 1 / m_posSamNorm[i];
800 accum.EtaInSample[i] *= inorm;
801 accum.PhiInSample[i] = CaloPhiRange::fix (accum.PhiInSample[i] * inorm);
802 }
803 }
804
805#define SETVAR(v, a) maybeSetVariable(v, a, (a)+sizeof(a)/sizeof((a)[0]))
806 SETVAR (CaloVariableType::ENERGY, accum.EnergyInSample);
807 SETVAR (CaloVariableType::ETA, accum.EtaInSample);
808 SETVAR (CaloVariableType::PHI, accum.PhiInSample);
809 SETVAR (CaloVariableType::MAX_ENERGY, accum.MaxEnergyInSample);
810 SETVAR (CaloVariableType::MAX_ETA, accum.EtaMaxEnergyInSample);
811 SETVAR (CaloVariableType::MAX_PHI, accum.PhiMaxEnergyInSample);
812#undef SETVAR
813
814 if ( m_nBarrel < 0 ) m_nBarrel = 0;
815 if ( m_nEndcap < 0 ) m_nEndcap = 0;
816
817 m_barrel = (m_nBarrel>0);
818 m_endcap = (m_nEndcap>0);
819}
820
822// Basic Data Management //
824
836double
838 const sampling_type& samType,
839 bool useLink ) const
840{
841 const CaloSamplingData* pDataStore = this->getDataStore(varType,useLink);
842 return pDataStore != nullptr
843 ? pDataStore->retrieveData(varType,samType)
844 : double(0);
845}
846
856bool
858 std::vector<double>& varList,
859 bool useLink) const
860{
861 const CaloSamplingData* pDataStore = this->getDataStore(varType,useLink);
862 return pDataStore != nullptr ? pDataStore->retrieveData(varType,varList) : false;
863}
864
871bool
873 const sampling_type& samType,
874 const double& varData,
875 bool useLink)
876{
877 // check samplingpattern
878 if(!this->hasSampling(samType)){
879 // std::cout << " Cluster does not have sampling " << samType << std::endl;
882 }
883
884 // allocate modifiable data store
885 CaloSamplingData* pDataStore = this->getDataStore(varType,useLink);
886 return pDataStore != nullptr
887 ? pDataStore->storeData(varType,samType,varData)
888 : false;
889}
890
891bool
893 const std::vector<double>& varList,
894 bool useLink)
895{
896 CaloSamplingData* pDataStore = this->getDataStore(varType,useLink);
897 return pDataStore != nullptr
898 ? pDataStore->storeData(varType,varList)
899 : false;
900}
901
903// Retrieve and Set Sampling Variables //
905
906// most methods are inlined!
907void
909{
910 if ( this->isEMSampling(sampling) )
911 this->setVariable(CaloVariableType::MAX_ENERGY,sampling,m,true);
912}
913
915{
916 if ( this->isEMSampling(sampling) )
917 this->setVariable(CaloVariableType::MAX_ETA,sampling,m,true);
918}
919
921{
922 if ( this->isEMSampling(sampling) )
923 this->setVariable(CaloVariableType::MAX_PHI,sampling,m,true);
924}
925
930void CaloCluster::setetasize(sampling_type sampling, double size)
931{
932 if ( this->isEMSampling(sampling) )
933 this->setVariable(CaloVariableType::DELTA_ETA,sampling,size,true);
934}
935
940void CaloCluster::setphisize(sampling_type sampling, double size)
941{
942 if ( this->isEMSampling(sampling) )
943 this->setVariable(CaloVariableType::DELTA_PHI,sampling,size,true);
944}
945
952double
954 const int& sam) const
955{
956 // check input
957 unsigned int iSamp((unsigned int)sam);
958 if ( iSamp > 3 ) return m_errorValue;
959
960 // barrel and endcap
961 if ( this->inBarrel() && this->inEndcap() )
962 {
963 // offsets for sampling indicators
964 unsigned int bOff = (unsigned int)CaloSampling::PreSamplerB;
965 unsigned int eOff = (unsigned int)CaloSampling::PreSamplerE;
967 (CaloSampling::CaloSample)(bOff+iSamp);
969 (CaloSampling::CaloSample)(eOff+iSamp);
970 double eBarrel = this->getVariable(CaloVariableType::ENERGY,
971 bSample,true);
972 double eEndCap = this->getVariable(CaloVariableType::ENERGY,
973 eSample,true);
974
975 double vBarrel = this->getVariable(varType,bSample,true);
976 double vEndCap = this->getVariable(varType,eSample,true);
977
978 // Deal with invalid eta/phi values.
979 if (varType == CaloVariableType::PHI ||
980 varType == CaloVariableType::ETA)
981 {
982 if (vBarrel <= m_errorValue) {
983 vBarrel = 0;
984 eBarrel = 0;
985 }
986 if (vEndCap <= m_errorValue) {
987 vEndCap = 0;
988 eEndCap = 0;
989 }
990 }
991
992 // invalid signals
993 double eSum = eBarrel + eEndCap;
994 if ( eSum == 0. ) return m_errorValue;
995 // average
996 double vAverage(m_errorValue);
997 switch ( varType )
998 {
1000 {
1001 double phiSum =
1002 eSum * vBarrel + eEndCap * CaloPhiRange::diff(vEndCap,vBarrel);
1003 vAverage = CaloPhiRange::fix(phiSum/eSum);
1004 break;
1005 }
1007 {
1008 vAverage = ( eBarrel * vBarrel + eEndCap * vEndCap ) / eSum;
1009 break;
1010 }
1012 {
1013 vAverage = eSum;
1014 break;
1015 }
1016 default:
1017 {
1018 break;
1019 }
1020 }
1021 return vAverage;
1022 }
1023
1024 // barrel only
1025 if ( this->inBarrel() )
1026 {
1027 unsigned int bOff = (unsigned int)CaloSampling::PreSamplerB;
1028 CaloSampling::CaloSample bSample =
1029 (CaloSampling::CaloSample)(bOff+iSamp);
1030 return this->getVariable(varType,bSample);
1031 }
1032
1033 // endcap only
1034 if ( this->inEndcap() )
1035 {
1036 unsigned int eOff = (unsigned int)CaloSampling::PreSamplerE;
1038 (CaloSampling::CaloSample)(eOff+iSamp);
1039 return this->getVariable(varType,eSample);
1040 }
1041
1042 // just in case
1043 return m_errorValue;
1044}
1045
1055const CaloSamplingData*
1056CaloCluster::getDataStore(const variable_type& varType,bool traceLink) const
1057{
1058 //
1059 //DEBUGstd::cout << "[CaloCluster@" << this
1060 //DEBUG << "]::getDataStore - const data store pointer requested, "
1061 //DEBUG << "try internal pointer = " << &m_dataStore;
1062
1063 // check if variable in local data store
1064 if ( m_dataStore.contains(varType) )
1065 {
1066 // std::cout << "...successful!" << std::endl;
1067 return &m_dataStore;
1068 }
1069
1070 // check linked data store if requested
1071 if ( traceLink && m_dataLink.isValid())
1072 {
1073 //DEBUG std::cout << "... unsuccessful, use linked pointer "
1074 //DEBUG << &((*m_dataLink)->getSamplingStore()) << std::endl;
1075 return &((*m_dataLink)->getSamplingStore());
1076 }
1077
1078 //DEBUGstd::cout << "... failed, no external or internal pointer available!"
1079 //DEBUG << std::endl;
1080 return (const CaloSamplingData*)nullptr;
1081}
1082
1093CaloCluster::getDataStore(const variable_type& varType,bool traceLink)
1094{
1095 if ( m_dataStore.contains(varType) )
1096 {
1097 return &m_dataStore;
1098 }
1099
1100 // check external store if requested
1101 if ( m_ownDataStore && !m_dataLink.isValid()) {
1102 m_shower = new CaloShower();
1103 m_dataLink.setElement(m_shower);
1104 }
1105
1106 // trace
1107 if ( ( traceLink || m_ownDataStore ) && m_shower )
1108 {
1109 return &(m_shower->getSamplingStore());
1110 }
1111
1112 return (CaloSamplingData*)nullptr;
1113}
1114
1116// Moments //
1118
1120{
1121 moment_iterator iMom;
1122 // get store pointers
1123 const CaloClusterMomentStore* pFirstMomStore = nullptr;
1124 const CaloClusterMomentStore* pSecndMomStore = nullptr;
1125 // try to return valid iterator to first data object...
1126 if ( this->getMomentStorePtrs(pFirstMomStore,pSecndMomStore,
1127 useLink) ) //DEBUG,"begin") )
1128 {
1129 iMom = moment_iterator(pFirstMomStore->begin(),pFirstMomStore,
1130 pSecndMomStore);
1131 }
1132 else
1133 {
1134 iMom = moment_iterator();
1135 }
1136
1137 return iMom;
1138}
1139
1140
1142{
1143 const CaloClusterMomentStore* pFirstMomStore = nullptr;
1144 const CaloClusterMomentStore* pSecndMomStore = nullptr;
1145 if ( this->getMomentStorePtrs(pFirstMomStore,pSecndMomStore,useLink) )
1146 //DEBUG,"end") )
1147 {
1149 pSecndMomStore != nullptr && pSecndMomStore->size() > 0
1150 ? pSecndMomStore->end()
1151 : pFirstMomStore->end();
1152 return moment_iterator(lMom,pFirstMomStore,pSecndMomStore);
1153 }
1154 else
1155 {
1156 return {};
1157 }
1158}
1159
1161{
1162 // follow link policy
1163 if ( !useLink ) return &m_momentStore;
1164
1165 // check on external link usage
1166 if ( ( m_dataLink.isValid() || m_ownDataStore ) && m_dataLink.isValid() )
1167 return &((*m_dataLink)->getMomentStore());
1168
1169 return (const CaloClusterMomentStore*)nullptr;
1170}
1171
1173{
1174 // follow link policy: do not use link!
1175 if ( !useLink ) return &m_momentStore;
1176
1177 // follow link policy: use link!
1178 if ( m_ownDataStore && m_dataLink.isValid() == 0 )
1179 {
1180 m_shower = new CaloShower();
1181 m_dataLink.setElement(m_shower);
1182 return this->getMomentStore(useLink);
1183 }
1184
1185 if ( m_shower || m_ownDataStore )
1186 {
1187 return &(m_shower->getMomentStore());
1188 }
1189 return (CaloClusterMomentStore*)nullptr;
1190}
1191
1193 bool useLink)
1194{
1195 // this is the "write" implementation!
1196 return m_momentStore.contains(momType)
1197 ? &m_momentStore // moment already in local store
1198 : this->getMomentStore(useLink); // retrieve local or external
1199}
1200
1202CaloCluster::getMomentStore(const moment_type& momType, bool useLink) const
1203{
1204 // local store
1205 if ( m_momentStore.contains(momType) ) return &m_momentStore;
1206
1207 // external store
1208 const CaloClusterMomentStore* pMomStore = this->getMomentStore(useLink);
1209
1210 //
1211 return pMomStore != nullptr && pMomStore->contains(momType)
1212 ? pMomStore : (const CaloClusterMomentStore*) nullptr;
1213}
1214
1215bool
1217 pFirstMomStore,
1219 pSecndMomStore,
1220 bool useLink) const
1221// const std::string& mode) const
1222{
1223 // first store is assumed local by default
1224 pFirstMomStore = this->getMomentStore();
1225 // second store is assumed NOT to exist by default
1226 pSecndMomStore = nullptr;
1227 // local first store does not exist or is empty...
1228 if ( pFirstMomStore == nullptr || pFirstMomStore->size() == 0 )
1229 {
1230 // ...try to make external store the first one!
1231 pFirstMomStore = this->getMomentStore(useLink);
1232 }
1233 // local first store exists...
1234 else
1235 {
1236 // ...check if second store available!
1237 pSecndMomStore = useLink ? this->getMomentStore(useLink) : nullptr;
1238 }
1239 return pFirstMomStore != nullptr;
1240}
1241
1248 const moment_value& momData,
1249 bool useLink)
1250{
1251 // use momType for getMomentStore to override useLink in case
1252 // the moment has already been stored and should just be updated ...
1253 CaloClusterMomentStore* pMomStore = this->getMomentStore(momType,useLink);
1254 if ( pMomStore != nullptr ) pMomStore->insert(momType,momData);
1255}
1256
1265bool
1267 moment_value& momData,
1268 bool useLink) const
1269{
1270 const CaloClusterMomentStore* pMomStore = this->getMomentStore(momType,
1271 useLink);
1272 return pMomStore != nullptr
1273 ? pMomStore->retrieve(momType,momData)
1274 : false;
1275}
1276
1277bool
1279 double& momValue,
1280 bool useLink) const
1281{
1282 CaloClusterMoment momData(0);
1283 if ( this->retrieveMoment(momType,momData,useLink) )
1284 {
1285 momValue = momData.getValue();
1286 return true;
1287 }
1288 return false;
1289}
1290
1291
1292// lock variable
1294{
1295 unsigned int bitPattern(CaloVariableType::getVariableBit(varType));
1296 m_lockPattern = ( m_lockPattern | bitPattern );
1297 return this->isLocked(bitPattern);
1298}
1299
1300// unlock variable
1302{
1303 unsigned int bitPattern(CaloVariableType::getVariableBit(varType));
1304 if ( this->isLocked(bitPattern) )
1305 {
1306 m_lockPattern = m_lockPattern ^ bitPattern;
1307 return ! this->isLocked(bitPattern);
1308 }
1309 else
1310 {
1311 return false;
1312 }
1313}
1314
1315double CaloCluster::getRawE() const { return m_rawE; }
1316double CaloCluster::getRawEta() const { return m_rawEta; }
1317double CaloCluster::getRawPhi() const { return m_rawPhi; }
1318double CaloCluster::getRawM() const { return m_rawM; }
1319
1320void CaloCluster::setRawE(double e) { m_rawE = e; }
1323void CaloCluster::setRawM(double m) { m_rawM = m; }
1324
1325double CaloCluster::getAltE() const { return m_altE; }
1326double CaloCluster::getAltEta() const { return m_altEta; }
1327double CaloCluster::getAltPhi() const { return m_altPhi; }
1328double CaloCluster::getAltM() const { return m_altM; }
1329
1330void CaloCluster::setAltE(double e) { m_altE = e; }
1333void CaloCluster::setAltM(double m) { m_altM = m; }
1334
1335double CaloCluster::getCalE() const { return P4EEtaPhiM::e(); }
1336double CaloCluster::getCalEta() const { return P4EEtaPhiM::eta(); }
1337double CaloCluster::getCalPhi() const { return P4EEtaPhiM::phi(); }
1338double CaloCluster::getCalM() const { return P4EEtaPhiM::m(); }
1339
1344
1346{
1347 if ( !this->hasSignalState(s) ) return false;
1348
1349 m_signalState = s;
1350
1351 return
1352 s == statename_t::CALIBRATED ? this->setStateCal() :
1354 s == statename_t::UNCALIBRATED ? this->setStateRaw() :
1355 false;
1356}
1357
1364
1366{
1367 return s == m_signalState;
1368}
1369
1374
1376{
1377 // std::cout << "CaloCluster [" << this
1378 // << "] setStateRaw()" << std::endl;
1383 //
1388 //
1389 return true;
1390}
1391
1393{
1394 // std::cout << "CaloCluster [" << this
1395 // << "] setStateAlt()" << std::endl;
1400 //
1405 return true;
1406}
1407
1409{
1410 // std::cout << "CaloCluster [" << this
1411 // << "] setStateCal()" << std::endl;
1416 //
1421 return true;
1422}
1423
1425{
1426 m_badChannelData.push_back(badChannel);
1427}
1428
1430{
1431 m_badChannelData.clear();
1432}
1433
1438
1440
1441 unsigned int size = 0;
1442 if(m_clusterSize==SW_55ele ||
1445 size = 5;
1446 }else if(m_clusterSize==SW_35ele ||
1452 size = 3;
1453 }else if(m_clusterSize==SW_7_11){
1454 size = 7;
1455 }
1456
1457 return size;
1458
1459}
1460
1462
1463 unsigned int size = 0;
1464 if(m_clusterSize==SW_55ele ||
1470 size = 5;
1471 }else if(
1475 size = 7;
1476 }else if(m_clusterSize==SW_7_11){
1477 size = 11;
1478 }
1479
1480 return size;
1481
1482}
1483
1484CLHEP::HepLorentzVector
1486 if(hasSignalState(s)){
1487 switch (s) {
1489 P4EEtaPhiM tmp = *this;
1490 return tmp.hlv();
1491 }
1494 return tmp.hlv();
1495 }
1498 return tmp.hlv();
1499 }
1500 default:
1501 break;
1502 }
1503 }
1504 return this->hlv();
1505}
1506
1508{
1509 return m_samplingPattern;
1510}
1511
1512
1513// MomentStoreIter methods moved out-of-line to avoid a cling problem.
1514// Symptom was that iteration over the moments would enter an infinte
1515// loop in the ESD_18.0.0 test of CaloAthenaPool.
1516
1521 const moment_store* firstStore,
1522 const moment_store* secndStore/*=0*/)
1523 : m_iter(iter), m_firstStore(firstStore), m_secndStore(secndStore)
1524{ }
1525
1527
1530{
1531 m_iter++;
1532 if ( m_iter == m_firstStore->end() &&
1533 ( m_secndStore != nullptr && m_secndStore->size() > 0 ) )
1534 {
1535 m_iter = m_secndStore->begin();
1536 }
1537 return *this;
1538}
1539
1542{
1543 if ( m_secndStore != nullptr && m_iter == m_secndStore->begin() )
1544 {
1545 m_iter = m_firstStore->end();
1546 }
1547 m_iter--;
1548 return *this;
1549}
1550
1559
1562{ return m_iter == anOther.m_iter; }
1563
1565{ return m_iter != anOther.m_iter; }
1566
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
#define SETVAR(v, a)
Definition of CaloDetDescrManager.
CaloPhiRange class declaration.
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
float time() const
get time (data member)
Definition CaloCell.h:368
virtual double e() const override final
get energy (data member) (synonym to method energy()
Definition CaloCell.h:333
virtual double phi() const override final
get phi (through CaloDetDescrElement)
Definition CaloCell.h:375
const CaloDetDescrElement * caloDDE() const
get pointer to CaloDetDescrElement (data member)
Definition CaloCell.h:321
uint16_t provenance() const
get provenance (data member)
Definition CaloCell.h:354
virtual double eta() const override final
get eta (through CaloDetDescrElement)
Definition CaloCell.h:382
Stores CaloClusterMoment in a keyed map.
virtual moment_iterator end() const
iterator loop terminator
CaloClusterMomentIterator moment_iterator
External moment iterator type.
virtual void insert(const moment_type &rMomType, const moment_value &rMomData)
Insert key/data pair.
virtual bool retrieve(const moment_type &rMomType, moment_value &rMomData) const
Retrieve cluster moment for a given key.
size_t size() const
Number of stored moments.
virtual bool contains(const moment_type &rMomType) const
Containment check.
virtual moment_iterator begin() const
{
defines enums and data types for different moments of CaloCluster
const double & getValue() const
returns the value of this moment
CaloClusterNavigable()
default constructor
const CaloClusterMoment & operator*() const
Operator access to CaloClusterMoment.
const moment_store * m_secndStore
Pointer to second CaloClusterMomentStore.
MomentStoreIter prev()
Step back iterator.
bool operator==(const MomentStoreIter &anOther) const
Equality comparator.
const moment_store * m_firstStore
Pointer to first CaloClusterMomentStore.
MomentStoreIter operator--()
Post-step back operator.
MomentStoreIter next()
Advance iterator.
MomentStoreIter()
Default constructor builds unusable iterator.
moment_iterator_i m_iter
Actual iterator on CaloClusterMomentStore.
bool operator!=(const MomentStoreIter &anOther) const
Inequality comparator.
moment_type getMomentType() const
Function access to moment type.
MomentStoreIter operator++()
Post-advance operator.
const CaloClusterMoment & getMoment() const
Function access to CaloClusterMoment.
Principal data class for CaloCell clusters.
void setphimax(sampling_type sampling, double m)
Set the of cell with maximum energy in a given sampling.
bool getMomentStorePtrs(const CaloClusterMomentStore *&pFirstStore, const CaloClusterMomentStore *&pSecndStore, bool useLink) const
double eta0() const
Returns raw of cluster seed.
void setRawEta(double eta)
Set raw eta.
double eSample(sampling_type sampling) const
Retrieve energy in a given sampling.
bool retrieveMoment(const moment_type &momType, moment_value &momValue, bool useLink=true) const
Retrieve individual moment.
virtual CLHEP::HepLorentzVector hlv() const
redefine hlv() here to avoid ambiguities
SET_VALUE m_setM
Pointer to setter functions.
double getAltM() const
Access to calibrated (cell weight) m.
MomentStoreIter moment_iterator
Moment iterator type for CaloCluster clients.
CaloClusterMomentStore m_momentStore
cluster moments
void calculateKine(const bool useweight=true, const bool updateLayers=true)
Calculate cluster kinematics from contained cells.
void setRawM(double m)
Set raw m.
void resetBadChannel()
Reset Bad channel list.
unsigned int getClusterEtaSize() const
bool setStateRaw()
Helper to switch to raw state.
unsigned int m_samplingPattern
Sampling pattern.
double m_altE
Stores calibrated (cell weight) signal.
virtual ~CaloCluster()
Destructor.
virtual double m() const
Retrieve mass independent of signal state.
double getRawPhi() const
Access to raw phi.
void addBadChannel(const CaloClusterBadChannelData &badChannel)
Add Bad channel information.
virtual double e() const
Retrieve energy independent of signal state.
CaloCompositeCellBase< CaloClusterNavigable >::cell_iterator cell_iterator
Iterator on CaloCell s.
virtual bool hasSignalState(signalstate_t s) const
check if signal state exists for current implementation
double m_altPhi
Stores calibrated (cell weight) signal.
void setCalPhi(double phi)
Set calibrated (LC) phi.
double variableBE(const variable_type &theVariable, const int &samplingIndex) const
Rewrite as for calculation.
virtual bool setSignalState(signalstate_t s)
Sets signal state.
int m_nEndcap
Counter for number of endcap cells with non-zero weight and energy.
SET_VALUE m_setE
Pointer to setter functions.
double getCalEta() const
Access to calibrated (LC) eta.
double getAltE() const
Access to calibrated (cell weight) energy.
std::vector< CaloClusterBadChannelData > badChannelList
Get Bad Channel information.
double getRawM() const
Access to raw mass.
void setetamax(sampling_type sampling, double m)
Set the of cell with maximum energy in a given sampling.
void insertMoment(const moment_type &momType, const moment_value &momValue, bool useLink=true)
Set individual moment.
void setAltE(double e)
Set calibrated (cell weight) energy.
signalstate_t m_signalState
Stores actual signal state.
double getRawEta() const
Access to raw eta.
void setCalE(double e)
Set calibrated (LC) energy.
bool setVariable(const variable_type &varType, const sampling_type &samType, const double &varData, bool useLink=false)
General sampling variable setter.
bool lockVariable(const variable_type &varType)
Lock variable (protect against future updates)
void setRawPhi(double phi)
Set raw phi.
virtual double eta() const
Retrieve eta independent of signal state.
CaloVariableType::VariableType variable_type
Data type indicator.
bool setStateCal()
Helper to switch to calibrated (LC) state.
double getTime() const
Access cluster time.
virtual void setEta(double eta)
Set eta.
signalstate_t m_defSigState
Stores default signal state.
virtual bool isAtSignalState(signalstate_t s) const
check if we are at the passed state
moment_iterator beginMoment(bool useLink=true) const
First iterator on moment store.
void setRawE(double e)
Set raw energy.
void setCalM(double m)
Set calibrated (LC) m.
CaloSamplingData * getDataStore(const variable_type &theVariable, bool useLink=true)
virtual void resetSignalState()
reset the signal state
bool m_endcap
Flag is true if at least one cell in EMB.
double getAltPhi() const
Access to calibrated (cell weight) phi.
std::vector< double > m_posSamNorm
Stores the normalization e.g.
CaloCluster(double eta0=0, double phi0=0, unsigned int varTypePattern=0x00000000, unsigned int clusterSize=CaloCluster::SW_55ele)
Constructor.
moment_store::moment_iterator moment_iterator_i
Cluster moment store iterator type.
double getCalPhi() const
Access to calibrated (LC) phi.
double getCalM() const
Access to calibrated (LC) m.
bool isLocked(const variable_type &varType) const
Check lock status of variable.
bool unlockVariable(const variable_type &varType)
Unlock variable (remove lock)
double m_altM
Stores calibrated (cell weight) signal.
double getCalE() const
Access to calibrated (LC) energy.
moment_iterator endMoment(bool useLink=true) const
Last iterator on moment store.
double getVariable(const variable_type &varType, const sampling_type &samType, bool useLink=true) const
General sampling variable access.
bool setStateAlt()
Helper to switch to calibrated (cell weight) state.
unsigned int samplingPattern() const
Get sampling bitmask.
bool setDefaultSignalState(signalstate_t s)
Sets default signal state.
const badChannelList * getBadChannel() const
double getAltEta() const
Access to calibrated (cell weight) eta.
double m_timeNorm
Stores the normalization for time calculation e.g.
SET_VALUE m_setPhi
Pointer to setter functions.
void setTime(double theTime)
Set cluster time.
bool inEndcap() const
Returns true if at least one clustered cell in EMEC.
SET_VALUE m_setEta
Pointer to setter functions.
bool isEMSampling(const sampling_type &theSampling) const
Checks if cells from a given sampling in EMB and EMEC are in the cluster.
bool hasSampling(const sampling_type &theSampling) const
Checks if certain sampling contributes to cluster.
unsigned int getClusterPhiSize() const
bool setStores(CaloShower *pData, CaloCellLink *pLink, bool ownStores=true)
Setup internal store.
moment_store::moment_value moment_value
Cluster moment value type.
double m_posNorm
Stores the normalization e.g.
CaloClusterMomentStore * getMomentStore(bool useLink=true)
GET_VALUE m_getPhi
Pointer to getter functions.
virtual double phi() const
Retrieve phi independent of signal state.
bool allLocked() const
Check if all variables are locked.
double getRawE() const
Access to raw energy.
CaloClusterMomentStore moment_store
Store type for cluster moments.
static const double m_errorValue
Internal error return for real numbers.
void setenergymax(sampling_type sampling, double m)
Set the maximum energy in a given sampling.
void setphisize(sampling_type sampling, double size)
Set the cluster size in for a given sampling.
CaloSamplingData m_dataStore
{\ brief Cached Stores
virtual void updateKine(const CaloCell *theCell, double weight)
Updates cluster kinematics when cell is added.
moment_store::moment_type moment_type
Cluster moment indicator type.
GET_VALUE m_getEta
Pointer to getter functions.
GET_VALUE m_getM
Pointer to getter functions.
void setAltPhi(double phi)
Set calibrated (cell weight) phi.
unsigned int m_clusterSize
Cluster size (e.g.
void setCalEta(double eta)
Set calibrated (LC) eta.
CaloSampling::CaloSample sampling_type
Sampling indicator.
double phi0() const
Returns raw of cluster seed.
int m_nBarrel
Counter for number of barrel cells with non-zero weight and energy.
void setAltM(double m)
Set calibrated (cell weight) m.
void setetasize(sampling_type sampling, double size)
Set the cluster size in for a given sampling.
bool m_barrel
Flag is true if at least one cell in EMB.
virtual void setPhi(double phi)
Set phi.
GET_VALUE m_getE
Pointer to getter functions.
double m_altEta
Stores calibrated (cell weight) signal.
double m_basicSignal
Stores basic energy signal.
unsigned int m_lockPattern
Variable lock pattern.
void setAltEta(double eta)
Set calibrated (cell weight) eta.
bool inBarrel() const
Returns true if at least one clustered cell in EMB.
virtual void setE(double e)
Set energy.
void setRecoStatus(const CaloRecoStatus &recStatus)
Set the reconstruction status.
const CaloRecoStatus & getRecoStatus() const
Retrieve the reconstruction status.
This class groups all DetDescr information related to a CaloCell.
CaloCell_ID::CaloSample getSampling() const
cell sampling
static double fix(double phi)
static double diff(double phi1, double phi2)
simple phi1 - phi2 calculation, but result is fixed to respect range.
Simple data object to store all variables in calorimeter samplings.
value_type retrieveData(variable_key_type theVariable, sampling_key_type theSampling) const
Retrieve const reference to individual variable.
bool storeData(variable_key_type theVariable, sampling_key_type theSampling, value_type theData)
}
static unsigned int getSamplingBit(const CaloSample &rSample)
Return a unique bit set for a given sampling.
Data class for cluster variables associated with a CaloCluster.
Definition CaloShower.h:12
I4Momentum is an abstract base class providing 4-momentum behavior.
Definition I4Momentum.h:31
ISignalState is an abstract base class providing support for various Signal States to be associated w...
P4EEtaPhiMBase is a base class for classes with 4-momentum behavior, for which E, eta,...
double m_m
Definition P4EEtaPhiM.h:78
virtual void setM(double theM)
set mass data member
Definition P4EEtaPhiM.h:123
virtual double e() const
get energy data member
Definition P4EEtaPhiM.h:102
double m_eta
Definition P4EEtaPhiM.h:76
virtual double phi() const
get phi data member
Definition P4EEtaPhiM.h:108
double m_phi
Definition P4EEtaPhiM.h:77
virtual void setEta(double theEta)
set eta data member
Definition P4EEtaPhiM.h:117
P4EEtaPhiM(const double e, const double eta, const double phi, const double m)
constructor with all data members
Definition P4EEtaPhiM.cxx:7
virtual void setE(double theE)
set energy data member
Definition P4EEtaPhiM.h:114
virtual double eta() const
get eta data member
Definition P4EEtaPhiM.h:105
virtual void setPhi(double thePhi)
set phi data member
Definition P4EEtaPhiM.h:120
double m_e
Definition P4EEtaPhiM.h:75
virtual double m() const
get mass data member
Definition P4EEtaPhiM.h:111
void nextDDE(Iter iter, Iter endIter)
Prefetch next CaloDDE.
void prefetchObj(const T *ptr)
Generic prefetch of the object of specific types (sizes).
Definition prefetch.h:108
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
Functions to prefetch blocks of memory.
double proxim(double b, double a)
Definition proxim.h:17
static unsigned int getVariableBit(const VariableType &varType)