TCut and TGlobal

I a script am loading a file with a number of cuts.
Later I am trying to select one of the cuts by its char name and give it a
temporary name:

TCut cut_temp=(TCut)gROOT->GetListOfGlobals()->FindObject(“cut10_1920”);

checking for the name
(const char* 0x1e8ae68)“cut10_1920”

it has the proper name

(const char* 0xf61ed8)""

shows that it does not have the test. Can someone help me figure out what I am doing wrong here?
Thanks, Andi

[quote]shows that it does not have the test. Can someone help me figure out what I am doing wrong here? [/quote]It really depends how those cuts were created …


This is the script which I then load with

gROOT->ProcessLine(".U ~/tester_suite/input/root/scripts/ZDG_cuts.C");


list of simple cuts for cu1904 and 1912 for events

TCut *cut1_1904 = new TCut(“cut1_1904”,“tree1904.zdacCntr==2147485314”);
TCut *cut2_1904 = new TCut(“cut2_1904”,“tree1904.zdacCntr==2147487242”);
TCut *cut3_1904 = new TCut(“cut3_1904”,“tree1904.zdacCntr==2147488431”);
TCut *cut4_1904 = new TCut(“cut4_1904”,“tree1904.zdacCntr==2147489428”);
TCut *cut5_1904 = new TCut(“cut5_1904”,“tree1904.zdacCntr==2147490502”);
TCut *cut6_1904 = new TCut(“cut6_1904”,“tree1904.zdacCntr==2147492152”);
TCut *cut7_1904 = new TCut(“cut7_1904”,“tree1904.zdacCntr==2147493312”);
TCut *cut8_1904 = new TCut(“cut8_1904”,“tree1904.zdacCntr==2147494896”);
TCut *cut9_1904 = new TCut(“cut9_1904”,“tree1904.zdacCntr==2147496045”);
TCut *cut10_1904 = new TCut(“cut10_1904”,“tree1904.zdacCntr==2147498757”);

TCut *cut1_1912 = new TCut(“cut1_1912”,“tree1912.zdacCntr==2147485314”);
TCut *cut2_1912 = new TCut(“cut2_1912”,“tree1912.zdacCntr==2147487242”);
TCut *cut3_1912 = new TCut(“cut3_1912”,“tree1912.zdacCntr==2147488431”);
TCut *cut4_1912 = new TCut(“cut4_1912”,“tree1912.zdacCntr==2147489428”);
TCut *cut5_1912 = new TCut(“cut5_1912”,“tree1912.zdacCntr==2147490502”);
TCut *cut6_1912 = new TCut(“cut6_1912”,“tree1912.zdacCntr==2147492152”);
TCut *cut7_1912 = new TCut(“cut7_1912”,“tree1912.zdacCntr==2147493312”);
TCut *cut8_1912 = new TCut(“cut8_1912”,“tree1912.zdacCntr==2147494896”);
TCut *cut9_1912 = new TCut(“cut9_1912”,“tree1912.zdacCntr==2147496045”);
TCut *cut10_1912 = new TCut(“cut10_1912”,“tree1912.zdacCntr==2147498757”);


Thanks, Andi

gROOT->ProcessLine(".U ~/tester_suite/input/root/scripts/ZDG_cuts.C");Odd: .U means to unload the script.

TCut *cut_temp=(TCut*)gROOT->GetListOfGlobals()->FindObject("cut10_1920"); This is incorrect. The list of globals contains only TGlobal objects (which are ‘reference’ to global variables).

So this might work:TGlobal *global=(TGlobal*)gROOT->GetListOfGlobals()->FindObject("cut10_1920"); TCut *cut = (TCut*)global->GetAddress();

Also, The TCut object do not self register to any list. So you must be doing some a bit more for the pointer and/or the TCut to be in the list of globals.


Hi Philippe
Sorry I cut and pasted the wrong line:
I actually do


When I do

TGlobal global=(TGlobal)gROOT->GetListOfGlobals()->FindObject(“cut10_1920”);
TCut cut = (TCut)global->GetAddress();

I get a segmentation violation.

Cheers, Andi

was does global->ls() and global->Print() shows?


ROOT does not do any bookeeping for TCut, only for classes stored in the collections known by TROOT (see TROOT.h)

It is up to you to add your cuts to eg. a TList


Putting them into a TList did it.