CMS 3D CMS Logo

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

#include <HBHETimeProfileStatusBitSetter.h>

Classes

struct  compare_digi_energy
 

Public Member Functions

double EnergyThreshold ()
 
void hbheSetTimeFlagsFromDigi (HBHERecHitCollection *, std::vector< HBHEDataFrame >, std::vector< int >)
 
 HBHETimeProfileStatusBitSetter ()
 
 HBHETimeProfileStatusBitSetter (double R1Min, double R1Max, double R2Min, double R2Max, double FracLeaderMin, double FracLeaderMax, double SlopeMin, double SlopeMax, double OuterMin, double OuterMax, double EnergyThreshold)
 
void SetExpLimits (double R1Min, double R1Max, double R2Min, double R2Max)
 
void SetFracLeaderLimits (double FracLeaderMin, double FracLeaderMax)
 
void SetOuterLimits (double OuterMin, double OuterMax)
 
void SetSlopeLimits (double SlopeMin, double SlopeMax)
 
 ~HBHETimeProfileStatusBitSetter ()
 

Private Member Functions

double TotalEnergyInDataFrame (HBHEDataFrame x)
 

Private Attributes

double EnergyThreshold_
 
double FracLeaderMax_
 
double FracLeaderMin_
 
double OuterMax_
 
double OuterMin_
 
double R1Max_
 
double R1Min_
 
double R2Max_
 
double R2Min_
 
double SlopeMax_
 
double SlopeMin_
 

Detailed Description

This class sets status bit in the status words for the revised CaloRecHit objets according to informatino from the digi associated to the hit.

Date:
2008/11/26 11:09:24
Revision:
1.1
Author
B Jones – University of Bristol / University of Maryland

Definition at line 17 of file HBHETimeProfileStatusBitSetter.h.

Constructor & Destructor Documentation

HBHETimeProfileStatusBitSetter::HBHETimeProfileStatusBitSetter ( )

Full featured constructor for HB/HE and HO (HPD-based detectors)

Definition at line 11 of file HBHETimeProfileStatusBitSetter.cc.

References EnergyThreshold_, FracLeaderMax_, FracLeaderMin_, OuterMax_, OuterMin_, R1Max_, R1Min_, R2Max_, R2Min_, SlopeMax_, and SlopeMin_.

HBHETimeProfileStatusBitSetter::HBHETimeProfileStatusBitSetter ( double  R1Min,
double  R1Max,
double  R2Min,
double  R2Max,
double  FracLeaderMin,
double  FracLeaderMax,
double  SlopeMin,
double  SlopeMax,
double  OuterMin,
double  OuterMax,
double  EnergyThreshold 
)

Definition at line 27 of file HBHETimeProfileStatusBitSetter.cc.

References EnergyThreshold(), EnergyThreshold_, FracLeaderMax_, FracLeaderMin_, OuterMax_, OuterMin_, R1Max_, R1Min_, R2Max_, R2Min_, SlopeMax_, and SlopeMin_.

33 {
34  R1Min_ = R1Min;
35  R1Max_ = R1Max;
36  R2Min_ = R2Min;
37  R2Max_ = R2Max;
38  FracLeaderMin_ = FracLeaderMin;
39  FracLeaderMax_ = FracLeaderMax;
40  SlopeMin_ = SlopeMin;
41  SlopeMax_ = SlopeMax;
42  OuterMin_ = OuterMin;
43  OuterMax_ = OuterMax;
45 }
HBHETimeProfileStatusBitSetter::~HBHETimeProfileStatusBitSetter ( )

Definition at line 47 of file HBHETimeProfileStatusBitSetter.cc.

47 {}

Member Function Documentation

double HBHETimeProfileStatusBitSetter::EnergyThreshold ( )
inline
void HBHETimeProfileStatusBitSetter::hbheSetTimeFlagsFromDigi ( HBHERecHitCollection hbhe,
std::vector< HBHEDataFrame digi,
std::vector< int >  RecHitIndex 
)

Definition at line 57 of file HBHETimeProfileStatusBitSetter.cc.

References abs, FracLeaderMax_, HcalCaloFlagLabels::HSCP_ExpFit, HcalCaloFlagLabels::HSCP_FracLeader, HcalCaloFlagLabels::HSCP_OuterEnergy, HcalCaloFlagLabels::HSCP_R1R2, i, OuterMax_, R1Max_, R1Min_, R2Max_, R2Min_, and python.multivaluedict::sort().

Referenced by HcalHitReconstructor::produce().

58 {
59 
60  bool Bits[4]={false, false, false, false};
61  std::sort(digi.begin(), digi.end(), compare_digi_energy()); // sort digis according to energies
62  std::vector<double> PulseShape; // store fC values for each time slice
63  int DigiSize=0;
64  int LeadingEta=0;
65  int LeadingPhi=0;
66  bool FoundLeadingChannel=false;
67  for(std::vector<HBHEDataFrame>::const_iterator itDigi = digi.begin(); itDigi!=digi.end(); itDigi++)
68  {
69  if(!FoundLeadingChannel)
70  {
71  LeadingEta = itDigi->id().ieta();
72  LeadingPhi = itDigi->id().iphi();
73  DigiSize=(*itDigi).size();
74  PulseShape.clear();
75  PulseShape.resize(DigiSize,0);
76  FoundLeadingChannel=true;
77  }
78  if(abs(LeadingPhi - itDigi->id().iphi())<2)
79  for(int i=0; i!=DigiSize; i++)
80  PulseShape[i]+=itDigi->sample(i).nominal_fC();
81 
82  }
83 
84 
85 
86  if(RecHitIndex.size()>0)
87  {
88  double FracInLeader=-1;
89  //double Slope=0; // not currently used
90  double R1=-1;
91  double R2=-1;
92  double OuterEnergy=-1;
93  double TotalEnergy=0;
94  int PeakPosition=0;
95 
96  for(int i=0; i!=DigiSize; i++)
97  {
98  if(PulseShape[i]>PulseShape[PeakPosition])
99  PeakPosition=i;
100  TotalEnergy+=PulseShape[i];
101  }
102 
103 
104  if(PeakPosition < (DigiSize-2))
105  {
106  R1 = PulseShape[PeakPosition+1]/PulseShape[PeakPosition];
107  R2 = PulseShape[PeakPosition+2]/PulseShape[PeakPosition+1];
108  }
109 
110  FracInLeader = PulseShape[PeakPosition]/TotalEnergy;
111 
112  if((PeakPosition > 0) && (PeakPosition < (DigiSize-2)))
113  {
114  OuterEnergy = 1. -((PulseShape[PeakPosition - 1] +
115  PulseShape[PeakPosition] +
116  PulseShape[PeakPosition + 1] +
117  PulseShape[PeakPosition + 2] )
118  / TotalEnergy);
119 
120  }
121 
122  /* TH1D * HistForFit = new TH1D("HistForFit","HistForFit",DigiSize,0,DigiSize);
123  for(int i=0; i!=DigiSize; i++)
124  {
125  HistForFit->Fill(i,PulseShape[i]);
126  HistForFit->Fit("expo","WWQ","",PeakPosition, DigiSize-1);
127  TF1 * Fit = HistForFit->GetFunction("expo");
128  Slope = Fit->GetParameter("Slope");
129  }
130  delete HistForFit;
131  */
132  if (R1!=-1 && R2!=-1)
133  Bits[0] = (R1Min_ > R1) || (R1Max_ < R1) || (R2Min_ > R2) || (R2Max_ < R2);
134  if (FracInLeader!=-1)
135  Bits[1] = (FracInLeader < FracLeaderMin_) || (FracInLeader > FracLeaderMax_);
136  if (OuterEnergy!=-1)
137  Bits[2] = (OuterEnergy < OuterMin_) || (OuterEnergy > OuterMax_);
138  // Bits[3] = (SlopeMin_ > Slope) || (SlopeMax_ < Slope);
139  Bits[3] = false;
140 
141  } // if (RecHitIndex.size()>0)
142  else
143  {
144 
145  Bits[0]=false;
146  Bits[1]=false;
147  Bits[2]=false;
148  Bits[3]=true;
149 
150  } // (RecHitIndex.size()==0; no need to set Bit3 true?)
151 
152  for(unsigned int i=0; i!=RecHitIndex.size(); i++)
153  {
154 
155  // Write calculated bit values starting from position FirstBit
156  (*hbhe)[RecHitIndex.at(i)].setFlagField(Bits[0],HcalCaloFlagLabels::HSCP_R1R2);
157  (*hbhe)[RecHitIndex.at(i)].setFlagField(Bits[1],HcalCaloFlagLabels::HSCP_FracLeader);
158  (*hbhe)[RecHitIndex.at(i)].setFlagField(Bits[2],HcalCaloFlagLabels::HSCP_OuterEnergy);
159  (*hbhe)[RecHitIndex.at(i)].setFlagField(Bits[3],HcalCaloFlagLabels::HSCP_ExpFit);
160 
161  }
162 
163 
164 
165 }
int i
Definition: DBlmapReader.cc:9
#define abs(x)
Definition: mlp_lapack.h:159
void HBHETimeProfileStatusBitSetter::SetExpLimits ( double  R1Min,
double  R1Max,
double  R2Min,
double  R2Max 
)
inline
void HBHETimeProfileStatusBitSetter::SetFracLeaderLimits ( double  FracLeaderMin,
double  FracLeaderMax 
)
inline
void HBHETimeProfileStatusBitSetter::SetOuterLimits ( double  OuterMin,
double  OuterMax 
)
inline
void HBHETimeProfileStatusBitSetter::SetSlopeLimits ( double  SlopeMin,
double  SlopeMax 
)
inline
double HBHETimeProfileStatusBitSetter::TotalEnergyInDataFrame ( HBHEDataFrame  x)
inlineprivate

Definition at line 65 of file HBHETimeProfileStatusBitSetter.h.

References i, HcalQIESample::nominal_fC(), HBHEDataFrame::sample(), and HBHEDataFrame::size().

65  {
66  double Total=0;
67  for(int i=0; i!=x.size(); Total += x.sample(i++).nominal_fC());
68  return Total;
69  }
int i
Definition: DBlmapReader.cc:9
int size() const
total number of samples in the digi
Definition: HBHEDataFrame.h:26
const HcalQIESample & sample(int i) const
access a sample
Definition: HBHEDataFrame.h:39
double nominal_fC() const
get the nominal FC (no calibrations applied)

Member Data Documentation

double HBHETimeProfileStatusBitSetter::EnergyThreshold_
private
double HBHETimeProfileStatusBitSetter::FracLeaderMax_
private
double HBHETimeProfileStatusBitSetter::FracLeaderMin_
private
double HBHETimeProfileStatusBitSetter::OuterMax_
private
double HBHETimeProfileStatusBitSetter::OuterMin_
private
double HBHETimeProfileStatusBitSetter::R1Max_
private
double HBHETimeProfileStatusBitSetter::R1Min_
private
double HBHETimeProfileStatusBitSetter::R2Max_
private
double HBHETimeProfileStatusBitSetter::R2Min_
private
double HBHETimeProfileStatusBitSetter::SlopeMax_
private
double HBHETimeProfileStatusBitSetter::SlopeMin_
private