/*
$Log$
+Revision 1.7 2000/06/08 18:32:58 cblume
+Make code compliant to coding conventions
+
+Revision 1.6 2000/06/07 16:27:32 cblume
+Try to remove compiler warnings on Sun and HP
+
+Revision 1.5 2000/05/09 16:38:57 cblume
+Removed PadResponse(). Merge problem
+
Revision 1.4 2000/05/08 15:53:45 cblume
Resolved merge conflict
}
+//_____________________________________________________________________________
+AliTRDdigitizer::AliTRDdigitizer(const AliTRDdigitizer &d)
+{
+ //
+ // AliTRDdigitizer copy constructor
+ //
+
+ ((AliTRDdigitizer &) d).Copy(*this);
+
+}
+
//_____________________________________________________________________________
AliTRDdigitizer::~AliTRDdigitizer()
{
+ //
+ // AliTRDdigitizer destructor
+ //
if (fInputFile) {
fInputFile->Close();
}
+//_____________________________________________________________________________
+AliTRDdigitizer &AliTRDdigitizer::operator=(const AliTRDdigitizer &d)
+{
+ //
+ // Assignment operator
+ //
+
+ if (this != &d) ((AliTRDdigitizer &) d).Copy(*this);
+ return *this;
+
+}
+
+//_____________________________________________________________________________
+void AliTRDdigitizer::Copy(TObject &d)
+{
+ //
+ // Copy function
+ //
+
+ ((AliTRDdigitizer &) d).fInputFile = NULL;
+ ((AliTRDdigitizer &) d).fDigits = NULL;
+ ((AliTRDdigitizer &) d).fTRD = NULL;
+ ((AliTRDdigitizer &) d).fGeo = NULL;
+
+ ((AliTRDdigitizer &) d).fEvent = 0;
+
+ ((AliTRDdigitizer &) d).fGasGain = fGasGain;
+ ((AliTRDdigitizer &) d).fNoise = fNoise;
+ ((AliTRDdigitizer &) d).fChipGain = fChipGain;
+ ((AliTRDdigitizer &) d).fADCoutRange = fADCoutRange;
+ ((AliTRDdigitizer &) d).fADCinRange = fADCinRange;
+ ((AliTRDdigitizer &) d).fADCthreshold = fADCthreshold;
+ ((AliTRDdigitizer &) d).fDiffusionOn = fDiffusionOn;
+ ((AliTRDdigitizer &) d).fDiffusionT = fDiffusionT;
+ ((AliTRDdigitizer &) d).fDiffusionL = fDiffusionL;
+ ((AliTRDdigitizer &) d).fElAttachOn = fElAttachOn;
+ ((AliTRDdigitizer &) d).fElAttachProp = fElAttachProp;
+ ((AliTRDdigitizer &) d).fExBOn = fExBOn;
+ ((AliTRDdigitizer &) d).fLorentzAngle = fLorentzAngle;
+ ((AliTRDdigitizer &) d).fLorentzFactor = fLorentzFactor;
+
+ fPRF->Copy(*((AliTRDdigitizer &) d).fPRF);
+
+}
+
//_____________________________________________________________________________
Int_t AliTRDdigitizer::Diffusion(Float_t driftlength, Float_t *xyz)
{
return kFALSE;
}
+ // Get the pointer to the detector class and check for version 1
+ fTRD = (AliTRD*) gAlice->GetDetector("TRD");
+ if (fTRD->IsVersion() != 1) {
+ printf("AliTRDdigitizer::Open -- ");
+ printf("TRD must be version 1 (slow simulator).\n");
+ exit(1);
+ }
+
+ // Get the geometry
+ fGeo = fTRD->GetGeometry();
+ printf("AliTRDdigitizer::Open -- ");
+ printf("Geometry version %d\n",fGeo->IsVersion());
+
return kTRUE;
}
///////////////////////////////////////////////////////////////
// Converts number of electrons to fC
- const Float_t el2fC = 1.602E-19 * 1.0E15;
+ const Float_t kEl2fC = 1.602E-19 * 1.0E15;
///////////////////////////////////////////////////////////////
Int_t totalSizeDict1 = 0;
Int_t totalSizeDict2 = 0;
- AliTRDdataArrayI *Digits;
- AliTRDdataArrayI *Dictionary[kNDict];
+ AliTRDdataArrayI *digits;
+ AliTRDdataArrayI *dictionary[kNDict];
if (!fGeo) {
printf("AliTRDdigitizer::MakeDigits -- ");
fDigits = new AliTRDdigitsManager();
// Create detector arrays to keep the signal and track numbers
- AliTRDdataArrayF *Signal = new AliTRDdataArrayF();
- AliTRDdataArrayI *Tracks[kNDict];
+ AliTRDdataArrayF *signal = new AliTRDdataArrayF();
+ AliTRDdataArrayI *tracks[kNDict];
for (iDict = 0; iDict < kNDict; iDict++) {
- Tracks[iDict] = new AliTRDdataArrayI();
+ tracks[iDict] = new AliTRDdataArrayI();
}
// Get the pointer to the hit tree
- TTree *HitTree = gAlice->TreeH();
+ TTree *hitTree = gAlice->TreeH();
// Get the number of entries in the hit tree
// (Number of primary particles creating a hit somewhere)
- Int_t nTrack = (Int_t) HitTree->GetEntries();
+ Int_t nTrack = (Int_t) hitTree->GetEntries();
printf("AliTRDdigitizer::MakeDigits -- ");
printf("Start creating digits.\n");
Int_t chamBeg = 0;
Int_t chamEnd = kNcham;
- if (fTRD->GetSensChamber() >= 0) {
+ if (fTRD->GetSensChamber() >= 0) {
chamBeg = fTRD->GetSensChamber();
chamEnd = chamBeg + 1;
}
Int_t planBeg = 0;
Int_t planEnd = kNplan;
- if (fTRD->GetSensPlane() >= 0) {
+ if (fTRD->GetSensPlane() >= 0) {
planBeg = fTRD->GetSensPlane();
planEnd = planBeg + 1;
}
Int_t sectBeg = 0;
Int_t sectEnd = kNsect;
- if (fTRD->GetSensSector() >= 0) {
- sectBeg = fTRD->GetSensSector();
- sectEnd = sectBeg + 1;
- }
- Int_t count_hits = 0;
+ Int_t countHits = 0;
// Loop through all the chambers
for (Int_t iCham = chamBeg; iCham < chamEnd; iCham++) {
for (Int_t iPlan = planBeg; iPlan < planEnd; iPlan++) {
for (Int_t iSect = sectBeg; iSect < sectEnd; iSect++) {
+ if (fTRD->GetSensSector() >= 0) {
+ Int_t sens1 = fTRD->GetSensSector();
+ Int_t sens2 = sens1 + fTRD->GetSensSectorRange();
+ sens2 -= ((Int_t) (sens2 / kNsect)) * kNsect;
+ if (sens1 < sens2) {
+ if ((iSect < sens1) || (iSect >= sens2)) continue;
+ }
+ else {
+ if ((iSect < sens1) && (iSect >= sens2)) continue;
+ }
+ }
+
Int_t nDigits = 0;
printf("AliTRDdigitizer::MakeDigits -- ");
Float_t timeBinSize = fGeo->GetTimeBinSize();
// Adjust the size of the detector arrays
- Signal->Allocate(nRowMax,nColMax,nTimeMax);
+ signal->Allocate(nRowMax,nColMax,nTimeMax);
for (iDict = 0; iDict < kNDict; iDict++) {
- Tracks[iDict]->Allocate(nRowMax,nColMax,nTimeMax);
+ tracks[iDict]->Allocate(nRowMax,nColMax,nTimeMax);
}
// Loop through all entries in the tree
for (Int_t iTrack = 0; iTrack < nTrack; iTrack++) {
gAlice->ResetHits();
- nBytes += HitTree->GetEvent(iTrack);
+ nBytes += hitTree->GetEvent(iTrack);
// Get the number of hits in the TRD created by this particle
Int_t nHit = fTRD->Hits()->GetEntriesFast();
// Loop through the TRD hits
for (Int_t iHit = 0; iHit < nHit; iHit++) {
- count_hits++;
+ countHits++;
- AliTRDhit *Hit = (AliTRDhit *) fTRD->Hits()->UncheckedAt(iHit);
+ AliTRDhit *hit = (AliTRDhit *) fTRD->Hits()->UncheckedAt(iHit);
Float_t pos[3];
- pos[0] = Hit->fX;
- pos[1] = Hit->fY;
- pos[2] = Hit->fZ;
- Float_t q = Hit->fQ;
- Int_t track = Hit->fTrack;
- Int_t detector = Hit->fDetector;
+ pos[0] = hit->fX;
+ pos[1] = hit->fY;
+ pos[2] = hit->fZ;
+ Float_t q = hit->GetCharge();
+ Int_t track = hit->fTrack;
+ Int_t detector = hit->GetDetector();
Int_t plane = fGeo->GetPlane(detector);
Int_t sector = fGeo->GetSector(detector);
Int_t chamber = fGeo->GetChamber(detector);
// Array to sum up the signal in a box surrounding the
// hit postition
- const Int_t timeBox = 7;
- const Int_t colBox = 9;
- const Int_t rowBox = 7;
- Float_t signalSum[rowBox][colBox][timeBox];
- for (iRow = 0; iRow < rowBox; iRow++ ) {
- for (iCol = 0; iCol < colBox; iCol++ ) {
- for (iTime = 0; iTime < timeBox; iTime++) {
+ const Int_t kTimeBox = 7;
+ const Int_t kColBox = 9;
+ const Int_t kRowBox = 7;
+ Float_t signalSum[kRowBox][kColBox][kTimeBox];
+ for (iRow = 0; iRow < kRowBox; iRow++ ) {
+ for (iCol = 0; iCol < kColBox; iCol++ ) {
+ for (iTime = 0; iTime < kTimeBox; iTime++) {
signalSum[iRow][iCol][iTime] = 0;
}
}
// Sum up the signal in the different pixels
// and apply the pad response
- Int_t rowIdx = rowD + (Int_t) ( rowBox / 2);
- Int_t colIdx = colD + (Int_t) ( colBox / 2);
- Int_t timeIdx = timeD + (Int_t) (timeBox / 2);
+ Int_t rowIdx = rowD + (Int_t) ( kRowBox / 2);
+ Int_t colIdx = colD + (Int_t) ( kColBox / 2);
+ Int_t timeIdx = timeD + (Int_t) (kTimeBox / 2);
- if (( rowIdx < 0) || ( rowIdx > rowBox)) {
+ if (( rowIdx < 0) || ( rowIdx > kRowBox)) {
printf("AliTRDdigitizer::MakeDigits -- ");
- printf("Boundary error. rowIdx = %d (%d)\n", rowIdx, rowBox);
+ printf("Boundary error. rowIdx = %d (%d)\n", rowIdx, kRowBox);
continue;
}
- if (( colIdx < 0) || ( colIdx > colBox)) {
+ if (( colIdx < 0) || ( colIdx > kColBox)) {
printf("AliTRDdigitizer::MakeDigits -- ");
- printf("Boundary error. colIdx = %d (%d)\n", colIdx, colBox);
+ printf("Boundary error. colIdx = %d (%d)\n", colIdx, kColBox);
continue;
}
- if ((timeIdx < 0) || (timeIdx > timeBox)) {
+ if ((timeIdx < 0) || (timeIdx > kTimeBox)) {
printf("AliTRDdigitizer::MakeDigits -- ");
- printf("Boundary error. timeIdx = %d (%d)\n",timeIdx,timeBox);
+ printf("Boundary error. timeIdx = %d (%d)\n",timeIdx,kTimeBox);
continue;
}
signalSum[rowIdx][colIdx-1][timeIdx] += fPRF->Eval(dist-1.0,0,0) * signal;
}
// Add the padcluster to the detector matrix
- for (iRow = 0; iRow < rowBox; iRow++ ) {
- for (iCol = 0; iCol < colBox; iCol++ ) {
- for (iTime = 0; iTime < timeBox; iTime++) {
+ for (iRow = 0; iRow < kRowBox; iRow++ ) {
+ for (iCol = 0; iCol < kColBox; iCol++ ) {
+ for (iTime = 0; iTime < kTimeBox; iTime++) {
- Int_t rowB = rowH + iRow - (Int_t) ( rowBox / 2);
- Int_t colB = colH + iCol - (Int_t) ( colBox / 2);
- Int_t timeB = timeH + iTime - (Int_t) (timeBox / 2);
+ Int_t rowB = rowH + iRow - (Int_t) ( kRowBox / 2);
+ Int_t colB = colH + iCol - (Int_t) ( kColBox / 2);
+ Int_t timeB = timeH + iTime - (Int_t) (kTimeBox / 2);
Float_t signalB = signalSum[iRow][iCol][iTime];
if (( rowB < 0) || ( rowB >= nRowMax)) continue;
if (( colB < 0) || ( colB >= nColMax)) continue;
if (signalB > 0.0) {
// Add the signal sum
- signalB += Signal->GetData(rowB,colB,timeB);
- Signal->SetData(rowB,colB,timeB,signalB);
+ signalB += signal->GetData(rowB,colB,timeB);
+ signal->SetData(rowB,colB,timeB,signalB);
// Store the track index in the dictionary
// Note: We store index+1 in order to allow the array to be compressed
for (iDict = 0; iDict < kNDict; iDict++) {
- Int_t oldTrack = Tracks[iDict]->GetData(rowB,colB,timeB);
+ Int_t oldTrack = tracks[iDict]->GetData(rowB,colB,timeB);
if (oldTrack == track+1) break;
if (oldTrack == -1) break;
if (oldTrack == 0) {
- Tracks[iDict]->SetData(rowB,colB,timeB,track+1);
+ tracks[iDict]->SetData(rowB,colB,timeB,track+1);
break;
}
}
}
// Add a container for the digits of this detector
- Digits = fDigits->GetDigits(iDet);
+ digits = fDigits->GetDigits(iDet);
// Allocate memory space for the digits buffer
- Digits->Allocate(nRowMax,nColMax,nTimeMax);
+ digits->Allocate(nRowMax,nColMax,nTimeMax);
// Do the same for the dictionary arrays
for (iDict = 0; iDict < kNDict; iDict++) {
- Dictionary[iDict] = fDigits->GetDictionary(iDet,iDict);
- Dictionary[iDict]->Allocate(nRowMax,nColMax,nTimeMax);
+ dictionary[iDict] = fDigits->GetDictionary(iDet,iDict);
+ dictionary[iDict]->Allocate(nRowMax,nColMax,nTimeMax);
}
// Create the digits for this chamber
for (iCol = 0; iCol < nColMax; iCol++ ) {
for (iTime = 0; iTime < nTimeMax; iTime++) {
- Float_t signalAmp = Signal->GetData(iRow,iCol,iTime);
+ Float_t signalAmp = signal->GetData(iRow,iCol,iTime);
// Add the noise
signalAmp = TMath::Max((Float_t) gRandom->Gaus(signalAmp,fNoise)
,(Float_t) 0.0);
// Convert to fC
- signalAmp *= el2fC;
+ signalAmp *= kEl2fC;
// Convert to mV
signalAmp *= fChipGain;
// Convert to ADC counts
nDigits++;
// Store the amplitude of the digit
- Digits->SetData(iRow,iCol,iTime,adc);
+ digits->SetData(iRow,iCol,iTime,adc);
// Store the track index in the dictionary
// Note: We store index+1 in order to allow the array to be compressed
for (iDict = 0; iDict < kNDict; iDict++) {
- Dictionary[iDict]->SetData(iRow,iCol,iTime
- ,Tracks[iDict]->GetData(iRow,iCol,iTime));
+ dictionary[iDict]->SetData(iRow,iCol,iTime
+ ,tracks[iDict]->GetData(iRow,iCol,iTime));
}
}
}
// Compress the arrays
- Digits->Compress(1,0);
+ digits->Compress(1,0);
for (iDict = 0; iDict < kNDict; iDict++) {
- Dictionary[iDict]->Compress(1,0);
+ dictionary[iDict]->Compress(1,0);
}
- totalSizeDigits += Digits->GetSize();
- totalSizeDict0 += Dictionary[0]->GetSize();
- totalSizeDict1 += Dictionary[1]->GetSize();
- totalSizeDict2 += Dictionary[2]->GetSize();
+ totalSizeDigits += digits->GetSize();
+ totalSizeDict0 += dictionary[0]->GetSize();
+ totalSizeDict1 += dictionary[1]->GetSize();
+ totalSizeDict2 += dictionary[2]->GetSize();
printf("AliTRDdigitizer::MakeDigits -- ");
printf("Number of digits found: %d.\n",nDigits);
// Reset the arrays
- Signal->Reset();
+ signal->Reset();
for (iDict = 0; iDict < kNDict; iDict++) {
- Tracks[iDict]->Reset();
+ tracks[iDict]->Reset();
}
}
}
printf("AliTRDdigitizer::MakeDigits -- ");
- printf("Total number of analyzed hits = %d\n",count_hits);
+ printf("Total number of analyzed hits = %d\n",countHits);
printf("AliTRDdigitizer::MakeDigits -- ");
printf("Total digits data size = %d, %d, %d, %d\n",totalSizeDigits