fEnCalibData(0),
fTowCalibData(0),
fZDCCalibFName(""),
- fSpectatorTracked(1)
+ fSpectatorTracked(1),
+ fBeamEnergy(0.),
+ fIspASystem(kFALSE),
+ fIsRELDISgen(kFALSE),
+ fOnlyZEM(kFALSE),
+ fFindMother(kFALSE)
{
//
// Default constructor for the Zero Degree Calorimeter base class
//_____________________________________________________________________________
AliZDC::AliZDC(const char *name, const char *title) :
AliDetector(name,title),
- fNoShower (0),
+ fNoShower(0),
fPedCalib(0),
fEnCalibData(0),
fTowCalibData(0),
fZDCCalibFName(""),
- fSpectatorTracked(1)
+ fSpectatorTracked(1),
+ fBeamEnergy(0.),
+ fIspASystem(kFALSE),
+ fIsRELDISgen(kFALSE),
+ fOnlyZEM(kFALSE),
+ fFindMother(kFALSE)
{
//
// Standard constructor for the Zero Degree Calorimeter base class
fHits = new TClonesArray("AliZDCHit",1000);
gAlice->GetMCApp()->AddHitList(fHits);
- char sensname[5],senstitle[25];
- sprintf(sensname,"ZDC");
- sprintf(senstitle,"ZDC dummy");
- SetName(sensname); SetTitle(senstitle);
+ SetName("ZDC"); SetTitle("ZDC");
}
fEnCalibData(ZDC.fEnCalibData),
fTowCalibData(ZDC.fTowCalibData),
fZDCCalibFName(ZDC.fZDCCalibFName),
-fSpectatorTracked(ZDC.fSpectatorTracked)
+fSpectatorTracked(ZDC.fSpectatorTracked),
+fBeamEnergy(ZDC.fBeamEnergy),
+fIspASystem(ZDC.fIspASystem),
+fIsRELDISgen(ZDC.fIsRELDISgen),
+fOnlyZEM(ZDC.fOnlyZEM),
+fFindMother(ZDC.fFindMother)
{
// copy constructor
}
fEnCalibData = ZDC.fEnCalibData;
fTowCalibData = ZDC.fTowCalibData;
fZDCCalibFName = ZDC.fZDCCalibFName;
+ fBeamEnergy = ZDC.fBeamEnergy;
+ fIspASystem = ZDC.fIspASystem;
+ fIsRELDISgen = ZDC.fIsRELDISgen;
+ fOnlyZEM = ZDC.fOnlyZEM;
+ fFindMother = ZDC.fFindMother;
} return *this;
}
//
// Add a ZDC hit to the hit list.
- static Float_t trackTime=0., primKinEn=0., xImpact=0., yImpact=0., sFlag=0.;
- static Int_t pcPDGcode, motPDGcode;
+ static Float_t trackTime=0., trackEta=0., primKinEn=0., xImpact=0., yImpact=0., sFlag=0.;
+ static Int_t pcPDGcode=0, motPDGcode=0;
AliZDCHit *newquad, *curprimquad;
newquad = new AliZDCHit(fIshunt, track, vol, hits);
if(fNhits==0){
// First hit -> setting flag for primary or secondary particle
- TParticle * p = gAlice->GetMCApp()->Particle(track);
+ /*TParticle * p = gAlice->GetMCApp()->Particle(track);
Int_t imo = p->GetFirstMother();
//
if(track != imo){
}
else if(track == imo){
newquad->SetSFlag(0); // PRIMARY particle entering the ZDC
- }
+ }*/
//
sFlag = newquad->GetSFlag();
primKinEn = newquad->GetPrimKinEn();
pcPDGcode = newquad->GetPDGCode();
motPDGcode = newquad->GetMotherPDGCode();
trackTime = newquad->GetTrackTOF();
+ trackEta = newquad->GetTrackEta();
}
else{
newquad->SetPrimKinEn(primKinEn);
newquad->SetPDGCode(pcPDGcode);
newquad->SetMotherPDGCode(motPDGcode);
newquad->SetTrackTOF(trackTime);
+ newquad->SetTrackEta(trackEta);
}
Int_t j;
//
char branchname[10];
- sprintf(branchname,"%s",GetName());
+ snprintf(branchname, 10, "%s", GetName());
const char *cH = strstr(opt,"H");
}
//_____________________________________________________________________________
-AliDigitizer* AliZDC::CreateDigitizer(AliRunDigitizer* manager) const
-{
+AliDigitizer* AliZDC::CreateDigitizer(AliDigitizationInput* digInput) const{
// Create the digitizer for ZDC
- AliZDCDigitizer *zdcDigitizer = new AliZDCDigitizer(manager);
+ AliZDCDigitizer *zdcDigitizer = new AliZDCDigitizer(digInput);
if(fSpectatorTracked==0) zdcDigitizer->SetSpectators2Track();
- //printf("\n**************************ZDC digitizer created with Spectators2Track = %d\n\n", fSpectatorTracked);
+ if(fBeamEnergy>0.01) zdcDigitizer->SetBeamEnergy(fBeamEnergy);
+ if(fIspASystem==kTRUE) zdcDigitizer->SetpAsystem();
+ if(fIsRELDISgen==kTRUE) zdcDigitizer->SetRELDISGenerator();
+ //if(fIspASystem==kTRUE) printf("\n **** ZDC digitizer initialized for p-A collisions\n\n");
return zdcDigitizer;
}
//
UInt_t lADCDataChannel = 0;
+ Int_t indADC0=0, indADC1=0, indADC2=0, indADC3=0;
+
// loop over digits
- for(Int_t iDigit=0; iDigit<treeD->GetEntries(); iDigit++){
+ for(Int_t iDigit=0; iDigit<(Int_t) (treeD->GetEntries()); iDigit++){
treeD->GetEntry(iDigit);
if(!pdigit) continue;
//digit.Print("");
}
}
// Ch. debug
- //printf(" det %d sec %d -> lADCDataGEO %d lADCDataChannel %d\n",
- // digit.GetSector(0),digit.GetSector(1),lADCDataGEO,lADCDataChannel);
+ //printf("iDigit %d det %d sec %d -> lADCDataGEO %d lADCDataChannel %d\n",
+ // iDigit,digit.GetSector(0),digit.GetSector(1),lADCDataGEO,lADCDataChannel);
if(lADCDataGEO==0){
- Int_t indHG = iDigit;
- Int_t indLG = indHG+knADCData1;
+ if(indADC0>=knADCData1){
+ AliWarning(Form(" Problem with digit index %d for ADC0\n", indADC0));
+ return;
+ }
+ Int_t indLG = indADC0+knADCData1;
// High gain ADC ch.
if(digit.GetADCValue(0) > 2047) lADCDataOvFlwHG = 1;
- lADCDataValue1[indHG] = digit.GetADCValue(0);
- lADCData1[indHG] = lADCDataGEO << 27 | lADCDataChannel << 17 |
- lADCDataOvFlwHG << 12 | (lADCDataValue1[indHG] & 0xfff);
+ lADCDataValue1[indADC0] = digit.GetADCValue(0);
+ lADCData1[indADC0] = lADCDataGEO << 27 | lADCDataChannel << 17 |
+ lADCDataOvFlwHG << 12 | (lADCDataValue1[indADC0] & 0xfff);
// Low gain ADC ch.
if(digit.GetADCValue(1) > 2047) lADCDataOvFlwLG = 1;
lADCDataValue1[indLG] = digit.GetADCValue(1);
lADCData1[indLG] = lADCDataGEO << 27 | lADCDataChannel << 17 | 0x1 << 16 |
lADCDataOvFlwLG << 12 | (lADCDataValue1[indLG] & 0xfff);
// Ch. debug
- //printf(" lADCDataGEO %d lADCDataValue1[%d] = %d lADCDataValue1[%d] = %d\n",
- // lADCDataGEO,iDigit,lADCDataValue1[indLG],indLG,lADCDataValue1[indLG]);
+ //printf(" lADCDataGEO %d ADCdataHG[%d] %d ADCdataLG[%d] %d\n",
+ // lADCDataGEO,indADC0,lADCDataValue1[indADC0],indLG,lADCDataValue1[indLG]);
+
+ indADC0++;
}
else if(lADCDataGEO==1){
- Int_t indHG = iDigit-knADCData1;
- Int_t indLG = indHG+knADCData2;
- // High gain ADC ch.
- if(digit.GetADCValue(0) > 2047) lADCDataOvFlwHG = 1;
- lADCDataValue2[indHG] = digit.GetADCValue(0);
- lADCData2[indHG] = lADCDataGEO << 27 | lADCDataChannel << 17 |
- lADCDataOvFlwHG << 12 | (lADCDataValue2[indHG] & 0xfff);
- // Low gain ADC ch.
- if(digit.GetADCValue(1) > 2047) lADCDataOvFlwLG = 1;
- lADCDataValue2[indLG] = digit.GetADCValue(1);
- lADCData2[indLG] = lADCDataGEO << 27 | lADCDataChannel << 17 | 0x1 << 16 |
- lADCDataOvFlwLG << 12 | (lADCDataValue2[indLG] & 0xfff);
- //Ch. debug
- //printf(" lADCDataGEO %d lADCDataValue2[%d] = %d lADCDataValue2[%d] = %d\n",
- // lADCDataGEO,indHG,lADCDataValue2[indHG],indLG,lADCDataValue2[indLG]);
+ if(indADC1>=knADCData2){
+ AliWarning(Form(" Problem with digit index %d for ADC1\n", indADC1));
+ return;
+ }
+ Int_t indLG = indADC1+knADCData2;
+ // High gain ADC ch.
+ if(digit.GetADCValue(0) > 2047) lADCDataOvFlwHG = 1;
+ lADCDataValue2[indADC1] = digit.GetADCValue(0);
+ lADCData2[indADC1] = lADCDataGEO << 27 | lADCDataChannel << 17 |
+ lADCDataOvFlwHG << 12 | (lADCDataValue2[indADC1] & 0xfff);
+ // Low gain ADC ch.
+ if(digit.GetADCValue(1) > 2047) lADCDataOvFlwLG = 1;
+ lADCDataValue2[indLG] = digit.GetADCValue(1);
+ lADCData2[indLG] = lADCDataGEO << 27 | lADCDataChannel << 17 | 0x1 << 16 |
+ lADCDataOvFlwLG << 12 | (lADCDataValue2[indLG] & 0xfff);
+ // Ch. debug
+ //printf(" lADCDataGEO %d ADCdataHG[%d] %d ADCdataLG[%d] %d\n",
+ // lADCDataGEO,indADC1,lADCDataValue2[indADC1],indLG,lADCDataValue2[indLG]);
+
+ indADC1++;
}
else if(lADCDataGEO==2){
- Int_t indHG = iDigit-knADCData1-knADCData2;
- Int_t indLG = indHG+knADCData3;
- // High gain ADC ch.
- if(digit.GetADCValue(0) > 2047) lADCDataOvFlwHG = 1;
- lADCDataValue3[indHG] = digit.GetADCValue(0);
- lADCData3[indHG] = lADCDataGEO << 27 | lADCDataChannel << 17 |
- lADCDataOvFlwHG << 12 | (lADCDataValue3[indHG] & 0xfff);
- // Low gain ADC ch.
- if(digit.GetADCValue(1) > 2047) lADCDataOvFlwLG = 1;
- lADCDataValue3[indLG] = digit.GetADCValue(1);
- lADCData3[indLG] = lADCDataGEO << 27 | lADCDataChannel << 17 | 0x1 << 16 |
- lADCDataOvFlwLG << 12 | (lADCDataValue3[indLG] & 0xfff);
- //Ch. debug
- //printf(" lADCDataGEO %d lADCDataValue3[%d] = %d lADCDataValue3[%d] = %d\n",
- // lADCDataGEO,indHG,lADCDataValue3[indHG],indLG,lADCDataValue3[indLG]);
+ if(indADC2>=knADCData3){
+ AliWarning(Form(" Problem with digit index %d for ADC2\n", indADC2));
+ return;
+ }
+ Int_t indLG = indADC2+knADCData3;
+ // High gain ADC ch.
+ if(digit.GetADCValue(0) > 2047) lADCDataOvFlwHG = 1;
+ lADCDataValue3[indADC1] = digit.GetADCValue(0);
+ lADCData3[indADC1] = lADCDataGEO << 27 | lADCDataChannel << 17 |
+ lADCDataOvFlwHG << 12 | (lADCDataValue3[indADC2] & 0xfff);
+ // Low gain ADC ch.
+ if(digit.GetADCValue(1) > 2047) lADCDataOvFlwLG = 1;
+ lADCDataValue3[indLG] = digit.GetADCValue(1);
+ lADCData3[indLG] = lADCDataGEO << 27 | lADCDataChannel << 17 | 0x1 << 16 |
+ lADCDataOvFlwLG << 12 | (lADCDataValue3[indLG] & 0xfff);
+ // Ch. debug
+ //printf(" lADCDataGEO %d ADCdataHG[%d] %d ADCdataLG[%d] %d\n",
+ // lADCDataGEO,indADC2,lADCDataValue3[indADC2],indLG,lADCDataValue3[indLG]);
+
+ indADC2++;
}
else if(lADCDataGEO==3){
- Int_t indHG = iDigit-knADCData1-knADCData2-knADCData3;
- Int_t indLG = indHG+knADCData4;
- // High gain ADC ch.
- if(digit.GetADCValue(0) > 2047) lADCDataOvFlwHG = 1;
- lADCDataValue4[indHG] = digit.GetADCValue(0);
- lADCData4[indHG] = lADCDataGEO << 27 | lADCDataChannel << 17 |
- lADCDataOvFlwHG << 12 | (lADCDataValue4[indHG] & 0xfff);
- // Low gain ADC ch.
- if(digit.GetADCValue(1) > 2047) lADCDataOvFlwLG = 1;
- lADCDataValue4[indLG] = digit.GetADCValue(1);
- lADCData4[indLG] = lADCDataGEO << 27 | lADCDataChannel << 17 | 0x1 << 16 |
- lADCDataOvFlwLG << 12 | (lADCDataValue4[indLG] & 0xfff);
- // Ch. debug
- //printf(" lADCDataGEO %d lADCDataValue4[%d] = %d lADCDataValue4[%d] = %d\n",
- // lADCDataGEO,indHG,lADCDataValue4[indHG],indLG,lADCDataValue4[indLG]);
+ if(indADC3>=knADCData4){
+ AliWarning(Form(" Problem with digit index %d for ADC2\n", indADC3));
+ return;
+ }
+ Int_t indLG = indADC3+knADCData4;
+ // High gain ADC ch.
+ if(digit.GetADCValue(0) > 2047) lADCDataOvFlwHG = 1;
+ lADCDataValue4[indADC3] = digit.GetADCValue(0);
+ lADCData4[indADC3] = lADCDataGEO << 27 | lADCDataChannel << 17 |
+ lADCDataOvFlwHG << 12 | (lADCDataValue4[indADC3] & 0xfff);
+ // Low gain ADC ch.
+ if(digit.GetADCValue(1) > 2047) lADCDataOvFlwLG = 1;
+ lADCDataValue4[indLG] = digit.GetADCValue(1);
+ lADCData4[indLG] = lADCDataGEO << 27 | lADCDataChannel << 17 | 0x1 << 16 |
+ lADCDataOvFlwLG << 12 | (lADCDataValue4[indLG] & 0xfff);
+ // Ch. debug
+ //printf(" lADCDataGEO %d ADCdataHG[%d] %d ADCdataLG[%d] %d\n",
+ // lADCDataGEO,indADC3,lADCDataValue4[indADC3],indLG,lADCDataValue4[indLG]);
+
+ indADC3++;
}
}
//printf("\t AliZDC::Digits2Raw -> ADCEndBlock = %d\n",lADCEndBlock);
// open the output file
- char fileName[30];
- strcpy(fileName,AliDAQ::DdlFileName("ZDC",0));
+ TString fileName;
+ fileName.Form("%s",AliDAQ::DdlFileName("ZDC",0));
- AliFstream* file = new AliFstream(fileName);
+ AliFstream* file = new AliFstream(fileName.Data());
// write the DDL data header
AliRawDataHeaderSim header;
return kFALSE;
}
-// // Event loop
- Int_t iEvent = 0;
- while(rawReader->NextEvent()){
- (AliRunLoader::Instance())->GetEvent(iEvent++);
- // Create the output digit tree
- TTree* treeS = loader->TreeS();
- if(!treeS){
- loader->MakeTree("S");
- treeS = loader->TreeS();
- }
- //
- AliZDCSDigit sdigit;
- AliZDCSDigit* psdigit = &sdigit;
- const Int_t kBufferSize = 4000;
- treeS->Branch("ZDC", "AliZDCSDigit", &psdigit, kBufferSize);
- //
- AliZDCRawStream rawStream(rawReader);
- Int_t sector[2], resADC, rawADC, corrADC, nPheVal;
- Int_t jcount = 0;
- while(rawStream.Next()){
- if(rawStream.IsADCDataWord()){
- //For the moment only in-time SDigits are foreseen (1st 48 raw values)
- if(jcount < kNch){
- for(Int_t j=0; j<2; j++) sector[j] = rawStream.GetSector(j);
- rawADC = rawStream.GetADCValue();
- resADC = rawStream.GetADCGain();
- //printf("\t RAw2SDigits raw%d -> RawADC[%d, %d, %d] read\n",
- // jcount, sector[0], sector[1], rawADC);
- //
- corrADC = rawADC - Pedestal(sector[0], sector[1], resADC);
- if(corrADC<0) corrADC=0;
- nPheVal = ADCch2Phe(sector[0], sector[1], corrADC, resADC);
- //
- //printf("\t \t -> SDigit[%d, %d, %d] created\n",
- // sector[0], sector[1], nPheVal);
- //
- new(psdigit) AliZDCSDigit(sector, (Float_t) nPheVal, 0.);
- treeS->Fill();
- jcount++;
- }
- }//IsADCDataWord
- }//rawStream.Next
- // write the output tree
- fLoader->WriteSDigits("OVERWRITE");
- fLoader->UnloadSDigits();
- }//Event loop
+ // Create the output digit tree
+ TTree* treeS = loader->TreeS();
+ if(!treeS){
+ loader->MakeTree("S");
+ treeS = loader->TreeS();
+ }
+ //
+ AliZDCSDigit sdigit;
+ AliZDCSDigit* psdigit = &sdigit;
+ const Int_t kBufferSize = 4000;
+ treeS->Branch("ZDC", "AliZDCSDigit", &psdigit, kBufferSize);
+ //
+ AliZDCRawStream rawStream(rawReader);
+ Int_t sector[2], resADC, rawADC, corrADC, nPheVal;
+ Int_t jcount = 0;
+ while(rawStream.Next()){
+ if(rawStream.IsADCDataWord()){
+ //For the moment only in-time SDigits are foreseen (1st 48 raw values)
+ if(jcount < kNch){
+ for(Int_t j=0; j<2; j++) sector[j] = rawStream.GetSector(j);
+ rawADC = rawStream.GetADCValue();
+ resADC = rawStream.GetADCGain();
+ //printf("\t RAw2SDigits raw%d -> RawADC[%d, %d, %d] read\n",
+ // jcount, sector[0], sector[1], rawADC);
+ //
+ corrADC = rawADC - Pedestal(sector[0], sector[1], resADC);
+ if(corrADC<0) corrADC=0;
+ nPheVal = ADCch2Phe(sector[0], sector[1], corrADC, resADC);
+ //
+ //printf("\t \t -> SDigit[%d, %d, %d] created\n",
+ // sector[0], sector[1], nPheVal);
+ //
+ new(psdigit) AliZDCSDigit(sector, (Float_t) nPheVal, 0.);
+ treeS->Fill();
+ jcount++;
+ }
+ }//IsADCDataWord
+ }//rawStream.Next
+ // write the output tree
+ fLoader->WriteSDigits("OVERWRITE");
+ fLoader->UnloadSDigits();
return kTRUE;
}
// Returns a pedestal for detector det, PM quad, channel with res.
//
// Getting calibration object for ZDC set
+ Float_t pedValue = 0.;
AliCDBManager *man = AliCDBManager::Instance();
AliCDBEntry *entry = man->Get("ZDC/Calib/Pedestals");
- AliZDCPedestals *calibPed = (AliZDCPedestals*) entry->GetObject();
- //
- if(!calibPed){
- printf("\t No calibration object found for ZDC!");
- return -1;
- }
- //
- Int_t index=0, kNch=24;
- if(Quad!=5){
- if(Det==1) index = Quad+kNch*Res; // ZN1
- else if(Det==2) index = Quad+5+kNch*Res; // ZP1
- else if(Det==3) index = Quad+9+kNch*Res; // ZEM
- else if(Det==4) index = Quad+12+kNch*Res; // ZN2
- else if(Det==5) index = Quad+17+kNch*Res; // ZP2
+ AliZDCPedestals *calibPed = 0x0;
+ if(!entry) AliFatal("No calibration data loaded!");
+ else{
+ calibPed = (AliZDCPedestals*) entry->GetObject();
+ //
+ if(!calibPed){
+ printf("\t No calibration object found for ZDC!");
+ return -1;
+ }
+ //
+ Int_t index=0, kNch=24;
+ if(Quad!=5){
+ if(Det==1) index = Quad+kNch*Res; // ZN1
+ else if(Det==2) index = Quad+5+kNch*Res; // ZP1
+ else if(Det==3) index = Quad+9+kNch*Res; // ZEM
+ else if(Det==4) index = Quad+12+kNch*Res; // ZN2
+ else if(Det==5) index = Quad+17+kNch*Res; // ZP2
+ }
+ else index = (Det-1)/3+22+kNch*Res; // Reference PMs
+ //
+ //
+ Float_t meanPed = calibPed->GetMeanPed(index);
+ Float_t pedWidth = calibPed->GetMeanPedWidth(index);
+ pedValue = gRandom->Gaus(meanPed,pedWidth);
+ //
+ //printf("\t AliZDC::Pedestal - det(%d, %d) - Ped[%d] = %d\n",Det, Quad, index,(Int_t) pedValue); // Chiara debugging!
}
- else index = (Det-1)/3+22+kNch*Res; // Reference PMs
- //
- //
- Float_t meanPed = calibPed->GetMeanPed(index);
- Float_t pedWidth = calibPed->GetMeanPedWidth(index);
- Float_t pedValue = gRandom->Gaus(meanPed,pedWidth);
- //
- //printf("\t AliZDC::Pedestal - det(%d, %d) - Ped[%d] = %d\n",Det, Quad, index,(Int_t) pedValue); // Chiara debugging!
-
-
return (Int_t) pedValue;
}
{
// Getting calibration object for ZDC
-
+ AliZDCChMap *calibdata = 0x0;
AliCDBEntry *entry = AliCDBManager::Instance()->Get("ZDC/Calib/ChMap");
if(!entry) AliFatal("No calibration data loaded!");
-
- AliZDCChMap *calibdata = dynamic_cast<AliZDCChMap*> (entry->GetObject());
- if(!calibdata) AliFatal("Wrong calibration object in calibration file!");
-
+ else{
+ calibdata = dynamic_cast<AliZDCChMap*> (entry->GetObject());
+ if(!calibdata) AliFatal("Wrong calibration object in calibration file!");
+ }
return calibdata;
}