/*
$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
+
+Revision 1.3 2000/04/28 14:49:27 cblume
+Only one declaration of iDict in MakeDigits()
+
+Revision 1.1.4.1 2000/05/08 14:42:04 cblume
+Introduced AliTRDdigitsManager
+
Revision 1.1 2000/02/28 19:00:13 cblume
Add new TRD classes
#include "AliTRD.h"
#include "AliTRDdigitizer.h"
-#include "AliTRDmatrix.h"
+#include "AliTRDdataArrayI.h"
+#include "AliTRDdataArrayF.h"
+#include "AliTRDdigitsManager.h"
ClassImp(AliTRDdigitizer)
// AliTRDdigitizer default constructor
//
- fInputFile = NULL;
- fEvent = 0;
+ fInputFile = NULL;
+ fDigits = NULL;
+ fTRD = NULL;
+ fGeo = NULL;
+ fPRF = NULL;
+
+ fEvent = 0;
+ fGasGain = 0.0;
+ fNoise = 0.0;
+ fChipGain = 0.0;
+ fADCoutRange = 0.0;
+ fADCinRange = 0.0;
+ fADCthreshold = 0;
+ fDiffusionOn = 0;
+ fDiffusionT = 0.0;
+ fDiffusionL = 0.0;
+ fElAttachOn = 0;
+ fElAttachProp = 0.0;
+ fExBOn = 0;
+ fLorentzAngle = 0.0;
}
// AliTRDdigitizer default constructor
//
- fInputFile = NULL;
- fEvent = 0;
+ fInputFile = NULL;
+ fDigits = NULL;
+ fTRD = NULL;
+ fGeo = NULL;
- fDigitsArray = new AliTRDsegmentArray(kNsect*kNplan*kNcham);
- for (Int_t iDict = 0; iDict < kNDict; iDict++) {
- fDictionary[iDict] = new AliTRDsegmentArray(kNsect*kNplan*kNcham);
- }
+ fEvent = 0;
Init();
}
+//_____________________________________________________________________________
+AliTRDdigitizer::AliTRDdigitizer(const AliTRDdigitizer &d)
+{
+ //
+ // AliTRDdigitizer copy constructor
+ //
+
+ ((AliTRDdigitizer &) d).Copy(*this);
+
+}
+
//_____________________________________________________________________________
AliTRDdigitizer::~AliTRDdigitizer()
{
+ //
+ // AliTRDdigitizer destructor
+ //
if (fInputFile) {
fInputFile->Close();
delete fInputFile;
}
- if (fDigitsArray) {
- fDigitsArray->Delete();
- delete fDigitsArray;
+ if (fDigits) {
+ delete fDigits;
}
- for (Int_t iDict = 0; iDict < kNDict; iDict++) {
- fDictionary[iDict]->Delete();
- delete fDictionary[iDict];
- }
+ if (fPRF) delete fPRF;
+
+}
+
+//_____________________________________________________________________________
+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);
}
// omega * tau. (tau ~ 12 * 10^-12, B = 0.2T)
fLorentzAngle = 17.6 * 12.0 * 0.2 * 0.01;
+ // The pad response function
+ fPRF = new TF1("PRF","[0]*([1]+exp(-x*x/(2.0*[2])))",-2,2);
+ fPRF->SetParameter(0, 0.8872);
+ fPRF->SetParameter(1,-0.00573);
+ fPRF->SetParameter(2, 0.454 * 0.454);
+
}
//_____________________________________________________________________________
printf("%s is already open.\n",name);
}
- // Get AliRun object from file or create it if not on file
- //if (!gAlice) {
- gAlice = (AliRun*) fInputFile->Get("gAlice");
- if (gAlice) {
- printf("AliTRDdigitizer::Open -- ");
- printf("AliRun object found on file.\n");
- }
- else {
- printf("AliTRDdigitizer::Open -- ");
- printf("Could not find AliRun object.\n");
- return kFALSE;
- }
- //}
+ gAlice = (AliRun*) fInputFile->Get("gAlice");
+ if (gAlice) {
+ printf("AliTRDdigitizer::Open -- ");
+ printf("AliRun object found on file.\n");
+ }
+ else {
+ printf("AliTRDdigitizer::Open -- ");
+ printf("Could not find AliRun object.\n");
+ return kFALSE;
+ }
fEvent = nEvent;
return kFALSE;
}
- return kTRUE;
-
-}
-
-//_____________________________________________________________________________
-Float_t AliTRDdigitizer::PadResponse(Float_t x)
-{
- //
- // The pad response for the chevron pads.
- // We use a simple Gaussian approximation which should be good
- // enough for our purpose.
- //
-
- // The parameters for the response function
- const Float_t aa = 0.8872;
- const Float_t bb = -0.00573;
- const Float_t cc = 0.454;
- const Float_t cc2 = cc*cc;
+ // 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);
+ }
- Float_t pr = aa * (bb + TMath::Exp(-x*x / (2. * cc2)));
+ // Get the geometry
+ fGeo = fTRD->GetGeometry();
+ printf("AliTRDdigitizer::Open -- ");
+ printf("Geometry version %d\n",fGeo->IsVersion());
- return (pr);
+ return kTRUE;
}
// Loops through the TRD-hits and creates the digits.
//
- // Get the pointer to the detector class and check for version 1
- AliTRD *TRD = (AliTRD*) gAlice->GetDetector("TRD");
- if (TRD->IsVersion() != 1) {
- printf("AliTRDdigitizer::MakeDigits -- ");
- printf("TRD must be version 1 (slow simulator).\n");
- return kFALSE;
- }
-
- // Get the geometry
- AliTRDgeometry *Geo = TRD->GetGeometry();
- printf("AliTRDdigitizer::MakeDigits -- ");
- printf("Geometry version %d\n",Geo->IsVersion());
-
- printf("AliTRDdigitizer::MakeDigits -- ");
- printf("Start creating digits.\n");
-
///////////////////////////////////////////////////////////////
// Parameter
///////////////////////////////////////////////////////////////
// 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 iRow, iCol, iTime;
Int_t nBytes = 0;
+ Int_t iDict;
Int_t totalSizeDigits = 0;
Int_t totalSizeDict0 = 0;
Int_t totalSizeDict1 = 0;
Int_t totalSizeDict2 = 0;
- AliTRDhit *Hit;
- AliTRDdataArray *Digits;
- AliTRDdataArray *Dictionary[kNDict];
+ AliTRDdataArrayI *digits;
+ AliTRDdataArrayI *dictionary[kNDict];
+
+ if (!fGeo) {
+ printf("AliTRDdigitizer::MakeDigits -- ");
+ printf("No geometry defined\n");
+ return kFALSE;
+ }
+
+ // Create a digits manager
+ fDigits = new AliTRDdigitsManager();
+
+ // Create detector arrays to keep the signal and track numbers
+ AliTRDdataArrayF *signal = new AliTRDdataArrayF();
+ AliTRDdataArrayI *tracks[kNDict];
+ for (iDict = 0; iDict < kNDict; iDict++) {
+ 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();
+
+ printf("AliTRDdigitizer::MakeDigits -- ");
+ printf("Start creating digits.\n");
// The Lorentz factor
if (fExBOn) {
fLorentzFactor = 1.0;
}
- // 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 chamBeg = 0;
Int_t chamEnd = kNcham;
- if (TRD->GetSensChamber() >= 0) {
- chamBeg = TRD->GetSensChamber();
- chamEnd = chamEnd + 1;
+ if (fTRD->GetSensChamber() >= 0) {
+ chamBeg = fTRD->GetSensChamber();
+ chamEnd = chamBeg + 1;
}
Int_t planBeg = 0;
Int_t planEnd = kNplan;
- if (TRD->GetSensPlane() >= 0) {
- planBeg = TRD->GetSensPlane();
+ if (fTRD->GetSensPlane() >= 0) {
+ planBeg = fTRD->GetSensPlane();
planEnd = planBeg + 1;
}
Int_t sectBeg = 0;
Int_t sectEnd = kNsect;
- if (TRD->GetSensSector() >= 0) {
- sectBeg = TRD->GetSensSector();
- sectEnd = sectBeg + 1;
- }
+
+ 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++) {
- Int_t nDigits = 0;
+ 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 iDet = Geo->GetDetector(iPlan,iCham,iSect);
+ Int_t nDigits = 0;
printf("AliTRDdigitizer::MakeDigits -- ");
printf("Digitizing chamber %d, plane %d, sector %d.\n"
,iCham,iPlan,iSect);
- Int_t nRowMax = Geo->GetRowMax(iPlan,iCham,iSect);
- Int_t nColMax = Geo->GetColMax(iPlan);
- Int_t nTimeMax = Geo->GetTimeMax();
- Float_t row0 = Geo->GetRow0(iPlan,iCham,iSect);
- Float_t col0 = Geo->GetCol0(iPlan);
- Float_t time0 = Geo->GetTime0(iPlan);
- Float_t rowPadSize = Geo->GetRowPadSize();
- Float_t colPadSize = Geo->GetColPadSize();
- Float_t timeBinSize = Geo->GetTimeBinSize();
-
- // Create a detector matrix to keep the signal and track numbers
- AliTRDmatrix *Matrix = new AliTRDmatrix(nRowMax,nColMax,nTimeMax
- ,iSect,iCham,iPlan);
+ Int_t iDet = fGeo->GetDetector(iPlan,iCham,iSect);
+ Int_t nRowMax = fGeo->GetRowMax(iPlan,iCham,iSect);
+ Int_t nColMax = fGeo->GetColMax(iPlan);
+ Int_t nTimeMax = fGeo->GetTimeMax();
+ Float_t row0 = fGeo->GetRow0(iPlan,iCham,iSect);
+ Float_t col0 = fGeo->GetCol0(iPlan);
+ Float_t time0 = fGeo->GetTime0(iPlan);
+ Float_t rowPadSize = fGeo->GetRowPadSize();
+ Float_t colPadSize = fGeo->GetColPadSize();
+ Float_t timeBinSize = fGeo->GetTimeBinSize();
+
+ // Adjust the size of the detector arrays
+ signal->Allocate(nRowMax,nColMax,nTimeMax);
+ for (iDict = 0; iDict < kNDict; iDict++) {
+ 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 = TRD->Hits()->GetEntriesFast();
+ Int_t nHit = fTRD->Hits()->GetEntriesFast();
// Loop through the TRD hits
for (Int_t iHit = 0; iHit < nHit; iHit++) {
- if (!(Hit = (AliTRDhit *) TRD->Hits()->UncheckedAt(iHit)))
- continue;
+ countHits++;
+ 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;
- Int_t plane = Geo->GetPlane(detector);
- Int_t sector = Geo->GetSector(detector);
- Int_t chamber = Geo->GetChamber(detector);
+ 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);
if ((sector != iSect) ||
(plane != iPlan) ||
// Rotate the sectors on top of each other
Float_t rot[3];
- Geo->Rotate(detector,pos,rot);
+ fGeo->Rotate(detector,pos,rot);
// The hit position in pad coordinates (center pad)
// The pad row (z-direction)
// 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] += PadResponse(dist-1.) * signal;
- signalSum[rowIdx][colIdx ][timeIdx] += PadResponse(dist ) * signal;
- signalSum[rowIdx][colIdx+1][timeIdx] += PadResponse(dist+1.) * signal;
+ signalSum[rowIdx][colIdx-1][timeIdx] += fPRF->Eval(dist-1.0,0,0) * signal;
+ signalSum[rowIdx][colIdx ][timeIdx] += fPRF->Eval(dist ,0,0) * signal;
+ 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++) {
-
- 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);
+ 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) ( 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 ((timeB < 0) || (timeB >= nTimeMax)) continue;
if (signalB > 0.0) {
- Matrix->AddSignal(rowB,colB,timeB,signalB);
- if (!(Matrix->AddTrack(rowB,colB,timeB,track))) {
+
+ // Add the signal sum
+ 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);
+ if (oldTrack == track+1) break;
+ if (oldTrack == -1) break;
+ if (oldTrack == 0) {
+ tracks[iDict]->SetData(rowB,colB,timeB,track+1);
+ break;
+ }
+ }
+ if (iDict == kNDict) {
printf("AliTRDdigitizer::MakeDigits -- ");
- printf("More than three tracks in a pixel!\n");
- }
- }
+ printf("More than three tracks for one digit!\n");
+ }
+ }
}
}
}
// Add a container for the digits of this detector
- Digits = (AliTRDdataArray *) fDigitsArray->At(iDet);
+ digits = fDigits->GetDigits(iDet);
// Allocate memory space for the digits buffer
- Digits->Allocate(nRowMax,nColMax,nTimeMax);
+ digits->Allocate(nRowMax,nColMax,nTimeMax);
- for (Int_t iDict = 0; iDict < kNDict; iDict++) {
- Dictionary[iDict] = (AliTRDdataArray *) fDictionary[iDict]->At(iDet);
- Dictionary[iDict]->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);
}
- // Create the hits for this chamber
+ // Create the digits for this chamber
for (iRow = 0; iRow < nRowMax; iRow++ ) {
for (iCol = 0; iCol < nColMax; iCol++ ) {
for (iTime = 0; iTime < nTimeMax; iTime++) {
- Float_t signalAmp = Matrix->GetSignal(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
Int_t adc = (Int_t) (signalAmp * (fADCoutRange / fADCinRange));
- // Store the amplitude of the digit
- Digits->SetData(iRow,iCol,iTime,adc);
+ if (adc > fADCthreshold) {
- // Store the track index in the dictionary
- // Note: We store index+1 in order to allow the array to be compressed
- for (Int_t iDict = 0; iDict < kNDict; iDict++) {
- Dictionary[iDict]->SetData(iRow,iCol,iTime
- ,Matrix->GetTrack(iRow,iCol,iTime,iDict)+1);
- }
+ nDigits++;
+
+ // Store the amplitude of the digit
+ digits->SetData(iRow,iCol,iTime,adc);
- if (adc > fADCthreshold) nDigits++;
+ // 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));
+ }
+
+ }
}
}
}
// Compress the arrays
- Digits->Compress(1,fADCthreshold);
- for (Int_t iDict = 0; iDict < kNDict; iDict++) {
- Dictionary[iDict]->Compress(1,0);
+ digits->Compress(1,0);
+ for (iDict = 0; iDict < kNDict; iDict++) {
+ 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);
-
- // Clean up
- if (Matrix) delete Matrix;
+
+ // Reset the arrays
+ signal->Reset();
+ for (iDict = 0; iDict < kNDict; iDict++) {
+ tracks[iDict]->Reset();
+ }
}
}
}
+ printf("AliTRDdigitizer::MakeDigits -- ");
+ printf("Total number of analyzed hits = %d\n",countHits);
+
printf("AliTRDdigitizer::MakeDigits -- ");
printf("Total digits data size = %d, %d, %d, %d\n",totalSizeDigits
,totalSizeDict0
}
-//_____________________________________________________________________________
-Bool_t AliTRDdigitizer::MakeBranch()
-{
- //
- // Creates the branches for the digits and the dictionary
- //
-
- Int_t buffersize = 64000;
-
- Bool_t status = kTRUE;
-
- if (gAlice->TreeD()) {
-
- // Make the branch for the digits
- if (fDigitsArray) {
- const AliTRDdataArray *Digits =
- (AliTRDdataArray *) fDigitsArray->At(0);
- if (Digits) {
- gAlice->TreeD()->Branch("TRDdigits",Digits->IsA()->GetName()
- ,&Digits,buffersize,1);
- printf("AliTRDdigitizer::MakeBranch -- ");
- printf("Making branch TRDdigits\n");
- }
- else {
- status = kFALSE;
- }
- }
- else {
- status = kFALSE;
- }
-
- // Make the branches for the dictionaries
- for (Int_t iDict = 0; iDict < kNDict; iDict++) {
-
- Char_t branchname[15];
- sprintf(branchname,"TRDdictionary%d",iDict);
- if (fDictionary[iDict]) {
- const AliTRDdataArray *Dictionary =
- (AliTRDdataArray *) fDictionary[iDict]->At(0);
- if (Dictionary) {
- gAlice->TreeD()->Branch(branchname,Dictionary->IsA()->GetName()
- ,&Dictionary,buffersize,1);
- printf("AliTRDdigitizer::MakeBranch -- ");
- printf("Making branch %s\n",branchname);
- }
- else {
- status = kFALSE;
- }
- }
- else {
- status = kFALSE;
- }
- }
-
- }
- else {
- status = kFALSE;
- }
-
- return status;
-
-}
-
//_____________________________________________________________________________
Bool_t AliTRDdigitizer::WriteDigits()
{
// Create the branches
if (!(gAlice->TreeD()->GetBranch("TRDdigits"))) {
- if (!MakeBranch()) return kFALSE;
+ if (!fDigits->MakeBranch()) return kFALSE;
}
- // Store the contents of the segment array in the tree
- if (!fDigitsArray->StoreArray("TRDdigits")) {
- printf("AliTRDdigitizer::WriteDigits -- ");
- printf("Error while storing digits in branch TRDdigits\n");
- return kFALSE;
- }
- for (Int_t iDict = 0; iDict < kNDict; iDict++) {
- Char_t branchname[15];
- sprintf(branchname,"TRDdictionary%d",iDict);
- if (!fDictionary[iDict]->StoreArray(branchname)) {
- printf("AliTRDdigitizer::WriteDigits -- ");
- printf("Error while storing dictionary in branch %s\n",branchname);
- return kFALSE;
- }
- }
+ // Store the digits and the dictionary in the tree
+ fDigits->WriteDigits();
// Write the new tree into the input file (use overwrite option)
Char_t treeName[7];
return kTRUE;
}
-
-ClassImp(AliTRDdigit)
-
-//_____________________________________________________________________________
-AliTRDdigit::AliTRDdigit(Int_t *digits):AliDigitNew()
-{
- //
- // Create a TRD digit
- //
-
- // Store the volume hierarchy
- fDetector = digits[0];
-
- // Store the row, pad, and time bucket number
- fRow = digits[1];
- fCol = digits[2];
- fTime = digits[3];
-
- // Store the signal amplitude
- fAmplitude = digits[4];
-
-}