_HADES_CLASS_DESCRIPTION HParticleCutRange Helper class for cuts. A cut has a name (should be unique), a cut number (better unique) and a condition as argument of creation. The cut object owns counters for the number of calls and the number of failed evaluations. The The counters cand be used to monitor the efficiency of the cut If the TCutG object belonging to the cut is set evalG(var,var,version) will evaluate the graph. cut. As option TF1 objects cann be used to cut (see the exapmple macro below) The cuts can be inversed by setInverse(Bool_t). In fact cuts will than select outside the band low-up range and for the graph cut isInside(var,var)==kFALSE will be used for selection. USAGE: // outside eventloop: HParticleCutRange cut1("BetaCut",1,0.9,1.1); // will create a cut object selecting beta range and // inside eventloop: if(cut1->eval(beta,0)) { // true if condition is fullfilled, stat counted for version 0 } if(cut1->eval(beta,1)) { // true if condition is fullfilled, stat counted for version 1 } // after eventloop cut1.print(); // show cut name,number,cut statistics and range void testCutRange() { // example macro for HParticleCutRange demonstrating the // different features. The cut will be applied on the // mass of an particle in this example. // Cuts can be applied in 3 ways: // CUTMODE: // 1. 1-dim cuts (upper+lower limit) // 2. 2-dim cut using TCutG // 3. 2-dim cut using TF1 // In TCutG or TF1 mode the example cuts in mass depends on the momentum. // The TCutG is owned by the cut and the user just has to set the // points. TF1 have to be contructed outside the clas due to the // available contructors of TF1. The user ahs to set the pointers // to the TF1. Remark: if the TF1 is contructed from a user function // the cut will not work when read back from root file. // TF1MODE: // There are 4 options : // 1. low+up (1 seperate TF1 for lower and upper cut) // 2. low (1 TF1 for lower cut) // 3. up (1 TF1 for upper cut) // 3. mean+width (1 TF1 for mean of the cut, 1 TF1 for the width of the cut) Bool_t invert = kFALSE; // invert cut : default: kFALSE Int_t cutmode = 2; //0=range,1=cutG,2=TF1 TString tf1mode = "low+up"; // TF1 mode: low+up, low,up,mean+width Double_t slope = .10; Double_t mass_pion = HPhysicsConstants::mass(8); Double_t mass_proton = HPhysicsConstants::mass(14); HParticleCutRange cut1("massCut",1,mass_proton-50,mass_proton+50); cut1.setInverse(invert); //-------------------------------------------------- // TF1 mode // Cuts in mass depend on mommentum // low+up , low , up mode TF1* flow = new TF1("flow","pol1",0,1000); flow->SetParameter(0,mass_pion); flow->SetParameter(1,-slope); TF1* fup = new TF1("fup","pol1" ,0,1000); fup->SetParameter(0,mass_pion); fup->SetParameter(1,slope); fup->SetLineColor(4); // mean+width mode TF1* fmean = new TF1("fmean","pol1",0,1000); fmean->SetParameter(0,mass_pion); fmean->SetParameter(1,0); TF1* fwidth = new TF1("fwidth","pol1",0,1000); fwidth->SetParameter(0,0); fwidth->SetParameter(1,slope); fwidth->SetLineColor(4); if(tf1mode=="low+up") cut1.setTF1(flow,fup,tf1mode); if(tf1mode=="low") cut1.setTF1(flow, 0,tf1mode); if(tf1mode=="up") cut1.setTF1( 0,fup,tf1mode); if(tf1mode=="mean+width")cut1.setTF1(flow,fup,tf1mode); //-------------------------------------------------- //-------------------------------------------------- // TCutG mode cut1.getTCutG()->SetPoint(0, 0,mass_proton); cut1.getTCutG()->SetPoint(1,1000,mass_proton - slope*1000); cut1.getTCutG()->SetPoint(2,1000,mass_proton + slope*1000); cut1.getTCutG()->SetPoint(3, 0,mass_proton); //-------------------------------------------------- TH2F* hmomvsmass = new TH2F("hmassvsmom","mom vs mass",200,0,2000,200,0,1200); hmomvsmass->SetXTitle("mom [MeV/c]"); hmomvsmass->SetYTitle("mass [MeV/c^{2}]"); //-------------------------------------------------- // create some dummy spectrum Double_t masses [] = {mass_pion,mass_proton}; for(Int_t i = 0 ; i <10000; i ++){ Double_t mom = gRandom->Rndm()*2000; Double_t massres = mom*0.1; Int_t index = (Int_t) (gRandom->Rndm()*2); Double_t mass = gRandom->Gaus(masses[index],massres); if(cutmode == 0 && cut1.eval(mass)) { hmomvsmass->Fill(mom,mass); } if(cutmode == 1 && cut1.evalG(mom,mass)) { hmomvsmass->Fill(mom,mass); } if(cutmode == 2 && cut1.evalF(mass,mom)) { hmomvsmass->Fill(mom,mass); } } //-------------------------------------------------- cut1.print(); TCanvas* result = new TCanvas("result","result",1000,800); hmomvsmass->Draw("colz"); if(cutmode == 1){ cut1.getTCutG()->Draw("same"); } if(cutmode == 2){ if(cut1.getTF1Low())cut1.getTF1Low()->DrawCopy("same"); if(cut1.getTF1Up() )cut1.getTF1Up() ->DrawCopy("same"); } TFile* cutsfile = new TFile("myCuts.root","RECREATE"); cut1.Write(); cutsfile->Save(); cutsfile->Close(); }
HParticleCutRange(const HParticleCutRange&) | |
HParticleCutRange(TString name = "cut", Int_t num = -1, Double_t l = -1e30, Double_t u = 1e30) | |
virtual | ~HParticleCutRange() |
void | TObject::AbstractMethod(const char* method) const |
virtual void | TObject::AppendPad(Option_t* option = "") |
virtual void | TObject::Browse(TBrowser* b) |
static TClass* | Class() |
virtual const char* | TObject::ClassName() const |
virtual void | TNamed::Clear(Option_t* option = "") |
virtual TObject* | TNamed::Clone(const char* newname = "") const |
virtual Int_t | TNamed::Compare(const TObject* obj) const |
virtual void | TNamed::Copy(TObject& named) const |
virtual void | TObject::Delete(Option_t* option = "")MENU |
virtual Int_t | TObject::DistancetoPrimitive(Int_t px, Int_t py) |
virtual void | TObject::Draw(Option_t* option = "") |
virtual void | TObject::DrawClass() constMENU |
virtual TObject* | TObject::DrawClone(Option_t* option = "") constMENU |
virtual void | TObject::Dump() constMENU |
virtual void | TObject::Error(const char* method, const char* msgfmt) const |
Bool_t | eval(Double_t var, UInt_t version = 0) |
Bool_t | evalF(Double_t var, Double_t var2, UInt_t version = 0) |
Bool_t | evalG(Double_t var, Double_t var2, UInt_t version = 0) |
virtual void | TObject::Execute(const char* method, const char* params, Int_t* error = 0) |
virtual void | TObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0) |
virtual void | TObject::ExecuteEvent(Int_t event, Int_t px, Int_t py) |
virtual void | TObject::Fatal(const char* method, const char* msgfmt) const |
virtual void | TNamed::FillBuffer(char*& buffer) |
virtual TObject* | TObject::FindObject(const char* name) const |
virtual TObject* | TObject::FindObject(const TObject* obj) const |
Int_t | getCutNumber() |
Float_t | getCutRate(UInt_t version = 0) |
virtual Option_t* | TObject::GetDrawOption() const |
static Long_t | TObject::GetDtorOnly() |
virtual const char* | TObject::GetIconName() const |
Double_t | getLowCut() |
UInt_t | getMaxVersion() |
virtual const char* | TNamed::GetName() const |
UInt_t | getNCall(UInt_t version = 0) |
UInt_t | getNFail(UInt_t version = 0) |
virtual char* | TObject::GetObjectInfo(Int_t px, Int_t py) const |
static Bool_t | TObject::GetObjectStat() |
virtual Option_t* | TObject::GetOption() const |
TCutG* | getTCutG() |
TF1* | getTF1Low() |
TF1* | getTF1Up() |
virtual const char* | TNamed::GetTitle() const |
virtual UInt_t | TObject::GetUniqueID() const |
Double_t | getUpCut() |
virtual Bool_t | TObject::HandleTimer(TTimer* timer) |
virtual ULong_t | TNamed::Hash() const |
virtual void | TObject::Info(const char* method, const char* msgfmt) const |
virtual Bool_t | TObject::InheritsFrom(const char* classname) const |
virtual Bool_t | TObject::InheritsFrom(const TClass* cl) const |
virtual void | TObject::Inspect() constMENU |
void | TObject::InvertBit(UInt_t f) |
virtual TClass* | IsA() const |
virtual Bool_t | TObject::IsEqual(const TObject* obj) const |
virtual Bool_t | TObject::IsFolder() const |
Bool_t | TObject::IsOnHeap() const |
virtual Bool_t | TNamed::IsSortable() const |
Bool_t | TObject::IsZombie() const |
virtual void | TNamed::ls(Option_t* option = "") const |
void | TObject::MayNotUse(const char* method) const |
virtual Bool_t | TObject::Notify() |
void | TObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const |
static void | TObject::operator delete(void* ptr) |
static void | TObject::operator delete(void* ptr, void* vp) |
static void | TObject::operator delete[](void* ptr) |
static void | TObject::operator delete[](void* ptr, void* vp) |
void* | TObject::operator new(size_t sz) |
void* | TObject::operator new(size_t sz, void* vp) |
void* | TObject::operator new[](size_t sz) |
void* | TObject::operator new[](size_t sz, void* vp) |
HParticleCutRange& | operator=(const HParticleCutRange&) |
virtual void | TObject::Paint(Option_t* option = "") |
virtual void | TObject::Pop() |
void | print() |
virtual void | TNamed::Print(Option_t* option = "") const |
virtual Int_t | TObject::Read(const char* name) |
virtual void | TObject::RecursiveRemove(TObject* obj) |
void | TObject::ResetBit(UInt_t f) |
void | resetCounter() |
virtual void | TObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU |
virtual void | TObject::SavePrimitive(ostream& out, Option_t* option = "") |
void | set(Double_t l = -1e30, Double_t u = 1e30) |
void | TObject::SetBit(UInt_t f) |
void | TObject::SetBit(UInt_t f, Bool_t set) |
virtual void | TObject::SetDrawOption(Option_t* option = "")MENU |
static void | TObject::SetDtorOnly(void* obj) |
void | setInverse(Bool_t inv) |
void | setMaxCut(UInt_t max = 4) |
virtual void | TNamed::SetName(const char* name)MENU |
virtual void | TNamed::SetNameTitle(const char* name, const char* title) |
static void | TObject::SetObjectStat(Bool_t stat) |
void | setTF1(TF1* flow, TF1* fup = 0, TString mode = "low+up") |
virtual void | TNamed::SetTitle(const char* title = "")MENU |
virtual void | TObject::SetUniqueID(UInt_t uid) |
virtual void | ShowMembers(TMemberInspector&) |
virtual Int_t | TNamed::Sizeof() const |
virtual void | Streamer(TBuffer&) |
void | StreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b) |
virtual void | TObject::SysError(const char* method, const char* msgfmt) const |
Bool_t | TObject::TestBit(UInt_t f) const |
Int_t | TObject::TestBits(UInt_t f) const |
virtual void | TObject::UseCurrentStyle() |
virtual void | TObject::Warning(const char* method, const char* msgfmt) const |
virtual Int_t | TObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) |
virtual Int_t | TObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const |
virtual void | TObject::DoError(int level, const char* location, const char* fmt, va_list va) const |
void | TObject::MakeZombie() |
enum TObject::EStatusBits { | kCanDelete | |
kMustCleanup | ||
kObjInCanvas | ||
kIsReferenced | ||
kHasUUID | ||
kCannotPick | ||
kNoContextMenu | ||
kInvalidObject | ||
}; | ||
enum TObject::[unnamed] { | kIsOnHeap | |
kNotDeleted | ||
kZombie | ||
kBitMask | ||
kSingleKey | ||
kOverwrite | ||
kWriteDelete | ||
}; |
TString | TNamed::fName | object identifier |
TString | TNamed::fTitle | object title |
TCutG* | fCut | graph cut object |
Int_t | fCutNumber | number of the cut |
Int_t | fF1Mode | 0 = "low+up" , 1="low" , 2="up" , 3="mean+width" |
TF1* | fLowF1 | TFormular for low cut |
TF1* | fUpF1 | TFormular for upper cut |
Bool_t | fbInverseCut | default kFALSE , kTRUE will invert selection |
vector<ULong64_t> | fctCall | count all call to the evaluation |
vector<ULong64_t> | fctFail | count evaluation == kFALSE |
Double_t | flow | lower cut |
UInt_t | fmaxCut | how many version can be used at max |
UInt_t | fmaxVersion | how many version have been used |
Double_t | fup | upper cut |
Set the TF1 objects for low and up cut. The TF1 will be used by evalF(var,var2) for cutting where the cuts in var will be a function of var2. There are the following modes implemented: mode = "low+up" : lower and upper cur are defined by independent TF1 (band pass) = "low" : low TF1 is used to defined a cut for var < lowcut(var2) ( high pass) = "up" : up TF1 is used to defined a cut for var > upcut(var2) ( low pass) = "mean+width" : is used to define a cut by mean(var2)(low TF1) + width(var2)(up TF1) for var > mean + width && var < mean - width ( band pass) the cuts can be inverted as the other cuts