#ifndef ALICALORIMETERUTILS_H #define ALICALORIMETERUTILS_H /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ //_________________________________________________________________________ // Class utility for Calorimeter specific selection methods /// // // // //-- Author: Gustavo Conesa (LPSC-Grenoble) ////////////////////////////////////////////////////////////////////////////// // --- ROOT system --- #include #include #include class TArrayF; #include #include //--- ANALYSIS system --- class AliVEvent; class AliVTrack; class AliAODPWG4Particle; class AliAODCaloCluster; class AliVCaloCells; class AliPHOSGeoUtils; class AliEMCALGeometry; #include "AliEMCALRecoUtils.h" class AliCalorimeterUtils : public TObject { public: AliCalorimeterUtils() ; // ctor virtual ~AliCalorimeterUtils() ;//virtual dtor virtual void InitParameters(); virtual void Print(const Option_t * opt) const ; virtual Int_t GetDebug() const { return fDebug ; } virtual void SetDebug(Int_t d) { fDebug = d ; } //virtual void Init(); // Cluster contents Bool_t AreNeighbours(const TString calo, const Int_t absId1, const Int_t absId2) const ; Int_t GetNumberOfLocalMaxima(AliVCluster* cluster, AliVCaloCells* cells) ; Int_t GetNumberOfLocalMaxima(AliVCluster* cluster, AliVCaloCells* cells, Int_t *absIdList, Float_t *maxEList) ; Float_t GetLocalMaximaCutE() const { return fLocMaxCutE ; } void SetLocalMaximaCutE(Float_t cut) { fLocMaxCutE = cut ; } Float_t GetLocalMaximaCutEDiff() const { return fLocMaxCutEDiff ; } void SetLocalMaximaCutEDiff(Float_t c) { fLocMaxCutEDiff = c ; } Int_t GetMaxEnergyCell(AliVCaloCells* cells, const AliVCluster* clu, Float_t & fraction) const ; void SplitEnergy(const Int_t absId1, const Int_t absId2, AliVCluster *cluster, AliVCaloCells* cells, //Float_t & e1, Float_t & e2, AliAODCaloCluster *cluster1, AliAODCaloCluster *cluster2, const Int_t nMax, const Int_t eventNumber = 0);//, Int_t *absIdList, Float_t *maxEList, void SwitchOnClusterPlot() { fPlotCluster = kTRUE ; } void SwitchOffClusterPlot() { fPlotCluster = kFALSE ; } //Calorimeters Geometry Methods AliEMCALGeometry * GetEMCALGeometry() const { return fEMCALGeo ; } TString EMCALGeometryName() const { return fEMCALGeoName ; } void SetEMCALGeometryName(TString name) { fEMCALGeoName = name ; } void InitEMCALGeometry() ; Bool_t IsEMCALGeoMatrixSet() const { return fEMCALGeoMatrixSet ; } AliPHOSGeoUtils * GetPHOSGeometry() const { return fPHOSGeo ; } TString PHOSGeometryName() const { return fPHOSGeoName ; } void SetPHOSGeometryName(TString name) { fPHOSGeoName = name ; } void InitPHOSGeometry() ; Bool_t IsPHOSGeoMatrixSet() const { return fPHOSGeoMatrixSet ; } void SetGeometryTransformationMatrices(AliVEvent* inputEvent) ; void SwitchOnLoadOwnEMCALGeometryMatrices() { fLoadEMCALMatrices = kTRUE ; } void SwitchOffLoadOwnEMCALGeometryMatrices() { fLoadEMCALMatrices = kFALSE ; } void SetEMCALGeometryMatrixInSM(TGeoHMatrix* m, Int_t i) { fEMCALMatrix[i] = m ; } void SwitchOnLoadOwnPHOSGeometryMatrices() { fLoadPHOSMatrices = kTRUE ; } void SwitchOffLoadOwnPHOSGeometryMatrices() { fLoadPHOSMatrices = kFALSE ; } void SetPHOSGeometryMatrixInSM(TGeoHMatrix* m, Int_t i) { fPHOSMatrix[i] = m ; } // Bad channels Bool_t IsBadChannelsRemovalSwitchedOn() const { return fRemoveBadChannels ; } void SwitchOnBadChannelsRemoval () { fRemoveBadChannels = kTRUE ; fEMCALRecoUtils->SwitchOnBadChannelsRemoval(); if(!fPHOSBadChannelMap) InitPHOSBadChannelStatusMap() ; } void SwitchOffBadChannelsRemoval() { fRemoveBadChannels = kFALSE ; fEMCALRecoUtils->SwitchOffBadChannelsRemoval() ; } Bool_t IsDistanceToBadChannelRecalculated() const { return IsDistanceToBadChannelRecalculated() ; } void SwitchOnDistToBadChannelRecalculation () { fEMCALRecoUtils->SwitchOnDistToBadChannelRecalculation() ; } void SwitchOffDistToBadChannelRecalculation() { fEMCALRecoUtils->SwitchOffDistToBadChannelRecalculation(); } void InitPHOSBadChannelStatusMap () ; Int_t GetEMCALChannelStatus(Int_t iSM , Int_t iCol, Int_t iRow) const { return fEMCALRecoUtils->GetEMCALChannelStatus(iSM,iCol,iRow); }//Channel is ok by default Int_t GetPHOSChannelStatus (Int_t imod, Int_t iCol, Int_t iRow) const { if(fPHOSBadChannelMap)return (Int_t) ((TH2I*)fPHOSBadChannelMap->At(imod))->GetBinContent(iCol,iRow); else return 0 ; }//Channel is ok by default void SetEMCALChannelStatus(Int_t iSM , Int_t iCol, Int_t iRow, Double_t c = 1) { fEMCALRecoUtils->SetEMCALChannelStatus(iSM,iCol,iRow,c) ; } void SetPHOSChannelStatus (Int_t imod, Int_t iCol, Int_t iRow, Double_t c = 1) { if(!fPHOSBadChannelMap) InitPHOSBadChannelStatusMap() ; ((TH2I*)fPHOSBadChannelMap->At(imod))->SetBinContent(iCol,iRow,c) ; } void SetEMCALChannelStatusMap(Int_t iSM , TH2I* h) { fEMCALRecoUtils->SetEMCALChannelStatusMap(iSM,h) ; } void SetPHOSChannelStatusMap(Int_t imod , TH2I* h) { fPHOSBadChannelMap ->AddAt(h,imod) ; } TH2I * GetEMCALChannelStatusMap(Int_t iSM) const { return fEMCALRecoUtils->GetEMCALChannelStatusMap(iSM) ; } TH2I * GetPHOSChannelStatusMap(Int_t imod) const { return (TH2I*)fPHOSBadChannelMap->At(imod) ; } void SetEMCALChannelStatusMap(TObjArray *map) { fEMCALRecoUtils->SetEMCALChannelStatusMap(map) ; } void SetPHOSChannelStatusMap (TObjArray *map) { fPHOSBadChannelMap = map ; } Bool_t ClusterContainsBadChannel(TString calorimeter,UShort_t* cellList, Int_t nCells); // Mask clusters in front of frame, EMCAL only Int_t GetNMaskCellColumns() const { return fNMaskCellColumns;} void SetNMaskCellColumns(Int_t n) { if(n > fNMaskCellColumns) { delete [] fMaskCellColumns ; fMaskCellColumns = new Int_t[n] ; } fNMaskCellColumns = n ; } void SetMaskCellColumn(Int_t ipos, Int_t icol) { if(ipos < fNMaskCellColumns) fMaskCellColumns[ipos] = icol; else printf("Not set, position larger than allocated set size first") ; } Bool_t MaskFrameCluster(const Int_t iSM, const Int_t ieta) const ; //Calorimeter indexes information Int_t GetModuleNumber(AliAODPWG4Particle * particle, AliVEvent* inputEvent) const; Int_t GetModuleNumber(AliVCluster * cluster) const; Int_t GetModuleNumberCellIndexes(const Int_t absId, const TString calo, Int_t & icol, Int_t & irow, Int_t &iRCU) const ; //Modules fiducial region Bool_t CheckCellFiducialRegion(AliVCluster* cluster, AliVCaloCells* cells, AliVEvent * event, Int_t iev=0) const ; void SetNumberOfCellsFromPHOSBorder(Int_t n) { fNCellsFromPHOSBorder = n ; } Int_t GetNumberOfCellsFromPHOSBorder() const { return fNCellsFromPHOSBorder ; } void SetNumberOfCellsFromEMCALBorder(Int_t n) { fEMCALRecoUtils->SetNumberOfCellsFromEMCALBorder(n) ; } Int_t GetNumberOfCellsFromEMCALBorder() const { return fEMCALRecoUtils->GetNumberOfCellsFromEMCALBorder(); } void SwitchOnNoFiducialBorderInEMCALEta0() { fEMCALRecoUtils->SwitchOnNoFiducialBorderInEMCALEta0() ; } void SwitchOffNoFiducialBorderInEMCALEta0() { fEMCALRecoUtils->SwitchOffNoFiducialBorderInEMCALEta0() ; } Bool_t IsEMCALNoBorderAtEta0() const { return fEMCALRecoUtils->IsEMCALNoBorderAtEta0() ; } // Recalibration Bool_t IsRecalibrationOn() const { return fRecalibration ; } void SwitchOnRecalibration() { fRecalibration = kTRUE ; InitPHOSRecalibrationFactors(); fEMCALRecoUtils->SwitchOnRecalibration() ; } void SwitchOffRecalibration() { fRecalibration = kFALSE; fEMCALRecoUtils->SwitchOffRecalibration() ; } void InitPHOSRecalibrationFactors () ; Float_t GetEMCALChannelRecalibrationFactor(Int_t iSM , Int_t iCol, Int_t iRow) const { return fEMCALRecoUtils->GetEMCALChannelRecalibrationFactor(iSM , iCol, iRow) ; } Float_t GetPHOSChannelRecalibrationFactor (Int_t imod, Int_t iCol, Int_t iRow) const { if(fPHOSRecalibrationFactors) return (Float_t) ((TH2F*)fPHOSRecalibrationFactors->At(imod))->GetBinContent(iCol,iRow); else return 1 ; } void SetEMCALChannelRecalibrationFactor(Int_t iSM , Int_t iCol, Int_t iRow, Double_t c = 1) { fEMCALRecoUtils->SetEMCALChannelRecalibrationFactor(iSM,iCol,iRow,c) ; } void SetPHOSChannelRecalibrationFactor (Int_t imod, Int_t iCol, Int_t iRow, Double_t c = 1) { if(!fPHOSRecalibrationFactors) InitPHOSRecalibrationFactors(); ((TH2F*)fPHOSRecalibrationFactors->At(imod))->SetBinContent(iCol,iRow,c) ; } void SetEMCALChannelRecalibrationFactors(Int_t iSM , TH2F* h) { fEMCALRecoUtils->SetEMCALChannelRecalibrationFactors(iSM,h) ; } void SetPHOSChannelRecalibrationFactors(Int_t imod , TH2F* h) { fPHOSRecalibrationFactors ->AddAt(h,imod) ; } TH2F * GetEMCALChannelRecalibrationFactors(Int_t iSM) const { return fEMCALRecoUtils->GetEMCALChannelRecalibrationFactors(iSM) ; } TH2F * GetPHOSChannelRecalibrationFactors(Int_t imod) const { return (TH2F*)fPHOSRecalibrationFactors->At(imod) ; } void SetEMCALChannelRecalibrationFactors(TObjArray *map) { fEMCALRecoUtils->SetEMCALChannelRecalibrationFactors(map) ; } void SetPHOSChannelRecalibrationFactors (TObjArray *map) { fPHOSRecalibrationFactors = map;} void RecalibrateCellTime (Double_t & time, const TString calo, const Int_t absId, const Int_t bunchCrossNumber) const ; void RecalibrateCellAmplitude(Float_t & amp, const TString calo, const Int_t absId) const ; Float_t RecalibrateClusterEnergy(AliVCluster* cluster, AliVCaloCells * cells); //EMCAL specific utils for the moment void SetEMCALRecoUtils(AliEMCALRecoUtils * ru) { fEMCALRecoUtils = ru ; } AliEMCALRecoUtils* GetEMCALRecoUtils() const { return fEMCALRecoUtils ; } Bool_t IsCorrectionOfClusterEnergyOn() const { return fCorrectELinearity ; } void SwitchOnCorrectClusterLinearity() { fCorrectELinearity = kTRUE ; } void SwitchOffCorrectClusterLinearity() { fCorrectELinearity = kFALSE ; } void CorrectClusterEnergy(AliVCluster *cl); Bool_t IsRecalculationOfClusterPositionOn() const { return fRecalculatePosition ; } void SwitchOnRecalculateClusterPosition() { fRecalculatePosition = kTRUE ; } void SwitchOffRecalculateClusterPosition() { fRecalculatePosition = kFALSE ; } void RecalculateClusterPosition(AliVCaloCells* cells, AliVCluster* clu); void RecalculateClusterShowerShapeParameters(AliVCaloCells* cells, AliVCluster* clu){ fEMCALRecoUtils->RecalculateClusterShowerShapeParameters((AliEMCALGeometry*)fEMCALGeo, cells, clu) ; } void RecalculateClusterDistanceToBadChannel(AliVCaloCells* cells, AliVCluster* clu){ fEMCALRecoUtils->RecalculateClusterDistanceToBadChannel((AliEMCALGeometry*)fEMCALGeo, cells, clu) ; } void RecalculateClusterPID(AliVCluster* clu) { fEMCALRecoUtils->RecalculateClusterPID(clu) ; } // *** Track Matching *** AliVTrack * GetMatchedTrack(const AliVCluster * cluster, const AliVEvent * event, const Int_t index = 0) const ; // Recalculation void RecalculateClusterTrackMatching(AliVEvent * event, TObjArray* clusterArray = 0x0) ; void GetMatchedResiduals(Int_t index, Float_t &dR, Float_t &dZ) { if (fRecalculateMatching) fEMCALRecoUtils->GetMatchedResiduals(index,dR,dZ) ; } //This could be used for PHOS ... void SwitchOnRecalculateClusterTrackMatching() { fRecalculateMatching = kTRUE ; } void SwitchOffRecalculateClusterTrackMatching() { fRecalculateMatching = kFALSE ; } Bool_t IsRecalculationOfClusterTrackMatchingOn() const { return fRecalculateMatching ; } Float_t GetCutZ() const { return fCutZ ; } // PHOS only void SetCutZ(Float_t z) { fCutZ = z ; } // PHOS only Float_t GetCutR() const { return fCutR ; } // PHOS and EMCAL void SetCutR(Float_t r) { fCutR = r ; // PHOS and EMCA fEMCALRecoUtils->SetCutR(r) ; } Float_t GetCutEta() const { return fCutEta ; } // EMCAL only void SetCutEta(Float_t e) { fCutEta = e ; // EMCAL only fEMCALRecoUtils->SetCutEta(e) ; } Float_t GetCutPhi() const { return fCutPhi ; } // EMCAL only void SetCutPhi(Float_t p) { fCutPhi = p ; // EMCAL only fEMCALRecoUtils->SetCutPhi(p) ; } private: Int_t fDebug; // Debugging level TString fEMCALGeoName; // Name of geometry to use for EMCAL. TString fPHOSGeoName; // Name of geometry to use for PHOS. AliEMCALGeometry * fEMCALGeo ; //! EMCAL geometry pointer AliPHOSGeoUtils * fPHOSGeo ; //! PHOS geometry pointer Bool_t fEMCALGeoMatrixSet; // Check if the transformation matrix is set for EMCAL Bool_t fPHOSGeoMatrixSet ; // Check if the transformation matrix is set for PHOS Bool_t fLoadEMCALMatrices; // Matrices set from configuration, not get from geometry.root or from ESDs/AODs TGeoHMatrix * fEMCALMatrix[12]; // Geometry matrices with alignments Bool_t fLoadPHOSMatrices; // Matrices set from configuration, not get from geometry.root or from ESDs/AODs TGeoHMatrix * fPHOSMatrix[5]; // Geometry matrices with alignments Bool_t fRemoveBadChannels; // Check the channel status provided and remove clusters with bad channels TObjArray * fPHOSBadChannelMap; // Array of histograms with map of bad channels, PHOS Int_t fNCellsFromPHOSBorder; // Number of cells from PHOS border the cell with maximum amplitude has to be. Int_t fNMaskCellColumns; // Number of masked columns Int_t* fMaskCellColumns; //[fNMaskCellColumns] list of masked cell collumn Bool_t fRecalibration; // Switch on or off the recalibration TObjArray * fPHOSRecalibrationFactors; // Array of histograms with map of recalibration factors, PHOS AliEMCALRecoUtils* fEMCALRecoUtils; // EMCAL utils for cluster rereconstruction Bool_t fRecalculatePosition; // Recalculate cluster position Bool_t fCorrectELinearity ; // Correct cluster energy linearity Bool_t fRecalculateMatching; // Recalculate cluster position Float_t fCutR; // dR cut on matching (PHOS) Float_t fCutZ; // dZ cut on matching (EMCAL/PHOS) Float_t fCutEta; // dEta cut on matching (EMCAL) Float_t fCutPhi; // dPhi cut on matching (EMCAL) Float_t fLocMaxCutE; // Local maxima cut must have more than this energy Float_t fLocMaxCutEDiff; // Local maxima cut, when aggregating cells, next can be a bit higher Bool_t fPlotCluster; // Plot cluster in splitting method AliCalorimeterUtils( const AliCalorimeterUtils & cu) ; // cpy ctor AliCalorimeterUtils & operator = (const AliCalorimeterUtils & cu) ; // cpy assignment ClassDef(AliCalorimeterUtils,12) } ; #endif //ALICALORIMETERUTILS_H