From 6de912026da34e200c7bab712bcd571db86b6ecd Mon Sep 17 00:00:00 2001 From: coppedis Date: Fri, 22 Oct 2004 10:22:14 +0000 Subject: [PATCH] Removing old macros --- ZDC/AliZDC.cxx | 678 ++++++++++++------------------------------- ZDC/AliZDC.h | 23 +- ZDC/AliZDCDigit.cxx | 12 +- ZDC/AliZDCDigit.h | 18 +- ZDC/AliZDCMerger.cxx | 151 ---------- ZDC/AliZDCMerger.h | 3 - ZDC/AliZDCv2.cxx | 7 +- ZDC/ZDCtest.C | 341 ---------------------- 8 files changed, 213 insertions(+), 1020 deletions(-) delete mode 100644 ZDC/ZDCtest.C diff --git a/ZDC/AliZDC.cxx b/ZDC/AliZDC.cxx index d66c737674c..aac2849a658 100644 --- a/ZDC/AliZDC.cxx +++ b/ZDC/AliZDC.cxx @@ -24,31 +24,22 @@ // // /////////////////////////////////////////////////////////////////////////////// -#include -#include - // --- ROOT system #include -#include -#include -#include #include #include #include -#include // --- AliRoot header files #include "AliDetector.h" #include "AliZDC.h" -#include "AliZDCDigit.h" #include "AliZDCHit.h" -#include "AliZDCMergedHit.h" -#include "AliZDCMerger.h" -#include "AliZDCReco.h" - -#include "AliConst.h" +#include "AliZDCSDigit.h" +#include "AliZDCDigit.h" +#include "AliZDCDigitizer.h" +#include "AliZDCRawStream.h" -#include "AliHeader.h" +#include "AliRawDataHeader.h" #include "AliLoader.h" #include "AliRun.h" #include "AliMC.h" @@ -66,18 +57,12 @@ AliZDC::AliZDC() fIshunt = 1; fNoShower = 0; - fMerger = 0; fHits = 0; fNhits = 0; fDigits = 0; fNdigits = 0; - fMergedHits = 0; - - fNRecPoints = 0; - fRecPoints = 0; - } //_____________________________________________________________________________ @@ -90,19 +75,13 @@ AliZDC::AliZDC(const char *name, const char *title) fIshunt = 1; fNoShower = 0; - fMerger = 0; // Allocate the hits array fHits = new TClonesArray("AliZDCHit",1000); gAlice->GetMCApp()->AddHitList(fHits); - // Allocate the merged hits array - fMergedHits = new TClonesArray("AliZDCMergedHit",1000); - // Allocate the digits array - fDigits = new TClonesArray("AliZDCDigit",1000); - - fNRecPoints = 0; - fRecPoints = 0; + fDigits = 0; + fNdigits = 0; } //____________________________________________________________________________ @@ -113,8 +92,6 @@ AliZDC::~AliZDC() // fIshunt = 0; - - if(fMerger) delete fMerger; } //_____________________________________________________________________________ @@ -173,20 +150,6 @@ void AliZDC::AddHit(Int_t track, Int_t *vol, Float_t *hits) delete newquad; } -//_____________________________________________________________________________ -void AliZDC::AddDigit(Int_t *sect, Int_t digit) -{ -// - AliZDCDigit *newdigit; - newdigit = new AliZDCDigit(sect, digit); - -// printf("\n AddDigit -> sector[0] = %d, sector[1] = %d, digit = %d", -// sect[0], sect[1], digit); - new((*fDigits)[fNdigits]) AliZDCDigit(*newdigit); - fNdigits++; - delete newdigit; -} - //_____________________________________________________________________________ void AliZDC::BuildGeometry() { @@ -225,19 +188,19 @@ Int_t AliZDC::DistancetoPrimitive(Int_t , Int_t ) Float_t AliZDC::ZMin(void) const { // Minimum dimension of the ZDC module in z - return 11600.; + return -11600.; } //____________________________________________________________________________ Float_t AliZDC::ZMax(void) const { // Maximum dimension of the ZDC module in z - return 11750.; + return -11750.; } //_____________________________________________________________________________ - void AliZDC::MakeBranch(Option_t *opt, const char *file) +void AliZDC::MakeBranch(Option_t *opt, const char * /*file*/) { // // Create Tree branches for the ZDC @@ -252,178 +215,100 @@ Float_t AliZDC::ZMax(void) const fHits = new TClonesArray("AliZDCHit",1000); AliDetector::MakeBranch(opt); - - const char *cS = strstr(opt,"S"); - - if (fLoader->TreeS() && cS) { - if(fMergedHits!=0) fMergedHits->Clear(); - else fMergedHits = new TClonesArray ("AliZDCMergedHit",1000); - MakeBranchInTree(fLoader->TreeS(), - branchname, &fMergedHits, fBufferSize, file) ; - if (GetDebug()) printf("* AliZDC::MakeBranch * Making Branch %s for SDigits\n\n",branchname); - } - - - const char *cD = strstr(opt,"D"); - - if (fLoader->TreeD() && cD) { - if(fDigits!=0) fDigits->Clear(); - else fDigits = new TClonesArray ("AliZDCDigit",1000); - MakeBranchInTree(fLoader->TreeD(), - branchname, &fDigits, fBufferSize, file) ; - if (GetDebug()) printf("* AliZDC::MakeBranch * Making Branch %s for Digits\n\n",branchname); - } - - - const char *cR = strstr(opt,"R"); - - if (fLoader->TreeR() && cR) { - if(fRecPoints==0) fRecPoints = new TClonesArray("AliZDCReco",1000); - MakeBranchInTree(fLoader->TreeR(), - branchname, &fRecPoints, fBufferSize, file) ; - if (GetDebug()) printf("* AliZDC::MakeBranch * Making Branch %s for RecPoints\n\n",branchname); } - -} - -//_____________________________________________________________________________ - void AliZDC::MakeBranchInTreeS(TTree *treeS, const char *file) -{ - // MakeBranchInTree - const Int_t kBufferSize = 4000; - char branchname[20]; - sprintf(branchname,"%s",GetName()); - if (fMergedHits==0x0) fMergedHits = new TClonesArray("AliZDCMergedHit",1000); - MakeBranchInTree(treeS, branchname, &fMergedHits, kBufferSize, file) ; - if (GetDebug()) printf("* AliZDC::MakeBranch * Making Branch %s for SDigits\n\n",branchname); - -} -//_____________________________________________________________________________ - void AliZDC::MakeBranchInTreeD(TTree *treeD, const char *file) -{ - // MakeBranchInTree - const Int_t kBufferSize = 4000; - char branchname[20]; - sprintf(branchname,"%s",GetName()); - if (fDigits == 0x0) fDigits = new TClonesArray("AliZDCDigit",1000); - MakeBranchInTree(treeD, branchname, &fDigits, kBufferSize, file) ; - if (GetDebug()) printf("* AliZDC::MakeBranch * Making Branch %s for Digits\n\n",branchname); - } -//_____________________________________________________________________________ - void AliZDC::MakeBranchInTreeR(TTree *treeR, const char *file) -{ - // MakeBranchInTree - const Int_t kBufferSize = 4000; - char branchname[20]; - sprintf(branchname,"%s",GetName()); - MakeBranchInTree(treeR, branchname, &fRecPoints, kBufferSize, file) ; - if (GetDebug()) printf("* AliZDC::MakeBranch * Making Branch %s for RecPoints\n\n",branchname); -} //_____________________________________________________________________________ void AliZDC::Hits2SDigits() { - if (GetDebug()) printf("\n Entering AliZDC::SDigits2Digits() "); + // Create summable digits from hits + + if (GetDebug()) printf("\n Entering AliZDC::Hits2Digits() "); fLoader->LoadHits("read"); fLoader->LoadSDigits("recreate"); - AliRunLoader* runLoader = fLoader->GetRunLoader(); + AliRunLoader* runLoader = fLoader->GetRunLoader(); + AliZDCSDigit sdigit; + AliZDCSDigit* psdigit = &sdigit; + // Event loop for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++) { - runLoader->GetEvent(iEvent); - if (!fLoader->TreeS()) fLoader->MakeTree("S"); - MakeBranch("S"); + Float_t pmCZN = 0, pmCZP = 0, pmQZN[4], pmQZP[4], pmZEM1 = 0, pmZEM2 = 0; + for (Int_t i = 0; i < 4; i++) pmQZN[i] = pmQZP[i] = 0; - //---------------------------------------------------------------- - if(!fMerger){ - if (GetDebug()) printf(" ZDC digitization (without merging)\n"); - - AliZDCMergedHit *mHit; - Int_t j, sector[2]; - Float_t mHits[7]; - fNMergedhits = 0; - - TTree *treeH = TreeH(); + runLoader->GetEvent(iEvent); + TTree* treeH = fLoader->TreeH(); Int_t ntracks = (Int_t) treeH->GetEntries(); - gAlice->ResetHits(); - + ResetHits(); + // Tracks loop - for(Int_t itrack=0; itrackGetEvent(itrack); - for(AliZDCHit* zdcHit=(AliZDCHit*)this->FirstHit(-1); zdcHit; - zdcHit = (AliZDCHit*)this->NextHit()){ + Int_t sector[2]; + for (Int_t itrack = 0; itrack < ntracks; itrack++) { + treeH->GetEntry(itrack); + for (AliZDCHit* zdcHit = (AliZDCHit*)FirstHit(-1); zdcHit; + zdcHit = (AliZDCHit*)NextHit()) { - for(j=0; j<2; j++) sector[j] = zdcHit->GetVolume(j); - mHits[0] = zdcHit->GetPrimKinEn(); - mHits[1] = zdcHit->GetXImpact(); - mHits[2] = zdcHit->GetYImpact(); - mHits[3] = zdcHit->GetSFlag(); - mHits[4] = zdcHit->GetLightPMQ(); - mHits[5] = zdcHit->GetLightPMC(); - mHits[6] = zdcHit->GetEnergy(); - }//Hits loop - - mHit = new AliZDCMergedHit(sector, mHits); - new((*fMergedHits)[fNMergedhits]) AliZDCMergedHit(*mHit); - TClonesArray &sdigits = *fMergedHits; - new (sdigits[fNMergedhits]) AliZDCMergedHit(*mHit); - fNMergedhits++; - delete mHit; + sector[0] = zdcHit->GetVolume(0); + sector[1] = zdcHit->GetVolume(1); + if ((sector[1] < 1) || (sector[1] > 4)) { + Error("Hits2SDigits", "sector[0] = %d, sector[1] = %d", + sector[0], sector[1]); + continue; + } + Float_t lightQ = zdcHit->GetLightPMQ(); + Float_t lightC = zdcHit->GetLightPMC(); + + if (sector[0] == 1) { //ZN + pmCZN += lightC; + pmQZN[sector[1]-1] += lightQ; + } else if (sector[0] == 2) { //ZP + pmCZP += lightC; + pmQZP[sector[1]-1] += lightQ; + } else if (sector[0] == 3) { //ZEM + if (sector[1] == 1) pmZEM1 += lightC; + else pmZEM2 += lightQ; + } + }//Hits loop } - fLoader->TreeS()->Fill(); - fLoader->TreeS()->AutoSave(); - fLoader->TreeS()->Reset(); - } - //---------------------------------------------------------------- - else if(fMerger){ - if (GetDebug()) printf(" ZDC merging and digitization\n"); - // ### Initialise merging - fMerger -> InitMerging(); - - // SDigits tree - - - - TTree *treeS = fLoader->TreeS(); - if (treeS == 0x0) - { - Int_t retval = fLoader->LoadSDigits(); - if (retval) - { - Error("Hits2SDigits","Error while loading S. Digits"); - return; - } - treeS = fLoader->TreeS(); - } - - if(!treeS){ - if (GetDebug()) printf("\n ERROR -> Can't find TreeS%d in background file\n",fMerger->EvNum()); - } - - // ### Get TCA of MergedHits from AliZDCMerger - fMergedHits = fMerger->MergedHits(); - fNMergedhits = fMerger->GetNMhits(); - - // Branch address - char branchSDname[20]; - sprintf(branchSDname,"%s",GetName()); - if(treeS && fMergedHits){ - TBranch *branchSD = treeS->GetBranch(branchSDname); - if(branchSD) branchSD->SetAddress(&fMergedHits); - else if(!branchSD) MakeBranchInTreeS(treeS); - } - AliZDCMergedHit *mHit; - TClonesArray &sdigits = *fMergedHits; - Int_t imhit; - //Merged Hits loop - for(imhit=0; imhitUncheckedAt(imhit); - new (sdigits[imhit]) AliZDCMergedHit(*mHit); + + // create the output tree + fLoader->MakeTree("S"); + TTree* treeS = fLoader->TreeS(); + const Int_t kBufferSize = 4000; + treeS->Branch(GetName(), "AliZDCSDigit", &psdigit, kBufferSize); + + // Create sdigits for ZN + sector[0] = 1; // Detector = ZN + sector[1] = 0; // Common PM ADC + new(psdigit) AliZDCSDigit(sector, pmCZN); + if (pmCZN > 0) treeS->Fill(); + for (Int_t j = 0; j < 4; j++) { + sector[1] = j+1; // Towers PM ADCs + new(psdigit) AliZDCSDigit(sector, pmQZN[j]); + if (pmQZN[j] > 0) treeS->Fill(); } - treeS->Fill(); - treeS->AutoSave(); - } + // Create sdigits for ZP + sector[0] = 2; // Detector = ZP + sector[1] = 0; // Common PM ADC + new(psdigit) AliZDCSDigit(sector, pmCZP); + if (pmCZP > 0) treeS->Fill(); + for (Int_t j = 0; j < 4; j++) { + sector[1] = j+1; // Towers PM ADCs + new(psdigit) AliZDCSDigit(sector, pmQZP[j]); + if (pmQZP[j] > 0) treeS->Fill(); + } + + // Create sdigits for ZEM + sector[0] = 3; + sector[1] = 1; // Detector = ZEM1 + new(psdigit) AliZDCSDigit(sector, pmZEM1); + if (pmZEM1 > 0) treeS->Fill(); + sector[1] = 2; // Detector = ZEM2 + new(psdigit) AliZDCSDigit(sector, pmZEM2); + if (pmZEM2 > 0) treeS->Fill(); + + // write the output tree + fLoader->WriteSDigits("OVERWRITE"); } fLoader->UnloadHits(); @@ -431,302 +316,122 @@ void AliZDC::Hits2SDigits() } //_____________________________________________________________________________ -void AliZDC::SDigits2Digits() -{ - if(!fMerger){ // Only digitization - if (GetDebug()) printf(" ZDC digitization (no merging) \n"); - fMerger = new AliZDCMerger(); - fMerger->Digitize(fNMergedhits, fMergedHits); - - char hname[30]; - AliRunLoader * rl = fLoader->GetRunLoader(); - sprintf(hname,"TreeD%d",rl->GetHeader()->GetEvent()); - fLoader->TreeD()->Fill(); - fLoader->TreeD()->AutoSave(); - fLoader->TreeD()->Reset(); - } - else if(fMerger){ // Merging and digitization - if (GetDebug()) printf(" ZDC merging and digitization\n"); - fMerger->Digitize(fNMergedhits, fMergedHits); - - // Digits tree - - TTree *treeD = fLoader->TreeD(); - if (treeD == 0x0) - { - Int_t retval = fLoader->LoadDigits(); - if (retval) - { - Error("SDigits2Digits","Error while loading Digits"); - return; - } - treeD = fLoader->TreeD(); - } - - - - if(!treeD){ - if (GetDebug()) printf("\n ERROR -> Can't find TreeD%d in background file\n",fMerger->EvNum()); - } - // Branch address - char branchDname[20]; - sprintf(branchDname,"%s",GetName()); - if(treeD && fDigits){ - TBranch *branchD = treeD->GetBranch(branchDname); - if(branchD) branchD->SetAddress(&fDigits); - else if(!branchD) MakeBranchInTreeD(treeD); - } - treeD->Fill(); - treeD->AutoSave(); - } - - -} -//_____________________________________________________________________________ -void AliZDC::Hits2Digits() +AliDigitizer* AliZDC::CreateDigitizer(AliRunDigitizer* manager) const { - gAlice->Hits2SDigits(); - gAlice->SDigits2Digits(); + // Create the digitizer for ZDC + + return new AliZDCDigitizer(manager); } //_____________________________________________________________________________ -void AliZDC::Digits2Reco() +void AliZDC::Digits2Raw() { - if (GetDebug()) printf(" Entering AliZDC::Digits2Reco\n"); - AliDetector *zdcd = gAlice->GetDetector("ZDC"); - TClonesArray *zdcdigits = zdcd->Digits(); + // Convert ZDC digits to raw data + + // preliminary format: 12 interger values (ZNC, ZNQ1-4, ZPC, ZPQ1-4, ZEM1,2) + // For the CAEN module V965 we have an header, the Data Words and an End Of Block + UInt_t ADCHeader; + UInt_t ADCData[24]; + UInt_t ADCEndBlock; + + // load the digits + fLoader->LoadDigits("read"); + AliZDCDigit digit; + AliZDCDigit* pdigit = &digit; + TTree* treeD = fLoader->TreeD(); + if (!treeD) return; + treeD->SetBranchAddress("ZDC", &pdigit); + + // Fill data array + // ADC header + UInt_t ADCHeaderGEO = 0; + UInt_t ADCHeaderCRATE = 0; + UInt_t ADCHeaderCNT = (UInt_t) treeD->GetEntries(); - TTree *td = fLoader->TreeD(); - if (td == 0x0) - { - Int_t retval = fLoader->LoadDigits(); - if (retval) - { - Error("Digits2Reco","Error while loading Digits"); - return; - } - td = fLoader->TreeD(); - } - - - if(td){ - char brname[20]; - sprintf(brname,"%s",zdcd->GetName()); - TBranch *br = td->GetBranch(brname); - if(br) br->SetAddress(&zdcdigits); + ADCHeader = ADCHeaderGEO << 27 | 0x1 << 25 | ADCHeaderCRATE << 16 | + ADCHeaderCNT << 8 ; + + //printf("ADCHeader = %d\n",ADCHeader); + + // ADC data word + UInt_t ADCDataGEO = ADCHeaderGEO; + UInt_t ADCDataValue[24]; + UInt_t ADCDataOvFlw[24]; + for(Int_t i = 0; i < 24; i++){ + ADCDataValue[i] = 0; + ADCDataOvFlw[i] = 0; + } + UInt_t ADCDataChannel = 0; + + // loop over digits + for (Int_t iDigit = 0; iDigit < treeD->GetEntries(); iDigit++) { + treeD->GetEntry(iDigit); + if (!pdigit) continue; + + //ADC data + Int_t index = 0; + if(digit.GetSector(0)!=3){ + index = (digit.GetSector(0)-1) + digit.GetSector(1)*4; + ADCDataChannel = (digit.GetSector(0)-1)*8 + digit.GetSector(1); + } + else { + index = 19 + digit.GetSector(1); + ADCDataChannel = 5 + digit.GetSector(1)*8; + } + + if ((index < 0) || (index >= 22)) { + Error("Digits2Raw", "sector[0] = %d, sector[1] = %d", + digit.GetSector(0), digit.GetSector(1)); + continue; } - else if(!td) printf(" ERROR -> TreeD NOT found in gAlice object\n"); - - Int_t nt = (Int_t) (td->GetEntries()); - gAlice->ResetDigits(); - AliZDCDigit *dig; - Int_t j, idig, ndigits, znraw=0, zpraw=0, zemraw=0; - // --- Summing raw ADCs for each detector to obtain total light - for(j=0; jGetEvent(j); - ndigits = zdcdigits->GetEntries(); - znraw=0; - zpraw=0; - zemraw=0; - // --- Loop over event digits - for(idig=0; idigUncheckedAt(idig); - if(dig->GetSector(0) == 1) znraw += dig->GetADCValue(); - else if(dig->GetSector(0) == 2) zpraw += dig->GetADCValue(); - else if(dig->GetSector(0) == 3) zemraw += dig->GetADCValue(); - } // Digits loop - } // TreeD entries loop - if (GetDebug()) printf("\n --- znraw = %d, zpraw = %d, zemraw = %d\n",znraw, zpraw, zemraw); + ADCDataValue[index] = digit.GetADCValue(0); + if (ADCDataValue[index] > 2047) ADCDataOvFlw[index] = 1; + ADCDataValue[index+2] = digit.GetADCValue(1); + if (ADCDataValue[index+2] > 2047) ADCDataOvFlw[index+2] = 1; - // --- Pedestal subtraction - Int_t zncorr, zpcorr, zemcorr, meanPed=50; - zncorr = znraw - 5*meanPed; - zpcorr = zpraw - 5*meanPed; - zemcorr = zemraw - 2*meanPed; - if(zncorr<0) zncorr=0; - if(zpcorr<0) zpcorr=0; - if(zemcorr<0) zemcorr=0; - if (GetDebug()) printf("\n zncorr = %d, zpcorr = %d, zemcorr = %d\n",zncorr,zpcorr,zemcorr); - - // --- ADCchannel -> photoelectrons - // NB-> PM gain = 10^(5), ADC resolution = 6.4*10^(-7) - Float_t znphe, zpphe, zemphe, convFactor = 0.064; - znphe = zncorr/convFactor; - zpphe = zpcorr/convFactor; - zemphe = zemcorr/convFactor; - if (GetDebug()) printf("\n znphe = %f, zpphe = %f, zemphe = %f\n",znphe, zpphe, zemphe); - - // --- Energy calibration - // Conversion factors for hadronic ZDCs goes from phe yield to TRUE incident - // energy (conversion from GeV to TeV is included); while for EM calos - // conversion is from light yield to detected energy calculated by GEANT - // NB -> ZN and ZP conversion factors are constant since incident spectators - // have all the same energy, ZEM energy is obtained through a fit over the whole - // range of incident particle energies (obtained with full HIJING simulations) - Float_t znenergy, zpenergy, zemenergy, zdcenergy; - Float_t znphexTeV=329., zpphexTeV=369.; - znenergy = znphe/znphexTeV; - zpenergy = zpphe/zpphexTeV; - zdcenergy = znenergy+zpenergy; - zemenergy = -4.81+0.3238*zemphe; - if(zemenergy<0) zemenergy=0; - if (GetDebug()) printf(" znenergy = %f TeV, zpenergy = %f TeV, zdcenergy = %f GeV, " - "\n zemenergy = %f TeV\n", znenergy, zpenergy, - zdcenergy, zemenergy); - - if(zdcenergy==0) - if (GetDebug()) printf("\n\n ### ATTENZIONE!!! -> ev# %d: znenergy = %f TeV, zpenergy = %f TeV, zdcenergy = %f GeV, " - " zemenergy = %f TeV\n\n", fMerger->EvNum(), znenergy, zpenergy, zdcenergy, zemenergy); - - // --- Number of incident spectator nucleons - Int_t nDetSpecN, nDetSpecP; - nDetSpecN = (Int_t) (znenergy/2.760); - nDetSpecP = (Int_t) (zpenergy/2.760); - if (GetDebug()) printf("\n nDetSpecN = %d, nDetSpecP = %d\n",nDetSpecN, nDetSpecP); - - // --- Number of generated spectator nucleons and impact parameter - // -------------------------------------------------------------------------------------------------- - // [1] ### Results in Chiara's PhD thesis -> 0 0 0 0 0 0 0 0 (eZEMCut+deltaEZEMSup)){ - nGenSpecN = (Int_t) (fZNCen->Eval(znenergy)); - nGenSpecP = (Int_t) (fZPCen->Eval(zpenergy)); - nGenSpec = (Int_t) (fZDCCen->Eval(zdcenergy)); - impPar = fbCen->Eval(zdcenergy); - //printf(" fZNCen = %f, fZPCen = %f, fZDCCen = %f\n",fZNCen->Eval(znenergy), - // fZPCen->Eval(zpenergy),fZDCCen->Eval(zdcenergy)); - } - else if(zemenergy < (eZEMCut-deltaEZEMInf)){ - nGenSpecN = (Int_t) (fZNPer->Eval(znenergy)); - nGenSpecP = (Int_t) (fZPPer->Eval(zpenergy)); - nGenSpec = (Int_t) (fZDCPer->Eval(zdcenergy)); - impPar = fbPer->Eval(zdcenergy); - //printf(" fZNPer = %f, fZPPer = %f, fZDCPer = %f\n",fZNPer->Eval(znenergy), - // fZPPer->Eval(zpenergy),fZDCPer->Eval(zdcenergy)); + ADCData[index] = ADCDataGEO << 27 | ADCDataChannel << 17 | + ADCDataOvFlw[index] << 12 | (ADCDataValue[index] & 0xfff); + ADCData[index+2] = ADCDataGEO << 27 | ADCDataChannel << 17 | 0x1 << 16 | + ADCDataOvFlw[index+2] << 12 | (ADCDataValue[index+2] & 0xfff); } - else if(zemenergy >= (eZEMCut-deltaEZEMInf) && zemenergy <= (eZEMCut+deltaEZEMSup)){ - nGenSpecN = (Int_t) (fZEMn->Eval(zemenergy)); - nGenSpecP = (Int_t) (fZEMp->Eval(zemenergy)); - nGenSpec = (Int_t)(fZEMsp->Eval(zemenergy)); - impPar = fZEMb->Eval(zemenergy); - //printf(" Nspec ZEM = %f, Nspec ZDC = %f\n",fZEMsp->Eval(znenergy),fZDCPer->Eval(zdcenergy)); - } - // [1] ### Results in Chiara's PhD thesis -> 0158.5) nGenSpecN = (Int_t) (fZEMn->Eval(zemenergy)); - if(zpenergy>58.91) nGenSpecP = (Int_t) (fZEMp->Eval(zemenergy)); - if(zdcenergy>220.4) nGenSpec = (Int_t)(fZEMsp->Eval(zemenergy)); - if(zdcenergy>225.) impPar = fZEMb->Eval(zemenergy);*/ - // [2] ### Results from a new production -> 0162.) nGenSpecN = (Int_t) (fZEMn->Eval(zemenergy)); - if(zpenergy>59.75) nGenSpecP = (Int_t) (fZEMp->Eval(zemenergy)); - if(zdcenergy>221.5) nGenSpec = (Int_t)(fZEMsp->Eval(zemenergy)); - if(zdcenergy>220.) impPar = fZEMb->Eval(zemenergy); - - if(nGenSpecN>125) nGenSpecN=125; - else if(nGenSpecN<0) nGenSpecN=0; - if(nGenSpecP>82) nGenSpecP=82; - else if(nGenSpecP<0) nGenSpecP=0; - if(nGenSpec>207) nGenSpec=207; - else if(nGenSpec<0) nGenSpec=0; - //printf(" NRecSpecN = %d, NRecSpecP = %d, NRecSpec = %d\n",nGenSpecN,nGenSpecP,nGenSpec); + //for (Int_t i=0;i<24;i++)printf("ADCData[%d] = %d\n",i,ADCData[i]); - // --- Number of participants - Int_t nPart, nPartTot; - nPart = 207-nGenSpecN-nGenSpecP; - nPartTot = 207-nGenSpec; - //printf(" ### nPart(ZP+ZN) = %d, nPart(ZDC) = %d, b = %f fm\n",nPart,nPartTot,impPar); - if (GetDebug()) printf(" ### nPart = %d, b = %f fm\n",nPartTot,impPar); + // End of Block + UInt_t ADCEndBlockGEO = ADCHeaderGEO; + UInt_t ADCEndBlockEvCount = gAlice->GetEventNrInRun(); - // --- Writing RecPoints TCA - // Allocate the RecPoints TCA - fRecPoints = new TClonesArray("AliZDCReco",1000); - AliZDCReco *reco = new AliZDCReco(znenergy,zpenergy,zdcenergy,zemenergy, - nDetSpecN,nDetSpecP,nGenSpecN,nGenSpecP,nGenSpec,nPartTot,impPar); - new((*fRecPoints)[fNRecPoints]) AliZDCReco(*reco); - //fNRecPoints++; - //fRecPoints->Dump(); - delete reco; + ADCEndBlock = ADCEndBlockGEO << 27 | 0x1 << 26 | ADCEndBlockEvCount; - // TreeR - TTree *treeR = fLoader->TreeR(); - if(!treeR) printf("\n ERROR -> Can't find TreeR%d in background file\n",fMerger->EvNum()); - // Branch address - char branchRname[20]; - sprintf(branchRname,"%s",GetName()); - if(fRecPoints){ - TBranch *branchR = treeR->GetBranch(branchRname); - if(branchR) branchR->SetAddress(&fRecPoints); - else if(!branchR) MakeBranchInTreeR(treeR); - } - treeR->Fill(); - treeR->AutoSave(); - treeR->Reset(); + //printf("ADCEndBlock = %d\n",ADCEndBlock); + + + // open the output file + char fileName[30]; + sprintf(fileName, "ZDC_%d.ddl", AliZDCRawStream::kDDLOffset); +#ifndef __DECCXX + ofstream file(fileName, ios::binary); +#else + ofstream file(fileName); +#endif + + // write the DDL data header + AliRawDataHeader header; + header.fSize = sizeof(header) + sizeof(ADCHeader) + + sizeof(ADCData) + sizeof(ADCEndBlock); + //printf("sizeof header = %d, ADCHeader = %d, ADCData = %d, ADCEndBlock = %d\n", + // sizeof(header),sizeof(ADCHeader),sizeof(ADCData),sizeof(ADCEndBlock)); + header.SetAttribute(0); // valid data + file.write((char*)(&header), sizeof(header)); + + // write the raw data and close the file + file.write((char*) &ADCHeader, sizeof (ADCHeader)); + file.write((char*)(ADCData), sizeof(ADCData)); + file.write((char*) &ADCEndBlock, sizeof(ADCEndBlock)); + file.close(); + + // unload the digits + fLoader->UnloadDigits(); } //______________________________________________________________________ @@ -741,9 +446,6 @@ void AliZDC::SetTreeAddress(){ if (fLoader->TreeH() && (fHits == 0x0)) fHits = new TClonesArray("AliZDCHit",1000); - if (fLoader->TreeD() && (fDigits == 0x0)) - fDigits = new TClonesArray("AliZDCDigit",1000); - AliDetector::SetTreeAddress(); } diff --git a/ZDC/AliZDC.h b/ZDC/AliZDC.h index 4992d45277f..7174765edc9 100644 --- a/ZDC/AliZDC.h +++ b/ZDC/AliZDC.h @@ -9,8 +9,6 @@ // Manager and classes for set ZDC // //////////////////////////////////////////////// -class AliZDCMerger; - #include "AliDetector.h" class AliZDC : public AliDetector { @@ -20,7 +18,6 @@ public: AliZDC(const char *name, const char *title); virtual ~AliZDC(); virtual void AddHit(Int_t track, Int_t *vol, Float_t *hits); - virtual void AddDigit(Int_t *sector, Int_t digit); virtual void BuildGeometry(); virtual void CreateGeometry() {} virtual void CreateMaterials() {} @@ -30,16 +27,9 @@ public: virtual Float_t ZMax() const; // Maximum overall dimension of the ZDC virtual void SetTreeAddress(); virtual void MakeBranch(Option_t* opt, const char *file=0); - virtual void MakeBranchInTreeS(TTree *treeS, const char *file=0); - virtual void MakeBranchInTreeD(TTree *treeD, const char *file=0); - virtual void MakeBranchInTreeR(TTree *treeD, const char *file=0); virtual void Hits2SDigits(); - virtual void SDigits2Digits(); - virtual void Hits2Digits(); - virtual void Digits2Reco(); - TClonesArray *Reconstructed() const {return fRecPoints;} - virtual void SetMerger(AliZDCMerger* merger) {fMerger = merger;} - virtual AliZDCMerger* Merger() {return fMerger;} + virtual AliDigitizer* CreateDigitizer(AliRunDigitizer* manager) const; + virtual void Digits2Raw(); virtual void StepManager() {} // Switching off the shower development in ZDCs @@ -49,15 +39,8 @@ public: protected: Int_t fNoShower; // Flag to switch off the shower - AliZDCMerger *fMerger; // ! pointer to merger - - Int_t fNMergedhits; // Number of Merged hits for background - TClonesArray *fMergedHits; //! TCA for "merged" hits - Int_t fNRecPoints; // Number of RecPoints - TClonesArray *fRecPoints; //! List of RecPoints - - ClassDef(AliZDC,3) // Zero Degree Calorimeter base class + ClassDef(AliZDC,4) // Zero Degree Calorimeter base class }; #endif diff --git a/ZDC/AliZDCDigit.cxx b/ZDC/AliZDCDigit.cxx index f51462226f1..d765d0ada1f 100644 --- a/ZDC/AliZDCDigit.cxx +++ b/ZDC/AliZDCDigit.cxx @@ -32,11 +32,12 @@ ClassImp(AliZDCDigit) fSector[0] = 0; fSector[1] = 0; - fADCValue = 0; + fADCValue[0] = 0; + fADCValue[1] = 0; } //____________________________________________________________________________ -AliZDCDigit::AliZDCDigit(Int_t *Sector, Int_t ADCValue) +AliZDCDigit::AliZDCDigit(Int_t *Sector, Int_t *ADCValue) { // Constructor @@ -44,7 +45,9 @@ AliZDCDigit::AliZDCDigit(Int_t *Sector, Int_t ADCValue) for(i=0; i<2; i++) { fSector[i] = Sector[i]; } - fADCValue = ADCValue; + for(i=0; i<2; i++) { + fADCValue[i] = ADCValue[i]; + } } //____________________________________________________________________________ @@ -54,6 +57,7 @@ AliZDCDigit::AliZDCDigit(const AliZDCDigit & digit):TObject(digit) fSector[0] = digit.fSector[0]; fSector[1] = digit.fSector[1]; - fADCValue = digit.fADCValue; + fADCValue[0] = digit.fADCValue[0]; + fADCValue[1] = digit.fADCValue[1]; } diff --git a/ZDC/AliZDCDigit.h b/ZDC/AliZDCDigit.h index 7f7a66b2706..de6ad6d7528 100644 --- a/ZDC/AliZDCDigit.h +++ b/ZDC/AliZDCDigit.h @@ -17,13 +17,13 @@ class AliZDCDigit : public TObject { public: AliZDCDigit() ; - AliZDCDigit(Int_t *Sector, Int_t ADCValue); + AliZDCDigit(Int_t *Sector, Int_t *ADCValue); AliZDCDigit(const AliZDCDigit & digit); virtual ~AliZDCDigit() {} // Getters - virtual Int_t GetSector(Int_t i) {return fSector[i];} - virtual Int_t GetADCValue() {return fADCValue;} + virtual Int_t GetSector(Int_t i) {return fSector[i];} + virtual Int_t GetADCValue(Int_t i) {return fADCValue[i];} // Operators Int_t operator == (AliZDCDigit &digit) { @@ -35,7 +35,9 @@ class AliZDCDigit : public TObject { } virtual AliZDCDigit& operator + (AliZDCDigit &digit) { // Adds the amplitude of digits - fADCValue += digit.fADCValue ; + for(Int_t i = 0; i < 2; i++){ + fADCValue[i] += digit.fADCValue[i] ; + } return *this ; } @@ -43,15 +45,15 @@ class AliZDCDigit : public TObject { //Data members Int_t fSector[2]; // Detector and tower in which light is produced - Int_t fADCValue; // ADC channel value + Int_t fADCValue[2]; // ADC channel value (0 = high gain, 1 = low gain) // Print method virtual void Print(Option_t *) { - printf(" -> DIGIT: Detector = %d Quadrant = %d ADCCh = %d\n ", - fSector[0], fSector[1], fADCValue); + printf(" -> DIGIT: Detector = %d Quadrant = %d ADCCh high gain= %d ADCCh low gain= %d\n ", + fSector[0], fSector[1], fADCValue[0], fADCValue[1]); } - ClassDef(AliZDCDigit,3) // Digits in ZDC + ClassDef(AliZDCDigit,4) // Digits in ZDC } ; diff --git a/ZDC/AliZDCMerger.cxx b/ZDC/AliZDCMerger.cxx index 3ea80783ba4..8f9bb36c23d 100644 --- a/ZDC/AliZDCMerger.cxx +++ b/ZDC/AliZDCMerger.cxx @@ -325,154 +325,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; imhitUncheckedAt(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; -} diff --git a/ZDC/AliZDCMerger.h b/ZDC/AliZDCMerger.h index d6102f6de4c..e19ad6d2a82 100644 --- a/ZDC/AliZDCMerger.h +++ b/ZDC/AliZDCMerger.h @@ -26,9 +26,6 @@ public: Int_t &nfreespn, Int_t &nfreespp); void Mixing(); void ExtractSignal(Int_t SpecType); - void Digitize(Int_t NMhits, TClonesArray *MHits); - Int_t Phe2ADCch(Int_t Detector, Int_t Quadrant, Int_t Light); - Int_t AddPedestal(); // Inline functions to return TCA of MergerHits to Hits2SDigits() TClonesArray *MergedHits() const {return fMHits;} diff --git a/ZDC/AliZDCv2.cxx b/ZDC/AliZDCv2.cxx index 354a5b73375..6650b53fcf7 100644 --- a/ZDC/AliZDCv2.cxx +++ b/ZDC/AliZDCv2.cxx @@ -1207,7 +1207,7 @@ void AliZDCv2::StepManager() else if(xdet[1]<0.) vol[1]=4; } if((vol[1]!=1) && (vol[1]!=2) && (vol[1]!=3) && (vol[1]!=4)) - printf("\n StepManager->ERROR in ZN!!! vol[1] = %d, xdet[0] = %f," + printf("\n ZDC StepManager->ERROR in ZN!!! vol[1] = %d, xdet[0] = %f," "xdet[1] = %f\n",vol[1], xdet[0], xdet[1]); } @@ -1226,7 +1226,7 @@ void AliZDCv2::StepManager() } } if((vol[1]!=1) && (vol[1]!=2) && (vol[1]!=3) && (vol[1]!=4)) - printf(" StepManager->ERROR in ZP!!! vol[1] = %d, xdet[0] = %f," + printf(" ZDC StepManager->ERROR in ZP!!! vol[1] = %d, xdet[0] = %f," "xdet[1] = %f",vol[1], xdet[0], xdet[1]); } @@ -1261,8 +1261,6 @@ void AliZDCv2::StepManager() hits[8] = 0; hits[9] = 0; -// Int_t PcID = gMC->TrackPid(); -// printf("Pc ID -> %d\n",PcID); AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits); if(fNoShower==1){ @@ -1291,7 +1289,6 @@ void AliZDCv2::StepManager() hits[8] = 0.; AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits); } -// printf(" Dep. E = %f \n",hits[9]); } }// NB -> Questa parentesi (chiude il primo IF) io la sposterei al fondo!??? diff --git a/ZDC/ZDCtest.C b/ZDC/ZDCtest.C deleted file mode 100644 index c7a4aba4d79..00000000000 --- a/ZDC/ZDCtest.C +++ /dev/null @@ -1,341 +0,0 @@ -void ZDCtest (Int_t detector=0, Int_t evTot = 0) -{ - delete gAlice; - gAlice=0; -// Dynamically link some shared libs - if (gClassTable->GetID("AliRun") < 0) { - gROOT->LoadMacro("loadlibs.C"); - loadlibs(); - } - -// Connect the Root Galice file containing Geometry, Kine, Hits and Digits - TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root"); - if (!file) { - printf("\n Creating galice.root \n"); - file = new TFile("galice.root"); - } else { - printf("\n galice.root found in file list"); - } - file->ls(); - -// Get AliRun object from file or create it if not on file - if (!gAlice) { - gAlice = (AliRun*)file->Get("gAlice"); - if (gAlice) printf("AliRun object found on file\n"); - if (!gAlice) { - printf("\n create new gAlice object"); - gAlice = new AliRun("gAlice","Alice test program"); - } - } - file->ls(); - -// Create some histograms - - TH2F *hspotzn = new TH2F("hspotzn","Y vs X on ZN front face",100,-4.,4.,100,-4.,4.); - hspotzn -> SetXTitle("X on ZN"); - hspotzn -> SetYTitle("Y on ZN"); - TH2F *hspotzp = new TH2F("hspotzp","Y vs X on ZP front face",100,-12.,12.,100,-12.,12.); - hspotzp -> SetXTitle("X on ZP"); - hspotzp -> SetYTitle("Y on ZP"); - TH2F *hspotzem = new TH2F("hspotzem","Y vs X on ZEM front face",100,-4.,4.,100,-4.,4.); - hspotzem -> SetXTitle("X on ZEM"); - hspotzem -> SetYTitle("Y on ZEM"); - - TH1F *hEzn = new TH1F("hEzn","Energy deposited in ZN",100,0,4.e3); - hEzn -> SetXTitle("E (GeV)"); - TH1F *hLzn = new TH1F("hLzn", "Total light in ZN ",100,0,4.e3); - hLzn -> SetXTitle("phe"); - TH1F *hPMCzn = new TH1F("hPMCzn", "Light in common PM ",100,0,1.e3); - hPMCzn -> SetXTitle("phe"); - TH1F *hPMQ1zn = new TH1F("hPMQ1zn","Light in quadrant 1 PM",100,0,1.e3); - hPMQ1zn -> SetXTitle("phe"); - TH1F *hPMQ2zn = new TH1F("hPMQ2zn","Light in quadrant 2 PM",100,0,1.e3); - hPMQ2zn -> SetXTitle("phe"); - TH1F *hPMQ3zn = new TH1F("hPMQ3zn","Light in quadrant 3 PM",100,0,1.e3); - hPMQ3zn -> SetXTitle("phe"); - TH1F *hPMQ4zn = new TH1F("hPMQ4zn","Light in quadrant 4 PM",100,0,1.e3); - hPMQ4zn -> SetXTitle("phe"); - - TH1F *hEzp = new TH1F("hEzp","Energy deposited in ZP",100,0,4.e3); - hEzp -> SetXTitle("E (GeV)"); - TH1F *hLzp = new TH1F("hLzp", "Total light in ZP ",100,0,4.e3); - hLzp -> SetXTitle("phe"); - TH1F *hPMCzp = new TH1F("hPMCzp","Light in common PM ",100,0,1.e3); - hPMCzp -> SetXTitle("phe"); - TH1F *hPMQ1zp = new TH1F("hPMQ1zp","Light in quadrant 1 PM",100,0,1.e3); - hPMQ1zp -> SetXTitle("phe"); - TH1F *hPMQ2zp = new TH1F("hPMQ2zp","Light in quadrant 2 PM",100,0,1.e3); - hPMQ2zp -> SetXTitle("phe"); - TH1F *hPMQ3zp = new TH1F("hPMQ3zp","Light in quadrant 3 PM",100,0,1.e3); - hPMQ3zp -> SetXTitle("phe"); - TH1F *hPMQ4zp = new TH1F("hPMQ4zp","Light in quadrant 4 PM",100,0,1.e3); - hPMQ4zp -> SetXTitle("phe"); - - - TH1F *hEzem = new TH1F("hEzem","Energy deposited in ZEM",100,0,5.e3); - hEzem -> SetXTitle("E (GeV)"); - TH1F *hPMzem = new TH1F("hPMzem","Light produced in ZEM PM",100,0,5.e3); - hPMzem -> SetXTitle("phe"); - - // - - TH1F *dPMCzn = new TH1F("dPMCzn","Common PM ",100,0,1.e3); - dPMCzn -> SetXTitle("ADC channels"); - TH1F *dPMQ1zn = new TH1F("dPMQ1zn","Quadrant 1 PM",100,0,1.e3); - dPMQ1zn -> SetXTitle("ADC channels"); - TH1F *dPMQ2zn = new TH1F("dPMQ2zn","Quadrant 2 PM",100,0,1.e3); - dPMQ2zn -> SetXTitle("ADC channels"); - TH1F *dPMQ3zn = new TH1F("dPMQ3zn","Quadrant 3 PM",100,0,1.e3); - dPMQ3zn -> SetXTitle("ADC channels"); - TH1F *dPMQ4zn = new TH1F("dPMQ4zn","Quadrant 4 PM",100,0,1.e3); - dPMQ4zn -> SetXTitle("ADC channels"); - TH1F *dZN = new TH1F("dZN","Total light in ZN",100,0,1.e3); - dZN -> SetXTitle("ADC channels"); - - TH1F *dPMCzp = new TH1F("dPMCzp","Common PM ",100,0,1.e3); - dPMCzp -> SetXTitle("ADC channels"); - TH1F *dPMQ1zp = new TH1F("dPMQ1zp","Quadrant 1 PM",100,0,1.e3); - dPMQ1zp -> SetXTitle("ADC channels"); - TH1F *dPMQ2zp = new TH1F("dPMQ2zp","Quadrant 2 PM",100,0,1.e3); - dPMQ2zp -> SetXTitle("ADC channels"); - TH1F *dPMQ3zp = new TH1F("dPMQ3zp","Quadrant 3 PM",100,0,1.e3); - dPMQ3zp -> SetXTitle("ADC channels"); - TH1F *dPMQ4zp = new TH1F("dPMQ4zp","Quadrant 4 PM",100,0,1.e3); - dPMQ4zp -> SetXTitle("ADC channels"); - TH1F *dZP = new TH1F("dZP","Total light in ZP",100,0,1.e3); - dZP -> SetXTitle("ADC channels"); - - TH1F *dZEM = new TH1F("dZEM","Total light in ZEM",100,0,1.e3); - dZEM -> SetXTitle("ADC channels"); - -// -// Loop over events -// -// NB -> Il TClonesArray delle particelle va inizializzato prima del loop - TParticle *particle; - TClonesArray *Particles = gAlice->Particles(); - - for (Int_t evNumber=0; evNumberGetEvent(evNumber); - if (nparticles <= 0) return; - printf("\n --- nparticles = %d\n",nparticles); - - Float_t energy, EtotZN=0, EtotZP=0, LightCzn=0, LightCzp=0, LtotZN=0, LtotZP=0; - Int_t nbytes=0, nbytesd=0, ipart, nhits, ndigits, pdgcode, ADCzn, ADCzp; - AliZDCHit *ZDChit; - AliZDCDigit *ZDCdigit; - -// Get pointers to Alice detectors and Hits containers - AliDetector *ZDC = gAlice->GetDetector("ZDC"); - if (ZDC) { - TClonesArray *ZDChits = ZDC->Hits(); -// TClonesArray *ZDCdigits = ZDC->Digits(); - } - -// # of entries in Hits tree - TTree *TH = gAlice->TreeH(); - Int_t ntracks = TH->GetEntries(); - -// # of entries in Digits tree -// TTree *TD = gAlice->TreeD(); -// Int_t ndigen = TD->GetEntries(); - -// gAlice->ResetDigits(); -// nbytesd += TD->GetEvent(ndigen-1); - -// if (ZDC) { -// ndigits = ZDCdigits->GetEntries(); -// printf("\n Digits Tree --- # of entries: %d; # of digits: %d\n",ndigen, ndigits); -// } -// for(Int_t digit=0; digitUncheckedAt(digit); -// printf("\n Digit# %d, fDetector = %d, fVolume = %d, fADCValue = %f\n", -// digit,ZDCdigit->fDetector,ZDCdigit->fQuadrant,ZDCdigit->fADCValue); -// } - -// Start loop on tracks in the hits containers - for (Int_t track=0; trackResetHits(); - nbytes += TH->GetEvent(track); - - if (ZDC) { -// nhits = ZDChits->GetEntries(); -// nhits = ZDChits->GetLast()+1; - nhits = ZDChits->GetEntriesFast(); -// printf("\n Hits Tree --- Event %d track %d nhits %d\n",evNumber,track,nhits); - - particle = (TParticle*)Particles->UncheckedAt(track); -// pdgcode = particle->GetPdgCode(); -// printf("\nParticle %d\n",pdgcode); - - for(Int_t hit=0; hitUncheckedAt(hit); - - // Print of the hits -// printf("\nHit # %d, fVolume = %d %d\n",hit,ZDChit->fVolume[0],ZDChit->fVolume[1]); -// printf("Primary energy = %f, Secondary Flag = %d\n",ZDChit->fPrimKinEn,ZDChit->fSFlag); -// printf("Impact point -> %f %f\n",ZDChit->fXImpact,ZDChit->fYImpact); -// printf("Energy = %f, Light in quadrant = %f, Light in common PM = %f\n\n", -// ZDChit->fEnergy,ZDChit->fLightPMQ,ZDChit->fLightPMC); - - // Filling histos - if(ZDChit->fVolume[0]==1) { //ZN - if(ZDChit->fVolume[1]==1)hPMQ1zn->Fill(ZDChit->fLightPMQ); - if(ZDChit->fVolume[1]==2)hPMQ2zn->Fill(ZDChit->fLightPMQ); - if(ZDChit->fVolume[1]==3)hPMQ3zn->Fill(ZDChit->fLightPMQ); - if(ZDChit->fVolume[1]==4)hPMQ4zn->Fill(ZDChit->fLightPMQ); - EtotZN += ZDChit->fEnergy; - LtotZN += (ZDChit->fLightPMQ) + (ZDChit->fLightPMC); - LightCzn += ZDChit->fLightPMC; - hspotzn->Fill(ZDChit->fXImpact,ZDChit->fYImpact); - } - if(ZDChit->fVolume[0]==2) { //ZP - if(ZDChit->fVolume[1]==1)hPMQ1zp->Fill(ZDChit->fLightPMQ); - if(ZDChit->fVolume[1]==2)hPMQ2zp->Fill(ZDChit->fLightPMQ); - if(ZDChit->fVolume[1]==3)hPMQ3zp->Fill(ZDChit->fLightPMQ); - if(ZDChit->fVolume[1]==4)hPMQ4zp->Fill(ZDChit->fLightPMQ); - EtotZP += ZDChit->fEnergy; - LtotZP += (ZDChit->fLightPMQ) + (ZDChit->fLightPMC); - LightCzp += ZDChit->fLightPMC; - hspotzp->Fill(ZDChit->fXImpact,ZDChit->fYImpact); - } - if(ZDChit->fVolume[0]==3) { //ZEM - hEzem->Fill(ZDChit->fEnergy); - hPMzem->Fill(ZDChit->fLightPMC); - hspotzem->Fill(ZDChit->fXImpact,ZDChit->fYImpact); - } - - } - if(nhits!=0){ - hEzn->Fill(EtotZN); - hLzn->Fill(LtotZN); - hPMCzn->Fill(LightCzn); - hEzp->Fill(EtotZP); - hLzp->Fill(LtotZP); - hPMCzp->Fill(LightCzp); -// printf("\n Histos var -> Ezn = %f, Lzn = %f, Ezp = %f, Lzp = %f \n\n", -// EtotZN, LtotZN, EtotZP, LtotZP); - } - }//ZDC - }//Track loop - }//Hit loop - -// Control prints - - -if(detector == 1){ // ZN histos - TCanvas *c1 = new TCanvas("c1","ZN hits",0,10,580,700); - c1->cd(); - TPad *pad1= new TPad("pad1"," ",0.01,0.51,0.99,0.99); - TPad *pad2= new TPad("pad2"," ",0.01,0.01,0.49,0.49); - TPad *pad3= new TPad("pad3"," ",0.51,0.01,0.99,0.49); - pad1->SetFillColor(18); - pad2->SetFillColor(18); - pad3->SetFillColor(18); - pad1->Draw(); - pad2->Draw(); - pad3->Draw(); - pad1->cd(); - hspotzn->Draw(); - pad2->cd(); - hEzn->Draw(); - pad3->cd(); - hPMCzn->Draw(); - - TCanvas *c2 = new TCanvas("c2","ZN hits",600,10,600,700); - c2->cd(); - TPad *pad4= new TPad("pad4"," ",0.01,0.51,0.49,0.99); - TPad *pad5= new TPad("pad5"," ",0.51,0.51,0.99,0.99); - TPad *pad6= new TPad("pad6"," ",0.01,0.01,0.49,0.49); - TPad *pad7= new TPad("pad7"," ",0.51,0.01,0.99,0.49); - pad4->SetFillColor(18); - pad5->SetFillColor(18); - pad6->SetFillColor(18); - pad7->SetFillColor(18); - pad4->Draw(); - pad5->Draw(); - pad6->Draw(); - pad7->Draw(); - pad4->cd(); - hPMQ1zn->Draw(); - pad5->cd(); - hPMQ2zn->Draw(); - pad6->cd(); - hPMQ3zn->Draw(); - pad7->cd(); - hPMQ4zn->Draw(); - - TCanvas *c3 = new TCanvas("c3","ZN hits",300,10,600,700); - c3->cd(); - hLzn->Draw(); -} - -if(detector == 2){ // ZP histos - TCanvas *c1 = new TCanvas("c1","ZP hits",0,10,580,700); - c1->cd(); - TPad *pad1= new TPad("pad1"," ",0.01,0.51,0.99,0.99); - TPad *pad2= new TPad("pad2"," ",0.01,0.01,0.49,0.49); - TPad *pad3= new TPad("pad3"," ",0.51,0.01,0.99,0.49); - pad1->SetFillColor(18); - pad2->SetFillColor(18); - pad3->SetFillColor(18); - pad1->Draw(); - pad2->Draw(); - pad3->Draw(); - pad1->cd(); - hspotzp->Draw(); - pad2->cd(); - hEzp->Draw(); - pad3->cd(); - hPMCzp->Draw(); - - TCanvas *c2 = new TCanvas("c2","ZP hits",600,10,600,700); - c2->cd(); - TPad *pad4= new TPad("pad4"," ",0.01,0.51,0.49,0.99); - TPad *pad5= new TPad("pad5"," ",0.51,0.51,0.99,0.99); - TPad *pad6= new TPad("pad6"," ",0.01,0.01,0.49,0.49); - TPad *pad7= new TPad("pad7"," ",0.51,0.01,0.99,0.49); - pad4->SetFillColor(18); - pad5->SetFillColor(18); - pad6->SetFillColor(18); - pad7->SetFillColor(18); - pad4->Draw(); - pad5->Draw(); - pad6->Draw(); - pad7->Draw(); - pad4->cd(); - hPMQ1zp->Draw(); - pad5->cd(); - hPMQ2zp->Draw(); - pad6->cd(); - hPMQ3zp->Draw(); - pad7->cd(); - hPMQ4zp->Draw(); - - TCanvas *c3 = new TCanvas("c3","ZP hits",300,10,600,700); - c3->cd(); - hLzp->Draw(); -} - -if(detector == 3){ // ZEM histos - TCanvas *c1 = new TCanvas("c1","ZEM hits",0,10,580,700); - c1->cd(); - TPad *pad1= new TPad("pad1"," ",0.01,0.51,0.99,0.99); - TPad *pad2= new TPad("pad2"," ",0.01,0.01,0.99,0.49); - pad1->SetFillColor(18); - pad2->SetFillColor(18); - pad1->Draw(); - pad2->Draw(); - pad1->cd(); - hspotzem->Draw(); - pad2->cd(); - hEzem->Draw(); - - TCanvas *c2 = new TCanvas("c2","ZEM hits",600,10,600,700); - c2->cd(); - hPMzem->Draw(); -} -// file->Close(); -} -- 2.43.0