1 void TOFquickanal(Int_t evNumber=0)
3 /////////////////////////////////////////////////////////////////////////
4 // This macro is a small example of a ROOT macro
5 // illustrating how to read the output of GALICE
6 // and fill some histograms concerning the TOF Hit Tree.
8 // Root > .L TOFquickanal.C //this loads the macro in memory
9 // Root > TOFquickanal(); //by default process first event
10 // Root > TOFquickanal(2); //process third event
13 <img src="picts/TOFquickanal.gif">
17 // Author: F. Pierella , Bologna University 12-04-2001
18 /////////////////////////////////////////////////////////////////////////
20 // Dynamically link some shared libs
21 if (gClassTable->GetID("AliRun") < 0) {
22 gROOT->LoadMacro("loadlibs.C");
26 // Connect the Root Galice file containing Geometry, Kine and Hits
27 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
28 if (!file) file = new TFile("galice.root");
30 // Get AliRun object from file or create it if not on file
32 gAlice = (AliRun*)file->Get("gAlice");
33 if (gAlice) printf("AliRun object found on file\n");
34 if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
37 // Import the Kine and Hits Trees for the event evNumber in the file
38 Int_t nparticles = gAlice->GetEvent(evNumber);
39 if (nparticles <= 0) return;
41 Float_t tof,tofmom,incangle;
42 Double_t xcoor,ycoor,zcoor,radius,prodmom,prodthe,prodphi;
49 // Get pointers to Alice detectors and Hits containers
50 AliDetector *TOF = gAlice->GetDetector("TOF");
52 Int_t ntracks = gAlice->TreeH()->GetEntries();
54 //=======> Create histograms
55 //---> Time of Flight for Primary Particles (ns)
56 TH1F *htofprim = new TH1F("htofprim","Time of Flight for Primary Particles",100,0.,100.);
57 //--->Time of Flight for Secondary Particles (ns)
58 TH1F *htofsec = new TH1F("htofsec","Time of Flight for Secondary Particles",100,0.,100.);
60 //---> r (radius) coordinate of production in the ALICE frame for secondary particles that produce at
61 // least one TOF-hit (cm) - cylindrical coordinate system assumed, primary plus secondary-
62 TH1F *hradius = new TH1F("hradius","r (radius) coordinate at the production vertex for secondary particles with at least one TOF-Hit",50,0.,500.);
64 //---> Momentum of primary particles that produce (at least) one TOF-hit when the hit
65 // is produced (Gev/c)
66 TH1F *htofmom = new TH1F("htofmom","Momentum of primary particles when the Hit is produced",50,0.,5.);
68 //---> Momentum of primary particles that produce (at least) one TOF-hit at the production vertex
70 TH1F *hprodmom = new TH1F("hprodmom","Momentum of primary particles (with at least one TOF hit) at the production ",50,0.,5.);
72 //---> Theta of production for primary particles that produce (at least) one TOF-hit (deg)
73 TH1F *hprodthe = new TH1F("hprodthe","Theta of primary particles (with at least one TOF hit) at the production ",90,0.,180.);
75 //---> Phi of production for primary particles that produce (at least) one TOF-hit (deg)
76 TH1F *hprodphi = new TH1F("hprodphi","Phi of primary particles (with at least one TOF hit) at the production ",180,-180.,180.);
78 //---> z Coordinate of the TOF Hit (z beam axis) - primary plus secondary - (cm)
79 TH1F *hzcoor = new TH1F("hzcoor","z Coordinate of the TOF Hit",800,-400.,400.);
81 //---> Incidence Angle of the particle on the pad (or strip) (deg) - primary plus secondary -
82 TH1F *hincangle = new TH1F("hincangle","Incidence Angle of the particle on the strip",90,0.,180.);
86 // Start loop on tracks in the hits containers
87 for (Int_t track=0; track<ntracks;track++) {
89 // printf("Track #%d\n",track);
91 // ======>Histogram TOF
92 for(tofHit=(AliTOFhit*)TOF->FirstHit(track); tofHit; tofHit=(AliTOFhit*)TOF->NextHit()) {
94 tof = tofHit->GetTof();
95 tof *= 1.E+09; // conversion from s to ns
96 tofmom = tofHit->GetMom();
98 ipart = tofHit->GetTrack();
99 particle = gAlice->Particle(ipart);
101 if (particle->GetFirstMother() < 0) {
103 htofmom->Fill(tofmom);
111 incangle= tofHit->GetIncA();
112 hincangle->Fill(incangle);
114 xcoor =particle->Vx();
115 ycoor =particle->Vy();
116 radius = TMath::Sqrt(xcoor*xcoor+ycoor*ycoor);
117 if (particle->GetFirstMother() >= 0) hradius->Fill(radius);
119 prodmom=particle->P();
121 Double_t dummy = (particle->Pz())/prodmom;
122 prodthe = TMath::ACos(dummy);
123 prodthe *=57.29578; // conversion from rad to deg
124 if (particle->GetFirstMother() < 0) hprodthe->Fill(prodthe);
125 } // theta at production vertex
127 if (particle->GetFirstMother() < 0) {
128 hprodmom->Fill(prodmom);
129 Double_t dummypx=particle->Px();
130 Double_t dummypy=particle->Py();
131 prodphi = TMath::ATan2(dummypy,dummypx);
132 prodphi *=57.29578; // conversion from rad to deg
133 hprodphi->Fill(prodphi);
134 } // phi at production vertex
137 } // close loop on TOF-hits
138 } // close loop on tracks in the hits containers
142 //Create canvas, set the view range, show histograms
143 TCanvas *c1 = new TCanvas("c1","Alice TOF hits quick analysis",400,10,600,700);
147 TCanvas *c2 = new TCanvas("c2","Alice TOF hits quick analysis",400,10,600,700);
151 TCanvas *c3 = new TCanvas("c3","Alice TOF hits quick analysis",400,10,600,700);
155 TCanvas *c4 = new TCanvas("c4","Alice TOF hits quick analysis",400,10,600,700);
159 TCanvas *c5 = new TCanvas("c5","Alice TOF hits quick analysis",400,10,600,700);
163 TCanvas *c6 = new TCanvas("c6","Alice TOF hits quick analysis",400,10,600,700);
167 TCanvas *c7 = new TCanvas("c7","Alice TOF hits quick analysis",400,10,600,700);
172 TCanvas *c8 = new TCanvas("c8","Alice TOF hits quick analysis",400,10,600,700);
176 TCanvas *c9 = new TCanvas("c9","Alice TOF hits quick analysis",400,10,600,700);