Skip to content
Snippets Groups Projects
Commit 4ee08644 authored by Hernán Asorey's avatar Hernán Asorey
Browse files

Calculation of signal characteristic times and signal fractions oriented to...

Calculation of signal characteristic times and signal fractions oriented to improve muon/EM signal separation
parent 0b717f7a
No related branches found
No related tags found
No related merge requests found
...@@ -58,12 +58,17 @@ int main (int argc, char **argv) { ...@@ -58,12 +58,17 @@ int main (int argc, char **argv) {
// //
// File reading and processing // File reading and processing
// //
double rt=0., ft=0., tt=0.;
cerr << "Reading file" << endl; cerr << "Reading file" << endl;
while(NbPulses!=-1) { while(NbPulses!=-1) {
NbPulses=Input.ReadOneSecond(&Data,Pulse,MAXPULSEPERSEC); NbPulses=Input.ReadOneSecond(&Data,Pulse,MAXPULSEPERSEC);
for (int j=CHANNELS-1; j>=0; j--) for (int i=0; i<NbPulses; i++) {
cout << Pulse[0].IsTriggered(j) << " "; rt = Pulse[i].GetRiseTime(2);
cout << endl; ft = Pulse[i].GetFallTime(2);
tt = Pulse[i].GetFullTime(2);
if (rt>0 && ft>0)
cout << rt << " " << ft << " " << tt << endl;
}
} }
return 0; return 0;
} }
...@@ -139,7 +139,55 @@ class LagoEvent { ...@@ -139,7 +139,55 @@ class LagoEvent {
return charge; return charge;
} }
void dump() { double GetTfraction(int channel, int fraction) {
if (fraction < 10 || fraction > 100)
return -1;
double charge = (double) GetCharge(channel);
if (!charge)
return -2;
int i=0;
double s = 0.;
double dy = 0.;
double x = 0.;
double limit = fraction / 100.;
for (i=0; i<currentbinfilled; i++) {
dy = 1.0 * (trace[channel][i] - BASELINE) / charge;
s += dy;
if (s >= limit)
break;
}
if (!i)
return -3;
if (!dy)// no changes from previous bin? should not happen thanks to the equal sign in the comparisson, but just in case
return ((i-1.)*BIN); // return previous bin
x = (1.0 * i - ((s - limit) / dy)) * BIN;
return x;
}
double GetCharTime(int channel, int up, int low) {
if (up < low)
return -1; // stupid user
double Tu=GetTfraction(channel,up);
double Tl=GetTfraction(channel,low);
if (Tu >= 0 && Tl >= 0)
return (Tu-Tl);
else
return -1;
}
double GetRiseTime (int channel) {
return GetCharTime(channel,50,10);
}
double GetFallTime (int channel) {
return GetCharTime(channel,90,50);
}
double GetFullTime (int channel) {
return GetCharTime(channel,90,10);
}
void dump() {
std::cout std::cout
<< "# trg: " << trigger << " cnt: " << counter << " clk: " << clockcount << " " << "# trg: " << trigger << " cnt: " << counter << " clk: " << clockcount << " "
<< std::endl; << std::endl;
......
...@@ -38,5 +38,6 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ...@@ -38,5 +38,6 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
#define CHANNELS 3 #define CHANNELS 3
#define TRACELEN 12 #define TRACELEN 12
#define BASELINE 50 #define BASELINE 50
#define BIN 25.
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment