]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ZDC/AliZDCDigitizer.cxx
Better starting value for estimate of covariance matrix (Maksym, Silvia)
[u/mrichter/AliRoot.git] / ZDC / AliZDCDigitizer.cxx
index d3310b5ba1aa1159882686d5f538d4af9e8b6834..d8b43c933dc682b885712eb99b8ff7fe19433c60 100644 (file)
@@ -36,6 +36,7 @@
 #include "AliGenHijingEventHeader.h"
 #include "AliRunDigitizer.h"
 #include "AliRunLoader.h"
+#include "AliLoader.h"
 #include "AliGRPObject.h"
 #include "AliCDBManager.h"
 #include "AliCDBEntry.h"
@@ -61,7 +62,7 @@ AliZDCDigitizer::AliZDCDigitizer() :
   fBeamEnergy(0.)
 {
   // Default constructor    
-
+  for(Int_t i=0; i<2; i++) fADCRes[i]=0.;
 }
 
 //____________________________________________________________________________
@@ -118,6 +119,7 @@ Bool_t AliZDCDigitizer::Init()
   // Initialize the digitizer
   
   AliCDBEntry*  entry = AliCDBManager::Instance()->Get("GRP/GRP/Data");
+  if(!entry) AliFatal("No calibration data loaded!");  
   AliGRPObject* grpData = 0x0;
   if(entry){
     TMap* m = dynamic_cast<TMap*>(entry->GetObject());  // old GRP entry
@@ -132,7 +134,10 @@ Bool_t AliZDCDigitizer::Init()
     entry->SetOwner(0);
     AliCDBManager::Instance()->UnloadFromCache("GRP/GRP/Data");
   }
-  if(!grpData) AliError("No GRP entry found in OCDB!");
+  if(!grpData){
+    AliError("No GRP entry found in OCDB! \n ");
+    return kFALSE;
+  }
   
   TString beamType = grpData->GetBeamType();
   if(beamType==AliGRPObject::GetInvalidString()){
@@ -148,6 +153,8 @@ Bool_t AliZDCDigitizer::Init()
 
   if((beamType.CompareTo("P-P")) == 0 || (beamType.CompareTo("p-p")) == 0){
     //PTM gains rescaled to beam energy for p-p
+    // New correction coefficients for PMT gains needed
+    // to reproduce experimental spectra (from Grazia Jul 2010)
     if(fBeamEnergy != 0){
       for(Int_t j = 0; j < 5; j++){
           fPMGain[0][j] = 1.515831*(661.444/fBeamEnergy+0.000740671)*10000000;
@@ -157,22 +164,37 @@ Bool_t AliZDCDigitizer::Init()
       }
       fPMGain[2][1] = 0.869654*(1.32312-0.000101515*fBeamEnergy)*10000000;
       fPMGain[2][2] = 1.030883*(1.32312-0.000101515*fBeamEnergy)*10000000;
+      //
       AliInfo(Form("    PMT gains for p-p @ %1.0f+%1.0f GeV: ZN(%1.0f), ZP(%1.0f), ZEM(%1.0f)\n",
        fBeamEnergy, fBeamEnergy, fPMGain[0][0], fPMGain[1][0], fPMGain[2][1]));
     }
+    else{ // for RELDIS simulation
+       Float_t scalGainFactor = 0.5;
+       for(Int_t j = 0; j < 5; j++){
+        fPMGain[0][j] = 50000./scalGainFactor;  // ZNC          
+        fPMGain[1][j] = 100000./scalGainFactor; // ZPC    
+        fPMGain[2][j] = 100000./scalGainFactor;     // ZEM
+        fPMGain[3][j] = 50000./scalGainFactor;  // ZNA          
+        fPMGain[4][j] = 100000./scalGainFactor; // ZPA 
+       }
+       //
+       AliInfo(Form("  PMT gains for RELDIS simulation: ZN(%1.0f), ZP(%1.0f), ZEM(%1.0f)\n",
+         fPMGain[0][0], fPMGain[1][0], fPMGain[2][1]));
+    }
   }
   else if((beamType.CompareTo("A-A")) == 0){
     // PTM gains for Pb-Pb @ 2.7+2.7 A TeV ***************
     // rescaled for Pb-Pb @ 1.38+1.38 A TeV ***************
-    // New correction coefficients for PMT gains needed
-    // to reproduce experimental spectra (from Grazia Jul 2010)
+    // Values corrected after 2010 Pb-Pb data taking (7/2/2011 - Ch.)
+    // Experimental data compared to EMD simulation for single nucleon peaks:
+    // ZN gains must be divided by 4, ZP gains by 10!
     Float_t scalGainFactor = fBeamEnergy/2760.;
     for(Int_t j = 0; j < 5; j++){
-       fPMGain[0][j] = 50000./scalGainFactor;           
-       fPMGain[1][j] = 100000./scalGainFactor;                  
-       fPMGain[2][j] = 100000./scalGainFactor;                  
-       fPMGain[3][j] = 50000./scalGainFactor;           
-       fPMGain[4][j] = 100000./scalGainFactor;    
+       fPMGain[0][j] = 50000./(4*scalGainFactor);  // ZNC               
+       fPMGain[1][j] = 100000./(5*scalGainFactor); // ZPC       
+       fPMGain[2][j] = 100000./scalGainFactor;            // ZEM
+       fPMGain[3][j] = 50000./(4*scalGainFactor);  // ZNA               
+       fPMGain[4][j] = 100000./(5*scalGainFactor); // ZPA    
     }
     AliInfo(Form("    PMT gains for Pb-Pb @ %1.0f+%1.0f A GeV: ZN(%1.0f), ZP(%1.0f), ZEM(%1.0f)\n",
        fBeamEnergy, fBeamEnergy, fPMGain[0][0], fPMGain[1][0], fPMGain[2][1]));
@@ -295,10 +317,10 @@ void AliZDCDigitizer::Exec(Option_t* /*option*/)
       specPProj = ((AliGenHijingEventHeader*) genHeader)->ProjSpectatorsp();
       specNTarg = ((AliGenHijingEventHeader*) genHeader)->TargSpectatorsn();
       specPTarg = ((AliGenHijingEventHeader*) genHeader)->TargSpectatorsp();
-      printf("\n\t AliZDCDigitizer: b = %1.2f fm\n"
+      /*printf("\n\t AliZDCDigitizer: b = %1.2f fm\n"
       " \t    PROJ.:  #spectator n %d, #spectator p %d\n"
       " \t    TARG.:  #spectator n %d, #spectator p %d\n", 
-      impPar, specNProj, specPProj, specNTarg, specPTarg);
+      impPar, specNProj, specPProj, specNTarg, specPTarg);*/
     }
     
   }
@@ -310,13 +332,13 @@ void AliZDCDigitizer::Exec(Option_t* /*option*/)
     Int_t freeSpecNTarg, freeSpecPTarg;
     Fragmentation(impPar, specNTarg, specPTarg, freeSpecNTarg, freeSpecPTarg);
     SpectatorSignal(1, freeSpecNProj, pm);
-    printf("\t AliZDCDigitizer -> Adding signal for %d PROJ free spectator n",freeSpecNProj);
+//    printf("\t AliZDCDigitizer -> Adding signal for %d PROJ free spectator n",freeSpecNProj);
     SpectatorSignal(2, freeSpecPProj, pm);
-    printf(" and %d free spectator p\n",freeSpecPProj);
+//    printf(" and %d free spectator p\n",freeSpecPProj);
     SpectatorSignal(3, freeSpecNTarg, pm);
-    printf("\t AliZDCDigitizer -> Adding signal for %d TARG free spectator n",freeSpecNTarg);
+//    printf("\t AliZDCDigitizer -> Adding signal for %d TARG free spectator n",freeSpecNTarg);
     SpectatorSignal(4, freeSpecPTarg, pm);
-    printf(" and %d free spectator p\n\n",freeSpecPTarg);
+//    printf(" and %d free spectator p\n\n",freeSpecPTarg);
   }
 
 
@@ -506,6 +528,11 @@ void AliZDCDigitizer::SpectatorSignal(Int_t SpecType, Int_t numEvents,
     }
   }
   
+  if(!zdcSignal){
+    printf("\n No spectator signal available for ZDC digitization\n");
+    return;
+  } 
+  
   Int_t nentries = (Int_t) zdcSignal->GetEntries();
   
   Float_t *entry;