#include <HBHETimeProfileStatusBitSetter.h>
Classes | |
struct | compare_digi_energy |
Public Member Functions | |
double | EnergyThreshold () |
void | hbheSetTimeFlagsFromDigi (HBHERecHitCollection *, std::vector< HBHEDataFrame >, std::vector< int >) |
HBHETimeProfileStatusBitSetter (double R1Min, double R1Max, double R2Min, double R2Max, double FracLeaderMin, double FracLeaderMax, double SlopeMin, double SlopeMax, double OuterMin, double OuterMax, double EnergyThreshold) | |
HBHETimeProfileStatusBitSetter () | |
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_ |
This class sets status bit in the status words for the revised CaloRecHit objets according to informatino from the digi associated to the hit.
Definition at line 17 of file HBHETimeProfileStatusBitSetter.h.
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_.
{ // use simple values in default constructor R1Min_ = 0.1; R1Max_ = 0.7; R2Min_ = 0.2; R2Max_ = 0.5; FracLeaderMin_ = 0.4; FracLeaderMax_ = 0.7; SlopeMin_ = -1.5; SlopeMax_ = -0.6; OuterMin_ = 0.9; OuterMax_ = 1.0; EnergyThreshold_=30; }
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_.
{ R1Min_ = R1Min; R1Max_ = R1Max; R2Min_ = R2Min; R2Max_ = R2Max; FracLeaderMin_ = FracLeaderMin; FracLeaderMax_ = FracLeaderMax; SlopeMin_ = SlopeMin; SlopeMax_ = SlopeMax; OuterMin_ = OuterMin; OuterMax_ = OuterMax; EnergyThreshold_ = EnergyThreshold; }
HBHETimeProfileStatusBitSetter::~HBHETimeProfileStatusBitSetter | ( | ) |
Definition at line 47 of file HBHETimeProfileStatusBitSetter.cc.
{}
double HBHETimeProfileStatusBitSetter::EnergyThreshold | ( | ) | [inline] |
Definition at line 45 of file HBHETimeProfileStatusBitSetter.h.
References EnergyThreshold_.
Referenced by HBHETimeProfileStatusBitSetter(), and HcalHitReconstructor::produce().
{return EnergyThreshold_;}
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().
{ bool Bits[4]={false, false, false, false}; std::sort(digi.begin(), digi.end(), compare_digi_energy()); // sort digis according to energies std::vector<double> PulseShape; // store fC values for each time slice int DigiSize=0; // int LeadingEta=0; int LeadingPhi=0; bool FoundLeadingChannel=false; for(std::vector<HBHEDataFrame>::const_iterator itDigi = digi.begin(); itDigi!=digi.end(); itDigi++) { if(!FoundLeadingChannel) { // LeadingEta = itDigi->id().ieta(); LeadingPhi = itDigi->id().iphi(); DigiSize=(*itDigi).size(); PulseShape.clear(); PulseShape.resize(DigiSize,0); FoundLeadingChannel=true; } if(abs(LeadingPhi - itDigi->id().iphi())<2) for(int i=0; i!=DigiSize; i++) PulseShape[i]+=itDigi->sample(i).nominal_fC(); } if(RecHitIndex.size()>0) { double FracInLeader=-1; //double Slope=0; // not currently used double R1=-1; double R2=-1; double OuterEnergy=-1; double TotalEnergy=0; int PeakPosition=0; for(int i=0; i!=DigiSize; i++) { if(PulseShape[i]>PulseShape[PeakPosition]) PeakPosition=i; TotalEnergy+=PulseShape[i]; } if(PeakPosition < (DigiSize-2)) { R1 = PulseShape[PeakPosition+1]/PulseShape[PeakPosition]; R2 = PulseShape[PeakPosition+2]/PulseShape[PeakPosition+1]; } FracInLeader = PulseShape[PeakPosition]/TotalEnergy; if((PeakPosition > 0) && (PeakPosition < (DigiSize-2))) { OuterEnergy = 1. -((PulseShape[PeakPosition - 1] + PulseShape[PeakPosition] + PulseShape[PeakPosition + 1] + PulseShape[PeakPosition + 2] ) / TotalEnergy); } /* TH1D * HistForFit = new TH1D("HistForFit","HistForFit",DigiSize,0,DigiSize); for(int i=0; i!=DigiSize; i++) { HistForFit->Fill(i,PulseShape[i]); HistForFit->Fit("expo","WWQ","",PeakPosition, DigiSize-1); TF1 * Fit = HistForFit->GetFunction("expo"); Slope = Fit->GetParameter("Slope"); } delete HistForFit; */ if (R1!=-1 && R2!=-1) Bits[0] = (R1Min_ > R1) || (R1Max_ < R1) || (R2Min_ > R2) || (R2Max_ < R2); if (FracInLeader!=-1) Bits[1] = (FracInLeader < FracLeaderMin_) || (FracInLeader > FracLeaderMax_); if (OuterEnergy!=-1) Bits[2] = (OuterEnergy < OuterMin_) || (OuterEnergy > OuterMax_); // Bits[3] = (SlopeMin_ > Slope) || (SlopeMax_ < Slope); Bits[3] = false; } // if (RecHitIndex.size()>0) else { Bits[0]=false; Bits[1]=false; Bits[2]=false; Bits[3]=true; } // (RecHitIndex.size()==0; no need to set Bit3 true?) for(unsigned int i=0; i!=RecHitIndex.size(); i++) { // Write calculated bit values starting from position FirstBit (*hbhe)[RecHitIndex.at(i)].setFlagField(Bits[0],HcalCaloFlagLabels::HSCP_R1R2); (*hbhe)[RecHitIndex.at(i)].setFlagField(Bits[1],HcalCaloFlagLabels::HSCP_FracLeader); (*hbhe)[RecHitIndex.at(i)].setFlagField(Bits[2],HcalCaloFlagLabels::HSCP_OuterEnergy); (*hbhe)[RecHitIndex.at(i)].setFlagField(Bits[3],HcalCaloFlagLabels::HSCP_ExpFit); } }
void HBHETimeProfileStatusBitSetter::SetExpLimits | ( | double | R1Min, |
double | R1Max, | ||
double | R2Min, | ||
double | R2Max | ||
) | [inline] |
void HBHETimeProfileStatusBitSetter::SetFracLeaderLimits | ( | double | FracLeaderMin, |
double | FracLeaderMax | ||
) | [inline] |
Definition at line 39 of file HBHETimeProfileStatusBitSetter.h.
References FracLeaderMax_, and FracLeaderMin_.
{ FracLeaderMin_ = FracLeaderMin; FracLeaderMax_ = FracLeaderMax;}
void HBHETimeProfileStatusBitSetter::SetOuterLimits | ( | double | OuterMin, |
double | OuterMax | ||
) | [inline] |
void HBHETimeProfileStatusBitSetter::SetSlopeLimits | ( | double | SlopeMin, |
double | SlopeMax | ||
) | [inline] |
double HBHETimeProfileStatusBitSetter::TotalEnergyInDataFrame | ( | HBHEDataFrame | x | ) | [inline, private] |
Definition at line 65 of file HBHETimeProfileStatusBitSetter.h.
References i, HcalQIESample::nominal_fC(), HBHEDataFrame::sample(), and HBHEDataFrame::size().
double HBHETimeProfileStatusBitSetter::EnergyThreshold_ [private] |
Definition at line 53 of file HBHETimeProfileStatusBitSetter.h.
Referenced by EnergyThreshold(), and HBHETimeProfileStatusBitSetter().
double HBHETimeProfileStatusBitSetter::FracLeaderMax_ [private] |
Definition at line 50 of file HBHETimeProfileStatusBitSetter.h.
Referenced by hbheSetTimeFlagsFromDigi(), HBHETimeProfileStatusBitSetter(), and SetFracLeaderLimits().
double HBHETimeProfileStatusBitSetter::FracLeaderMin_ [private] |
Definition at line 50 of file HBHETimeProfileStatusBitSetter.h.
Referenced by HBHETimeProfileStatusBitSetter(), and SetFracLeaderLimits().
double HBHETimeProfileStatusBitSetter::OuterMax_ [private] |
Definition at line 52 of file HBHETimeProfileStatusBitSetter.h.
Referenced by hbheSetTimeFlagsFromDigi(), HBHETimeProfileStatusBitSetter(), and SetOuterLimits().
double HBHETimeProfileStatusBitSetter::OuterMin_ [private] |
Definition at line 52 of file HBHETimeProfileStatusBitSetter.h.
Referenced by HBHETimeProfileStatusBitSetter(), and SetOuterLimits().
double HBHETimeProfileStatusBitSetter::R1Max_ [private] |
Definition at line 49 of file HBHETimeProfileStatusBitSetter.h.
Referenced by hbheSetTimeFlagsFromDigi(), HBHETimeProfileStatusBitSetter(), and SetExpLimits().
double HBHETimeProfileStatusBitSetter::R1Min_ [private] |
Definition at line 49 of file HBHETimeProfileStatusBitSetter.h.
Referenced by hbheSetTimeFlagsFromDigi(), HBHETimeProfileStatusBitSetter(), and SetExpLimits().
double HBHETimeProfileStatusBitSetter::R2Max_ [private] |
Definition at line 49 of file HBHETimeProfileStatusBitSetter.h.
Referenced by hbheSetTimeFlagsFromDigi(), HBHETimeProfileStatusBitSetter(), and SetExpLimits().
double HBHETimeProfileStatusBitSetter::R2Min_ [private] |
Definition at line 49 of file HBHETimeProfileStatusBitSetter.h.
Referenced by hbheSetTimeFlagsFromDigi(), HBHETimeProfileStatusBitSetter(), and SetExpLimits().
double HBHETimeProfileStatusBitSetter::SlopeMax_ [private] |
Definition at line 51 of file HBHETimeProfileStatusBitSetter.h.
Referenced by HBHETimeProfileStatusBitSetter(), and SetSlopeLimits().
double HBHETimeProfileStatusBitSetter::SlopeMin_ [private] |
Definition at line 51 of file HBHETimeProfileStatusBitSetter.h.
Referenced by HBHETimeProfileStatusBitSetter(), and SetSlopeLimits().