CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Attributes

TT6ApvMask Class Reference

#include <TT6ApvMask.h>

Inheritance diagram for TT6ApvMask:
TkApvMask

List of all members.

Public Member Functions

void calculateMask (ApvAnalysis::PedestalType)
MaskType mask ()
void setMask (MaskType in)
 TT6ApvMask (int ctype, float ncut, float dcut, float tcut)
virtual ~TT6ApvMask ()

Protected Member Functions

bool defineNoisy (float avrg, float rms, float noise)

Private Attributes

int theCalculationFlag_
float theDeadCut_
MaskType theMask_
float theNoiseCut_
float theTruncationCut_

Detailed Description

Concrete implementation of TkApvMask for TT6.

Definition at line 10 of file TT6ApvMask.h.


Constructor & Destructor Documentation

TT6ApvMask::TT6ApvMask ( int  ctype,
float  ncut,
float  dcut,
float  tcut 
)

Definition at line 9 of file TT6ApvMask.cc.

                                                                    {
  theCalculationFlag_ = ctype;
  theNoiseCut_        = ncut;
  theDeadCut_         = dcut;
  theTruncationCut_   = tcut;
}
TT6ApvMask::~TT6ApvMask ( ) [virtual]

Definition at line 19 of file TT6ApvMask.cc.

References gather_cfg::cout.

                       {
  if (0) cout << "Destructing TT6ApvMask " << endl;
}

Member Function Documentation

void TT6ApvMask::calculateMask ( ApvAnalysis::PedestalType  in) [virtual]

Implements TkApvMask.

Definition at line 25 of file TT6ApvMask.cc.

References gather_cfg::cout, i, convertSQLiteXML::ok, python::multivaluedict::sort(), and mathSSE::sqrt().

                                                        {

  theMask_.clear();
  ApvAnalysis::PedestalType temp_in(in);
  double sumVal,sqSumVal,avVal,sqAvVal,rmsVal; 
  sort(temp_in.begin(), temp_in.end());
  int nSize    = in.size();
  int cutLow   = int(nSize * theTruncationCut_);
  int cutHigh  = int(nSize * theTruncationCut_);
  int effSize  = nSize - cutLow - cutHigh;
  sumVal = 0.0;
  sqSumVal = 0.0;
  sumVal   = accumulate((temp_in.begin()+cutLow), (temp_in.end()-cutHigh), 0.0);
  sqSumVal = inner_product((temp_in.begin()+cutLow), (temp_in.end()-cutHigh), 
                           (temp_in.begin()+cutLow), 0.0);
  
  avVal    = (effSize) ? sumVal/float(effSize):0.0;
  sqAvVal  = (effSize) ? sqSumVal/float(effSize):0.0;
  rmsVal   = (sqAvVal - avVal*avVal > 0.0) ? sqrt(sqAvVal - avVal*avVal):0.0; 
  if (0) cout << " TT6ApvMask::calculateMask  Mean " << avVal <<
           " RMS " << rmsVal << " " <<  effSize << endl;       
  for (unsigned int i=0; i<in.size(); i++){
    if (defineNoisy( static_cast<float>(avVal),
                     static_cast<float>(rmsVal),in[i])) {
      theMask_.push_back(noisy);
    } else if (in[i] < theDeadCut_*avVal) {
           theMask_.push_back(dead);
    } else {
      theMask_.push_back(ok);
    }     
  }
}
bool TT6ApvMask::defineNoisy ( float  avrg,
float  rms,
float  noise 
) [protected]

Definition at line 62 of file TT6ApvMask.cc.

References gather_cfg::cout, and groupFilesInBlocks::temp.

                                                            {
  bool temp;
  temp=false;
  if (theCalculationFlag_ == 1){
   if ((noise-avrg) > theNoiseCut_*rms) {
     temp=true;
     if (0) cout << " Mean " << avrg << " rms " << rms << " Noise " << noise << endl;
   }
  } else if (theCalculationFlag_ == 2){
    if ((noise-avrg) > avrg*theNoiseCut_) temp=true;
  } else if (theCalculationFlag_ == 3){
    if (noise > theNoiseCut_) temp=true;
  } 
  return temp;
}
MaskType TT6ApvMask::mask ( ) [inline, virtual]

Implements TkApvMask.

Definition at line 19 of file TT6ApvMask.h.

References theMask_.

{return theMask_;}
void TT6ApvMask::setMask ( MaskType  in) [inline, virtual]

Implements TkApvMask.

Definition at line 18 of file TT6ApvMask.h.

References recoMuon::in, and theMask_.

{theMask_ = in;}

Member Data Documentation

Definition at line 28 of file TT6ApvMask.h.

float TT6ApvMask::theDeadCut_ [private]

Definition at line 30 of file TT6ApvMask.h.

Definition at line 27 of file TT6ApvMask.h.

Referenced by mask(), and setMask().

float TT6ApvMask::theNoiseCut_ [private]

Definition at line 29 of file TT6ApvMask.h.

Definition at line 31 of file TT6ApvMask.h.