////////////////////////////////////////////////////////////////////////
// //
// EMCAL tender, apply corrections to EMCAl clusters //
-// and do track matching //
-// Author : Deepa Thomas (Utrecht University) //
+// and do track matching. //
+// Author: Deepa Thomas (Utrecht University) //
+// Later mods/rewrite: Jiri Kral (University of Jyvaskyla) //
+// S. Aiola, C. Loizides : Make it work for AODs //
// //
////////////////////////////////////////////////////////////////////////
-#include <AliTenderSupply.h>
+#include "AliTenderSupply.h"
+
+class TTree;
+class TClonesArray;
class AliVCluster;
class AliEMCALRecoUtils;
class TTree;
class TFile;
class TString;
+class AliEMCALClusterizer;
+class AliEMCALAfterBurnerUF;
+class AliEMCALRecParam;
+class AliAnalysisTaskSE;
+class AliVEvent;
class AliEMCALTenderSupply: public AliTenderSupply {
public:
AliEMCALTenderSupply();
AliEMCALTenderSupply(const char *name, const AliTender *tender=NULL);
+ AliEMCALTenderSupply(const char *name, AliAnalysisTaskSE *task);
virtual ~AliEMCALTenderSupply();
- virtual void Init();
- virtual void ProcessEvent();
-
-
- void SetEMCALGeometryName(TString name) { fEMCALGeoName = name ;}
- TString EMCALGeometryName() const { return fEMCALGeoName ;}
+ enum NonlinearityFunctions{kPi0MC=0,kPi0GammaGamma=1,kPi0GammaConversion=2,kNoCorrection=3,kBeamTest=4,kBeamTestCorrected=5};
+ enum MisalignSettings{kdefault=0,kSurveybyS=1,kSurveybyM=2};
+
+ virtual void Init();
+ virtual void ProcessEvent();
- void SetDebugLevel(Int_t level) {fDebugLevel=level ;}
+ void SetTask(AliAnalysisTaskSE *task) { fTask = task ;}
+ void SetDefaults();
+
+ void SetEMCALGeometryName(const char *name) { fEMCALGeoName = name ;}
+ TString EMCALGeometryName() const { return fEMCALGeoName ;}
+
+ void SetDebugLevel(Int_t level) { fDebugLevel=level ;}
+
+ void SetBasePath(const Char_t *basePath) { fBasePath = basePath ;}
+
+ void SetConfigFileName(const char *name) { fConfigName = name ;}
- void SetNonLinearityFunction(Int_t fun) { fNonLinearFunc = fun ;}
- Int_t GetNonLinearityFunction() const { return fNonLinearFunc ;}
+ void SetNonLinearityFunction(Int_t fun) { fNonLinearFunc = fun ;}
+ Int_t GetNonLinearityFunction() const { return fNonLinearFunc ;}
- void SetNonLinearityThreshold(Int_t threshold) { fNonLinearThreshold = threshold ;} //only for Alexei's non linearity correction
- Int_t GetNonLinearityThreshold() const { return fNonLinearThreshold ;}
+ void SetNonLinearityThreshold(Int_t threshold) { fNonLinearThreshold = threshold ;} //only for Alexei's non linearity correction
+ Int_t GetNonLinearityThreshold() const { return fNonLinearThreshold ;}
- void SwitchOnReCalibrateCluster() { fReCalibCluster = kTRUE ;}
- void SwitchOffReCalibrateCluster() { fReCalibCluster = kFALSE ;}
+ void SwitchOnNonLinearityCorrection() { fDoNonLinearity = kTRUE ;}
+ void SwitchOffNonLinearityCorrection() { fDoNonLinearity = kFALSE ;}
- void SwitchOnReCalibrateCell() { fReCalibCell = kTRUE ;}
- void SwitchOffReCalibrateCell() { fReCalibCell = kFALSE ;}
+ void SwitchOnReCalibrateCluster() { fReCalibCluster = kTRUE ;}
+ void SwitchOffReCalibrateCluster() { fReCalibCluster = kFALSE ;}
- void SwitchOnRecalculateClusPos() { fRecalClusPos = kTRUE ;}
- void SwitchOffRecalculateClusPos() { fRecalClusPos = kFALSE ;}
+ void SwitchOnRecalculateClusPos() { fRecalClusPos = kTRUE ;}
+ void SwitchOffRecalculateClusPos() { fRecalClusPos = kFALSE ;}
- void SwitchOnCellFiducialRegion() { fFiducial = kTRUE ;}
- void SwitchOffCellFiducialRegion() { fFiducial = kFALSE ;}
+ void SetMisalignmentMatrixSurvey(Int_t misalignSurvey) { fMisalignSurvey = misalignSurvey ;}
+ Int_t GetMisalignmentMatrixSurvey() const { return fMisalignSurvey ;}
- void SetNumberOfcellsFromEMCALBorder(Int_t n) { fNCellsFromEMCALBorder = n ;}
- Int_t GetNumberOfcellsFromEMCALBorder() const { return fNCellsFromEMCALBorder ;}
+ void SwitchOnCellFiducialRegion() { fFiducial = kTRUE ;}
+ void SwitchOffCellFiducialRegion() { fFiducial = kFALSE ;}
- void SwitchOnRecalDistBadChannel() { fRecalDistToBadChannels = kTRUE ;}
- void SwitchOffRecalDistBadChannel() { fRecalDistToBadChannels = kFALSE ;}
+ void SetNumberOfCellsFromEMCALBorder(Int_t n) { fNCellsFromEMCALBorder = n ;}
+ Int_t GetNumberOfCellsFromEMCALBorder() const { return fNCellsFromEMCALBorder ;}
- Float_t GetRCut() const { return fRcut ;}
- void SetRCut(Float_t Rcut) { fRcut = Rcut ;}
+ void SwitchOnRecalDistBadChannel() { fRecalDistToBadChannels = kTRUE ;}
+ void SwitchOffRecalDistBadChannel() { fRecalDistToBadChannels = kFALSE ;}
- Double_t GetMass() const { return fMass ;}
- void SetMass(Double_t mass){ fMass=mass ;}
+ void SwitchOnRecalShowerShape() { fRecalShowerShape = kTRUE ;}
+ void SwitchOffRecalShowerShape() { fRecalShowerShape = kFALSE ;}
- Double_t GetStep() const { return fStep ;}
- void SetStep(Double_t step){ fStep=step ;}
+ Float_t GetRCut() const { return fRcut ;}
+ void SetRCut(Float_t rcut) { fRcut = rcut ;}
-
-private:
+ Double_t GetMass() const { return fMass ;}
+ void SetMass(Double_t mass) { fMass = mass ;}
- Bool_t InitBadChannels();
- Bool_t InitRecalibCluster();
- Bool_t InitMisalignMatrix();
-
- void SetClusterMatchedToTrack(AliESDEvent *event);
- void SetTracksMatchedToCluster(AliESDEvent *event);
+ Double_t GetStep() const { return fStep ;}
+ void SetStep(Double_t step) { fStep = step ;}
+
+ Double_t GetEtaCut() const { return fEtacut ;}
+ void SetEtaCut(Double_t eta) { fEtacut = eta ;}
+
+ Double_t GetPhiCut() const { return fPhicut ;}
+ void SetPhiCut(Double_t phi) { fPhicut = phi ;}
- void RecalibrateCells(); //Recalibrate cells
+ Float_t GetExoticCellFraction() const { return fExoticCellFraction ;}
+ void SetExoticCellFraction(Float_t f) { fExoticCellFraction = f ;}
- AliEMCALGeometry *fEMCALGeo; //! EMCAL geometry
- TString fEMCALGeoName; // Name of geometry to use.
+ Float_t GetExoticCellDiffTime() const { return fExoticCellDiffTime ;}
+ void SetExoticCellDiffTime(Float_t f) { fExoticCellDiffTime = f ;}
+
+ Float_t GetExoticCellMinAmplitude() const { return fExoticCellMinAmplitude ;}
+ void SetExoticCellMinAmplitude(Float_t f) { fExoticCellMinAmplitude = f ;}
+
+ void SwitchOnReclustering() { fReClusterize = kTRUE ;}
+ void SwitchOffReclustering() { fReClusterize = kFALSE ;}
+
+ void SwitchOnCutEtaPhiSum() { fCutEtaPhiSum=kTRUE; fCutEtaPhiSeparate=kFALSE ;}
+ void SwitchOnCutEtaPhiSeparate() { fCutEtaPhiSeparate=kTRUE; fCutEtaPhiSum=kFALSE ;}
- AliEMCALRecoUtils *fEMCALRecoUtils; // Pointer to EMCAL utilities for clusterization
- TString fConfigName; // Name of analysis configuration file
+ void SwitchOnLoadOwnGeometryMatrices() { fLoadGeomMatrices = kTRUE ;}
+ void SwitchOffLoadOwnGeometryMatrices() { fLoadGeomMatrices = kFALSE ;}
+ void SetGeometryMatrixInSM(TGeoHMatrix* m, Int_t i) { fEMCALMatrix[i] = m ;}
- Int_t fDebugLevel; // debug level
+ AliEMCALRecParam *GetRecParam() const { return fRecParam ;}
+ void SetRecParam(AliEMCALRecParam *p) { fRecParam = p ;}
+
+ AliEMCALRecoUtils *GetRecoUtils() const { return fEMCALRecoUtils ;}
+ void SetRecoUtils(AliEMCALRecoUtils *r) { fEMCALRecoUtils = r ;}
+
+ void SwitchOnUpdateCell() { fUpdateCell = kTRUE ;}
+ void SwitchOffUpdateCell() { fUpdateCell = kFALSE ;}
- Int_t fNonLinearFunc; // Non linearity function
- Int_t fNonLinearThreshold; // Non linearity threshold value for kBeamTesh non linearity function
+ void SwitchOnBadCellRemove() { fBadCellRemove = kTRUE ;}
+ void SwitchOffBadCellRemove() { fBadCellRemove = kFALSE ;}
- Bool_t fReCalibCluster; // switch for Recalibrate clusters
- Bool_t fReCalibCell; // switch for Recalibrate cell
+ void SwitchOnClusterBadChannelCheck() { fClusterBadChannelCheck = kTRUE ;}
+ void SwitchOffClusterBadChannelCheck() { fClusterBadChannelCheck = kFALSE ;}
- TGeoHMatrix *fEMCALMatrix[10]; // Geometry matrices with alignments
- Bool_t fRecalClusPos; // switch for applying missalignment
+ void SwitchOnExoticCellRemove() { fRejectExoticCells = kTRUE ;}
+ void SwitchOffExoticCellRemove() { fRejectExoticCells = kFALSE ;}
- Bool_t fFiducial; // switch for checking cells in the fiducial region
- Int_t fNCellsFromEMCALBorder; // number os cells from EMCAL border
- Bool_t fRecalDistToBadChannels; // switch for recalculation cluster position from bad channel
+ void SwitchOnClusterExoticChannelCheck() { fRejectExoticClusters = kTRUE ;}
+ void SwitchOffClusterExoticChannelCheck() { fRejectExoticClusters = kFALSE ;}
- TTree *fInputTree; // input data tree
- TFile *fInputFile; // input data file
- TString fFilepass; // input data pass number
+ void SwitchOnCalibrateEnergy() { fCalibrateEnergy = kTRUE ;}
+ void SwitchOffCalibrateEnergy() { fCalibrateEnergy = kFALSE ;}
- Double_t fMass; // mass for track matching
- Double_t fStep; // step size during track matching
- Float_t fRcut; // residual cut for track matching
+ void SwitchOnCalibrateTime() { fCalibrateTime = kTRUE ;}
+ void SwitchOffCalibrateTime() { fCalibrateTime = kFALSE ;}
- AliEMCALTenderSupply(const AliEMCALTenderSupply&c);
- AliEMCALTenderSupply& operator= (const AliEMCALTenderSupply&c);
+ void SwitchOnUpdateCellOnly() { fDoUpdateOnly = kTRUE ;}
+ void SwitchOffUpdateCellOnly() { fDoUpdateOnly = kFALSE ;}
+
+ void SwitchOnTrackMatch() { fDoTrackMatch = kTRUE ;}
+ void SwitchOffTrackMatch() { fDoTrackMatch = kFALSE ;}
+
+ void SetPass(const char* p) { fFilepass = p; fGetPassFromFileName = kFALSE; }
+ void UnsetPass() { fFilepass = ""; fGetPassFromFileName = kTRUE; }
- ClassDef(AliEMCALTenderSupply, 2); // TPC tender task
-};
+ //MC label methods
+
+ void RemapMCLabelForAODs(Int_t &label);
+ void SwitchOnRemapMCLabelForAODs() { fRemapMCLabelForAODs = kTRUE ; }
+ void SwitchOffRemapMCLabelForAODs() { fRemapMCLabelForAODs = kFALSE ; }
+
+ void SetClustersMCLabelFromOriginalClusters() ;
+ void SwitchOnUseClusterMCLabelForCell(Int_t opt = 2) { fSetCellMCLabelFromCluster = opt ; }
+ void SwitchOffUseClusterMCLabelForCell() { fSetCellMCLabelFromCluster = 0 ; }
+
+private:
-#endif
+ AliVEvent* GetEvent();
+ TString GetBeamType();
+ Bool_t RunChanged() const;
+ Int_t InitBadChannels();
+ Bool_t InitClusterization();
+ Int_t InitRecParam();
+ Bool_t InitMisalignMatrix();
+ Int_t InitRecalib();
+ Int_t InitRunDepRecalib();
+ Int_t InitTimeCalibration();
+ void Clusterize();
+ void FillDigitsArray();
+ void GetPass();
+ void RecPoints2Clusters(TClonesArray *clus);
+ void RecalibrateCells();
+ void UpdateCells();
+ void UpdateClusters();
+
+ AliAnalysisTaskSE *fTask; // analysis task
+ Int_t fRun; // current run number
+ AliEMCALGeometry *fEMCALGeo; // EMCAL geometry
+ TString fEMCALGeoName; // name of geometry to use.
+ AliEMCALRecoUtils *fEMCALRecoUtils; // pointer to EMCAL utilities for clusterization
+ TString fConfigName; // name of analysis configuration file
+ Int_t fDebugLevel; // debug level
+ Int_t fNonLinearFunc; // non linearity function
+ Int_t fNonLinearThreshold; // non linearity threshold value for kBeamTesh non linearity function
+ Bool_t fReCalibCluster; // switch for Recalibrate clusters
+ Bool_t fUpdateCell; // flag cell update
+ Bool_t fCalibrateEnergy; // flag cell energy calibration
+ Bool_t fCalibrateTime; // flag cell time calibration
+ Bool_t fCalibrateTimeParamAvailable; // Check if time calib param are available to set properly time cuts
+ Bool_t fDoNonLinearity; // nNon linearity correction flag
+ Bool_t fBadCellRemove; // zero bad cells
+ Bool_t fRejectExoticCells; // reject exotic cells
+ Bool_t fRejectExoticClusters; // recect clusters with exotic cells
+ Bool_t fClusterBadChannelCheck; // check clusters for bad channels
+ TGeoHMatrix *fEMCALMatrix[12]; // geometry matrices with misalignments
+ Bool_t fRecalClusPos; // switch for applying missalignment
+ Bool_t fFiducial; // switch for checking cells in the fiducial region
+ Int_t fNCellsFromEMCALBorder; // number os cells from EMCAL border
+ Bool_t fRecalDistToBadChannels; // switch for recalculation cluster position from bad channel
+ Bool_t fRecalShowerShape; // switch for recalculation of the shower shape
+ TTree *fInputTree; //!input data tree
+ TFile *fInputFile; //!input data file
+ Bool_t fGetPassFromFileName; // get fFilepass from file name
+ TString fFilepass; // input data pass number
+ Double_t fMass; // mass for track matching
+ Double_t fStep; // step size during track matching
+ Bool_t fCutEtaPhiSum; // swicth to apply residual cut together
+ Bool_t fCutEtaPhiSeparate; // swicth to apply residual cut separately
+ Float_t fRcut; // residual cut for track matching
+ Float_t fEtacut; // eta cut for track matching
+ Float_t fPhicut; // phi cut for track matching
+ TString fBasePath; // base folder path to get root files
+ Bool_t fReClusterize; // switch for reclustering
+ AliEMCALClusterizer *fClusterizer; //!clusterizer
+ Bool_t fGeomMatrixSet; // set geometry matrices only once, for the first event.
+ Bool_t fLoadGeomMatrices; // matrices set from configuration, not get from geometry.root or from ESDs/AODs
+ AliEMCALRecParam *fRecParam; // reconstruction parameters container
+ Bool_t fDoTrackMatch; // do track matching
+ Bool_t fDoUpdateOnly; // do only update of cells
+ AliEMCALAfterBurnerUF *fUnfolder; //!unfolding procedure
+ TClonesArray *fDigitsArr; //!digits array
+ TObjArray *fClusterArr; //!recpoints array
+ Int_t fMisalignSurvey; // misalignment matrix survey
+ Float_t fExoticCellFraction; // good cell if fraction < 1-ecross/ecell
+ Float_t fExoticCellDiffTime; // if time of candidate to exotic and close cell is too different (in ns), it must be noisy, set amp to 0
+ Float_t fExoticCellMinAmplitude; // check for exotic only if amplitud is larger than this value
+ // MC labels
+ Int_t fOrgClusterCellId[12672]; // Array ID of cluster to wich the cell belongs in unmodified clusters
+
+ Int_t fSetCellMCLabelFromCluster; // Use cluster MC label as cell label:
+ // 0 - get the MC label stored in cells
+ // 1 - assign to the cell the MC lable of the cluster
+ // 2 - get the original clusters id, add all the MC labels
+ TClonesArray * fTempClusterArr ; //! Temporal clusters array to recover the MC of original cluster if fSetCellMCLabelFromCluster=2
+ Bool_t fRemapMCLabelForAODs ; // Remap AOD cells MC label
+
+ AliEMCALTenderSupply( const AliEMCALTenderSupply&c);
+ AliEMCALTenderSupply& operator= (const AliEMCALTenderSupply&c);
+
+ ClassDef(AliEMCALTenderSupply, 16); // EMCAL tender task
+};
+#endif