#include <TFile.h>
#include <TNtuple.h>
#include <TParticle.h>
+#include <TRandom.h>
#include "AliLog.h"
#include "AliRun.h"
fPMDHit(0),
fPMD(0),
fPMDLoader(0),
+ fCalibData(GetCalibData()),
fSDigits(0),
fDigits(0),
fCell(0),
fNsdigit(0),
fNdigit(0),
fDetNo(0),
- fZPos(361.5)// in units of cm, This is the default position of PMD
+ fZPos(361.5) // in units of cm, default position of PMD
{
// Default Constructor
//
{
for (Int_t k = 0; k < fgkCol; k++)
{
- fCPV[i][j][k] = 0.;
- fPRE[i][j][k] = 0.;
- fPRECounter[i][j][k] = 0;
- fPRETrackNo[i][j][k] = -1;
- fCPVTrackNo[i][j][k] = -1;
+ fCPV[i][j][k] = 0.;
+ fPRE[i][j][k] = 0.;
+ fPRECounter[i][j][k] = 0;
+ fPRETrackNo[i][j][k] = -1;
+ fCPVTrackNo[i][j][k] = -1;
}
}
}
- fCalibData = GetCalibData();
+
}
//____________________________________________________________________________
-AliPMDDigitizer::AliPMDDigitizer(AliRunDigitizer* manager)
- :AliDigitizer(manager),
+AliPMDDigitizer::AliPMDDigitizer(const AliPMDDigitizer& digitizer):
+ AliDigitizer(digitizer),
fRunLoader(0),
fPMDHit(0),
fPMD(0),
fPMDLoader(0),
+ fCalibData(GetCalibData()),
+ fSDigits(0),
+ fDigits(0),
+ fCell(0),
+ fNsdigit(0),
+ fNdigit(0),
+ fDetNo(0),
+ fZPos(361.5) // in units of cm, default position of PMD
+{
+ // copy constructor
+ AliError("Copy constructor not allowed ");
+
+}
+//____________________________________________________________________________
+AliPMDDigitizer & AliPMDDigitizer::operator=(const AliPMDDigitizer& /*digitizer*/)
+{
+ // Assignment operator
+ AliError("Assignement operator not allowed ");
+
+ return *this;
+}
+//____________________________________________________________________________
+AliPMDDigitizer::AliPMDDigitizer(AliRunDigitizer* manager):
+ AliDigitizer(manager),
+ fRunLoader(0),
+ fPMDHit(0),
+ fPMD(0),
+ fPMDLoader(0),
+ fCalibData(GetCalibData()),
fSDigits(new TClonesArray("AliPMDsdigit", 1000)),
fDigits(new TClonesArray("AliPMDdigit", 1000)),
fCell(0),
{
// ctor which should be used
- fCalibData = GetCalibData();
for (Int_t i = 0; i < fgkTotUM; i++)
{
{
for (Int_t k = 0; k < fgkCol; k++)
{
- fCPV[i][j][k] = 0.;
- fPRE[i][j][k] = 0.;
- fPRECounter[i][j][k] = 0;
- fPRETrackNo[i][j][k] = -1;
- fCPVTrackNo[i][j][k] = -1;
+ fCPV[i][j][k] = 0.;
+ fPRE[i][j][k] = 0.;
+ fPRECounter[i][j][k] = 0;
+ fPRETrackNo[i][j][k] = -1;
+ fCPVTrackNo[i][j][k] = -1;
}
}
}
}
+
//____________________________________________________________________________
AliPMDDigitizer::~AliPMDDigitizer()
{
TString evfoldname = AliConfig::GetDefaultEventFolderName();
fRunLoader = AliRunLoader::GetRunLoader(evfoldname);
if (!fRunLoader)
- fRunLoader = AliRunLoader::Open(file,AliConfig::GetDefaultEventFolderName(),
- "UPDATE");
+ fRunLoader = AliRunLoader::Open(file,AliConfig::GetDefaultEventFolderName(), "UPDATE");
if (!fRunLoader)
{
AliError(Form("Can not open session for file %s.",file));
}
-
- if (!fRunLoader->GetAliRun()) fRunLoader->LoadgAlice();
- if (!fRunLoader->TreeE()) fRunLoader->LoadHeader();
- if (!fRunLoader->TreeK()) fRunLoader->LoadKinematics();
- gAlice = fRunLoader->GetAliRun();
+ const char *cHS = strstr(option,"HS");
+ const char *cHD = strstr(option,"HD");
+ const char *cSD = strstr(option,"SD");
- if (gAlice)
+ if(cHS || cHD)
{
- AliDebug(1,"Alirun object found");
- }
- else
- {
- AliError("Could not found Alirun object");
- }
+ if (!fRunLoader->GetAliRun()) fRunLoader->LoadgAlice();
+ if (!fRunLoader->TreeE()) fRunLoader->LoadHeader();
+ if (!fRunLoader->TreeK()) fRunLoader->LoadKinematics();
- fPMD = (AliPMD*)gAlice->GetDetector("PMD");
+ gAlice = fRunLoader->GetAliRun();
+
+ if (gAlice)
+ {
+ AliDebug(1,"Alirun object found");
+ }
+ else
+ {
+ AliError("Could not found Alirun object");
+ }
+
+ fPMD = (AliPMD*)gAlice->GetDetector("PMD");
+ }
+
fPMDLoader = fRunLoader->GetLoader("PMDLoader");
if (fPMDLoader == 0x0)
{
AliError("Can not find PMDLoader");
}
- const char *cHS = strstr(option,"HS");
- const char *cHD = strstr(option,"HD");
- const char *cSD = strstr(option,"SD");
if (cHS)
{
treeS = fPMDLoader->TreeS();
}
Int_t bufsize = 16000;
- treeS->Branch("PMDSDigit", &fSDigits, bufsize);
+ treeS->Branch("PMDSDigit", &fSDigits, bufsize);
TClonesArray* hits = 0;
if (fPMD) hits = fPMD->Hits();
// Start loop on tracks in the hits containers
- for (Int_t track=0; track<ntracks;track++)
+ for (Int_t track=0; track<ntracks;track++)
{
gAlice->ResetHits();
treeH->GetEvent(track);
- if (fPMD)
+ if (fPMD)
{
npmd = hits->GetEntriesFast();
- for (int ipmd = 0; ipmd < npmd; ipmd++)
+ for (int ipmd = 0; ipmd < npmd; ipmd++)
{
fPMDHit = (AliPMDhit*) hits->UncheckedAt(ipmd);
trackno = fPMDHit->GetTrack();
edep = fPMDHit->GetEnergy();
Int_t vol1 = fPMDHit->GetVolume(1); // Column
Int_t vol2 = fPMDHit->GetVolume(2); // Row
- Int_t vol3 = fPMDHit->GetVolume(3); // UnitModule
- Int_t vol6 = fPMDHit->GetVolume(6); // SuperModule
+ Int_t vol7 = fPMDHit->GetVolume(7); // UnitModule
+ Int_t vol8 = fPMDHit->GetVolume(8); // SuperModule
+
// -----------------------------------------//
+ // In new geometry after adding electronics //
// For Super Module 1 & 2 //
- // nrow = 96, ncol = 48 //
- // For Super Module 3 & 4 //
// nrow = 48, ncol = 96 //
+ // For Super Module 3 & 4 //
+ // nrow = 96, ncol = 48 //
// -----------------------------------------//
+
+
- smnumber = (vol6-1)*6 + vol3;
+ smnumber = (vol8-1)*6 + vol7;
- if (vol6 == 1 || vol6 == 2)
- {
- xpad = vol1;
- ypad = vol2;
- }
- else if (vol6 == 3 || vol6 == 4)
+ if (vol8 == 1 || vol8 == 2)
{
xpad = vol2;
ypad = vol1;
}
+ else if (vol8 == 3 || vol8 == 4)
+ {
+ xpad = vol1;
+ ypad = vol2;
+ }
AliDebug(2,Form("Zposition = %f Edeposition = %f",zPos,edep));
- Float_t zposition = TMath::Abs(zPos);
- if (zposition < fZPos)
+ //Float_t zposition = TMath::Abs(zPos);
+ if (zPos < fZPos)
{
// CPV
fDetNo = 1;
}
- else if (zposition > fZPos)
+ else if (zPos > fZPos)
{
// PMD
fDetNo = 0;
fPRECounter[smn][ixx][iyy]++;
AliPMDcell* cell = new AliPMDcell(mtrackno,smn,ixx,iyy,edep);
-
fCell.Add(cell);
}
else if(fDetNo == 1)
}
fPMDLoader->WriteSDigits("OVERWRITE");
ResetCellADC();
-
}
//____________________________________________________________________________
if (!fDigits) fDigits = new TClonesArray("AliPMDdigit", 1000);
ResetDigit();
- AliDebug(1,Form("Event Number = %d",ievt));
+ AliDebug(1,Form("Event Number = %d",ievt));
Int_t nparticles = fRunLoader->GetHeader()->GetNtrack();
AliDebug(1,Form("Number of Particles = %d", nparticles));
fRunLoader->GetEvent(ievt);
treeD = fPMDLoader->TreeD();
}
Int_t bufsize = 16000;
- treeD->Branch("PMDDigit", &fDigits, bufsize);
+ treeD->Branch("PMDDigit", &fDigits, bufsize);
TClonesArray* hits = 0;
if (fPMD) hits = fPMD->Hits();
// Start loop on tracks in the hits containers
- for (Int_t track=0; track<ntracks;track++)
+ for (Int_t track=0; track<ntracks;track++)
{
gAlice->ResetHits();
treeH->GetEvent(track);
- if (fPMD)
+ if (fPMD)
{
npmd = hits->GetEntriesFast();
- for (int ipmd = 0; ipmd < npmd; ipmd++)
+ for (int ipmd = 0; ipmd < npmd; ipmd++)
{
fPMDHit = (AliPMDhit*) hits->UncheckedAt(ipmd);
trackno = fPMDHit->GetTrack();
xPos = fPMDHit->X();
yPos = fPMDHit->Y();
zPos = fPMDHit->Z();
-
+ edep = fPMDHit->GetEnergy();
Int_t vol1 = fPMDHit->GetVolume(1); // Column
Int_t vol2 = fPMDHit->GetVolume(2); // Row
- Int_t vol3 = fPMDHit->GetVolume(3); // UnitModule
- Int_t vol6 = fPMDHit->GetVolume(6); // SuperModule
- edep = fPMDHit->GetEnergy();
+ Int_t vol7 = fPMDHit->GetVolume(7); // UnitModule
+ Int_t vol8 = fPMDHit->GetVolume(8); // SuperModule
+
// -----------------------------------------//
+ // In new geometry after adding electronics //
// For Super Module 1 & 2 //
- // nrow = 96, ncol = 48 //
- // For Super Module 3 & 4 //
// nrow = 48, ncol = 96 //
+ // For Super Module 3 & 4 //
+ // nrow = 96, ncol = 48 //
// -----------------------------------------//
- smnumber = (vol6-1)*6 + vol3;
+ smnumber = (vol8-1)*6 + vol7;
- if (vol6 == 1 || vol6 == 2)
- {
- xpad = vol1;
- ypad = vol2;
- }
- else if (vol6 == 3 || vol6 == 4)
+ if (vol8 == 1 || vol8 == 2)
{
xpad = vol2;
ypad = vol1;
}
+ else if (vol8 == 3 || vol8 == 4)
+ {
+ xpad = vol1;
+ ypad = vol2;
+ }
AliDebug(2,Form("ZPosition = %f Edeposition = %d",zPos,edep));
- Float_t zposition = TMath::Abs(zPos);
+ //Float_t zposition = TMath::Abs(zPos);
- if (zposition < fZPos)
+ if (zPos < fZPos)
{
// CPV
fDetNo = 1;
}
- else if (zposition > fZPos)
+ else if (zPos > fZPos)
{
// PMD
fDetNo = 0;
TrackAssignment2Cell();
ResetCell();
- Float_t gain1,gain2;
+ Float_t gain1;
Float_t adc;
Float_t deltaE = 0.;
Int_t detno = 0;
Int_t trno = 1;
for (Int_t idet = 0; idet < 2; idet++)
- {
+ {
for (Int_t ism = 0; ism < fgkTotUM; ism++)
- {
+ {
for (Int_t jrow = 0; jrow < fgkRow; jrow++)
- {
+ {
for (Int_t kcol = 0; kcol < fgkCol; kcol++)
- {
+ {
if (idet == 0)
- {
- gain1 =Gain(idet,ism,jrow,kcol);
- // cout<<"The gain Factor is"<<gain1<<endl;
- deltaE = fPRE[ism][jrow][kcol]*gain1;
+ {
+ deltaE = fPRE[ism][jrow][kcol];
trno = fPRETrackNo[ism][jrow][kcol];
detno = 0;
- }
+ }
else if (idet == 1)
- {
- gain2 =Gain(idet,ism,jrow,kcol);
- // cout<<"The Gain factor is"<<gain2<<endl;
- deltaE = fCPV[ism][jrow][kcol]*gain2;
+ {
+ deltaE = fCPV[ism][jrow][kcol];
trno = fCPVTrackNo[ism][jrow][kcol];
detno = 1;
- }
+ }
if (deltaE > 0.)
- {
+ {
MeV2ADC(deltaE,adc);
+
+ // To decalibrate the adc values
+ //
+ gain1 = Gain(idet,ism,jrow,kcol);
+ if (gain1 != 0.)
+ {
+ Int_t adcDecalib = (Int_t)(adc/gain1);
+ adc = (Float_t) adcDecalib;
+ }
+ else if(gain1 == 0.)
+ {
+ adc = 0.;
+ }
AddDigit(trno,detno,ism,jrow,kcol,adc);
- }
- } // column loop
- } // row loop
+ }
+ } // column loop
+ } // row loop
treeD->Fill();
ResetDigit();
- } // supermodule loop
- } // detector loop
+ } // supermodule loop
+ } // detector loop
fPMDLoader->WriteDigits("OVERWRITE");
ResetCellADC();
-
+
}
//____________________________________________________________________________
}
Int_t bufsize = 16000;
if (!fDigits) fDigits = new TClonesArray("AliPMDdigit", 1000);
- treeD->Branch("PMDDigit", &fDigits, bufsize);
+ treeD->Branch("PMDDigit", &fDigits, bufsize);
Int_t trno, det, smn;
Int_t irow, icol;
for (Int_t imodule = 0; imodule < nmodules; imodule++)
{
- treeS->GetEntry(imodule);
+ treeS->GetEntry(imodule);
Int_t nentries = fSDigits->GetLast();
AliDebug(2,Form("Number of entries per module = %d",nentries+1));
for (Int_t ient = 0; ient < nentries+1; ient++)
edep = pmdsdigit->GetCellEdep();
MeV2ADC(edep,adc);
- AddDigit(trno,det,smn,irow,icol,adc);
+
+ // To decalibrte the adc values
+ //
+ Float_t gain1 = Gain(det,smn,irow,icol);
+ if (gain1 != 0.)
+ {
+ Int_t adcDecalib = (Int_t)(adc/gain1);
+ adc = (Float_t) adcDecalib;
+ }
+ else if(gain1 == 0.)
+ {
+ adc = 0.;
+ }
+
+ AddDigit(trno,det,smn,irow,icol,adc);
}
treeD->Fill();
ResetDigit();
}
Int_t bufsize = 16000;
if (!fDigits) fDigits = new TClonesArray("AliPMDdigit", 1000);
- treeD->Branch("PMDDigit", &fDigits, bufsize);
+ treeD->Branch("PMDDigit", &fDigits, bufsize);
Float_t adc;
Float_t deltaE = 0.;
if (deltaE > 0.)
{
MeV2ADC(deltaE,adc);
+ //
+ // To decalibrte the adc values
+ //
+ Float_t gain1 = Gain(idet,ism,jrow,kcol);
+ if (gain1 != 0.)
+ {
+ Int_t adcDecalib = (Int_t)(adc/gain1);
+ adc = (Float_t) adcDecalib;
+ }
+ else if(gain1 == 0.)
+ {
+ adc = 0.;
+ }
+
AddDigit(trno,detno,ism,jrow,kcol,adc);
}
} // column loop
ResetDigit();
} // supermodule loop
} // detector loop
- fPMDLoader->WriteDigits("OVERWRITE");
+ fPMDLoader->WriteDigits("OVERWRITE");
fPMDLoader->UnloadDigits();
ResetCellADC();
}
AliDebug(1,Form("Track Offset = %d",troffset));
for (Int_t imodule = 0; imodule < nmodules; imodule++)
{
- treeS->GetEntry(imodule);
+ treeS->GetEntry(imodule);
Int_t nentries = fSDigits->GetLast();
AliDebug(2,Form("Number of Entries per Module = %d",nentries));
for (Int_t ient = 0; ient < nentries+1; ient++)
nn = 1;
pmdTrack[i][j][k] = new Int_t[nn];
pmdEdep[i][j][k] = new Float_t[nn];
- }
+ }
fPRECounter[i][j][k] = 0;
}
}
{
trnarray[trCount] = track;
trCount++;
- }
+ }
trackOld = track;
}
delete [] status1;
}
//____________________________________________________________________________
-void AliPMDDigitizer::AddSDigit(Int_t trnumber, Int_t det, Int_t smnumber,
- Int_t irow, Int_t icol, Float_t adc)
+void AliPMDDigitizer::AddSDigit(Int_t trnumber, Int_t det, Int_t smnumber,
+ Int_t irow, Int_t icol, Float_t adc)
{
// Add SDigit
//
}
//____________________________________________________________________________
-void AliPMDDigitizer::AddDigit(Int_t trnumber, Int_t det, Int_t smnumber,
- Int_t irow, Int_t icol, Float_t adc)
+void AliPMDDigitizer::AddDigit(Int_t trnumber, Int_t det, Int_t smnumber,
+ Int_t irow, Int_t icol, Float_t adc)
{
// Add Digit
//
{
for (Int_t k = 0; k < fgkCol; k++)
{
- fPRECounter[i][j][k] = 0;
+ fPRECounter[i][j][k] = 0;
}
}
}
{
for (Int_t k = 0; k < fgkCol; k++)
{
- fCPV[i][j][k] = 0.;
- fPRE[i][j][k] = 0.;
+ fCPV[i][j][k] = 0.;
+ fPRE[i][j][k] = 0.;
fPRETrackNo[i][j][k] = 0;
fCPVTrackNo[i][j][k] = 0;
}
}
}
}
-//------------------------------------------------------
//____________________________________________________________________________
void AliPMDDigitizer::UnLoad(Option_t *option)
if(!fCalibData) {
AliError("No calibration data loaded from CDB!!!");
- return -1;
+ return 1;
}
Float_t GainFact;
GainFact = fCalibData->GetGainFact(det,smn,row,col);
- printf("\t gain=%10.3f\n",GainFact);
return GainFact;
}
//----------------------------------------------------------------------
// The run number will be centralized in AliCDBManager,
// you don't need to set it here!
// Added this method by ZA
+ // Cleaned up by Alberto
AliCDBEntry *entry = AliCDBManager::Instance()->Get("PMD/Calib/Data");
- if(!entry){
- AliWarning("Calibration object retrieval failed! Dummy calibration will be used.");
-
- // this just remembers the actual default storage. No problem if it is null.
- AliCDBStorage *origStorage = AliCDBManager::Instance()->GetDefaultStorage();
- AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-
- entry = AliCDBManager::Instance()->Get("PMD/Calib/Data");
-
- // now reset the original default storage to AliCDBManager...
- AliCDBManager::Instance()->SetDefaultStorage(origStorage);
- }
+ if(!entry) AliFatal("Calibration object retrieval failed!");
AliPMDCalibData *calibdata=0;
if (entry) calibdata = (AliPMDCalibData*) entry->GetObject();
- if (!calibdata) AliError("No calibration data from calibration database !");
+ if (!calibdata) AliFatal("No calibration data from calibration database !");
return calibdata;
}