Intead of:
TTree::Draw("fPt>>hfPt",cut0,cut1,cut2,cut3,cut4,cut5,cut6,cut7)
do
TTree::Draw("fPt>>hfPt",cut0&&cut1&&cut2&&cut3&&cut4&&cut5&&cut6&&cut7)
Rene Brun
On Sun, 26 May 2002 filjaybee@physics.msuiit.edu.ph wrote:
> hi everyone...
>
> SORRY... i was out for some time :-). by the way, i am using
> root version 3.02/06 and my operating system is redhat linux
> 7.1... the problem is this: i have a tree file containing data
> and i want to put some cuts on the data. i have 31 cuts and root
> allows only less than 10... and i want these cuts to be applied
> simulatneously... the SHORTENED code is found below:
>
> ==============================================================
> ==============================================================
> ==============================================================
> //////////////////////////////////////////////////
> // Reading and Making Histograms of TTree Files //
> //////////////////////////////////////////////////
> Char_t *inputfile = "i02zh6janl.root";
> Char_t *outputfile= "zh6janlcuthist02.root";
>
> TCanvas *dHist;
>
> Double_t kmin = 0.0;
> Double_t kmax = 300.0;
> Int_t kbin = 150;
>
> //-------------------------------
> void InitHist()
> {
> hfPt = new TH1F("hfPt","Transverse Momentum",kbin,kmin,kmax);
> hfPt->SetXTitle("hfPt");
>
> hfEvis = new TH1F("hfEvis","Visible Energy",kbin,kmin,kmax);
> hfEvis->SetXTitle("hfEvis");
>
> // I HAVE 33 HISTOGRAMS HERE AND ALL OF THEM ARE IN THE
> INPUT // FILE...
>
> hfNjets = new TH1F("hfNjets","Number of Jets",100,0,100);
> hfNjets->SetXTitle("hfNjets");
>
> hfEjet = new TH1F("hfEjet","Energy of Jets",kbin,kmin,kmax);
> hfEjet->SetXTitle("hfEjet");
> }
>
> //-------------------------------------------------------//
> void READTTreeFile02() //FILENAME: READTTreeFile02.C
> {
> TFile *f1, *f2;
>
> f1 = new TFile(inputfile,"READ");
> TTree *T0 = (TTree*)f1.Get("analysis"); // "analysis" tree name
> f2 = new TFile(outputfile, "RECREATE");
>
> // BELOW ARE THE CUTS... 31 OF THEM...
> TCut cut0 = "fEvis>=240 && fPt<=20 && fPl>=-25 && fPl<=25";
> // cut0 is a combination of 4 cuts/conditions
> TCut cut1 = "fThrust>=0.650 && fThrust<=0.825 &&
> fFYmax>=0.0025";
> TCut cut2 = "fNjets>=80 && fEjet>=10 && fEjet<=120 &&
> fNchg>=30";
> TCut cut3 = "fMassZ>=40 && fMassZ<=150 && fEnergyZ>=75 &&
> fEnergyZ<=200 && fPabsZ>=40 && fPabsZ<=110";
> TCut cut4 = "fMassW>=30 && fMassW<=120 && fEnergyW>=40 &&
> fEnergyW<=140 && fPabsW>=20 && fPabsW<=100";
> TCut cut5 = "fMassWstar>=20 && fMassWstar<=110 &&
> fEnergyWstar>=30";
> TCut cut6 = "fEnergyWstar<=130 && fPabsWstar>=15 &&
> fPabsWstar<=100";
> TCut cut7 = "fXsquareMass<=15 && fXsquareEner<=5 &&
> fXsquarePabs<=10";
>
>
> dHist = new TCanvas("dHist","Canvas2",100,100,1000,1000);
> dHist->Divide(6,6);
>
>
> InitHist();
>
>
> // CUTS ARE APPLIED HERE...
> dHist->cd(1); T0.Draw("fPt>>hfPt", cut0, cut1, cut2, cut3,
> cut4, cut5, cut6, cut7);
> dHist->cd(2); T0.Draw("fPl>>hfPl", cut0, cut1, cut2, cut3,
> cut4, cut5, cut6, cut7);
> dHist->cd(3); T0.Draw("fEvis>>hfEvis", cut0, cut1, cut2, cut3,
> cut4, cut5, cut6, cut7);
> dHist->cd(4); T0.Draw("fNchg>>hfNchg", cut0, cut1, cut2, cut3,
> cut4, cut5, cut6, cut7);
> dHist->cd(5); T0.Draw("fThrust>>hfThrust", cut0, cut1, cut2,
> cut3, cut4, cut5, cut6, cut7);
> dHist->cd(6); T0.Draw("fFYcut>>hfFYcut", cut0, cut1, cut2,
> cut3, cut4, cut5, cut6, cut7);
> // THE REST OF THE HISTOGRAMS FOLLOW...
>
> f2.Write();
> }
> ==============================================================
> ==============================================================
> ==============================================================
>
>
> AND THE ERROR...
> ==============================================================
> ==============================================================
> ==============================================================
> *******************************************
> * *
> * W E L C O M E to R O O T *
> * *
> * Version 3.02/06 9 March 2002 *
> * *
> * You are welcome to visit our Web site *
> * http://root.cern.ch *
> * *
> *******************************************
>
> Compiled for linux with thread support.
>
> CINT/ROOT C/C++ Interpreter version 5.15.21, Dec 8 2001
> Type ? for help. Commands must be C++ statements.
> Enclose multiple statements between { }.
> root [0]
> Processing READTTreeFile01.C...
> Error: Can't call
> TTree::Draw("fPt>>hfPt",cut0,cut1,cut2,cut3,cut4,cut5,cut6,cut7)
> in current scope FILE:READTTreeFile01.C LINE:146
> Possible candidates are...
> filename line:size busy function type and name (in TTree)
> (compiled) 0:0 0 public: virtual void Draw(Option_t* opt);
> (compiled) 0:0 0 public: virtual Int_t Draw(const char*
> varexp,TCut selection,Option_t* option=,Int_t
> nentries=1000000000,Int_t firstentry=0);
> (compiled) 0:0 0 public: virtual Int_t Draw(const char*
> varexp,const char* selection,Option_t* option=,Int_t
> nentries=1000000000,Int_t firstentry=0); //*MENU*
> filename line:size busy function type and name (in TNamed)
> filename line:size busy function type and name (in
> TObject)
> (compiled) 0:0 0 public: virtual void Draw(Option_t*
> option=);
> filename line:size busy function type and name (in
> TAttLine)
> filename line:size busy function type and name (in
> TAttFill)
> filename line:size busy function type and name (in
> TAttMarker)
> *** Interpreter error recovered ***
> root [1]
> ==============================================================
> ==============================================================
> ==============================================================
>
> if i put only "cut0 && cut5" or "cut3" it works but not when i
> put "cut0, cut1, cut2, cut3, cut4, cut5, cut6, cut7".
>
>
> please help me...
> jaybee b. magallanes
> csm, msuiit
>
>
> _______________________________________________________________________
> Committed to Excellence in Science and Technology http://www.msuiit.edu.ph/
> Are you an MSUan? Join the MSU International Alumni Homecoming 2002
> Logon http://www.msu-system.org/ for details.
>
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:54 MET