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 CaloRecHit* recHit = 0;
39  if ( recHitInfo.isRecHit1_ ) recHit = recHitInfo.recHit1_;
40  else if ( recHitInfo.isRecHit2_ ) recHit = recHitInfo.recHit2_;
41  const EcalRecHit* recHit_ecal = static_cast<const EcalRecHit*>(recHit);
42  assert(recHit_ecal);
43  assert(recHitInfo.isRecHitSum_);
44  uint32_t flagBits = 0;
45  for ( int flag = 0; flag < 32; ++flag ) {
46  if ( recHit_ecal->checkFlag(flag) ) flagBits += (0x1 << flag);
47  }
48  EcalRecHit mergedRecHit(recHit_ecal->detid(), recHitInfo.energySum_, recHit_ecal->time(), recHit_ecal->flags(), flagBits);
49  mergedRecHit.setAux(recHit_ecal->aux());
50  return mergedRecHit;
51 }
52 
53 // template specialization for different types of HCAL recHits
54 //
55 // NOTE: rh1 should refer to simulated tau decay products,
56 // rh2 to Zmumu event
57 //
58 namespace
59 {
60  template <typename T>
61  T buildRecHit_HCAL(const CaloRecHitMixer_mixedRecHitInfoType& recHitInfo)
62  {
63  // CV: take status flags and timing information from simulated tau decay products
64  // (suggested by Florian Beaudette)
65  const CaloRecHit* recHit = 0;
66  if ( recHitInfo.isRecHit1_ ) recHit = recHitInfo.recHit1_;
67  else if ( recHitInfo.isRecHit2_ ) recHit = recHitInfo.recHit2_;
68  const T* recHit_hcal = static_cast<const T*>(recHit);
69  assert(recHit_hcal);
70  assert(recHitInfo.isRecHitSum_);
71  T mergedRecHit(recHit_hcal->detid(), recHitInfo.energySum_, recHit_hcal->time());
72  mergedRecHit.setFlags(recHit_hcal->flags());
73  mergedRecHit.setAux(recHit_hcal->aux());
74  return mergedRecHit;
75  }
76 }
77 
78 template <>
80 {
81  return buildRecHit_HCAL<HBHERecHit>(recHitInfo);
82 }
83 
84 template <>
86 {
87  return buildRecHit_HCAL<HORecHit>(recHitInfo);
88 }
89 
90 template <>
92 {
93  return buildRecHit_HCAL<HFRecHit>(recHitInfo);
94 }
95 
96 // template specialization for CASTOR recHits
97 //
98 // NOTE: rh1 should refer to simulated tau decay products,
99 // rh2 to Zmumu event
100 //
101 template <>
103 {
104  // CV: take status flags and timing information from simulated tau decay products
105  // (suggested by Florian Beaudette)
106  const CaloRecHit* recHit = 0;
107  if ( recHitInfo.isRecHit1_ ) recHit = recHitInfo.recHit1_;
108  else if ( recHitInfo.isRecHit2_ ) recHit = recHitInfo.recHit2_;
109  const CastorRecHit* recHit_castor = static_cast<const CastorRecHit*>(recHit);
110  assert(recHit_castor);
111  assert(recHitInfo.isRecHitSum_);
112  CastorRecHit mergedRecHit(recHit_castor->detid(), recHitInfo.energySum_, recHit_castor->time());
113  mergedRecHit.setFlags(recHit_castor->flags());
114  mergedRecHit.setAux(recHit_castor->aux());
115  return mergedRecHit;
116 }
117 
119 
124 //DEFINE_FWK_MODULE(ZDCRecHitMixer);
126 
127 
128 
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
float time() const
Definition: CaloRecHit.h:19
bool checkFlag(int flag) const
check if the flag is true
Definition: EcalRecHit.h:106
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 setAux(uint32_t value)
Definition: CaloRecHit.h:25
CaloRecHitMixer< HBHERecHit > HBHERecHitMixer
T buildRecHit(const CaloRecHitMixer_mixedRecHitInfoType &)
long double T