#include "AliLoader.h"
#include "AliConfig.h"
#include "AliMagF.h"
-#include "AliRunDigitizer.h"
+#include "AliDigitizationInput.h"
#include "AliDigitizer.h"
#include "AliHeader.h"
#include "AliCDBManager.h"
return *this;
}
//____________________________________________________________________________
-AliPMDDigitizer::AliPMDDigitizer(AliRunDigitizer* manager):
- AliDigitizer(manager),
+AliPMDDigitizer::AliPMDDigitizer(AliDigitizationInput* digInput):
+ AliDigitizer(digInput),
fRunLoader(0),
fPMDHit(0),
fPMD(0),
const Int_t kPi0 = 111;
const Int_t kGamma = 22;
- Int_t npmd;
- Int_t trackno;
- Int_t smnumber;
- Int_t trackpid;
- Int_t mtrackno;
- Int_t mtrackpid;
-
- Float_t xPos, yPos, zPos;
+ Int_t npmd = 0;
+ Int_t trackno = 0;
+ Int_t smnumber = 0;
+ Int_t trackpid = 0;
+ Int_t mtrackno = 0;
+ Int_t mtrackpid = 0;
+
+ Float_t xPos = 0., yPos = 0., zPos = 0.;
Int_t xpad = -1, ypad = -1;
- Float_t edep;
- Float_t vx = -999.0, vy = -999.0, vz = -999.0;
+ Float_t edep = 0.;
+ // Float_t vx = -999.0, vy = -999.0, vz = -999.0; //coverity (8443) fix satya (1/9/2014)
if (!fSDigits) fSDigits = new TClonesArray("AliPMDsdigit", 1000);
trackpid = mparticle->GetPdgCode();
Int_t ks = mparticle->GetStatusCode();
Int_t imo;
- Int_t tracknoOld=0, trackpidOld=0, statusOld = 0;
+ Int_t tracknoOld=0, trackpidOld=0;
+ // Int_t statusOld = 0; //coverity (8443) fix satya (1/9/2014)
if (mparticle->GetFirstMother() == -1)
{
tracknoOld = trackno;
trackpidOld = trackpid;
- statusOld = -1;
+ //statusOld = -1;
}
- Int_t igstatus = 0;
+ // Int_t igstatus = 0;
- Int_t trnotemp = trackno; // Modified on 25th Nov 2009
+ Int_t trnotemp = trackno;
if(ks==1||(imo = mparticle->GetFirstMother())<0 ){
- vx = mparticle->Vx();
- vy = mparticle->Vy();
- vz = mparticle->Vz();
+ // vx = mparticle->Vx(); //coverity (8443) fix satya (1/9/2014)
+ // vy = mparticle->Vy();
+ // vz = mparticle->Vz();
- if(trackpid==kGamma||trackpid==11||trackpid==-11||
- trackpid==kPi0)igstatus=1;
+ // if(trackpid==kGamma||trackpid==11||trackpid==-11||
+ // trackpid==kPi0)igstatus=1;
}
mparticle = gAlice->GetMCApp()->Particle(imo);
trackpid = mparticle->GetPdgCode();
ks = mparticle->GetStatusCode();
- vx = mparticle->Vx();
- vy = mparticle->Vy();
- vz = mparticle->Vz();
+ // vx = mparticle->Vx();//coverity (8443) fix satya (1/9/2014)
+ // vy = mparticle->Vy();
+ // vz = mparticle->Vz();
- // Modified on 25th Nov 2009
trnotemp = trackno;
if(trackpid == 111)
// end of modification on 25th Nov 2009
}
- if(trackpid==kGamma||trackpid==11||trackpid==-11||
- trackpid==kPi0)igstatus=1;
+ // if(trackpid==kGamma||trackpid==11||trackpid==-11||
+ // trackpid==kPi0)igstatus=1;
mtrackpid=trackpid;
mtrackno=trackno;
trackpid=trackpidOld;
trackno=tracknoOld;
//-----------------end of modification----------------
+ Float_t ptime = fPMDHit->GetTime()*1e6; // time in microsec
+ if (ptime < 0. || ptime > 1.2) continue;
+
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
//
const Int_t kPi0 = 111;
const Int_t kGamma = 22;
- Int_t npmd;
- Int_t trackno;
- Int_t smnumber;
- Int_t trackpid;
- Int_t mtrackno;
- Int_t mtrackpid;
-
- Float_t xPos, yPos, zPos;
+ Int_t npmd = 0;
+ Int_t trackno = 0;
+ Int_t smnumber = 0;
+ Int_t trackpid = 0;
+ Int_t mtrackno = 0;
+ Int_t mtrackpid = 0;
+
+ Float_t xPos = 0., yPos = 0., zPos = 0.;
Int_t xpad = -1, ypad = -1;
- Float_t edep;
- Float_t vx = -999.0, vy = -999.0, vz = -999.0;
+ Float_t edep = 0.;
+ // Float_t vx = -999.0, vy = -999.0, vz = -999.0; //coverity (8443) fix satya (1/9/2014)
if (!fDigits) fDigits = new TClonesArray("AliPMDdigit", 1000);
ResetDigit();
trackpid = mparticle->GetPdgCode();
Int_t ks = mparticle->GetStatusCode();
Int_t imo;
- Int_t tracknoOld=0, trackpidOld=0, statusOld = 0;
+ Int_t tracknoOld=0, trackpidOld=0;
+ //Int_t statusOld = 0; //coverity (8443) fix satya (1/9/2014)
if (mparticle->GetFirstMother() == -1)
{
tracknoOld = trackno;
trackpidOld = trackpid;
- statusOld = -1;
+ // statusOld = -1;
}
- Int_t igstatus = 0;
+ // Int_t igstatus = 0;
- Int_t trnotemp = trackno; // modified on 25th Nov 2009
+ Int_t trnotemp = trackno;
if(ks==1||(imo = mparticle->GetFirstMother())<0 ){
- vx = mparticle->Vx();
- vy = mparticle->Vy();
- vz = mparticle->Vz();
+ // vx = mparticle->Vx(); //coverity (8443) fix satya (1/9/2014)
+ // vy = mparticle->Vy();
+ // vz = mparticle->Vz();
- if(trackpid==kGamma||trackpid==11||trackpid==-11||trackpid==kPi0)
- igstatus=1;
+ // if(trackpid==kGamma||trackpid==11||trackpid==-11||trackpid==kPi0)
+ // igstatus=1;
}
mparticle = gAlice->GetMCApp()->Particle(imo);
trackpid = mparticle->GetPdgCode();
ks = mparticle->GetStatusCode();
- vx = mparticle->Vx();
- vy = mparticle->Vy();
- vz = mparticle->Vz();
+ // vx = mparticle->Vx(); //coverity (8443) fix satya (1/9/2014)
+ // vy = mparticle->Vy();
+ // vz = mparticle->Vz();
- // Modified on 25th Nov 2009
trnotemp = trackno;
if(trackpid == 111)
}
}
- if(trackpid==kGamma||trackpid==11||trackpid==-11||trackpid==kPi0)
- igstatus=1;
+ // if(trackpid==kGamma||trackpid==11||trackpid==-11||trackpid==kPi0)
+ // igstatus=1; //coverity (8443) fix satya (1/9/2014)
mtrackpid=trackpid;
mtrackno=trackno;
trackpid=trackpidOld;
trackno=tracknoOld;
+
+ Float_t ptime = fPMDHit->GetTime()*1e6;
+ if (ptime < 0. || ptime > 1.2) continue;
xPos = fPMDHit->X();
yPos = fPMDHit->Y();
ypad = vol2;
}
- AliDebug(2,Form("ZPosition = %f Edeposition = %d",zPos,edep));
+ AliDebug(2,Form("ZPosition = %f Edeposition = %f",zPos,edep));
if (vol7 < 24)
{
{
fDetNo = 1;
}
- /*
- if (zPos < fZPos)
- {
- // CPV
- fDetNo = 1;
- }
- else if (zPos > fZPos)
- {
- // PMD
- fDetNo = 0;
- }
- */
+
Int_t smn = smnumber;
Int_t ixx = xpad - 1;
Int_t iyy = ypad - 1;
TrackAssignment2Cell();
ResetCell();
- Float_t gain1;
- Float_t adc;
+ Float_t gain1 = 1.;
+ Float_t adc = 0. ;
Float_t deltaE = 0.;
- Int_t detno = 0;
- Int_t trno = 1;
- Int_t trpid = -99;
+ Int_t detno = 0;
+ Int_t trno = 1;
+ Int_t trpid = -99;
for (Int_t idet = 0; idet < 2; idet++)
{
if (!fDigits) fDigits = new TClonesArray("AliPMDdigit", 1000);
treeD->Branch("PMDDigit", &fDigits, bufsize);
- Int_t trno, trpid, det, smn;
- Int_t irow, icol;
- Float_t edep, adc;
+ Int_t trno = 1, trpid = 0, det = 0, smn = 0;
+ Int_t irow = 0, icol = 0;
+ Float_t edep = 0., adc = 0.;
Int_t nmodules = (Int_t) treeS->GetEntries();
AliDebug(1,Form("Number of modules = %d",nmodules));
}
//____________________________________________________________________________
-void AliPMDDigitizer::Exec(Option_t *option)
+void AliPMDDigitizer::Digitize(Option_t *option)
{
// Does the event merging and digitization
const char *cdeb = strstr(option,"deb");
AliDebug(100," *** PMD Exec is called ***");
}
- Int_t ninputs = fManager->GetNinputs();
+ Int_t ninputs = fDigInput->GetNinputs();
AliDebug(1,Form("Number of files to be processed = %d",ninputs));
ResetCellADC();
for (Int_t i = 0; i < ninputs; i++)
{
- Int_t troffset = fManager->GetMask(i);
+ Int_t troffset = fDigInput->GetMask(i);
MergeSDigits(i, troffset);
}
- fRunLoader = AliRunLoader::GetRunLoader(fManager->GetOutputFolderName());
+ fRunLoader = AliRunLoader::GetRunLoader(fDigInput->GetOutputFolderName());
fPMD = (AliPMD*)gAlice->GetDetector("PMD");
fPMDLoader = fRunLoader->GetLoader("PMDLoader");
if (fPMDLoader == 0x0)
if (!fDigits) fDigits = new TClonesArray("AliPMDdigit", 1000);
treeD->Branch("PMDDigit", &fDigits, bufsize);
- Float_t adc;
+ Float_t adc = 0.;
Float_t deltaE = 0.;
Int_t detno = 0;
Int_t trno = 1;
// This method added by Ajay
Bool_t jsort = false;
- Int_t i, j, k;
+ Int_t i = 0, j = 0, k = 0;
Int_t *status1;
Int_t *status2;
Int_t nentries = fCPVCell.GetEntries();
- Int_t mtrackno, ism, ixp, iyp;
- Float_t edep;
+ Int_t mtrackno = 0, ism = 0, ixp = 0, iyp = 0;
+ Float_t edep = 0.;
for (i = 0; i < nentries; i++)
{
AliPMDcell* cpvcell = (AliPMDcell*)fCPVCell.UncheckedAt(i);
fCPVCounter[ism][ixp][iyp]++;
}
- Int_t iz, il;
- Int_t im, ix, iy;
- Int_t nn;
+ Int_t iz = 0, il = 0;
+ Int_t im = 0, ix = 0, iy = 0;
+ Int_t nn = 0;
for (im=0; im<fgkTotUM; im++)
{
for (ix=0; ix<fgkRow; ix++)
// This block handles if a cell is fired
// many times by many tracks
status1 = new Int_t[nn];
- status2 = new Int_t[nn];
+ status2 = new Int_t[2*nn];
trnarray = new Int_t[nn];
for (iz = 0; iz < nn; iz++)
{
void AliPMDDigitizer::MergeSDigits(Int_t filenumber, Int_t troffset)
{
// merging sdigits
- fRunLoader = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(filenumber));
+ fRunLoader = AliRunLoader::GetRunLoader(fDigInput->GetInputFolderName(filenumber));
fPMDLoader = fRunLoader->GetLoader("PMDLoader");
fPMDLoader->LoadSDigits("read");
TTree* treeS = fPMDLoader->TreeS();
if (!fSDigits) fSDigits = new TClonesArray("AliPMDsdigit", 1000);
branch->SetAddress(&fSDigits);
- Int_t itrackno, itrackpid, idet, ism;
- Int_t ixp, iyp;
- Float_t edep;
+ Int_t itrackno = 1, itrackpid = 0, idet = 0, ism = 0;
+ Int_t ixp = 0, iyp = 0;
+ Float_t edep = 0.;
Int_t nmodules = (Int_t) treeS->GetEntries();
AliDebug(1,Form("Number of Modules in the treeS = %d",nmodules));
AliDebug(1,Form("Track Offset = %d",troffset));
//
Bool_t jsort = false;
- Int_t i, j, k;
+ Int_t i = 0, j = 0, k = 0;
Int_t *status1;
Int_t *status2;
fPRECounter[ism][ixp][iyp]++;
}
- Int_t iz, il;
- Int_t im, ix, iy;
- Int_t nn;
+ Int_t iz = 0, il = 0;
+ Int_t im = 0, ix = 0, iy = 0;
+ Int_t nn = 0;
for (im=0; im<fgkTotUM; im++)
{
// This block handles if a cell is fired
// many times by many tracks
status1 = new Int_t[nn];
- status2 = new Int_t[nn];
+ status2 = new Int_t[2*nn];
trnarray = new Int_t[nn];
for (iz = 0; iz < nn; iz++)
{
{
// This converts the simulated edep to ADC according to the
// Test Beam Data
- //PS Test in May 2009, Voltage @ 1350 V
+ // PS Test in June 2010, Voltage @ 1300 V
// KeV - ADC conversion for 12bit ADC
// MPV data used for the fit and taken here
- const Float_t kConstant = -0.1602;
- const Float_t kErConstant = 0.9914;
- const Float_t kSlope = 77.47;
- const Float_t kErSlope = 3.16;
-
- Float_t cons = gRandom->Gaus(kConstant,kErConstant);
- Float_t slop = gRandom->Gaus(kSlope,kErSlope);
+ // constants are from Test Beam 2010
- Float_t adc12bit = slop*mev*0.001 + cons;
+ const Float_t kConstant = 0.612796;
+ const Float_t kSlope = 130.158;
+ Float_t adc12bit = kSlope*mev*0.001 + kConstant;
if (adc12bit < 0.) adc12bit = 0.;
-
- if(adc12bit < 1600.0)
+
+ //Introducing Readout Resolution for ALICE-PMD
+
+ Float_t sigrr = 0.605016 - 0.000273*adc12bit + 6.54e-8*adc12bit*adc12bit;
+ Float_t adcwithrr = gRandom->Gaus(adc12bit,sigrr);
+
+ if(adcwithrr < 0.)
{
- adc = (Float_t) adc12bit;
+ adc = 0.;
}
- else if (adc12bit >= 1600.0)
+ else if(adcwithrr >= 0. && adcwithrr < 1600.0)
+ {
+ adc = adcwithrr;
+ }
+ else if (adcwithrr >= 1600.0)
{
adc = 1600.0;
}
+
}
//____________________________________________________________________________
void AliPMDDigitizer::AddSDigit(Int_t trnumber, Int_t trpid, Int_t det,