5 #include "TDirectory.h"
185 Int_t num,Double_t l,Double_t u)
188 TDirectory* saveDir = gDirectory;
199 fbInverseCut= kFALSE;
233 if(mode.CompareTo(
"low+up") == 0){
234 if(flowF == 0 || fupF == 0){
235 Error(
"setTF1()",
"Both TF1 needs to be !=0 in mode \"low+up\"");
242 }
else if(mode.CompareTo(
"low") == 0){
243 if(flowF == 0 || fupF != 0){
244 Error(
"setTF1()",
"Lower TF1 needs to be set and upper TF1 == 0 in mode \"low\"");
251 }
else if(mode.CompareTo(
"up") == 0){
252 if(flowF != 0 || fupF == 0){
253 Error(
"setTF1()",
"Upper TF1 needs to be set and lower TF1 == 0 in mode \"up\"");
260 }
else if(mode.CompareTo(
"mean+width") == 0){
261 if(flowF == 0 || fupF == 0){
262 Error(
"setTF1()",
"Both TF1 needs to be !=0 in mode \"mean+width\"");
270 Error(
"setTF1()",
"Unknown mode =%s",mode.Data());
278 if(fmaxCut == 0) fmaxCut = 1;
290 if(version>fmaxVersion) fmaxVersion = version;
292 if( (!fbInverseCut && (var > fup || var < flow)) ||
293 ( fbInverseCut && !(var > fup || var < flow))
296 if(version<fmaxCut)fctFail[version]++;
307 if(fCut->GetN() == 0) {
308 Warning(
"evalG(var,var)",
"Cut %s has no set TCutG !",GetName());
313 if(version>fmaxVersion) fmaxVersion = version;
315 if( (!fbInverseCut && !fCut->IsInside(var,var2)) ||
316 ( fbInverseCut && fCut->IsInside(var,var2))
319 if(version<fmaxCut)fctFail[version]++;
331 Warning(
"evalF(var,var)",
"TF1 Cut %s has no set !",GetName());
337 if(version>fmaxVersion) fmaxVersion = version;
340 Double_t lowCut = -1e30;
341 Double_t upCut = 1e30;
344 lowCut = fLowF1->Eval(var2);
345 upCut = fUpF1 ->Eval(var2);
346 }
else if (fF1Mode == 1 ) {
347 lowCut = fLowF1->Eval(var2);
348 }
else if (fF1Mode == 2) {
349 upCut = fUpF1->Eval(var2);
351 Double_t width = fUpF1->Eval(var2);
352 Double_t mean = fLowF1->Eval(var2);
353 lowCut = mean - width;
354 upCut = mean + width;
358 if( (!fbInverseCut && !( var<upCut && var>lowCut) ) ||
359 ( fbInverseCut && ( var<upCut && var>lowCut))
362 if(version<fmaxCut)fctFail[version]++;
369 Int_t p = cout.precision();
370 std::ios_base::fmtflags fl =cout.flags();
371 cout<<
"CutNumber : "<<setw(3)<<fCutNumber
372 <<
" name : "<<setw(20)<<GetName()
373 <<
", lowCut : "<<setw(10)<<flow
374 <<
", UpCut : "<<setw(10)<<fup<<
", cut [%] : "<<flush;
375 for(UInt_t i = 0; i < fmaxCut ; i++){ cout<<setw(5)<<fixed<<right<<setprecision(1)<<getCutRate(i)<<
" "<<flush;}
376 cout<<setprecision(p)<<endl;
384 fctFail.assign(fmaxCut,0);
385 fctCall.assign(fmaxCut,0);
390 return (version <fmaxCut && fctCall[version] > 0) ? (fctFail[version]/(Float_t)fctCall[version])*100.:0;
395 return (version <fmaxCut ) ? fctCall[version]:0;
400 return (version <fmaxCut ) ? fctFail[version]:0;
void setMaxCut(UInt_t max=4)
UInt_t getNFail(UInt_t version=0)
ClassImp(HParticleCutRange) HParticleCutRange
Bool_t evalG(Double_t var, Double_t var2, UInt_t version=0)
Float_t getCutRate(UInt_t version=0)
Bool_t evalF(Double_t var, Double_t var2, UInt_t version=0)
void setTF1(TF1 *flow, TF1 *fup=0, TString mode="low+up")
UInt_t getNCall(UInt_t version=0)
Bool_t eval(Double_t var, UInt_t version=0)