#include <TRandom.h>
// --- AliRoot header files
-#include "AliLog.h"
#include "AliRun.h"
#include "AliHeader.h"
#include "AliGenHijingEventHeader.h"
-#include "AliRunDigitizer.h"
+#include "AliGenCocktailEventHeader.h"
+#include "AliDigitizationInput.h"
#include "AliRunLoader.h"
+#include "AliLoader.h"
#include "AliGRPObject.h"
#include "AliCDBManager.h"
#include "AliCDBEntry.h"
fFracLostSignal(0.),
fPedData(0),
fSpectators2Track(kFALSE),
- fBeamEnergy(0.)
+ fBeamEnergy(0.),
+ fBeamType(""),
+ fIspASystem(kFALSE),
+ fIsRELDISgen(kFALSE)
{
// Default constructor
-
+ for(Int_t i=0; i<2; i++) fADCRes[i]=0.;
}
//____________________________________________________________________________
-AliZDCDigitizer::AliZDCDigitizer(AliRunDigitizer* manager):
- AliDigitizer(manager),
+AliZDCDigitizer::AliZDCDigitizer(AliDigitizationInput* digInput):
+ AliDigitizer(digInput),
fIsCalibration(0), //By default the simulation doesn't create calib. data
fIsSignalInADCGate(kFALSE),
fFracLostSignal(0.),
fPedData(GetPedData()),
fSpectators2Track(kFALSE),
- fBeamEnergy(0.)
+ fBeamEnergy(0.),
+ fBeamType(""),
+ fIspASystem(kFALSE),
+ fIsRELDISgen(kFALSE)
{
// Get calibration data
if(fIsCalibration!=0) printf("\n\t AliZDCDigitizer -> Creating calibration data (pedestals)\n");
- for(Int_t i=0; i<6; i++){
+ for(Int_t i=0; i<5; i++){
for(Int_t j=0; j<5; j++)
fPMGain[i][j] = 0.;
}
fFracLostSignal(digitizer.fFracLostSignal),
fPedData(digitizer.fPedData),
fSpectators2Track(digitizer.fSpectators2Track),
- fBeamEnergy(digitizer.fBeamEnergy)
+ fBeamEnergy(digitizer.fBeamEnergy),
+ fBeamType(digitizer.fBeamType),
+ fIspASystem(digitizer.fIspASystem),
+ fIsRELDISgen(digitizer.fIsRELDISgen)
{
// Copy constructor
- for(Int_t i=0; i<6; i++){
+ for(Int_t i=0; i<5; i++){
for(Int_t j=0; j<5; j++){
fPMGain[i][j] = digitizer.fPMGain[i][j];
}
{
// Initialize the digitizer
+
+ //printf(" **** Initializing AliZDCDigitizer fBeamEnergy = %1.0f GeV\n\n", fBeamEnergy);
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
entry->SetOwner(0);
AliCDBManager::Instance()->UnloadFromCache("GRP/GRP/Data");
}
- if(!grpData) AliError("No GRP entry found in OCDB!");
-
- TString beamType = grpData->GetBeamType();
- if(beamType==AliGRPObject::GetInvalidString()){
- AliError("\t UNKNOWN beam type from GRP obj -> PMT gains not set in ZDC digitizer!!!\n");
+ if(!grpData){
+ AliError("No GRP entry found in OCDB! \n ");
+ return kFALSE;
}
- fBeamEnergy = grpData->GetBeamEnergy();
- if(fBeamEnergy==AliGRPObject::GetInvalidFloat()){
- AliWarning("GRP/GRP/Data entry: missing value for the beam energy ! Using 0.");
+ fBeamType = grpData->GetBeamType();
+ if(fBeamType==AliGRPObject::GetInvalidString()){
AliError("\t UNKNOWN beam type from GRP obj -> PMT gains not set in ZDC digitizer!!!\n");
- fBeamEnergy = 0.;
}
-
- if((beamType.CompareTo("P-P")) == 0 || (beamType.CompareTo("p-p")) == 0){
- //PTM gains rescaled to beam energy for p-p
- if(fBeamEnergy != 0){
- for(Int_t j = 0; j < 5; j++){
- fPMGain[0][j] = (661.444/fBeamEnergy+0.000740671)*10000000;
- fPMGain[1][j] = (864.350/fBeamEnergy+0.002344)*10000000;
- fPMGain[2][j] = (1.32312-0.000101515*fBeamEnergy)*10000000;
- fPMGain[3][j] = fPMGain[0][j];
- fPMGain[4][j] = fPMGain[1][j] ;
- }
- 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][0]));
+
+ // If beam energy is not set from Config.C (RELDIS / spectator generators)
+ if(fBeamEnergy<0.01){
+ fBeamEnergy = grpData->GetBeamEnergy();
+ if(fBeamEnergy==AliGRPObject::GetInvalidFloat()){
+ AliWarning("GRP/GRP/Data entry: missing value for the beam energy ! Using 0.");
+ AliError("\t UNKNOWN beam type from GRP obj -> PMT gains not set in ZDC digitizer!!!\n");
+ fBeamEnergy = 0.;
}
}
- 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)
- Float_t scalGainFactor = fBeamEnergy/2760.;
- for(Int_t j = 0; j < 5; j++){
- fPMGain[0][j] = 1.515831*(661.444/fBeamEnergy+0.000740671)*10000000;
- fPMGain[1][j] = 0.674234*(864.350/fBeamEnergy+0.00234375)*10000000;
- fPMGain[2][j] = 0.;
- fPMGain[3][j] = 1.350938*(661.444/fBeamEnergy+0.000740671)*10000000;
- fPMGain[4][j] = 0.678597*(864.350/fBeamEnergy+0.00234375)*10000000;
- }
- 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 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][0]));
+
+ if(fIspASystem){
+ fBeamType = "p-A";
+ AliInfo(" AliZDCDigitizer -> Manually setting beam type to p-A\n");
}
-
+
+ // Setting beam type for spectator generator and RELDIS generator
+ if(((fBeamType.CompareTo("UNKNOWN")) == 0) || fIsRELDISgen){
+ fBeamType = "A-A";
+ AliInfo(" AliZDCDigitizer -> Manually setting beam type to A-A\n");
+ }
+ printf("\t AliZDCDigitizer -> beam type %s - beam energy = %f GeV\n", fBeamType.Data(), fBeamEnergy);
+
+ CalculatePMTGains();
+
// ADC Caen V965
fADCRes[0] = 0.0000008; // ADC Resolution high gain: 200 fC/adcCh
fADCRes[1] = 0.0000064; // ADC Resolution low gain: 25 fC/adcCh
}
//____________________________________________________________________________
-void AliZDCDigitizer::Exec(Option_t* /*option*/)
+void AliZDCDigitizer::Digitize(Option_t* /*option*/)
{
// Execute digitization
}
// impact parameter and number of spectators
- Float_t impPar = -1;
+ Float_t impPar = 0;
Int_t specNTarg = 0, specPTarg = 0;
Int_t specNProj = 0, specPProj = 0;
Float_t signalTime0 = 0.;
// loop over input streams
- for(Int_t iInput = 0; iInput<fManager->GetNinputs(); iInput++){
+ for(Int_t iInput = 0; iInput<fDigInput->GetNinputs(); iInput++){
// get run loader and ZDC loader
AliRunLoader* runLoader =
- AliRunLoader::GetRunLoader(fManager->GetInputFolderName(iInput));
+ AliRunLoader::GetRunLoader(fDigInput->GetInputFolderName(iInput));
AliLoader* loader = runLoader->GetLoader("ZDCLoader");
if(!loader) continue;
if(sdigit.GetTrackTime()<=signalTime0+30.) fIsSignalInADCGate = kTRUE;
if(sdigit.GetTrackTime()>signalTime0+30.){
fIsSignalInADCGate = kFALSE;
- // Vedi quaderno per spiegazione approx. usata
- // nel calcolo della fraz. di segnale perso
+ // Vedi quaderno per spiegazione approx. usata nel calcolo della fraz. di segnale perso
fFracLostSignal = (sdigit.GetTrackTime()-30)*(sdigit.GetTrackTime()-30)/280.;
}
}
if(!header) continue;
AliGenEventHeader* genHeader = header->GenEventHeader();
if(!genHeader) continue;
- if(!genHeader->InheritsFrom(AliGenHijingEventHeader::Class())) continue;
+ AliGenHijingEventHeader *hijingHeader = 0;
+ if(genHeader->InheritsFrom(AliGenHijingEventHeader::Class())) hijingHeader = dynamic_cast <AliGenHijingEventHeader*> (genHeader);
+ else if(genHeader->InheritsFrom(AliGenCocktailEventHeader::Class())){
+ TList* listOfHeaders = ((AliGenCocktailEventHeader*) genHeader)->GetHeaders();
+ if(listOfHeaders) hijingHeader = dynamic_cast <AliGenHijingEventHeader*> (listOfHeaders->FindObject("Hijing"));
+ else{
+ AliWarning(" No list of headers from generator -> skipping event\n");
+ continue;
+ }
+ }
+ if(!hijingHeader) continue;
if(fSpectators2Track==kTRUE){
- impPar = ((AliGenHijingEventHeader*) genHeader)->ImpactParameter();
- specNProj = ((AliGenHijingEventHeader*) genHeader)->ProjSpectatorsn();
- specPProj = ((AliGenHijingEventHeader*) genHeader)->ProjSpectatorsp();
- specNTarg = ((AliGenHijingEventHeader*) genHeader)->TargSpectatorsn();
- specPTarg = ((AliGenHijingEventHeader*) genHeader)->TargSpectatorsp();
- 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 = hijingHeader->ImpactParameter();
+ specNProj = hijingHeader->ProjSpectatorsn();
+ specPProj = hijingHeader->ProjSpectatorsp();
+ specNTarg = hijingHeader->TargSpectatorsn();
+ specPTarg = hijingHeader->TargSpectatorsp();
+ AliInfo(Form("\t AliZDCDigitizer: b = %1.2f fm\n"
+ " \t PROJECTILE: #spectator n %d, #spectator p %d\n"
+ " \t TARGET: #spectator n %d, #spectator p %d\n",
+ impPar, specNProj, specPProj, specNTarg, specPTarg));
- }
-
- // Applying fragmentation algorithm and adding spectator signal
- if(fSpectators2Track==kTRUE && impPar) {
- Int_t freeSpecNProj, freeSpecPProj;
- Fragmentation(impPar, specNProj, specPProj, freeSpecNProj, freeSpecPProj);
- 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);
- SpectatorSignal(2, freeSpecPProj, pm);
- printf(" and %d free spectator p\n",freeSpecPProj);
- SpectatorSignal(3, freeSpecNTarg, pm);
- 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);
+ // Applying fragmentation algorithm and adding spectator signal
+ Int_t freeSpecNProj=0, freeSpecPProj=0;
+ if(specNProj!=0 || specPProj!=0) Fragmentation(impPar, specNProj, specPProj, freeSpecNProj, freeSpecPProj);
+ Int_t freeSpecNTarg=0, freeSpecPTarg=0;
+ if(specNTarg!=0 || specPTarg!=0) Fragmentation(impPar, specNTarg, specPTarg, freeSpecNTarg, freeSpecPTarg);
+ if(freeSpecNProj!=0) SpectatorSignal(1, freeSpecNProj, pm);
+ if(freeSpecPProj!=0) SpectatorSignal(2, freeSpecPProj, pm);
+ AliInfo(Form("\t AliZDCDigitizer -> Adding spectator signal for PROJECTILE: %d free n and %d free p\n",freeSpecNProj,freeSpecPProj));
+ if(freeSpecNTarg!=0) SpectatorSignal(3, freeSpecNTarg, pm);
+ if(freeSpecPTarg!=0) SpectatorSignal(4, freeSpecPTarg, pm);
+ AliInfo(Form("\t AliZDCDigitizer -> Adding spectator signal for TARGET: %d free n and %d free p\n",freeSpecNTarg,freeSpecPTarg));
+ }
}
// get the output run loader and loader
AliRunLoader* runLoader =
- AliRunLoader::GetRunLoader(fManager->GetOutputFolderName());
+ AliRunLoader::GetRunLoader(fDigInput->GetOutputFolderName());
AliLoader* loader = runLoader->GetLoader("ZDCLoader");
if(!loader) {
AliError("no ZDC loader found");
}
+//_____________________________________________________________________________
+void AliZDCDigitizer::CalculatePMTGains()
+{
+// Calculate PMT gain according to beam type and beam energy
+ if(((fBeamType.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;
+ fPMGain[1][j] = 0.674234*(864.350/fBeamEnergy+0.00234375)*10000000;
+ fPMGain[3][j] = 1.350938*(661.444/fBeamEnergy+0.000740671)*10000000;
+ fPMGain[4][j] = 0.678597*(864.350/fBeamEnergy+0.00234375)*10000000;
+ }
+ fPMGain[2][1] = 0.869654*(1.32312-0.000101515*fBeamEnergy)*10000000;
+ fPMGain[2][2] = 1.030883*(1.32312-0.000101515*fBeamEnergy)*10000000;
+ //
+ AliInfo(Form("\n ZDC PMT gains for p-p @ %1.0f+%1.0f GeV: ZNC(%1.0f), ZPC(%1.0f), ZEM(%1.0f), ZNA(%1.0f) ZPA(%1.0f)\n",
+ fBeamEnergy, fBeamEnergy, fPMGain[0][0], fPMGain[1][0], fPMGain[2][1], fPMGain[3][0], fPMGain[4][0]));
+
+ }
+ }
+ else if(((fBeamType.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 ***************
+ // 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./(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("\n ZDC 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]));
+ }
+ else if(((fBeamType.CompareTo("p-A")) == 0)){
+ // PTM gains for Pb-Pb @ 1.38+1.38 A TeV on side A
+ // PTM gains rescaled to beam energy for p-p on side C
+ // WARNING! Energies are set by hand for 2011 pA RUN!!!
+ Float_t scalGainFactor = fBeamEnergy*82/(208*2760.);
+
+ for(Int_t j = 0; j < 5; j++){
+ fPMGain[0][j] = 1.515831*(661.444/fBeamEnergy+0.000740671)*10000000; //ZNC (p)
+ fPMGain[1][j] = 0.674234*(864.350/fBeamEnergy+0.00234375)*10000000; //ZPC (p)
+ fPMGain[2][j] = 100000./scalGainFactor; // ZEM (Pb)
+ fPMGain[3][j] = 50000./(4*scalGainFactor); // ZNA (Pb)
+ fPMGain[4][j] = 100000./(5*scalGainFactor); // ZPA (Pb)
+ }
+ AliInfo(Form("\n ZDC PMT gains for p-Pb: ZNC(%1.0f), ZPC(%1.0f), ZEM(%1.0f), ZNA(%1.0f) ZPA(%1.0f)\n",
+ fPMGain[0][0], fPMGain[1][0], fPMGain[2][1], fPMGain[3][0], fPMGain[4][0]));
+ }
+}
+
//_____________________________________________________________________________
void AliZDCDigitizer::Fragmentation(Float_t impPar, Int_t specN, Int_t specP,
Int_t &freeSpecN, Int_t &freeSpecP) const
Int_t nAlpha = frag.GetNalpha();
// Attach neutrons
+ frag.AttachNeutrons();
Int_t ztot = frag.GetZtot();
Int_t ntot = frag.GetNtot();
- frag.AttachNeutrons();
+
+ // Removing fragments and alpha pcs
freeSpecN = specN-ntot-2*nAlpha;
freeSpecP = specP-ztot-2*nAlpha;
+
// Removing deuterons
Int_t ndeu = (Int_t) (freeSpecN*frag.DeuteronNumber());
freeSpecN -= ndeu;
+ freeSpecP -= ndeu;
//
if(freeSpecN<0) freeSpecN=0;
if(freeSpecP<0) freeSpecP=0;
return;
}
- TNtuple* zdcSignal;
+ TNtuple* zdcSignal=0x0;
Float_t sqrtS = 2*fBeamEnergy;
//
if(TMath::Abs(sqrtS-5500) < 100.){
+ AliInfo(" Extracting signal from SpectatorSignal/energy5500 ");
specSignalFile->cd("energy5500");
//
if(SpecType == 1) { // --- Signal for projectile spectator neutrons
}
}
else if(TMath::Abs(sqrtS-2760) < 100.){
+ AliInfo(" Extracting signal from SpectatorSignal/energy2760 ");
specSignalFile->cd("energy2760");
//
if(SpecType == 1) { // --- Signal for projectile spectator neutrons
}
}
+ if(!zdcSignal){
+ printf("\n No spectator signal available for ZDC digitization\n");
+ return;
+ }
+
Int_t nentries = (Int_t) zdcSignal->GetEntries();
Float_t *entry;