1 Int_t AliTRDanalyzeDigits()
9 const Int_t kNpla = AliTRDgeometry::Nplan();
12 cout << "<AliTRDanalyzeDigits> No AliRun object found" << endl;
16 Int_t nPart = gAlice->GetEvent(0);
18 // Get the pointer to the TRD detector
19 AliTRD *TRD = (AliTRD *) gAlice->GetDetector("TRD");
21 cout << "<AliTRDanalyzeDigits> No TRD detector found" << endl;
26 // Get the digitizer object
27 TFile *file = (TFile *) gROOT->GetListOfFiles()->FindObject("TRD_test.root");
28 AliTRDdigitizer *Digitizer = (AliTRDdigitizer *) file->Get("digitizer");
30 cout << "<AliTRDanalyzeDigits> No digitizer object found" << endl;
35 // Define the histograms
36 Int_t adcRange = ((Int_t) Digitizer->GetADCoutRange());
37 TH1F *hAmpAll = new TH1F("hAmpAll" ,"Amplitude of the digits (all)"
38 ,adcRange+1,-0.5,((Float_t) adcRange)+0.5);
39 TH1F *hAmpEl = new TH1F("hAmpEl" ,"Amplitude of the digits (electrons)"
40 ,adcRange+1,-0.5,((Float_t) adcRange)+0.5);
41 TH1F *hAmpPi = new TH1F("hAmpPi" ,"Amplitude of the digits (pions)"
42 ,adcRange+1,-0.5,((Float_t) adcRange)+0.5);
43 TH1F *hAmpNoise = new TH1F("hAmpNoise","Amplitude of the digits (noise)"
46 // Get the pointer to the geometry object
47 AliTRDgeometry *TRDgeometry;
49 TRDgeometry = TRD->GetGeometry();
52 cout << "<AliTRDanalyzeDigits> No TRD geometry found" << endl;
57 // Create the digits manager
58 AliTRDdigitsManager *DigitsManager = new AliTRDdigitsManager();
60 // Read the digits from the file
61 if (!(DigitsManager->ReadDigits())) {
62 cout << "<AliTRDanalyzeDigits> Cannot read the digits" << endl;
67 AliTRDmatrix *TRDmatrix;
69 Int_t countDigits = 0;
70 Int_t iSec = TRD->GetSensSector();
71 Int_t iCha = TRD->GetSensChamber();
72 Int_t timeMax = TRDgeometry->GetTimeTotal();
74 TProfile *hAmpTimeEl = new TProfile("hAmpTimeEl","Amplitude of the digits (electrons)"
75 ,timeMax,-0.5,((Double_t) timeMax)-0.5);
76 TProfile *hAmpTimePi = new TProfile("hAmpTimePi","Amplitude of the digits (pions)"
77 ,timeMax,-0.5,((Double_t) timeMax)-0.5);
79 // Loop over all planes
80 for (Int_t iPla = 0; iPla < kNpla; iPla++) {
82 Int_t iDet = TRDgeometry->GetDetector(iPla,iCha,iSec);
83 Int_t rowMax = TRDgeometry->GetRowMax(iPla,iCha,iSec);
84 Int_t colMax = TRDgeometry->GetColMax(iPla);
87 TRDmatrix = new AliTRDmatrix(rowMax,colMax,timeMax,iSec,iCha,iPla);
90 // Loop through the detector pixel
91 for (Int_t time = 0; time < timeMax; time++) {
92 for (Int_t col = 0; col < colMax; col++) {
93 for (Int_t row = 0; row < rowMax; row++) {
95 AliTRDdigit *Digit = DigitsManager->GetDigit(row,col,time,iDet);
96 Int_t amp = Digit->GetAmp();
98 Int_t track0 = DigitsManager->GetTrack(0,row,col,time,iDet);
99 Int_t track1 = DigitsManager->GetTrack(1,row,col,time,iDet);
102 Part = gAlice->Particle(track0);
108 TRDmatrix->SetSignal(row,col,time,amp);
117 hAmpNoise->Fill(amp);
121 if ((Part) && (Part->GetPdgCode() == 11) && (track1 < 0)) {
123 hAmpTimeEl->Fill(time,amp);
127 if ((Part) && (Part->GetPdgCode() == -211) && (track1 < 0)) {
129 hAmpTimePi->Fill(time,amp);
140 cout << "<AliTRDanalyzeDigits> Found " << countDigits << " digits in total" << endl;
142 // Display the detector matrix
144 TRDmatrix->ProjRow();
145 TRDmatrix->ProjCol();
146 TRDmatrix->ProjTime();
148 TCanvas *cDigits = new TCanvas("cDigits","AliTRDanalyzeDigits",50,50,600,800);
149 cDigits->Divide(2,3);
152 hAmpAll->SetXTitle("Amplitude (ADC-channels)");
153 hAmpAll->SetYTitle("Entries");
157 hAmpNoise->SetXTitle("Amplitude (ADC-channels)");
158 hAmpNoise->SetYTitle("Entries");
162 hAmpEl->SetXTitle("Amplitude (ADC-channels)");
163 hAmpEl->SetYTitle("Entries");
167 hAmpPi->SetXTitle("Amplitude (ADC-channels)");
168 hAmpPi->SetYTitle("Entries");
171 hAmpTimeEl->SetXTitle("Timebin number");
172 hAmpTimeEl->SetYTitle("Mean amplitude");
173 hAmpTimeEl->Draw("HIST");
175 hAmpTimePi->SetXTitle("Timebin number");
176 hAmpTimePi->SetYTitle("Mean amplitude");
177 hAmpTimePi->Draw("HIST");
179 TFile *fileOut = new TFile("digits_test.root","RECREATE");