]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ZDC/AliZDC.cxx
Adding TDC histos
[u/mrichter/AliRoot.git] / ZDC / AliZDC.cxx
index 15ab6b9f312ff75d820d72360dabef8ed2a3ebdd..220a0bc54ced55cd721cde935e2713f346f89a4e 100644 (file)
@@ -680,52 +680,47 @@ Bool_t AliZDC::Raw2SDigits(AliRawReader* rawReader)
     return kFALSE;
   }
 
-//  // Event loop
-  Int_t iEvent = 0;
-  while(rawReader->NextEvent()){
-    (AliRunLoader::Instance())->GetEvent(iEvent++);
-    // Create the output digit tree
-    TTree* treeS = loader->TreeS();
-    if(!treeS){
-      loader->MakeTree("S");
-      treeS = loader->TreeS();
-    }
-    //
-    AliZDCSDigit sdigit;
-    AliZDCSDigit* psdigit = &sdigit;
-    const Int_t kBufferSize = 4000;
-    treeS->Branch("ZDC", "AliZDCSDigit",  &psdigit, kBufferSize);
-    //
-    AliZDCRawStream rawStream(rawReader);
-    Int_t sector[2], resADC, rawADC, corrADC, nPheVal;
-    Int_t jcount = 0;
-    while(rawStream.Next()){
-      if(rawStream.IsADCDataWord()){
-        //For the moment only in-time SDigits are foreseen (1st 48 raw values)
-        if(jcount < kNch){ 
-          for(Int_t j=0; j<2; j++) sector[j] = rawStream.GetSector(j);
-         rawADC = rawStream.GetADCValue();
-         resADC = rawStream.GetADCGain();
-         //printf("\t RAw2SDigits raw%d ->  RawADC[%d, %d, %d] read\n",
-         //    jcount, sector[0], sector[1], rawADC);
-         //
-         corrADC = rawADC - Pedestal(sector[0], sector[1], resADC);
-         if(corrADC<0) corrADC=0;
-         nPheVal = ADCch2Phe(sector[0], sector[1], corrADC, resADC);
-          //
-         //printf("\t \t ->  SDigit[%d, %d, %d] created\n",
-         //    sector[0], sector[1], nPheVal);
-         //
-          new(psdigit) AliZDCSDigit(sector, (Float_t) nPheVal, 0.);
-          treeS->Fill();
-          jcount++;
-        }
-      }//IsADCDataWord
-    }//rawStream.Next
-    // write the output tree
-    fLoader->WriteSDigits("OVERWRITE");
-    fLoader->UnloadSDigits();
-  }//Event loop 
+  // Create the output digit tree
+  TTree* treeS = loader->TreeS();
+  if(!treeS){
+    loader->MakeTree("S");
+    treeS = loader->TreeS();
+  }
+  //
+  AliZDCSDigit sdigit;
+  AliZDCSDigit* psdigit = &sdigit;
+  const Int_t kBufferSize = 4000;
+  treeS->Branch("ZDC", "AliZDCSDigit",  &psdigit, kBufferSize);
+  //
+  AliZDCRawStream rawStream(rawReader);
+  Int_t sector[2], resADC, rawADC, corrADC, nPheVal;
+  Int_t jcount = 0;
+  while(rawStream.Next()){
+    if(rawStream.IsADCDataWord()){
+      //For the moment only in-time SDigits are foreseen (1st 48 raw values)
+      if(jcount < kNch){ 
+       for(Int_t j=0; j<2; j++) sector[j] = rawStream.GetSector(j);
+        rawADC = rawStream.GetADCValue();
+        resADC = rawStream.GetADCGain();
+        //printf("\t RAw2SDigits raw%d ->  RawADC[%d, %d, %d] read\n",
+        //    jcount, sector[0], sector[1], rawADC);
+        //
+        corrADC = rawADC - Pedestal(sector[0], sector[1], resADC);
+        if(corrADC<0) corrADC=0;
+        nPheVal = ADCch2Phe(sector[0], sector[1], corrADC, resADC);
+       //
+        //printf("\t \t ->  SDigit[%d, %d, %d] created\n",
+        //    sector[0], sector[1], nPheVal);
+        //
+       new(psdigit) AliZDCSDigit(sector, (Float_t) nPheVal, 0.);
+       treeS->Fill();
+       jcount++;
+      }
+    }//IsADCDataWord
+  }//rawStream.Next
+  // write the output tree
+  fLoader->WriteSDigits("OVERWRITE");
+  fLoader->UnloadSDigits();
    
   return kTRUE;
 }
@@ -786,7 +781,7 @@ Int_t AliZDC::ADCch2Phe(Int_t Det, Int_t Quad, Int_t ADCVal, Int_t Res) const
   resADC[0] = 0.0000008; // ADC Resolution high gain: 200 fC/adcCh
   resADC[1] = 0.0000064; // ADC Resolution low gain:  25  fC/adcCh
   //
-  Int_t nPhe = (Int_t) (ADCVal * pmGain[Det-1][Quad] * resADC[Res]);
+  Int_t nPhe = (Int_t) (ADCVal / (pmGain[Det-1][Quad] * resADC[Res]));
   //
   //printf("\t AliZDC::ADCch2Phe -> det(%d, %d) - ADC %d  phe %d\n",Det,Quad,ADCVal,nPhe);