ROOT logo
#ifndef ALIPHOSTENDERSUPPLY_H
#define ALIPHOSTENDERSUPPLY_H

/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 * See cxx source for full Copyright notice                               */

////////////////////////////////////////////////////////////////////////
//                                                                    //
//  PHOS tender, apply corrections to PHOS clusters                   //
//  and do track matching                                             //
//  Author : Dmitri Peressounko (RRC KI)                              //
//                                                                    //
////////////////////////////////////////////////////////////////////////

#include <AliTenderSupply.h>

class TVector3;
class AliPHOSGeometry;
class AliPHOSCalibData ;
class TH2I ;
class AliVCluster ;
class AliVCaloCells ;
class AliAnalysisTaskSE ;

class AliPHOSTenderSupply: public AliTenderSupply {
  
public:
  AliPHOSTenderSupply();
  AliPHOSTenderSupply(const char *name, const AliTender *tender=NULL);
  virtual ~AliPHOSTenderSupply();

  virtual void   Init(){}
  virtual void   ProcessEvent();
  
  void SetTask(AliAnalysisTaskSE * task){fTask=task;} //if work with AOD and special task
  
  void  SetNonlinearityVersion(const char * ver="Gustavo2005"){fNonlinearityVersion=ver;}
  void  SetNonlinearityParams(Int_t n, const Double_t * par){
            if(n>10){printf("Only 10 parameters allowed \n"); return ;}
            for(Int_t i=0;i<n;i++)fNonlinearityParams[i]=par[i]; }
  void  SetReconstructionPass(Int_t ipass=2){fRecoPass=ipass;}
  
  //Use this function to let tender know that it works with MC production
  //should read calibration from PHOSMCCalibration file and use object for specified production
  //By defaul real data is assumed.
  void SetMCProduction(const char * name ="LHC13_b2"){fIsMC=kTRUE ; fMCProduction=name ;}
  
  //If you want to override automatic choise of bad maps and calibration
  void ForceUsingBadMap(const char * filename="alien:///alice/cern.ch/user/p/prsnko/BadMaps/BadMap_LHC10b.root") ;
  void ForceUsingCalibration(const char * filename="alien:///alice/cern.ch/user/p/prsnko/Recalibrations/LHC10b_pass1.root") ;
  void   InitTender();

protected:
  AliPHOSTenderSupply(const AliPHOSTenderSupply&c);
  AliPHOSTenderSupply& operator= (const AliPHOSTenderSupply&c);
  void   FindTrackMatching(Int_t mod,TVector3 *locpos,Double_t &dx, Double_t &dz, Double_t &pttrack, Int_t &charge); 
  Float_t CorrectNonlinearity(Float_t en) ;
  Double_t TestCPV(Double_t dx, Double_t dz, Double_t pt, Int_t charge) ;
  Double_t TestCoreLambda(Double_t pt,Double_t l1,Double_t l2) ;
  Double_t TestFullLambda(Double_t pt,Double_t l1,Double_t l2) ;
  Bool_t IsGoodChannel(Int_t mod, Int_t ix, Int_t iz) ;
  void   CorrectPHOSMisalignment(TVector3 & globalPos, Int_t module);
  void   EvalLambdas(AliVCluster * clu, Double_t &m02, Double_t &m20) ;
  Double_t CoreEnergy(AliVCluster * clu) ;  
  Double_t EvalEcross(AliVCluster * clu) ;  
  Double_t EvalTOF(AliVCluster * clu,AliVCaloCells * cells); 
  Double_t CalibrateTOF(Double_t tof, Int_t absId, Bool_t isHG); 
  void DistanceToBadChannel(Int_t mod, TVector3 * locPos, Double_t &minDist) ;

 
private:

  TString fOCDBpass ;                        // Pass to OCDB recalibration object, local or alien
  TString fNonlinearityVersion;              // Version of non-linearity correction to aaply
  AliPHOSGeometry   *fPHOSGeo;               // PHOS geometry
  Double_t fNonlinearityParams[10] ;         // Parameters for non-linearity calculation
  TH2I * fPHOSBadMap[5] ;                    // Bad channels map
  Int_t fRecoPass ;                          // Reconstruction pass
  Bool_t fUsePrivateBadMap ;
  Bool_t fUsePrivateCalib ;
  
  AliPHOSCalibData *fPHOSCalibData;          // PHOS calibration object
  AliAnalysisTaskSE     *fTask;              // analysis task

  Bool_t fIsMC;                              //True if work with MC data
  TString fMCProduction ;                    //Name of MC production
 
  ClassDef(AliPHOSTenderSupply, 2); // PHOS tender task
};


#endif


 AliPHOSTenderSupply.h:1
 AliPHOSTenderSupply.h:2
 AliPHOSTenderSupply.h:3
 AliPHOSTenderSupply.h:4
 AliPHOSTenderSupply.h:5
 AliPHOSTenderSupply.h:6
 AliPHOSTenderSupply.h:7
 AliPHOSTenderSupply.h:8
 AliPHOSTenderSupply.h:9
 AliPHOSTenderSupply.h:10
 AliPHOSTenderSupply.h:11
 AliPHOSTenderSupply.h:12
 AliPHOSTenderSupply.h:13
 AliPHOSTenderSupply.h:14
 AliPHOSTenderSupply.h:15
 AliPHOSTenderSupply.h:16
 AliPHOSTenderSupply.h:17
 AliPHOSTenderSupply.h:18
 AliPHOSTenderSupply.h:19
 AliPHOSTenderSupply.h:20
 AliPHOSTenderSupply.h:21
 AliPHOSTenderSupply.h:22
 AliPHOSTenderSupply.h:23
 AliPHOSTenderSupply.h:24
 AliPHOSTenderSupply.h:25
 AliPHOSTenderSupply.h:26
 AliPHOSTenderSupply.h:27
 AliPHOSTenderSupply.h:28
 AliPHOSTenderSupply.h:29
 AliPHOSTenderSupply.h:30
 AliPHOSTenderSupply.h:31
 AliPHOSTenderSupply.h:32
 AliPHOSTenderSupply.h:33
 AliPHOSTenderSupply.h:34
 AliPHOSTenderSupply.h:35
 AliPHOSTenderSupply.h:36
 AliPHOSTenderSupply.h:37
 AliPHOSTenderSupply.h:38
 AliPHOSTenderSupply.h:39
 AliPHOSTenderSupply.h:40
 AliPHOSTenderSupply.h:41
 AliPHOSTenderSupply.h:42
 AliPHOSTenderSupply.h:43
 AliPHOSTenderSupply.h:44
 AliPHOSTenderSupply.h:45
 AliPHOSTenderSupply.h:46
 AliPHOSTenderSupply.h:47
 AliPHOSTenderSupply.h:48
 AliPHOSTenderSupply.h:49
 AliPHOSTenderSupply.h:50
 AliPHOSTenderSupply.h:51
 AliPHOSTenderSupply.h:52
 AliPHOSTenderSupply.h:53
 AliPHOSTenderSupply.h:54
 AliPHOSTenderSupply.h:55
 AliPHOSTenderSupply.h:56
 AliPHOSTenderSupply.h:57
 AliPHOSTenderSupply.h:58
 AliPHOSTenderSupply.h:59
 AliPHOSTenderSupply.h:60
 AliPHOSTenderSupply.h:61
 AliPHOSTenderSupply.h:62
 AliPHOSTenderSupply.h:63
 AliPHOSTenderSupply.h:64
 AliPHOSTenderSupply.h:65
 AliPHOSTenderSupply.h:66
 AliPHOSTenderSupply.h:67
 AliPHOSTenderSupply.h:68
 AliPHOSTenderSupply.h:69
 AliPHOSTenderSupply.h:70
 AliPHOSTenderSupply.h:71
 AliPHOSTenderSupply.h:72
 AliPHOSTenderSupply.h:73
 AliPHOSTenderSupply.h:74
 AliPHOSTenderSupply.h:75
 AliPHOSTenderSupply.h:76
 AliPHOSTenderSupply.h:77
 AliPHOSTenderSupply.h:78
 AliPHOSTenderSupply.h:79
 AliPHOSTenderSupply.h:80
 AliPHOSTenderSupply.h:81
 AliPHOSTenderSupply.h:82
 AliPHOSTenderSupply.h:83
 AliPHOSTenderSupply.h:84
 AliPHOSTenderSupply.h:85
 AliPHOSTenderSupply.h:86
 AliPHOSTenderSupply.h:87
 AliPHOSTenderSupply.h:88
 AliPHOSTenderSupply.h:89
 AliPHOSTenderSupply.h:90
 AliPHOSTenderSupply.h:91
 AliPHOSTenderSupply.h:92
 AliPHOSTenderSupply.h:93
 AliPHOSTenderSupply.h:94