fNsamplePed(3),
fIsZerosupressed( false ),
fVerbose( false ),
- fAlgo(Algo::kNONE)
+ fAlgo(Algo::kNONE),
+ fL1Phase(0),
+ fAmp(0),
+ fTof(0),
+ fTau( EMCAL::TAU ),
+ fFixTau( true )
{
- //Comment
- snprintf(fName, 256,"%s", name);
+ // Ctor
+
+ snprintf(fName, 256, "%s", name);
snprintf(fNameShort,256, "%s", nameshort);
-
- for(int i=0; i < MAXSAMPLES; i++ )
+
+ for(int i=0; i < ALTROMAXSAMPLES; i++ )
{
fReversed[i] = 0;
}
}
-AliCaloRawAnalyzer::~AliCaloRawAnalyzer()
-{
-
-}
-
void
AliCaloRawAnalyzer::SetTimeConstraint(const int min, const int max )
{
//Require that the bin if the maximum ADC value is between min and max (timebin)
- if( ( min > max ) || min > MAXSAMPLES || max > MAXSAMPLES )
+
+ if( ( min > max ) || min > ALTROMAXSAMPLES || max > ALTROMAXSAMPLES )
{
AliWarning( Form( "Attempt to set Invalid time bin range (Min , Max) = (%d, %d), Ingored", min, max ) );
}
UShort_t
AliCaloRawAnalyzer::Max(const UShort_t *data, const int length ) const
{
- //------------
+ // Get maximum of array
+
UShort_t tmpmax = data[0];
for(int i=0; i < length; i++)
void
-AliCaloRawAnalyzer::SelectSubarray( const Double_t *fData, const int length, const short maxindex, int *const first, int *const last ) const
+AliCaloRawAnalyzer::SelectSubarray( const Double_t *data, int length, short maxindex,
+ int * first, int * last, int cut) const
{
//Selection of subset of data from one bunch that will be used for fitting or
//Peak finding. Go to the left and right of index of the maximum time bin
//Until the ADC value is less that fFitArrayCut, or derivative changes sign (data jump)
int tmpfirst = maxindex;
int tmplast = maxindex;
- Double_t prevFirst = fData[maxindex];
- Double_t prevLast = fData[maxindex];
+ Double_t prevFirst = data[maxindex];
+ Double_t prevLast = data[maxindex];
bool firstJump = false;
bool lastJump = false;
- while( (tmpfirst >= 0) && (fData[tmpfirst] >= fFitArrayCut) && (!firstJump) )
+ while( (tmpfirst >= 0) && (data[tmpfirst] >= cut ) && (!firstJump) )
{
// jump check:
if (tmpfirst != maxindex) { // neighbor to maxindex can share peak with maxindex
- if (fData[tmpfirst] >= prevFirst) {
+ if ( data[tmpfirst] >= prevFirst) {
firstJump = true;
}
}
- prevFirst = fData[tmpfirst];
+ prevFirst = data[tmpfirst];
tmpfirst -- ;
}
- while( (tmplast < length) && (fData[tmplast] >= fFitArrayCut) && (!lastJump) )
+ while( (tmplast < length) && (data[tmplast] >= cut ) && (!lastJump) )
{
// jump check:
if (tmplast != maxindex) { // neighbor to maxindex can share peak with maxindex
- if (fData[tmplast] >= prevLast) {
+ if ( data[tmplast] >= prevLast) {
lastJump = true;
}
}
- prevLast = fData[tmplast];
+ prevLast = data[tmplast];
tmplast ++;
}
*first = tmpfirst;
*last = tmplast;
+
return;
}
Float_t
-AliCaloRawAnalyzer::ReverseAndSubtractPed( const AliCaloBunchInfo *bunch, const UInt_t /*altrocfg1*/, const UInt_t /*altrocfg2*/, double *outarray ) const
+AliCaloRawAnalyzer::ReverseAndSubtractPed( const AliCaloBunchInfo *bunch,
+ UInt_t /*altrocfg1*/, UInt_t /*altrocfg2*/,
+ double *outarray ) const
{
//Time sample comes in reversed order, revers them back
//Subtract the baseline based on content of altrocfg1 and altrocfg2.
+
Int_t length = bunch->GetLength();
const UShort_t *sig = bunch->GetData();
Float_t
-AliCaloRawAnalyzer::EvaluatePedestal(const UShort_t * const data, const int /*length*/ ) const
+AliCaloRawAnalyzer::EvaluatePedestal(const UShort_t * data, int /*length*/ ) const
{
- // double ped = 0;
+ // Pedestal evaluation if not zero suppressed
+
double tmp = 0;
if( fIsZerosupressed == false )
short
-AliCaloRawAnalyzer::Max( const AliCaloBunchInfo *const bunch , int *const maxindex ) const
+AliCaloRawAnalyzer::Max( const AliCaloBunchInfo * bunch , int * maxindex ) const
{
- //comment
+ // Get maximum in bunch array
+
short tmpmax = -1;
int tmpindex = -1;
const UShort_t *sig = bunch->GetData();
int
-AliCaloRawAnalyzer::SelectBunch( const vector<AliCaloBunchInfo> &bunchvector,short *const maxampbin, short *const maxamplitude ) const
+AliCaloRawAnalyzer::SelectBunch( const vector<AliCaloBunchInfo> &bunchvector,
+ short * maxampbin, short * maxamplitude )
{
//We select the bunch with the highest amplitude unless any time constraints is set
short max = -1;
for(unsigned int i=0; i < bunchvector.size(); i++ )
{
max = Max( &bunchvector.at(i), &indx ); // CRAP PTH, bug fix, trouble if more than one bunches
- if( IsInTimeRange( indx) )
+ if( IsInTimeRange( indx, fMaxTimeIndex, fMinTimeIndex) )
{
if( max > maxall )
{
bool
-AliCaloRawAnalyzer::IsInTimeRange( const int maxindex ) const
+AliCaloRawAnalyzer::IsInTimeRange( const int maxindex, const int maxtindx, const int mintindx ) const
{
// Ckeck if the index of the max ADC vaue is consistent with trigger.
- if( ( fMinTimeIndex < 0 && fMaxTimeIndex < 0) ||fMaxTimeIndex < 0 )
+ if( ( mintindx < 0 && maxtindx < 0) ||maxtindx < 0 )
{
return true;
}
- return ( maxindex < fMaxTimeIndex ) && ( maxindex > fMinTimeIndex ) ? true : false;
+ return ( maxindex < maxtindx ) && ( maxindex > mintindx ) ? true : false;
}
void
-AliCaloRawAnalyzer::PrintBunches( const vector<AliCaloBunchInfo> &bvctr ) const
+AliCaloRawAnalyzer::PrintBunches( const vector<AliCaloBunchInfo> &bvctr )
{
- //comment
+ // Print bunch vector info
cout << __FILE__ << __LINE__<< "*************** Printing Bunches *******************" << endl;
cout << __FILE__ << __LINE__<< "*** There are " << bvctr.size() << ", bunches" << endl;
void
-AliCaloRawAnalyzer::PrintBunch( const AliCaloBunchInfo &bunch ) const
+AliCaloRawAnalyzer::PrintBunch( const AliCaloBunchInfo &bunch )
{
- //comment
+ // Print bunch infor
cout << __FILE__ << ":" << __LINE__ << endl;
cout << __FILE__ << __LINE__ << ", startimebin = " << bunch.GetStartBin() << ", length =" << bunch.GetLength() << endl;
const UShort_t *sig = bunch.GetData();
Double_t
-AliCaloRawAnalyzer::CalculateChi2(const Double_t amp, const Double_t time,
- const Int_t first, const Int_t last,
- const Double_t adcErr,
- const Double_t tau)
+AliCaloRawAnalyzer::CalculateChi2( Double_t amp, Double_t time,
+ Int_t first, Int_t last,
+ Double_t adcErr, Double_t tau) const
{
// Input:
// amp - max amplitude;
void
-AliCaloRawAnalyzer::CalculateMeanAndRMS(const Int_t first, const Int_t last,
- Double_t & mean, Double_t & rms)
+AliCaloRawAnalyzer::CalculateMeanAndRMS(Int_t first, Int_t last,
+ Double_t & mean, Double_t & rms)
{
// Input:
// first, last - sample array indices to be used
-// AliCaloFitResults
-// AliCaloRawAnalyzer::Evaluate( const vector<AliCaloBunchInfo> &/*bunchvector*/, const UInt_t /*altrocfg1*/, const UInt_t /*altrocfg2*/)
-// { // method to do the selection of what should possibly be fitted
-// // not implemented for base class
-// cout << __FILE__ << ":" << __LINE__ << " " << endl;
-
-// return AliCaloFitResults( 0, 0 );
-// }
-
-
-
int
-AliCaloRawAnalyzer::PreFitEvaluateSamples( const vector<AliCaloBunchInfo> &bunchvector, const UInt_t altrocfg1, const UInt_t altrocfg2, Int_t & index, Float_t & maxf, short & maxamp, short & maxrev, Float_t & ped, int & first, int & last)
-{ // method to do the selection of what should possibly be fitted
+AliCaloRawAnalyzer::PreFitEvaluateSamples( const vector<AliCaloBunchInfo> &bunchvector,
+ UInt_t altrocfg1, UInt_t altrocfg2, Int_t & index,
+ Float_t & maxf, short & maxamp,
+ short & maxrev, Float_t & ped,
+ int & first, int & last, int acut )
+{
+ // method to do the selection of what should possibly be fitted
+
int nsamples = 0;
short maxampindex = 0;
index = SelectBunch( bunchvector, &maxampindex, &maxamp ); // select the bunch with the highest amplitude unless any time constraints is set
- if( index >= 0 && maxamp >= fAmpCut) // something valid was found, and non-zero amplitude
+ if( index >= 0 && maxamp >= acut ) // something valid was found, and non-zero amplitude
{
// use more convenient numbering and possibly subtract pedestal
ped = ReverseAndSubtractPed( &(bunchvector.at(index)), altrocfg1, altrocfg2, fReversed );
maxf = TMath::MaxElement( bunchvector.at(index).GetLength(), fReversed );
- if ( maxf >= fAmpCut ) // possibly significant signal
+ if ( maxf >= acut ) // possibly significant signal
{
// select array around max to possibly be used in fit
maxrev = maxampindex - bunchvector.at(index).GetStartBin();
- SelectSubarray( fReversed, bunchvector.at(index).GetLength(), maxrev, &first, &last);
+ SelectSubarray( fReversed, bunchvector.at(index).GetLength(), maxrev, &first, &last, acut );
// sanity check: maximum should not be in first or last bin
// if we should do a fit
- if (first!=maxrev && last!=maxrev) {
- // calculate how many samples we have
- nsamples = last - first + 1;
- }
+ if (first!=maxrev && last!=maxrev)
+ {
+ // calculate how many samples we have
+ nsamples = last - first + 1;
+ }
}
}