StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
JF_util_zoo.h
1 // *+****1****+****2****+****3****+****4****+****5****+****6****+****7****+****
2 //
3 // example algos fro FGT
4 //
5 //*-- Author: Jan Balewski, MIT, January 2012
6 //
7 // $Id: JF_util_zoo.h,v 1.1 2012/02/21 21:21:25 balewski Exp $
8 //
9 // *+****1****+****2****+****3****+****4****+****5****+****6****+****7****+****
10 
11 
12 #ifndef JF_util_zoo_H
13 #define JF_util_zoo_H
14 
15 //-------------------------------
16 //-------- pulse seed finder , based on expected pulse shape and sigPed
17 //-------------------------------
18 bool pluseSeedFinderA(float *adc, int N, float sigPed,
19  float &peakAdc, int &leadEdgeBin, float &sumAdc) {
20  // assumes adc[timeBin] are pedestal subtracted
21  assert(N==7);// works only for 7 time-bin sampling
22  peakAdc=leadEdgeBin=-9999;
23  sumAdc=0;
24 
25  for(int i=0;i<N;i++) {
26  sumAdc+=adc[i];
27  if(leadEdgeBin<0 && adc[i]> 5*sigPed) leadEdgeBin=i;
28  if(2<=i && i<=4 && peakAdc < adc[i] ) peakAdc =adc[i]; // snap to peak
29  }
30  // do sum first, it is used even if puls is not tagged as a seed
31 
32  if( adc[0]> 2*sigPed) return false; // start low
33  if( adc[2]< 5*sigPed) return false; // high is visible
34  if( adc[3]< 5*sigPed) return false; // high is visible
35  if( adc[4]< 5*sigPed) return false; // high is visible
36 
37  if(peakAdc < adc[6] ) return false; //trailing edge
38 
39  return true;
40 }
41 
42 
43 
44 #endif
45 
46 // $Log: JF_util_zoo.h,v $
47 // Revision 1.1 2012/02/21 21:21:25 balewski
48 // *** empty log message ***
49 //