48 fIsZerosupressed( false ),
57 snprintf(
fName, 256,
"%s", name);
75 AliWarning( Form(
"Attempt to set Invalid time bin range (Min , Max) = (%d, %d), Ingored", min, max ) );
90 UShort_t tmpmax = data[0];
92 for(
int i=0; i < length; i++)
94 if( tmpmax < data[i] )
109 int * first,
int * last,
int cut)
const 111 int tmpfirst = maxindex;
112 int tmplast = maxindex;
113 Double_t prevFirst = data[maxindex];
114 Double_t prevLast = data[maxindex];
115 bool firstJump =
false;
116 bool lastJump =
false;
118 while( (tmpfirst >= 0) && (data[tmpfirst] >= cut ) && (!firstJump) )
121 if (tmpfirst != maxindex) {
122 if ( data[tmpfirst] >= prevFirst) {
126 prevFirst = data[tmpfirst];
130 while( (tmplast < length) && (data[tmplast] >= cut ) && (!lastJump) )
133 if (tmplast != maxindex) {
134 if ( data[tmplast] >= prevLast) {
138 prevLast = data[tmplast];
144 if (firstJump || tmpfirst<0) tmpfirst ++;
145 if (lastJump || tmplast>=length) tmplast --;
161 double *outarray )
const 164 const UShort_t *sig = bunch->
GetData();
168 for(
int i=0; i < length; i++ )
170 outarray[i] = sig[length -i -1] - ped;
203 const UShort_t *sig = bunch->
GetData();
205 for(
int i=0; i < bunch->
GetLength(); i++ )
207 if( sig[i] > tmpmax )
231 const UShort_t *sig = bunch->
GetData();
233 for(
int i=0; i < bunch->
GetLength(); i++ )
235 if( sig[i] > tmpmax )
243 if (tmpindex == 0 || tmpindex == (bunch->
GetLength()-1) )
256 short * maxampbin,
short * maxamplitude )
259 short bunchindex = -1;
263 for(
unsigned int i=0; i < bunchvector.size(); i++ )
265 max =
Max( &bunchvector.at(i), &indx );
296 if( ( mintindx < 0 && maxtindx < 0) ||maxtindx < 0 )
301 return ( maxindex < maxtindx ) && ( maxindex > mintindx ) ?
true :
false;
310 cout << __FILE__ << __LINE__<<
"*************** Printing Bunches *******************" << endl;
311 cout << __FILE__ << __LINE__<<
"*** There are " << bvctr.size() <<
", bunches" << endl;
313 for(
unsigned int i=0; i < bvctr.size() ; i++ )
316 cout <<
" bunch = " << i << endl;
318 cout << __FILE__ << __LINE__<<
"*************** Done ... *******************" << endl;
327 cout << __FILE__ <<
":" << __LINE__ << endl;
328 cout << __FILE__ << __LINE__ <<
", startimebin = " << bunch.
GetStartBin() <<
", length =" << bunch.
GetLength() << endl;
329 const UShort_t *sig = bunch.
GetData();
331 for ( Int_t j = 0; j < bunch.
GetLength(); j++)
350 Int_t first, Int_t last,
351 Double_t adcErr, Double_t tau)
const 353 if (first == last || first<0 ) {
358 int nsamples = last - first + 1;
363 Double_t dy = 0.0, xx = 0.0,
f=0.0;
365 for (Int_t i=0; i<nsamples; i++)
368 xx = (x - time + tau) / tau;
373 f = amp * xx*xx * TMath::Exp(2 * (1 - xx )) ;
383 chi2 /= (adcErr*adcErr);
401 Double_t & mean, Double_t & rms)
408 if (first == last || first<0 )
411 int nsamples = last - first + 1;
415 Double_t sampleSum = 0;
416 Double_t squaredSampleSum = 0;
418 for (Int_t i=0; i<nsamples; i++)
425 mean = sampleSum / nsamples;
426 Double_t squaredMean = squaredSampleSum / nsamples;
428 rms = sqrt(squaredMean - mean*mean);
439 UInt_t altrocfg1, UInt_t altrocfg2, Int_t & index,
440 Float_t & maxf,
short & maxamp,
441 short & maxrev, Float_t & ped,
442 int & first,
int & last,
int acut )
445 short maxampindex = 0;
448 index =
SelectBunch( bunchvector, &maxampindex, &maxamp );
451 if( index >= 0 && maxamp >= acut )
455 maxf = TMath::MaxElement( bunchvector.at(index).GetLength(),
fReversed );
460 maxrev = maxampindex - bunchvector.at(index).GetStartBin();
465 if (first!=maxrev && last!=maxrev)
468 nsamples = last - first + 1;
int fMaxTimeIndex
The timebin of the max signal value must be between fMinTimeIndex and fMaxTimeIndex.
bool IsInTimeRange(const int maxindex, const int maxtime, const int mintime) const
Check if the index of the max ADC vaue is consistent with trigger.
printf("Chi2/npoints = %f\n", TMath::Sqrt(chi2/npoints))
Base class for extraction of signal amplitude and peak position.
bool CheckBunchEdgesForMax(const AliCaloBunchInfo *const bunch) const
A bunch is considered invalid if the maximum is in the first or last time-bin.
char fName[256]
Name of the algorithm.
const UShort_t * GetData() const
void CalculateMeanAndRMS(const Int_t first, const Int_t last, Double_t &mean, Double_t &rms)
short Max(const AliCaloBunchInfo *const bunch, int *maxindex) const
Get maximum in bunch array.
AliCaloRawAnalyzer(const char *name="AliCaloRawAnalyzer", const char *nameshort="RawAna")
Constructor.
int SelectBunch(const std::vector< AliCaloBunchInfo > &bunchvector, short *maxampbin, short *maxamplitude)
We select the bunch with the highest amplitude unless any time constraints is set.
const double TAU
Approximate shaping time.
#define AliWarning(message)
Container of ALTRO information.
bool fIsZerosupressed
Wether or not the data is zeros supressed, by default its assumed that the baseline is also subtracte...
static void PrintBunches(const std::vector< AliCaloBunchInfo > &bunchvector)
Print bunch vector infomation.
char fNameShort[256]
Abbrevation for the name.
UInt_t GetStartBin() const
void SelectSubarray(const Double_t *date, int length, short maxindex, int *first, int *last, int cut) const
int fNsamplePed
Number of samples used for pedestal calculation (first in bunch)
Float_t ReverseAndSubtractPed(const AliCaloBunchInfo *bunch, UInt_t altrocfg1, UInt_t altrocfg2, double *outarray) const
int PreFitEvaluateSamples(const std::vector< AliCaloBunchInfo > &bunchvector, UInt_t altrocfg1, UInt_t altrocfg2, Int_t &index, Float_t &maxf, short &maxamp, short &maxampindex, Float_t &ped, int &first, int &last, int acut)
Method to do the selection of what should possibly be fitted.
const int ALTROMAXSAMPLES
The maximum number of samples of the ALTRO.
static void PrintBunch(const AliCaloBunchInfo &bunch)
Print bunch information.
Double_t fReversed[ALTROMAXSAMPLES]
Reversed sequence of samples (pedestalsubtracted)
Double_t CalculateChi2(const Double_t amp, const Double_t time, const Int_t first, const Int_t last, const Double_t adcErr=1, const Double_t tau=2.35) const
Float_t EvaluatePedestal(const UShort_t *const data, const int length) const
Pedestal evaluation if not zero suppressed.
int fMinTimeIndex
The timebin of the max signal value must be between fMinTimeIndex and fMaxTimeIndex.
void SetTimeConstraint(int min, int max)
Require that the bin if the maximum ADC value is between min and max (timebin)
static double fAmp
amplitude