CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
HBHETimeProfileStatusBitSetter Class Reference

#include <HBHETimeProfileStatusBitSetter.h>

Public Member Functions

double EnergyThreshold ()
 
void hbheSetTimeFlagsFromDigi (HBHERecHitCollection *, const std::vector< HBHEDataFrame > &, const 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 (const 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.

Author
B Jones – University of Bristol / University of Maryland

Definition at line 15 of file HBHETimeProfileStatusBitSetter.h.

Constructor & Destructor Documentation

◆ HBHETimeProfileStatusBitSetter() [1/2]

HBHETimeProfileStatusBitSetter::HBHETimeProfileStatusBitSetter ( )

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

Definition at line 10 of file HBHETimeProfileStatusBitSetter.cc.

10  {
11  // use simple values in default constructor
12  R1Min_ = 0.1;
13  R1Max_ = 0.7;
14  R2Min_ = 0.2;
15  R2Max_ = 0.5;
16  FracLeaderMin_ = 0.4;
17  FracLeaderMax_ = 0.7;
18  SlopeMin_ = -1.5;
19  SlopeMax_ = -0.6;
20  OuterMin_ = 0.9;
21  OuterMax_ = 1.0;
22  EnergyThreshold_ = 30;
23 }

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

◆ HBHETimeProfileStatusBitSetter() [2/2]

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 25 of file HBHETimeProfileStatusBitSetter.cc.

35  {
36  R1Min_ = R1Min;
37  R1Max_ = R1Max;
38  R2Min_ = R2Min;
39  R2Max_ = R2Max;
40  FracLeaderMin_ = FracLeaderMin;
41  FracLeaderMax_ = FracLeaderMax;
42  SlopeMin_ = SlopeMin;
43  SlopeMax_ = SlopeMax;
44  OuterMin_ = OuterMin;
45  OuterMax_ = OuterMax;
47 }

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

◆ ~HBHETimeProfileStatusBitSetter()

HBHETimeProfileStatusBitSetter::~HBHETimeProfileStatusBitSetter ( )

Definition at line 49 of file HBHETimeProfileStatusBitSetter.cc.

49 {}

Member Function Documentation

◆ EnergyThreshold()

double HBHETimeProfileStatusBitSetter::EnergyThreshold ( )
inline

Definition at line 56 of file HBHETimeProfileStatusBitSetter.h.

56 { return EnergyThreshold_; }

References EnergyThreshold_.

Referenced by HBHETimeProfileStatusBitSetter().

◆ hbheSetTimeFlagsFromDigi()

void HBHETimeProfileStatusBitSetter::hbheSetTimeFlagsFromDigi ( HBHERecHitCollection hbhe,
const std::vector< HBHEDataFrame > &  udigi,
const std::vector< int > &  RecHitIndex 
)

Definition at line 64 of file HBHETimeProfileStatusBitSetter.cc.

66  {
67  bool Bits[4] = {false, false, false, false};
68  std::vector<HBHEDataFrame> digi(udigi);
69  std::sort(digi.begin(), digi.end(), compareDigiEnergy); // sort digis according to energies
70  std::vector<double> PulseShape; // store fC values for each time slice
71  int DigiSize = 0;
72  // int LeadingEta=0;
73  int LeadingPhi = 0;
74  bool FoundLeadingChannel = false;
75  for (std::vector<HBHEDataFrame>::const_iterator itDigi = digi.begin(); itDigi != digi.end(); itDigi++) {
76  if (!FoundLeadingChannel) {
77  // LeadingEta = itDigi->id().ieta();
78  LeadingPhi = itDigi->id().iphi();
79  DigiSize = (*itDigi).size();
80  PulseShape.clear();
81  PulseShape.resize(DigiSize, 0);
82  FoundLeadingChannel = true;
83  }
84  if (abs(LeadingPhi - itDigi->id().iphi()) < 2)
85  for (int i = 0; i != DigiSize; i++)
86  PulseShape[i] += itDigi->sample(i).nominal_fC();
87  }
88 
89  if (!RecHitIndex.empty()) {
90  double FracInLeader = -1;
91  //double Slope=0; // not currently used
92  double R1 = -1;
93  double R2 = -1;
94  double OuterEnergy = -1;
95  double TotalEnergy = 0;
96  int PeakPosition = 0;
97 
98  for (int i = 0; i != DigiSize; i++) {
99  if (PulseShape[i] > PulseShape[PeakPosition])
100  PeakPosition = i;
101  TotalEnergy += PulseShape[i];
102  }
103 
104  if (PeakPosition < (DigiSize - 2)) {
105  R1 = PulseShape[PeakPosition + 1] / PulseShape[PeakPosition];
106  R2 = PulseShape[PeakPosition + 2] / PulseShape[PeakPosition + 1];
107  }
108 
109  FracInLeader = PulseShape[PeakPosition] / TotalEnergy;
110 
111  if ((PeakPosition > 0) && (PeakPosition < (DigiSize - 2))) {
112  OuterEnergy = 1. - ((PulseShape[PeakPosition - 1] + PulseShape[PeakPosition] + PulseShape[PeakPosition + 1] +
113  PulseShape[PeakPosition + 2]) /
114  TotalEnergy);
115  }
116 
117  /* TH1D * HistForFit = new TH1D("HistForFit","HistForFit",DigiSize,0,DigiSize);
118  for(int i=0; i!=DigiSize; i++)
119  {
120  HistForFit->Fill(i,PulseShape[i]);
121  HistForFit->Fit("expo","WWQ","",PeakPosition, DigiSize-1);
122  TF1 * Fit = HistForFit->GetFunction("expo");
123  Slope = Fit->GetParameter("Slope");
124  }
125  delete HistForFit;
126  */
127  if (R1 != -1 && R2 != -1)
128  Bits[0] = (R1Min_ > R1) || (R1Max_ < R1) || (R2Min_ > R2) || (R2Max_ < R2);
129  if (FracInLeader != -1)
130  Bits[1] = (FracInLeader < FracLeaderMin_) || (FracInLeader > FracLeaderMax_);
131  if (OuterEnergy != -1)
132  Bits[2] = (OuterEnergy < OuterMin_) || (OuterEnergy > OuterMax_);
133  // Bits[3] = (SlopeMin_ > Slope) || (SlopeMax_ < Slope);
134  Bits[3] = false;
135 
136  } // if (RecHitIndex.size()>0)
137  else {
138  Bits[0] = false;
139  Bits[1] = false;
140  Bits[2] = false;
141  Bits[3] = true;
142 
143  } // (RecHitIndex.size()==0; no need to set Bit3 true?)
144 
145  for (unsigned int i = 0; i != RecHitIndex.size(); i++) {
146  // Write calculated bit values starting from position FirstBit
147  (*hbhe)[RecHitIndex.at(i)].setFlagField(Bits[0], HcalCaloFlagLabels::HSCP_R1R2);
148  (*hbhe)[RecHitIndex.at(i)].setFlagField(Bits[1], HcalCaloFlagLabels::HSCP_FracLeader);
149  (*hbhe)[RecHitIndex.at(i)].setFlagField(Bits[2], HcalCaloFlagLabels::HSCP_OuterEnergy);
150  (*hbhe)[RecHitIndex.at(i)].setFlagField(Bits[3], HcalCaloFlagLabels::HSCP_ExpFit);
151  }
152 }

References funct::abs(), FracLeaderMax_, FracLeaderMin_, HcalCaloFlagLabels::HSCP_ExpFit, HcalCaloFlagLabels::HSCP_FracLeader, HcalCaloFlagLabels::HSCP_OuterEnergy, HcalCaloFlagLabels::HSCP_R1R2, mps_fire::i, OuterMax_, OuterMin_, R1Max_, R1Min_, R2Max_, and R2Min_.

◆ SetExpLimits()

void HBHETimeProfileStatusBitSetter::SetExpLimits ( double  R1Min,
double  R1Max,
double  R2Min,
double  R2Max 
)
inline

Definition at line 38 of file HBHETimeProfileStatusBitSetter.h.

38  {
39  R1Min_ = R1Min;
40  R1Max_ = R1Max;
41  R2Min_ = R2Max;
42  R2Max_ = R2Max;
43  }

References R1Max_, R1Min_, R2Max_, and R2Min_.

◆ SetFracLeaderLimits()

void HBHETimeProfileStatusBitSetter::SetFracLeaderLimits ( double  FracLeaderMin,
double  FracLeaderMax 
)
inline

Definition at line 44 of file HBHETimeProfileStatusBitSetter.h.

44  {
45  FracLeaderMin_ = FracLeaderMin;
46  FracLeaderMax_ = FracLeaderMax;
47  }

References FracLeaderMax_, and FracLeaderMin_.

◆ SetOuterLimits()

void HBHETimeProfileStatusBitSetter::SetOuterLimits ( double  OuterMin,
double  OuterMax 
)
inline

Definition at line 52 of file HBHETimeProfileStatusBitSetter.h.

52  {
53  OuterMin_ = OuterMin;
54  OuterMax_ = OuterMax;
55  }

References OuterMax_, and OuterMin_.

◆ SetSlopeLimits()

void HBHETimeProfileStatusBitSetter::SetSlopeLimits ( double  SlopeMin,
double  SlopeMax 
)
inline

Definition at line 48 of file HBHETimeProfileStatusBitSetter.h.

48  {
49  SlopeMin_ = SlopeMin;
50  SlopeMax_ = SlopeMax;
51  }

References SlopeMax_, and SlopeMin_.

◆ TotalEnergyInDataFrame()

double HBHETimeProfileStatusBitSetter::TotalEnergyInDataFrame ( const HBHEDataFrame x)
inlineprivate

Definition at line 66 of file HBHETimeProfileStatusBitSetter.h.

66  {
67  double Total = 0;
68  for (int i = 0; i != x.size(); Total += x.sample(i++).nominal_fC())
69  ;
70  return Total;
71  }

References mps_fire::i, IntegrityTask_cfi::Total, and x.

Member Data Documentation

◆ EnergyThreshold_

double HBHETimeProfileStatusBitSetter::EnergyThreshold_
private

◆ FracLeaderMax_

double HBHETimeProfileStatusBitSetter::FracLeaderMax_
private

◆ FracLeaderMin_

double HBHETimeProfileStatusBitSetter::FracLeaderMin_
private

◆ OuterMax_

double HBHETimeProfileStatusBitSetter::OuterMax_
private

◆ OuterMin_

double HBHETimeProfileStatusBitSetter::OuterMin_
private

◆ R1Max_

double HBHETimeProfileStatusBitSetter::R1Max_
private

◆ R1Min_

double HBHETimeProfileStatusBitSetter::R1Min_
private

◆ R2Max_

double HBHETimeProfileStatusBitSetter::R2Max_
private

◆ R2Min_

double HBHETimeProfileStatusBitSetter::R2Min_
private

◆ SlopeMax_

double HBHETimeProfileStatusBitSetter::SlopeMax_
private

◆ SlopeMin_

double HBHETimeProfileStatusBitSetter::SlopeMin_
private
edm::module::AbilityBits::Bits
Bits
Definition: moduleAbilityEnums.h:50
mps_fire.i
i
Definition: mps_fire.py:355
HBHETimeProfileStatusBitSetter::FracLeaderMin_
double FracLeaderMin_
Definition: HBHETimeProfileStatusBitSetter.h:61
HcalCaloFlagLabels::HSCP_FracLeader
Definition: HcalCaloFlagLabels.h:16
DDAxes::x
HBHETimeProfileStatusBitSetter::EnergyThreshold
double EnergyThreshold()
Definition: HBHETimeProfileStatusBitSetter.h:56
HBHETimeProfileStatusBitSetter::FracLeaderMax_
double FracLeaderMax_
Definition: HBHETimeProfileStatusBitSetter.h:61
HBHETimeProfileStatusBitSetter::R1Max_
double R1Max_
Definition: HBHETimeProfileStatusBitSetter.h:60
HcalCaloFlagLabels::HSCP_R1R2
Definition: HcalCaloFlagLabels.h:15
HcalCaloFlagLabels::HSCP_ExpFit
Definition: HcalCaloFlagLabels.h:18
HBHETimeProfileStatusBitSetter::R2Max_
double R2Max_
Definition: HBHETimeProfileStatusBitSetter.h:60
IntegrityTask_cfi.Total
Total
Definition: IntegrityTask_cfi.py:44
HBHETimeProfileStatusBitSetter::SlopeMin_
double SlopeMin_
Definition: HBHETimeProfileStatusBitSetter.h:62
HcalCaloFlagLabels::HSCP_OuterEnergy
Definition: HcalCaloFlagLabels.h:17
HBHETimeProfileStatusBitSetter::OuterMin_
double OuterMin_
Definition: HBHETimeProfileStatusBitSetter.h:63
HBHETimeProfileStatusBitSetter::OuterMax_
double OuterMax_
Definition: HBHETimeProfileStatusBitSetter.h:63
HBHETimeProfileStatusBitSetter::EnergyThreshold_
double EnergyThreshold_
Definition: HBHETimeProfileStatusBitSetter.h:64
HBHETimeProfileStatusBitSetter::SlopeMax_
double SlopeMax_
Definition: HBHETimeProfileStatusBitSetter.h:62
HBHETimeProfileStatusBitSetter::R2Min_
double R2Min_
Definition: HBHETimeProfileStatusBitSetter.h:60
HBHETimeProfileStatusBitSetter::R1Min_
double R1Min_
Definition: HBHETimeProfileStatusBitSetter.h:60
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22