From 168c7b3cf21f0cf36791bbfd1988a02629508615 Mon Sep 17 00:00:00 2001 From: dsilverm Date: Mon, 20 Sep 2010 11:15:49 +0000 Subject: [PATCH] update from Per Thomas: \ Factoring out enumerators, such as fit-algorithms and return codes. \ to a common AliCaloConstants nested name-space. to make it more convenient \ too use the same constants for standalone tools as well as for the HLT, and too avoid \ having public enumerator class members in the RawAnalyzer classes. --- EMCAL/AliCaloConstants.h | 49 +++++++++++++ EMCAL/AliCaloFitResults.cxx | 35 ++++++---- EMCAL/AliCaloFitResults.h | 10 ++- EMCAL/AliCaloPeakFinderConstants.h | 11 --- EMCAL/AliCaloPeakFinderVectors.cxx | 15 ++-- EMCAL/AliCaloPeakFinderVectors.h | 19 ++--- EMCAL/AliCaloRawAnalyzer.cxx | 43 +++++++----- EMCAL/AliCaloRawAnalyzer.h | 19 +++-- EMCAL/AliCaloRawAnalyzerCrude.cxx | 13 ++-- EMCAL/AliCaloRawAnalyzerFakeALTRO.cxx | 17 ++--- EMCAL/AliCaloRawAnalyzerFastFit.cxx | 23 ++++-- EMCAL/AliCaloRawAnalyzerLMS.cxx | 33 +++++---- EMCAL/AliCaloRawAnalyzerNN.cxx | 23 +++--- EMCAL/AliCaloRawAnalyzerPeakFinder.cxx | 96 ++++++++++++++++++-------- EMCAL/AliCaloRawAnalyzerPeakFinder.h | 21 +++--- EMCAL/AliEMCALRawUtils.cxx | 49 +++++++------ EMCAL/AliEMCALRawUtils.h | 11 +-- EMCAL/libEMCALUtils.pkg | 2 +- 18 files changed, 306 insertions(+), 183 deletions(-) create mode 100644 EMCAL/AliCaloConstants.h delete mode 100644 EMCAL/AliCaloPeakFinderConstants.h diff --git a/EMCAL/AliCaloConstants.h b/EMCAL/AliCaloConstants.h new file mode 100644 index 00000000000..c5bd789db5c --- /dev/null +++ b/EMCAL/AliCaloConstants.h @@ -0,0 +1,49 @@ +// -*- mode: c++ -*- +#ifndef ALICALOCONSTANTS_H +#define ALICALOCONSTANTS_H + +/************************************************************************** + * This file is property of and copyright by * + * the Relativistic Heavy Ion Group (RHIG), Yale University, US, 2009 * + * * + * Primary Author: Per Thomas Hille * + * * + * Contributors are mentioned in the code where appropriate. * + * Please report bugs to perthomas.hille@yale.edu * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +namespace CaloConstants +{ + namespace FitAlgorithm + { + enum fitAlgorithm { kLMS = 0, kCrude = 1, kPeakFinder = 2, kNeuralNet = 3, kFastFit= 4, + kLogFit = 5, kStandard = 6, kNONE = 7}; + }; + + namespace ReturnCodes + { + enum kReturnCode {kFitPar=1, kDummy=-1, kCrude=-9, kNoFit=-99, kInvalid=-9999};// possible return values + }; + + namespace PeakFinderConstants + { + const int MAXSTART = 3; + const int SAMPLERANGE = 15; + }; +}; + + +//For easier notation +namespace Algo = CaloConstants::FitAlgorithm; +namespace Ret = CaloConstants::ReturnCodes; +namespace PF = CaloConstants::PeakFinderConstants; + +#endif diff --git a/EMCAL/AliCaloFitResults.cxx b/EMCAL/AliCaloFitResults.cxx index 9c3c4d0fe20..f2d37f5b728 100644 --- a/EMCAL/AliCaloFitResults.cxx +++ b/EMCAL/AliCaloFitResults.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 * @@ -16,8 +17,8 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ - #include "AliCaloFitResults.h" +#include "AliCaloConstants.h" AliCaloFitResults::AliCaloFitResults() : fMaxSig(-1), fPed(-1), @@ -48,7 +49,7 @@ AliCaloFitResults::AliCaloFitResults(const Int_t maxSig, const Float_t ped, const Short_t fitstatus, const Float_t amp, const Float_t time, const Int_t maxTimebin, const Float_t chi, const Int_t ndf, Int_t minSig, - const AliCaloFitSubarray fitSubarray) : + const AliCaloFitSubarray fitSubarray ) : fMaxSig(maxSig), fPed(ped), fStatus(fitstatus), @@ -60,6 +61,7 @@ AliCaloFitResults::AliCaloFitResults(const Int_t maxSig, const Float_t ped, fMinSig(minSig), fFitSubarray(fitSubarray) { + } @@ -76,8 +78,9 @@ AliCaloFitResults::AliCaloFitResults(const Int_t maxSig, const Float_t ped, fChi2Sig(chi), fNdfSig(ndf), fMinSig(minSig), - fFitSubarray(kDummy) + fFitSubarray(Ret::kDummy) { + } @@ -90,25 +93,27 @@ AliCaloFitResults::AliCaloFitResults(const Int_t maxSig, const Float_t ped, fAmpSig(amp), fTime(maxTimebin), fMaxTimebin(maxTimebin), - fChi2Sig( kNoFit ), - fNdfSig( kNoFit ), - fMinSig( kNoFit ), - fFitSubarray( kNoFit ) + fChi2Sig( Ret::kNoFit ), + fNdfSig( Ret::kNoFit ), + fMinSig( Ret::kNoFit ), + fFitSubarray( Ret::kNoFit ) { + } + AliCaloFitResults::AliCaloFitResults(const Int_t maxSig, const Int_t minSig) : fMaxSig(maxSig), - fPed( kInvalid ), - fStatus( kInvalid ), - fAmpSig( kInvalid ), - fTime( kInvalid ), - fMaxTimebin( kInvalid ), - fChi2Sig( kInvalid ), - fNdfSig( kInvalid), + fPed( Ret::kInvalid ), + fStatus( Ret::kInvalid ), + fAmpSig( Ret::kInvalid ), + fTime( Ret::kInvalid ), + fMaxTimebin( Ret::kInvalid ), + fChi2Sig( Ret::kInvalid ), + fNdfSig( Ret::kInvalid), fMinSig (minSig), - fFitSubarray(kInvalid) + fFitSubarray( Ret::kInvalid ) { } diff --git a/EMCAL/AliCaloFitResults.h b/EMCAL/AliCaloFitResults.h index 8e5faaa469a..1b5b683d733 100644 --- a/EMCAL/AliCaloFitResults.h +++ b/EMCAL/AliCaloFitResults.h @@ -21,6 +21,10 @@ #include "Rtypes.h" #include "AliCaloFitSubarray.h" +#include "AliCaloConstants.h" + +//using namespace CaloConstants::ReturnCodes; +// using CaloConstants::FitAlgorithm; // Container class to hold results from fitting // as well as other methods for @@ -28,7 +32,7 @@ class AliCaloFitResults { public: - enum kReturnCode {kFitPar=1, kDummy=-1, kCrude=-9, kNoFit=-99, kInvalid=-9999};// possible return values + // enum kReturnCode {kFitPar=1, kDummy=-1, kCrude=-9, kNoFit=-99, kInvalid=-9999};// possible return values // kFitPar: method fit or parametrization was used // kDummy: just a filler parameter, if e.g. chi2 not available // kCrude: maximum was used @@ -54,7 +58,9 @@ class AliCaloFitResults const Int_t maxTimebin, const Float_t chi, const Int_t ndf, - const Int_t minSig = kDummy); + const Int_t minSig = Ret::kDummy); + // const Int_t minSig = CaloConstants::ReturnCodes::kDummy); + // shorter interface when no fit is done explicit AliCaloFitResults( const Int_t maxSig, diff --git a/EMCAL/AliCaloPeakFinderConstants.h b/EMCAL/AliCaloPeakFinderConstants.h deleted file mode 100644 index 09687f634da..00000000000 --- a/EMCAL/AliCaloPeakFinderConstants.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef ALIPEAKFINDERCONSTANTS_H -#define ALIPEAKFINDERCONSTANTS_H - - -namespace PeakFinderConstants -{ - const int MAXSTART = 3; - const int SAMPLERANGE = 15; -} - -#endif diff --git a/EMCAL/AliCaloPeakFinderVectors.cxx b/EMCAL/AliCaloPeakFinderVectors.cxx index 4a4cad31b25..398c88f8b3e 100644 --- a/EMCAL/AliCaloPeakFinderVectors.cxx +++ b/EMCAL/AliCaloPeakFinderVectors.cxx @@ -1,3 +1,4 @@ +// -*- mode: c++ -*- /************************************************************************** * This file is property of and copyright by the Relativistic Heavy Ion * * Group (RHIG), Department of Physics Yale University, US, 2010 * @@ -45,11 +46,11 @@ void AliCaloPeakFinderVectors::ResetVectors() { // As implied by function name - for(int i=0; i < MAXSTART; i++ ) + for(int i=0; i < PF::MAXSTART; i++ ) { - for(int j=0; j < SAMPLERANGE; j++) + for(int j=0; j < PF::SAMPLERANGE; j++) { - if(i < MAXSTART && j < SAMPLERANGE ) + if(i < PF::MAXSTART && j < PF::SAMPLERANGE ) { for(int k = 0; k < 100; k++) { @@ -69,7 +70,7 @@ AliCaloPeakFinderVectors::SetVector(const int i, const int j, const Double_t *c const Double_t *const ac, const Double_t *const tc ) { // As implied by function name - if(i < MAXSTART && j < SAMPLERANGE ) + if(i < PF::MAXSTART && j < PF::SAMPLERANGE ) { for(int k = 0; k < 100; k++) { @@ -87,7 +88,7 @@ AliCaloPeakFinderVectors::GetVector(const int i, const int j, Double_t *const a, Double_t *const ac, Double_t *const tc ) const { // As implied by function name - if(i < MAXSTART && j < SAMPLERANGE ) + if(i < PF::MAXSTART && j < PF::SAMPLERANGE ) { for( int k = 0; k < 100; k++) { @@ -105,9 +106,9 @@ AliCaloPeakFinderVectors::PrintVectors() const { // As implied by function name cout << __FILE__ << __LINE__ << __FUNCTION__ << endl; - for(int i= 0; i < MAXSTART; i++ ) + for(int i= 0; i < PF::MAXSTART; i++ ) { - for(int j=0; j < SAMPLERANGE; j++ ) + for(int j=0; j < PF::SAMPLERANGE; j++ ) { for(int k=0; k < 10; k++ ) { diff --git a/EMCAL/AliCaloPeakFinderVectors.h b/EMCAL/AliCaloPeakFinderVectors.h index 9a086fbf2fc..cc83dedaa09 100644 --- a/EMCAL/AliCaloPeakFinderVectors.h +++ b/EMCAL/AliCaloPeakFinderVectors.h @@ -1,3 +1,4 @@ +// -*- mode: c++ -*- #ifndef ALICALOPEAKFINDERVECTORS_H #define ALICALOPEAKFINDERVECTORS_H @@ -21,8 +22,10 @@ //Container class for Peak Finder vectors #include "TObject.h" -#include "AliCaloPeakFinderConstants.h" -using namespace PeakFinderConstants; +//#include "AliCaloPeakFinderConstants.h" +//using namespace PeakFinderConstants; + +#include "AliCaloConstants.h" class AliCaloPeakFinderVector; @@ -41,12 +44,12 @@ class AliCaloPeakFinderVectors : public TObject void ResetVectors(); private: - Double_t fPFAmpVC[MAXSTART][SAMPLERANGE][100]; // Vectors for Amplitude extraction, first iteration - Double_t fPFTofVC[MAXSTART][SAMPLERANGE][100]; // Vectors for TOF extraction, first iteration - Double_t fPFAmpV[MAXSTART][SAMPLERANGE][100]; // Vectors for Amplitude extraction, second iteration - Double_t fPFTofV[MAXSTART][SAMPLERANGE][100]; // Vectors for TOF extraction, second iteration - - ClassDef( AliCaloPeakFinderVectors, 1 ) + Double_t fPFAmpVC[PF::MAXSTART][PF::SAMPLERANGE][100]; // Vectors for Amplitude extraction, first iteration + Double_t fPFTofVC[PF::MAXSTART][PF::SAMPLERANGE][100]; // Vectors for TOF extraction, first iteration + Double_t fPFAmpV[PF::MAXSTART][PF::SAMPLERANGE][100]; // Vectors for Amplitude extraction, second iteration + Double_t fPFTofV[PF::MAXSTART][PF::SAMPLERANGE][100]; // Vectors for TOF extraction, second iteration + + ClassDef( AliCaloPeakFinderVectors, 2 ) }; diff --git a/EMCAL/AliCaloRawAnalyzer.cxx b/EMCAL/AliCaloRawAnalyzer.cxx index cae7b21bf17..50bd8ff2b3c 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,15 +36,16 @@ using namespace std; ClassImp(AliCaloRawAnalyzer) AliCaloRawAnalyzer::AliCaloRawAnalyzer(const char *name, const char *nameshort) : TObject(), - fMinTimeIndex(-1), - fMaxTimeIndex(-1), - fFitArrayCut(5), - fAmpCut(4), - fNsampleCut(5), - fOverflowCut(950), - 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) { //Comment sprintf(fName, "%s", name); @@ -332,7 +334,7 @@ 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; @@ -372,8 +374,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 @@ -401,12 +403,17 @@ 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 ); -} + + +// 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 +// cout << __FILE__ << ":" << __LINE__ << " " << endl; + +// return AliCaloFitResults( 0, 0 ); +// } + int diff --git a/EMCAL/AliCaloRawAnalyzer.h b/EMCAL/AliCaloRawAnalyzer.h index 7791c590368..07cb88468cc 100644 --- a/EMCAL/AliCaloRawAnalyzer.h +++ b/EMCAL/AliCaloRawAnalyzer.h @@ -1,3 +1,4 @@ +// -*- mode: c++ -*- #ifndef ALICALORAWANALYZER_H #define ALICALORAWANALYZER_H /************************************************************************** @@ -23,13 +24,14 @@ //of signal amplitude and peak position //From CALO Calorimeter RAW data - #include "Rtypes.h" #include "TObject.h" - #define MAXSAMPLES 1008 //CRAP PTH - #include +#include "AliCaloConstants.h" + +//using namespace CaloConstants::FitAlgorithm; +//using CaloConstants::ReturnCodes; class AliCaloBunchInfo; class AliCaloFitResults; @@ -40,11 +42,11 @@ class AliCaloRawAnalyzer : public TObject AliCaloRawAnalyzer(const char *name="AliCaloRawAnalyzer", const char *nameshort="RawAna"); virtual ~AliCaloRawAnalyzer(); virtual AliCaloFitResults Evaluate( const std::vector &bunchvector, - const UInt_t altrocfg1, const UInt_t altrocfg2 ); - + const UInt_t altrocfg1, const UInt_t altrocfg2 ) = 0; + //enum fitAlgorithm {kCrude, kPeakFinder, kLMS, kFastFit, kNeuralNet, kNONE}; void PrintBunches( const std::vector &bunchvector ) const; void PrintBunch( const AliCaloBunchInfo &bunch ) const ; - + virtual int PreFitEvaluateSamples( const std::vector &bunchvector, const UInt_t altrocfg1, const UInt_t altrocfg2, Int_t & index, Float_t & maxf, short & maxamp, short & maxampindex, Float_t & ped, int & first, int & last); @@ -68,6 +70,7 @@ class AliCaloRawAnalyzer : public TObject Double_t GetReversed(const int i) const { return fReversed[i]; } const char * GetAlgoName() const { return fName; }; const char * GetAlgoAbbr() const { return fNameShort; }; + Algo::fitAlgorithm GetAlgo() const { return fAlgo; }; Double_t CalculateChi2(const Double_t amp, const Double_t time, const Int_t first, const Int_t last, @@ -102,7 +105,11 @@ class AliCaloRawAnalyzer : public TObject char fName[256]; // Name of the algorithm char fNameShort[256]; // Abbrevation for the name + + // CaloConstants fAlgo; + Algo::fitAlgorithm fAlgo; + ClassDef(AliCaloRawAnalyzer, 2) }; diff --git a/EMCAL/AliCaloRawAnalyzerCrude.cxx b/EMCAL/AliCaloRawAnalyzerCrude.cxx index 979b2e292e0..52e68f4340d 100644 --- a/EMCAL/AliCaloRawAnalyzerCrude.cxx +++ b/EMCAL/AliCaloRawAnalyzerCrude.cxx @@ -26,15 +26,16 @@ #include "AliCaloFitResults.h" #include "AliCaloBunchInfo.h" #include "TMath.h" - using namespace std; +#include "AliCaloConstants.h" + ClassImp(AliCaloRawAnalyzerCrude) AliCaloRawAnalyzerCrude::AliCaloRawAnalyzerCrude() : AliCaloRawAnalyzer("Crude", "Crude") { - + fAlgo=Algo::kCrude; } @@ -60,7 +61,7 @@ AliCaloRawAnalyzerCrude::Evaluate(const vector &bunchvector, c if( maxf < fAmpCut || ( maxamp - ped) > fOverflowCut ) // (maxamp - ped) > fOverflowCut = Close to saturation (use low gain then) { - return AliCaloFitResults( maxamp, ped, AliCaloFitResults::kCrude, maxf, timebinOffset); + return AliCaloFitResults( maxamp, ped, Ret::kCrude, maxf, timebinOffset); } else if ( maxf >= fAmpCut ) // no if statement needed really; keep for readability { @@ -71,12 +72,12 @@ AliCaloRawAnalyzerCrude::Evaluate(const vector &bunchvector, c Float_t chi2 = CalculateChi2(maxf, maxrev, first, last); Int_t ndf = last - first - 1; // nsamples - 2 - return AliCaloFitResults( maxamp, ped, AliCaloFitResults::kCrude, maxf, timebinOffset, - timebinOffset, chi2, ndf, AliCaloFitResults::kDummy, AliCaloFitSubarray(index, maxrev, first, last) ); + return AliCaloFitResults( maxamp, ped, Ret::kCrude, maxf, timebinOffset, + timebinOffset, chi2, ndf, Ret::kDummy, AliCaloFitSubarray(index, maxrev, first, last) ); } // ampcut } // bunch index - return AliCaloFitResults(AliCaloFitResults::kInvalid , AliCaloFitResults::kInvalid); + return AliCaloFitResults( Ret::kInvalid , Ret::kInvalid); } //end Crude diff --git a/EMCAL/AliCaloRawAnalyzerFakeALTRO.cxx b/EMCAL/AliCaloRawAnalyzerFakeALTRO.cxx index 2c14d409503..36a3c14c185 100644 --- a/EMCAL/AliCaloRawAnalyzerFakeALTRO.cxx +++ b/EMCAL/AliCaloRawAnalyzerFakeALTRO.cxx @@ -28,6 +28,7 @@ Author: R. GUERNANE LPSC Grenoble CNRS/IN2P3 #include #include "TF1.h" #include "TGraph.h" +#include "AliCaloConstants.h" using namespace std; @@ -85,7 +86,7 @@ AliCaloRawAnalyzerFakeALTRO::Evaluate( const vector &bunchvec short timebinOffset = maxampindex - (bunchvector.at(index).GetLength()-1); if( maxf < fAmpCut || ( maxamp - ped) > fOverflowCut ) // (maxamp - ped) > fOverflowCut = Close to saturation (use low gain then) { - return AliCaloFitResults( maxamp, ped, AliCaloFitResults::kCrude, maxf, timebinOffset); + return AliCaloFitResults( maxamp, ped, Ret::kCrude, maxf, timebinOffset); } else if ( maxf >= fAmpCut ) { @@ -118,8 +119,8 @@ AliCaloRawAnalyzerFakeALTRO::Evaluate( const vector &bunchvec } catch (const std::exception & e) { AliError( Form("TGraph Fit exception %s", e.what()) ); - return AliCaloFitResults( maxamp, ped, AliCaloFitResults::kNoFit, maxf, timebinOffset, - timebinOffset, AliCaloFitResults::kDummy, AliCaloFitResults::kDummy, AliCaloFitResults::kDummy, AliCaloFitSubarray(index, maxrev, first, last) ); + return AliCaloFitResults( maxamp, ped, Ret::kNoFit, maxf, timebinOffset, + timebinOffset, Ret::kDummy, Ret::kDummy, Ret::kDummy, AliCaloFitSubarray(index, maxrev, first, last) ); } if( fVerbose == true ) @@ -132,13 +133,13 @@ AliCaloRawAnalyzerFakeALTRO::Evaluate( const vector &bunchvec + fTf1->GetParameter(2); // +tau, makes sum tmax delete graph; - return AliCaloFitResults( maxamp, ped , AliCaloFitResults::kFitPar, + return AliCaloFitResults( maxamp, ped , Ret::kFitPar, fTf1->GetParameter(0)/fkEulerSquared, tmax, timebinOffset, fTf1->GetChisquare(), fTf1->GetNDF(), - AliCaloFitResults::kDummy, AliCaloFitSubarray(index, maxrev, first, last) ); + Ret::kDummy, AliCaloFitSubarray(index, maxrev, first, last) ); // delete graph; @@ -147,12 +148,12 @@ AliCaloRawAnalyzerFakeALTRO::Evaluate( const vector &bunchvec { Float_t chi2 = CalculateChi2(maxf, maxrev, first, last); Int_t ndf = last - first - 1; // nsamples - 2 - return AliCaloFitResults( maxamp, ped, AliCaloFitResults::kCrude, maxf, timebinOffset, - timebinOffset, chi2, ndf, AliCaloFitResults::kDummy, AliCaloFitSubarray(index, maxrev, first, last) ); + return AliCaloFitResults( maxamp, ped, Ret::kCrude, maxf, timebinOffset, + timebinOffset, chi2, ndf, Ret::kDummy, AliCaloFitSubarray(index, maxrev, first, last) ); } } // ampcut } - return AliCaloFitResults( AliCaloFitResults::kInvalid, AliCaloFitResults::kInvalid ); + return AliCaloFitResults( Ret::kInvalid, Ret::kInvalid ); } diff --git a/EMCAL/AliCaloRawAnalyzerFastFit.cxx b/EMCAL/AliCaloRawAnalyzerFastFit.cxx index 86d68d7af24..dd45f5cd9fc 100644 --- a/EMCAL/AliCaloRawAnalyzerFastFit.cxx +++ b/EMCAL/AliCaloRawAnalyzerFastFit.cxx @@ -1,3 +1,4 @@ +// -*- mode: c++ -*- /************************************************************************** * This file is property of and copyright by the Experimental Nuclear * * Physics Group, Dep. of Physics * @@ -30,13 +31,19 @@ #include "TMath.h" #include + using namespace std; +#include "AliCaloConstants.h" +//using namespace CaloConstants::FitAlgorithm; +//using namespace CaloConstants::ReturnCodes; + ClassImp( AliCaloRawAnalyzerFastFit ) AliCaloRawAnalyzerFastFit::AliCaloRawAnalyzerFastFit() : AliCaloRawAnalyzer("Fast Fit (Alexei)", "FF") { // Comment + fAlgo= Algo::kFastFit; for(int i=0; i < 1008; i++) { @@ -69,7 +76,7 @@ AliCaloRawAnalyzerFastFit::Evaluate( const vector &bunchvector if( maxf < fAmpCut || ( maxamp - ped) > fOverflowCut ) // (maxamp - ped) > fOverflowCut = Close to saturation (use low gain then) { - return AliCaloFitResults( maxamp, ped, AliCaloFitResults::kCrude, maxf, timebinOffset); + return AliCaloFitResults( maxamp, ped, Algo::kCrude, maxf, timebinOffset); } else if ( maxf >= fAmpCut ) // no if statement needed really; keep for readability { @@ -102,18 +109,22 @@ AliCaloRawAnalyzerFastFit::Evaluate( const vector &bunchvector Double_t dTimeMax = dTime0 + timebinOffset - (maxrev - first) // abs. t0 + dTau; // +tau, makes sum tmax - return AliCaloFitResults(maxamp, ped, AliCaloFitResults::kFitPar, dAmp, dTimeMax, timebinOffset, chi2, AliCaloFitResults::kDummy, - AliCaloFitResults::kDummy, AliCaloFitSubarray(index, maxrev, first, last) ); + return AliCaloFitResults(maxamp, ped, Ret::kFitPar, dAmp, dTimeMax, timebinOffset, chi2, Ret::kDummy, + Ret::kDummy, AliCaloFitSubarray(index, maxrev, first, last) ); } // samplecut else { Float_t chi2 = CalculateChi2(maxf, maxrev, first, last); Int_t ndf = last - first - 1; // nsamples - 2 - return AliCaloFitResults( maxamp, ped, AliCaloFitResults::kCrude, maxf, timebinOffset, - timebinOffset, chi2, ndf, AliCaloFitResults::kDummy, AliCaloFitSubarray(index, maxrev, first, last) ); + return AliCaloFitResults( maxamp, ped, Ret::kCrude, maxf, timebinOffset, + timebinOffset, chi2, ndf, Ret::kDummy, AliCaloFitSubarray(index, maxrev, first, last) ); } } // ampcut } // bunch index - return AliCaloFitResults(AliCaloFitResults::kInvalid , AliCaloFitResults::kInvalid); + return AliCaloFitResults( Ret::kInvalid , Ret::kInvalid ); + + // return AliCaloFitResults( kInvalid , kInvalid, + // kInvalid, kInvalid, kInvalid ); + } diff --git a/EMCAL/AliCaloRawAnalyzerLMS.cxx b/EMCAL/AliCaloRawAnalyzerLMS.cxx index e22017085dd..41263014760 100644 --- a/EMCAL/AliCaloRawAnalyzerLMS.cxx +++ b/EMCAL/AliCaloRawAnalyzerLMS.cxx @@ -48,6 +48,8 @@ AliCaloRawAnalyzerLMS::AliCaloRawAnalyzerLMS() : AliCaloRawAnalyzer("Chi Square fTau(2.35), fFixTau(kTRUE) { + + fAlgo = Algo::kLMS; //comment for(int i=0; i < MAXSAMPLES; i++) { @@ -55,14 +57,15 @@ AliCaloRawAnalyzerLMS::AliCaloRawAnalyzerLMS() : AliCaloRawAnalyzer("Chi Square } fTf1 = new TF1( "myformula", "[0]*((x - [1])/[2])^2*exp(-2*(x -[1])/[2])", 0, 30 ); - if (fFixTau) { + if (fFixTau) + { fTf1->FixParameter(2, fTau); - } - else { - fTf1->ReleaseParameter(2); // allow par. to vary - fTf1->SetParameter(2, fTau); - } - + } + else + { + fTf1->ReleaseParameter(2); // allow par. to vary + fTf1->SetParameter(2, fTau); + } } @@ -90,7 +93,7 @@ AliCaloRawAnalyzerLMS::Evaluate( const vector &bunchvector, c short timebinOffset = maxampindex - (bunchvector.at(index).GetLength()-1); if( maxf < fAmpCut || ( maxamp - ped) > fOverflowCut ) // (maxamp - ped) > fOverflowCut = Close to saturation (use low gain then) { - return AliCaloFitResults( maxamp, ped, AliCaloFitResults::kCrude, maxf, timebinOffset); + return AliCaloFitResults( maxamp, ped, Ret::kCrude, maxf, timebinOffset); } else if ( maxf >= fAmpCut ) { @@ -123,8 +126,8 @@ AliCaloRawAnalyzerLMS::Evaluate( const vector &bunchvector, c } catch (const std::exception & e) { AliError( Form("TGraph Fit exception %s", e.what()) ); - return AliCaloFitResults( maxamp, ped, AliCaloFitResults::kNoFit, maxf, timebinOffset, - timebinOffset, AliCaloFitResults::kDummy, AliCaloFitResults::kDummy, AliCaloFitResults::kDummy, AliCaloFitSubarray(index, maxrev, first, last) ); + return AliCaloFitResults( maxamp, ped, Ret::kNoFit, maxf, timebinOffset, + timebinOffset, Ret::kDummy, Ret::kDummy, Ret::kDummy, AliCaloFitSubarray(index, maxrev, first, last) ); } if( fVerbose == true ) @@ -137,13 +140,13 @@ AliCaloRawAnalyzerLMS::Evaluate( const vector &bunchvector, c + fTf1->GetParameter(2); // +tau, makes sum tmax delete graph; - return AliCaloFitResults( maxamp, ped , AliCaloFitResults::kFitPar, + return AliCaloFitResults( maxamp, ped , Ret::kFitPar, fTf1->GetParameter(0)/fkEulerSquared, tmax, timebinOffset, fTf1->GetChisquare(), fTf1->GetNDF(), - AliCaloFitResults::kDummy, AliCaloFitSubarray(index, maxrev, first, last) ); + Ret::kDummy, AliCaloFitSubarray(index, maxrev, first, last) ); // delete graph; @@ -152,12 +155,12 @@ AliCaloRawAnalyzerLMS::Evaluate( const vector &bunchvector, c { Float_t chi2 = CalculateChi2(maxf, maxrev, first, last); Int_t ndf = last - first - 1; // nsamples - 2 - return AliCaloFitResults( maxamp, ped, AliCaloFitResults::kCrude, maxf, timebinOffset, - timebinOffset, chi2, ndf, AliCaloFitResults::kDummy, AliCaloFitSubarray(index, maxrev, first, last) ); + return AliCaloFitResults( maxamp, ped, Ret::kCrude, maxf, timebinOffset, + timebinOffset, chi2, ndf, Ret::kDummy, AliCaloFitSubarray(index, maxrev, first, last) ); } } // ampcut } - return AliCaloFitResults( AliCaloFitResults::kInvalid, AliCaloFitResults::kInvalid ); + return AliCaloFitResults( Ret::kInvalid, Ret::kInvalid ); } diff --git a/EMCAL/AliCaloRawAnalyzerNN.cxx b/EMCAL/AliCaloRawAnalyzerNN.cxx index 606fe3634a2..96bc9e43b17 100644 --- a/EMCAL/AliCaloRawAnalyzerNN.cxx +++ b/EMCAL/AliCaloRawAnalyzerNN.cxx @@ -28,16 +28,17 @@ #include "AliCaloNeuralFit.h" #include "AliCaloFitResults.h" #include "AliCaloBunchInfo.h" - #include - using namespace std; +#include "AliCaloConstants.h" + ClassImp( AliCaloRawAnalyzerNN ) AliCaloRawAnalyzerNN::AliCaloRawAnalyzerNN() : AliCaloRawAnalyzer("Neural Network", "NN"), fNeuralNet(0) { // Comment + fAlgo=Algo::kNeuralNet; fNeuralNet = new AliCaloNeuralFit(); @@ -62,7 +63,7 @@ AliCaloRawAnalyzerNN::Evaluate( const vector &bunchvector, // The eveluation of Peak position and amplitude using the Neural Network if( bunchvector.size() <= 0 ) { - return AliCaloFitResults(AliCaloFitResults::kInvalid, AliCaloFitResults::kInvalid); + return AliCaloFitResults( Ret::kInvalid, Ret::kInvalid); } short maxampindex; @@ -72,7 +73,7 @@ AliCaloRawAnalyzerNN::Evaluate( const vector &bunchvector, if( index < 0 ) { - return AliCaloFitResults(AliCaloFitResults::kInvalid, AliCaloFitResults::kInvalid); + return AliCaloFitResults( Ret::kInvalid, Ret::kInvalid); } Float_t ped = ReverseAndSubtractPed( &(bunchvector.at( index ) ) , altrocfg1, altrocfg2, fReversed ); @@ -81,7 +82,7 @@ AliCaloRawAnalyzerNN::Evaluate( const vector &bunchvector, if( maxf < fAmpCut || ( maxamp - ped) > fOverflowCut ) // (maxamp - ped) > fOverflowCut = Close to saturation (use low gain then) { - return AliCaloFitResults( maxamp, ped, AliCaloFitResults::kCrude, maxf, timebinOffset); + return AliCaloFitResults( maxamp, ped, Ret::kCrude, maxf, timebinOffset); } int first = 0; @@ -97,8 +98,8 @@ AliCaloRawAnalyzerNN::Evaluate( const vector &bunchvector, { chi2 = CalculateChi2(maxf, maxrev, first, last); ndf = last - first - 1; // nsamples - 2 - return AliCaloFitResults( maxamp, ped, AliCaloFitResults::kCrude, maxf, timebinOffset, - timebinOffset, chi2, ndf, AliCaloFitResults::kDummy, AliCaloFitSubarray(index, maxrev, first, last) ); + return AliCaloFitResults( maxamp, ped, Ret::kCrude, maxf, timebinOffset, + timebinOffset, chi2, ndf, Ret::kDummy, AliCaloFitSubarray(index, maxrev, first, last) ); } else { @@ -115,15 +116,15 @@ AliCaloRawAnalyzerNN::Evaluate( const vector &bunchvector, // use local-array time for chi2 estimate chi2 = CalculateChi2(amp, tof-timebinOffset+maxrev, first, last); ndf = last - first - 1; // nsamples - 2 - return AliCaloFitResults( maxamp, ped , AliCaloFitResults::kFitPar, amp , tof, timebinOffset, chi2, ndf, - AliCaloFitResults::kDummy, AliCaloFitSubarray(index, maxrev, first, last) ); + return AliCaloFitResults( maxamp, ped , Ret::kFitPar, amp , tof, timebinOffset, chi2, ndf, + Ret::kDummy, AliCaloFitSubarray(index, maxrev, first, last) ); } } chi2 = CalculateChi2(maxf, maxrev, first, last); ndf = last - first - 1; // nsamples - 2 - return AliCaloFitResults( maxamp, ped, AliCaloFitResults::kCrude, maxf, timebinOffset, - timebinOffset, chi2, ndf, AliCaloFitResults::kDummy, AliCaloFitSubarray(index, maxrev, first, last) ); + return AliCaloFitResults( maxamp, ped, Ret::kCrude, maxf, timebinOffset, + timebinOffset, chi2, ndf, Ret::kDummy, AliCaloFitSubarray(index, maxrev, first, last) ); } diff --git a/EMCAL/AliCaloRawAnalyzerPeakFinder.cxx b/EMCAL/AliCaloRawAnalyzerPeakFinder.cxx index bcc34f42d2b..02ebbe38b29 100644 --- a/EMCAL/AliCaloRawAnalyzerPeakFinder.cxx +++ b/EMCAL/AliCaloRawAnalyzerPeakFinder.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 * @@ -16,7 +17,6 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ - // The Peak-Finder algorithm // The amplitude is extracted as a // weighted sum of the samples using the @@ -35,7 +35,7 @@ #include "AliCDBManager.h" #include "TFile.h" #include "AliCaloPeakFinderVectors.h" - +#include using namespace std; @@ -45,9 +45,11 @@ ClassImp( AliCaloRawAnalyzerPeakFinder ) AliCaloRawAnalyzerPeakFinder::AliCaloRawAnalyzerPeakFinder() :AliCaloRawAnalyzer("Peak-Finder", "PF"), fAmp(0), fPeakFinderVectors(0), - fRunOnAlien(false) + fRunOnAlien(false), + fIsInitialized(false) { //Comment + fAlgo= Algo::kPeakFinder; InitOCDB(fRunOnAlien); fPeakFinderVectors = new AliCaloPeakFinderVectors() ; ResetVectors(); @@ -68,9 +70,9 @@ void AliCaloRawAnalyzerPeakFinder::ResetVectors() { //As name implies - for(int i=0; i < MAXSTART; i++) + for(int i=0; i < PF::MAXSTART; i++) { - for(int j=0; j < SAMPLERANGE; j++ ) + for(int j=0; j < PF::SAMPLERANGE; j++ ) { for(int k=0; k < 100; k++ ) { @@ -90,7 +92,6 @@ AliCaloRawAnalyzerPeakFinder::~AliCaloRawAnalyzerPeakFinder() } - Double_t AliCaloRawAnalyzerPeakFinder::ScanCoarse(const Double_t *const array, const int length ) const { @@ -115,6 +116,12 @@ AliCaloRawAnalyzerPeakFinder::ScanCoarse(const Double_t *const array, const int AliCaloFitResults AliCaloRawAnalyzerPeakFinder::Evaluate( const vector &bunchvector, const UInt_t altrocfg1, const UInt_t altrocfg2 ) { + if( fIsInitialized == false ) + { + cout << __FILE__ << ":" << __LINE__ << "ERROR, peakfinder vectors not loaded" << endl; + return AliCaloFitResults(kInvalid, kInvalid); + } + // Extracting the amplitude using the Peak-Finder algorithm // The amplitude is a weighted sum of the samples using // optimum weights. @@ -123,16 +130,16 @@ AliCaloRawAnalyzerPeakFinder::Evaluate( const vector &bunchvec short maxamp; //Maximum amplitude fAmp = 0; int index = SelectBunch( bunchvector, &maxampindex, &maxamp ); - + if( index >= 0) { Float_t ped = ReverseAndSubtractPed( &(bunchvector.at(index)) , altrocfg1, altrocfg2, fReversed ); Float_t maxf = TMath::MaxElement( bunchvector.at(index).GetLength(), fReversed ); short timebinOffset = maxampindex - (bunchvector.at( index ).GetLength()-1); - + if( maxf < fAmpCut || ( maxamp - ped) > fOverflowCut ) // (maxamp - ped) > fOverflowCut = Close to saturation (use low gain then) { - return AliCaloFitResults( maxamp, ped, AliCaloFitResults::kCrude, maxf, timebinOffset); + return AliCaloFitResults( maxamp, ped, Ret::kCrude, maxf, timebinOffset); } else if ( maxf >= fAmpCut ) { @@ -147,11 +154,12 @@ AliCaloRawAnalyzerPeakFinder::Evaluate( const vector &bunchvec int startbin = bunchvector.at(index).GetStartBin(); int n = last - first; int pfindex = n - fNsampleCut; - pfindex = pfindex > SAMPLERANGE ? SAMPLERANGE : pfindex; + pfindex = pfindex > PF::SAMPLERANGE ? PF::SAMPLERANGE : pfindex; int dt = maxampindex - startbin -2; int tmpindex = 0; + Float_t tmptof = ScanCoarse( &fReversed[dt] , n ); if( tmptof < -1 ) @@ -169,13 +177,13 @@ AliCaloRawAnalyzerPeakFinder::Evaluate( const vector &bunchvec } double tof = 0; - - for(int k=0; k < SAMPLERANGE; k++ ) + + for(int k=0; k < PF::SAMPLERANGE; k++ ) { tof += fPFTofVectors[0][pfindex][k]*fReversed[ dt +k + tmpindex -1 ]; } - for( int i=0; i < SAMPLERANGE; i++ ) + for( int i=0; i < PF::SAMPLERANGE; i++ ) { { fAmp += fPFAmpVectors[0][pfindex][i]*fReversed[ dt +i +tmpindex -1 ]; @@ -183,44 +191,44 @@ AliCaloRawAnalyzerPeakFinder::Evaluate( const vector &bunchvec } if( TMath::Abs( (maxf - fAmp )/maxf ) > 0.1 ) { + // cout << __FILE__ << ":" << __LINE__ << "WARNING: amp was" << fAmp <<", but was changed to "<< maxf << endl; fAmp = maxf; } tof = timebinOffset - 0.01*tof/fAmp; // clock ticks - // use local-array time for chi2 estimate Float_t chi2 = CalculateChi2(fAmp, tof-timebinOffset+maxrev, first, last); Int_t ndf = last - first - 1; // nsamples - 2 - return AliCaloFitResults( maxamp, ped , AliCaloFitResults::kFitPar, fAmp, tof, + return AliCaloFitResults( maxamp, ped , Ret::kFitPar, fAmp, tof, timebinOffset, chi2, ndf, - AliCaloFitResults::kDummy, AliCaloFitSubarray(index, maxrev, first, last) ); + Ret::kDummy, AliCaloFitSubarray(index, maxrev, first, last) ); } else { Float_t chi2 = CalculateChi2(maxf, maxrev, first, last); Int_t ndf = last - first - 1; // nsamples - 2 - return AliCaloFitResults( maxamp, ped , AliCaloFitResults::kCrude, maxf, timebinOffset, - timebinOffset, chi2, ndf, AliCaloFitResults::kDummy, AliCaloFitSubarray(index, maxrev, first, last) ); + return AliCaloFitResults( maxamp, ped , Ret::kCrude, maxf, timebinOffset, + timebinOffset, chi2, ndf, Ret::kDummy, AliCaloFitSubarray(index, maxrev, first, last) ); } } // ampcut } - return AliCaloFitResults(AliCaloFitResults::kInvalid, AliCaloFitResults::kInvalid); + return AliCaloFitResults(kInvalid, kInvalid); } void -AliCaloRawAnalyzerPeakFinder::CopyVectors(const AliCaloPeakFinderVectors *const pfv ) +AliCaloRawAnalyzerPeakFinder::CopyVectors( const AliCaloPeakFinderVectors *const pfv ) { // As name implies - if ( pfv != 0) { - for(int i = 0; i < MAXSTART ; i++) + for(int i = 0; i < PF::MAXSTART ; i++) { - for( int j=0; j < SAMPLERANGE; j++) + for( int j=0; j < PF::SAMPLERANGE; j++) { pfv->GetVector( i, j, fPFAmpVectors[i][j] , fPFTofVectors[i][j], fPFAmpVectorsCoarse[i][j] , fPFTofVectorsCoarse[i][j] ); + fPeakFinderVectors->SetVector( i, j, fPFAmpVectors[i][j], fPFTofVectors[i][j], fPFAmpVectorsCoarse[i][j], fPFTofVectorsCoarse[i][j] ); } @@ -233,19 +241,30 @@ AliCaloRawAnalyzerPeakFinder::CopyVectors(const AliCaloPeakFinderVectors *const } - void AliCaloRawAnalyzerPeakFinder::LoadVectorsOCDB() { //Loading of Peak-Finder vectors from the //Offline Condition Database (OCDB) AliCDBEntry* entry = AliCDBManager::Instance()->Get("EMCAL/Calib/PeakFinder/"); - + cout << __FILE__ << ":" << __LINE__ << ": Printing metadata !! " << endl; + entry->PrintMetaData(); + if( entry != 0 ) { AliCaloPeakFinderVectors *pfv = (AliCaloPeakFinderVectors *)entry->GetObject(); + if( pfv == 0 ) + { + cout << __FILE__ << ":" << __LINE__ << "_ ERRROR " << endl; + } + CopyVectors( pfv ); - } + + if( pfv != 0 ) + { + fIsInitialized = true; + } + } } @@ -253,9 +272,11 @@ void AliCaloRawAnalyzerPeakFinder::LoadVectorsASCII() { //Read in the Peak finder vecors from ASCI files - for(int i = 0; i < MAXSTART ; i++) + fIsInitialized= true; + + for(int i = 0; i < PF::MAXSTART ; i++) { - for( int j=0; j < SAMPLERANGE; j++) + for( int j=0; j < PF::SAMPLERANGE; j++) { char filenameCoarse[256]; char filename[256]; @@ -272,7 +293,6 @@ AliCaloRawAnalyzerPeakFinder::LoadVectorsASCII() { AliFatal( Form( "could not open file: %s", filename ) ); } - if(fpc == 0) { AliFatal( Form( "could not open file: %s", filenameCoarse ) ); @@ -314,3 +334,21 @@ AliCaloRawAnalyzerPeakFinder::WriteRootFile() const f->Close(); delete f; } + + +void +AliCaloRawAnalyzerPeakFinder::PrintVectors() +{ + for(int i=0; i < 20; i++) + { + for( int j = 0; j < PF::MAXSTART; j ++ ) + { + for( int k=0; k < PF::SAMPLERANGE; k++ ) + { + cout << fPFAmpVectors[j][k][i] << "\t" ; + } + } + cout << endl; + } + cout << __FILE__ << ":" << __LINE__ << ":.... DONE !!" << endl; +} diff --git a/EMCAL/AliCaloRawAnalyzerPeakFinder.h b/EMCAL/AliCaloRawAnalyzerPeakFinder.h index 616fdaa40ad..3f3fe4c1644 100644 --- a/EMCAL/AliCaloRawAnalyzerPeakFinder.h +++ b/EMCAL/AliCaloRawAnalyzerPeakFinder.h @@ -1,7 +1,6 @@ +// -*- mode: c++ -*- #ifndef ALICALORAWANALYZERPEAKFINDER_H #define ALICALORAWANALYZERPEAKFINDER_H - - /************************************************************************** * This file is property of and copyright by * * the Relativistic Heavy Ion Group (RHIG), Yale University, US, 2009 * @@ -26,14 +25,11 @@ // best possible weights. #include "AliCaloRawAnalyzer.h" -#include "AliCaloPeakFinderConstants.h" - -using namespace PeakFinderConstants; +#include "AliCaloConstants.h" class AliCaloBunchInfo; class AliCaloPeakFinderVectors; - class AliCaloRawAnalyzerPeakFinder : public AliCaloRawAnalyzer { public: @@ -51,17 +47,16 @@ class AliCaloRawAnalyzerPeakFinder : public AliCaloRawAnalyzer void ResetVectors(); void InitOCDB(bool alien) const; void WriteRootFile() const; + void PrintVectors(); Double_t ScanCoarse(const Double_t *const array, const int length ) const ; // Find a rough estimate of peak position and t0 - - Double_t fPFAmpVectorsCoarse[MAXSTART][SAMPLERANGE][100]; // Vectors for Amplitude extraction, first iteration - Double_t fPFTofVectorsCoarse[MAXSTART][SAMPLERANGE][100]; // Vectors for TOF extraction, first iteration - Double_t fPFAmpVectors[MAXSTART][SAMPLERANGE][100]; // Vectors for Amplitude extraction, second iteration - Double_t fPFTofVectors[MAXSTART][SAMPLERANGE][100]; // Vectors for TOF extraction, second iteration + Double_t fPFAmpVectorsCoarse[PF::MAXSTART][PF::SAMPLERANGE][100]; // Vectors for Amplitude extraction, first iteration + Double_t fPFTofVectorsCoarse[PF::MAXSTART][PF::SAMPLERANGE][100]; // Vectors for TOF extraction, first iteration + Double_t fPFAmpVectors[PF::MAXSTART][PF::SAMPLERANGE][100]; // Vectors for Amplitude extraction, second iteration + Double_t fPFTofVectors[PF::MAXSTART][PF::SAMPLERANGE][100]; // Vectors for TOF extraction, second iteration Double_t fAmp; // The amplitude in entities of ADC counts AliCaloPeakFinderVectors *fPeakFinderVectors; // Collection of Peak-Fincer vectors - bool fRunOnAlien; // Wether or not we are running on the GRID - + bool fIsInitialized; ClassDef( AliCaloRawAnalyzerPeakFinder, 1 ) }; diff --git a/EMCAL/AliEMCALRawUtils.cxx b/EMCAL/AliEMCALRawUtils.cxx index 6a49c3f7821..5e52a6a792f 100644 --- a/EMCAL/AliEMCALRawUtils.cxx +++ b/EMCAL/AliEMCALRawUtils.cxx @@ -1,3 +1,4 @@ +// -*- mode: c++ -*- /************************************************************************** * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * * @@ -78,7 +79,7 @@ Int_t AliEMCALRawUtils::fgDDLPerSuperModule = 2; // 2 ddls per SuperModule Int_t AliEMCALRawUtils::fgPedestalValue = 0; // pedestal value for digits2raw, default generate ZS data Double_t AliEMCALRawUtils::fgFEENoise = 3.; // 3 ADC channels of noise (sampled) -AliEMCALRawUtils::AliEMCALRawUtils(fitAlgorithm fitAlgo) +AliEMCALRawUtils::AliEMCALRawUtils( Algo::fitAlgorithm fitAlgo) : fHighLowGainFactor(0.), fOrder(0), fTau(0.), fNoiseThreshold(0), fNPedSamples(0), fGeom(0), fOption(""), fRemoveBadChannels(kTRUE),fFittingAlgorithm(0), @@ -130,7 +131,7 @@ AliEMCALRawUtils::AliEMCALRawUtils(fitAlgorithm fitAlgo) } //____________________________________________________________________________ -AliEMCALRawUtils::AliEMCALRawUtils(AliEMCALGeometry *pGeometry, fitAlgorithm fitAlgo) +AliEMCALRawUtils::AliEMCALRawUtils(AliEMCALGeometry *pGeometry, Algo::fitAlgorithm fitAlgo) : fHighLowGainFactor(0.), fOrder(0), fTau(0.), fNoiseThreshold(0), fNPedSamples(0), fGeom(pGeometry), fOption(""), fRemoveBadChannels(kTRUE),fFittingAlgorithm(0), @@ -404,18 +405,19 @@ void AliEMCALRawUtils::Raw2Digits(AliRawReader* reader,TClonesArray *digitsArr, bunchlist.push_back( AliCaloBunchInfo(in.GetStartTimeBin(), in.GetBunchLength(), in.GetSignals() ) ); } // loop over bunches - - if ( caloFlag < 2 ){ // ALTRO - - Float_t time = 0; - Float_t amp = 0; - short timeEstimate = 0; - Float_t ampEstimate = 0; - Bool_t fitDone = kFALSE; - Float_t chi2 = 0; - Int_t ndf = 0; - - if ( fFittingAlgorithm == kFastFit || fFittingAlgorithm == kNeuralNet || fFittingAlgorithm == kLMS || fFittingAlgorithm == kPeakFinder || fFittingAlgorithm == kCrude) { + if ( caloFlag < 2 ) + { // ALTRO + Float_t time = 0; + Float_t amp = 0; + short timeEstimate = 0; + Float_t ampEstimate = 0; + Bool_t fitDone = kFALSE; + Float_t chi2 = 0; + Int_t ndf = 0; + + if ( fFittingAlgorithm == Algo::kFastFit || fFittingAlgorithm == Algo::kNeuralNet || + fFittingAlgorithm == Algo::kLMS || fFittingAlgorithm == Algo::kPeakFinder || + fFittingAlgorithm == Algo::kCrude) { // all functionality to determine amp and time etc is encapsulated inside the Evaluate call for these methods AliCaloFitResults fitResults = fRawAnalyzer->Evaluate( bunchlist, in.GetAltroCFG1(), in.GetAltroCFG2()); @@ -425,7 +427,7 @@ void AliEMCALRawUtils::Raw2Digits(AliRawReader* reader,TClonesArray *digitsArr, ampEstimate = fitResults.GetMaxSig(); chi2 = fitResults.GetChi2(); ndf = fitResults.GetNdf(); - if (fitResults.GetStatus() == AliCaloFitResults::kFitPar) { + if (fitResults.GetStatus() == Ret::kFitPar) { fitDone = kTRUE; } } @@ -610,7 +612,7 @@ void AliEMCALRawUtils::FitRaw(const Int_t firstTimeBin, const Int_t lastTimeBin, fitDone = kFALSE; switch(fFittingAlgorithm) { - case kStandard: + case Algo::kStandard: { if (nsamples < 3) { return; } // nothing much to fit //printf("Standard fitter \n"); @@ -655,7 +657,7 @@ void AliEMCALRawUtils::FitRaw(const Int_t firstTimeBin, const Int_t lastTimeBin, break; }//kStandard Fitter //---------------------------- - case kLogFit: + case Algo::kLogFit: { if (nsamples < 3) { return; } // nothing much to fit //printf("LogFit \n"); @@ -935,23 +937,24 @@ void AliEMCALRawUtils::SetFittingAlgorithm(Int_t fitAlgo) fFittingAlgorithm = fitAlgo; if (fRawAnalyzer) delete fRawAnalyzer; // delete prev. analyzer if existed. - if (fitAlgo == kFastFit) { + if (fitAlgo == Algo::kFastFit) { fRawAnalyzer = new AliCaloRawAnalyzerFastFit(); } - else if (fitAlgo == kNeuralNet) { + else if (fitAlgo == Algo::kNeuralNet) { fRawAnalyzer = new AliCaloRawAnalyzerNN(); } - else if (fitAlgo == kLMS) { + else if (fitAlgo == Algo::kLMS) { fRawAnalyzer = new AliCaloRawAnalyzerLMS(); } - else if (fitAlgo == kPeakFinder) { + else if (fitAlgo == Algo::kPeakFinder) { fRawAnalyzer = new AliCaloRawAnalyzerPeakFinder(); } - else if (fitAlgo == kCrude) { + else if (fitAlgo == Algo::kCrude) { fRawAnalyzer = new AliCaloRawAnalyzerCrude(); } else { - fRawAnalyzer = new AliCaloRawAnalyzer(); + // fRawAnalyzer = new AliCaloRawAnalyzer(); + fRawAnalyzer = 0; } } diff --git a/EMCAL/AliEMCALRawUtils.h b/EMCAL/AliEMCALRawUtils.h index 61bfe68e823..874526eb6b6 100644 --- a/EMCAL/AliEMCALRawUtils.h +++ b/EMCAL/AliEMCALRawUtils.h @@ -1,3 +1,4 @@ +// -*- mode: c++ -*- #ifndef ALIEMCALRAWUTILS_H #define ALIEMCALRAWUTILS_H /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * @@ -19,7 +20,8 @@ // #include "TObject.h" // for ROOT types #include -//#include "AliCaloRawStreamV3.h" + + class AliCaloRawStreamV3; class AliAltroMapping; class TGraph; @@ -29,13 +31,14 @@ class AliCaloCalibPedestal; class AliCaloRawAnalyzer; class AliEMCALTriggerRawDigitMaker; class AliEMCALTriggerData; +#include "AliCaloConstants.h" class AliEMCALRawUtils : public TObject { public: - enum fitAlgorithm {kStandard = 0, kFastFit= 1, kNeuralNet = 2, kLogFit = 3, kLMS = 4, kPeakFinder = 5, kCrude = 6}; + // enum fitAlgorithm {kStandard = 0, kFastFit= 1, kNeuralNet = 2, kLogFit = 3, kLMS = 4, kPeakFinder = 5, kCrude = 6}; - AliEMCALRawUtils(fitAlgorithm fitAlgo = kStandard); - AliEMCALRawUtils(AliEMCALGeometry *pGeometry, fitAlgorithm fitAlgo = kStandard); + AliEMCALRawUtils(Algo::fitAlgorithm fitAlgo = Algo::kStandard); + AliEMCALRawUtils(AliEMCALGeometry *pGeometry, Algo::fitAlgorithm fitAlgo = Algo::kStandard); virtual ~AliEMCALRawUtils(); AliEMCALRawUtils(const AliEMCALRawUtils& rawUtils); //copy ctor diff --git a/EMCAL/libEMCALUtils.pkg b/EMCAL/libEMCALUtils.pkg index 9708a501a95..0f278729f6f 100644 --- a/EMCAL/libEMCALUtils.pkg +++ b/EMCAL/libEMCALUtils.pkg @@ -18,7 +18,7 @@ AliCaloRawAnalyzerNN.cxx \ AliCaloPeakFinderVectors.cxx \ AliEMCALHistoUtilities.cxx -HDRS:= $(SRCS:.cxx=.h) AliCaloPeakFinderConstants.h +HDRS:= $(SRCS:.cxx=.h) DHDR= EMCALUtilsLinkDef.h -- 2.43.0