///////////////////////////////////////////////////////////////////////////////
// --- ROOT system
-#include <TBRIK.h>
#include <TClonesArray.h>
-#include <TGeometry.h>
-#include <TNode.h>
#include <TTree.h>
#include <TFile.h>
#include <TSystem.h>
#include <TRandom.h>
+#include <TParticle.h>
// --- AliRoot header files
#include "AliDetector.h"
#include "AliZDCDigitizer.h"
#include "AliZDCRawStream.h"
#include "AliZDCPedestals.h"
-#include "AliZDCCalib.h"
+#include "AliZDCEnCalib.h"
+#include "AliZDCTowerCalib.h"
#include "AliFstream.h"
AliDetector(),
fNoShower(0),
fPedCalib(0),
- fCalibData(0),
- fZDCCalibFName("")
+ fEnCalibData(0),
+ fTowCalibData(0),
+ fZDCCalibFName(""),
+ fSpectatorTracked(1)
{
//
// Default constructor for the Zero Degree Calorimeter base class
AliDetector(name,title),
fNoShower (0),
fPedCalib(0),
- fCalibData(0),
- fZDCCalibFName("")
+ fEnCalibData(0),
+ fTowCalibData(0),
+ fZDCCalibFName(""),
+ fSpectatorTracked(1)
{
//
// Standard constructor for the Zero Degree Calorimeter base class
//
fIshunt = 0;
- delete fPedCalib;
- delete fCalibData;
+ if(fPedCalib) delete fPedCalib;
+ if(fEnCalibData) delete fEnCalibData;
+ if(fEnCalibData) delete fEnCalibData;
}
AliDetector("ZDC","ZDC"),
fNoShower(ZDC.fNoShower),
fPedCalib(ZDC.fPedCalib),
-fCalibData(ZDC.fCalibData),
-fZDCCalibFName(ZDC.fZDCCalibFName)
+fEnCalibData(ZDC.fEnCalibData),
+fTowCalibData(ZDC.fTowCalibData),
+fZDCCalibFName(ZDC.fZDCCalibFName),
+fSpectatorTracked(ZDC.fSpectatorTracked)
{
// copy constructor
}
if(this!=&ZDC){
fNoShower = ZDC.fNoShower;
fPedCalib = ZDC.fPedCalib;
- fCalibData = ZDC.fCalibData;
+ fEnCalibData = ZDC.fEnCalibData;
+ fTowCalibData = ZDC.fTowCalibData;
fZDCCalibFName = ZDC.fZDCCalibFName;
} return *this;
}
{
//
// Add a ZDC hit to the hit list.
- // -> We make use of 2 array of hits:
- // [1] fHits (the usual one) that contains hits for each PRIMARY
- // [2] fStHits that contains hits for each EVENT and is used to
- // obtain digits at the end of each event
- //
- static Float_t primKinEn=0., xImpact=0., yImpact=0., sFlag=0.;
- static Int_t pcPDGcode;
+ static Float_t trackTime=0., primKinEn=0., xImpact=0., yImpact=0., sFlag=0.;
+ static Int_t pcPDGcode, motPDGcode;
AliZDCHit *newquad, *curprimquad;
newquad = new AliZDCHit(fIshunt, track, vol, hits);
if(fNhits==0){
// First hit -> setting flag for primary or secondary particle
- Int_t primary = gAlice->GetMCApp()->GetPrimary(track);
+ TParticle * p = gAlice->GetMCApp()->Particle(track);
+ Int_t imo = p->GetFirstMother();
//
- if(track != primary){
+ if(track != imo){
newquad->SetSFlag(1); // SECONDARY particle entering the ZDC
}
- else if(track == primary){
+ else if(track == imo){
newquad->SetSFlag(0); // PRIMARY particle entering the ZDC
- }
- sFlag = newquad->GetSFlag();
- primKinEn = newquad->GetPrimKinEn();
- xImpact = newquad->GetXImpact();
- yImpact = newquad->GetYImpact();
- pcPDGcode = newquad->GetPDGCode();
+ }
+ //
+ sFlag = newquad->GetSFlag();
+ primKinEn = newquad->GetPrimKinEn();
+ xImpact = newquad->GetXImpact();
+ yImpact = newquad->GetYImpact();
+ pcPDGcode = newquad->GetPDGCode();
+ motPDGcode = newquad->GetMotherPDGCode();
+ trackTime = newquad->GetTrackTOF();
}
else{
newquad->SetPrimKinEn(primKinEn);
newquad->SetYImpact(yImpact);
newquad->SetSFlag(sFlag);
newquad->SetPDGCode(pcPDGcode);
+ newquad->SetMotherPDGCode(motPDGcode);
+ newquad->SetTrackTOF(trackTime);
}
Int_t j;
curprimquad = (AliZDCHit*) lhits[j];
if(*curprimquad == *newquad){
*curprimquad = *curprimquad+*newquad;
- // CH. debug
- /*if(newquad->GetEnergy() != 0. || newquad->GetLightPMC() != 0. ||
- newquad->GetLightPMQ() != 0.){
- printf("\n\t --- Equal hits found\n");
- curprimquad->Print("");
- newquad->Print("");
- printf("\t --- Det. %d, Quad. %d: X = %f, E = %f, LightPMC = %f, LightPMQ = %f\n",
- curprimquad->GetVolume(0),curprimquad->GetVolume(1),curprimquad->GetXImpact(),
- curprimquad->GetEnergy(), curprimquad->GetLightPMC(), curprimquad->GetLightPMQ());
- }*/
+ // Ch. debug
+ //printf("\n\t Summing hits **************** \n", fNhits);
+ //curprimquad->Print("");
//
delete newquad;
return;
//Otherwise create a new hit
new(lhits[fNhits]) AliZDCHit(*newquad);
fNhits++;
- // CH. debug
- /*printf("\n\t New ZDC hit added! fNhits = %d\n", fNhits);
- printf("\t Det. %d, Quad.t %d: X = %f, E = %f, LightPMC = %f, LightPMQ = %f\n",
- newquad->GetVolume(0),newquad->GetVolume(1),newquad->GetXImpact(),
- newquad->GetEnergy(), newquad->GetLightPMC(), newquad->GetLightPMQ());
- */
+ // Ch. debug
+ //printf("\n\t New ZDC hit added! fNhits = %d\n", fNhits);
+ //newquad->Print("");
+
delete newquad;
}
-//_____________________________________________________________________________
-void AliZDC::BuildGeometry()
-{
- //
- // Build the ROOT TNode geometry for event display
- // in the Zero Degree Calorimeter
- // This routine is dummy for the moment
- //
-
- TNode *node, *top;
- TBRIK *brik;
- const int kColorZDC = kBlue;
-
- //
- top=gAlice->GetGeometry()->GetNode("alice");
-
- // ZDC
- brik = new TBRIK("S_ZDC","ZDC box","void",300,300,5);
- top->cd();
- node = new TNode("ZDC","ZDC","S_ZDC",0,0,600,"");
- node->SetLineColor(kColorZDC);
- fNodes->Add(node);
-}
-
//____________________________________________________________________________
Float_t AliZDC::ZMin(void) const
{
{
// Create summable digits from hits
- AliDebug(1,"\n Entering AliZDC::Hits2SDigits() ");
+ AliDebug(1,"\n AliZDC::Hits2SDigits() ");
fLoader->LoadHits("read");
fLoader->LoadSDigits("recreate");
// Event loop
for(Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++) {
- Float_t pmCZNC=0, pmCZPC=0, pmCZNA=0, pmCZPA=0, pmZEM1 = 0, pmZEM2 = 0;
- Float_t pmQZNC[4], pmQZPC[4], pmQZNA[4], pmQZPA[4];
- for(Int_t i = 0; i < 4; i++) pmQZNC[i] = pmQZPC[i] = pmQZNA[i] = pmQZPA[i] = 0;
+ Float_t pmZNC[5], pmZPC[5], pmZNA[5], pmZPA[5], pmZEM1=0., pmZEM2=0.;
+ for(Int_t i=0; i<5; i++) pmZNC[i] = pmZPC[i] = pmZNA[i] = pmZPA[i] = 0;
runLoader->GetEvent(iEvent);
TTree* treeH = fLoader->TreeH();
ResetHits();
// Tracks loop
- Int_t sector[2];
+ Int_t sector[2]; Float_t trackTime = 0.;
for(Int_t itrack = 0; itrack < ntracks; itrack++) {
treeH->GetEntry(itrack);
for(AliZDCHit* zdcHit = (AliZDCHit*)FirstHit(-1); zdcHit;
- zdcHit = (AliZDCHit*)NextHit()) {
+ zdcHit = (AliZDCHit*)NextHit()) {
sector[0] = zdcHit->GetVolume(0);
sector[1] = zdcHit->GetVolume(1);
- if((sector[1] < 1) || (sector[1] > 5)) {
- Error("Hits2SDigits", "sector[0] = %d, sector[1] = %d",
- sector[0], sector[1]);
+ if((sector[1] < 1) || (sector[1]>5)) {
+ Error("Hits2SDigits", "sector[0] = %d, sector[1] = %d", sector[0], sector[1]);
continue;
}
Float_t lightQ = zdcHit->GetLightPMQ();
Float_t lightC = zdcHit->GetLightPMC();
+ trackTime = zdcHit->GetTrackTOF();
+ // Signals from ZEM are delayed to arrive in time with ZDC signals
+ if(sector[0] == 3) trackTime += 320;
+ // Ch. debug
+ //printf("\t det %d vol %d trackTOF %f lightQ %1.0f lightC %1.0f\n",
+ // sector[0], sector[1], trackTime, lightQ, lightC);
if(sector[0] == 1) { //ZNC
- pmCZNC += lightC;
- pmQZNC[sector[1]-1] += lightQ;
+ pmZNC[0] += lightC;
+ pmZNC[sector[1]] += lightQ;
}
else if(sector[0] == 2) { //ZPC
- pmCZPC += lightC;
- pmQZPC[sector[1]-1] += lightQ;
+ pmZPC[0] += lightC;
+ pmZPC[sector[1]] += lightQ;
}
else if(sector[0] == 3) { //ZEM
if(sector[1] == 1) pmZEM1 += lightC;
else pmZEM2 += lightQ;
}
if(sector[0] == 4) { //ZNA
- pmCZNA += lightC;
- pmQZNA[sector[1]-1] += lightQ;
+ pmZNA[0] += lightC;
+ pmZNA[sector[1]] += lightQ;
}
else if(sector[0] == 5) { //ZPA
- pmCZPA += lightC;
- pmQZPA[sector[1]-1] += lightQ;
+ pmZPA[0] += lightC;
+ pmZPA[sector[1]] += lightQ;
}
}//Hits loop
- }
+ }//Tracks loop
// create the output tree
fLoader->MakeTree("S");
// Create sdigits for ZNC
sector[0] = 1; // Detector = ZNC
- sector[1] = 0; // Common PM ADC
- new(psdigit) AliZDCSDigit(sector, pmCZNC);
- if(pmCZNC > 0) treeS->Fill();
- for(Int_t j = 0; j < 4; j++) {
- sector[1] = j+1; // Towers PM ADCs
- new(psdigit) AliZDCSDigit(sector, pmQZNC[j]);
- if(pmQZNC[j] > 0) treeS->Fill();
+ for(Int_t j = 0; j < 5; j++) {
+ sector[1] = j;
+ if(pmZNC[j]>0){
+ new(psdigit) AliZDCSDigit(sector, pmZNC[j], trackTime);
+ treeS->Fill();
+ // Ch. debug
+ //printf("\t SDigit created: det %d quad %d pmZNC[%d] %1.0f trackTOF %f\n",
+ // sector[0], sector[1], j, pmZNC[j], trackTime);
+ }
}
// Create sdigits for ZPC
sector[0] = 2; // Detector = ZPC
- sector[1] = 0; // Common PM ADC
- new(psdigit) AliZDCSDigit(sector, pmCZPC);
- if(pmCZPC > 0) treeS->Fill();
- for(Int_t j = 0; j < 4; j++) {
- sector[1] = j+1; // Towers PM ADCs
- new(psdigit) AliZDCSDigit(sector, pmQZPC[j]);
- if(pmQZPC[j] > 0) treeS->Fill();
+ for(Int_t j = 0; j < 5; j++) {
+ sector[1] = j; // Towers PM ADCs
+ if(pmZPC[j]>0){
+ new(psdigit) AliZDCSDigit(sector, pmZPC[j], trackTime);
+ treeS->Fill();
+ // Ch. debug
+ //printf("\t SDigit created: det %d quad %d pmZPC[%d] %1.0f trackTOF %f\n",
+ // sector[0], sector[1], j, pmZPC[j], trackTime);
+ }
}
// Create sdigits for ZEM
sector[0] = 3;
sector[1] = 1; // Detector = ZEM1
- new(psdigit) AliZDCSDigit(sector, pmZEM1);
- if(pmZEM1 > 0) treeS->Fill();
+ if(pmZEM1>0){
+ new(psdigit) AliZDCSDigit(sector, pmZEM1, trackTime);
+ treeS->Fill();
+ // Ch. debug
+ //printf("\t SDigit created: det %d quad %d pmZEM1 %1.0f trackTOF %f\n",
+ // sector[0], sector[1], pmZEM1, trackTime);
+ }
sector[1] = 2; // Detector = ZEM2
- new(psdigit) AliZDCSDigit(sector, pmZEM2);
- if(pmZEM2 > 0) treeS->Fill();
+ if(pmZEM2>0){
+ new(psdigit) AliZDCSDigit(sector, pmZEM2, trackTime);
+ treeS->Fill();
+ // Ch. debug
+ //printf("\t SDigit created: det %d quad %d pmZEM2 %1.0f trackTOF %f\n",
+ // sector[0], sector[1], pmZEM2, trackTime);
+ }
// Create sdigits for ZNA
sector[0] = 4; // Detector = ZNA
- sector[1] = 0; // Common PM ADC
- new(psdigit) AliZDCSDigit(sector, pmCZNA);
- if(pmCZNA > 0) treeS->Fill();
- for(Int_t j = 0; j < 4; j++) {
- sector[1] = j+1; // Towers PM ADCs
- new(psdigit) AliZDCSDigit(sector, pmQZNA[j]);
- if(pmQZNA[j] > 0) treeS->Fill();
+ for(Int_t j = 0; j < 5; j++) {
+ sector[1] = j; // Towers PM ADCs
+ if(pmZNA[j]>0){
+ new(psdigit) AliZDCSDigit(sector, pmZNA[j], trackTime);
+ treeS->Fill();
+ // Ch. debug
+ //printf("\t SDigit created: det %d quad %d pmZNA[%d] %1.0f trackTOF %f\n",
+ // sector[0], sector[1], j, pmZNA[j], trackTime);
+ }
}
// Create sdigits for ZPA
sector[0] = 5; // Detector = ZPA
sector[1] = 0; // Common PM ADC
- new(psdigit) AliZDCSDigit(sector, pmCZPA);
- if(pmCZPA > 0) treeS->Fill();
- for(Int_t j = 0; j < 4; j++) {
- sector[1] = j+1; // Towers PM ADCs
- new(psdigit) AliZDCSDigit(sector, pmQZPA[j]);
- if(pmQZPA[j] > 0) treeS->Fill();
+ for(Int_t j = 0; j < 5; j++) {
+ sector[1] = j; // Towers PM ADCs
+ if(pmZPA[j]>0){
+ new(psdigit) AliZDCSDigit(sector, pmZPA[j], trackTime);
+ treeS->Fill();
+ // Ch. debug
+ //printf("\t SDigit created: det %d quad %d pmZPA[%d] %1.0f trackTOF %f\n",
+ // sector[0], sector[1], j, pmZPA[j], trackTime);
+ }
}
// write the output tree
AliDigitizer* AliZDC::CreateDigitizer(AliRunDigitizer* manager) const
{
// Create the digitizer for ZDC
-
- return new AliZDCDigitizer(manager);
+ AliZDCDigitizer *zdcDigitizer = new AliZDCDigitizer(manager);
+ if(fSpectatorTracked==0) zdcDigitizer->SetSpectators2Track();
+ //printf("\n**************************ZDC digitizer created with Spectators2Track = %d\n\n", fSpectatorTracked);
+ return zdcDigitizer;
}
//_____________________________________________________________________________
Error("Digits2Raw", "sector[0] = %d, sector[1] = %d",
digit.GetSector(0), digit.GetSector(1));
continue;
- }
-
-
+ }
}
//
/*
// End of Block
UInt_t lADCEndBlockGEO = lADCHeaderGEO;
- UInt_t lADCEndBlockEvCount = gAlice->GetEventNrInRun();
+ // Event counter in ADC EOB -> getting no. of events in run from AliRunLoader
+ // get run loader
+ AliRunLoader* runLoader = fLoader->GetRunLoader();
+ UInt_t lADCEndBlockEvCount = runLoader->GetEventNumber();
//
lADCEndBlock = lADCEndBlockGEO << 27 | 0x1 << 26 | lADCEndBlockEvCount;
//printf("\t AliZDC::Digits2Raw -> ADCEndBlock = %d\n",lADCEndBlock);
-
// open the output file
char fileName[30];
strcpy(fileName,AliDAQ::DdlFileName("ZDC",0));
{
// Convert ZDC raw data to Sdigits
- AliLoader* loader = (gAlice->GetRunLoader())->GetLoader("ZDCLoader");
+ AliLoader* loader = (AliRunLoader::Instance())->GetLoader("ZDCLoader");
if(!loader) {
AliError("no ZDC loader found");
return kFALSE;
// // Event loop
Int_t iEvent = 0;
while(rawReader->NextEvent()){
- (gAlice->GetRunLoader())->GetEvent(iEvent++);
+ (AliRunLoader::Instance())->GetEvent(iEvent++);
// Create the output digit tree
TTree* treeS = loader->TreeS();
if(!treeS){
//printf("\t \t -> SDigit[%d, %d, %d] created\n",
// sector[0], sector[1], nPheVal);
//
- new(psdigit) AliZDCSDigit(sector, (Float_t) nPheVal);
+ new(psdigit) AliZDCSDigit(sector, (Float_t) nPheVal, 0.);
treeS->Fill();
jcount++;
}