[BLASTTALK] TBLCut class

From: zhangchi (zhangchi@general.lns.mit.edu)
Date: Mon Aug 12 2002 - 13:13:04 EDT


Hi blasters:

As an attempt initiated by Tancredi to unify and make easy the cuts people
are using in analysis of blast data, I checked in a new class TBLCut, and
a few of its subclasses, namely TBLHid(Hit ID), TOF_HIT, CC_HIT, into
BlastLib2. They are compiled into libBlast.so so if you loas the lib, they
are available for use.

It is only a premitive type, does not do much yet. I will be adding more
into it. Right now at least I wish it could save people some typing by
doing those "atl%dt>300" things automatically.

Also I would like to welcome any suggestions.

Chi

I will check in later a script containing sample usages of the
classes. Before that, please refer to the following few lines if you
really were trying to use the class:

.L libBlast.so;

TFile *run = new TFile("commis-923-925.root","r");
TTree *tree = (TTree*)run->Get("ntp");

TBLCut::Init(tree) // tell TBLCut which tree you want to analyze

//TBLHid::Init("HitIDCalib") // optional, the initialization is already
                            // done when libBlast.so is loaded

tree->Draw("ttl12t", TOF_HIT('l', 13)); // a clean plot with garbages cut out

// TBLCut supports basic logic manipulations +/||, */&&. !, -.
tree->Draw("ttl12t", TOF_HIT('l', 13) && TOF_HIT('r', 3)) // a coinc plot

TOF_HIT l_12('l', 12); // create a cut

TBLCut cut1 = l_12, cut2(cut1); // supports copy and assignment

cut1.Examine(); // tells you what the cut is

TBLCut cut3 = cut1 * cut2; // same thing as cut1 && cut2
TBLCut cut4 = cut1 + cut2; // smae thing as cut1 || cut2
TBLCut cut5("cut5", "atl12t > 1000 && ttl9b < 3000") // create a generic cut

tree->GetEntry(10);
cout<<l_12<<endl; // this casts the cut into a double according as if
// current event passed the cut or not, for this event, it is 0
// it can then be cast into a bool to control you program flow.

tree->GetEntry(11);
cout<<TOF_HIT('l', 12)<<endl; // this creates a cut on the fly and uses
                              // it, for this event, return value is 1;

// subscription [i] is to evaluate the cut on the ith entry in the tree;
for (int i=0; i<50; i++)
    if (l_12[i])
        cout<<"event "<<i<<" passed the cut<<endl;

// unfortunatly subscription does not work with cuts created on the fly,
// use the function Eval(int)
for (int i=0; i<50; i++)
    if (TOF_HIT('l', 12).Eval(i))
        cout<<"event"<<i<<" passed the cut"<<endl;

Enjoy.



This archive was generated by hypermail 2.1.2 : Mon Feb 24 2014 - 14:07:28 EST