/*
$Log$
+Revision 1.24 2001/01/26 19:56:49 hristov
+Major upgrade of AliRoot code
+
Revision 1.23 2000/11/01 14:53:20 cblume
Merge with TRD-develop
#include "AliTRDgeometryFull.h"
#include "AliTRDrecPoint.h"
#include "AliTRDdigitsManager.h"
+#include "AliTRDdataArrayI.h"
+#include "AliTRDsegmentArray.h"
ClassImp(AliTRD)
// Default constructor
//
- fIshunt = 0;
- fGasMix = 0;
- fHits = 0;
- fDigits = 0;
+ fIshunt = 0;
+ fGasMix = 0;
+ fHits = 0;
+ fDigits = 0;
- fRecPoints = 0;
- fNRecPoints = 0;
+ fRecPoints = 0;
+ fNRecPoints = 0;
- fGeometry = 0;
+ fGeometry = 0;
- fGasDensity = 0;
- fFoilDensity = 0;
+ fGasDensity = 0;
+ fFoilDensity = 0;
- fDrawTR = 0;
- fDisplayType = 0;
+ fDrawTR = 0;
+ fDisplayType = 0;
+
+ fDigitsArray = 0;
+ for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
+ fDictionaryArray[iDict] = 0;
+ }
}
fDigits = 0;
// Allocate the rec point array
- fRecPoints = new TObjArray(400);
- fNRecPoints = 0;
+ fRecPoints = new TObjArray(400);
+ fNRecPoints = 0;
- fIshunt = 0;
- fGasMix = 0;
+ fIshunt = 0;
+ fGasMix = 1;
- fGasDensity = 0;
- fFoilDensity = 0;
+ fGasDensity = 0;
+ fFoilDensity = 0;
- fDrawTR = 0;
- fDisplayType = 0;
+ fDrawTR = 0;
+ fDisplayType = 0;
+
+ fDigitsArray = 0;
+ for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
+ fDictionaryArray[iDict] = 0;
+ }
SetMarkerColor(kWhite);
delete fGeometry;
delete fHits;
delete fRecPoints;
+ if (fDigitsArray) delete fDigitsArray;
+ for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
+ if (fDictionaryArray[iDict]) delete fDictionaryArray[iDict];
+ }
}
fRecPoints->Add(recPoint);
}
-//___________________________________________
-void AliTRD::SDigits2Digits()
+
+//_____________________________________________________________________________
+void AliTRD::Hits2Digits()
{
//
// Create digits
//
- AliTRDdigitizer *Digitizer = new AliTRDdigitizer("digitizer","TRD digitizer class");
+
+ AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
+ ,"TRD digitizer class");
// Set the parameter
- Digitizer->SetDiffusion();
- Digitizer->SetVerbose(1);
+ digitizer->SetDiffusion();
+ digitizer->SetExB();
+
+ // Initialization
+ //digitizer->InitDetector();
+
+ // Create the digits
+ digitizer->MakeDigits();
- //Digitizer->SetExB();
- //Digitizer->SetElAttach();
- //Digitizer->SetAttachProb();
+ // Write the digits into the input file
+ if (digitizer->Digits()->MakeBranch(fDigitsFile)) {
+
+ digitizer->WriteDigits();
+
+ // Save the digitizer class in the AliROOT
+ digitizer->Write();
+
+ }
+
+}
+
+//_____________________________________________________________________________
+void AliTRD::Hits2SDigits()
+{
+ //
+ // Create summable digits
+ //
+
+ AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
+ ,"TRD digitizer class");
+
+ // For the summable digits
+ digitizer->SetSDigits(kTRUE);
- Digitizer->InitDetector();
+ // Set the parameter
+ digitizer->SetDiffusion();
+ digitizer->SetExB();
+
+ // Initialization
+ //digitizer->InitDetector();
// Create the digits
- Digitizer->MakeDigits();
- cout<<"After MakeDigits"<<endl;
+ digitizer->MakeDigits();
// Write the digits into the input file
- if (Digitizer->Digits()->MakeBranch(fDigitsFile))
- {
- Digitizer->WriteDigits();
- cout<<"After write digits"<<endl;
+ if (digitizer->Digits()->MakeBranch(fDigitsFile)) {
+
+ digitizer->WriteDigits();
// Save the digitizer class in the AliROOT
- Digitizer->Write();
- cout<<"After write digitizer"<<endl;
+ digitizer->Write();
+
}
+
+}
+
+//_____________________________________________________________________________
+void AliTRD::SDigits2Digits()
+{
+ //
+ // Create final digits from summable digits
+ //
+
}
//_____________________________________________________________________________
AliDetector::MakeBranch(option,file);
+ Int_t buffersize = 64000;
+
+ fDigitsArray = new AliTRDdataArrayI();
+ gAlice->MakeBranchInTree(gAlice->TreeD()
+ ,"TRDdigits", fDigitsArray->IsA()->GetName()
+ ,&fDigitsArray,buffersize,1,file);
+
+ for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
+ Char_t branchname[15];
+ sprintf(branchname,"TRDdictionary%d",iDict);
+ fDictionaryArray[iDict] = new AliTRDdataArrayI();
+ gAlice->MakeBranchInTree(gAlice->TreeD()
+ ,branchname,fDictionaryArray[iDict]->IsA()->GetName()
+ ,&fDictionaryArray[iDict],buffersize,1,file) ;
+ }
+
//Char_t *r = strstr(option,"R");
//sprintf(branchname,"%srecPoints",GetName());
//if (fRecPoints && gAlice->TreeR() && r) {
}
+//_____________________________________________________________________________
+void AliTRD::ResetDigits()
+{
+ //
+ // Resets the digits
+ //
+
+ if (gAlice->TreeD()) {
+ TBranch *branch;
+ branch = gAlice->TreeD()->GetBranch("TRDdigits");
+ if (branch) {
+ branch->Reset();
+ for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
+ Char_t branchname[15];
+ sprintf(branchname,"TRDdictionary%d",iDict);
+ branch = gAlice->TreeD()->GetBranch(branchname);
+ branch->Reset();
+ }
+ }
+ }
+
+}
+
//_____________________________________________________________________________
void AliTRD::ResetRecPoints()
{
if ((imix < 0) || (imix > 1)) {
printf("Wrong input value: %d\n",imix);
printf("Use standard setting\n");
- fGasMix = 0;
+ fGasMix = 1;
return;
}
/*
$Log$
+Revision 1.20 2001/02/25 20:19:00 hristov
+Minor correction: loop variable declared only once for HP, Sun
+
Revision 1.19 2001/02/14 18:22:26 cblume
Change in the geometry of the padplane
// AliTRDdigitizer default constructor
//
- fInputFile = NULL;
- fDigits = NULL;
- fTRD = NULL;
- fGeo = NULL;
- fPRF = NULL;
- fPRFsmp = NULL;
- fTRF = NULL;
- fTRFint = 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;
- fOmegaTau = 0.0;
- fPRFOn = 0;
- fTRFOn = 0;
- fDriftVelocity = 0.0;
-
- fPRFbin = 0;
- fPRFlo = 0.0;
- fPRFhi = 0.0;
- fPRFwid = 0.0;
- fPRFpad = 0;
- fTRFbin = 0;
- fTRFlo = 0.0;
- fTRFhi = 0.0;
- fTRFwid = 0.0;
-
- fCompress = kTRUE;
- fVerbose = 1;
+ fInputFile = NULL;
+ fDigits = NULL;
+ fTRD = NULL;
+ fGeo = NULL;
+ fPRF = NULL;
+ fPRFsmp = NULL;
+ fTRF = NULL;
+ fTRFint = NULL;
+
+ fEvent = 0;
+ fGasGain = 0.0;
+ fNoise = 0.0;
+ fChipGain = 0.0;
+ fSinRange = 0.0;
+ fSoutRange = 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;
+ fOmegaTau = 0.0;
+ fPRFOn = 0;
+ fTRFOn = 0;
+ fDriftVelocity = 0.0;
+ fPadCoupling = 0.0;
+ fTimeCoupling = 0.0;
+ fTimeBinWidth = 0.0;
+
+ fPRFbin = 0;
+ fPRFlo = 0.0;
+ fPRFhi = 0.0;
+ fPRFwid = 0.0;
+ fPRFpad = 0;
+ fTRFbin = 0;
+ fTRFlo = 0.0;
+ fTRFhi = 0.0;
+ fTRFwid = 0.0;
+
+ fCompress = kTRUE;
+ fVerbose = 1;
+ fSDigits = kFALSE;
}
fCompress = kTRUE;
fVerbose = 1;
+ fSDigits = kFALSE;
Init();
Int_t iBin;
- ((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).fOmegaTau = fOmegaTau;
- ((AliTRDdigitizer &) d).fLorentzFactor = fLorentzFactor;
- ((AliTRDdigitizer &) d).fPRFOn = fPRFOn;
- ((AliTRDdigitizer &) d).fTRFOn = fTRFOn;
-
- ((AliTRDdigitizer &) d).fCompress = fCompress;
- ((AliTRDdigitizer &) d).fVerbose = fVerbose;
+ ((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).fSoutRange = fSoutRange;
+ ((AliTRDdigitizer &) d).fSinRange = fSinRange;
+ ((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).fOmegaTau = fOmegaTau;
+ ((AliTRDdigitizer &) d).fLorentzFactor = fLorentzFactor;
+ ((AliTRDdigitizer &) d).fDriftVelocity = fDriftVelocity;
+ ((AliTRDdigitizer &) d).fPadCoupling = fPadCoupling;
+ ((AliTRDdigitizer &) d).fTimeCoupling = fTimeCoupling;
+ ((AliTRDdigitizer &) d).fTimeBinWidth = fTimeBinWidth;
+ ((AliTRDdigitizer &) d).fPRFOn = fPRFOn;
+ ((AliTRDdigitizer &) d).fTRFOn = fTRFOn;
+
+ ((AliTRDdigitizer &) d).fCompress = fCompress;
+ ((AliTRDdigitizer &) d).fVerbose = fVerbose;
+ ((AliTRDdigitizer &) d).fSDigits = fSDigits;
fPRF->Copy(*((AliTRDdigitizer &) d).fPRF);
fTRF->Copy(*((AliTRDdigitizer &) d).fTRF);
- ((AliTRDdigitizer &) d).fPRFbin = fPRFbin;
- ((AliTRDdigitizer &) d).fPRFlo = fPRFlo;
- ((AliTRDdigitizer &) d).fPRFhi = fPRFhi;
- ((AliTRDdigitizer &) d).fPRFwid = fPRFwid;
- ((AliTRDdigitizer &) d).fPRFpad = fPRFpad;
+ ((AliTRDdigitizer &) d).fPRFbin = fPRFbin;
+ ((AliTRDdigitizer &) d).fPRFlo = fPRFlo;
+ ((AliTRDdigitizer &) d).fPRFhi = fPRFhi;
+ ((AliTRDdigitizer &) d).fPRFwid = fPRFwid;
+ ((AliTRDdigitizer &) d).fPRFpad = fPRFpad;
if (((AliTRDdigitizer &) d).fPRFsmp) delete ((AliTRDdigitizer &) d).fPRFsmp;
((AliTRDdigitizer &) d).fPRFsmp = new Float_t[fPRFbin];
for (iBin = 0; iBin < fPRFbin; iBin++) {
((AliTRDdigitizer &) d).fPRFsmp[iBin] = fPRFsmp[iBin];
}
- ((AliTRDdigitizer &) d).fTRFbin = fTRFbin;
- ((AliTRDdigitizer &) d).fTRFlo = fTRFlo;
- ((AliTRDdigitizer &) d).fTRFhi = fTRFhi;
- ((AliTRDdigitizer &) d).fTRFwid = fTRFwid;
+ ((AliTRDdigitizer &) d).fTRFbin = fTRFbin;
+ ((AliTRDdigitizer &) d).fTRFlo = fTRFlo;
+ ((AliTRDdigitizer &) d).fTRFhi = fTRFhi;
+ ((AliTRDdigitizer &) d).fTRFwid = fTRFwid;
if (((AliTRDdigitizer &) d).fTRFint) delete ((AliTRDdigitizer &) d).fTRFint;
((AliTRDdigitizer &) d).fTRFint = new Float_t[fTRFbin];
for (iBin = 0; iBin < fTRFbin; iBin++) {
((AliTRDdigitizer &) d).fTRFint[iBin] = fTRFint[iBin];
- }
-
+ }
+
}
//_____________________________________________________________________________
// Initializes the digitization procedure with standard values
//
+ // Get the detector geometry
+ InitDetector();
+
// The default parameter for the digitization
- fGasGain = 8.0E3;
- fNoise = 3000.;
- fChipGain = 10.;
- fADCoutRange = 255.;
- fADCinRange = 2000.;
- fADCthreshold = 1;
+ fGasGain = 2.0E3;
+ fChipGain = 20.;
+ fNoise = 1000.;
+ fADCoutRange = 1023.; // 10-bit ADC
+ fADCinRange = 2000.; // 2V input range
+ fADCthreshold = 1;
+
+ // For the summable digits
+ fSinRange = 1000000.;
+ fSoutRange = 1000000.;
// Transverse and longitudinal diffusion coefficients (Xe/Isobutane)
- fDiffusionOn = 1;
- fDiffusionT = 0.060;
- fDiffusionL = 0.017;
+ fDiffusionOn = 1;
+ fDiffusionT = 0.060;
+ fDiffusionL = 0.017;
// Propability for electron attachment
- fElAttachOn = 0;
- fElAttachProp = 0.0;
+ fElAttachOn = 0;
+ fElAttachProp = 0.0;
// E x B effects
- fExBOn = 0;
- // omega * tau. (tau ~ 12 * 10^-12, B = 0.2T)
- fOmegaTau = 17.6 * 12.0 * 0.2 * 0.01;
+ fExBOn = 0;
+ // omega * tau.= arctan(Lorentz-angle)
+ fOmegaTau = 0.19438031;
// The pad response function
- fPRFOn = 1;
- fPRFlo = -3.0;
- fPRFhi = 3.0;
- fPRFbin = 1200;
- fPRFwid = (fPRFhi - fPRFlo) / ((Float_t) fPRFbin);
- fPRFpad = ((Int_t) (1.0 / fPRFwid));
- fPRF = new TF1("PRF","[0]*([1]+exp(-x*x/(2.0*[2])))",fPRFlo,fPRFhi);
+ fPRFOn = 1;
+ fPRFlo = -3.0;
+ fPRFhi = 3.0;
+ fPRFbin = 120;
+ fPRFwid = (fPRFhi - fPRFlo) / ((Float_t) fPRFbin);
+ fPRFpad = ((Int_t) (1.0 / fPRFwid));
+ fPRF = new TF1("PRF","[0]*([1]+exp(-x*x/(2.0*[2])))",fPRFlo,fPRFhi);
fPRF->SetParameter(0, 0.8872);
fPRF->SetParameter(1,-0.00573);
fPRF->SetParameter(2, 0.454 * 0.454);
// The drift velocity (cm / mus)
- fDriftVelocity = 1.0;
-
- // The time response function
- fTRFOn = 1;
- Float_t loTRF = -200.0;
- Float_t hiTRF = 1000.0;
- fTRF = new TF1("TRF",TRFlandau,loTRF,hiTRF,3);
- fTRF->SetParameter(0, 1.0 / 24.24249);
+ fDriftVelocity = 2.0;
+
+ // The pad coupling factor (same number as for the TPC)
+ fPadCoupling = 0.5;
+
+ // The time coupling factor (same number as for the TPC)
+ fTimeCoupling = 0.4;
+
+ ReInit();
+
+}
+
+//_____________________________________________________________________________
+void AliTRDdigitizer::ReInit()
+{
+ //
+ // Re-initializes the digitization procedure after a change in the parameter
+ //
+
+ // Calculate the time bin width in ns
+ fTimeBinWidth = fGeo->GetTimeBinSize() / fDriftVelocity * 1000.0;
+
+ // The time response function (in ns)
+ // The FWHM of the TRF is automatically set equal to the time bin width
+ fTRFOn = 1;
+ Float_t loTRF = -2.0 * fTimeBinWidth;
+ Float_t hiTRF = 10.0 * fTimeBinWidth;
+ fTRF = new TF1("TRF",TRFlandau,loTRF,hiTRF,3);
+ //fTRF->SetParameter(0, 1.0 / 24.24249);
+ fTRF->SetParameter(0, 5.56);
fTRF->SetParameter(1, 0.0);
- fTRF->SetParameter(2, 25.0);
- fTRFbin = 1200;
- fTRFlo = loTRF * fDriftVelocity / 1000.0;
- fTRFhi = hiTRF * fDriftVelocity / 1000.0;
- fTRFwid = (fTRFhi - fTRFlo) / ((Float_t) fTRFbin);
+ fTRF->SetParameter(2, 0.25 * fTimeBinWidth);
+ fTRFbin = 120;
+ fTRFlo = loTRF * fDriftVelocity / 1000.0;
+ fTRFhi = hiTRF * fDriftVelocity / 1000.0;
+ fTRFwid = (fTRFhi - fTRFlo) / ((Float_t) fTRFbin);
+
+ // The Lorentz factor
+ if (fExBOn) {
+ fLorentzFactor = 1.0 / (1.0 + fOmegaTau*fOmegaTau);
+ }
+ else {
+ fLorentzFactor = 1.0;
+ }
}
//_____________________________________________________________________________
-void AliTRDdigitizer::IntegrateTRF()
+void AliTRDdigitizer::SampleTRF()
{
//
- // Integrates the time response function over the time bin size
+ // Samples the time response function
//
if (fTRFint) delete fTRFint;
fTRFint = new Float_t[fTRFbin];
- Float_t hiTRF = fTRFhi / fDriftVelocity * 1000.0;
- Float_t loTRF = fTRFlo / fDriftVelocity * 1000.0;
- Float_t timeBin = fGeo->GetTimeBinSize() / fDriftVelocity * 1000.0;
+ Float_t loTRF = fTRFlo / fDriftVelocity * 1000.0;
+ Float_t hiTRF = fTRFhi / fDriftVelocity * 1000.0;
Float_t binWidth = (hiTRF - loTRF) / ((Float_t) fTRFbin);
for (Int_t iBin = 0; iBin < fTRFbin; iBin++) {
- Float_t bin = iBin * binWidth + loTRF - 0.5 * timeBin;
- fTRFint[iBin] = fTRF->Integral(bin,bin + timeBin);
+ Float_t bin = (((Float_t) iBin) + 0.5) * binWidth + loTRF;
+ fTRFint[iBin] = fTRF->Eval(bin);
}
}
// 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("AliTRDdigitizer::InitDetector -- ");
printf("TRD must be version 1 (slow simulator).\n");
exit(1);
}
// Get the geometry
fGeo = fTRD->GetGeometry();
- printf("AliTRDdigitizer::Open -- ");
+ printf("AliTRDdigitizer::InitDetector -- ");
printf("Geometry version %d\n",fGeo->IsVersion());
return kTRUE;
}
+//_____________________________________________________________________________
+Bool_t AliTRDdigitizer::SumSDigits()
+{
+ //
+ // Sums up the summable digits and creates final digits
+ // Not yet implemented
+ //
+
+ return kFALSE;
+
+}
+
//_____________________________________________________________________________
Bool_t AliTRDdigitizer::MakeDigits()
{
//
- // Loops through the TRD-hits and creates the digits.
+ // Creates summable digits.
//
///////////////////////////////////////////////////////////////
printf("Start creating digits.\n");
if (fVerbose > 0) this->Dump();
- // The Lorentz factor
- if (fExBOn) {
- fLorentzFactor = 1.0 / (1.0 + fOmegaTau*fOmegaTau);
- }
- else {
- fLorentzFactor = 1.0;
- }
-
// Create the sampled PRF
SamplePRF();
- // Create the integrated TRF
- IntegrateTRF();
+ // Create the sampled TRF
+ SampleTRF();
// Get the pointer to the hit tree
TTree *HitTree = gAlice->TreeH();
// The electron position
// The pad row (z-direction)
Int_t rowE = (Int_t) ((xyz[2] - row0) / rowPadSize);
+ if (( rowE < 0) || ( rowE >= nRowMax)) continue;
// The pad column (rphi-direction)
Int_t colE = (Int_t) ((xyz[1] - col0) / colPadSize);
+ if (( colE < 0) || ( colE >= nColMax)) continue;
// The time bucket
Int_t timeE = (Int_t) ((time0 - xyz[0]) / timeBinSize);
-
- if (( rowE < 0) || ( rowE >= nRowMax)) continue;
- if (( colE < 0) || ( colE >= nColMax)) continue;
if ((timeE < 0) || (timeE >= nTimeMax)) continue;
// Apply the gas gain including fluctuations
} while (ggRndm <= 0);
Int_t signal = (Int_t) (-fGasGain * TMath::Log(ggRndm));
- if (fVerbose > 2) {
- printf(" electron no. %d, signal = %d\n",iEl,signal);
- printf(" rowE = %d, colE = %d, timeE = %d\n"
- ,rowE,colE,timeE);
- }
-
// Apply the pad response
Float_t padSignal[kNpad];
if (fPRFOn) {
timeTRDend = 11;
}
for (Int_t iTimeBin = TMath::Max(timeE - timeTRDbeg, 0)
- ; iTimeBin < TMath::Min(timeE + timeTRDend,nTimeMax)
- ; iTimeBin++) {
+ ;iTimeBin < TMath::Min(timeE + timeTRDend,nTimeMax)
+ ;iTimeBin++) {
// Apply the time response
Float_t timeResponse = 1.0;
signalOld[iPad] += padSignal[iPad] * timeResponse;
signals->SetData(rowE,colPos,iTimeBin,signalOld[iPad]);
}
- if (fVerbose > 3) {
- printf(" iTimeBin = %d, timeResponse = %f\n"
- ,iTimeBin,timeResponse);
- printf(" pad-signal = %f, %f, %f\n"
- ,signalOld[0],signalOld[1],signalOld[2]);
- }
// Store the track index in the dictionary
// Note: We store index+1 in order to allow the array to be compressed
//if (oldTrack == -1) break;
if (oldTrack == 0) {
dictionary[iDict]->SetData(rowE,colPos,iTimeBin,track+1);
- if (fVerbose > 3) {
- printf(" track index = %d\n",track);
- }
break;
}
}
}
}
- if ((fVerbose > 1) && (iDict == kNDict)) {
- printf("AliTRDdigitizer::MakeDigits -- ");
- printf("More than three tracks for one digit!\n");
- }
+ //if ((fVerbose > 1) && (iDict == kNDict)) {
+ // printf("AliTRDdigitizer::MakeDigits -- ");
+ // printf("More than three tracks for one digit!\n");
+ //}
}
printf("AliTRDdigitizer::MakeDigits -- ");
printf("Finished analyzing %d hits\n",countHits);
+ // The total conversion factor
+ Float_t convert = kEl2fC * fPadCoupling * fTimeCoupling * fChipGain;
+
// Loop through all chambers to finalize the digits
for (Int_t iDet = 0; iDet < AliTRDgeometry::Ndet(); iDet++) {
Int_t nColMax = fGeo->GetColMax(plane);
Int_t nTimeMax = fGeo->GetTimeMax();
- //if (!(CheckDetector(plane,chamber,sector))) continue;
if (fVerbose > 0) {
printf("AliTRDdigitizer::MakeDigits -- ");
printf("Digitization for chamber %d\n",iDet);
Int_t nDigits = 0;
- // 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 = signals->GetData(iRow,iCol,iTime);
-
- // Add the noise
- signalAmp = TMath::Max((Double_t) gRandom->Gaus(signalAmp,fNoise),0.0);
- // Convert to fC
- signalAmp *= kEl2fC;
- // Convert to mV
- signalAmp *= fChipGain;
- // Convert to ADC counts. Set the overflow-bit fADCoutRange if the
- // signal is larger than fADCinRange
- Int_t adc = 0;
- if (signalAmp >= fADCinRange) {
- adc = ((Int_t) fADCoutRange);
- }
- else {
- adc = ((Int_t) (signalAmp * (fADCoutRange / fADCinRange)));
- }
+ // Don't create noise in detectors that are switched off
+ if (CheckDetector(plane,chamber,sector)) {
+
+ // Create the digits for this chamber
+ for (iRow = 0; iRow < nRowMax; iRow++ ) {
+ for (iCol = 0; iCol < nColMax; iCol++ ) {
+ for (iTime = 0; iTime < nTimeMax; iTime++) {
+
+ // Create summable digits
+ if (fSDigits) {
+
+ Float_t signalAmp = signals->GetData(iRow,iCol,iTime);
+ Int_t adc = 0;
+ if (signalAmp >= fSinRange) {
+ adc = ((Int_t) fSoutRange);
+ }
+ else {
+ adc = ((Int_t) (signalAmp * (fSoutRange / fSinRange)));
+ }
+ nDigits++;
+ digits->SetData(iRow,iCol,iTime,adc);
- // Store the amplitude of the digit if above threshold
- if (adc > fADCthreshold) {
- if (fVerbose > 2) {
- printf(" iRow = %d, iCol = %d, iTime = %d\n"
- ,iRow,iCol,iTime);
- printf(" signal = %f, adc = %d\n",signalAmp,adc);
}
- nDigits++;
- digits->SetData(iRow,iCol,iTime,adc);
- }
+ // Create normal digits
+ else {
+
+ Float_t signalAmp = signals->GetData(iRow,iCol,iTime);
+
+ // Add the noise
+ signalAmp = TMath::Max((Double_t) gRandom->Gaus(signalAmp,fNoise),0.0);
+ // Convert to mV
+ signalAmp *= convert;
+ // Convert to ADC counts. Set the overflow-bit fADCoutRange if the
+ // signal is larger than fADCinRange
+ Int_t adc = 0;
+ if (signalAmp >= fADCinRange) {
+ adc = ((Int_t) fADCoutRange);
+ }
+ else {
+ adc = ((Int_t) (signalAmp * (fADCoutRange / fADCinRange)));
+ }
+
+ // Store the amplitude of the digit if above threshold
+ if (adc > fADCthreshold) {
+ if (fVerbose > 2) {
+ printf(" iRow = %d, iCol = %d, iTime = %d\n"
+ ,iRow,iCol,iTime);
+ printf(" signal = %f, adc = %d\n",signalAmp,adc);
+ }
+ nDigits++;
+ digits->SetData(iRow,iCol,iTime,adc);
+ }
- }
+ }
+
+ }
+ }
}
+
}
// Compress the arrays
// Create the branches
if (!(gAlice->TreeD()->GetBranch("TRDdigits"))) {
- if (!fDigits->MakeBranch()) return kFALSE;
+ return kFALSE;
+ //if (!fDigits->MakeBranch()) {
+ // printf("AliTRDdigitizer::WriteDigits -- ");
+ // printf("MakeBranch failed.\n");
+ // return kFALSE;
+ //}
}
// Store the digits and the dictionary in the tree
virtual void Init();
virtual Bool_t Open(const Char_t *name, Int_t nEvent = 0);
virtual Bool_t MakeDigits();
+ virtual void ReInit();
+ virtual Bool_t SumSDigits();
virtual Bool_t WriteDigits();
virtual Bool_t InitDetector();
- virtual void SetGasGain(Float_t gasgain) { fGasGain = gasgain; };
- virtual void SetNoise(Float_t noise) { fNoise = noise; };
- virtual void SetChipGain(Float_t chipgain) { fChipGain = chipgain; };
- virtual void SetADCoutRange(Float_t range) { fADCoutRange = range; };
- virtual void SetADCinRange(Float_t range) { fADCinRange = range; };
- virtual void SetADCthreshold(Int_t thresh) { fADCthreshold = thresh; };
- virtual void SetDiffusion(Int_t diffOn = 1) { fDiffusionOn = diffOn; };
- virtual void SetDiffusionT(Float_t diff) { fDiffusionT = diff; };
- virtual void SetDiffusionL(Float_t diff) { fDiffusionL = diff; };
- virtual void SetElAttach(Int_t elOn = 1) { fElAttachOn = elOn; };
- virtual void SetElAttachProp(Float_t prop) { fElAttachProp = prop; };
- virtual void SetExB(Int_t exbOn = 1) { fExBOn = exbOn; };
- virtual void SetOmegaTau(Float_t ot) { fOmegaTau = ot; };
- virtual void SetPadResponse(Int_t prfOn = 1) { fPRFOn = prfOn; };
+ virtual void SetGasGain(Float_t gasgain) { fGasGain = gasgain; };
+ virtual void SetNoise(Float_t noise) { fNoise = noise; };
+ virtual void SetChipGain(Float_t chipgain) { fChipGain = chipgain; };
+ virtual void SetADCoutRange(Float_t range) { fADCoutRange = range; };
+ virtual void SetADCinRange(Float_t range) { fADCinRange = range; };
+ virtual void SetADCthreshold(Int_t thresh) { fADCthreshold = thresh; };
+ virtual void SetDiffusion(Int_t diffOn = 1) { fDiffusionOn = diffOn; };
+ virtual void SetDiffusionT(Float_t diff) { fDiffusionT = diff; };
+ virtual void SetDiffusionL(Float_t diff) { fDiffusionL = diff; };
+ virtual void SetElAttach(Int_t elOn = 1) { fElAttachOn = elOn; };
+ virtual void SetElAttachProp(Float_t prop) { fElAttachProp = prop; };
+ virtual void SetExB(Int_t exbOn = 1) { fExBOn = exbOn; };
+ virtual void SetOmegaTau(Float_t ot) { fOmegaTau = ot;
+ ReInit(); };
+ virtual void SetPadResponse(Int_t prfOn = 1) { fPRFOn = prfOn; };
virtual void SetPRF(TF1 *prf);
- virtual void SetTimeResponse(Int_t trfOn = 1) { fTRFOn = trfOn; };
+ virtual void SetTimeResponse(Int_t trfOn = 1) { fTRFOn = trfOn;
+ ReInit(); };
virtual void SetTRF(TF1 *trf);
- virtual void SetDriftVelocity(Float_t v) { fDriftVelocity = v; };
- virtual void SetCompress(Int_t c = 1) { fCompress = c; };
- virtual void SetVerbose(Int_t v = 1) { fVerbose = v; };
+ virtual void SetDriftVelocity(Float_t v) { fDriftVelocity = v;
+ ReInit(); };
+ virtual void SetPadCoupling(Float_t v) { fPadCoupling = v; };
+ virtual void SetTimeCoupling(Float_t v) { fTimeCoupling = v; };
+ virtual void SetCompress(Int_t c = 1) { fCompress = c; };
+ virtual void SetVerbose(Int_t v = 1) { fVerbose = v; };
+ virtual void SetSDigits(Int_t v = 1) { fSDigits = v; };
AliTRDdigitsManager *Digits() const { return fDigits; };
virtual TF1 *GetPadResponse() const { return fPRF; };
virtual TF1 *GetTimeResponse() const { return fTRF; };
virtual Float_t GetDriftVelocity() const { return fDriftVelocity; };
+ virtual Float_t GetPadCoupling() const { return fPadCoupling; };
+ virtual Float_t GetTimeCoupling() const { return fTimeCoupling; };
virtual Bool_t GetCompress() const { return fCompress; };
+ virtual Bool_t GetSDigits() const { return fSDigits; };
+ virtual Float_t GetTimeBinWidth() const { return fTimeBinWidth; };
protected:
Float_t fChipGain; // Electronics gain
Float_t fADCoutRange; // ADC output range (number of channels)
Float_t fADCinRange; // ADC input range (input charge)
+ Float_t fSinRange; // Input range for summable digits
+ Float_t fSoutRange; // Output range for summable digits
Int_t fADCthreshold; // ADC threshold in ADC channel
Int_t fDiffusionOn; // Switch for the diffusion
Float_t fDiffusionT; // Diffusion in transverse direction
Float_t fTRFhi; // Higher boundary of the TRF
Float_t fTRFwid; // Bin width of the integrated TRF
Float_t fDriftVelocity; // Drift velocity (cm / mus)
+ Float_t fTimeBinWidth; // Time bin width in ns
+ Float_t fPadCoupling; // Pad coupling factor
+ Float_t fTimeCoupling; // Time coupling factor (image charge of moving ions)
Bool_t fCompress; // Switch to keep only compressed data in memory
Int_t fVerbose; // Sets the verbose level
+ Bool_t fSDigits; // Switch for the summable digits
private:
virtual Float_t TimeResponse(Float_t time);
virtual Bool_t CheckDetector(Int_t plane, Int_t chamber, Int_t sector);
virtual void SamplePRF();
- virtual void IntegrateTRF();
+ virtual void SampleTRF();
- ClassDef(AliTRDdigitizer,2) // Produces TRD-Digits
+ ClassDef(AliTRDdigitizer,3) // Produces TRD-Digits
};