X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=ZDC%2FAliZDCDigitizer.cxx;h=73209002498a137b178e5f359c7be1983c71c3cd;hb=bdc16ddd23bdaf00bc133257bfcf4139cdd7df27;hp=986ab09922feed705884604e285f298110b5e467;hpb=a736fd93925bbd527050341d1cb70b279af56576;p=u%2Fmrichter%2FAliRoot.git diff --git a/ZDC/AliZDCDigitizer.cxx b/ZDC/AliZDCDigitizer.cxx index 986ab09922f..73209002498 100644 --- a/ZDC/AliZDCDigitizer.cxx +++ b/ZDC/AliZDCDigitizer.cxx @@ -21,7 +21,9 @@ // // /////////////////////////////////////////////////////////////////////////////// +// --- Standard libraries #include +#include // --- ROOT system #include @@ -30,12 +32,13 @@ #include // --- 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" @@ -58,21 +61,29 @@ AliZDCDigitizer::AliZDCDigitizer() : fFracLostSignal(0.), fPedData(0), fSpectators2Track(kFALSE), - fBeamEnergy(0.) + fBeamEnergy(0.), + fBeamType(""), + fIspASystem(kFALSE), + fIsRELDISgen(kFALSE), + fSpectatorData(0) { // 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), + fSpectatorData(NULL) { // Get calibration data if(fIsCalibration!=0) printf("\n\t AliZDCDigitizer -> Creating calibration data (pedestals)\n"); @@ -86,7 +97,10 @@ AliZDCDigitizer::AliZDCDigitizer(AliRunDigitizer* manager): AliZDCDigitizer::~AliZDCDigitizer() { // Destructor -// Not implemented + if(fSpectatorData!=NULL){ + fSpectatorData->Close(); + delete fSpectatorData; + } } @@ -98,7 +112,11 @@ AliZDCDigitizer::AliZDCDigitizer(const AliZDCDigitizer &digitizer): fFracLostSignal(digitizer.fFracLostSignal), fPedData(digitizer.fPedData), fSpectators2Track(digitizer.fSpectators2Track), - fBeamEnergy(digitizer.fBeamEnergy) + fBeamEnergy(digitizer.fBeamEnergy), + fBeamType(digitizer.fBeamType), + fIspASystem(digitizer.fIspASystem), + fIsRELDISgen(digitizer.fIsRELDISgen), + fSpectatorData(digitizer.fSpectatorData) { // Copy constructor @@ -117,6 +135,8 @@ Bool_t AliZDCDigitizer::Init() { // 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; @@ -138,63 +158,42 @@ Bool_t AliZDCDigitizer::Init() return kFALSE; } - TString beamType = grpData->GetBeamType(); - if(beamType==AliGRPObject::GetInvalidString()){ + fBeamType = grpData->GetBeamType(); + if(fBeamType==AliGRPObject::GetInvalidString()){ AliError("\t UNKNOWN beam type from GRP obj -> PMT gains not set in ZDC digitizer!!!\n"); } - 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.; - } - - 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; - 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; - } - else{ - Float_t scalGainFactor = fBeamEnergy/2760.; - for(Int_t j = 0; j < 5; j++){ - fPMGain[0][j] = 50000./(4*scalGainFactor); // ZNC - fPMGain[1][j] = 100000./(10*scalGainFactor); // ZPC - fPMGain[2][j] = 100000./scalGainFactor; // ZEM - fPMGain[3][j] = 50000./(4*scalGainFactor); // ZNA - fPMGain[4][j] = 100000./(10*scalGainFactor); // ZPA - } + // 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.; } - 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 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 *************** - // 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./(10*scalGainFactor); // ZPC - fPMGain[2][j] = 100000./scalGainFactor; // ZEM - fPMGain[3][j] = 50000./(4*scalGainFactor); // ZNA - fPMGain[4][j] = 100000./(10*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])); + + /*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("\n\t AliZDCDigitizer -> beam type %s - beam energy = %f GeV\n", fBeamType.Data(), fBeamEnergy); + if(fSpectators2Track) printf("\n\t AliZDCDigitizer -> spectator signal added at digit level\n\n"); + + if(fBeamEnergy>0.1){ + ReadPMTGains(); + //CalculatePMTGains(); } - + else{ + AliWarning("\n Beam energy is 0 -> ZDC PMT gains can't be set -> NO ZDC DIGITS!!!\n"); + } + // 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 @@ -203,7 +202,7 @@ Bool_t AliZDCDigitizer::Init() } //____________________________________________________________________________ -void AliZDCDigitizer::Exec(Option_t* /*option*/) +void AliZDCDigitizer::Digitize(Option_t* /*option*/) { // Execute digitization @@ -227,11 +226,11 @@ void AliZDCDigitizer::Exec(Option_t* /*option*/) // ### Out of time ADC added (22 channels) // --- same codification as for signal PTMs (see above) // ------------------------------------------------------------ - Float_t pmoot[5][5]; - for(Int_t iSector1=0; iSector1<5; iSector1++) - for(Int_t iSector2=0; iSector2<5; iSector2++){ - pmoot[iSector1][iSector2] = 0; - } + // Float_t pmoot[5][5]; + // for(Int_t iSector1=0; iSector1<5; iSector1++) + // for(Int_t iSector2=0; iSector2<5; iSector2++){ + // pmoot[iSector1][iSector2] = 0; + // } // impact parameter and number of spectators Float_t impPar = 0; @@ -240,11 +239,11 @@ void AliZDCDigitizer::Exec(Option_t* /*option*/) Float_t signalTime0 = 0.; // loop over input streams - for(Int_t iInput = 0; iInputGetNinputs(); iInput++){ + for(Int_t iInput = 0; iInputGetNinputs(); 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; @@ -274,8 +273,7 @@ void AliZDCDigitizer::Exec(Option_t* /*option*/) 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.; } } @@ -304,42 +302,56 @@ void AliZDCDigitizer::Exec(Option_t* /*option*/) if(!header) continue; AliGenEventHeader* genHeader = header->GenEventHeader(); if(!genHeader) continue; - if(!genHeader->InheritsFrom(AliGenHijingEventHeader::Class())) 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); + AliGenHijingEventHeader *hijingHeader = 0; + if(genHeader->InheritsFrom(AliGenHijingEventHeader::Class())) hijingHeader = dynamic_cast (genHeader); + else if(genHeader->InheritsFrom(AliGenCocktailEventHeader::Class())){ + TList* listOfHeaders = ((AliGenCocktailEventHeader*) genHeader)->GetHeaders(); + if(listOfHeaders){ + for(Int_t iH = 0; iH < listOfHeaders->GetEntries(); ++iH) { + AliGenEventHeader *currHeader = dynamic_cast (listOfHeaders->At(iH)); + if (currHeader && currHeader->InheritsFrom(AliGenHijingEventHeader::Class())) { + hijingHeader = dynamic_cast (currHeader); + break; + } + } + } + else{ + printf(" No list of headers from generator \n"); + } + } + if(!hijingHeader){ + printf(" No HIJING header found in list of headers from generator\n"); } - } - - // 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); + if(hijingHeader && fSpectators2Track==kTRUE){ + impPar = hijingHeader->ImpactParameter(); + specNProj = hijingHeader->ProjSpectatorsn(); + specPProj = hijingHeader->ProjSpectatorsp(); + specNTarg = hijingHeader->TargSpectatorsn(); + specPTarg = hijingHeader->TargSpectatorsp(); + /*printf("\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 + 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); + //printf("\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); + //printf("\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"); @@ -372,7 +384,7 @@ void AliZDCDigitizer::Exec(Option_t* /*option*/) //Ch. debug //printf("\t DIGIT added -> det %d quad %d - digi[0,1] = [%d, %d]\n", - // sector[0], sector[1], digi[0], digi[1]); // Chiara debugging! + // sector[0], sector[1], digi[0], digi[1]); // Chiara debugging! } } // Loop over detector @@ -435,6 +447,168 @@ void AliZDCDigitizer::Exec(Option_t* /*option*/) } +//_____________________________________________________________________________ +void AliZDCDigitizer::ReadPMTGains() +{ +// Read PMT gain from an external file + + char *fname = gSystem->ExpandPathName("$ALICE_ROOT/ZDC/PMTGainsdata.txt"); + FILE *fdata = fopen(fname,"r"); + if(fdata==NULL){ + AliWarning(" Can't open file $ALICE_ROOT/ZDC/PMTGainsdata.txt to read ZDC PMT Gains\n"); + AliWarning(" -> ZDC signal will be pedestal!!!!!!!!!!!!\n\n"); + return; + } + int read=1; + Float_t data[5]; + Int_t beam[12], det[12]; + Float_t gain[12], aEne[12], bEne[12]; + for(int ir=0; ir<12; ir++){ + for(int ic=0; ic<5; ic++){ + read = fscanf(fdata,"%f ",&data[ic]); + if(read==0) AliDebug(3, " Error in reading PMT gains from external file "); + } + beam[ir] = (int) (data[0]); + det[ir] = (int) (data[1]); + gain[ir] = data[2]; + aEne[ir] = data[3]; + bEne[ir] = data[4]; + } + fclose(fdata); + + if(((fBeamType.CompareTo("P-P")) == 0) || ((fBeamType.CompareTo("p-p")) == 0)){ + for(int i=0; i<12; i++){ + if(beam[i]==0 && fBeamEnergy!=0.){ + if(det[i]!=31 && det[i]!=32){ + for(Int_t j=0; j<5; j++) fPMGain[det[i]-1][j] = gain[i]*(aEne[i]/fBeamEnergy+bEne[i]); + } + else if(det[i] == 31) fPMGain[2][1] = gain[i]*(aEne[i]-fBeamEnergy*bEne[i]); + else if(det[i] == 32) fPMGain[2][2] = gain[i]*(aEne[i]-fBeamEnergy*bEne[i]); + } + } + // + printf("\n AliZDCDigitizer::ReadPMTGains -> 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)){ + for(int i=0; i<12; i++){ + if(beam[i]==1){ + Float_t scalGainFactor = fBeamEnergy/2760.; + if(det[i]!=31 && det[i]!=32){ + for(Int_t j=0; j<5; j++) fPMGain[det[i]-1][j] = gain[i]/(aEne[i]*scalGainFactor); + } + else{ + for(int iq=1; iq<3; iq++) fPMGain[2][iq] = gain[i]/(aEne[i]*scalGainFactor); + } + } + } + // + printf("\n AliZDCDigitizer::ReadPMTGains -> 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) || ((fBeamType.CompareTo("P-A")) == 0) + || ((fBeamType.CompareTo("A-p")) == 0) || ((fBeamType.CompareTo("A-P")) == 0)){ + for(int i=0; i<12; i++){ + if(beam[i]==0 && fBeamEnergy!=0.){ + if(det[i]==1 || det[i]==2){ + for(Int_t j=0; j<5; j++) fPMGain[det[i]-1][j] = gain[i]*(aEne[i]/fBeamEnergy+bEne[i]); + } + } + if(beam[i]==1){ + Float_t scalGainFactor = fBeamEnergy/2760.; + Float_t npartScalingFactor = 208./15.; + if(det[i]==4 || det[i]==5){ + for(Int_t j=0; j<5; j++) fPMGain[det[i]-1][j] = npartScalingFactor*gain[i]/(aEne[i]*scalGainFactor); + } + else if(det[i]==31 || det[i]==32){ + for(int iq=1; iq<3; iq++) fPMGain[2][iq] = npartScalingFactor*gain[i]/(aEne[i]*scalGainFactor); + } + } + } + printf("\n AliZDCDigitizer::ReadPMTGains -> 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::CalculatePMTGains() +{ +// Calculate PMT gain according to beam type and beam energy + if( ((fBeamType.CompareTo("P-P")) == 0) || ((fBeamType.CompareTo("p-p"))) ){ + // 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; + // + printf("\n AliZDCDigitizer::CalculatePMTGains -> 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 + } + printf("\n AliZDCDigitizer::CalculatePMTGains -> 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) || ((fBeamType.CompareTo("P-A"))) ){ + // 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/2760.; + Float_t npartScalingFactor = 208./15.; + + 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) + if(j<2) fPMGain[2][j] = npartScalingFactor*100000./scalGainFactor; // ZEM (Pb) + // Npart max scales from 400 in Pb-Pb to ~8 in pPb -> *40. + fPMGain[3][j] = npartScalingFactor*50000/(4*scalGainFactor); // ZNA (Pb) + fPMGain[4][j] = npartScalingFactor*100000/(5*scalGainFactor); // ZPA (Pb) + } + printf("\n AliZDCDigitizer::CalculatePMTGains -> 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]); + } + else if(((fBeamType.CompareTo("A-p")) == 0) || ((fBeamType.CompareTo("A-P"))) ){ + // PTM gains for Pb-Pb @ 1.38+1.38 A TeV on side + // 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/2760.; + Float_t npartScalingFactor = 208./15.; + + for(Int_t j = 0; j < 5; j++){ + fPMGain[3][j] = 1.350938*(661.444/fBeamEnergy+0.000740671)*10000000; //ZNA (p) + fPMGain[4][j] = 0.678597*(864.350/fBeamEnergy+0.00234375)*10000000; //ZPA (p) + // Npart max scales from 400 in Pb-Pb to ~8 in pPb -> *40. + fPMGain[1][j] = npartScalingFactor*50000/(4*scalGainFactor); // ZNC (Pb) + fPMGain[2][j] = npartScalingFactor*100000/(5*scalGainFactor); // ZPC (Pb) + } + fPMGain[2][1] = 0.869654*(1.32312-0.000101515*fBeamEnergy)*10000000; // ZEM (pp) + fPMGain[2][2] = 1.030883*(1.32312-0.000101515*fBeamEnergy)*10000000; // ZEM (pp) + printf("\n AliZDCDigitizer::CalculatePMTGains -> 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 @@ -467,13 +641,12 @@ void AliZDCDigitizer::Fragmentation(Float_t impPar, Int_t specN, Int_t specP, } //_____________________________________________________________________________ -void AliZDCDigitizer::SpectatorSignal(Int_t SpecType, Int_t numEvents, - Float_t pm[5][5]) const +void AliZDCDigitizer::SpectatorSignal(Int_t SpecType, Int_t numEvents, Float_t pm[5][5]) { // add signal of the spectators - TFile *specSignalFile = TFile::Open("$ALICE_ROOT/ZDC/SpectatorSignal.root"); - if(!specSignalFile || !specSignalFile->IsOpen()) { + if(!fSpectatorData) fSpectatorData = TFile::Open("$ALICE_ROOT/ZDC/SpectatorSignal.root"); + if(!fSpectatorData || !fSpectatorData->IsOpen()) { AliError((" Opening file $ALICE_ROOT/ZDC/SpectatorSignal.root failed\n")); return; } @@ -483,42 +656,44 @@ void AliZDCDigitizer::SpectatorSignal(Int_t SpecType, Int_t numEvents, Float_t sqrtS = 2*fBeamEnergy; // if(TMath::Abs(sqrtS-5500) < 100.){ - specSignalFile->cd("energy5500"); + AliInfo(" Extracting signal from SpectatorSignal/energy5500 "); + fSpectatorData->cd("energy5500"); // if(SpecType == 1) { // --- Signal for projectile spectator neutrons - specSignalFile->GetObject("energy5500/ZNCSignal;1",zdcSignal); + fSpectatorData->GetObject("energy5500/ZNCSignal;1",zdcSignal); if(!zdcSignal) AliError(" PROBLEM!!! Can't retrieve ZNCSignal from SpectatorSignal.root file"); } else if(SpecType == 2) { // --- Signal for projectile spectator protons - specSignalFile->GetObject("energy5500/ZPCSignal;1",zdcSignal); + fSpectatorData->GetObject("energy5500/ZPCSignal;1",zdcSignal); if(!zdcSignal) AliError(" PROBLEM!!! Can't retrieve ZPCSignal from SpectatorSignal.root file"); } else if(SpecType == 3) { // --- Signal for target spectator neutrons - specSignalFile->GetObject("energy5500/ZNASignal;1",zdcSignal); + fSpectatorData->GetObject("energy5500/ZNASignal;1",zdcSignal); if(!zdcSignal) AliError(" PROBLEM!!! Can't retrieve ZNASignal from SpectatorSignal.root file"); } else if(SpecType == 4) { // --- Signal for target spectator protons - specSignalFile->GetObject("energy5500/ZPASignal;1",zdcSignal); + fSpectatorData->GetObject("energy5500/ZPASignal;1",zdcSignal); if(!zdcSignal) AliError(" PROBLEM!!! Can't retrieve ZPASignal from SpectatorSignal.root file"); } } else if(TMath::Abs(sqrtS-2760) < 100.){ - specSignalFile->cd("energy2760"); + AliInfo(" Extracting signal from SpectatorSignal/energy2760 "); + fSpectatorData->cd("energy2760"); // if(SpecType == 1) { // --- Signal for projectile spectator neutrons - specSignalFile->GetObject("energy2760/ZNCSignal;1",zdcSignal); + fSpectatorData->GetObject("energy2760/ZNCSignal;1",zdcSignal); if(!zdcSignal) AliError(" PROBLEM!!! Can't retrieve ZNCSignal from SpectatorSignal.root file"); } else if(SpecType == 2) { // --- Signal for projectile spectator protons - specSignalFile->GetObject("energy2760/ZPCSignal;1",zdcSignal); + fSpectatorData->GetObject("energy2760/ZPCSignal;1",zdcSignal); if(!zdcSignal) AliError(" PROBLEM!!! Can't retrieve ZPCSignal from SpectatorSignal.root file"); } else if(SpecType == 3) { // --- Signal for target spectator neutrons - specSignalFile->GetObject("energy2760/ZNASignal;1",zdcSignal); + fSpectatorData->GetObject("energy2760/ZNASignal;1",zdcSignal); if(!zdcSignal) AliError(" PROBLEM!!! Can't retrieve ZNASignal from SpectatorSignal.root file"); } else if(SpecType == 4) { // --- Signal for target spectator protons - specSignalFile->GetObject("energy2760/ZPASignal;1",zdcSignal); + fSpectatorData->GetObject("energy2760/ZPASignal;1",zdcSignal); if(!zdcSignal) AliError(" PROBLEM!!! Can't retrieve ZPASignal from SpectatorSignal.root file"); } } @@ -573,8 +748,6 @@ void AliZDCDigitizer::SpectatorSignal(Int_t SpecType, Int_t numEvents, } }while(ievClose(); - delete specSignalFile; }