CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CaloRecHitMixer.cc
Go to the documentation of this file.
2 
9 
14 //typedef CaloRecHitMixer<ZDCRecHit> ZDCRecHitMixer;
16 
17 //-------------------------------------------------------------------------------
18 // define 'buildRecHit' functions used for different types of recHits
19 //-------------------------------------------------------------------------------
20 
21 template <typename T>
23 {
24  assert(0); // CV: make sure general function never gets called;
25  // always use template specializations
26 }
27 
28 // template specialization for ECAL recHits
29 //
30 // NOTE: rh1 should refer to simulated tau decay products,
31 // rh2 to Zmumu event
32 //
33 template <>
35 {
36  // CV: take status flags and timing information from simulated tau decay products
37  // (suggested by Florian Beaudette)
38  const EcalRecHit* recHit_ecal = NULL;
39  if ( recHitInfo.isRecHit1_ ) recHit_ecal = recHitInfo.recHit1_;
40  else if ( recHitInfo.isRecHit2_ ) recHit_ecal = recHitInfo.recHit2_;
41 
42  assert(recHit_ecal);
43  assert(recHitInfo.isRecHitSum_);
44 
45  EcalRecHit mergedRecHit(*recHit_ecal);
46  mergedRecHit.setEnergy(recHitInfo.energySum_);
47 
48  /* TODO Does not make sense
49  uint32_t flagBits = 0;
50  for ( int flag = 0; flag < 32; ++flag ) {
51  if ( recHit_ecal->checkFlag(flag) ) flagBits += (0x1 << flag);
52  }
53  EcalRecHit mergedRecHit(recHit_ecal->detid(), recHitInfo.energySum_, recHit_ecal->time(), recHit_ecal->flags(), flagBits);
54  mergedRecHit.setAux(recHit_ecal->aux());
55  */
56 
57  return mergedRecHit;
58 }
59 
60 // template specialization for different types of HCAL recHits
61 //
62 // NOTE: rh1 should refer to simulated tau decay products,
63 // rh2 to Zmumu event
64 //
65 namespace
66 {
67  template <typename T>
68  T buildRecHit_HCAL(const CaloRecHitMixer_mixedRecHitInfoType<T>& recHitInfo)
69  {
70  // CV: take status flags and timing information from simulated tau decay products
71  // (suggested by Florian Beaudette)
72  const CaloRecHit* recHit = 0;
73  if ( recHitInfo.isRecHit1_ ) recHit = recHitInfo.recHit1_;
74  else if ( recHitInfo.isRecHit2_ ) recHit = recHitInfo.recHit2_;
75  const T* recHit_hcal = static_cast<const T*>(recHit);
76  assert(recHit_hcal);
77  assert(recHitInfo.isRecHitSum_);
78  T mergedRecHit(recHit_hcal->detid(), recHitInfo.energySum_, recHit_hcal->time());
79  mergedRecHit.setFlags(recHit_hcal->flags());
80  mergedRecHit.setAux(recHit_hcal->aux());
81  return mergedRecHit;
82  }
83 }
84 
85 template <>
87 {
88  return buildRecHit_HCAL<HBHERecHit>(recHitInfo);
89 }
90 
91 template <>
93 {
94  return buildRecHit_HCAL<HORecHit>(recHitInfo);
95 }
96 
97 template <>
99 {
100  return buildRecHit_HCAL<HFRecHit>(recHitInfo);
101 }
102 
103 // template specialization for CASTOR recHits
104 //
105 // NOTE: rh1 should refer to simulated tau decay products,
106 // rh2 to Zmumu event
107 //
108 template <>
110 {
111  // CV: take status flags and timing information from simulated tau decay products
112  // (suggested by Florian Beaudette)
113  const CaloRecHit* recHit = 0;
114  if ( recHitInfo.isRecHit1_ ) recHit = recHitInfo.recHit1_;
115  else if ( recHitInfo.isRecHit2_ ) recHit = recHitInfo.recHit2_;
116  const CastorRecHit* recHit_castor = static_cast<const CastorRecHit*>(recHit);
117  assert(recHit_castor);
118  assert(recHitInfo.isRecHitSum_);
119  CastorRecHit mergedRecHit(recHit_castor->detid(), recHitInfo.energySum_, recHit_castor->time());
120  mergedRecHit.setFlags(recHit_castor->flags());
121  mergedRecHit.setAux(recHit_castor->aux());
122  return mergedRecHit;
123 }
124 
126 
131 //DEFINE_FWK_MODULE(ZDCRecHitMixer);
133 
134 
135 
T buildRecHit(const CaloRecHitMixer_mixedRecHitInfoType< T > &)
uint32_t aux() const
Definition: CaloRecHit.h:26
const DetId & detid() const
Definition: CaloRecHit.h:20
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
assert(m_qm.get())
#define NULL
Definition: scimark2.h:8
float time() const
Definition: CaloRecHit.h:19
uint32_t flags() const
Definition: CaloRecHit.h:21
CaloRecHitMixer< HORecHit > HORecHitMixer
CaloRecHitMixer< CastorRecHit > CastorRecHitMixer
void setFlags(uint32_t flags)
Definition: CaloRecHit.h:22
CaloRecHitMixer< HFRecHit > HFRecHitMixer
CaloRecHitMixer< EcalRecHit > EcalRecHitMixer
void setEnergy(float energy)
Definition: EcalRecHit.h:69
CaloRecHitMixer< HBHERecHit > HBHERecHitMixer
long double T