Electronc noise switched-on in simulation. Default number of sigma for threshold...
authorgvolpe <gvolpe@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 31 Jul 2011 10:52:00 +0000 (10:52 +0000)
committergvolpe <gvolpe@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 31 Jul 2011 10:52:00 +0000 (10:52 +0000)
HMPID/AliHMPIDDigitizer.cxx
HMPID/AliHMPIDParam.cxx
HMPID/AliHMPIDParam.h

index 7e45ca4..b269a74 100644 (file)
 #include "AliRunDigitizer.h"
 #include <AliLoader.h>
 #include <AliLog.h>
+#include <AliCDBEntry.h> 
+#include <AliCDBManager.h>
 #include "AliHMPIDDigitizer.h"
+#include "AliHMPIDReconstructor.h"
 #include "AliHMPIDDigit.h"
 #include "AliHMPID.h"
 #include "AliHMPIDParam.h"
 #include <TRandom.h>
+#include <TMath.h>
 #include <TTree.h>
+#include <TObjArray.h>
 
 ClassImp(AliHMPIDDigitizer)
 
-Bool_t AliHMPIDDigitizer::fgDoNoise=kFALSE;
+Bool_t AliHMPIDDigitizer::fgDoNoise=kTRUE;
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void AliHMPIDDigitizer::Exec(Option_t*)
 {
@@ -89,28 +94,42 @@ void AliHMPIDDigitizer::Sdi2Dig(TClonesArray *pSdiLst,TObjArray *pDigLst)
     iCnt[i]=0; if(pLst[i]->GetEntries()!=0) AliErrorClass("Some of digits lists is not empty");         //in principle those lists should be empty                                                                       
   }
 
+  TMatrixF *pM[7];
+      
+  AliCDBEntry *pDaqSigEnt = AliCDBManager::Instance()->Get("HMPID/Calib/DaqSig");  //contains TObjArray of TObjArray 14 TMatrixF sigmas values for pads 
+  if(!pDaqSigEnt) Printf("prova"); 
+  TObjArray *pDaqSig = (TObjArray*)pDaqSigEnt->GetObject();
+  for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){                  //chambers loop    
+    pM[iCh] = (TMatrixF*)pDaqSig->At(iCh);     
+  }
+
   // make noise array
   Float_t arrNoise[7][6][80][48];
   if(fgDoNoise) {
-    for (Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++)
+    for (Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){
       for (Int_t iPc=AliHMPIDParam::kMinPc;iPc<=AliHMPIDParam::kMaxPc;iPc++)
         for(Int_t iPx=AliHMPIDParam::kMinPx;iPx<=AliHMPIDParam::kMaxPx;iPx++)
-          for(Int_t iPy=AliHMPIDParam::kMinPy;iPy<=AliHMPIDParam::kMaxPy;iPy++) arrNoise[iCh][iPc][iPx][iPy] = gRandom->Gaus(0,1.1);
+          for(Int_t iPy=AliHMPIDParam::kMinPy;iPy<=AliHMPIDParam::kMaxPy;iPy++){
+            Int_t padX = (iPc%2)*AliHMPIDParam::kPadPcX+iPx; 
+            Int_t padY = (iPc/2)*AliHMPIDParam::kPadPcY+iPy;
+            arrNoise[iCh][iPc][iPx][iPy] = gRandom->Gaus(0,(*pM[iCh])(padX,padY));
+          } 
+    }    
   }  
   
   pSdiLst->Sort();  
                      
   Int_t iPad=-1,iCh=-1,iNdigPad=-1,aTids[3]={-1,-1,-1}; Float_t q=-1;
   for(Int_t i=0;i<pSdiLst->GetEntries();i++){                                                                  //sdigits loop (sorted)
-    AliHMPIDDigit *pSdig=(AliHMPIDDigit*)pSdiLst->At(i);                                                         //take current sdigit
+    AliHMPIDDigit *pSdig=(AliHMPIDDigit*)pSdiLst->At(i);                                                       //take current sdigit
     if(pSdig->Pad()==iPad){                                                                                    //if the same pad 
       q+=pSdig->Q();                                                                                           //sum up charge
       iNdigPad++; if(iNdigPad<=3) aTids[iNdigPad-1]=pSdig->GetTrack(0);                                        //collect TID 
       continue;
     }
-    if(i!=0 && AliHMPIDParam::IsOverTh(q) 
-            && iCh>=AliHMPIDParam::kMinCh
-            && iCh<=AliHMPIDParam::kMaxCh)  new((*pLst[iCh])[iCnt[iCh]++]) AliHMPIDDigit(iPad,(Int_t)q,aTids);  //do not create digit for the very first sdigit 
+    if(i!=0 && iCh>=AliHMPIDParam::kMinCh && iCh<=AliHMPIDParam::kMaxCh){
+      AliHMPIDParam::Instance()->SetThreshold(TMath::Nint(((*pM[iCh])(pSdig->PadChX(),pSdig->PadChY()))*AliHMPIDParam::Nsig()));         
+      if(AliHMPIDParam::IsOverTh(q)) new((*pLst[iCh])[iCnt[iCh]++]) AliHMPIDDigit(iPad,(Int_t)q,aTids);}  //do not create digit for the very first sdigit 
     
     iPad=pSdig->Pad(); iCh=AliHMPIDParam::A2C(iPad);                                                            //new sdigit comes, reset collectors
     iNdigPad=1;
@@ -120,20 +139,27 @@ void AliHMPIDDigitizer::Sdi2Dig(TClonesArray *pSdiLst,TObjArray *pDigLst)
     arrNoise[iCh][pSdig->Pc()][pSdig->PadPcX()][pSdig->PadPcY()]=0;
   }//sdigits loop (sorted)
   
-  if(AliHMPIDParam::IsOverTh(q)
-      && iCh>=AliHMPIDParam::kMinCh
-      && iCh<=AliHMPIDParam::kMaxCh)  new((*pLst[iCh])[iCnt[iCh]++]) AliHMPIDDigit(iPad,(Int_t)q,aTids);        //add the last one, in case of empty sdigits list q=-1
+  if(iCh>=AliHMPIDParam::kMinCh && iCh<=AliHMPIDParam::kMaxCh){
+    Int_t pc = AliHMPIDParam::A2P(iPad);
+    Int_t padX = (pc%2)*AliHMPIDParam::kPadPcX+AliHMPIDParam::A2X(iPad); 
+    Int_t padY = (pc/2)*AliHMPIDParam::kPadPcY+AliHMPIDParam::A2Y(iPad);
+    AliHMPIDParam::Instance()->SetThreshold(TMath::Nint(((*pM[iCh])(padX,padY))*AliHMPIDParam::Nsig()));
+    if(AliHMPIDParam::IsOverTh(q)) new((*pLst[iCh])[iCnt[iCh]++]) AliHMPIDDigit(iPad,(Int_t)q,aTids);}  //add the last one, in case of empty sdigits list q=-1 
   
 // add noise pad above threshold with no signal merged...if any
   if(!fgDoNoise) return;
+  
   aTids[0]=aTids[1]=aTids[2]=-1;
-  for (Int_t iChCurr=AliHMPIDParam::kMinCh;iChCurr<=AliHMPIDParam::kMaxCh;iChCurr++)
+  for (Int_t iChCurr=AliHMPIDParam::kMinCh;iChCurr<=AliHMPIDParam::kMaxCh;iChCurr++){
     for (Int_t iPc=AliHMPIDParam::kMinPc;iPc<=AliHMPIDParam::kMaxPc;iPc++)
       for(Int_t iPx=AliHMPIDParam::kMinPx;iPx<=AliHMPIDParam::kMaxPx;iPx++)
         for(Int_t iPy=AliHMPIDParam::kMinPy;iPy<=AliHMPIDParam::kMaxPy;iPy++) {
           Float_t qNoise = arrNoise[iChCurr][iPc][iPx][iPy];
+          Int_t padX = (iPc%2)*AliHMPIDParam::kPadPcX+iPx; 
+          Int_t padY = (iPc/2)*AliHMPIDParam::kPadPcY+iPy;
+          AliHMPIDParam::Instance()->SetThreshold(TMath::Nint(((*pM[iChCurr])(padX,padY))*AliHMPIDParam::Nsig()));
           if(AliHMPIDParam::IsOverTh(qNoise)) new((*pLst[iChCurr])[iCnt[iChCurr]++]) AliHMPIDDigit(AliHMPIDParam::Abs(iChCurr,iPc,iPx,iPy),(Int_t)qNoise,aTids);
         }
-        
+  }        
 }//Sdi2Dig()
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
index f6fae4c..1f0ba99 100644 (file)
@@ -66,7 +66,8 @@ Bool_t AliHMPIDParam::fgInstanceType=kTRUE;
 
 AliHMPIDParam* AliHMPIDParam::fgInstance=0x0;        //singleton pointer               
 
-Int_t AliHMPIDParam::fgSigmas=4;
+Int_t AliHMPIDParam::fgNSigmas  = 4;
+Int_t AliHMPIDParam::fgThreshold= 4;
 
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 AliHMPIDParam::AliHMPIDParam(Bool_t noGeo=kFALSE):
index 2bd836d..4145942 100644 (file)
@@ -44,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]    
 
@@ -65,7 +65,7 @@ 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                        
   
@@ -135,7 +135,8 @@ 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
@@ -177,7 +178,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