Ctrl+c to stop root job

Hi,

I have this strange problem, I have two files like this


  1. run.C

run(){
gSystem->Load(“libRIO.so”);
gSystem->Load(“libTree.so”);
gSystem->Load(“libHist.so”);
gSystem->Load(“Analysis.so”);
Analysis t;
t.Loop();
}

and


  1. RUN_Code.csh

#~/bin/tcsh
make clean
make
root -l run.C -q

When I run the RUN_Code.csh the file runs nicely…but problem arise when I want to stop the run in the middle using Ctrl+c keys. It gives me the following:


[sushil-laptop@Analysis_Code] ./RUN_Code.csh
removing Analysisdict.C Analysisdict.h Analysis.so
rm Analysisdict.C Analysisdict.h Analysis.so
Making Analysisdict.C Analysisdict.h
rm -f Analysisdict.C Analysisdict.h
rootcint Analysisdict.C -c -I/home/sushil/ROOT/root_5.22/root/include Analysis.h
Compiling Analysis.C
g++ -o Analysis.so -O -Wall -fPIC -shared -I/home/sushil/ROOT/root_5.22/root/include Analysisdict.C Analysis.C
In file included from Analysis.C:2:
Analysis.h: In member function ‘virtual Double_t Analysis::getDeltaPhi(Int_t)’:
Analysis.h:1039: warning: unused variable ‘twopi’
Analysis.h: In member function ‘virtual Double_t Analysis::getGenDeltaPhi(Int_t)’:
Analysis.h:1052: warning: unused variable ‘twopi’
root [0]
Processing run.C…
Error in TTree::SetBranchStatus: unknown branch -> pat_phot_isoEcalRecHitR4
Error in TTree::SetBranchStatus: unknown branch -> pat_phot_isoHcalRecHitR4
Error in TTree::SetBranchStatus: unknown branch -> pat_phot_isohollowtrkconeR4
Events analysed till now —> 0
Events analysed till now —> 100000
Error in TTree::SetBranchStatus: unknown branch -> pat_phot_isoEcalRecHitR4
Error in TTree::SetBranchStatus: unknown branch -> pat_phot_isoHcalRecHitR4
Error in TTree::SetBranchStatus: unknown branch -> pat_phot_isohollowtrkconeR4
Events analysed till now —> 200000
^C
*** Break *** keyboard interrupt run.C:7:

[sushil-laptop@Analysis_Code]
[sushil-laptop@Analysis_Code]
[sushil-laptop@Analysis_Code]
[sushil-laptop@Analysis_Code]
[sushil-laptop@Analysis_Code]
[sushil-laptop@Analysis_Code] Events analysed till now —> 300000
Error in TTree::SetBranchStatus: unknown branch -> pat_phot_isoEcalRecHitR4
Error in TTree::SetBranchStatus: unknown branch -> pat_phot_isoHcalRecHitR4
Error in TTree::SetBranchStatus: unknown branch -> pat_phot_isohollowtrkconeR4
Events analysed till now —> 400000
Events analysed till now —> 500000

I checked with oher applications and Ctrl+c work fine. But with root it does not. I am using Ubuntu 9.10.

Any suggestions to solve this problem…as I am doing some test and often want to kill the process in the middle using Ctrl+c.

Thanks a lot.
With best regards,
sushil

Hi,

Does the problem persist if you replaceroot -l run.C -q withroot.exe -l run.C -q?

Cheers,
Philippe.

Yes, it still persist even if I change root to root.exe.

To check again I open a pdf file using acroread command in the terminal and then did Ctrl+c to kill it and it worked fine.

With best regards,
sushil

do you have anything specific on ctrl-c in your .cshrc?

Cheers, Fons.

No, I do not have anything specific regarding ctrl+c in .tcshrc (i use tcsh shell).

I was using ‘c’ as an alias for ‘clear’…but now I remove that and tried again the ctrl+c keys and it still gives the same problem with root!.

With best regards,
sushil

what puzzles me is how ROOT can continue after you got your prompt back, looks like it is running in the background. When this happens do you get the ROOT prompt back at the end?

Cheers, Fons.

In the end I get this



Error in TTree::SetBranchStatus: unknown branch -> pat_phot_isoHcalRecHitR4
Error in TTree::SetBranchStatus: unknown branch -> pat_phot_isohollowtrkconeR4
Events analysed till now —> 2200000
Error in TTree::SetBranchStatus: unknown branch -> pat_phot_isoEcalRecHit
Error in TTree::SetBranchStatus: unknown branch -> pat_phot_isoHcalRecHit
Error in TTree::SetBranchStatus: unknown branch -> pat_phot_isohollowtrkcone
Vectors are cleared now
*** Interpreter error recovered ***

After this if I hit “enter” I get back to the prompt (I have -q option while running .C file )

with best regards,
sushil

and without the -q, same behavior?

– Fons

With -q I get this:


Error in TTree::SetBranchStatus: unknown branch -> pat_phot_isohollowtrkconeR4
Events analysed till now —> 2200000
Error in TTree::SetBranchStatus: unknown branch -> pat_phot_isoEcalRecHit
Error in TTree::SetBranchStatus: unknown branch -> pat_phot_isoHcalRecHit
Error in TTree::SetBranchStatus: unknown branch -> pat_phot_isohollowtrkcone
Vectors are cleared now
*** Interpreter error recovered ***
root [1]

With best regards,
sushil

But also the shell prompt in the middle after the ctrl-c?

– Fons

yes, it shows prompt.

Meantime I tried this:


[sushil-laptop@Analysis_Code] root -l run.C
root [0]
Processing run.C…
Error in TTree::SetBranchStatus: unknown branch -> pat_phot_isoEcalRecHitR4
Error in TTree::SetBranchStatus: unknown branch -> pat_phot_isoHcalRecHitR4
Error in TTree::SetBranchStatus: unknown branch -> pat_phot_isohollowtrkconeR4
Events analysed till now —> 0
Events analysed till now —> 100000
^C
*** Break *** keyboard interrupt run.C:7:
^C
*** Break *** keyboard interrupt
Root >
*** Break *** keyboard interrupt
Root >
*** Break *** keyboard interrupt
Root >


and


[sushil-laptop@Analysis_Code] root -l run.C -q
root [0]
Processing run.C…
Error in TTree::SetBranchStatus: unknown branch -> pat_phot_isoEcalRecHitR4
Error in TTree::SetBranchStatus: unknown branch -> pat_phot_isoHcalRecHitR4
Error in TTree::SetBranchStatus: unknown branch -> pat_phot_isohollowtrkconeR4
Events analysed till now —> 0
Events analysed till now —> 100000
^C
*** Break *** keyboard interrupt run.C:7:
^C
*** Break *** keyboard interrupt
Root > [sushil-laptop@Analysis_Code]
[sushil-laptop@Analysis_Code]
[sushil-laptop@Analysis_Code]

so both of them worked fine!!!

with best regards,
sushil

Ok, indeed multiple ctrl-c will get you out of the event loop.

– Fons

It seems when i use ctrl+c more than once and NOT running through .csh script then it works fine but if I run it through .csh file then it do not work…infact hitting ctrl+c many time do not show the line below more than once!!!

^C
*** Break *** keyboard interrupt

So still do not know whats happening!!

with best regards,
sushil

Just to check if this is the problem with .csh script or tcsh shell i did following:

made a file junk.csh with following in it:

#!/bin/tcsh
echo ‘hello’
/bin/sleep 60
echo ‘hello’

When it was running sleep command, I hit ctrl+c and it worked fine.

With best regards,
sushil