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)