]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Updated error definitions.
authordibari <dibari@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 31 Jan 2008 13:26:59 +0000 (13:26 +0000)
committerdibari <dibari@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 31 Jan 2008 13:26:59 +0000 (13:26 +0000)
HMPID/AliHMPIDCalib.cxx
HMPID/AliHMPIDCalib.h

index bee80baebe9455114ab8e58a0072c9df1f2e3c13..d7fda0446fe59d46df1d795ac2e4b34bb6325aad 100644 (file)
 //  **************************************************************************
 
 #include "AliHMPIDCalib.h" //class header
-#include "TTreePlayer.h"
 #include <fstream>
 #include <TTree.h>
-//#include "AliHMPIDDigit.h"
+
+
 
 ClassImp(AliHMPIDCalib) 
 
@@ -43,44 +43,97 @@ void AliHMPIDCalib::Init()
   //
   //Init the q calc.
   //
+   
     for(Int_t iDDL=0; iDDL< AliHMPIDCalib::kNDDL; iDDL++) 
       {
         faddl[iDDL]=kFALSE;
-        for(Int_t row = 1; row <=AliHMPIDCalib::kNRows; row++){
+
+         for(Int_t ierr=0; ierr < AliHMPIDRawStream::kSumErr; ierr++)  fNumOfErr[iDDL][ierr]=0;               //reset errors for all DDLs
+
+         for(Int_t row = 1; row <=AliHMPIDCalib::kNRows; row++){
           for(Int_t dil = 1; dil <=AliHMPIDCalib::kNDILOGICAdd; dil++){
             for(Int_t pad = 0; pad < AliHMPIDCalib::kNPadAdd; pad++){
                      fsq[iDDL][row][dil][pad]=0;
-                    fsq2[iDDL][row][dil][pad]=0;
-            }
+                    fsq2[iDDL][row][dil][pad]=0;                  
+               }
           }
         }
       }
 }//Init()
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-void AliHMPIDCalib::FillPedestal(Int_t nDDL,Int_t row, Int_t dil,Int_t adr,Int_t q)
+//void AliHMPIDCalib::FillPedestal(Int_t nDDL,Int_t row, Int_t dil,Int_t adr,Int_t q)
+void AliHMPIDCalib::FillPedestal(Int_t pad,Int_t q)
 {
   //
   //Called from the HMPIDda and fills the pedestal tree 
   //
+  Int_t nDDL=0, row=0, dil=0, adr=0;
+  //The decoding (abs. pad -> ddl,dil,...) is the same as in AliHMPIDDigit::Raw
+  Int_t y2a[6]={5,3,1,0,2,4};
+
+       nDDL=  2*AliHMPIDParam::A2C(pad)+AliHMPIDParam::A2P(pad)%2;             //DDL# 0..13
+  Int_t tmp=  1+AliHMPIDParam::A2P(pad)/2*8+AliHMPIDParam::A2Y(pad)/6;         //temp variable
+        row=   (AliHMPIDParam::A2P(pad)%2)? 25-tmp:tmp;                         //row r=1..24
+        dil=  1+AliHMPIDParam::A2X(pad)/8;                                     //DILOGIC 
+        adr=y2a[AliHMPIDParam::A2Y(pad)%6]+6*(AliHMPIDParam::A2X(pad)%8);    //ADDRESS 0..47 
+        
+  //  Printf("AbsPadNum: %d nDDL: %d tmp %d row: %d dil: %d adr: %d",pad,nDDL,tmp,row,dil,adr);
+  //........... decoding done      
+                                      
     if(q>0) { 
          fsq[nDDL][row][dil][adr]+=q;
         fsq2[nDDL][row][dil][adr]+=(q*q);
                        faddl[nDDL]=kTRUE;  
         }
 
+        
+        
+        
 }//FillPedestal()
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-Bool_t AliHMPIDCalib::CalcPedestal(Int_t nDDL, Char_t* name, Int_t nEv)    
+void AliHMPIDCalib::FillErrors(Int_t nDDL,Int_t nErrType, Int_t nErr)
+{
+  //
+  //Fill decoding errors
+  //
+ // fhDdlDecodErrors[nDDL]->Fill(nErrType,nErr);      //select DDL, select bin and add the occurence
+    fNumOfErr[nDDL][nErrType]+=nErr;
+  
+}//FillErrors()
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+Bool_t AliHMPIDCalib::WriteErrors(ULong_t runNum, Int_t nDDL, Char_t* name, Int_t /*nEv*/)
+{
+  //
+  //Write decoding errors to a txt file
+  //
+  
+  if(faddl[nDDL]==kFALSE) return kFALSE;                   //if ddl is missing no error file is created
+  ofstream outerr;  
+  outerr.open(name);                                      //open error file
+                                                             
+                                                                outerr << Form("%d \n",(Int_t)runNum);
+  for(Int_t  ierr=1; ierr < AliHMPIDRawStream::kSumErr; ierr++) outerr << Form("%2d\t",fNumOfErr[nDDL][ierr]);
+                                                                outerr << Form("\n");  
+  outerr.close();                                          //write error file
+  return kTRUE;
+    
+}//FillErrors()
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+Bool_t AliHMPIDCalib::CalcPedestal(ULong_t runNum, Int_t nDDL, Char_t* name, Int_t nEv)    
 {
   //
   //Calculate pedestal for each pad  
   //
+   
+  if(faddl[nDDL]==kFALSE) return kFALSE;                   //if ddl is missing no ped file is created (and also for LDC selection). Check with Paolo what he checks for?!  
   Float_t mean=0,sigma=0;
   Float_t qs2m=0,qsm2=0;
   ofstream out;                                           //to write the pedestal text files
   Int_t inhard;
-  if(faddl[nDDL]==kFALSE) return kFALSE;                   //if ddl is missing no ped file is created (and also for LDC selection). Check with Paolo what he checks for?!
+  //Printf("From AliHMPIDCalib::CalcPedestal: faddl[%i]= %i",nDDL,faddl[nDDL]);
+
   out.open(name);
+  out << Form("%d \n",(Int_t)runNum);
   for(Int_t row = 1; row <= AliHMPIDCalib::kNRows; row++){
     for(Int_t dil = 1; dil <= AliHMPIDCalib::kNDILOGICAdd; dil++){
       for(Int_t pad = 0; pad < AliHMPIDCalib::kNPadAdd; pad++){
index ee2f8138fd55fbbe3db4265f81636add60219f1c..674da2e92037debbb5f17e2b1af0d6bd343794d2 100644 (file)
 //#include "TTreePlayer.h"
 //#include <TTree.h>
 #include <TH1.h>
+#include <TH2.h>
+#include <TH1S.h>
 #include <TMath.h>
+#include "AliHMPIDParam.h"
+#include "AliHMPIDRawStream.h"
 
 class AliHMPIDCalib: public TObject { 
 
@@ -20,8 +24,11 @@ public:
   AliHMPIDCalib();
   virtual ~AliHMPIDCalib();
           void Init();
-          void FillPedestal(Int_t nDDL,Int_t row, Int_t dil,Int_t adr,Int_t q);
-        Bool_t CalcPedestal(Int_t nDDL, Char_t* name, Int_t nEv);
+//          void FillPedestal(Int_t nDDL,Int_t row, Int_t dil,Int_t adr,Int_t q);
+          void FillPedestal(Int_t pad,Int_t q);                             //absolute pad number and the charge of the pad
+          void FillErrors(Int_t nDDL,Int_t nErrType, Int_t nErr);
+        Bool_t CalcPedestal(ULong_t runNum, Int_t nDDL, Char_t* name, Int_t nEv);       //number of the DDL, name of the output file and the number of events processed
+        Bool_t WriteErrors(ULong_t runNum, Int_t nDDL, Char_t* name, Int_t nEv);        //number of the DDL, name of the output file and the number of events processed
 
    enum {
       kNRows       = 24,                                    // Number of rows (starting from 1 !)//was25
@@ -34,6 +41,7 @@ protected:
     Bool_t  faddl[11];                                                            //check is ddl is filled
     Float_t fsq[kNDDL][kNRows][kNDILOGICAdd][kNPadAdd];                           //Sum of pad Q
     Float_t fsq2[kNDDL][kNRows][kNDILOGICAdd][kNPadAdd];                          //Sum of pad Q^2
-    ClassDef(AliHMPIDCalib,1)                                                     //HMPID calibration and pedestal class        
+    Int_t   fNumOfErr[kNDDL][AliHMPIDRawStream::kSumErr];                         // Store the numner of errors for a given error type and a given DDL
+    ClassDef(AliHMPIDCalib,2)                                                     //HMPID calibration and pedestal class        
 };
 #endif