]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCAL.cxx
New versions of GDC and CDH raw data headers. Some CDH getters are added
[u/mrichter/AliRoot.git] / EMCAL / AliEMCAL.cxx
index 41f5c7d27b296ec8c8196eb3017294d18cfc3ac3..d00b2d2ea7521780ca702956124bd5b8d80666e4 100644 (file)
@@ -48,6 +48,7 @@ class TFile;
 #include "AliAltroBuffer.h"
 #include "AliRawReader.h"
 #include "AliEMCALRawStream.h"
+#include "AliDAQ.h"
 
 ClassImp(AliEMCAL)
 Double_t AliEMCAL::fgCapa        = 1.;        // 1pF 
@@ -56,7 +57,6 @@ Double_t AliEMCAL::fgTimeMax     = 2.56E-5 ;  // each sample is over 100 ns fTim
 Double_t AliEMCAL::fgTimePeak    = 4.1E-6 ;   // 4 micro seconds
 Double_t AliEMCAL::fgTimeTrigger = 100E-9 ;      // 100ns, just for a reference
 // some digitization constants
-Int_t    AliEMCAL::fgDDLOffset = 0x800;
 Int_t    AliEMCAL::fgThreshold = 1;
 // 24*48=1152 towers per SM; divided up on 3 DDLs, 
 // each DDL with 12FEC *32towers or 12*32*2 channels (high&low gain) 
@@ -67,28 +67,51 @@ AliEMCAL::AliEMCAL():AliDetector()
 {
   // Default ctor 
   fName = "EMCAL" ;
+  Init();
+
 }
 
 //____________________________________________________________________________
 AliEMCAL::AliEMCAL(const char* name, const char* title): AliDetector(name,title)
 {
   //   ctor : title is used to identify the layout
+  Init();
+
+}
+
+//____________________________________________________________________________
+AliEMCAL::AliEMCAL(const AliEMCAL& emcal) : AliDetector(emcal)
+{
+  //copy ctor
+  Init();
 
-  fHighCharge        = 8.2 ;          // adjusted for a high gain range of 5.12 GeV (10 bits)
-  fHighGain          = 6.64 ; 
-  fHighLowGainFactor = 16. ;          // adjusted for a low gain range of 82 GeV (10 bits) 
-  fLowGainOffset     = 1 ;            // offset added to the module id to distinguish high and low gain data
 }
 
 //____________________________________________________________________________
 AliEMCAL::~AliEMCAL()
 {
+  //dtor
+}
 
+//____________________________________________________________________________
+void AliEMCAL::Init(void)
+{
+  //initialize EMCAL values
+  fBirkC0 = 1;
+  fBirkC1 = 0.013/1.032;
+  fBirkC2 = 9.6e-6/(1.032 * 1.032);
+  
+  fHighCharge        = 8.2 ;          // adjusted for a high gain range of 5.12 GeV (10 bits)
+  fHighGain          = 6.64 ; 
+  fHighLowGainFactor = 16. ;          // adjusted for a low gain range of 82 GeV (10 bits) 
+  fLowGainOffset     = 1 ;            // offset added to the module id to distinguish high and low gain data
 }
 
 //____________________________________________________________________________
 void AliEMCAL::Copy(AliEMCAL & emcal) const
 {
+  //copy
+
   TObject::Copy(emcal) ; 
   emcal.fHighCharge        = fHighCharge ;
   emcal.fHighGain          = fHighGain ; 
@@ -99,6 +122,7 @@ void AliEMCAL::Copy(AliEMCAL & emcal) const
 //____________________________________________________________________________
 AliDigitizer* AliEMCAL::CreateDigitizer(AliRunDigitizer* manager) const
 {
+  //create and return the digitizer
   return new AliEMCALDigitizer(manager);
 }
 
@@ -240,6 +264,7 @@ void AliEMCAL::Digits2Raw()
 
   // get the digits
   loader->LoadDigits("EMCAL");
+  loader->GetEvent();
   TClonesArray* digits = loader->Digits() ;
 
   if (!digits) {
@@ -254,8 +279,8 @@ void AliEMCAL::Digits2Raw()
 
   AliAltroBuffer* buffer = NULL;
   Int_t prevDDL = -1;
-  Int_t adcValuesLow[fkTimeBins];
-  Int_t adcValuesHigh[fkTimeBins];
+  Int_t adcValuesLow[fgkTimeBins];
+  Int_t adcValuesHigh[fgkTimeBins];
   
   // loop over digits (assume ordered digits)
   for (Int_t iDigit = 0; iDigit < digits->GetEntries(); iDigit++) {
@@ -275,10 +300,8 @@ void AliEMCAL::Digits2Raw()
       }
 
       // open new file and write dummy header
-      TString fileName("EMCAL_") ;
-      fileName += (iDDL + fgDDLOffset) ; 
-      fileName += ".ddl" ; 
-      buffer = new AliAltroBuffer(fileName.Data(), 1);
+      TString fileName(AliDAQ::DdlFileName("EMCAL",iDDL));
+      buffer = new AliAltroBuffer(fileName.Data());
       buffer->WriteDataHeader(kTRUE, kFALSE);  //Dummy;
 
       prevDDL = iDDL;
@@ -347,8 +370,8 @@ void AliEMCAL::Raw2Digits(AliRawReader* reader)
   // Use AliAltroRawStream to read the ALTRO format.  No need to
   // reinvent the wheel :-) 
   AliEMCALRawStream in(reader);
-  // Select EMCAL DDL's; lowest 8 bits of DDL offser is used for something else.. 
-  reader->Select(fgDDLOffset >> 8);
+  // Select EMCAL DDL's;
+  reader->Select("EMCAL");
 
   // reading is from previously existing AliEMCALGetter.cxx
   // ReadRaw method
@@ -532,6 +555,7 @@ Double_t AliEMCAL::RawResponseFunction(Double_t *x, Double_t *par)
 //__________________________________________________________________
 Double_t AliEMCAL::RawResponseFunctionMax(Double_t charge, Double_t gain) 
 {
+  //compute the maximum of the raw response function and return
   return ( charge * TMath::Power(fgOrder, fgOrder) * TMath::Power(gain, fgOrder) 
      / ( fgCapa * TMath::Exp(fgOrder) ) );