1 Int_t AliTOFanalyzeHits()
4 // Analyzes the hits and fills QA-histograms
10 cout << "<AliTOFanalyzeHits> No AliRun object found" << endl;
16 // Get the pointer to the TOF detector
17 AliTOF *tof = (AliTOF *) gAlice->GetDetector("TOF");
19 cout << "<AliTOFanalyzeHits> No TOF detector found" << endl;
24 // Define the histograms
25 // x,y,z, rho, tof, padx, padz, sector, plate, strip, (x vs y)
28 TH2F *h2hitMap = new TH2F("h2hitMap","Hit Map (projection on the plane)",2500,-12500.,12500.,800,-400.,400.);
29 // time of flight distribution for primaries and secondaries
30 TH1F *htofp = new TH1F("htofp","Time of Flight (primaries)",800,0.,80.);
31 TH1F *htofs = new TH1F("htofs","Time of Flight (secondaries)",800,0.,80.);
32 // momentum when striking the TOF for primaries and secondaries
33 TH1F *htofmomp = new TH1F("htofmomp","Momentum at TOF (primaries)",100,0.,10.);
34 TH1F *htofmoms = new TH1F("htofmoms","Momentum at TOF (secondaries)",100,0.,10.);
36 TH1F *hsector = new TH1F("hsector","Sector",20,0.,20.);
37 TH1F *hplate = new TH1F("hplate","Plate ", 6,0., 6.);
38 TH1F *hstrip = new TH1F("hstrip","Strip ",25,0.,25.);
39 TH1F *hpadz = new TH1F("hpadz","Pad along z ",3,0.,3.);
40 TH1F *hpadx = new TH1F("hpadx","Pad along x",50,0.,50.);
41 // track length when striking the TOF (used by AliTOFT0)
42 TH1F *htrackLenp= new TH1F("htrackLenp","Track Length on TOF for Primaries",800,0.,800.);
44 // Get the pointer hit tree
45 TTree *hitTree = gAlice->TreeH();
47 cout << "<AliTOFanalyzeHits> No hit tree found" << endl;
55 // Get the number of entries in the hit tree
56 // (Number of primary particles creating a hit somewhere)
57 Int_t nTrack = (Int_t) hitTree->GetEntries();
58 cout << "<AliTOFanalyzeHits> Found " << nTrack
59 << " primary particles with hits" << endl;
61 Int_t nPrimaryOnTof = 0;
62 Int_t nSecondaryOnTof = 0;
69 // Loop through all entries in the tree
70 for (Int_t iTrack = 0; iTrack < nTrack; iTrack++) {
73 nBytes += hitTree->GetEvent(iTrack);
76 // Loop through the TOF hits
78 AliTOFhitT0 *hit = (AliTOFhitT0 *) tof->FirstHit(-1);
87 Float_t circleLen=TMath::Sqrt(x*x+y*y)*TMath::ATan2(y,x);
88 h2hitMap->Fill(circleLen,z);
90 Float_t flightTime = hit->GetTof(); // [s]
91 flightTime*=1.e+09; // convert in [ns]
92 Float_t angle = hit->GetIncA();
93 Float_t tofmom= hit->GetMom(); // [GeV/c]
94 Float_t trackLen= hit->GetLen(); // [cm]
97 Int_t sector = hit->GetSector(); // range [1-18]
98 Int_t plate = hit->GetPlate(); // range [1- 5]
99 Int_t strip = hit->GetStrip(); // range [1-20]
100 Int_t padz = hit->GetPadz(); // range [1- 2]
101 Int_t padx = hit->GetPadx(); // range [1-48]
102 // it is QA, then I perform QA!
103 Bool_t isHitBad = (sector<1 || sector>18 || plate<1 || plate >5 || padz<1 || padz>2 || padx<1 || padx>48);
106 cout << "<AliTOFanalyzeHits> strange hit found" << endl;
110 // filling hit volume histos
111 hsector->Fill(sector);
118 Int_t track = hit->Track();
119 TParticle *part = gAlice->Particle(track);
121 // getting MC info for the current track
122 if (part->GetFirstMother()<0){
123 Int_t icod = TMath::Abs(part->GetPdgCode());
141 htofp->Fill(flightTime);
142 htofmomp->Fill(tofmom);
143 htrackLenp->Fill(trackLen);
145 htofs->Fill(flightTime);
146 htofmoms->Fill(tofmom);
150 hit = (AliTOFhitT0 *) tof->NextHit();
156 cout << "<AliTOFanalyzeHits> Found " << countHits << " hits in total" << endl;
157 cout << npion << " primary pions reached the TOF detector" << endl;
158 cout << nkaon << " primary kaons reached the TOF detector" << endl;
159 cout << nproton << " primary protons reached the TOF detector" << endl;
160 cout << nelectron << " primary electrons reached the TOF detector" << endl;
161 cout << nmuon << " primary muons reached the TOF detector" << endl;
164 TCanvas *cHits = new TCanvas("cHits","AliTOFanalyzeHits hit volumes",50,50,900,900);
177 TCanvas *chitmap = new TCanvas("chitmap","AliTOFanalyzeHits Hit Map",50,50,400,400);
181 TCanvas *ctrackLen = new TCanvas("ctrackLen","AliTOFanalyzeHits Track Length for primaries on TOF",50,50,400,400);
185 TCanvas *ctofmom = new TCanvas("ctofmom","AliTOFanalyzeHits flight times",50,50,700,700);
186 ctofmom->Divide(2,2);
201 // save histos into file TOF_hitsQA.root
202 TFile *fout = new TFile("TOF_hitsQA.root","RECREATE");