]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HMPID/AliHMPIDParam.h
reduce arguments AddTaskPWG4HighPtTrackQA
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDParam.h
index c784f1c17c467cc040927595b3c129608f6cc11b..69756b662923a6286fcac97217fcbbc524a132b2 100644 (file)
@@ -5,6 +5,7 @@
 
 /* $Id$ */
 
+#include "stdio.h"
 #include <TMath.h>
 #include <TNamed.h>        //base class
 #include <TGeoManager.h>   //Instance()
@@ -29,7 +30,9 @@ public:
   enum EChamberData{kMinCh=0,kMaxCh=6,kMinPc=0,kMaxPc=5};      //Segmenation
   enum EPadxData{kPadPcX=80,kMinPx=0,kMaxPx=79,kMaxPcx=159};   //Segmentation structure along x
   enum EPadyData{kPadPcY=48,kMinPy=0,kMaxPy=47,kMaxPcy=143};   //Segmentation structure along y 
-  enum EPedestalData{kPadMeanZeroCharge=4000,kPadSigmaZeroCharge=1000,kPadMeanMasked=4001,kPadSigmaMasked=1001}; //Pedestal pad data information
+  //The electronics takes the 32bit int as: first 9 bits for the pedestal and the second 9 bits for threshold - values below should be within range
+  enum EPedestalData{kPadMeanZeroCharge=400,kPadSigmaZeroCharge=20,kPadMeanMasked=401,kPadSigmaMasked=20};         //One can go up to 5 sigma cut, overflow is protected in AliHMPIDCalib
+  
       
   static Float_t r2d         (                               )     {return 57.2957795;                               }
   static Float_t SizePadX    (                               )     {return fgCellX;                                  }  //pad size x, [cm]  
@@ -41,7 +44,7 @@ public:
   static Float_t MaxPcY      (Int_t iPc                      )     {return fgkMaxPcY[iPc];                           }  // PC limits
   static Float_t MinPcX      (Int_t iPc                      )     {return fgkMinPcX[iPc];                           }  // PC limits
   static Float_t MinPcY      (Int_t iPc                      )     {return fgkMinPcY[iPc];                           }  // PC limits
-  static Int_t   Nsig        (                               )     {return fgSigmas;                                 }  //Getter n. sigmas for noise
+  static Int_t   Nsig        (                               )     {return fgNSigmas;                                 }  //Getter n. sigmas for noise
   static Float_t SizeAllX    (                               )     {return fgAllX;                                   }  //all PCs size x, [cm]        
   static Float_t SizeAllY    (                               )     {return fgAllY;                                   }  //all PCs size y, [cm]    
 
@@ -62,19 +65,28 @@ public:
   static Int_t   A2X         (Int_t pad                      )     {return pad%1000000/1000;                         }  //abs pad -> pad X 
   static Int_t   A2Y         (Int_t pad                      )     {return pad%1000;                                 }  //abs pad -> pad Y 
 
-  static Bool_t  IsOverTh    (Float_t q                      )     {return q >= fgSigmas;                            }  //is digit over threshold?
+  static Bool_t  IsOverTh    (Float_t q                      )     {return q >= fgThreshold;                         }  //is digit over threshold?
   
   Bool_t  GetInstType        (                               )const{return fgInstanceType;                            }  //return if the instance is from geom or ideal                        
   
   inline static Bool_t IsInDead(Float_t x,Float_t y        );                                                           //is the point in dead area?
+  inline static Bool_t IsDeadPad(Int_t padx,Int_t pady,Int_t ch);                                                       //is a dead pad?
+  
+  inline void SetChStatus(Int_t ch,Bool_t status=kTRUE);
+  inline void SetSectStatus(Int_t ch,Int_t sect,Bool_t status); 
+  inline void SetPcStatus(Int_t ch,Int_t pc,Bool_t status); 
+  inline void PrintChStatus(Int_t ch);
+  inline void SetGeomAccept();
+  
   inline static Int_t  InHVSector(           Float_t y     );                                                           //find HV sector
-  static Int_t  Radiator(          Float_t y               )       {if (InHVSector(y)<0) return -1; return InHVSector(y)/2;}
-  static Bool_t  IsInside    (Float_t x,Float_t y,Float_t d=0)     {return  x>-d&&y>-d&&x<fgkMaxPcX[kMaxPc]+d&&y<fgkMaxPcY[kMaxPc]+d; } //is point inside chamber boundaries?
+  static Int_t     Radiator(          Float_t y               )       {if (InHVSector(y)<0) return -1; return InHVSector(y)/2;}
+  static Double_t  HinRad(Float_t y)         {if (Radiator(y)<0) return -1;return y-Radiator(y)*fgkMinPcY[Radiator(y)];}                                   // height in the radiator to estimate temperature from gradient
+  static Bool_t    IsInside    (Float_t x,Float_t y,Float_t d=0)     {return  x>-d&&y>-d&&x<fgkMaxPcX[kMaxPc]+d&&y<fgkMaxPcY[kMaxPc]+d; } //is point inside chamber boundaries?
 
   //For optical properties
   static Double_t   EPhotMin()                       {return 5.5;}           //
   static Double_t   EPhotMax()                       {return 8.5;}           //Photon energy range,[eV]
-  static Double_t NIdxRad(Double_t eV,Double_t temp) {return TMath::Sqrt(1+0.554*(1239.84/eV)*(1239.84/eV)/((1239.84/eV)*(1239.84/eV)-5769)-0.0005*(temp-20));}
+  static Double_t NIdxRad(Double_t eV,Double_t temp) {return TMath::Sqrt(1+0.554*(1239.84/eV)*(1239.84/eV)/((1239.84/eV)*(1239.84/eV)-5769))-0.0005*(temp-20);}
   static Double_t NIdxWin(Double_t eV)               {return TMath::Sqrt(1+46.411/(10.666*10.666-eV*eV)+228.71/(18.125*18.125-eV*eV));}  
   static Double_t NMgF2Idx(Double_t eV)              {return 1.7744 - 2.866e-3*(1239.842609/eV) + 5.5564e-6*(1239.842609/eV)*(1239.842609/eV);}          // MgF2 idx of trasparency system
   static Double_t NIdxGap(Double_t eV)               {return 1+0.12489e-6/(2.62e-4 - eV*eV/1239.84/1239.84);}
@@ -94,7 +106,7 @@ public:
   //
   Float_t    DistCut                 ()const {return 1.0;}       //<--TEMPORAR--> to be removed in future. Cut for MIP-TRACK residual 
   Float_t    QCut                    ()const {return 100;}       //<--TEMPORAR--> to be removed in future. Separation PHOTON-MIP charge 
-  Float_t    MultCut                 ()const {return 200;}       //<--TEMPORAR--> to be removed in future. Multiplicity cut to activate WEIGHT procedure 
+  Float_t    MultCut                 ()const {return 30;}       //<--TEMPORAR--> to be removed in future. Multiplicity cut to activate WEIGHT procedure 
 
   Double_t   RadThick                ()const {return 1.5;}       //<--TEMPORAR--> to be removed in future. Radiator thickness
   Double_t   WinThick                ()const {return 0.5;}       //<--TEMPORAR--> to be removed in future. Window thickness
@@ -123,13 +135,16 @@ public:
   
   void     SetRefIdx      (Double_t refRadIdx                                  ) {fRefIdx = refRadIdx;}               //set running refractive index
   
-  void     SetSigmas      (Int_t sigmas                                        ) {fgSigmas = sigmas;}                 //set sigma cut    
+  void     SetNSigmas     (Int_t sigmas                                        ) {fgNSigmas   = sigmas;}                 //set sigma cut  
+  void     SetThreshold   (Int_t thres                                         ) {fgThreshold = thres;}                 //set sigma cut        
   void     SetInstanceType(Bool_t inst                                         ) {fgInstanceType = inst;}             //kTRUE if from geomatry kFALSE if from ideal geometry
   //For PID
-  Double_t SigLoc      (Double_t trkTheta,Double_t trkPhi,Double_t ckovTh,Double_t ckovPh,Double_t beta);//error due to cathode segmetation
-  Double_t SigGeom     (Double_t trkTheta,Double_t trkPhi,Double_t ckovTh,Double_t ckovPh,Double_t beta);//error due to unknown photon origin
-  Double_t SigCrom     (Double_t trkTheta,Double_t trkPhi,Double_t ckovTh,Double_t ckovPh,Double_t beta);//error due to unknonw photon energy
-  Double_t Sigma2      (Double_t trkTheta,Double_t trkPhi,Double_t ckovTh,Double_t ckovPh              );//photon candidate sigma^2
+  Double_t SigLoc         (Double_t trkTheta,Double_t trkPhi,Double_t ckovTh,Double_t ckovPh,Double_t beta);//error due to cathode segmetation
+  Double_t SigGeom        (Double_t trkTheta,Double_t trkPhi,Double_t ckovTh,Double_t ckovPh,Double_t beta);//error due to unknown photon origin
+  Double_t SigCrom        (Double_t trkTheta,Double_t trkPhi,Double_t ckovTh,Double_t ckovPh,Double_t beta);//error due to unknonw photon energy
+  Double_t Sigma2         (Double_t trkTheta,Double_t trkPhi,Double_t ckovTh,Double_t ckovPh              );//photon candidate sigma^2
+  
+  static Double_t SigmaCorrFact(Int_t iPart, Double_t occupancy                                         );//correction factor for theoretical resolution
 
   //Mathieson Getters
   
@@ -152,6 +167,8 @@ protected:
   static /*const*/ Float_t fgkMaxPcX[6];                                                           //limits PC
   static /*const*/ Float_t fgkMaxPcY[6]; 
   
+  static Bool_t fgMapPad[160][144][7];                                                                   //map of pads to evaluate if they are active or dead (160,144) pads for 7 chambers
+  
 // Mathieson constants
 // For HMPID --> x direction means parallel      to the wires: K3 = 0.66  (NIM A270 (1988) 602-603) fig.1  
 // For HMPID --> y direction means perpendicular to the wires: K3 = 0.90  (NIM A270 (1988) 602-603) fig.2  
@@ -163,7 +180,8 @@ protected:
   static const Double_t fgkSqrtK3y,fgkK2y,fgkK1y,fgkK4y;
 //
     
-  static Int_t    fgSigmas;                                                                        //sigma Cut
+  static Int_t    fgNSigmas;                                                                        //sigma Cut
+  static Int_t    fgThreshold;                                                                        //sigma Cut
   static Bool_t   fgInstanceType;                                                                  //kTRUE if from geomatry kFALSE if from ideal geometry
 
   static Float_t fgCellX, fgCellY, fgPcX, fgPcY, fgAllX, fgAllY;                                   //definition of HMPID geometric parameters 
@@ -214,6 +232,17 @@ Bool_t AliHMPIDParam::IsInDead(Float_t x,Float_t y)
   return kTRUE;
 }
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+Bool_t AliHMPIDParam::IsDeadPad(Int_t padx,Int_t pady,Int_t ch)
+{
+// Check is the current pad is active or not
+// Arguments: padx,pady pad integer coord
+//   Returns: kTRUE if dead, kFALSE if active
+
+    if(fgMapPad[padx-1][pady-1][ch]) return kFALSE; //current pad active
+  
+  return kTRUE;
+}
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void AliHMPIDParam::Lors2Pad(Float_t x,Float_t y,Int_t &pc,Int_t &px,Int_t &py)
 {
 // Check the pad of given position
@@ -248,18 +277,92 @@ Int_t AliHMPIDParam::InHVSector(Float_t y)
 Double_t AliHMPIDParam::FindTemp(Double_t tLow,Double_t tHigh,Double_t y)
 {
 //  Model for gradient in temperature
+  Double_t yRad = HinRad(y);     //height in a given radiator
+  if(tHigh<tLow) tHigh = tLow;   //if Tout < Tin consider just Tin as reference...
+  if(yRad<0        ) yRad = 0;         //protection against fake y values
+  if(yRad>SizePcY()) yRad = SizePcY(); //protection against fake y values
   
-//  Double_t gradT = (t2-t1)/SizePcY();  // linear gradient
-//  return gradT*y+t1;
-  Double_t halfPadSize = 0.5*SizePadY();
-  Double_t result = tLow;
-  Double_t delta = (TMath::Log(tHigh)-TMath::Log(tLow));
-  if (TMath::Abs(delta)>0) {
-    Double_t gradT = (TMath::Log(SizePcY()) - TMath::Log(halfPadSize))/delta;
-    if(y<0) y = 0;
-    result += TMath::Power(y/halfPadSize,1./gradT);
-  }
-  return result;    
+  Double_t gradT = (tHigh-tLow)/SizePcY();  // linear gradient
+  return gradT*yRad+tLow;
 }
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+void AliHMPIDParam::SetChStatus(Int_t ch,Bool_t status)
+{
+//Set a chamber on or off depending on the status
+//Arguments: ch=chamber,status=kTRUE = active, kFALSE=off
+//Returns: none
+  for(Int_t padx=0;padx<kMaxPcx+1;padx++) {
+     for(Int_t pady=0;pady<kMaxPcy+1;pady++) {
+       fgMapPad[padx][pady][ch] = status;
+     }
+   }
+}
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+void AliHMPIDParam::SetSectStatus(Int_t ch,Int_t sect,Bool_t status)
+{
+//Set a given sector sect for a chamber ch on or off depending on the status
+//Sector=0,5 (6 sectors)
+//Arguments: ch=chamber,sect=sector,status: kTRUE = active, kFALSE=off
+//Returns: none
+  
+  Int_t npadsect = (kMaxPcy+1)/6;
+  Int_t padSectMin = npadsect*sect;
+  Int_t padSectMax = padSectMin+npadsect;
+  
+  for(Int_t padx=0;padx<kMaxPcx+1;padx++) {
+     for(Int_t pady=padSectMin;pady<padSectMax;pady++) {
+       fgMapPad[padx][pady][ch] = status;
+     }
+   }
+}
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+void AliHMPIDParam::SetPcStatus(Int_t ch,Int_t pc,Bool_t status)
+{
+//Set a given PC pc for a chamber ch on or off depending on the status
+//Arguments: ch=chamber,pc=PC,status: kTRUE = active, kFALSE=off
+//Returns: none
+  
+  Int_t deltaX = pc%2;
+  Int_t deltaY = pc/2;
+  Int_t padPcXMin = deltaX*kPadPcX;
+  Int_t padPcXMax = padPcXMin+kPadPcX;
+  Int_t padPcYMin = deltaY*kPadPcY;
+  Int_t padPcYMax = padPcYMin+kPadPcY;
+  
+  for(Int_t padx=padPcXMin;padx<padPcXMax;padx++) {
+     for(Int_t pady=padPcYMin;pady<padPcYMax;pady++) {
+       fgMapPad[padx][pady][ch] = status;
+     }
+   }
+}
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+void AliHMPIDParam::PrintChStatus(Int_t ch)
+{
+//Print the map status of a chamber on or off depending on the status
+//Arguments: ch=chamber
+//Returns: none
+  Printf(" ");
+  Printf(" --------- C H A M B E R  %d   ---------------",ch);
+  for(Int_t pady=kMaxPcy;pady>=0;pady--) {
+     for(Int_t padx=0;padx<kMaxPcx+1;padx++) {
+       if(padx==80) printf(" ");
+       printf("%d",fgMapPad[padx][pady][ch]);
+     }
+     printf(" %d \n",pady+1);
+     if(pady%48==0) printf("\n");
+   }
+   printf("\n");
+}
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+void AliHMPIDParam::SetGeomAccept()
+{
+//Set the real acceptance of the modules, due to ineficciency or hardware problems (up tp 1/6/2010)
+//Arguments: none
+//Returns: none
+  SetSectStatus(0,3,kFALSE);
+  SetSectStatus(4,0,kFALSE);
+  SetSectStatus(5,1,kFALSE);
+  SetSectStatus(6,2,kFALSE);
+  SetSectStatus(6,3,kFALSE);
+}
 #endif