]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ZDC/AliZDCMerger.cxx
Adding TOFFEE in ShuttleInput
[u/mrichter/AliRoot.git] / ZDC / AliZDCMerger.cxx
index 3ea80783ba496ed887cd7e71cdc80f5e803548e7..2a6e36a9065f175cb2d89d2c3b43ed1e400c03a3 100644 (file)
@@ -120,11 +120,9 @@ void AliZDCMerger::Background(Float_t &fImpPar, Int_t &fSpecn, Int_t &fSpecp)
     AliHeader *header = gAlice->GetHeader();
     AliGenEventHeader* mcHeader = header->GenEventHeader();
     fImpPar = ((AliGenHijingEventHeader*) mcHeader)->ImpactParameter();
-    Int_t dSpecn  = ((AliGenHijingEventHeader*) mcHeader)->Spectatorsn();
-    Int_t dSpecp  = ((AliGenHijingEventHeader*) mcHeader)->Spectatorsp();
-    // Until there is only 1 ZDC set the # of spectators must be divided by 2!!!
-    fSpecn = dSpecn/2;
-    fSpecp = dSpecp/2;
+    fSpecn  = ((AliGenHijingEventHeader*) mcHeader)->ProjSpectatorsn();
+    fSpecp  = ((AliGenHijingEventHeader*) mcHeader)->ProjSpectatorsp();
+    // 
     printf("\n HIJING ev. #%d - b = %f fm, Nspecn = %d, Nspecp = %d\n",
             fNEvBgr,fImpPar,fSpecn,fSpecp);
 }
@@ -258,14 +256,14 @@ void AliZDCMerger::ExtractSignal(Int_t SpecType)
  
  Int_t numEvents = 0;
  if(SpecType == 1){            // --- Signal for spectator neutrons
-   fFnSpecn = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/ZNsignalntu.root");
+   fFnSpecn = gSystem->ExpandPathName("$ALICE_ROOT/ZDC/ZNsignalntu.root");
    fSpecnFile = TFile::Open(fFnSpecn,"R");
    fSpecnFile->cd();
    printf("\n  --- ExtractSignal x n: file %s opened\n", fFnSpecn);
    numEvents = fFreeSpn;
  }
  else if(SpecType == 2){       // --- Signal for spectator protons
-   fFnSpecp = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/ZPsignalntu.root");
+   fFnSpecp = gSystem->ExpandPathName("$ALICE_ROOT/ZDC/ZPsignalntu.root");
    fSpecpFile = TFile::Open(fFnSpecp,"R");
    fSpecpFile->cd();
    printf("\n  --- ExtractSignal x p: file %s opened\n", fFnSpecp);
@@ -286,7 +284,7 @@ void AliZDCMerger::ExtractSignal(Int_t SpecType)
   }
   for(pl=0;pl<numEvents;pl++){
      rnd[pl] = (Int_t) (9999*gRandom->Rndm());
-     if(rnd[pl] >= 9998) rnd[pl] = 9997;
+     if(rnd[pl] >= 9999) rnd[pl] = 9998;
      //printf("        rnd[%d] = %d\n",pl,rnd[pl]);     
   }
   // Sorting vector in ascending order with C function QSORT 
@@ -325,154 +323,3 @@ void AliZDCMerger::ExtractSignal(Int_t SpecType)
   }
       
 }
-
-//____________________________________________________________________________
-void AliZDCMerger::Digitize(Int_t fNMhits, TClonesArray *fMHits)
-{
-// Digitization
-
-  printf("\n   AliZDCMerger->Digitize()");
-
-  AliZDC *zdc = (AliZDC *)gAlice->GetModule("ZDC");
-//  if(zdc) printf("\n         Ho trovato lo ZDC!\n");
-  Int_t lightQ, lightC, sector[2], digit;
-  Int_t pmCZN = 0, pmCZP = 0, pmQZN[4], pmQZP[4], pmZEM1 = 0, pmZEM2 = 0;
-  Int_t i;
-  for(i=0; i<4; i++){
-     pmQZN[i] = 0;
-     pmQZP[i] = 0;
-  }
-  
-  AliZDCMergedHit *mHit;
-  Int_t imhit;
-  printf("        fNMHits = %d\n", fNMhits);
-  // Loop over SDigits
-  for(imhit=0; imhit<fNMhits; imhit++){
-     
-     mHit = (AliZDCMergedHit*) fMHits->UncheckedAt(imhit);
-     sector[0] = mHit->GetSector(0);
-     sector[1] = mHit->GetSector(1);
-   // tmp -> c'erano i quadranti cannati!
-  if((sector[1]!=1) && (sector[1]!=2) && (sector[1]!=3) && (sector[1]!=4)){
-     printf("\n  *** ERROR!!! sector[0] = %d, sector[1] = %d\n",
-             sector[0], sector[1]);
-       sector[1] = 0;
-   }
-     lightQ    = Int_t(mHit->GetLightPMQ());
-     lightC    = Int_t(mHit->GetLightPMC());
-//     printf("    imhit = %d -> DET. = %d, quad = %d,PMQ = %d, PMC = %d\n", 
-//      imhit,sector[0], sector[1],lightQ, lightC);
-     
-     if(sector[0] == 1){          //ZN 
-       pmCZN = pmCZN + lightC;
-       pmQZN[sector[1]-1] = pmQZN[sector[1]-1] + lightQ;
-     }
-     else if(sector[0] == 2){     //ZP 
-       pmCZP = pmCZP + lightC;
-       pmQZP[sector[1]-1] = pmQZP[sector[1]-1] + lightQ;
-     }
-     else if(sector[0] == 3){     //ZEM 
-       if(sector[1] ==1) pmZEM1 = pmZEM1 + lightC;
-       else              pmZEM2 = pmZEM2 + lightQ;
-     }
-  } // SDigits loop
-      
-  // ### Digits creation ###############################################
-  // Create digits for ZN
-  Int_t pedValue;
-  sector[0] = 1; // Detector = ZN
-  sector[1] = 0; // Common PM ADC
-  digit = Phe2ADCch(1, 0, pmCZN);
-  printf("\n\n ZN ###  pmCZN = %d      ADCZN = %d",pmCZN, digit);
-  pedValue = AddPedestal();
-  digit += pedValue;
-//  printf("   pedValue = %d",pedValue);
-  zdc->AddDigit(sector, digit);
-  Int_t j;
-  for(j=0; j<4; j++){
-    sector[1] = j+1; // Towers PM ADCs
-    digit = Phe2ADCch(1, j+1, pmQZN[j]);
-    printf("\n         pmQZN[%d] = %d  phe     ADCZN[%d] = %d adcCh",j,pmQZN[j],j,digit);
-    pedValue = AddPedestal();
-    digit += pedValue;
-//    printf(" pedValue = %d",pedValue);
-    zdc->AddDigit(sector, digit);
-  }
-  printf("\n");
-  
-  // Create digits for ZP
-  sector[0] = 2; // Detector = ZP
-  sector[1] = 0; // Common PM ADC
-  digit = Phe2ADCch(2, 0, pmCZP);
-  printf("\n   ZP --- pmCZP = %d       phe     ADCZP = %d adcCh",pmCZP,digit);
-  pedValue = AddPedestal();
-  digit += pedValue;
-//  printf("   pedValue = %d",pedValue);
-  zdc->AddDigit(sector, digit);
-  for(j=0; j<4; j++){
-    sector[1] = j+1; // Towers PM ADCs
-    digit = Phe2ADCch(2, j+1, pmQZP[j]);
-    printf("\n        pmQZP[%d] = %d   phe     ADCZP[%d] = %d adcCh",j,pmQZP[j],j,digit);
-    pedValue = AddPedestal();
-    digit += pedValue;
-//    printf(" pedValue = %d",pedValue);
-    zdc->AddDigit(sector, digit);
-  }
-  printf("\n");
-  
-  // Create digits for ZEM
-  sector[0] = 3; 
-  sector[1] = 1; // Detector = ZEM1
-  digit  = Phe2ADCch(3, 1, pmZEM1);
-  printf("\n   ZEM *** pmZEM1 = %d      phe     ADCZEM1 = %d adcCh",pmZEM1,digit);
-  pedValue = AddPedestal();
-  digit += pedValue;
-//  printf("  pedValue = %d\n",pedValue);
-  zdc->AddDigit(sector, digit); 
-  sector[1] = 2; // Detector = ZEM2
-  digit  = Phe2ADCch(3, 2, pmZEM2);
-  printf("\n   ZEM *** pmZEM2 = %d      phe     ADCZEM2 = %d adcCh\n",pmZEM2,digit);
-  pedValue = AddPedestal();
-  digit += pedValue;
-//  printf("  pedValue = %d\n",pedValue);
-  zdc->AddDigit(sector, digit); 
-}
-
-//_____________________________________________________________________________
-Int_t AliZDCMerger::Phe2ADCch(Int_t Det, Int_t Quad, Int_t Light)
-{
-  // Evaluation of the ADC channel corresponding to the light yield Light
-
-  if(gAlice->GetDebug() > 0){
-//    printf("\n  Phe2ADCch -> Detector = %d, Quadrant = %d, Light = %d\n", Det, Quad, Light);
-  }
-  
-  Int_t adcCh = 0;
-  
-  Int_t j,i;
-  for(i=0; i<3; i++){
-     for(j=0; j<5; j++){
-        fPMGain[i][j]   = 100000.;
-     }
-  }
-  fADCRes   = 0.00000064; // ADC Resolution: 250 fC/adcCh
-  
-  adcCh = (Int_t) (Light*fPMGain[Det-1][Quad]*fADCRes);
-     
-  return adcCh;
-}
-
-//_____________________________________________________________________________
-Int_t AliZDCMerger::AddPedestal()
-{
-  // --- Pedestal value -> extracted from a gaussian distribution
-  // obtained from the beam test on the ZEM prototype (Aug. 2000)
-  
-  Int_t pedValue;
-  Float_t pedMean  = 50.;
-  Float_t pedWidth = 5.;
-  
-  pedValue    = (Int_t) gRandom->Gaus(pedMean,pedWidth);
-  
-  return pedValue;
-}