]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HMPID/AliHMPIDv1.cxx
typo fixed: HMP_DET/HMP_ENV/HMP_ENV_TENV.actual.value
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDv1.cxx
index 58537bb383525b659098d9079249409ecc47549d..9fffa9263b67b931a33a5f79a3c241866f7844e7 100644 (file)
@@ -18,6 +18,7 @@
 #include "AliHMPIDParam.h"  //StepManager()
 #include "AliHMPIDHit.h"    //Hits2SDigs(),StepManager()
 #include "AliHMPIDDigit.h"  //Digits2Raw(), Raw2SDigits()
+#include "AliHMPIDRawStream.h"  //Digits2Raw(), Raw2SDigits()
 #include "AliRawReader.h"  //Raw2SDigits()
 #include <TVirtualMC.h>    //StepManager() for gMC
 #include <TPDGCode.h>      //StepHistory() 
@@ -206,7 +207,7 @@ void AliHMPIDv1::DefineOpticalProperties()
   Float_t                                                    aQeAll [kNbins], aQePc [kNbins];
   Double_t dReflMet[kNbins], dQePc[kNbins];
 
-  TF2 *pRaIF=new TF2("HidxRad","sqrt(1+0.554*(1239.84/x)^2/((1239.84/x)^2-5796)-0.0005*(y-20))"                                       ,emin,emax,0,50); //DiMauro mail temp 0-50 degrees C
+  TF2 *pRaIF=new TF2("HidxRad","sqrt(1+0.554*(1239.84/x)^2/((1239.84/x)^2-5769)-0.0005*(y-20))"                                       ,emin,emax,0,50); //DiMauro mail temp 0-50 degrees C
   TF1 *pWiIF=new TF1("HidxWin","sqrt(1+46.411/(10.666*10.666-x*x)+228.71/(18.125*18.125-x*x))"                                        ,emin,emax);      //SiO2 idx TDR p.35
   TF1 *pGaIF=new TF1("HidxGap","1+0.12489e-6/(2.62e-4 - x*x/1239.84/1239.84)"                                                         ,emin,emax);      //?????? from where  
 
@@ -388,7 +389,9 @@ void AliHMPIDv1::Digits2Raw()
   }
   treeD->GetEntry(0);
   
-  AliHMPIDDigit::WriteRaw(DigLst());
+  //AliHMPIDDigit::WriteRaw(DigLst());
+   AliHMPIDRawStream *pRS=0x0;
+   pRS->WriteRaw(DigLst());
     
   GetLoader()->UnloadDigits();
   AliDebug(1,"Stop.");      
@@ -463,18 +466,26 @@ Bool_t AliHMPIDv1::Raw2SDigits(AliRawReader *pRR)
 // Interface methode ivoked from AliSimulation to create a list of sdigits from raw digits. Events loop is done in AliSimulation
 // Arguments: pRR- raw reader 
 //   Returns: kTRUE on success (currently ignored in AliSimulation::ConvertRaw2SDigits())      
-  AliHMPIDDigit sdi; //tmp sdigit, raw digit will be converted to it
+  //AliHMPIDDigit sdi; //tmp sdigit, raw digit will be converted to it
   
   if(!GetLoader()->TreeS()) {MakeTree("S");  MakeBranch("S");}
     
   TClonesArray *pSdiLst=SdiLst(); Int_t iSdiCnt=0; //tmp list of sdigits for all chambers
-  pRR->Select("HMPID",0,13);//select all HMPID DDL files
-  UInt_t w32=0;
-  while(pRR->ReadNextInt(w32)){//raw records loop (in selected DDL files)
-    UInt_t ddl=pRR->GetDDLID(); //returns 0,1,2 ... 13
-    if(!sdi.Raw(ddl,w32,pRR)) continue;  
-    new((*pSdiLst)[iSdiCnt++]) AliHMPIDDigit(sdi); //add this digit to the tmp list
-  }//raw records loop
+  AliHMPIDRawStream stream(pRR);
+  while(stream.Next())
+  {
+    UInt_t ddl=stream.GetDDLNumber(); //returns 0,1,2 ... 13  
+    for(Int_t row = 1; row <=AliHMPIDRawStream::kNRows; row++){
+     for(Int_t dil = 1; dil <= AliHMPIDRawStream::kNDILOGICAdd; dil++){
+      for(Int_t pad = 0; pad < AliHMPIDRawStream::kNPadAdd; pad++){
+          if(stream.GetCharge(ddl,row,dil,pad)<1) continue;
+          AliHMPIDDigit sdi(stream.GetPad(ddl,row,dil,pad),stream.GetCharge(ddl,row,dil,pad));
+          new((*pSdiLst)[iSdiCnt++]) AliHMPIDDigit(sdi); //add this digit to the tmp list
+          }//pad
+      }//dil
+    }//row
+  }
+  
   GetLoader()->TreeS()->Fill(); GetLoader()->WriteSDigits("OVERWRITE");//write out sdigits
   SdiReset();
   return kTRUE;