Hello!
I have a problem: I am trying to create a Root file and 600 histograms, fill each histogram and write them to the file.
Here is the code I am using:
int main(int argc, char **argv) {
if (argc!=3) {
printf("Usage: analyzerefScan.exe refDataDir runNr\n");
return -1;
}
TString refDataDir = Form("%s",argv[1]);
UInt_t runNr = atoi(argv[2]);
char name[50];
TObjArray *Hlist = new TObjArray(600);
TH1I *h1[20][6][10];
UInt_t step = 0;
AliITSOnlineSPDscan *scanObj[20];
for (UInt_t eq=0; eq<20; eq++) {
TString fileName = Form("%s/%d_SPD_ref_scan_eq_%d",refDataDir.Data(),runNr,eq);
scanObj[eq] = new AliITSOnlineSPDscan(fileName.Data());
for (UInt_t hs=0; hs<6; hs++) {
for (UInt_t chip=0; chip<10; chip++) {
sprintf(name, "eq %d hs %d chip %d", eq,hs,chip);
h1[eq][hs][chip] = new TH1I(name,name,101,0,101);
Hlist->Add(h1[eq][hs][chip]);
for (UInt_t col=0; col<32; col++) {
for (UInt_t row=0; row<26; row++) {
UInt_t nrHits = scanObj[eq]->GetHits(step,hs,chip,col,row);
h1[eq][hs][chip]->Fill(nrHits);
}
}
}
}
delete scanObj[eq];
}
TFile hfile("histos.root", "RECREATE");
Hlist->Write();
hfile.Close();
return 0;
}
When I try to run it, the following message appeared:
- Break *** segmentation violation
(no debugging symbols found)
Using host libthread_db library "/lib/tls/libthread_db.so.1".
Attaching to program: /proc/7998/exe, process 7998
(no debugging symbols found)...done.
(no debugging symbols found)...done.
(no debugging symbols found)...done.
(no debugging symbols found)...done.
(no debugging symbols found)...done.
(no debugging symbols found)...done.
(no debugging symbols found)...done.
(no debugging symbols found)...done.
(no debugging symbols found)...done.
(no debugging symbols found)...done.
[Thread debugging using libthread_db enabled]
[New Thread -1278355776 (LWP 7998)]
0x00aeb7a2 in _dl_sysinfo_int80 ()
from /lib/ld-linux.so.2
#1 0x0213df13 in __waitpid_nocancel () from /lib/tls/libc.so.6
#2 0x020e77b9 in do_system () from /lib/tls/libc.so.6
#3 0x01b7198d in system () from /lib/tls/libpthread.so.0
#4 0x002e25b7 in TUnixSystem::Exec ()
from /home/rferrett/root/v5-21-01-alice/lib/libCore.so
#5 0x002e8041 in TUnixSystem::StackTrace ()
from /home/rferrett/root/v5-21-01-alice/lib/libCore.so
#6 0x002e4c86 in TUnixSystem::DispatchSignals ()
from /home/rferrett/root/v5-21-01-alice/lib/libCore.so
#7 0x002e4d14 in SigHandler ()
from /home/rferrett/root/v5-21-01-alice/lib/libCore.so
#8 0x002e3f59 in sighandler ()
from /home/rferrett/root/v5-21-01-alice/lib/libCore.so
#9 <signal handler called>
#10 0xb3e14f0f in AliITSOnlineSPDscan::GetNSteps (this=0x0)
at ITS/AliITSOnlineSPDscanInfo.h:41
#11 0xb3e14963 in AliITSOnlineSPDscan::GetHits (this=0x8a4c0a0, nsi=0, hs=0,
chipi=0, coli=0, rowi=0) at ITS/AliITSOnlineSPDscan.cxx:260
#12 0x080496b3 in main ()
Where is the problem? What I have to do?
Thank you very much.
RF
Received on Mon Oct 13 2008 - 11:24:25 CEST