X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=EMCAL%2FAliCaloRawAnalyzer.cxx;h=bdec18b523c47ffd4c60f83b5a787fb5d2892cd4;hb=3002fb0e7f349c159434a4a9a26cd45c31d95d91;hp=6ce22c5bec73aad7b400c42de2d7af9b865e07b9;hpb=947c8e28ae00737bbcf18a4d27247c97bcd06715;p=u%2Fmrichter%2FAliRoot.git diff --git a/EMCAL/AliCaloRawAnalyzer.cxx b/EMCAL/AliCaloRawAnalyzer.cxx index 6ce22c5bec7..bdec18b523c 100644 --- a/EMCAL/AliCaloRawAnalyzer.cxx +++ b/EMCAL/AliCaloRawAnalyzer.cxx @@ -1,3 +1,4 @@ +// -*- mode: c++ -*- /************************************************************************** * This file is property of and copyright by * * the Relativistic Heavy Ion Group (RHIG), Yale University, US, 2009 * @@ -35,20 +36,28 @@ using namespace std; ClassImp(AliCaloRawAnalyzer) AliCaloRawAnalyzer::AliCaloRawAnalyzer(const char *name, const char *nameshort) : TObject(), - fMinTimeIndex(-1), - fMaxTimeIndex(-1), - fFitArrayCut(5), - fAmpCut(4), - fNsampleCut(5), - fNsamplePed(3), - fIsZerosupressed( false ), - fVerbose( false ) + fMinTimeIndex(-1), + fMaxTimeIndex(-1), + fFitArrayCut(5), + fAmpCut(4), + fNsampleCut(5), + fOverflowCut(950), + fNsamplePed(3), + fIsZerosupressed( false ), + fVerbose( false ), + fAlgo(Algo::kNONE), + fL1Phase(0), + fAmp(0), + fTof(0), + fTau( EMCAL::TAU ) { //Comment - sprintf(fName, "%s", name); - sprintf(fNameShort, "%s", nameshort); - - for(int i=0; i < MAXSAMPLES; i++ ) + snprintf(fName, 256,"%s", name); + snprintf(fNameShort,256, "%s", nameshort); + // sprintf(fName ,"%s", name); + // sprintf(fNameShort, "%s", nameshort); + + for(int i=0; i < ALTROMAXSAMPLES; i++ ) { fReversed[i] = 0; } @@ -64,7 +73,7 @@ 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 ) ); } @@ -94,39 +103,39 @@ AliCaloRawAnalyzer::Max(const UShort_t *data, const int length ) const 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, const int length, const short maxindex,int *const first, int *const last, const 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 ++; } @@ -235,7 +244,7 @@ AliCaloRawAnalyzer::CheckBunchEdgesForMax( const AliCaloBunchInfo *const bunch ) int -AliCaloRawAnalyzer::SelectBunch( const vector &bunchvector,short *const maxampbin, short *const maxamplitude ) const +AliCaloRawAnalyzer::SelectBunch( const vector &bunchvector, short *const maxampbin, short *const maxamplitude ) { //We select the bunch with the highest amplitude unless any time constraints is set short max = -1; @@ -246,7 +255,7 @@ AliCaloRawAnalyzer::SelectBunch( const vector &bunchvector,sho 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 ) { @@ -270,19 +279,19 @@ AliCaloRawAnalyzer::SelectBunch( const vector &bunchvector,sho 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 &bvctr ) const +AliCaloRawAnalyzer::PrintBunches( const vector &bvctr ) { //comment cout << __FILE__ << __LINE__<< "*************** Printing Bunches *******************" << endl; @@ -298,7 +307,7 @@ AliCaloRawAnalyzer::PrintBunches( const vector &bvctr ) const void -AliCaloRawAnalyzer::PrintBunch( const AliCaloBunchInfo &bunch ) const +AliCaloRawAnalyzer::PrintBunch( const AliCaloBunchInfo &bunch ) { //comment cout << __FILE__ << ":" << __LINE__ << endl; @@ -317,7 +326,7 @@ 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) + const Double_t tau) const { // Input: // amp - max amplitude; @@ -331,11 +340,11 @@ AliCaloRawAnalyzer::CalculateChi2(const Double_t amp, const Double_t time, if (first == last || first<0 ) { // signal consists of single sample, chi2 estimate (0) not too well defined.. // or, first is negative, the indices are not valid - return AliCaloFitResults::kDummy; + return Ret::kDummy; } int nsamples = last - first + 1; - // printf(" AliCaloRawAnalyzer::CalculateChi2 : first %i last %i : nsamples %i \n", first, last, nsamples); + // printf(" AliCaloRawAnalyzer::CalculateChi2 : first %i last %i : nsamples %i : amp %3.2f time %3.2f \n", first, last, nsamples, amp, time); Int_t x = 0; Double_t chi2 = 0; @@ -350,7 +359,7 @@ AliCaloRawAnalyzer::CalculateChi2(const Double_t amp, const Double_t time, } dy = fReversed[x] - f; chi2 += dy*dy; - // printf(" AliCaloRawAnalyzer::CalculateChi2 : %i : y %f -> f %f : dy %f \n", i, fReversed[first+i], f, dy); + // printf(" AliCaloRawAnalyzer::CalculateChi2 : %i : y %f -> f %f : dy %f \n", i, fReversed[first+i], f, dy); } if (adcErr>0.0) { // weight chi2 @@ -371,8 +380,8 @@ AliCaloRawAnalyzer::CalculateMeanAndRMS(const Int_t first, const Int_t last, // // To possibly be used to differentiate good signals from bad before fitting // - mean = AliCaloFitResults::kDummy; - rms = AliCaloFitResults::kDummy; + mean = Ret::kDummy; + rms = Ret::kDummy; if (first == last || first<0 ) { // signal consists of single sample, chi2 estimate (0) not too well defined.. // or, first is negative, the indices are not valid @@ -400,40 +409,37 @@ AliCaloRawAnalyzer::CalculateMeanAndRMS(const Int_t first, const Int_t last, return; } -AliCaloFitResults -AliCaloRawAnalyzer::Evaluate( const vector &/*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 - return AliCaloFitResults( 0, 0 ); -} int -AliCaloRawAnalyzer::PreFitEvaluateSamples( const vector &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) +AliCaloRawAnalyzer::PreFitEvaluateSamples( const vector &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,const 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; + } } }