1 Int_t AliTRDanalyzeHits()
4 // Analyzes the hits and fills QA-histograms
10 cout << "<AliTRDanalyzeHits> No AliRun object found" << endl;
16 // Get the pointer to the TRD detector
17 AliTRD *trd = (AliTRD *) gAlice->GetDetector("TRD");
19 cout << "<AliTRDanalyzeHits> No TRD detector found" << endl;
24 // Get the pointer to the geometry object
25 AliTRDgeometryFull *geo;
27 geo = (AliTRDgeometryFull *) trd->GetGeometry();
30 cout << "<AliTRDanalyzeHits> No TRD geometry found" << endl;
35 // Define the histograms
36 TH1F *hQdedx = new TH1F("hQdedx","Charge dedx-hits",100,0.0,1000.0);
37 TH1F *hQtr = new TH1F("hQtr" ,"Charge TR-hits" ,100,0.0,1000.0);
39 Float_t rmin = geo->Rmin();
40 Float_t rmax = geo->Rmax();
41 Float_t length = geo->GetChamberLengthI(0);
42 Float_t width = geo->GetChamberWidth(0);
43 Int_t ncol = geo->GetColMax(0);
44 Int_t nrow = geo->GetRowMax(0,2,13);
45 Int_t ntime = ((Int_t) (rmax - rmin) / geo->GetTimeBinSize());
47 TH2F *hZY = new TH2F("hZY" ,"Y vs Z (chamber 0)", nrow,-length/2.,length/2.
49 TH2F *hXZ = new TH2F("hXZ" ,"Z vs X (plane 0)" , ncol, -width/2., width/2.
50 , nrow,-length/2.,length/2.);
52 TH1F *hNprimP = new TH1F("hNprimP","Number of primary electrons per cm (MIP pion)"
54 TH1F *hNprimE = new TH1F("hNprimE","Number of primary electrons per cm (3GeV electron)"
56 TH1F *hNtotP = new TH1F("hNtotP" ,"Number of electrons per cm (MIP pion)"
58 TH1F *hNtotE = new TH1F("hNtotE" ,"Number of electrons per cm (3GeV electron)"
61 // Get the pointer hit tree
62 TTree *hitTree = gAlice->TreeH();
64 cout << "<AliTRDanalyzeHits> No hit tree found" << endl;
72 // Get the number of entries in the hit tree
73 // (Number of primary particles creating a hit somewhere)
74 Int_t nTrack = (Int_t) hitTree->GetEntries();
75 cout << "<AliTRDanalyzeHits> Found " << nTrack
76 << " primary particles with hits" << endl;
78 // Loop through all entries in the tree
79 for (Int_t iTrack = 0; iTrack < nTrack; iTrack++) {
82 nBytes += hitTree->GetEvent(iTrack);
89 // Get the number of hits in the TRD created by this particle
90 Int_t nHit = trd->Hits()->GetEntriesFast();
92 // Loop through the TRD hits
93 for (Int_t iHit = 0; iHit < nHit; iHit++) {
97 AliTRDhit *hit = (AliTRDhit *) trd->Hits()->UncheckedAt(iHit);
100 Float_t y = hit->Y();
101 Float_t z = hit->Z();
102 Float_t q = hit->GetCharge();
103 Int_t track = hit->Track();
104 Int_t det = hit->GetDetector();
105 Int_t plane = geo->GetPlane(det);
107 if (hit->FromDrift()) {
114 else if (hit->FromTRphoton()) {
115 hQtr->Fill(TMath::Abs(q));
118 TParticle *part = gAlice->Particle(track);
120 if ((plane == 0) && (hit->FromDrift())) {
123 if ((part->GetPdgCode() == 11) &&
126 nTotE += ((Int_t) q);
130 if ((part->GetPdgCode() == -211) &&
133 nTotP += ((Int_t) q);
140 if (nPrimE > 0) hNprimE->Fill(((Double_t) nPrimE)/3.);
141 if (nPrimP > 0) hNprimP->Fill(((Double_t) nPrimP)/3.);
142 if (nTotE > 0) hNtotE->Fill(((Double_t) nTotE)/3.);
143 if (nTotP > 0) hNtotP->Fill(((Double_t) nTotP)/3.);
147 cout << "<AliTRDanalyzeHits> Found " << countHits << " hits in total" << endl;
149 TCanvas *cHits = new TCanvas("cHits","AliTRDanalyzeHits",50,50,600,600);
162 TCanvas *cNel = new TCanvas("cNel","Ionization",50,50,600,600);
177 TFile *fout = new TFile("TRD_ionization.root","RECREATE");