This code works at CINT.
But when I try to compile the program by a Makefile, it gives the error at the below.
[color=red]H_dec.cc: In function `int main()':
H_dec.cc:84: warning: converting to `int' from `float'
H_dec.cc:86: error: invalid types `TH1F*[72][float]' for array subscript
make: *** [H_dec] Error 1[/color]
How should I use TH1Farray class in a .cc file?
This code works at CINT.
But when I try to compile the program by a Makefile, it gives the error at the below.
[color=red]H_dec.cc: In function int main()': H_dec.cc:84: warning: converting toint’ from float' H_dec.cc:86: error: invalid typesTH1F*[72][float]’ for array subscript
make: *** [H_dec] Error 1[/color]
[quote]H_dec.cc:84: warning: converting to int' fromfloat’
H_dec.cc:86: error: invalid types `TH1F*[72][float]’ for array subscript [/quote]humm … what is the content of the line 84 and 86? [It does not seem to what you mentioned in you first post].
The problem is that RecHOEta and RecHOPhi are (seemingly) declared as array of floats. If there are intended to be used as indices, you should declare them as array of ints or longs.
66 //float RecHOPhi[375];
67 int RecHOPhi[375];
68 //float RecHOEta[375];
69 int RecHOEta[375];
It was compiled without an error. but when I run it I got;
*** Break *** segmentation violation
Using host libthread_db library “/lib64/tls/libthread_db.so.1”.
Attaching to program: /proc/9374/exe, process 9374
[Thread debugging using libthread_db enabled]
[New Thread 4131854816 (LWP 9374)]
0xffffe410 in __kernel_vsyscall () #1 0x00356f13 in __waitpid_nocancel () from /lib/tls/libc.so.6 #2 0x003007b9 in do_system () from /lib/tls/libc.so.6 #3 0x0043398d in system () from /lib/tls/libpthread.so.0 #4 0xf7af1d4d in TUnixSystem::Exec ()
from /afs/cern.ch/cms/sw/slc4_ia32_gcc345/cms/cmssw/CMSSW_2_1_9/external/slc4_ia32_gcc345/lib/libCore.so #5 0xf7af83d0 in TUnixSystem::StackTrace ()
from /afs/cern.ch/cms/sw/slc4_ia32_gcc345/cms/cmssw/CMSSW_2_1_9/external/slc4_ia32_gcc345/lib/libCore.so #6 0xf7af4959 in TUnixSystem::DispatchSignals ()
from /afs/cern.ch/cms/sw/slc4_ia32_gcc345/cms/cmssw/CMSSW_2_1_9/external/slc4_ia32_gcc345/lib/libCore.so #7 0xf7af4a03 in SigHandler ()
from /afs/cern.ch/cms/sw/slc4_ia32_gcc345/cms/cmssw/CMSSW_2_1_9/external/slc4_ia32_gcc345/lib/libCore.so #8 0xf7af3aae in sighandler ()
from /afs/cern.ch/cms/sw/slc4_ia32_gcc345/cms/cmssw/CMSSW_2_1_9/external/slc4_ia32_gcc345/lib/libCore.so #9 #10 0x0804a575 in main () at HO.cc:94