]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALDigitizer.cxx
Fill Tree instead of branches to be able to use the root browser
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALDigitizer.cxx
index 9f23959a05eebe3eb0e8065b1b0788449ce8bc90..d148aa931bf07827ad08e52836b5d2388b4c40a4 100644 (file)
@@ -86,20 +86,20 @@ ClassImp(AliEMCALDigitizer)
   // ctor
 
   fSDigitizer = 0 ;
-  fNinputs = 1 ;
-  fPinNoise = 0.01 ;
-  fEMCDigitThreshold = 0.01 ;
-  fTimeResolution     = 0.5e-9 ;
-  fTimeSignalLength   = 1.0e-9 ;
-  fPreShowerDigitThreshold = fEMCDigitThreshold/100. ;
-  fADCchannelTower = 0.0030;        // width of one ADC channel in GeV
-  fADCpedestalTower = 0.005 ;      // pedestal of ADC
-  fNADCTower = (Int_t) TMath::Power(2,16) ;  // number of channels in Tower ADC
-
-  fADCchannelPreSho = 0.0030 ;          // width of one ADC channel in Pre Shower
-  fADCpedestalPreSho = 0.005 ;         // pedestal of ADC
-  fNADCPreSho = (Int_t) TMath::Power(2,16);      // number of channels in Pre Shower ADC
-  fTimeThreshold = 0.001*10000000 ; //Means 1 MeV in terms of SDigits amplitude
+  fNinputs = 0 ;
+  fPinNoise = 0.0 ;
+  fTowerDigitThreshold = 0.0 ;
+  fTimeResolution     = 0. ;
+  fTimeSignalLength   = 0. ;
+  fPreShowerDigitThreshold = 0. ;
+  fADCchannelTower = 0.0;      // width of one ADC channel in GeV
+  fADCpedestalTower = 0. ;      // pedestal of ADC
+  fNADCTower = 0;  // number of channels in Tower ADC
+
+  fADCchannelPreSho  = 0.0;          // width of one ADC channel in Pre Shower
+  fADCpedestalPreSho = 0.0 ;         // pedestal of ADC
+  fNADCPreSho = 0;      // number of channels in Pre Shower ADC
+  fTimeThreshold = 0.0; //Means 1 MeV in terms of SDigits amplitude
   fManager = 0 ;
 
 
@@ -112,29 +112,29 @@ Bool_t AliEMCALDigitizer::Init()
 
   fSDigitizer = 0 ;
   fNinputs = 1 ;
-  fPinNoise = 0.01 ;
-  fEMCDigitThreshold = 0.01 ;
+  fPinNoise = 0.00001 ;
+  fTowerDigitThreshold = 0.001 ;
   fTimeResolution     = 0.5e-9 ;
   fTimeSignalLength   = 1.0e-9 ;
-  fPreShowerDigitThreshold = fEMCDigitThreshold/100. ;
+  fPreShowerDigitThreshold = fTowerDigitThreshold/25. ;
   fInitialized = kFALSE ;
-  fADCchannelTower = 0.0030;        // width of one ADC channel in GeV
-  fADCpedestalTower = 0.005 ;      //
+  fADCchannelTower = 0.000220;       // width of one ADC channel in GeV
+  fADCpedestalTower = 0.005 ;      // GeV
   fNADCTower = (Int_t) TMath::Power(2,16) ;  // number of channels in Tower ADC
 
-  fADCchannelPreSho = 0.0030 ;          // width of one ADC channel in Pre Shower
+  fADCchannelPreSho = 0.0000300;          // width of one ADC channel in Pre Shower
   fADCpedestalPreSho = 0.005 ;         // 
-  fNADCPreSho = (Int_t) TMath::Power(2,16);      // number of channels in Pre ShowerADC
+  fNADCPreSho = (Int_t) TMath::Power(2,12);      // number of channels in Pre ShowerADC
 
   fTimeThreshold = 0.001*10000000 ; //Means 1 MeV in terms of SDigits amplitude
  
 
 
-if(fManager)
+  if(fManager)
     SetTitle("aliroot") ;
   else if (strcmp(GetTitle(),"")==0) 
-   SetTitle("galice.root") ;
-
+    SetTitle("galice.root") ;
+  
   if( strcmp(GetName(), "") == 0 )
     SetName("Default") ;
   
@@ -167,7 +167,7 @@ if(fManager)
 //____________________________________________________________________________ 
 AliEMCALDigitizer::AliEMCALDigitizer(const char *headerFile,const char *name)
 {
-   SetName(name) ;
+  SetName(name) ;
   SetTitle(headerFile) ;
   fManager = 0 ;                     // We work in the standalong mode
   Init() ;
@@ -230,7 +230,6 @@ void AliEMCALDigitizer::Digitize(const Int_t event) {
     cerr << "ERROR: AliEMCALDigitizer::Digitize -> SDigitizer with name " << GetName() << " not found " << endl ; 
     abort() ; 
   }
-
 // loop through the sdigits posted to the White Board and add them to the noise
   TCollection * folderslist = gime->SDigitsFolder()->GetListOfFolders() ; 
   TIter next(folderslist) ; 
@@ -240,13 +239,15 @@ void AliEMCALDigitizer::Digitize(const Int_t event) {
   TObjArray * sdigArray = new TObjArray(2) ;
   while ( (folder = (TFolder*)next()) ) 
     if ( (sdigits = (TClonesArray*)folder->FindObject(GetName()) ) ) {
+      TString fileName(folder->GetName()) ;
+      fileName.ReplaceAll("_","/") ;
       cout << "INFO: AliEMCALDigitizer::Digitize -> Adding SDigits " 
-          << GetName() << " from " << folder->GetName() << endl ; 
+          << GetName() << " from " << fileName << endl ; 
       sdigArray->AddAt(sdigits, input) ;
       input++ ;
     }
 
-  //Find the first crystall with signal
+  //Find the first tower with signal
   Int_t nextSig = 200000 ; 
   Int_t i;
   for(i=0; i<input; i++){
@@ -268,7 +269,7 @@ void AliEMCALDigitizer::Digitize(const Int_t event) {
 
   //Put Noise contribution
   for(absID = 1; absID <= nEMC; absID++){
-    Float_t noise = gRandom->Gaus(0., fPinNoise) 
+    Float_t noise = gRandom->Gaus(0., fPinNoise); 
     new((*digits)[absID-1]) AliEMCALDigit( -1, -1, absID,sDigitizer->Digitize(noise), TimeOfNoise() ) ;
     //look if we have to add signal?
     if(absID==nextSig){
@@ -342,7 +343,7 @@ void AliEMCALDigitizer::Digitize(const Int_t event) {
 
   //remove digits below thresholds
   for(absID = 0; absID < nEMC/2 ; absID++){
-    if(sDigitizer->Calibrate(((AliEMCALDigit*)digits->At(absID))->GetAmp()) < fEMCDigitThreshold)
+    if(sDigitizer->Calibrate(((AliEMCALDigit*)digits->At(absID))->GetAmp()) < fTowerDigitThreshold)
       digits->RemoveAt(absID) ;
     else
       digit->SetTime(gRandom->Gaus(digit->GetTime(),fTimeResolution) ) ;
@@ -364,7 +365,7 @@ void AliEMCALDigitizer::Digitize(const Int_t event) {
   
   //Set indexes in list of digits
   //Int_t i ;
 for (i = 0 ; i < ndigits ; i++) { 
+ for (i = 0 ; i < ndigits ; i++) { 
     AliEMCALDigit * digit = (AliEMCALDigit *) digits->At(i) ; 
     digit->SetIndexInList(i) ; 
     Float_t energy = sDigitizer->Calibrate(digit->GetAmp()) ;
@@ -380,12 +381,15 @@ Int_t AliEMCALDigitizer::DigitizeEnergy(Float_t energy, Int_t absId)
   Int_t nphi = AliEMCALGetter::GetInstance()->EMCALGeometry()->GetNPhi() ; 
   Int_t nz   = AliEMCALGetter::GetInstance()->EMCALGeometry()->GetNZ() ;
   
-  if(absId <= nphi*nz) //digitize as tower
-    channel = (Int_t) TMath::Ceil( (energy - fADCpedestalTower)/fADCchannelTower )  ;
-  if(channel > fNADCTower ) channel =  fNADCTower ;
-  else 
-    channel =  (Int_t) TMath::Ceil( (energy - fADCpedestalPreSho)/fADCchannelPreSho )  ;
-  if(channel > fNADCPreSho ) channel =  fNADCPreSho ;
+  if(absId <= nphi*nz){  //digitize as tower
+    channel = static_cast<Int_t> (TMath::Ceil( (energy + fADCpedestalTower)/fADCchannelTower ))  ;
+  if(channel > fNADCTower ) 
+    channel =  fNADCTower ;
+  } else {
+    channel =  static_cast<Int_t>(TMath::Ceil( (energy + fADCpedestalPreSho)/fADCchannelPreSho ))  ;
+  if(channel > fNADCPreSho ) 
+    channel =  fNADCPreSho ;
+  }
   
   return channel ;
 }
@@ -466,8 +470,8 @@ if(strcmp(GetName(), "") == 0 )
        gime->ReadTreeS(treeS,input) ;
       }
     }
-    else
-      gime->Event(ievent,"S") ;
+    else 
+      gime->Event(ievent,"S") ; 
     
     Digitize(ievent) ; //Add prepared SDigits to digits and add the noise
     
@@ -556,7 +560,7 @@ void AliEMCALDigitizer::Print(Option_t* option)const {
       cout << endl ;
       cout << "With following parameters: " << endl ;
       cout << "     Electronics noise in EMC (fPinNoise) = " << fPinNoise << endl ;
-      cout << "  Threshold  in EMC  (fEMCDigitThreshold) = " << fEMCDigitThreshold  << endl;
+      cout << "  Threshold  in EMC  (fTowerDigitThreshold) = " << fTowerDigitThreshold  << endl;
       cout << "  Threshold  in PreShower  (fPreShowerDigitThreshold) = " << fPreShowerDigitThreshold  << endl ; ;
       cout << "---------------------------------------------------" << endl ;
     }
@@ -653,9 +657,7 @@ void AliEMCALDigitizer::WriteDigits(Int_t event)
     cwd->cd();
   }
   
-  digitsBranch->Fill() ;      
-  digitizerBranch->Fill() ;
-
+  treeD->Fill() ; 
   treeD->Write(0,kOverwrite) ;  
  
 }