10 theCalculationFlag_ = ctype;
13 theTruncationCut_ = tcut;
20 if (
false)
cout <<
"Destructing TT6ApvMask " << endl;
29 double sumVal,sqSumVal,avVal,sqAvVal,rmsVal;
30 sort(temp_in.begin(), temp_in.end());
31 int nSize = in.size();
32 int cutLow =
int(nSize * theTruncationCut_);
33 int cutHigh =
int(nSize * theTruncationCut_);
34 int effSize = nSize - cutLow - cutHigh;
37 sumVal = accumulate((temp_in.begin()+cutLow), (temp_in.end()-cutHigh), 0.0);
38 sqSumVal = inner_product((temp_in.begin()+cutLow), (temp_in.end()-cutHigh),
39 (temp_in.begin()+cutLow), 0.0);
41 avVal = (effSize) ? sumVal/
float(effSize):0.0;
42 sqAvVal = (effSize) ? sqSumVal/
float(effSize):0.0;
43 rmsVal = (sqAvVal - avVal*avVal > 0.0) ?
sqrt(sqAvVal - avVal*avVal):0.0;
44 if (
false)
cout <<
" TT6ApvMask::calculateMask Mean " << avVal <<
45 " RMS " << rmsVal <<
" " << effSize << endl;
46 for (
unsigned int i=0;
i<in.size();
i++){
47 if (defineNoisy( static_cast<float>(avVal),
48 static_cast<float>(rmsVal),in[
i])) {
49 theMask_.push_back(noisy);
50 }
else if (in[i] < theDeadCut_*avVal) {
51 theMask_.push_back(dead);
53 theMask_.push_back(
ok);
65 if (theCalculationFlag_ == 1){
66 if ((noise-avrg) > theNoiseCut_*rms) {
68 if (
false)
cout <<
" Mean " << avrg <<
" rms " << rms <<
" Noise " << noise << endl;
70 }
else if (theCalculationFlag_ == 2){
71 if ((noise-avrg) > avrg*theNoiseCut_) temp=
true;
72 }
else if (theCalculationFlag_ == 3){
73 if (noise > theNoiseCut_) temp=
true;
std::vector< float > PedestalType
TT6ApvMask(int ctype, float ncut, float dcut, float tcut)
void calculateMask(const ApvAnalysis::PedestalType &) override
bool defineNoisy(float avrg, float rms, float noise)