test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
HcalHaloAlgo Class Reference

#include <HcalHaloAlgo.h>

Public Member Functions

reco::HcalHaloData Calculate (const CaloGeometry &TheCaloGeometry, edm::Handle< HBHERecHitCollection > &TheHBHERecHits)
 
float GetHBRecHitEnergyThreshold ()
 
float GetHERecHitEnergyThreshold ()
 
float GetPhiWedgeEnergyThreshold ()
 
int GetPhiWedgeNHitsThreshold ()
 
 HcalHaloAlgo ()
 
void SetPhiWedgeEnergyThreshold (float SumE)
 
void SetPhiWedgeNHitsThreshold (int nhits)
 
void SetPhiWedgeThresholds (float SumE, int nhits)
 
void SetRecHitEnergyThresholds (float HB, float HE)
 
 ~HcalHaloAlgo ()
 

Private Attributes

float HBRecHitEnergyThreshold
 
float HERecHitEnergyThreshold
 
int NHitsThreshold
 
float SumEnergyThreshold
 

Detailed Description

Definition at line 27 of file HcalHaloAlgo.h.

Constructor & Destructor Documentation

HcalHaloAlgo::HcalHaloAlgo ( )

Definition at line 17 of file HcalHaloAlgo.cc.

18 {
21  SumEnergyThreshold = 0.;
22  NHitsThreshold = 0;
23 }
float HERecHitEnergyThreshold
Definition: HcalHaloAlgo.h:56
float HBRecHitEnergyThreshold
Definition: HcalHaloAlgo.h:55
float SumEnergyThreshold
Definition: HcalHaloAlgo.h:59
int NHitsThreshold
Definition: HcalHaloAlgo.h:60
HcalHaloAlgo::~HcalHaloAlgo ( )
inline

Definition at line 32 of file HcalHaloAlgo.h.

32 {}

Member Function Documentation

HcalHaloData HcalHaloAlgo::Calculate ( const CaloGeometry TheCaloGeometry,
edm::Handle< HBHERecHitCollection > &  TheHBHERecHits 
)

Definition at line 25 of file HcalHaloAlgo.cc.

References Abs(), CompareTime(), reco::HcalHaloData::GetPhiWedges(), HcalBarrel, HcalEndcap, i, hit::id, HcalDetId::ieta(), j, reco::PhiWedge::SetPlusZOriginConfidence(), python.multivaluedict::sort(), and cond::rpcobgas::time.

Referenced by reco::HcalHaloDataProducer::produce().

26 {
27  HcalHaloData TheHcalHaloData;
28 
29  // Store Energy sum of rechits as a function of iPhi (iPhi goes from 1 to 72)
30  float SumE[73];
31  // Store Number of rechits as a function of iPhi
32  int NumHits[73];
33  // Store minimum time of rechit as a function of iPhi
34  float MinTimeHits[73];
35  // Store maximum time of rechit as a function of iPhi
36  float MaxTimeHits[73];
37  for(unsigned int i = 0 ; i < 73 ; i++ )
38  {
39  SumE[i] = 0;
40  NumHits[i]= 0;
41  MinTimeHits[i] = 0.;
42  MaxTimeHits[i] = 0.;
43  }
44 
45  for( HBHERecHitCollection::const_iterator hit = TheHBHERecHits->begin() ; hit != TheHBHERecHits->end() ; hit++ )
46  {
47  HcalDetId id = HcalDetId(hit->id());
48  switch ( id.subdet() )
49  {
50  case HcalBarrel:
51  if(hit->energy() < HBRecHitEnergyThreshold )continue;
52  break;
53  case HcalEndcap:
54  if(hit->energy() < HERecHitEnergyThreshold ) continue;
55  break;
56  default:
57  continue;
58  }
59 
60  int iEta = id.ieta();
61  int iPhi = id.iphi();
62  if(iPhi < 73 && TMath::Abs(iEta) < 23 )
63  {
64  SumE[iPhi]+= hit->energy();
65  NumHits[iPhi] ++;
66 
67  float time = hit->time();
68  MinTimeHits[iPhi] = time < MinTimeHits[iPhi] ? time : MinTimeHits[iPhi];
69  MaxTimeHits[iPhi] = time > MaxTimeHits[iPhi] ? time : MaxTimeHits[iPhi];
70  }
71  }
72 
73  for( int iPhi = 1 ; iPhi < 73 ; iPhi++ )
74  {
75  if( SumE[iPhi] >= SumEnergyThreshold && NumHits[iPhi] > NHitsThreshold )
76  {
77  // Build PhiWedge and store to HcalHaloData if energy or #hits pass thresholds
78  PhiWedge wedge(SumE[iPhi], iPhi, NumHits[iPhi], MinTimeHits[iPhi], MaxTimeHits[iPhi]);
79 
80  // Loop over rechits again to calculate direction based on timing info
81  std::vector<const HBHERecHit*> Hits;
82  for( HBHERecHitCollection::const_iterator hit = TheHBHERecHits->begin() ; hit != TheHBHERecHits->end() ; hit++ )
83  {
84 
85  HcalDetId id = HcalDetId(hit->id());
86  if( id.iphi() != iPhi ) continue;
87  if( TMath::Abs(id.ieta() ) > 22 ) continue; // has to overlap geometrically w/ HB
88  switch ( id.subdet() )
89  {
90  case HcalBarrel:
91  if(hit->energy() < HBRecHitEnergyThreshold )continue;
92  break;
93  case HcalEndcap:
94  if(hit->energy() < HERecHitEnergyThreshold ) continue;
95  break;
96  default:
97  continue;
98  }
99  Hits.push_back(&(*hit));
100  }
101 
102  std::sort( Hits.begin() , Hits.end() , CompareTime);
103  float MinusToPlus = 0.;
104  float PlusToMinus = 0.;
105  for( unsigned int i = 0 ; i < Hits.size() ; i++ )
106  {
107  HcalDetId id_i = HcalDetId(Hits[i]->id() );
108  int ieta_i = id_i.ieta();
109  for( unsigned int j = (i+1) ; j < Hits.size() ; j++ )
110  {
111  HcalDetId id_j = HcalDetId(Hits[j]->id() );
112  int ieta_j = id_j.ieta();
113  if( ieta_i > ieta_j ) PlusToMinus += TMath::Abs(ieta_i - ieta_j ) ;
114  else MinusToPlus += TMath::Abs(ieta_i - ieta_j);
115  }
116  }
117  float PlusZOriginConfidence = (PlusToMinus + MinusToPlus )? PlusToMinus / ( PlusToMinus + MinusToPlus ) : -1. ;
118  wedge.SetPlusZOriginConfidence( PlusZOriginConfidence );
119  TheHcalHaloData.GetPhiWedges().push_back( wedge );
120  }
121  }
122  return TheHcalHaloData;
123 
124 }
int i
Definition: DBlmapReader.cc:9
float HERecHitEnergyThreshold
Definition: HcalHaloAlgo.h:56
std::vector< HBHERecHit >::const_iterator const_iterator
T Abs(T a)
Definition: MathUtil.h:49
int ieta() const
get the cell ieta
Definition: HcalDetId.h:36
int j
Definition: DBlmapReader.cc:9
unsigned int id
float HBRecHitEnergyThreshold
Definition: HcalHaloAlgo.h:55
float SumEnergyThreshold
Definition: HcalHaloAlgo.h:59
bool CompareTime(const EcalRecHit *x, const EcalRecHit *y)
Definition: EcalHaloAlgo.cc:15
const std::vector< PhiWedge > & GetPhiWedges() const
Definition: HcalHaloData.h:21
int NHitsThreshold
Definition: HcalHaloAlgo.h:60
float HcalHaloAlgo::GetHBRecHitEnergyThreshold ( )
inline

Definition at line 46 of file HcalHaloAlgo.h.

References HBRecHitEnergyThreshold.

46 { return HBRecHitEnergyThreshold;}
float HBRecHitEnergyThreshold
Definition: HcalHaloAlgo.h:55
float HcalHaloAlgo::GetHERecHitEnergyThreshold ( )
inline

Definition at line 47 of file HcalHaloAlgo.h.

References HERecHitEnergyThreshold.

47 { return HERecHitEnergyThreshold;}
float HERecHitEnergyThreshold
Definition: HcalHaloAlgo.h:56
float HcalHaloAlgo::GetPhiWedgeEnergyThreshold ( )
inline

Definition at line 50 of file HcalHaloAlgo.h.

References SumEnergyThreshold.

50 { return SumEnergyThreshold;}
float SumEnergyThreshold
Definition: HcalHaloAlgo.h:59
int HcalHaloAlgo::GetPhiWedgeNHitsThreshold ( )
inline

Definition at line 51 of file HcalHaloAlgo.h.

References NHitsThreshold.

51 { return NHitsThreshold;}
int NHitsThreshold
Definition: HcalHaloAlgo.h:60
void HcalHaloAlgo::SetPhiWedgeEnergyThreshold ( float  SumE)
inline

Definition at line 41 of file HcalHaloAlgo.h.

References SumEnergyThreshold.

41 { SumEnergyThreshold = SumE ;}
float SumEnergyThreshold
Definition: HcalHaloAlgo.h:59
void HcalHaloAlgo::SetPhiWedgeNHitsThreshold ( int  nhits)
inline

Definition at line 42 of file HcalHaloAlgo.h.

References NHitsThreshold.

42 { NHitsThreshold = nhits ; }
int NHitsThreshold
Definition: HcalHaloAlgo.h:60
void HcalHaloAlgo::SetPhiWedgeThresholds ( float  SumE,
int  nhits 
)
inline

Definition at line 43 of file HcalHaloAlgo.h.

References NHitsThreshold, and SumEnergyThreshold.

Referenced by reco::HcalHaloDataProducer::produce().

43 { SumEnergyThreshold = SumE ; NHitsThreshold = nhits ;}
float SumEnergyThreshold
Definition: HcalHaloAlgo.h:59
int NHitsThreshold
Definition: HcalHaloAlgo.h:60
void HcalHaloAlgo::SetRecHitEnergyThresholds ( float  HB,
float  HE 
)
inline

Definition at line 38 of file HcalHaloAlgo.h.

References HBRecHitEnergyThreshold, and HERecHitEnergyThreshold.

Referenced by reco::HcalHaloDataProducer::produce().

float HERecHitEnergyThreshold
Definition: HcalHaloAlgo.h:56
float HBRecHitEnergyThreshold
Definition: HcalHaloAlgo.h:55

Member Data Documentation

float HcalHaloAlgo::HBRecHitEnergyThreshold
private

Definition at line 55 of file HcalHaloAlgo.h.

Referenced by GetHBRecHitEnergyThreshold(), and SetRecHitEnergyThresholds().

float HcalHaloAlgo::HERecHitEnergyThreshold
private

Definition at line 56 of file HcalHaloAlgo.h.

Referenced by GetHERecHitEnergyThreshold(), and SetRecHitEnergyThresholds().

int HcalHaloAlgo::NHitsThreshold
private
float HcalHaloAlgo::SumEnergyThreshold
private