Suppose that we have a simple signal with just 1 bump around center and nothing in rest of points. Something like a Gaussian distribution. for instance See This. Okay, Then we divided this shape to some data point.
I want to convert this shape to a trapezoidal shape in c++
. Something like this.
As far as i know, It's just a kind of taking average mathematically. Well, how can i do it ?
In addition, I use ROOT CERN
to show the results ...
This is the main part of my code, But it's not work correctly ...
char Data[Data_Point][5]
for (int k = 0; k < Data_Point ; k++){ // Data_Point is equal to 512, and so my array has just 512 member.
h1 = 0.0;
h2 = 0.0;
H = 0.0;
H1 = 0.0;
H2 = 0.0;
for (int l = 0; l <= L; l++){ // L is a const int and equal to 80.
if (k + 1 < Data_Point){
h1 += ((stoi(Data[k + l])) - Baseline / 20.0); // Baseline is average of 20 data point of first of 512 data point, by this i'm trying to make more accuarcy by subtracting the baseline.
} else {
H1 = h1;
cout << H1;
}
if (L + G + k + l < Data_Point){ // G is a Const int and equal to 15.
h2 += ((stoi(Data[L + G + k + l])) - Baseline / 20.0);
} else {
H2 = h2;
cout << H2;
}
}
H = ((h2 - h1) / L);
}
RisingTime->Fill(H);
When i Run this code i encounter with error that say : Unhandled exception at 0x7731C54F in Pro1.exe: Microsoft C++ exception: std::invalid_argument at memory location 0x0019E854.
Anyone can help ? Any answer will be appreciated.