/*
$Log$
+Revision 1.33 2001/11/06 17:19:41 cblume
+Add detailed geometry and simple simulator
+
Revision 1.32 2001/10/08 06:57:33 hristov
Branches for TRD digits are created only during the digitisation
#include <TGeometry.h>
#include <TTree.h>
#include <TPGON.h>
+#include <TFile.h>
+#include <TROOT.h>
#include "AliRun.h"
#include "AliConst.h"
#include "AliTRDrecPoint.h"
#include "AliTRDcluster.h"
#include "AliTRDdigitsManager.h"
-#include "AliTRDdataArrayI.h"
-#include "AliTRDsegmentArray.h"
+#include "AliTRDdigitsMerger.h"
ClassImp(AliTRD)
fDrawTR = 0;
fDisplayType = 0;
- fDigitsArray = 0;
- for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
- fDictionaryArray[iDict] = 0;
- }
-
}
//_____________________________________________________________________________
fDrawTR = 0;
fDisplayType = 0;
- fDigitsArray = 0;
- for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
- fDictionaryArray[iDict] = 0;
- }
-
SetMarkerColor(kWhite);
}
fIshunt = 0;
- 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];
+ if (fGeometry) {
+ delete fGeometry;
+ }
+ if (fHits) {
+ delete fHits;
+ }
+ if (fRecPoints) {
+ delete fRecPoints;
}
}
AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
,"TRD digitizer class");
+ digitizer->SetVerbose(GetDebug());
// Set the parameter
digitizer->SetDiffusion();
digitizer->SetExB();
digitizer->SetEvent(gAlice->GetEvNumber());
+
// Initialization
digitizer->InitDetector();
digitizer->MakeDigits();
// Write the digits into the input file
- if (digitizer->Digits()->MakeBranch(fDigitsFile)) {
+ if (digitizer->MakeBranch(fDigitsFile)) {
digitizer->WriteDigits();
AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
,"TRD digitizer class");
+ digitizer->SetVerbose(GetDebug());
// For the summable digits
digitizer->SetSDigits(kTRUE);
// Initialization
digitizer->InitDetector();
- // Create the digits
+ // Create the TRD s-digits branch
digitizer->MakeDigits();
// Write the digits into the input file
- if (digitizer->Digits()->MakeBranch(fDigitsFile)) {
+ if (digitizer->MakeBranch(fDigitsFile)) {
digitizer->WriteDigits();
// Create final digits from summable digits
//
-}
+ // Create the TRD digitizer
+ AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
+ ,"TRD digitizer class");
+ digitizer->SetVerbose(GetDebug());
-//_____________________________________________________________________________
-void AliTRD::AddDigit(Int_t *digits, Int_t *amp)
-{
- //
- // Add a digit for the TRD
- //
+ // Set the parameter
+ digitizer->SetEvent(gAlice->GetEvNumber());
+
+ // Initialization
+ digitizer->InitDetector();
+
+ // Read the s-digits via digits manager
+ AliTRDdigitsManager *sdigitsManager = new AliTRDdigitsManager();
+ sdigitsManager->SetVerbose(GetDebug());
+ sdigitsManager->SetSDigits(kTRUE);
+ if (fDigitsFile) {
+ sdigitsManager->Open(fDigitsFile);
+ }
+ sdigitsManager->CreateArrays();
+ sdigitsManager->ReadDigits();
+
+ // Add the s-digits to the input list
+ digitizer->AddSDigitsManager(sdigitsManager);
- TClonesArray &ldigits = *fDigits;
- new(ldigits[fNdigits++]) AliTRDdigit(kFALSE,digits,amp);
+ // Convert the s-digits to normal digits
+ digitizer->SDigits2Digits();
+
+ // Store the digits
+ if (digitizer->MakeBranch(fDigitsFile)) {
+
+ digitizer->WriteDigits();
+
+ }
}
Int_t i;
- if(fDebug) {
+ if (fDebug) {
printf("\n%s: ",ClassName());
for (i = 0; i < 35; i++) printf("*");
printf(" TRD_INIT ");
printf("%s: Leave space in front of RICH free\n",ClassName());
}
- if (fGasMix == 1)
+ if (fGasMix == 1) {
printf("%s: Gas Mixture: 85%% Xe + 15%% CO2\n",ClassName());
- else
+ }
+ else {
printf("%s: Gas Mixture: 97%% Xe + 3%% Isobutane\n",ClassName());
+ }
}
void AliTRD::MakeBranch(Option_t* option, const char *file)
{
//
- // Create Tree branches for the TRD digits and cluster.
+ // Create Tree branches for the TRD digits.
//
- //Int_t buffersize = 4000;
- //Char_t branchname[15];
+ Int_t buffersize = 4000;
+ Char_t branchname[15];
+ sprintf(branchname,"%s",GetName());
const char *cD = strstr(option,"D");
AliDetector::MakeBranch(option,file);
- Int_t buffersize = 64000;
-
- if (cD) {
- fDigitsArray = new AliTRDdataArrayI();
- MakeBranchInTree(gAlice->TreeD()
- ,"TRDdigits", fDigitsArray->IsA()->GetName()
- ,&fDigitsArray,buffersize,99,file);
-
- for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
- Char_t branchname[15];
- sprintf(branchname,"TRDdictionary%d",iDict);
- fDictionaryArray[iDict] = new AliTRDdataArrayI();
- MakeBranchInTree(gAlice->TreeD()
- ,branchname,fDictionaryArray[iDict]->IsA()->GetName()
- ,&fDictionaryArray[iDict],buffersize,99,file);
- }
- }
+ if (fDigits && gAlice->TreeD() && cD) {
+ MakeBranchInTree(gAlice->TreeD(),branchname,&fDigits,buffersize,file);
+ }
+
}
//_____________________________________________________________________________
void AliTRD::ResetDigits()
{
//
- // Resets the digits
+ // Reset number of digits and the digits array for this detector
//
- 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();
- }
- }
- }
+ fNdigits = 0;
+ if (fDigits) fDigits->Clear();
}
return *this;
}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
class AliTRDhit;
class AliTRDsim;
class AliTRDgeometry;
-class AliTRDdataArrayI;
//_____________________________________________________________________________
class AliTRD : public AliDetector {
AliTRD &operator=(const AliTRD &trd);
virtual void AddHit(Int_t track, Int_t det, Float_t *hits, Int_t q);
- virtual void AddDigit(Int_t *digits, Int_t *amp);
virtual void AddCluster(Float_t *pos, Int_t *digits
, Int_t det, Float_t amp, Int_t *tracks
, Float_t sigmaY2, Int_t iType);
Int_t fDrawTR; // Switches marking the TR photons in the display
Int_t fDisplayType; // Display type (0: normal, 1: detailed)
- AliTRDdataArrayI *fDigitsArray; //! Digits array
- AliTRDdataArrayI *fDictionaryArray[3]; //! Dictionary array
-
- ClassDef(AliTRD,3) // Transition Radiation Detector base class
+ ClassDef(AliTRD,4) // Transition Radiation Detector base class
};
gAlice->GetEvent(0);
// Get the pointer to the TRD detector
- AliTRD *TRD = (AliTRD *) gAlice->GetDetector("TRD");
- if (!TRD) {
+ AliTRD *trd = (AliTRD *) gAlice->GetDetector("TRD");
+ if (!trd) {
cout << "<AliTRDanalyzeCluster> No TRD detector found" << endl;
rc = 2;
return rc;
,501,-0.5,500.5);
// Get the pointer to the geometry object
- AliTRDgeometry *TRDgeometry;
- if (TRD) {
- TRDgeometry = TRD->GetGeometry();
+ AliTRDgeometry *geo;
+ if (trd) {
+ geo = trd->GetGeometry();
}
else {
cout << "<AliTRDanalyzeCluster> No TRD geometry found" << endl;
// Get the pointer to the hit-tree
TFile *file = (TFile *) gROOT->GetListOfFiles()->FindObject("TRD_test.root");
- TTree *ClusterTree = file->Get("ClusterTree");
- if (!(ClusterTree)) {
+ TTree *clusterTree = (TTree *) file->Get("TreeR0_TRD");
+ if (!(clusterTree)) {
cout << "<AliTRDanalyzeCluster> No tree with clusters found" << endl;
rc = 4;
return rc;
}
// Get the pointer to the hit container
- TObjArray *ClusterArray = TRD->RecPoints();
- if (!(ClusterArray)) {
- cout << "<AliTRDanalyzeCluster> No ClusterArray found" << endl;
+ TObjArray *clusterArray = trd->RecPoints();
+ if (!(clusterArray)) {
+ cout << "<AliTRDanalyzeCluster> No clusterArray found" << endl;
rc = 5;
return rc;
}
// Set the branch address
- ClusterTree->GetBranch("TRDcluster")->SetAddress(&ClusterArray);
- Int_t nEntries = ClusterTree->GetEntries();
+ clusterTree->GetBranch("TRDcluster")->SetAddress(&clusterArray);
+ Int_t nEntries = clusterTree->GetEntries();
cout << "<AliTRDanalyzeCluster> Number of entries in the cluster tree = "
<< nEntries
<< endl;
Int_t countCluster = 0;
- Int_t countUnfold = 0;
+ Int_t countOverlap = 0;
// Loop through all entries in the tree
Int_t nbytes;
for (Int_t iEntry = 0; iEntry < nEntries; iEntry++) {
// Import the tree
- nbytes += ClusterTree->GetEvent(iEntry);
+ nbytes += clusterTree->GetEvent(iEntry);
// Get the number of points in the detector
- Int_t nCluster = ClusterArray->GetEntriesFast();
+ Int_t nCluster = clusterArray->GetEntriesFast();
// Loop through all TRD digits
for (Int_t iCluster = 0; iCluster < nCluster; iCluster++) {
// Get the information for this digit
- AliTRDcluster *Cluster = (AliTRDcluster *) ClusterArray->UncheckedAt(iCluster);
- Int_t detector = Cluster->GetDetector();
- Int_t sector = TRDgeometry->GetSector(detector);
- Int_t plane = TRDgeometry->GetPlane(detector);
- Int_t chamber = TRDgeometry->GetChamber(detector);
- Float_t energy = Cluster->GetQ();
- Int_t track0 = Cluster->GetTrackIndex(0);
- Int_t track1 = Cluster->GetTrackIndex(1);
- Int_t track2 = Cluster->GetTrackIndex(2);
- TParticle *Part = 0;
+ AliTRDcluster *cluster = (AliTRDcluster *) clusterArray->UncheckedAt(iCluster);
+ Int_t detector = cluster->GetDetector();
+ Int_t sector = geo->GetSector(detector);
+ Int_t plane = geo->GetPlane(detector);
+ Int_t chamber = geo->GetChamber(detector);
+ Float_t energy = cluster->GetQ();
+ Int_t track0 = cluster->GetTrackIndex(0);
+ Int_t track1 = cluster->GetTrackIndex(1);
+ Int_t track2 = cluster->GetTrackIndex(2);
+ TParticle *particle = 0;
if (track0 > -1) {
- Part = gAlice->Particle(track0);
+ particle = gAlice->Particle(track0);
}
countCluster++;
- if (Cluster->FromUnfolding()) countUnfold++;
+ if (!cluster->Isolated()) countOverlap++;
// Total spectrum
hClusAll->Fill(energy);
- if (!Cluster->FromUnfolding()) {
+ if (cluster->Isolated()) {
// Noise spectrum
if (track0 < 0) {
}
// Electron cluster
- if ((Part) && (Part->GetPdgCode() == 11) && (track1 < 0)) {
+ if ((particle) && (particle->GetPdgCode() == 11) && (track1 < 0)) {
hClusEl->Fill(energy);
}
// Pion cluster
- if ((Part) && (Part->GetPdgCode() == -211) && (track1 < 0)) {
+ if ((particle) && (particle->GetPdgCode() == -211) && (track1 < 0)) {
hClusPi->Fill(energy);
}
}
- cout << "<AliTRDanalyzeCluster> Found " << countCluster << " cluster in total" << endl;
- cout << "<AliTRDanalyzeCluster> Found " << countUnfold << " cluster from unfolding" << endl;
+ cout << "<AliTRDanalyzeCluster> Found " << countCluster << " cluster in total" << endl;
+ cout << "<AliTRDanalyzeCluster> Found " << countOverlap << " overlapping cluster" << endl;
cout << endl;
TCanvas *cCluster = new TCanvas("cCluster","AliTRDanalyzeCluster",50,50,600,600);
Int_t nPart = gAlice->GetEvent(0);
// Get the pointer to the TRD detector
- AliTRD *TRD = (AliTRD *) gAlice->GetDetector("TRD");
- if (!TRD) {
+ AliTRD *trd = (AliTRD *) gAlice->GetDetector("TRD");
+ if (!trd) {
cout << "<AliTRDanalyzeDigits> No TRD detector found" << endl;
rc = 2;
return rc;
// Get the digitizer object
TFile *file = (TFile *) gROOT->GetListOfFiles()->FindObject("TRD_test.root");
- AliTRDdigitizer *Digitizer = (AliTRDdigitizer *) file->Get("digitizer");
- if (!Digitizer) {
+ AliTRDdigitizer *digitizer = (AliTRDdigitizer *) file->Get("digitizer");
+ if (!digitizer) {
cout << "<AliTRDanalyzeDigits> No digitizer object found" << endl;
rc = 3;
return rc;
}
// Define the histograms
- Int_t adcRange = ((Int_t) Digitizer->GetADCoutRange());
+ Int_t adcRange = ((Int_t) digitizer->GetADCoutRange());
TH1F *hAmpAll = new TH1F("hAmpAll" ,"Amplitude of the digits (all)"
,adcRange+1,-0.5,((Float_t) adcRange)+0.5);
TH1F *hAmpEl = new TH1F("hAmpEl" ,"Amplitude of the digits (electrons)"
,5,-0.5,4.5);
// Get the pointer to the geometry object
- AliTRDgeometry *TRDgeometry;
- if (TRD) {
- TRDgeometry = TRD->GetGeometry();
+ AliTRDgeometry *geo;
+ if (trd) {
+ geo = trd->GetGeometry();
}
else {
cout << "<AliTRDanalyzeDigits> No TRD geometry found" << endl;
}
// Create the digits manager
- AliTRDdigitsManager *DigitsManager = new AliTRDdigitsManager();
+ AliTRDdigitsManager *digitsManager = new AliTRDdigitsManager();
+
+ digitsManager->Open("TRD_test.root");
// Read the digits from the file
- if (!(DigitsManager->ReadDigits())) {
+ if (!(digitsManager->ReadDigits())) {
cout << "<AliTRDanalyzeDigits> Cannot read the digits" << endl;
rc = 5;
return rc;
}
- AliTRDmatrix *TRDmatrix;
+ AliTRDmatrix *matrix;
Int_t countDigits = 0;
- Int_t iSec = TRD->GetSensSector();
- Int_t iCha = TRD->GetSensChamber();
- Int_t timeMax = TRDgeometry->GetTimeTotal();
+ Int_t iSec = trd->GetSensSector();
+ Int_t iCha = trd->GetSensChamber();
+ Int_t timeMax = geo->GetTimeTotal();
TProfile *hAmpTimeEl = new TProfile("hAmpTimeEl","Amplitude of the digits (electrons)"
,timeMax,-0.5,((Double_t) timeMax)-0.5);
// Loop over all planes
for (Int_t iPla = 0; iPla < kNpla; iPla++) {
- Int_t iDet = TRDgeometry->GetDetector(iPla,iCha,iSec);
- Int_t rowMax = TRDgeometry->GetRowMax(iPla,iCha,iSec);
- Int_t colMax = TRDgeometry->GetColMax(iPla);
+ Int_t iDet = geo->GetDetector(iPla,iCha,iSec);
+ Int_t rowMax = geo->GetRowMax(iPla,iCha,iSec);
+ Int_t colMax = geo->GetColMax(iPla);
if (iPla == 0) {
- TRDmatrix = new AliTRDmatrix(rowMax,colMax,timeMax,iSec,iCha,iPla);
+ matrix = new AliTRDmatrix(rowMax,colMax,timeMax,iSec,iCha,iPla);
}
// Loop through the detector pixel
for (Int_t col = 0; col < colMax; col++) {
for (Int_t row = 0; row < rowMax; row++) {
- AliTRDdigit *Digit = DigitsManager->GetDigit(row,col,time,iDet);
- Int_t amp = Digit->GetAmp();
-
- Int_t track0 = DigitsManager->GetTrack(0,row,col,time,iDet);
- Int_t track1 = DigitsManager->GetTrack(1,row,col,time,iDet);
- TParticle *Part = 0;
+ AliTRDdigit *digit = digitsManager->GetDigit(row,col,time,iDet);
+ Int_t amp = digit->GetAmp();
+ Int_t track0 = digitsManager->GetTrack(0,row,col,time,iDet);
+ Int_t track1 = digitsManager->GetTrack(1,row,col,time,iDet);
+ TParticle *particle = 0;
if (track0 > -1) {
- Part = gAlice->Particle(track0);
+ particle = gAlice->Particle(track0);
}
if (amp > 0) {
countDigits++;
if (iPla == 0) {
- TRDmatrix->SetSignal(row,col,time,amp);
+ matrix->SetSignal(row,col,time,amp);
}
}
}
// Electron digit
- if ((Part) && (Part->GetPdgCode() == 11) && (track1 < 0)) {
+ if ((particle) && (particle->GetPdgCode() == 11) && (track1 < 0)) {
hAmpEl->Fill(amp);
hAmpTimeEl->Fill(time,amp);
}
// Pion digit
- if ((Part) && (Part->GetPdgCode() == -211) && (track1 < 0)) {
+ if ((particle) && (particle->GetPdgCode() == -211) && (track1 < 0)) {
hAmpPi->Fill(amp);
hAmpTimePi->Fill(time,amp);
}
- delete Digit;
+ delete digit;
}
}
cout << "<AliTRDanalyzeDigits> Found " << countDigits << " digits in total" << endl;
// Display the detector matrix
- TRDmatrix->Draw();
- TRDmatrix->ProjRow();
- TRDmatrix->ProjCol();
- TRDmatrix->ProjTime();
+ matrix->Draw();
+ matrix->ProjRow();
+ matrix->ProjCol();
+ matrix->ProjTime();
TCanvas *cDigits = new TCanvas("cDigits","AliTRDanalyzeDigits",50,50,600,800);
cDigits->Divide(2,3);
gAlice->GetEvent(0);
// Get the pointer to the TRD detector
- AliTRD *TRD = (AliTRD *) gAlice->GetDetector("TRD");
- if (!TRD) {
+ AliTRD *trd = (AliTRD *) gAlice->GetDetector("TRD");
+ if (!trd) {
cout << "<AliTRDanalyzeHits> No TRD detector found" << endl;
rc = 2;
return rc;
}
// Get the pointer to the geometry object
- AliTRDgeometryFull *TRDgeometry;
- if (TRD) {
- TRDgeometry = (AliTRDgeometryFull *) TRD->GetGeometry();
+ AliTRDgeometryFull *geo;
+ if (trd) {
+ geo = (AliTRDgeometryFull *) trd->GetGeometry();
}
else {
cout << "<AliTRDanalyzeHits> No TRD geometry found" << endl;
TH1F *hQdedx = new TH1F("hQdedx","Charge dedx-hits",100,0.0,1000.0);
TH1F *hQtr = new TH1F("hQtr" ,"Charge TR-hits" ,100,0.0,1000.0);
- Float_t rmin = TRDgeometry->Rmin();
- Float_t rmax = TRDgeometry->Rmax();
- Float_t length = TRDgeometry->GetChamberLengthI(0);
- Float_t width = TRDgeometry->GetChamberWidth(0);
- Int_t ncol = TRDgeometry->GetColMax(0);
- Int_t nrow = TRDgeometry->GetRowMax(0,2,13);
- Int_t ntime = ((Int_t) (rmax - rmin) / TRDgeometry->GetTimeBinSize());
+ Float_t rmin = geo->Rmin();
+ Float_t rmax = geo->Rmax();
+ Float_t length = geo->GetChamberLengthI(0);
+ Float_t width = geo->GetChamberWidth(0);
+ Int_t ncol = geo->GetColMax(0);
+ Int_t nrow = geo->GetRowMax(0,2,13);
+ Int_t ntime = ((Int_t) (rmax - rmin) / geo->GetTimeBinSize());
TH2F *hZY = new TH2F("hZY" ,"Y vs Z (chamber 0)", nrow,-length/2.,length/2.
,ntime, rmin, rmax);
,50,0.0,1000.0);
// Get the pointer hit tree
- TTree *HitTree = gAlice->TreeH();
- if (!HitTree) {
+ TTree *hitTree = gAlice->TreeH();
+ if (!hitTree) {
cout << "<AliTRDanalyzeHits> No hit tree found" << endl;
rc = 4;
return rc;
// 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();
cout << "<AliTRDanalyzeHits> Found " << nTrack
<< " primary particles with hits" << endl;
for (Int_t iTrack = 0; iTrack < nTrack; iTrack++) {
gAlice->ResetHits();
- nBytes += HitTree->GetEvent(iTrack);
+ nBytes += hitTree->GetEvent(iTrack);
Int_t nPrimE = 0;
Int_t nPrimP = 0;
Int_t nTotP = 0;
// Get the number of hits in the TRD created by this particle
- Int_t nHit = TRD->Hits()->GetEntriesFast();
+ Int_t nHit = trd->Hits()->GetEntriesFast();
// Loop through the TRD hits
for (Int_t iHit = 0; iHit < nHit; iHit++) {
countHits++;
- AliTRDhit *hit = (AliTRDhit *) TRD->Hits()->UncheckedAt(iHit);
+ AliTRDhit *hit = (AliTRDhit *) trd->Hits()->UncheckedAt(iHit);
Float_t x = hit->X();
Float_t y = hit->Y();
Float_t q = hit->GetCharge();
Int_t track = hit->Track();
Int_t det = hit->GetDetector();
- Int_t plane = TRDgeometry->GetPlane(det);
+ Int_t plane = geo->GetPlane(det);
if (hit->FromDrift()) {
hQdedx->Fill(q);
Bool_t From4pad() const { return TestBit(k4pad); }
Bool_t From5pad() const { return TestBit(k5pad); }
Bool_t FromLarge() const { return TestBit(kLarge); }
-
+ Bool_t Isolated() const { return (TestBit(k2pad) || TestBit(k3pad)); }
+
void SetDetector(Int_t d) { fDetector = d; }
void SetLocalTimeBin(Int_t t) { fTimeBin = t; }
void SetQ(Float_t q) { fQ = q; }
/*
$Log$
+Revision 1.9 2001/10/21 18:30:02 hristov
+Several pointers were set to zero in the default constructors to avoid memory management problems
+
Revision 1.8 2001/05/07 08:06:44 cblume
Speedup of the code. Create only AliTRDcluster
}
// Create a tree for the cluster
- fClusterTree = new TTree("ClusterTree","Tree with TRDcluster");
+ Char_t treeName[12];
+ sprintf(treeName,"TreeR%d_TRD",fEvent);
+ fClusterTree = new TTree(treeName,"TRD cluster");
TObjArray *ioArray = 0;
- fClusterTree->Branch("TRDcluster","TObjArray",&ioArray,32000,0);
+ fClusterTree->BranchOld("TRDcluster","TObjArray",&ioArray,32000,0);
if (savedir) {
savedir->cd();
/*
$Log$
+Revision 1.13 2001/05/28 17:07:58 hristov
+Last minute changes; ExB correction in AliTRDclusterizerV1; taking into account of material in G10 TEC frames and material between TEC planes (C.Blume,S.Sedykh)
+
Revision 1.12 2001/05/21 17:42:58 hristov
Constant casted to avoid the ambiguity
if (fDigitsManager) {
delete fDigitsManager;
+ fDigitsManager = NULL;
}
}
fLUT[ilut] = lut[ilut];
}
+ fDigitsManager->CreateArrays();
+
}
//_____________________________________________________________________________
return kFALSE;
}
+ fDigitsManager->Open(fInputFile->GetName());
+
// Read in the digit arrays
return (fDigitsManager->ReadDigits());
Int_t rc = 0;
// Create the clusterizer
- AliTRDclusterizerV1 *Clusterizer =
+ AliTRDclusterizerV1 *clusterizer =
new AliTRDclusterizerV1("clusterizer","Clusterizer class");
// Set the parameter
- Clusterizer->SetClusMaxThresh(0);
- Clusterizer->SetClusSigThresh(0);
- Clusterizer->Dump();
+ clusterizer->SetClusMaxThresh(0);
+ clusterizer->SetClusSigThresh(0);
+ clusterizer->Dump();
// Open the file
- if (!(Clusterizer->Open("TRD_test.root",0))) {
+ if (!(clusterizer->Open("TRD_test.root",0))) {
rc = 1;
return rc;
}
// Load the digits
- if (!(Clusterizer->ReadDigits())) {
+ if (!(clusterizer->ReadDigits())) {
rc = 2;
return rc;
}
// Find the cluster
- if (!(Clusterizer->MakeClusters())) {
+ if (!(clusterizer->MakeClusters())) {
rc = 3;
return rc;
}
// Write the cluster tree into the file
- if (!(Clusterizer->WriteClusters(-1))) {
+ if (!(clusterizer->WriteClusters(-1))) {
rc = 4;
return rc;
}
// Save the clusterizer class in the file
- if (!(Clusterizer->Write())) {
+ if (!(clusterizer->Write())) {
rc = 5;
return rc;
}
gAlice->GetEvent(0);
// Create the TRD digitzer
- AliTRDdigitizer *Digitizer = new AliTRDdigitizer("digitizer","Digitizer class");
- Digitizer->InitDetector();
+ AliTRDdigitizer *digitizer = new AliTRDdigitizer("digitizer","Digitizer class");
+ digitizer->InitDetector();
// Set the parameter (for TRF ~200ns)
- Digitizer->SetGasGain(1600.);
- Digitizer->SetChipGain(8.0);
- Digitizer->SetNoise(1000.);
- Digitizer->SetADCinRange(1000.);
- Digitizer->SetADCoutRange(1023.);
- Digitizer->SetADCthreshold(0);
- Digitizer->SetVerbose(1);
+ digitizer->SetGasGain(1600.);
+ digitizer->SetChipGain(8.0);
+ digitizer->SetNoise(1000.);
+ digitizer->SetADCinRange(1000.);
+ digitizer->SetADCoutRange(1023.);
+ digitizer->SetADCthreshold(0);
+ digitizer->SetVerbose(1);
// Create the digits
- if (!(Digitizer->MakeDigits())) {
+ if (!(digitizer->MakeDigits())) {
rc = 2;
return rc;
}
// Write the digits into the input file
- if (!(Digitizer->WriteDigits())) {
+ if (!(digitizer->MakeBranch())) {
rc = 3;
return rc;
}
+ // Write the digits into the input file
+ if (!(digitizer->WriteDigits())) {
+ rc = 4;
+ return rc;
+ }
+
// Save the digitizer class in the AliROOT file
- if (!(Digitizer->Write())) {
+ if (!(digitizer->Write())) {
rc = 4;
return rc;
}
/*
$Log$
+Revision 1.26 2001/11/06 17:19:41 cblume
+Add detailed geometry and simple simulator
+
Revision 1.25 2001/06/27 09:54:44 cblume
Moved fField initialization to InitDetector()
///////////////////////////////////////////////////////////////////////////////
// //
// Creates and handles digits from TRD hits //
+// Author: C. Blume (C.Blume@gsi.de) //
// //
// The following effects are included: //
// - Diffusion //
// - ExB effects //
// - Gas gain including fluctuations //
// - Pad-response (simple Gaussian approximation) //
+// - Time-response //
// - Electronics noise //
// - Electronics gain //
// - Digitization //
// The corresponding parameter can be adjusted via the various //
// Set-functions. If these parameters are not explicitly set, default //
// values are used (see Init-function). //
-// To produce digits from a root-file with TRD-hits use the //
-// slowDigitsCreate.C macro. //
+// As an example on how to use this class to produce digits from hits //
+// have a look at the macro hits2digits.C //
+// The production of summable digits is demonstrated in hits2sdigits.C //
+// and the subsequent conversion of the s-digits into normal digits is //
+// explained in sdigits2digits.C. //
// //
///////////////////////////////////////////////////////////////////////////////
#include <TTree.h>
#include <TFile.h>
#include <TF1.h>
+#include <TList.h>
#include "AliRun.h"
#include "AliMagF.h"
// AliTRDdigitizer default constructor
//
- fInputFile = NULL;
- fDigits = NULL;
- fTRD = NULL;
- fGeo = NULL;
- fPRFsmp = NULL;
- fTRFsmp = 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;
- fField = 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;
+ fInputFile = NULL;
+ fDigitsManager = NULL;
+ fSDigitsManagerList = NULL;
+ fSDigitsManager = NULL;
+ fTRD = NULL;
+ fGeo = NULL;
+ fPRFsmp = NULL;
+ fTRFsmp = 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;
+ fPadCoupling = 0.0;
+ fTimeCoupling = 0.0;
+ fTimeBinWidth = 0.0;
+ fField = 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 = 0;
+ fSDigits = kFALSE;
+ fSDigitsScale = 0.0;
}
// AliTRDdigitizer default constructor
//
- fInputFile = NULL;
- fDigits = NULL;
- fTRD = NULL;
- fGeo = NULL;
- fPRFsmp = NULL;
- fTRFsmp = NULL;
+ fInputFile = NULL;
+
+ fDigitsManager = NULL;
+ fSDigitsManager = NULL;
+ fSDigitsManagerList = NULL;
- fEvent = 0;
+ fTRD = NULL;
+ fGeo = NULL;
+ fPRFsmp = NULL;
+ fTRFsmp = NULL;
- fCompress = kTRUE;
- fVerbose = 1;
- fSDigits = kFALSE;
+ fEvent = 0;
+
+ fCompress = kTRUE;
+ fVerbose = 0;
+ fSDigits = kFALSE;
Init();
if (fInputFile) {
fInputFile->Close();
delete fInputFile;
+ fInputFile = NULL;
+ }
+
+ if (fDigitsManager) {
+ delete fDigitsManager;
+ fDigitsManager = NULL;
}
- if (fDigits) {
- delete fDigits;
+ if (fSDigitsManager) {
+ delete fSDigitsManager;
+ fSDigitsManager = NULL;
}
+ if (fSDigitsManagerList) {
+ fSDigitsManagerList->Delete();
+ delete fSDigitsManagerList;
+ fSDigitsManagerList = NULL;
+ }
}
//_____________________________________________________________________________
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).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).fField = fField;
- ((AliTRDdigitizer &) d).fPRFOn = fPRFOn;
- ((AliTRDdigitizer &) d).fTRFOn = fTRFOn;
-
- ((AliTRDdigitizer &) d).fCompress = fCompress;
- ((AliTRDdigitizer &) d).fVerbose = fVerbose;
- ((AliTRDdigitizer &) d).fSDigits = fSDigits;
-
- ((AliTRDdigitizer &) d).fPRFbin = fPRFbin;
- ((AliTRDdigitizer &) d).fPRFlo = fPRFlo;
- ((AliTRDdigitizer &) d).fPRFhi = fPRFhi;
- ((AliTRDdigitizer &) d).fPRFwid = fPRFwid;
- ((AliTRDdigitizer &) d).fPRFpad = fPRFpad;
+ ((AliTRDdigitizer &) d).fInputFile = NULL;
+ ((AliTRDdigitizer &) d).fSDigitsManagerList = NULL;
+ ((AliTRDdigitizer &) d).fSDigitsManager = NULL;
+ ((AliTRDdigitizer &) d).fDigitsManager = 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).fDriftVelocity = fDriftVelocity;
+ ((AliTRDdigitizer &) d).fPadCoupling = fPadCoupling;
+ ((AliTRDdigitizer &) d).fTimeCoupling = fTimeCoupling;
+ ((AliTRDdigitizer &) d).fTimeBinWidth = fTimeBinWidth;
+ ((AliTRDdigitizer &) d).fField = fField;
+ ((AliTRDdigitizer &) d).fPRFOn = fPRFOn;
+ ((AliTRDdigitizer &) d).fTRFOn = fTRFOn;
+
+ ((AliTRDdigitizer &) d).fCompress = fCompress;
+ ((AliTRDdigitizer &) d).fVerbose = fVerbose;
+ ((AliTRDdigitizer &) d).fSDigits = fSDigits;
+ ((AliTRDdigitizer &) d).fSDigitsScale = fSDigitsScale;
+
+ ((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).fTRFsmp) delete ((AliTRDdigitizer &) d).fTRFsmp;
((AliTRDdigitizer &) d).fTRFsmp = new Float_t[fTRFbin];
for (iBin = 0; iBin < fTRFbin; iBin++) {
fADCthreshold = 1;
// For the summable digits
- fSinRange = 1000000.;
- fSoutRange = 1000000.;
+ fSDigitsScale = 100.;
// The drift velocity (cm / mus)
fDriftVelocity = 1.5;
, 0.018451, 0.018282, 0.018113, 0.017947
, 0.017782, 0.017617, 0.017455, 0.017297 };
- //for (Int_t ipasa = 0; ipasa < kNpasa; ipasa++) {
- // time[ipasa] += 0.13;
- // time[ipasa] *= 0.5;
- //}
-
if (fTRFsmp) delete fTRFsmp;
fTRFsmp = new Float_t[fTRFbin];
// Connect the AliRoot file containing Geometry, Kine, and Hits
fInputFile = (TFile*) gROOT->GetListOfFiles()->FindObject(name);
if (!fInputFile) {
- printf("AliTRDdigitizer::Open -- ");
- printf("Open the ALIROOT-file %s.\n",name);
+ if (fVerbose > 0) {
+ printf("AliTRDdigitizer::Open -- ");
+ printf("Open the AliROOT-file %s.\n",name);
+ }
fInputFile = new TFile(name,"UPDATE");
}
else {
- printf("AliTRDdigitizer::Open -- ");
- printf("%s is already open.\n",name);
+ if (fVerbose > 0) {
+ printf("AliTRDdigitizer::Open -- ");
+ printf("%s is already open.\n",name);
+ }
}
gAlice = (AliRun*) fInputFile->Get("gAlice");
if (gAlice) {
- printf("AliTRDdigitizer::Open -- ");
- printf("AliRun object found on file.\n");
+ if (fVerbose > 0) {
+ printf("AliTRDdigitizer::Open -- ");
+ printf("AliRun object found on file.\n");
+ }
}
else {
printf("AliTRDdigitizer::Open -- ");
return kFALSE;
}
- return InitDetector();
+ if (InitDetector()) {
+ return MakeBranch();
+ }
+ else {
+ return kFALSE;
+ }
}
// Get the geometry
fGeo = fTRD->GetGeometry();
- printf("AliTRDdigitizer::InitDetector -- ");
- printf("Geometry version %d\n",fGeo->IsVersion());
+ if (fVerbose > 0) {
+ printf("AliTRDdigitizer::InitDetector -- ");
+ printf("Geometry version %d\n",fGeo->IsVersion());
+ }
// The magnetic field strength in Tesla
fField = 0.2 * gAlice->Field()->Factor();
+ // Create a digits manager
+ fDigitsManager = new AliTRDdigitsManager();
+ fDigitsManager->SetSDigits(fSDigits);
+ fDigitsManager->CreateArrays();
+ fDigitsManager->SetEvent(fEvent);
+ fDigitsManager->SetVerbose(fVerbose);
+
+ // The list for the input s-digits manager to be merged
+ fSDigitsManagerList = new TList();
+
ReInit();
return kTRUE;
}
//_____________________________________________________________________________
-Bool_t AliTRDdigitizer::SumSDigits()
+Bool_t AliTRDdigitizer::MakeBranch(const Char_t *file)
{
- //
- // Sums up the summable digits and creates final digits
- // Not yet implemented
+ //
+ // Create the branches for the digits array
//
- return kFALSE;
+ return fDigitsManager->MakeBranch(file);
}
AliTRDdataArrayI *digits = 0;
AliTRDdataArrayI *dictionary[kNDict];
- // Create a digits manager
- fDigits = new AliTRDdigitsManager();
-
// Create a container for the amplitudes
AliTRDsegmentArray *signalsArray
= new AliTRDsegmentArray("AliTRDdataArrayF",AliTRDgeometry::Ndet());
if (fTRFOn) {
timeTRDbeg = ((Int_t) (-fTRFlo / fGeo->GetTimeBinSize())) - 1;
timeTRDend = ((Int_t) ( fTRFhi / fGeo->GetTimeBinSize())) - 1;
- printf("AliTRDdigitizer::MakeDigits -- ");
- printf("Sample the TRF between -%d and %d\n",timeTRDbeg,timeTRDend);
+ if (fVerbose > 0) {
+ printf("AliTRDdigitizer::MakeDigits -- ");
+ printf("Sample the TRF between -%d and %d\n",timeTRDbeg,timeTRDend);
+ }
}
Float_t elAttachProp = fElAttachProp / 100.;
return kFALSE;
}
- printf("AliTRDdigitizer::MakeDigits -- ");
- printf("Start creating digits.\n");
- if (fVerbose > 0) this->Dump();
+ if (fVerbose > 0) {
+ printf("AliTRDdigitizer::MakeDigits -- ");
+ printf("Start creating digits.\n");
+ }
// Get the pointer to the hit tree
TTree *HitTree = gAlice->TreeH();
}
// The same for the dictionary
for (iDict = 0; iDict < kNDict; iDict++) {
- dictionary[iDict] = fDigits->GetDictionary(detector,iDict);
+ dictionary[iDict] = fDigitsManager->GetDictionary(detector,iDict);
if (dictionary[iDict]->GetNtime() == 0) {
dictionary[iDict]->Allocate(nRowMax,nColMax,nTimeTotal);
}
} // All hits finished
- printf("AliTRDdigitizer::MakeDigits -- ");
- printf("Finished analyzing %d hits\n",countHits);
+ if (fVerbose > 0) {
+ printf("AliTRDdigitizer::MakeDigits -- ");
+ printf("Finished analyzing %d hits\n",countHits);
+ }
// The total conversion factor
Float_t convert = kEl2fC * fPadCoupling * fTimeCoupling * fChipGain;
}
// Add a container for the digits of this detector
- digits = fDigits->GetDigits(iDet);
+ digits = fDigitsManager->GetDigits(iDet);
// Allocate memory space for the digits buffer
digits->Allocate(nRowMax,nColMax,nTimeTotal);
}
// Create the missing dictionary containers
for (iDict = 0; iDict < kNDict; iDict++) {
- dictionary[iDict] = fDigits->GetDictionary(iDet,iDict);
+ dictionary[iDict] = fDigitsManager->GetDictionary(iDet,iDict);
if (dictionary[iDict]->GetNtime() == 0) {
dictionary[iDict]->Allocate(nRowMax,nColMax,nTimeTotal);
}
if (fSDigits) {
Float_t signalAmp = signals->GetDataUnchecked(iRow,iCol,iTime);
- Int_t adc = 0;
- if (signalAmp >= fSinRange) {
- adc = ((Int_t) fSoutRange);
- }
- else {
- adc = ((Int_t) (signalAmp * (fSoutRange / fSinRange)));
- }
+ signalAmp *= fSDigitsScale;
+ signalAmp = TMath::Min(signalAmp,1.0e9);
+ Int_t adc = (Int_t) signalAmp;
nDigits++;
digits->SetDataUnchecked(iRow,iCol,iTime,adc);
totalSizeDict2 += dictionary[2]->GetSize();
Float_t nPixel = nRowMax * nColMax * nTimeMax;
- printf("AliTRDdigitizer::MakeDigits -- ");
- printf("Found %d digits in detector %d (%3.0f).\n"
- ,nDigits,iDet
- ,100.0 * ((Float_t) nDigits) / nPixel);
-
+ if (fVerbose > 0) {
+ printf("AliTRDdigitizer::MakeDigits -- ");
+ printf("Found %d digits in detector %d (%3.0f).\n"
+ ,nDigits,iDet
+ ,100.0 * ((Float_t) nDigits) / nPixel);
+ }
+
if (fCompress) signals->Compress(1,0);
}
- printf("AliTRDdigitizer::MakeDigits -- ");
- printf("Total number of analyzed hits = %d\n",countHits);
+ if (fVerbose > 0) {
+ 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
+ ,totalSizeDict1
+ ,totalSizeDict2);
+ }
+
+ return kTRUE;
+
+}
+
+//_____________________________________________________________________________
+void AliTRDdigitizer::AddSDigitsManager(AliTRDdigitsManager *man)
+{
+ //
+ // Add a digits manager for s-digits to the input list.
+ //
+
+ fSDigitsManagerList->Add(man);
+
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDdigitizer::ConvertSDigits()
+{
+ //
+ // Converts s-digits to normal digits
+ //
+
+ // Number of track dictionary arrays
+ const Int_t kNDict = AliTRDdigitsManager::kNDict;
+
+ // Converts number of electrons to fC
+ const Double_t kEl2fC = 1.602E-19 * 1.0E15;
+
+ Int_t iDict = 0;
+
+ if (fVerbose > 0) {
+ this->Dump();
+ }
+
+ Double_t sDigitsScale = 1.0 / GetSDigitsScale();
+ Double_t noise = GetNoise();
+ Double_t padCoupling = GetPadCoupling();
+ Double_t timeCoupling = GetTimeCoupling();
+ Double_t chipGain = GetChipGain();
+ Double_t convert = kEl2fC * padCoupling * timeCoupling * chipGain;;
+ Double_t adcInRange = GetADCinRange();
+ Double_t adcOutRange = GetADCoutRange();
+ Int_t adcThreshold = GetADCthreshold();
+
+ AliTRDdataArrayI *digitsIn;
+ AliTRDdataArrayI *digitsOut;
+ AliTRDdataArrayI *dictionaryIn[kNDict];
+ AliTRDdataArrayI *dictionaryOut[kNDict];
+
+ // Loop through the detectors
+ for (Int_t iDet = 0; iDet < AliTRDgeometry::Ndet(); iDet++) {
- printf("AliTRDdigitizer::MakeDigits -- ");
- printf("Total digits data size = %d, %d, %d, %d\n",totalSizeDigits
- ,totalSizeDict0
- ,totalSizeDict1
- ,totalSizeDict2);
+ if (fVerbose > 0) {
+ printf("AliTRDdigitizer::ConvertSDigits -- ");
+ printf("Convert detector %d to digits.\n",iDet);
+ }
+
+ Int_t plane = fGeo->GetPlane(iDet);
+ Int_t sector = fGeo->GetSector(iDet);
+ Int_t chamber = fGeo->GetChamber(iDet);
+ Int_t nRowMax = fGeo->GetRowMax(plane,chamber,sector);
+ Int_t nColMax = fGeo->GetColMax(plane);
+ Int_t nTimeTotal = fGeo->GetTimeTotal();
+
+ digitsIn = fSDigitsManager->GetDigits(iDet);
+ digitsIn->Expand();
+ digitsOut = fDigitsManager->GetDigits(iDet);
+ digitsOut->Allocate(nRowMax,nColMax,nTimeTotal);
+ for (iDict = 0; iDict < kNDict; iDict++) {
+ dictionaryIn[iDict] = fSDigitsManager->GetDictionary(iDet,iDict);
+ dictionaryIn[iDict]->Expand();
+ dictionaryOut[iDict] = fDigitsManager->GetDictionary(iDet,iDict);
+ dictionaryOut[iDict]->Allocate(nRowMax,nColMax,nTimeTotal);
+ }
+
+ for (Int_t iRow = 0; iRow < nRowMax; iRow++ ) {
+ for (Int_t iCol = 0; iCol < nColMax; iCol++ ) {
+ for (Int_t iTime = 0; iTime < nTimeTotal; iTime++) {
+
+ Double_t signal = (Double_t) digitsIn->GetDataUnchecked(iRow,iCol,iTime);
+ signal *= sDigitsScale;
+ // Add the noise
+ signal = TMath::Max((Double_t) gRandom->Gaus(signal,noise),0.0);
+ // Convert to mV
+ signal *= convert;
+ // Convert to ADC counts. Set the overflow-bit adcOutRange if the
+ // signal is larger than adcInRange
+ Int_t adc = 0;
+ if (signal >= adcInRange) {
+ adc = ((Int_t) adcOutRange);
+ }
+ else {
+ adc = ((Int_t) (signal * (adcOutRange / adcInRange)));
+ }
+ // Store the amplitude of the digit if above threshold
+ if (adc > adcThreshold) {
+ digitsOut->SetDataUnchecked(iRow,iCol,iTime,adc);
+ }
+ // Copy the dictionary
+ for (iDict = 0; iDict < kNDict; iDict++) {
+ Int_t track = dictionaryIn[iDict]->GetDataUnchecked(iRow,iCol,iTime);
+ dictionaryOut[iDict]->SetDataUnchecked(iRow,iCol,iTime,track);
+ }
+
+ }
+ }
+ }
+
+ if (fCompress) {
+ digitsIn->Compress(1,0);
+ digitsOut->Compress(1,0);
+ for (iDict = 0; iDict < kNDict; iDict++) {
+ dictionaryIn[iDict]->Compress(1,0);
+ dictionaryOut[iDict]->Compress(1,0);
+ }
+ }
+
+ }
return kTRUE;
}
//_____________________________________________________________________________
-Bool_t AliTRDdigitizer::Merge(TTree *trees, Int_t *mask, Int_t nin, Int_t event)
+Bool_t AliTRDdigitizer::MergeSDigits()
{
//
- // Merges the summable digits of different events
+ // Merges the input s-digits:
+ // - The amplitude of the different inputs are summed up.
+ // - Of the track IDs from the input dictionaries only one is
+ // kept for each input. This works for maximal 3 different merged inputs.
//
+ // Number of track dictionary arrays
+ const Int_t kNDict = AliTRDdigitsManager::kNDict;
+
+ Int_t iDict = 0;
+
+ AliTRDdataArrayI *digitsA;
+ AliTRDdataArrayI *digitsB;
+ AliTRDdataArrayI *dictionaryA[kNDict];
+ AliTRDdataArrayI *dictionaryB[kNDict];
+
+ // Get the first s-digits
+ fSDigitsManager = (AliTRDdigitsManager *) fSDigitsManagerList->First();
+ if (!fSDigitsManager) return kFALSE;
+
+ // Loop through the other sets of s-digits
+ AliTRDdigitsManager *mergeSDigitsManager;
+ mergeSDigitsManager = (AliTRDdigitsManager *)
+ fSDigitsManagerList->After(fSDigitsManager);
+
+ if (fVerbose > 0) {
+ if (mergeSDigitsManager) {
+ printf("AliTRDdigitizer::MergeSDigits -- ");
+ printf("Merge serveral input files.\n");
+ }
+ else {
+ printf("AliTRDdigitizer::MergeSDigits -- ");
+ printf("Only one input file.\n");
+ }
+ }
+
+ Int_t iMerge = 0;
+ while (mergeSDigitsManager) {
+
+ iMerge++;
+
+ // Loop through the detectors
+ for (Int_t iDet = 0; iDet < AliTRDgeometry::Ndet(); iDet++) {
+
+ Int_t plane = fGeo->GetPlane(iDet);
+ Int_t sector = fGeo->GetSector(iDet);
+ Int_t chamber = fGeo->GetChamber(iDet);
+ Int_t nRowMax = fGeo->GetRowMax(plane,chamber,sector);
+ Int_t nColMax = fGeo->GetColMax(plane);
+ Int_t nTimeTotal = fGeo->GetTimeTotal();
+
+ // Loop through the pixels of one detector and add the signals
+ digitsA = fSDigitsManager->GetDigits(iDet);
+ digitsB = mergeSDigitsManager->GetDigits(iDet);
+ digitsA->Expand();
+ digitsB->Expand();
+ for (iDict = 0; iDict < kNDict; iDict++) {
+ dictionaryA[iDict] = fSDigitsManager->GetDictionary(iDet,iDict);
+ dictionaryB[iDict] = mergeSDigitsManager->GetDictionary(iDet,iDict);
+ dictionaryA[iDict]->Expand();
+ dictionaryB[iDict]->Expand();
+ }
+
+ if (fVerbose > 0) {
+ printf("AliTRDdigitizer::MergeSDigits -- ");
+ printf("Merge detector %d of input no.%d.\n",iDet,iMerge);
+ }
+
+ for (Int_t iRow = 0; iRow < nRowMax; iRow++ ) {
+ for (Int_t iCol = 0; iCol < nColMax; iCol++ ) {
+ for (Int_t iTime = 0; iTime < nTimeTotal; iTime++) {
+
+ // Add the amplitudes of the summable digits
+ Int_t ampA = digitsA->GetDataUnchecked(iRow,iCol,iTime);
+ Int_t ampB = digitsB->GetDataUnchecked(iRow,iCol,iTime);
+ ampA += ampB;
+ digitsA->SetDataUnchecked(iRow,iCol,iTime,ampA);
+
+ // Take only one track from each input
+ Int_t track = dictionaryB[0]->GetDataUnchecked(iRow,iCol,iTime);
+ if (iMerge < kNDict) {
+ dictionaryA[iMerge]->SetDataUnchecked(iRow,iCol,iTime,track);
+ }
+
+ }
+ }
+ }
+
+ if (fCompress) {
+ digitsA->Compress(1,0);
+ digitsB->Compress(1,0);
+ for (iDict = 0; iDict < kNDict; iDict++) {
+ dictionaryA[iDict]->Compress(1,0);
+ dictionaryB[iDict]->Compress(1,0);
+ }
+ }
+
+ }
+
+ // The next set of s-digits
+ mergeSDigitsManager = (AliTRDdigitsManager *)
+ fSDigitsManagerList->After(mergeSDigitsManager);
+
+ }
+
return kTRUE;
}
+//_____________________________________________________________________________
+Bool_t AliTRDdigitizer::SDigits2Digits()
+{
+ //
+ // Merges the input s-digits and converts them to normal digits
+ //
+
+ if (!MergeSDigits()) return kFALSE;
+
+ return ConvertSDigits();
+
+}
+
//_____________________________________________________________________________
Bool_t AliTRDdigitizer::CheckDetector(Int_t plane, Int_t chamber, Int_t sector)
{
// Writes out the TRD-digits and the dictionaries
//
- // Create the branches
- if (!(gAlice->TreeD()->GetBranch("TRDdigits"))) {
- 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[15];
- sprintf(treeName,"TreeD%d",fEvent);
- printf("AliTRDdigitizer::WriteDigits -- ");
- printf("Write the digits tree %s for event %d.\n"
- ,treeName,fEvent);
- gAlice->TreeD()->Write(treeName,TObject::kOverwrite);
-
- return kTRUE;
+ return fDigitsManager->WriteDigits();
}
virtual void Copy(TObject &d);
virtual void Init();
+ virtual Bool_t InitDetector();
+ virtual void ReInit();
virtual Bool_t Open(const Char_t *name, Int_t nEvent = 0);
+ virtual Bool_t MakeBranch(const Char_t *file = 0);
virtual Bool_t MakeDigits();
- virtual Bool_t Merge(TTree *trees, Int_t *mask, Int_t nin, Int_t event);
- virtual void ReInit();
- virtual Bool_t SumSDigits();
+ virtual void AddSDigitsManager(AliTRDdigitsManager *man);
+ virtual Bool_t ConvertSDigits();
+ virtual Bool_t MergeSDigits();
+ virtual Bool_t SDigits2Digits();
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 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; };
+ virtual void SetSDigitsScale(Float_t s) { fSDigitsScale = s; };
virtual void SetEvent(Int_t v = 0) { fEvent = v; };
- virtual void SetManager(AliTRDdigitsManager *man) { fDigits = man; };
+ virtual void SetManager(AliTRDdigitsManager *man) { fDigitsManager = man; };
- AliTRDdigitsManager *Digits() const { return fDigits; };
+ AliTRDdigitsManager *Digits() const { return fDigitsManager; };
Float_t GetGasGain() const { return fGasGain; };
Float_t GetNoise() const { return fNoise; };
Float_t GetTimeCoupling() const { return fTimeCoupling; };
Bool_t GetCompress() const { return fCompress; };
Bool_t GetSDigits() const { return fSDigits; };
+ Float_t GetSDigitsScale() const { return fSDigitsScale; };
Float_t GetTimeBinWidth() const { return fTimeBinWidth; };
virtual Float_t GetDiffusionL(Float_t vd, Float_t b);
virtual Float_t GetDiffusionT(Float_t vd, Float_t b);
protected:
- TFile *fInputFile; //! ALIROOT-filename
- AliTRDdigitsManager *fDigits; //! TRD digits manager
- AliTRD *fTRD; //! TRD detector class
- AliTRDgeometry *fGeo; //! TRD geometry
+ TFile *fInputFile; //! ALIROOT-file
+ AliTRDdigitsManager *fDigitsManager; //! Manager for the output digits
+ AliTRDdigitsManager *fSDigitsManager; //! Manager for the summed input s-digits
+ TList *fSDigitsManagerList; //! List of managers of input s-digits
+ AliTRD *fTRD; //! TRD detector class
+ AliTRDgeometry *fGeo; //! TRD geometry
- Int_t fEvent; //! Event number
-
- Float_t fField; // Magnetic field
- Float_t fGasGain; // Gas gain
- Float_t fNoise; // Electronics noise
- 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 fDiffusionL; // Diffusion in longitudinal direction
- Int_t fElAttachOn; // Switch for the electron attachment
- Float_t fElAttachProp; // Propability for electron attachment (for 1m)
- Int_t fExBOn; // Switch for the ExB effects
- Float_t fOmegaTau; // Tangens of the Lorentz angle
- Float_t fLorentzFactor; // Factor due to Lorentz force
- Int_t fPRFOn; // Switch for the pad response
- Float_t *fPRFsmp; //!Sampled pad response
- Int_t fPRFbin; // Number of bins for the PRF
- Float_t fPRFlo; // Lower boundary of the PRF
- Float_t fPRFhi; // Higher boundary of the PRF
- Float_t fPRFwid; // Bin width of the sampled PRF
- Int_t fPRFpad; // Distance to next pad in PRF
- Int_t fTRFOn; // Switch for the time response
- Float_t *fTRFsmp; //!Integrated time response
- Int_t fTRFbin; // Number of bins for the TRF
- Float_t fTRFlo; // Lower boundary of the TRF
- 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
+ Int_t fEvent; //! Event number
+
+ Float_t fField; // Magnetic field
+ Float_t fGasGain; // Gas gain
+ Float_t fNoise; // Electronics noise
+ Float_t fChipGain; // Electronics gain
+ Float_t fADCoutRange; // ADC output range (number of channels)
+ Float_t fADCinRange; // ADC input range (input charge)
+ Int_t fADCthreshold; // ADC threshold in ADC channel
+ Int_t fDiffusionOn; // Switch for the diffusion
+ Float_t fDiffusionT; // Diffusion in transverse direction
+ Float_t fDiffusionL; // Diffusion in longitudinal direction
+ Int_t fElAttachOn; // Switch for the electron attachment
+ Float_t fElAttachProp; // Propability for electron attachment (for 1m)
+ Int_t fExBOn; // Switch for the ExB effects
+ Float_t fOmegaTau; // Tangens of the Lorentz angle
+ Float_t fLorentzFactor; // Factor due to Lorentz force
+ Int_t fPRFOn; // Switch for the pad response
+ Float_t *fPRFsmp; //! Sampled pad response
+ Int_t fPRFbin; // Number of bins for the PRF
+ Float_t fPRFlo; // Lower boundary of the PRF
+ Float_t fPRFhi; // Higher boundary of the PRF
+ Float_t fPRFwid; // Bin width of the sampled PRF
+ Int_t fPRFpad; // Distance to next pad in PRF
+ Int_t fTRFOn; // Switch for the time response
+ Float_t *fTRFsmp; //! Integrated time response
+ Int_t fTRFbin; // Number of bins for the TRF
+ Float_t fTRFlo; // Lower boundary of the TRF
+ 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
+ Float_t fSDigitsScale; // Scale factor for the summable digits
private:
virtual void SamplePRF();
virtual void SampleTRF();
- ClassDef(AliTRDdigitizer,4) // Produces TRD-Digits
+ ClassDef(AliTRDdigitizer,5) // Produces TRD-Digits
};
/*
$Log$
+Revision 1.13 2001/11/06 17:19:41 cblume
+Add detailed geometry and simple simulator
+
Revision 1.12 2001/05/16 14:57:28 alibrary
New files for folders and Stack
// Default constructor
//
- fIsRaw = kFALSE;
-
- fDigits = new AliTRDsegmentArray("AliTRDdataArrayI",AliTRDgeometry::Ndet());
+ fIsRaw = kFALSE;
+ fEvent = 0;
+ fVerbose = 0;
+ fSDigits = 0;
+ fFile = NULL;
+ fTree = NULL;
+ fDigits = NULL;
for (Int_t iDict = 0; iDict < kNDict; iDict++) {
- fDictionary[iDict] = new AliTRDsegmentArray("AliTRDdataArrayI"
- ,AliTRDgeometry::Ndet());
+ fDictionary[iDict] = NULL;
}
}
// AliTRDdigitsManager destructor
//
+ if (fFile) {
+ fFile->Close();
+ delete fFile;
+ fFile = NULL;
+ }
+
+ if (fTree) {
+ delete fTree;
+ fTree = NULL;
+ }
+
if (fDigits) {
fDigits->Delete();
delete fDigits;
+ fDigits = NULL;
}
for (Int_t iDict = 0; iDict < kNDict; iDict++) {
fDictionary[iDict]->Delete();
delete fDictionary[iDict];
+ fDictionary[iDict] = NULL;
}
}
// Copy function
//
- ((AliTRDdigitsManager &) m).fIsRaw = fIsRaw;
+ ((AliTRDdigitsManager &) m).fIsRaw = fIsRaw;
+ ((AliTRDdigitsManager &) m).fEvent = fEvent;
+ ((AliTRDdigitsManager &) m).fVerbose = fVerbose;
+ ((AliTRDdigitsManager &) m).fSDigits = fSDigits;
TObject::Copy(m);
}
+//_____________________________________________________________________________
+void AliTRDdigitsManager::CreateArrays()
+{
+ //
+ // Create the data arrays
+ //
+
+ fDigits = new AliTRDsegmentArray("AliTRDdataArrayI",AliTRDgeometry::Ndet());
+
+ for (Int_t iDict = 0; iDict < kNDict; iDict++) {
+ fDictionary[iDict] = new AliTRDsegmentArray("AliTRDdataArrayI"
+ ,AliTRDgeometry::Ndet());
+ }
+
+}
+
//_____________________________________________________________________________
void AliTRDdigitsManager::SetRaw()
{
}
//_____________________________________________________________________________
-Bool_t AliTRDdigitsManager::MakeBranch(char *file)
+Bool_t AliTRDdigitsManager::Open(const Char_t *name)
{
//
- // Creates the branches for the digits and the dictionary in the digits tree
+ // Opens the file for the TRD digits
+ //
+
+ fFile = (TFile*) gROOT->GetListOfFiles()->FindObject(name);
+ if (!fFile) {
+ if (fVerbose > 0) {
+ printf("AliTRDdigitsManager::Open -- ");
+ printf("Open the AliROOT-file %s.\n",name);
+ }
+ fFile = new TFile(name,"UPDATE");
+ if (!fFile) return kFALSE;
+ }
+ else {
+ if (fVerbose > 0) {
+ printf("AliTRDdigitsManager::Open -- ");
+ printf("%s is already open.\n",name);
+ }
+ }
+
+ return kTRUE;
+
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDdigitsManager::MakeBranch(const Char_t *file)
+{
+ //
+ // Creates the tree and branches for the digits and the dictionary
//
Int_t buffersize = 64000;
Bool_t status = kTRUE;
- //TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("TRD.Digits.root");
+ AliTRD *trd = (AliTRD *) gAlice->GetDetector("TRD") ;
- AliTRD * TRD = (AliTRD *) gAlice->GetDetector("TRD") ;
+ // Create the TRD digits tree
+ Char_t treeName[12];
+ if (fSDigits) {
+ sprintf(treeName,"TreeS%d_TRD",fEvent);
+ fTree = new TTree(treeName,"TRD SDigits");
+ }
+ else {
+ sprintf(treeName,"TreeD%d_TRD",fEvent);
+ fTree = new TTree(treeName,"TRD Digits");
+ }
- if (gAlice->TreeD()) {
+ if (fVerbose > 0) {
+ printf("AliTRDdigitsManager::MakeBranch -- ");
+ printf("Creating tree %s\n",treeName);
+ }
- // Make the branch for the digits
- if (fDigits) {
- const AliTRDdataArray *kDigits =
- (AliTRDdataArray *) fDigits->At(0);
- if (kDigits) {
- TRD->MakeBranchInTree(gAlice->TreeD(),
- "TRDdigits", kDigits->IsA()->GetName(),
- &kDigits,buffersize, 1,file);
+ // Make the branch for the digits
+ if (fDigits) {
+ const AliTRDdataArray *kDigits = (AliTRDdataArray *) fDigits->At(0);
+ if (kDigits) {
+ trd->MakeBranchInTree(fTree,"TRDdigits",kDigits->IsA()->GetName()
+ ,&kDigits,buffersize,99,file);
+ if (fVerbose > 0) {
printf("AliTRDdigitsManager::MakeBranch -- ");
printf("Making branch TRDdigits\n");
}
- else {
- status = kFALSE;
- }
}
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 *kDictionary =
- (AliTRDdataArray *) fDictionary[iDict]->At(0);
- if (kDictionary) {
- TRD->MakeBranchInTree(gAlice->TreeD(),
- branchname,kDictionary->IsA()->GetName(),
- &kDictionary,buffersize, 1,file);
+ // 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 *kDictionary =
+ (AliTRDdataArray *) fDictionary[iDict]->At(0);
+ if (kDictionary) {
+ trd->MakeBranchInTree(fTree,branchname,kDictionary->IsA()->GetName()
+ ,&kDictionary,buffersize,99,file);
+ if (fVerbose > 0) {
printf("AliTRDdigitsManager::MakeBranch -- ");
printf("Making branch %s\n",branchname);
}
- else {
- status = kFALSE;
- }
}
else {
status = kFALSE;
}
}
-
- }
- else {
- status = kFALSE;
+ else {
+ status = kFALSE;
+ }
}
return status;
Bool_t status = kTRUE;
- status = fDigits->LoadArray("TRDdigits");
+ // Get the digits tree
+ Char_t treeName[12];
+ if (fSDigits) {
+ sprintf(treeName,"TreeS%d_TRD",fEvent);
+ }
+ else {
+ sprintf(treeName,"TreeD%d_TRD",fEvent);
+ }
+ if (fFile) {
+ fTree = (TTree *) fFile->Get(treeName);
+ }
+ else {
+ fTree = (TTree *) gDirectory->Get(treeName);
+ }
+ if (!fTree) {
+ if (fVerbose > 0) {
+ printf("AliTRDdigitsManager::ReadDigits -- ");
+ printf("Could not find tree %s.\n",treeName);
+ }
+ return kFALSE;
+ }
+
+ if (!fDigits) {
+ if (fVerbose > 0) {
+ printf("AliTRDdigitsManager::ReadDigits -- ");
+ printf("Create the data arrays.\n");
+ }
+ CreateArrays();
+ }
+
+ status = fDigits->LoadArray("TRDdigits",fTree);
for (Int_t iDict = 0; iDict < kNDict; iDict++) {
Char_t branchname[15];
sprintf(branchname,"TRDdictionary%d",iDict);
- status = fDictionary[iDict]->LoadArray(branchname);
+ status = fDictionary[iDict]->LoadArray(branchname,fTree);
}
if (fDigits->TestBit(AliTRDdigit::RawDigit())) {
// Writes out the TRD-digits and the dictionaries
//
- // Create the branches
- if (!(gAlice->TreeD()->GetBranch("TRDdigits"))) {
- printf("AliTRDdigitsManager::WriteDigits -- ");
- printf("Call MakeBranch\n");
- if (!MakeBranch()) return kFALSE;
- }
-
// Store the contents of the segment array in the tree
- if (!fDigits->StoreArray("TRDdigits")) {
+ if (!fDigits->StoreArray("TRDdigits",fTree)) {
printf("AliTRDdigitsManager::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)) {
+ if (!fDictionary[iDict]->StoreArray(branchname,fTree)) {
printf("AliTRDdigitsManager::WriteDigits -- ");
printf("Error while storing dictionary in branch %s\n",branchname);
return kFALSE;
}
}
+ // Write the new tree to the output file
+ fTree->Write();
+
return kTRUE;
}
#include <TObject.h>
class TFile;
+class TTree;
class AliTRDsegmentArray;
class AliTRDdataArrayI;
virtual ~AliTRDdigitsManager();
AliTRDdigitsManager &operator=(const AliTRDdigitsManager &m);
+ virtual void CreateArrays();
virtual void Copy(TObject &m);
- virtual Bool_t MakeBranch(char *file=0);
+ virtual Bool_t Open(const Char_t *name);
+ virtual Bool_t MakeBranch(const Char_t *file = 0);
virtual Bool_t ReadDigits();
virtual Bool_t WriteDigits();
virtual void SetRaw();
+ virtual void SetEvent(Int_t evt) { fEvent = evt; };
+ virtual void SetVerbose(Int_t v = 1) { fVerbose = v; };
+ virtual void SetSDigits(Int_t v = 1) { fSDigits = v; };
virtual Bool_t IsRaw() const { return fIsRaw; };
static Int_t NDict() { return fgkNDict; };
static const Int_t fgkNDict; // Number of track dictionary arrays
- AliTRDsegmentArray *fDigits; //! Digits data Array
+ Int_t fEvent; // Event number
+
+ TFile *fFile; //! File containing the TRD digits tree
+ TTree *fTree; //! Tree for the digits arrays
+
+ AliTRDsegmentArray *fDigits; //! Digits data array
AliTRDsegmentArray *fDictionary[kNDict]; //! Track dictionary data array
Bool_t fIsRaw; // Flag indicating raw digits
+ Bool_t fSDigits; // Switch for the summable digits
+ Int_t fVerbose; // Verbose flag
- ClassDef(AliTRDdigitsManager,1) // Manages the TRD digits
+ ClassDef(AliTRDdigitsManager,3) // Manages the TRD digits
};
/*
$Log$
+Revision 1.2 2001/11/06 17:19:41 cblume
+Add detailed geometry and simple simulator
+
Revision 1.1 2001/05/07 08:08:05 cblume
Update of TRD code
fPIDindexMin = 0;
fPIDindexMax = 0;
+ fEvent = 0;
+
fThreePadOnly = kFALSE;
}
fGeometry = NULL;
fFileKine = NULL;
+ fEvent = 0;
+
Init();
}
if (fClusterArray) {
fClusterArray->Delete();
delete fClusterArray;
+ fClusterArray = NULL;
}
if (fTrackArray) {
fTrackArray->Delete();
delete fTrackArray;
+ fTrackArray = NULL;
}
fFileKine->Close();
((AliTRDpid &) p).fPIDindexMin = fPIDindexMin;
((AliTRDpid &) p).fPIDindexMax = fPIDindexMax;
((AliTRDpid &) p).fThreePadOnly = fThreePadOnly;
+ ((AliTRDpid &) p).fEvent = fEvent;
}
return kFALSE;
}
+ fEvent = event;
+
return kTRUE;
}
}
}
- TTree *trackTree = (TTree *) file->Get("TreeT");
+ Char_t treeName[12];
+ sprintf(treeName,"TreeT%d_TRD",fEvent);
+ TTree *trackTree = (TTree *) file->Get(treeName);
TBranch *trackBranch = trackTree->GetBranch("tracks");
Int_t nEntry = ((Int_t) trackTree->GetEntries());
void SetPIDindexMax(Int_t max) { fPIDindexMax = max; };
void SetThreePadOnly(Bool_t only) { fThreePadOnly = only; };
+ void SetEvent(Int_t event) { fEvent = event; };
TObjArray *GetTrackArray() { return fTrackArray; };
TObjArray *GetClusterArray() { return fClusterArray; };
Bool_t fThreePadOnly; // Use only three pad cluster in the charge sum
+ Int_t fEvent; // Event number
+
TObjArray *fTrackArray; //! Array containing the tracks
TObjArray *fClusterArray; //! Array containing the cluster
AliTRDgeometry *fGeometry; //! The TRD geometry
/*
$Log$
+Revision 1.7 2001/03/13 09:30:35 cblume
+Update of digitization. Moved digit branch definition to AliTRD
+
Revision 1.6 2000/11/01 14:53:21 cblume
Merge with TRD-develop
}
//_____________________________________________________________________________
-Bool_t AliTRDsegmentArray::LoadArray(const Char_t *branchname)
+Bool_t AliTRDsegmentArray::LoadArray(const Char_t *branchname, TTree *tree)
{
//
// Loads all segments of the array from the branch <branchname> of
- // the digits tree
+ // the digits tree <tree>
//
- // Connect the digits tree
- fTree = gAlice->TreeD();
- if (!fTree) return kFALSE;
+ fTree = tree;
+
+ // Connect the digits tree as default
+ if (!fTree) {
+ printf("AliTRDsegmentArray::LoadArray -- ");
+ printf("Use default TreeD\n");
+ fTree = gAlice->TreeD();
+ if (!fTree) return kFALSE;
+ }
// Get the branch
fBranch = fTree->GetBranch(branchname);
}
//_____________________________________________________________________________
-Bool_t AliTRDsegmentArray::StoreArray(const Char_t *branchname)
+Bool_t AliTRDsegmentArray::StoreArray(const Char_t *branchname, TTree *tree)
{
//
// Stores all segments of the array in the branch <branchname> of
- // the digits tree
+ // the digits tree <tree>
//
- // Connect the digits tree
- fTree = gAlice->TreeD();
- if (!fTree) return kFALSE;
+ fTree = tree;
+
+ // Connect the digits tree as default
+ if (!fTree) {
+ printf("AliTRDsegmentArray::StoreArray -- ");
+ printf("Use default TreeD\n");
+ fTree = gAlice->TreeD();
+ if (!fTree) return kFALSE;
+ }
// Get the branch
fBranch = fTree->GetBranch(branchname);
// Array for TRD detector segments containing digits //
////////////////////////////////////////////////////////
+class TTree;
+
class AliTRDdataArray;
//_____________________________________________________________________________
virtual void Delete();
virtual void Delete(const char *) { Delete(); };
- virtual Bool_t LoadArray(const Char_t *branchname);
- virtual Bool_t StoreArray(const Char_t *branchname);
+ virtual Bool_t LoadArray(const Char_t *branchname, TTree *tree = 0);
+ virtual Bool_t StoreArray(const Char_t *branchname, TTree *tree = 0);
virtual AliTRDdataArray *GetDataArray(Int_t det) const;
virtual AliTRDdataArray *GetDataArray(Int_t sec, Int_t cha, Int_t pla) const;
/*
$Log$
+Revision 1.10 2001/05/31 16:53:26 alibrary
+Correction to the destructor
+
Revision 1.9 2001/05/21 16:45:47 hristov
Last minute changes (C.Blume)
if (fSpectrum) delete fSpectrum;
fSpectrum = new TH1D("TRspectrum","TR spectrum",fSpNBins,fSpLower,fSpUpper);
+ fSpectrum->SetDirectory(0);
// Set the sigma values
SetSigma();
/*
$Log$
+Revision 1.13 2001/05/30 12:17:47 hristov
+Loop variables declared once
+
Revision 1.12 2001/05/28 17:07:58 hristov
Last minute changes; ExB correction in AliTRDclusterizerV1; taking into account of material in G10 TEC frames and material between TEC planes (C.Blume,S.Sedykh)
TFile *file = TFile::Open(filename);
if (!file->IsOpen()) {printf("Can't open file %s !\n",filename); return;}
- TTree *ClusterTree = (TTree*)file->Get("ClusterTree");
+ Char_t treeName[12];
+ sprintf(treeName,"TreeR%d_TRD",fEvent);
+ TTree *ClusterTree = (TTree*) file->Get(treeName);
TObjArray *ClusterArray = new TObjArray(400);
printf("%s is already open.\n",filename);
}
- TTree tracktree("TreeT","Tree with TRD tracks");
+ Char_t treeName[12];
+ sprintf(treeName,"TreeT%d_TRD",fEvent);
+ TTree tracktree(treeName,"Tree with TRD tracks");
AliTRDtrack *iotrack=0;
tracktree.Branch("tracks","AliTRDtrack",&iotrack,32000,0);