padsley / k600analyser

Code for the K600 analyser including plugin codes for silicon, clover and HAGAR data
1 stars 4 forks source link

Crash on arthur #145

Closed padsley closed 7 years ago

padsley commented 7 years ago

Crash with 2 ADC modules.

This is for my own notes. Go away.

The lines below might hint at the cause of the crash. If they do not help you then please submit a bug report at http://root.cern.ch/bugs. Please post the ENTIRE stack trace from above as an attachment in addition to anything else

that might help us fixing this issue.

6 0x000000000042b4f6 in CloverEnergyCalc (Channel=Channel

entry=22, ADCValue=167) at CloverSort.c:153

7 0x000000000042b7e4 in CloverSort (ADC_import=0x2ac61d0, ntdc=ntdc

entry=27, TDC_channel_import=TDC_channel_import entry=0x3339670, TDC_value_import=TDC_value_import entry=0x3339af0, gammy=0x3339b70) at CloverSort.c:60

8 0x0000000000433d9d in main_event (pheader=, pevent=) at main.c:1884

9 0x000000000041828b in process_event (par=0x68b980 , pevent=0x7fb38df05010) at src/mana.c:3157

10 0x0000000000418822 in analyze_run (run_number=1083, input_file_name=0x7ffcd4a11d70 "/experiment-data/PR251/2016/run01083.mid.gz", output_file_name=) at src/mana.c:4178

11 0x0000000000418d52 in loop_runs_offline () at src/mana.c:4366

12 0x0000000000419585 in main (argc=, argv=) at src/mana.c:5579

padsley commented 7 years ago

The problem is in 'ADCCalibrationParameters' somewhere...

padsley commented 7 years ago

Oh!

Found it.

  for(int i=1;i<npars+1;i++)
  {
    result += ADCCalibrationParameters[Channel][i] * pow(RandyADCValue,(double)i-1.);
  }

The problem happens in here.

padsley commented 7 years ago

Ignore that last message. Was nonsense. It failed there because I'd stopped it failing earlier. Doh.

padsley commented 7 years ago

Fixed.

Problem was in CloverSort.c.

In Parameters.c, the declaration is: double **ADCCalibrationParameters;.

There is, on the line above, an outdated declaration: // std::vector<std::vector<double> > ADCCalibrationParameters;.

This is left over from my first attempt to add non-linear calibrations.

In CloverSort.c, the declaration was //extern std::vector<std::vector<double> > ADCCalibrationParameters;.

For some reason, this allowed the compilation. Je ne comprends pas. Anyway, it caused the array behaviour to be different (in some manner which I do not understand) which caused the code to crash.

Obviously, the problem was in the memory allocation of ADCCalibrationParameters. Hence why the problem only occurred when people attempted to run with only 2 ADC modules and not with a higher number.

padsley commented 7 years ago

I just checked, the only other place with a non-linear calibration implemented is in RawData.c.

Here, the declaration looks fine. C'est bon.

padsley commented 7 years ago

Definitely my fault: https://github.com/padsley/k600analyser/commit/01ead185d645576bc1d468d43232aa5f460ccfa3