TCut not behaving properly, v5.24/00b

I inherited a macro that is supposed to open a bunch of root files, plot data from each root file with specified cuts, and store these in a single summary root file. Supposedly this was working a while ago, 2005/6, but now I am having issues with TCut. It only works the first time it is used, and is jibberish for the rest of the program.

I have attached the macro with this post, but here is a snippet of it where a cut is declared and used in one of the loops:

TCut rawcut_base = “ev_num>1 && !cond_low_beam &&
!cond_beam_burp”;
rawcut_base += “!cond_mon_saturate”;
rawcut_base += “!cond_startup && !cond_pair_seq && !cond_evt_seq”;
rawcut_base += “!cond_adcx_bad && !cond_adcx_dac_burp”;

TCut rawcut[4];
rawcut[0] = rawcut_base;

for(UInt_t ibcm=0; ibcm<nbcm; ibcm++) {
TString drawcommand = “bcm”+bcm[ibcm];
raw->Draw(drawcommand+">>htemp",TCut(rawcut[0]),“goff”);
// TH1* htemp = (TH1*) gROOT->FindObject(“htemp”);
if (htemp && htemp->GetEntries()>0) {
Int_t nev = htemp->GetEntries();
rawbcm[ibcm] = htemp->GetMean();
rawbcmrms[ibcm] = htemp->GetRMS();
rawbcmerr[ibcm] = rawbcmrms[ibcm] / sqrt(nev);
} else {
rawbcm[ibcm] = -1.E6;
rawbcmrms[ibcm] = -1.E6;
rawbcmerr[ibcm] = -1.E6;
}
cerr << "***bcm: " << drawcommand << endl;
cerr << "cut: " << rawcut[0] << endl;
cerr << "Entries: " << htemp->GetEntries() << endl;
cerr << "rawbcm: " << rawbcm[ibcm] << endl;
cerr << "rawbcm_rms: " << rawbcmrms[ibcm] << endl;
cerr << "rawbcm_err: " << rawbcmerr[ibcm] << endl;
}

Here is the output of the for loop above:
***bcm: bcm1
cut: ��u�
Entries: 90082
rawbcm: 28907.4
rawbcm_rms: 515.453
rawbcm_err: 1.71739
***bcm: bcm2
cut: ��u�
Entries: 90082
rawbcm: 0
rawbcm_rms: 0
rawbcm_err: 0
***bcm: bcm5
cut: ��u�
Entries: 90082
rawbcm: 0
rawbcm_rms: 0
rawbcm_err: 0
***bcm: bcm10
cut: ��u�
Entries: 90082
rawbcm: 0
rawbcm_rms: 0
rawbcm_err: 0

The first output “bcm1” is correct, but the rest is not. I tried just passing the cuts as TString, but did not work either. I dont know what else to try, so I would appreciate any help I could get. Thanks much.

Some info on the system I am using:
uname -m = i686
uname -r = 2.6.31-17-generic-pae
uname -s = Linux
uname -v = #54-Ubuntu SMP Thu Dec 10 17:23:29 UTC 2009
root version 5.24/00b

rupesh
mkSumTreeH.C (33.8 KB)

Why did you comment the essential line

// TH1* htemp = (TH1*) gROOT->FindObject("htemp");
Rene

Code:
// TH1* htemp = (TH1*) gROOT->FindObject(“htemp”);

It does not matter whether I comment the line or not, at least in this case. I get the same output with and without the line commented out. Thanks!

rupesh

It is not possible to have the same output in you comment or not this line. You must have a problem somewhere else.
Could you provide the STRICT minimum setup (.C,.H ,.root) files to reproduce your problem?

Rene

I have made a zipped file of the minimum components required to run this macro, but it is about 350 MB. The libraries and other files are small (much greater than 2 MB though) but some of the .root files are huge. Since this forum caps the attachment file size limit at 2MB, I was wondering if I could email you the attachment. Thanks much for your help.
rupesh

By strict minimum, I meant a max of a few hundred lines. If the problem is what you described you should be able to provide a small test script of few tens of lines + a small data file.

Rene