--- /dev/null
+Int_t AliTRDanalyzeCluster()
+{
+ //
+ // Analyzes the cluster
+ //
+
+ Int_t rc = 0;
+
+ if (!gAlice) {
+ cout << "<AliTRDanalyzeCluster> No AliRun object found" << endl;
+ rc = 1;
+ return rc;
+ }
+ gAlice->GetEvent(0);
+
+ // Get the pointer to the TRD detector
+ AliTRD *TRD = (AliTRD *) gAlice->GetDetector("TRD");
+ if (!TRD) {
+ cout << "<AliTRDanalyzeCluster> No TRD detector found" << endl;
+ rc = 2;
+ return rc;
+ }
+
+ // Define the histograms
+ TH1F *hClusAll = new TH1F("hClusAll" ,"Amplitude of the cluster (all)" ,501,-0.5,500.5);
+ TH1F *hClusNoise = new TH1F("hClusNoise","Amplitude of the cluster (noise)" ,501,-0.5,500.5);
+ TH1F *hClusEl = new TH1F("hClusEl" ,"Amplitude of the cluster (electron)",501,-0.5,500.5);
+ TH1F *hClusPi = new TH1F("hClusPi" ,"Amplitude of the cluster (pion)" ,501,-0.5,500.5);
+
+ // Get the pointer to the geometry object
+ AliTRDgeometry *TRDgeometry;
+ if (TRD) {
+ TRDgeometry = TRD->GetGeometry();
+ }
+ else {
+ cout << "<AliTRDanalyzeCluster> No TRD geometry found" << endl;
+ rc = 3;
+ return rc;
+ }
+
+ // Get the pointer to the hit-tree
+ TFile *file = (TFile *) gROOT->GetListOfFiles()->FindObject("TRD_test.root");
+ TTree *RecTree = file->Get("ClusterTree");
+ if (!(RecTree)) {
+ cout << "<AliTRDanalyzeCluster> No tree with rec. points found" << endl;
+ rc = 4;
+ return rc;
+ }
+
+ // Get the pointer to the hit container
+ TObjArray *RecPointArray = TRD->RecPoints();
+ if (!(RecPointArray)) {
+ cout << "<AliTRDanalyzeCluster> No RecPointArray found" << endl;
+ rc = 5;
+ return rc;
+ }
+
+ // Set the branch address
+ RecTree->GetBranch("TRDrecPoints")->SetAddress(&RecPointArray);
+ Int_t nEntries = RecTree->GetEntries();
+ cout << "Number of entries in the rec. point tree = " << nEntries << endl;
+
+ Int_t countCluster = 0;
+
+ // Loop through all entries in the tree
+ Int_t nbytes;
+ for (Int_t iEntry = 0; iEntry < nEntries; iEntry++) {
+
+ // Import the tree
+ nbytes += RecTree->GetEvent(iEntry);
+
+ // Get the number of points in the detector
+ Int_t nRecPoint = RecPointArray->GetEntriesFast();
+
+ // Loop through all TRD digits
+ for (Int_t iRecPoint = 0; iRecPoint < nRecPoint; iRecPoint++) {
+
+ // Get the information for this digit
+ AliTRDrecPoint *RecPoint = (AliTRDrecPoint *) RecPointArray->UncheckedAt(iRecPoint);
+ Int_t detector = RecPoint->GetDetector();
+ Int_t sector = TRDgeometry->GetSector(detector);
+ Int_t plane = TRDgeometry->GetPlane(detector);
+ Int_t chamber = TRDgeometry->GetChamber(detector);
+ Int_t energy = RecPoint->GetEnergy();
+ TVector3 pos;
+ RecPoint->GetLocalPosition(pos);
+ Int_t track0 = RecPoint->GetTrackIndex(0);
+ Int_t track1 = RecPoint->GetTrackIndex(1);
+ TParticle *Part = 0;
+ if (track0 > -1) {
+ Part = gAlice->Particle(track0);
+ }
+
+ countCluster++;
+
+ // Total spectrum
+ hClusAll->Fill((Float_t) energy);
+
+ // Noise spectrum
+ if (track0 < 0) {
+ hClusNoise->Fill((Float_t) energy);
+ }
+
+ // Electron cluster
+ if ((Part) && (Part->GetPdgCode() == 11) && (track1 < 0)) {
+ hClusEl->Fill((Float_t) energy);
+ }
+
+ // Pion cluster
+ if ((Part) && (Part->GetPdgCode() == -211) && (track1 < 0)) {
+ hClusPi->Fill((Float_t) energy);
+ }
+
+ }
+
+ }
+
+ cout << "<AliTRDanalyzeCluster> Found " << countCluster << " cluster in total" << endl;
+
+ TCanvas *cCluster = new TCanvas("cCluster","AliTRDanalyzeCluster",50,50,600,600);
+ cCluster->Divide(2,2);
+
+ TF1 *fun;
+ cCluster->cd(1);
+ gPad->SetLogy();
+ hClusAll->Fit("landau","0");
+ fun = (TF1 *) hClusAll->GetListOfFunctions()->First();
+ Float_t meanAll = fun->GetParameter(1);
+ hClusAll->Draw();
+ fun->SetLineColor(2);
+ fun->Draw("SAME");
+
+ cCluster->cd(2);
+ gPad->SetLogy();
+ gPad->SetLogx();
+ Float_t meanNoise = hClusNoise->GetMean();
+ hClusNoise->Draw();
+
+ cCluster->cd(3);
+ gPad->SetLogy();
+ hClusEl->Fit("landau","0");
+ fun = (TF1 *) hClusEl->GetListOfFunctions()->First();
+ fun->SetLineColor(2);
+ Float_t meanEl = fun->GetParameter(1);
+ hClusEl->Draw();
+ fun->Draw("SAME");
+
+ cCluster->cd(4);
+ gPad->SetLogy();
+ hClusPi->Fit("landau","0");
+ fun = (TF1 *) hClusPi->GetListOfFunctions()->First();
+ fun->SetLineColor(2);
+ Float_t meanPi = fun->GetParameter(1);
+ hClusPi->Draw();
+ fun->Draw("SAME");
+
+ cout << endl;
+ cout << "##################################################################" << endl;
+ cout << " Mean all = " << meanAll << endl;
+ cout << " Mean noise = " << meanNoise << endl;
+ cout << " Mean electrons = " << meanEl << endl;
+ cout << " Mean pions = " << meanPi << endl;
+ cout << "##################################################################" << endl;
+ cout << endl;
+
+ return rc;
+
+}
rc = 1;
return rc;
}
- gAlice->GetEvent(0);
+ Int_t nPart = gAlice->GetEvent(0);
// Get the pointer to the TRD detector
AliTRD *TRD = (AliTRD *) gAlice->GetDetector("TRD");
return rc;
}
+ // Get the digitizer object
+ TFile *file = (TFile *) gROOT->GetListOfFiles()->FindObject("TRD_test.root");
+ AliTRDdigitizer *Digitizer = (AliTRDdigitizer *) file->Get("digitizer");
+ if (!Digitizer) {
+ cout << "<AliTRDanalyzeDigits> No digitizer object found" << endl;
+ rc = 3;
+ return rc;
+ }
+
// Define the histograms
- TH1F *hAmp = new TH1F("hAmp","Amplitude of the digits",256,-0.5,255.5);
+ 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)"
+ ,adcRange+1,-0.5,((Float_t) adcRange)+0.5);
+ TH1F *hAmpPi = new TH1F("hAmpPi" ,"Amplitude of the digits (pions)"
+ ,adcRange+1,-0.5,((Float_t) adcRange)+0.5);
+ TH1F *hAmpNoise = new TH1F("hAmpNoise","Amplitude of the digits (noise)"
+ ,adcRange+1,-0.5,((Float_t) adcRange)+0.5);
// Get the pointer to the geometry object
AliTRDgeometry *TRDgeometry;
}
else {
cout << "<AliTRDanalyzeDigits> No TRD geometry found" << endl;
- rc = 3;
+ rc = 4;
return rc;
}
// Read the digits from the file
if (!(DigitsManager->ReadDigits())) {
cout << "<AliTRDanalyzeDigits> Cannot read the digits" << endl;
- rc = 4;
+ rc = 5;
return rc;
}
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;
+ if (track0 > -1) {
+ Part = gAlice->Particle(track0);
+ }
+
if (amp > 0) {
+
countDigits++;
- hAmp->Fill(amp);
TRDmatrix->SetSignal(row,col,time,amp);
+
+ }
+
+ // Total spectrum
+ hAmpAll->Fill(amp);
+
+ // Noise spectrum
+ if (track0 < 0) {
+ hAmpNoise->Fill(amp);
+ }
+
+ // Electron digit
+ if ((Part) && (Part->GetPdgCode() == 11) && (track1 < 0)) {
+ hAmpEl->Fill(amp);
+ }
+
+ // Pion digit
+ if ((Part) && (Part->GetPdgCode() == -211) && (track1 < 0)) {
+ hAmpPi->Fill(amp);
}
delete Digit;
TRDmatrix->ProjTime();
TCanvas *cDigits = new TCanvas("cDigits","AliTRDanalyzeDigits",50,50,600,600);
+ cDigits->Divide(2,2);
+ cDigits->cd(1);
+ gPad->SetLogy();
+ hAmpAll->Draw();
+ cDigits->cd(2);
+ gPad->SetLogy();
+ gPad->SetLogx();
+ hAmpNoise->Draw();
+ cDigits->cd(3);
+ gPad->SetLogy();
+ hAmpEl->Draw();
+ cDigits->cd(4);
gPad->SetLogy();
- hAmp->Draw();
+ hAmpPi->Draw();
return rc;
Float_t z = hit->Z();
Float_t q = hit->GetCharge();
- if (q > 0)
+ if (q > 0) {
hQdedx->Fill(q);
- else
+ }
+ else if (q < 0) {
hQtr->Fill(TMath::Abs(q));
+ }
hZY->Fill(z,y);
hXZ->Fill(x,z);
// ************* STEERING parameters FOR ALICE SIMULATION **************
// --- Specify event type to be tracked through the ALICE setup
// --- All positions are in cm, angles in degrees, and P and E in GeV
- //AliGenHIJINGpara *gener = new AliGenHIJINGpara(250);
- AliGenBox *gener = new AliGenBox(100);
- gener->SetMomentumRange(1.0,3.0);
- gener->SetPhiRange(80.0,100.0);
- gener->SetThetaRange(70.0,110.0);
- gener->SetPart(11); // Only electrons
- gener->SetOrigin(0,0,0); // Vertex position
- gener->SetSigma(0,0,0); // Sigma in (X,Y,Z) (cm) on IP position
+
+ AliGenCocktail *gener = new AliGenCocktail();
+
+ AliGenBox *genEl = new AliGenBox(100);
+ genEl->SetOrigin(0,0,0); // Vertex position
+ genEl->SetSigma(0,0,0); // Sigma in (X,Y,Z) (cm) on IP position
+ genEl->SetPart(11); // Only electrons
+
+ AliGenBox *genPi = new AliGenBox(100);
+ genPi->SetOrigin(0,0,0); // Vertex position
+ genPi->SetSigma(0,0,0); // Sigma in (X,Y,Z) (cm) on IP position
+ genPi->SetPart(-211); // Only pions
+
+ gener->AddGenerator(genEl,"Electrons",1);
+ gener->AddGenerator(genPi,"Pions" ,1);
+
+ AliGenerator *gg = gener->FirstGenerator()->Generator();
+ gg->SetMomentumRange(1.0,3.0);
+ gg->SetPhiRange(75.0,95.0);
+ gg->SetThetaRange(70.0,110.0);
+ gg = gener->NextGenerator()->Generator();
+ gg->SetMomentumRange(2.5,3.0);
+ gg->SetPhiRange(75.0,95.0);
+ gg->SetThetaRange(70.0,110.0);
+
gener->Init();
- //Specify maximum magnetic field in Tesla (neg. ==> default field)
- gAlice->SetField(-999,2);
+ // Specify maximum magnetic field in Tesla (neg. ==> default field)
+ // 0.4 T
+ gAlice->SetField(-999,2,2.0);
Int_t iMAG = 1;
Int_t iITS = 1;
TRD->SetSensChamber(2);
TRD->SetSensSector(13);
+ // Get the pointer to the geometry object
+ AliTRDgeometry *TRDgeometry = TRD->GetGeometry();
+
+ // The number of timebins
+ TRDgeometry->SetNTimeBin(15);
+
// Select the gas mixture (0: 97% Xe + 3% isobutane, 1: 90% Xe + 10% CO2)
TRD->SetGasMix(1);
--- /dev/null
+Int_t AliTRDcreateCluster()
+{
+ //
+ // Creates the cluster from the digits
+ //
+
+ Int_t rc = 0;
+
+ // Create the clusterizer
+ AliTRDclusterizerV1 *Clusterizer =
+ new AliTRDclusterizerV1("clusterizer","Clusterizer class");
+
+ // Set the parameter
+ Clusterizer->SetClusMaxThresh(0.0);
+ Clusterizer->SetClusSigThresh(0.0);
+ Clusterizer->Dump();
+
+ // Open the file
+ if (!(Clusterizer->Open("TRD_test.root",0))) {
+ rc = 1;
+ return rc;
+ }
+
+ // Load the digits
+ if (!(Clusterizer->ReadDigits())) {
+ rc = 2;
+ return rc;
+ }
+
+ // Find the cluster
+ if (!(Clusterizer->MakeClusters())) {
+ rc = 3;
+ return rc;
+ }
+
+ // Write the cluster tree into the file
+ if (!(Clusterizer->WriteClusters(-1))) {
+ rc = 4;
+ return rc;
+ }
+
+ // Save the clusterizer class in the file
+ if (!(Clusterizer->Write())) {
+ rc = 5;
+ return rc;
+ }
+
+ return rc;
+
+}
// Create the TRD digitzer
AliTRDdigitizer *Digitizer = new AliTRDdigitizer("digitizer","Digitizer class");
- // Set the parameter
- Digitizer->SetDiffusion();
+ // Set the parameter
+ Digitizer->SetGasGain(3300.);
+ Digitizer->SetChipGain(8.0);
+ Digitizer->SetNoise(1000.);
+ Digitizer->SetADCinRange(1000.);
+ Digitizer->SetADCoutRange(1023.);
+ Digitizer->SetADCthreshold(0);
Digitizer->SetVerbose(1);
// Create the digits
gROOT->LoadMacro("$(ALICE_ROOT)/TRD/AliTRDanalyzeDigits.C");
if (rc = AliTRDanalyzeDigits()) return rc;
+ // Create the cluster
+ gROOT->LoadMacro("$(ALICE_ROOT)/TRD/AliTRDcreateCluster.C");
+ if (rc = AliTRDcreateCluster()) return rc;
+
+ if (gAlice) delete gAlice;
+ TFile *file = (TFile *) gROOT->GetListOfFiles()->FindObject("TRD_test.root");
+ gAlice = (AliRun *) file->Get("gAlice");
+
+ // Analyze the digits
+ gROOT->LoadMacro("$(ALICE_ROOT)/TRD/AliTRDanalyzeCluster.C");
+ if (rc = AliTRDanalyzeCluster()) return rc;
+
return rc;
}