Problem Running Simple Code

Hello,

I am having trouble running the simple attached code that inputs an n-tuple, loops over its events and does a simple calculation (2+3=5). I keep on receiving the following error:

Error: Incorrect assignment to c, wrong type ‘Int_t’ test.cpp:20:
*** Interpreter error recovered **

Weirder still, when I include a line above the calculation: cout<<iEvent<<endl;- the code works fine!

I am doing analysis on many n-tuples and I have a large analysis code. I wrote this test script because I discovered that (for unknown reasons to me) whenever I added a small amount of code to my analysis code, it wouldn’t run.

Any help with this matter would be greatly appreciated. I also could attach the file 126937.root if that would help.
Thanks,
David
test.cpp (555 Bytes)

Attach your ROOT file.

The only thing I consider wrong is the name of your routine. The name “main” is reserved. Change it into something else, e.g. “test”.

I tried changing the function name to test and testmain, and it didn’t change anything.
Unfortunately it seems like the root file is too large to be attached.

Thanks for the quick reply!
David

Post here the output of: TFile *f = TFile::Open("126937.root"); f->ls(); TTree *t; f->GetObject("HWWTree_quadlep", t); t->Print();

I believe from me playing around that the problem is from tree->GetEntry(iEvent);
Although I have no idea why.

Here is the output:

TFile** 126937.root
TFile* 126937.root
KEY: TTree HWWTree_trilep;1 HWW TrilepNtuple
KEY: TTree HWWTree_trilep_ss;1 HWW Same Sign TrilepNtuple
KEY: TH1D trilep_channel;1 Cutflow trilep channel
KEY: TH1D trilep_channel_ss;1 Cutflow trilep channel SS
KEY: TH1D quadlep_channel;1 Cutflow quadlep channel
KEY: TH1D electronCutFlow;1 electron object count
KEY: TH1D muonCutFlow;1 muon object count
KEY: TH1D jetCutFlow;1 jet object count
KEY: TH1D electronCutFlow_Den;1 electron object count
KEY: TH1D muonCutFlow_Den;1 muon object count
KEY: TH1D Count;1 h_Count
KEY: TTree HWWTree_quadlep;1 HWW QuadlepNtuple

And the output of the tree gets cut off in the ROOT window, but here is a sample of it:


*Br 930 :m_trk_nBLayerOutliers : vector *
*Entries : 11171 : Total Size= 1628965 bytes File Size = 108643 *
*Baskets : 51 : Basket Size= 878592 bytes Compression= 14.98 *

*Br 931 :m_trk_nPixelOutliers : vector *
*Entries : 11171 : Total Size= 1628910 bytes File Size = 108065 *
*Baskets : 51 : Basket Size= 878592 bytes Compression= 15.06 *

*Br 932 :m_trk_nSCTOutliers : vector *
*Entries : 11171 : Total Size= 1628800 bytes File Size = 107948 *
*Baskets : 51 : Basket Size= 878592 bytes Compression= 15.08 *

*Br 933 :m_trk_expectBLayerHit : vector *
*Entries : 11171 : Total Size= 1628965 bytes File Size = 154607 *
*Baskets : 51 : Basket Size= 878592 bytes Compression= 10.53 *

*Br 934 :m_mcevt_pdf_id1 : vector *
*Entries : 11171 : Total Size= 202505 bytes File Size = 40038 *
*Baskets : 9 : Basket Size= 249344 bytes Compression= 5.04 *

*Br 935 :m_mcevt_pdf_id2 : vector *
*Entries : 11171 : Total Size= 202505 bytes File Size = 40030 *
*Baskets : 9 : Basket Size= 249344 bytes Compression= 5.05 *

*Br 936 :m_mcevt_pdf_x1 : vector *
*Entries : 11171 : Total Size= 247296 bytes File Size = 117332 *
*Baskets : 10 : Basket Size= 304640 bytes Compression= 2.10 *

*Br 937 :m_mcevt_pdf_x2 : vector *
*Entries : 11171 : Total Size= 247296 bytes File Size = 117355 *
*Baskets : 10 : Basket Size= 304640 bytes Compression= 2.10 *

*Br 938 :m_mcevt_pdf_scale : vector *
*Entries : 11171 : Total Size= 247338 bytes File Size = 108773 *
*Baskets : 10 : Basket Size= 304640 bytes Compression= 2.27 *

Try:
root […] t->Print(); > HWWTree_quadlep.Print.txt
and post the “HWWTree_quadlep.Print.txt” file here.

And now with this code that just changes the placement of tree->GetEntry, it works perfectly.
test.cpp (544 Bytes)

And ya sorry here it is. Hopefully this is what you were looking for:

TFile: name=126937.root, title=, option=READ
HWWTree_quadlep.Print.txt (45 Bytes)

Hi,

Do you still have this problem? If you do I recommend you run with valgrind and report valgrind’s finding and/or provide a complete running example showing the problem.

Cheers,
Philippe.