From 57839add729de273b3f0b5a2c75f94eda52dc4e4 Mon Sep 17 00:00:00 2001 From: dsilverm Date: Mon, 25 Jan 2010 03:29:24 +0000 Subject: [PATCH] update from Per Thomas - mainly renaming classes --- ...MCALBunchInfo.cxx => AliCaloBunchInfo.cxx} | 12 +-- ...AliEMCALBunchInfo.h => AliCaloBunchInfo.h} | 16 +-- ...ALFitResults.cxx => AliCaloFitResults.cxx} | 10 +- ...iEMCALFitResults.h => AliCaloFitResults.h} | 46 ++++----- ...RawAnalyzer.cxx => AliCaloRawAnalyzer.cxx} | 97 ++++++++++++++----- ...MCALRawAnalyzer.h => AliCaloRawAnalyzer.h} | 40 +++++--- EMCAL/AliCaloRawAnalyzerCrude.cxx | 68 +++++++++++++ EMCAL/AliCaloRawAnalyzerCrude.h | 38 ++++++++ ...lyzerLMS.cxx => AliCaloRawAnalyzerLMS.cxx} | 45 ++++----- ...wAnalyzerLMS.h => AliCaloRawAnalyzerLMS.h} | 22 ++--- ...r.cxx => AliCaloRawAnalyzerPeakFinder.cxx} | 24 ++--- ...inder.h => AliCaloRawAnalyzerPeakFinder.h} | 20 ++-- EMCAL/libEMCALrec.pkg | 11 ++- 13 files changed, 304 insertions(+), 145 deletions(-) rename EMCAL/{AliEMCALBunchInfo.cxx => AliCaloBunchInfo.cxx} (81%) rename EMCAL/{AliEMCALBunchInfo.h => AliCaloBunchInfo.h} (85%) rename EMCAL/{AliEMCALFitResults.cxx => AliCaloFitResults.cxx} (87%) rename EMCAL/{AliEMCALFitResults.h => AliCaloFitResults.h} (65%) rename EMCAL/{AliEMCALRawAnalyzer.cxx => AliCaloRawAnalyzer.cxx} (63%) rename EMCAL/{AliEMCALRawAnalyzer.h => AliCaloRawAnalyzer.h} (66%) create mode 100644 EMCAL/AliCaloRawAnalyzerCrude.cxx create mode 100644 EMCAL/AliCaloRawAnalyzerCrude.h rename EMCAL/{AliEMCALRawAnalyzerLMS.cxx => AliCaloRawAnalyzerLMS.cxx} (77%) rename EMCAL/{AliEMCALRawAnalyzerLMS.h => AliCaloRawAnalyzerLMS.h} (76%) rename EMCAL/{AliEMCALRawAnalyzerPeakFinder.cxx => AliCaloRawAnalyzerPeakFinder.cxx} (86%) rename EMCAL/{AliEMCALRawAnalyzerPeakFinder.h => AliCaloRawAnalyzerPeakFinder.h} (74%) diff --git a/EMCAL/AliEMCALBunchInfo.cxx b/EMCAL/AliCaloBunchInfo.cxx similarity index 81% rename from EMCAL/AliEMCALBunchInfo.cxx rename to EMCAL/AliCaloBunchInfo.cxx index 585b4dd21f0..22c2dc2bfe4 100644 --- a/EMCAL/AliEMCALBunchInfo.cxx +++ b/EMCAL/AliCaloBunchInfo.cxx @@ -17,14 +17,14 @@ **************************************************************************/ -#include "AliEMCALBunchInfo.h" +#include "AliCaloBunchInfo.h" // Container class to hold information // about of bunches. // Used by the -// AliEMCALRawAnalyzer +// AliCaloRawAnalyzer // classes -AliEMCALBunchInfo::AliEMCALBunchInfo( UInt_t start, Int_t length, const UShort_t * data ) : fStartTimebin(start), +AliCaloBunchInfo::AliCaloBunchInfo( UInt_t start, Int_t length, const UShort_t * data ) : fStartTimebin(start), fLength(length), fkData(data) { @@ -34,7 +34,7 @@ AliEMCALBunchInfo::AliEMCALBunchInfo( UInt_t start, Int_t length, const UShort_t -AliEMCALBunchInfo::~AliEMCALBunchInfo() +AliCaloBunchInfo::~AliCaloBunchInfo() { @@ -42,7 +42,7 @@ AliEMCALBunchInfo::~AliEMCALBunchInfo() -AliEMCALBunchInfo::AliEMCALBunchInfo( const AliEMCALBunchInfo & rhs) :fStartTimebin( rhs.fStartTimebin ), +AliCaloBunchInfo::AliCaloBunchInfo( const AliCaloBunchInfo & rhs) :fStartTimebin( rhs.fStartTimebin ), fLength( rhs.fLength ), fkData( rhs.fkData ) { @@ -53,7 +53,7 @@ AliEMCALBunchInfo::AliEMCALBunchInfo( const AliEMCALBunchInfo & rhs) :fStartTim -AliEMCALBunchInfo& AliEMCALBunchInfo::operator = ( const AliEMCALBunchInfo & rhs) +AliCaloBunchInfo& AliCaloBunchInfo::operator = ( const AliCaloBunchInfo & rhs) { //This is just to get of compliation warning. Its not really needed if(this != & rhs) diff --git a/EMCAL/AliEMCALBunchInfo.h b/EMCAL/AliCaloBunchInfo.h similarity index 85% rename from EMCAL/AliEMCALBunchInfo.h rename to EMCAL/AliCaloBunchInfo.h index 44e44061a6d..044722a5d68 100644 --- a/EMCAL/AliEMCALBunchInfo.h +++ b/EMCAL/AliCaloBunchInfo.h @@ -1,5 +1,5 @@ -#ifndef ALIEMCALBUNCHINFO_H -#define ALIEMCALBUNCHINFO_H +#ifndef ALICALOBUNCHINFO_H +#define ALICALOBUNCHINFO_H /************************************************************************** * This file is property of and copyright by * @@ -28,14 +28,14 @@ // the number of ADC samples in the bunch fLength, and a pointer // to the last (fStartTimebin + fLength ) time bin of the bunch. // -class AliEMCALBunchInfo +class AliCaloBunchInfo { public: - AliEMCALBunchInfo( UInt_t starttimebin, Int_t length, const UShort_t * data ); - virtual ~AliEMCALBunchInfo(); + AliCaloBunchInfo( UInt_t starttimebin, Int_t length, const UShort_t * data ); + virtual ~AliCaloBunchInfo(); - AliEMCALBunchInfo( const AliEMCALBunchInfo & rhs); - AliEMCALBunchInfo & operator = ( const AliEMCALBunchInfo & rhs); + AliCaloBunchInfo( const AliCaloBunchInfo & rhs); + AliCaloBunchInfo & operator = ( const AliCaloBunchInfo & rhs); UInt_t GetStartBin( ) const { return fStartTimebin;}; @@ -43,7 +43,7 @@ class AliEMCALBunchInfo const UShort_t *GetData() const { return fkData; }; private: - AliEMCALBunchInfo(); + AliCaloBunchInfo(); UInt_t fStartTimebin; //Starttimebin as given by the ALTRO stream Int_t fLength; //Length of the bunch const UShort_t *fkData; //Pointer to the last data enetry of the bunch (data is reversed with respect to fStartTimebin) diff --git a/EMCAL/AliEMCALFitResults.cxx b/EMCAL/AliCaloFitResults.cxx similarity index 87% rename from EMCAL/AliEMCALFitResults.cxx rename to EMCAL/AliCaloFitResults.cxx index 055ee6ef5aa..07317e17765 100644 --- a/EMCAL/AliEMCALFitResults.cxx +++ b/EMCAL/AliCaloFitResults.cxx @@ -17,7 +17,7 @@ **************************************************************************/ -#include "AliEMCALFitResults.h" +#include "AliCaloFitResults.h" // Container class to hold results from fitting @@ -27,10 +27,10 @@ // Applied. fStatus holds information on wether or not // The signal was fitted sucessfully. fStatus might have a different meaning If other // procedures than A different meaning Fitting is applied -AliEMCALFitResults::AliEMCALFitResults(const UShort_t maxSig, const Float_t ped, +AliCaloFitResults::AliCaloFitResults(const Int_t maxSig, const Float_t ped, const Short_t fitstatus, const Float_t amp, const Float_t t0, const Float_t chi, - const UShort_t ndf, UShort_t minSig ) : fMaxSig(maxSig), + const Int_t ndf, Int_t minSig ) : fMaxSig(maxSig), fPed(ped), fStatus(fitstatus), fAmpSig(amp), @@ -46,7 +46,7 @@ AliEMCALFitResults::AliEMCALFitResults(const UShort_t maxSig, const Float_t ped, -AliEMCALFitResults::AliEMCALFitResults(const UShort_t maxSig, const UShort_t minSig) : fMaxSig(maxSig), +AliCaloFitResults::AliCaloFitResults(const Int_t maxSig, const Int_t minSig) : fMaxSig(maxSig), fPed(-98), fStatus( -1 ), fAmpSig( -1 ), @@ -60,7 +60,7 @@ AliEMCALFitResults::AliEMCALFitResults(const UShort_t maxSig, const UShort_t min -AliEMCALFitResults::~AliEMCALFitResults() +AliCaloFitResults::~AliCaloFitResults() { } diff --git a/EMCAL/AliEMCALFitResults.h b/EMCAL/AliCaloFitResults.h similarity index 65% rename from EMCAL/AliEMCALFitResults.h rename to EMCAL/AliCaloFitResults.h index 799b66edcee..38378c2c7df 100644 --- a/EMCAL/AliEMCALFitResults.h +++ b/EMCAL/AliCaloFitResults.h @@ -1,6 +1,6 @@ // -*- mode: c++ -*- -#ifndef ALIEMCALFITRESULTS_H -#define ALIEMCALFITRESULTS_H +#ifndef ALICALOFITRESULTS_H +#define ALICALOFITRESULTS_H /************************************************************************** * This file is property of and copyright by * * the Relativistic Heavy Ion Group (RHIG), Yale University, US, 2009 * @@ -25,42 +25,42 @@ // Container class to hold results from fitting // as well as other methods for // raw data signals extraction -class AliEMCALFitResults +class AliCaloFitResults { public: - explicit AliEMCALFitResults( const UShort_t maxSig, - const Float_t ped, - const Short_t fitStatus, - const Float_t amp, - const Float_t t0, - const Float_t chi, - const UShort_t ndf, - const UShort_t minSig = -99); + explicit AliCaloFitResults( const Int_t maxSig, + const Float_t ped, + const Short_t fitStatus, + const Float_t amp, + const Float_t t0, + const Float_t chi, + const Int_t ndf, + const Int_t minSig = -99); - explicit AliEMCALFitResults( const UShort_t maxSig, const UShort_t minSig ); - //AliEMCALFitResults( const UShort_t maxSig, const UShort_t minSig ); + explicit AliCaloFitResults( const Int_t maxSig, const Int_t minSig ); + //AliCaloFitResults( const Int_t maxSig, const Int_t minSig ); - virtual ~AliEMCALFitResults(); - UShort_t GetMaxSig() const { return fMaxSig;}; + virtual ~AliCaloFitResults(); + Int_t GetMaxSig() const { return fMaxSig;}; Float_t GetPed() const { return fPed;}; - UShort_t GetMinSig() const { return fMinSig;}; - UShort_t GetStatus() const { return fStatus;}; + Int_t GetMinSig() const { return fMinSig;}; + Int_t GetStatus() const { return fStatus;}; Float_t GetAmp() const { return fAmpSig; }; Float_t GetTof() const { return fT0; }; Float_t GetChisSquare() const { return fChi2Sig;}; - UShort_t GetNdf() const { return fNdfSig; }; + Int_t GetNdf() const { return fNdfSig; }; private: - AliEMCALFitResults(); - UShort_t fMaxSig; //Maximum sample value ( 0 - 1023 ) + AliCaloFitResults(); + Int_t fMaxSig; //Maximum sample value ( 0 - 1023 ) Float_t fPed; //Pedestal - UShort_t fStatus; //Sucess or failure of fitting pocedure + Int_t fStatus; //Sucess or failure of fitting pocedure Float_t fAmpSig; //Amplitude in entities of ADC counts Float_t fT0; //Start time of signal in entities of sample intervals Float_t fChi2Sig; //Chi Square of fit - UShort_t fNdfSig; //Number of degrees of freedom of fit - UShort_t fMinSig; //Pedestal + Int_t fNdfSig; //Number of degrees of freedom of fit + Int_t fMinSig; //Pedestal }; #endif diff --git a/EMCAL/AliEMCALRawAnalyzer.cxx b/EMCAL/AliCaloRawAnalyzer.cxx similarity index 63% rename from EMCAL/AliEMCALRawAnalyzer.cxx rename to EMCAL/AliCaloRawAnalyzer.cxx index 87385465025..524c296a74b 100644 --- a/EMCAL/AliEMCALRawAnalyzer.cxx +++ b/EMCAL/AliCaloRawAnalyzer.cxx @@ -19,20 +19,21 @@ // Base class for extraction // of signal amplitude and peak position -// From EMCAL Calorimeter RAW data (from the RCU) +// From CALO Calorimeter RAW data (from the RCU) // Contains some utilities for preparing / selecting // Signals suitable for signal extraction // By derived classes #include "AliLog.h" -#include "AliEMCALRawAnalyzer.h" -#include "AliEMCALBunchInfo.h" -#include "AliEMCALFitResults.h" +#include "AliCaloRawAnalyzer.h" +#include "AliCaloBunchInfo.h" +#include "AliCaloFitResults.h" +#include "TMath.h" #include using namespace std; -AliEMCALRawAnalyzer::AliEMCALRawAnalyzer() : TObject(), +AliCaloRawAnalyzer::AliCaloRawAnalyzer() : TObject(), fMinTimeIndex(-1), fMaxTimeIndex(-1), fFitArrayCut(5), @@ -48,14 +49,14 @@ AliEMCALRawAnalyzer::AliEMCALRawAnalyzer() : TObject(), } } -AliEMCALRawAnalyzer::~AliEMCALRawAnalyzer() +AliCaloRawAnalyzer::~AliCaloRawAnalyzer() { } void -AliEMCALRawAnalyzer::SetTimeConstraint(const int min, const int max ) +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 ) @@ -71,7 +72,7 @@ AliEMCALRawAnalyzer::SetTimeConstraint(const int min, const int max ) UShort_t -AliEMCALRawAnalyzer::Max(const UShort_t *data, const int length ) const +AliCaloRawAnalyzer::Max(const UShort_t *data, const int length ) const { //------------ UShort_t tmpmax = data[0]; @@ -88,7 +89,7 @@ AliEMCALRawAnalyzer::Max(const UShort_t *data, const int length ) const void -AliEMCALRawAnalyzer::SelectSubarray( const Double_t *fData, const int length, const short maxindex, int *const first, int *const last ) const +AliCaloRawAnalyzer::SelectSubarray( const Double_t *fData, const int length, const short maxindex, int *const first, int *const last ) 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 @@ -113,35 +114,44 @@ AliEMCALRawAnalyzer::SelectSubarray( const Double_t *fData, const int length, co Float_t -AliEMCALRawAnalyzer::ReverseAndSubtractPed( const AliEMCALBunchInfo *bunch, const UInt_t /*altrocfg1*/, const UInt_t /*altrocfg2*/, double *outarray ) const +AliCaloRawAnalyzer::ReverseAndSubtractPed( const AliCaloBunchInfo *bunch, const UInt_t /*altrocfg1*/, const 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(); - double ped = 0; + double ped = EvaluatePedestal( sig , length); + + for( int i=0; i < length; i++ ) + { + outarray[i] = sig[length -i -1] - ped; + } + + return ped; +} + + + +Float_t +AliCaloRawAnalyzer::EvaluatePedestal(const UShort_t * const data, const int /*length*/ ) const +{ + // double ped = 0; double tmp = 0; if( fIsZerosupressed == false ) { for(int i=0; i < 5; i++ ) { - tmp += sig[i]; + tmp += data[i]; } } - ped = tmp / 5; - for( int i=0; i < length; i++ ) - { - outarray[i] = sig[length -i -1] - ped; - } - - return ped; + return tmp/5; } short -AliEMCALRawAnalyzer::Max( const AliEMCALBunchInfo *const bunch , int *const maxindex ) const +AliCaloRawAnalyzer::Max( const AliCaloBunchInfo *const bunch , int *const maxindex ) const { //comment short tmpmax = -1; @@ -167,7 +177,7 @@ AliEMCALRawAnalyzer::Max( const AliEMCALBunchInfo *const bunch , int *const maxi int -AliEMCALRawAnalyzer::SelectBunch( const vector &bunchvector,short *const maxampbin, short *const maxamplitude ) const +AliCaloRawAnalyzer::SelectBunch( const vector &bunchvector,short *const maxampbin, short *const maxamplitude ) const { //We select the bunch with the highest amplitude unless any time constraints is set short max = -1; @@ -195,7 +205,7 @@ AliEMCALRawAnalyzer::SelectBunch( const vector &bunchvector,s bool -AliEMCALRawAnalyzer::IsInTimeRange( const int maxindex ) const +AliCaloRawAnalyzer::IsInTimeRange( const int maxindex ) const { // Ckeck if the index of the max ADC vaue is consistent with trigger. if( ( fMinTimeIndex < 0 && fMaxTimeIndex < 0) ||fMaxTimeIndex < 0 ) @@ -207,7 +217,7 @@ AliEMCALRawAnalyzer::IsInTimeRange( const int maxindex ) const void -AliEMCALRawAnalyzer::PrintBunches( const vector &bvctr ) const +AliCaloRawAnalyzer::PrintBunches( const vector &bvctr ) const { //comment cout << __FILE__ << __LINE__<< "*************** Printing Bunches *******************" << endl; @@ -223,7 +233,7 @@ AliEMCALRawAnalyzer::PrintBunches( const vector &bvctr ) cons void -AliEMCALRawAnalyzer::PrintBunch( const AliEMCALBunchInfo &bunch ) const +AliCaloRawAnalyzer::PrintBunch( const AliCaloBunchInfo &bunch ) const { //comment cout << __FILE__ << ":" << __LINE__ << endl; @@ -238,3 +248,42 @@ AliEMCALRawAnalyzer::PrintBunch( const AliEMCALBunchInfo &bunch ) const } +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, 0, 0, 0, 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 & maxampindex, Float_t & ped, int & first, int & last) +{ // method to do the selection of what should possibly be fitted + int nsamples = 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 + { + // 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 + { + // select array around max to possibly be used in fit + maxampindex -= bunchvector.at(index).GetStartBin(); // PTH - why isn't this index also reversed for call below? + SelectSubarray( fReversed, bunchvector.at(index).GetLength(), maxampindex , &first, &last); + + // sanity check: maximum should not be in first or last bin + // if we should do a fit + if (first!=maxampindex && last!=maxampindex) { + // calculate how many samples we have + nsamples = last - first + 1; + } + } + } + + return nsamples; +} + diff --git a/EMCAL/AliEMCALRawAnalyzer.h b/EMCAL/AliCaloRawAnalyzer.h similarity index 66% rename from EMCAL/AliEMCALRawAnalyzer.h rename to EMCAL/AliCaloRawAnalyzer.h index b4d103fbddf..1a3029f56c3 100644 --- a/EMCAL/AliEMCALRawAnalyzer.h +++ b/EMCAL/AliCaloRawAnalyzer.h @@ -1,5 +1,5 @@ -#ifndef ALIEMCALRAWANALYZER_H -#define ALIEMCALRAWANALYZER_H +#ifndef ALICALORAWANALYZER_H +#define ALICALORAWANALYZER_H /************************************************************************** * This file is property of and copyright by * * the Relatvistic Heavy Ion Group (RHIG), Yale University, US, 2009 * @@ -18,9 +18,10 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ + //Base class for extraction //of signal amplitude and peak position -//From EMCAL Calorimeter RAW data +//From CALO Calorimeter RAW data #include "Rtypes.h" @@ -29,34 +30,41 @@ using namespace std; #define MAXSAMPLES 1008 //CRAP PTH -#include "AliEMCALRawAnalyzer.h" +#include "AliCaloRawAnalyzer.h" -class AliEMCALBunchInfo; -class AliEMCALFitResults; +class AliCaloBunchInfo; +class AliCaloFitResults; -class AliEMCALRawAnalyzer : public TObject +class AliCaloRawAnalyzer : public TObject { public: - AliEMCALRawAnalyzer(); - virtual ~AliEMCALRawAnalyzer(); - virtual AliEMCALFitResults Evaluate( const vector &bunchvector, const UInt_t altrocfg1, const UInt_t altrocfg2 ) = 0; + AliCaloRawAnalyzer(); + virtual ~AliCaloRawAnalyzer(); + virtual AliCaloFitResults Evaluate( const vector &bunchvector, const UInt_t altrocfg1, const UInt_t altrocfg2 ); - void PrintBunches( const vector &bunchvector ) const; - void PrintBunch( const AliEMCALBunchInfo &bunch ) const ; + void PrintBunches( const vector &bunchvector ) const; + void PrintBunch( const AliCaloBunchInfo &bunch ) const ; + virtual int PreFitEvaluateSamples( const 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); void SetTimeConstraint(const int min, const int max ); void SetVerbose(bool verbose = true){ fVerbose = verbose; }; void SetIsZeroSuppressed(const bool iszs = true) { fIsZerosupressed = iszs; } ; void SetAmpCut(const Float_t cut) { fAmpCut = cut ; } ; + void SetFitArrayCut(const Int_t cut) { fFitArrayCut = cut ; } ; + void SetNsampleCut(const Int_t cut) { fNsampleCut = cut ; } ; + + // access to array info + Double_t GetReversed(const int i) const { return fReversed[i]; } protected: - short Max( const AliEMCALBunchInfo *const bunch, int *const maxindex) const; + short Max( const AliCaloBunchInfo *const bunch, int *const maxindex) const; UShort_t Max(const UShort_t *data, const int length ) const; bool IsInTimeRange( const int maxindex ) const; - Float_t ReverseAndSubtractPed( const AliEMCALBunchInfo *bunch, const UInt_t altrocfg1, const UInt_t altrocfg2, double *outarray ) const; - int SelectBunch( const vector &bunchvector, short *const maxampbin, short *const maxamplitude ) const; + Float_t ReverseAndSubtractPed( const AliCaloBunchInfo *bunch, const UInt_t altrocfg1, const UInt_t altrocfg2, double *outarray ) const; + int SelectBunch( const vector &bunchvector, short *const maxampbin, short *const maxamplitude ) const; void SelectSubarray( const Double_t *fData, const int length, const short maxindex, int *const first, int *const last ) const; + Float_t EvaluatePedestal(const UShort_t * const data, const int length ) const; Double_t fReversed[MAXSAMPLES]; //Reversed sequence of samples (pedestalsubtracted) @@ -68,7 +76,7 @@ class AliEMCALRawAnalyzer : public TObject int fNsampleCut; //Minimum number of sample require before attemting to extract signal parameters bool fIsZerosupressed; //Wether or not the data is zeros supressed, by default its assumed that the baseline is also subtracted if set to true bool fVerbose; //Print debug information to std out if set to true - + }; #endif diff --git a/EMCAL/AliCaloRawAnalyzerCrude.cxx b/EMCAL/AliCaloRawAnalyzerCrude.cxx new file mode 100644 index 00000000000..0ddd36e2596 --- /dev/null +++ b/EMCAL/AliCaloRawAnalyzerCrude.cxx @@ -0,0 +1,68 @@ +/************************************************************************** + * This file is property of and copyright by the Experimental Nuclear * + * Physics Group, Dep. of Physics * + * University of Oslo, Norway, 2007 * + * * + * Author: Per Thomas Hille for the ALICE HLT Project.* + * Contributors are mentioned in the code where appropriate. * + * Please report bugs to perthi@fys.uio.no * + * * + * 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. * + **************************************************************************/ +#include "AliCaloRawAnalyzerCrude.h" +#include "AliCaloFitResults.h" +#include "AliCaloBunchInfo.h" + + +AliCaloRawAnalyzerCrude::AliCaloRawAnalyzerCrude() +{ + +} + + +AliCaloRawAnalyzerCrude::~AliCaloRawAnalyzerCrude() +{ + +} + + +AliCaloFitResults +AliCaloRawAnalyzerCrude::Evaluate(const vector &bunchvector, const UInt_t /*altrocfg1*/, const UInt_t /*altrocfg2*/) +{ + if( bunchvector.size() <= 0 ) + { + return AliCaloFitResults(-1, -1, -1, -1 , -1, -1, -1 ); + } + + Int_t amp = 0; + Float_t tof = -99; + const UShort_t *sig; + + double ped = EvaluatePedestal( bunchvector.at(0).GetData(), bunchvector.at(0).GetLength() ) ; + + for( unsigned int i= 0; i < bunchvector.size(); ++i) + { + sig = bunchvector.at(i).GetData(); + int length = bunchvector.at(i).GetLength(); + + for(int j = 0; j < length; j ++) + if( sig[j] > amp ) + { + amp = sig[j]; + tof = i; + } + } + + //:EvaluatePedestal(const UShort_t * const data, const int length ) + // double ped = EvaluatePedestal(sig, length) ; + return AliCaloFitResults(amp, ped, -1, amp - ped, tof, -1, -1 ); + +} //end Crude + + diff --git a/EMCAL/AliCaloRawAnalyzerCrude.h b/EMCAL/AliCaloRawAnalyzerCrude.h new file mode 100644 index 00000000000..b55ec9e06b0 --- /dev/null +++ b/EMCAL/AliCaloRawAnalyzerCrude.h @@ -0,0 +1,38 @@ +#ifndef ALICALORAWANALYZERCRUDE_H +#define ALICALORAWANALYZERCRUDE_H + +/************************************************************************** + * This file is property of and copyright by the Experimental Nuclear * + * Physics Group, Dep. of Physics * + * University of Oslo, Norway, 2007 * + * * + * Author: Per Thomas Hille for the ALICE HLT Project.* + * Contributors are mentioned in the code where appropriate. * + * Please report bugs to perthi@fys.uio.no * + * * + * 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. * + **************************************************************************/ + +#include "AliCaloRawAnalyzer.h" + +class AliCaloFitResults; +class AliCaloBunchInfo; + + +class AliCaloRawAnalyzerCrude : public AliCaloRawAnalyzer +{ + public: + virtual AliCaloFitResults Evaluate( const vector &bunchvector, + const UInt_t altrocfg1, const UInt_t altrocfg2 ); + AliCaloRawAnalyzerCrude(); + virtual ~AliCaloRawAnalyzerCrude(); + +}; + +#endif diff --git a/EMCAL/AliEMCALRawAnalyzerLMS.cxx b/EMCAL/AliCaloRawAnalyzerLMS.cxx similarity index 77% rename from EMCAL/AliEMCALRawAnalyzerLMS.cxx rename to EMCAL/AliCaloRawAnalyzerLMS.cxx index 64b342418cb..59e4691925c 100644 --- a/EMCAL/AliEMCALRawAnalyzerLMS.cxx +++ b/EMCAL/AliCaloRawAnalyzerLMS.cxx @@ -18,15 +18,15 @@ // Extraction of amplitude and peak position -// FRom EMCAL raw data using +// FRom CALO raw data using // least square fit for the // Moment assuming identical and // independent errors (equivalent with chi square) // -#include "AliEMCALRawAnalyzerLMS.h" -#include "AliEMCALBunchInfo.h" -#include "AliEMCALFitResults.h" +#include "AliCaloRawAnalyzerLMS.h" +#include "AliCaloBunchInfo.h" +#include "AliCaloFitResults.h" #include "AliLog.h" #include "TMath.h" #include @@ -39,10 +39,10 @@ using namespace std; #define BAD 4 //CRAP PTH -AliEMCALRawAnalyzerLMS::AliEMCALRawAnalyzerLMS() : AliEMCALRawAnalyzer(), - fkEulerSquared(7.389056098930650227), - fSig(0), - fTf1(0) +AliCaloRawAnalyzerLMS::AliCaloRawAnalyzerLMS() : AliCaloRawAnalyzer(), + fkEulerSquared(7.389056098930650227), + fSig(0), + fTf1(0) { //comment for(int i=0; i < MAXSAMPLES; i++) @@ -56,15 +56,15 @@ AliEMCALRawAnalyzerLMS::AliEMCALRawAnalyzerLMS() : AliEMCALRawAnalyzer(), } -AliEMCALRawAnalyzerLMS::~AliEMCALRawAnalyzerLMS() +AliCaloRawAnalyzerLMS::~AliCaloRawAnalyzerLMS() { delete fTf1; } -AliEMCALFitResults -AliEMCALRawAnalyzerLMS::Evaluate( const vector &bunchvector, const UInt_t altrocfg1, const UInt_t altrocfg2 ) +AliCaloFitResults +AliCaloRawAnalyzerLMS::Evaluate( const vector &bunchvector, const UInt_t altrocfg1, const UInt_t altrocfg2 ) { // Extracting signal parameters using fitting short maxampindex; //index of maximum amplitude @@ -88,27 +88,24 @@ AliEMCALRawAnalyzerLMS::Evaluate( const vector &bunchvector, TGraph *graph = new TGraph( last - first, fXaxis, &fReversed[first] ); fTf1->SetParameter(0, maxf*fkEulerSquared ); - fTf1->SetParameter(1, 0.235); + fTf1->SetParameter(1, 0.2); // fTf1->SetParameter(2, 2); // fTf1->SetParameter(2, 3); - // return AliEMCALFitResults( -1 , -1 , -1, -1, -1, -1 , -1); + // return AliCaloFitResults( -1 , -1 , -1, -1, -1, -1 , -1); Short_t tmpStatus = graph->Fit(fTf1, "Q0RW"); - // return AliEMCALFitResults( -1 , -1 , -1, -1, -1, -1 , -1); + // return AliCaloFitResults( -1 , -1 , -1, -1, -1, -1 , -1); if( fVerbose == true ) { - AliEMCALRawAnalyzer::PrintBunch( bunchvector.at(index) ); + AliCaloRawAnalyzer::PrintBunch( bunchvector.at(index) ); PrintFitResult( fTf1 ) ; } delete graph; - - - - return AliEMCALFitResults( maxamp, ped , tmpStatus, + return AliCaloFitResults( maxamp, ped , tmpStatus, fTf1->GetParameter(0)/fkEulerSquared, fTf1->GetParameter(1) + maxampindex, fTf1->GetChisquare(), @@ -120,26 +117,26 @@ AliEMCALRawAnalyzerLMS::Evaluate( const vector &bunchvector, } else { - return AliEMCALFitResults( maxamp, ped, -1, maxf, -1, -1, -1 ); + return AliCaloFitResults( maxamp, ped, -1, maxf, -1, -1, -1 ); } } else { - return AliEMCALFitResults( maxamp , ped, -1, maxf, -1, -1, -1 ); + return AliCaloFitResults( maxamp , ped, -1, maxf, -1, -1, -1 ); } } else { - return AliEMCALFitResults( -99, -99 ); + return AliCaloFitResults( -99, -99 ); } - return AliEMCALFitResults( -99, -99 ); + return AliCaloFitResults( -99, -99 ); } void -AliEMCALRawAnalyzerLMS::PrintFitResult(const TF1 *f) const +AliCaloRawAnalyzerLMS::PrintFitResult(const TF1 *f) const { //comment cout << endl; diff --git a/EMCAL/AliEMCALRawAnalyzerLMS.h b/EMCAL/AliCaloRawAnalyzerLMS.h similarity index 76% rename from EMCAL/AliEMCALRawAnalyzerLMS.h rename to EMCAL/AliCaloRawAnalyzerLMS.h index 10c56bf9ca3..edd625e1944 100644 --- a/EMCAL/AliEMCALRawAnalyzerLMS.h +++ b/EMCAL/AliCaloRawAnalyzerLMS.h @@ -1,5 +1,5 @@ -#ifndef ALIEMCALRAWANALYZERLMS_H -#define ALIEMCALRAWANALYZERLMS_H +#ifndef ALICALORAWANALYZERLMS_H +#define ALICALORAWANALYZERLMS_H /************************************************************************** * This file is property of and copyright by * * the Relativistic Heavy Ion Group (RHIG), Yale University, US, 2009 * @@ -20,34 +20,32 @@ // Extraction of amplitude and peak position -// FRom EMCAL raw data using +// FRom CALO raw data using // Chi square fit -#include "AliEMCALRawAnalyzer.h" +#include "AliCaloRawAnalyzer.h" class TF1; class TGraph; -class AliEMCALRawAnalyzerLMS : public AliEMCALRawAnalyzer +class AliCaloRawAnalyzerLMS : public AliCaloRawAnalyzer { public: - AliEMCALRawAnalyzerLMS(); - virtual ~AliEMCALRawAnalyzerLMS(); - virtual AliEMCALFitResults Evaluate( const vector &bunchvector, const UInt_t altrocfg1, const UInt_t altrocfg2 ); + AliCaloRawAnalyzerLMS(); + virtual ~AliCaloRawAnalyzerLMS(); + virtual AliCaloFitResults Evaluate( const vector &bunchvector, const UInt_t altrocfg1, const UInt_t altrocfg2 ); void PrintFitResult(const TF1 *f) const; private: - AliEMCALRawAnalyzerLMS(const AliEMCALRawAnalyzerLMS & ); - AliEMCALRawAnalyzerLMS & operator = (const AliEMCALRawAnalyzerLMS &); + AliCaloRawAnalyzerLMS(const AliCaloRawAnalyzerLMS & ); + AliCaloRawAnalyzerLMS & operator = (const AliCaloRawAnalyzerLMS &); double fXaxis[MAXSAMPLES]; //Axis if time bins, ( used by TGraph ) const double fkEulerSquared; //e^2 = 7.389056098930650227 TGraph *fSig; // Signale holding the data to be fitted. TF1 *fTf1; // Analytical formula of the Semi Gaussian to be fitted - - }; #endif diff --git a/EMCAL/AliEMCALRawAnalyzerPeakFinder.cxx b/EMCAL/AliCaloRawAnalyzerPeakFinder.cxx similarity index 86% rename from EMCAL/AliEMCALRawAnalyzerPeakFinder.cxx rename to EMCAL/AliCaloRawAnalyzerPeakFinder.cxx index ff1f5c22f21..f839260957e 100644 --- a/EMCAL/AliEMCALRawAnalyzerPeakFinder.cxx +++ b/EMCAL/AliCaloRawAnalyzerPeakFinder.cxx @@ -25,9 +25,9 @@ // Is done with a simple vector multiplication, allowing for // Extreemely fast computations. -#include "AliEMCALRawAnalyzerPeakFinder.h" -#include "AliEMCALBunchInfo.h" -#include "AliEMCALFitResults.h" +#include "AliCaloRawAnalyzerPeakFinder.h" +#include "AliCaloBunchInfo.h" +#include "AliCaloFitResults.h" #include #include "unistd.h" #include "TMath.h" @@ -35,7 +35,7 @@ using namespace std; -AliEMCALRawAnalyzerPeakFinder::AliEMCALRawAnalyzerPeakFinder() :AliEMCALRawAnalyzer(), +AliCaloRawAnalyzerPeakFinder::AliCaloRawAnalyzerPeakFinder() :AliCaloRawAnalyzer(), fTof(0), fAmp(0) { @@ -61,7 +61,7 @@ AliEMCALRawAnalyzerPeakFinder::AliEMCALRawAnalyzerPeakFinder() :AliEMCALRawAnaly } -AliEMCALRawAnalyzerPeakFinder::~AliEMCALRawAnalyzerPeakFinder() +AliCaloRawAnalyzerPeakFinder::~AliCaloRawAnalyzerPeakFinder() { //comment for(int i=0; i < MAXSTART; i++) @@ -75,8 +75,8 @@ AliEMCALRawAnalyzerPeakFinder::~AliEMCALRawAnalyzerPeakFinder() } -AliEMCALFitResults -AliEMCALRawAnalyzerPeakFinder::Evaluate( const vector &bunchvector, const UInt_t altrocfg1, const UInt_t altrocfg2 ) +AliCaloFitResults +AliCaloRawAnalyzerPeakFinder::Evaluate( const vector &bunchvector, const UInt_t altrocfg1, const UInt_t altrocfg2 ) { // Extracting the amplitude using the Peak-Finder algorithm // The amplitude is a weighted sum of the samples using @@ -95,7 +95,7 @@ AliEMCALRawAnalyzerPeakFinder::Evaluate( const vector &bunchv if( maxf < fAmpCut || ( maxamp - ped) > 900 ) // (maxamp - ped) > 900 = Close to saturation (use low gain then) { // cout << __FILE__ << __LINE__ <<":, maxamp = " << maxamp << ", ped = "<< ped << ",. maxf = "<< maxf << ", maxampindex = "<< maxampindex << endl; - return AliEMCALFitResults( maxamp, ped, -1, maxf, maxampindex, -1, -1 ); + return AliCaloFitResults( maxamp, ped, -1, maxf, maxampindex, -1, -1 ); } int first; @@ -119,23 +119,23 @@ AliEMCALRawAnalyzerPeakFinder::Evaluate( const vector &bunchv fAmp += fPFAmpVectors[0][pfindex][i]*tmp; } - return AliEMCALFitResults( maxamp, ped , -1, fAmp, -1, -1, -1 ); + return AliCaloFitResults( maxamp, ped , -1, fAmp, -1, -1, -1 ); } else { - return AliEMCALFitResults( maxamp, ped , -1, maxf, -1, -1, -1 ); + return AliCaloFitResults( maxamp, ped , -1, maxf, -1, -1, -1 ); } } } // cout << __FILE__ << __LINE__ << "WARNING, returning amp = -1 " << endl; - return AliEMCALFitResults(-1, -1); + return AliCaloFitResults(-1, -1); } void -AliEMCALRawAnalyzerPeakFinder::LoadVectors() +AliCaloRawAnalyzerPeakFinder::LoadVectors() { //Read in the Peak finder vecors from file for(int i = 0; i < MAXSTART ; i++) diff --git a/EMCAL/AliEMCALRawAnalyzerPeakFinder.h b/EMCAL/AliCaloRawAnalyzerPeakFinder.h similarity index 74% rename from EMCAL/AliEMCALRawAnalyzerPeakFinder.h rename to EMCAL/AliCaloRawAnalyzerPeakFinder.h index c7e1d7b5546..d4ad5e60a34 100644 --- a/EMCAL/AliEMCALRawAnalyzerPeakFinder.h +++ b/EMCAL/AliCaloRawAnalyzerPeakFinder.h @@ -1,5 +1,5 @@ -#ifndef ALIEMCALRAWANALYZERPEAKFINDER_H -#define ALIEMCALRAWANALYZERPEAKFINDER_H +#ifndef ALICALORAWANALYZERPEAKFINDER_H +#define ALICALORAWANALYZERPEAKFINDER_H /************************************************************************** * This file is property of and copyright by the Experimental Nuclear * @@ -25,24 +25,24 @@ // best possible weights. -#include "AliEMCALRawAnalyzer.h" +#include "AliCaloRawAnalyzer.h" #define MAXSTART 3 #define SAMPLERANGE 15 #define SHIF 0.5 -class AliEMCALBunchInfo; +class AliCaloBunchInfo; -class AliEMCALRawAnalyzerPeakFinder : public AliEMCALRawAnalyzer +class AliCaloRawAnalyzerPeakFinder : public AliCaloRawAnalyzer { public: - AliEMCALRawAnalyzerPeakFinder(); - virtual ~AliEMCALRawAnalyzerPeakFinder(); - virtual AliEMCALFitResults Evaluate( const vector &bunchvector, const UInt_t altrocfg1, const UInt_t altrocfg2 ); + AliCaloRawAnalyzerPeakFinder(); + virtual ~AliCaloRawAnalyzerPeakFinder(); + virtual AliCaloFitResults Evaluate( const vector &bunchvector, const UInt_t altrocfg1, const UInt_t altrocfg2 ); private: - AliEMCALRawAnalyzerPeakFinder( const AliEMCALRawAnalyzerPeakFinder & ); - AliEMCALRawAnalyzerPeakFinder & operator = ( const AliEMCALRawAnalyzerPeakFinder & ); + // AliCaloRawAnalyzerPeakFinder( const AliCaloRawAnalyzerPeakFinder & ); + // AliCaloRawAnalyzerPeakFinder & operator = ( const AliCaloRawAnalyzerPeakFinder & ); void LoadVectors(); double *fPFAmpVectors[MAXSTART][SAMPLERANGE]; // Vectors for Amplitude extraction diff --git a/EMCAL/libEMCALrec.pkg b/EMCAL/libEMCALrec.pkg index eda174f59c6..e4312e7baca 100644 --- a/EMCAL/libEMCALrec.pkg +++ b/EMCAL/libEMCALrec.pkg @@ -10,11 +10,12 @@ AliEMCALPID.cxx \ AliEMCALQADataMakerRec.cxx \ AliEMCALAodCluster.cxx \ AliCaloNeuralFit.cxx \ -AliEMCALRawAnalyzer.cxx \ -AliEMCALRawAnalyzerLMS.cxx \ -AliEMCALRawAnalyzerPeakFinder.cxx \ -AliEMCALBunchInfo.cxx \ -AliEMCALFitResults.cxx +AliCaloRawAnalyzer.cxx \ +AliCaloRawAnalyzerCrude.cxx \ +AliCaloRawAnalyzerLMS.cxx \ +AliCaloRawAnalyzerPeakFinder.cxx \ +AliCaloBunchInfo.cxx \ +AliCaloFitResults.cxx HDRS= $(SRCS:.cxx=.h) -- 2.39.3