]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/MUONcombi.C
- Dummy z-arguments in GetPadI, SetHit, FirstPad replaced by real z-coordinate
[u/mrichter/AliRoot.git] / MUON / MUONcombi.C
CommitLineData
fe4da5cc 1void MUONcombi (Int_t evNumber=0)
2{
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.
7//
8// Root > .L anal.C //this loads the macro in memory
9// Root > anal(); //by default process first event
10// Root > anal(2); //process third event
11//Begin_Html
12/*
a897a37a 13<img src="gif/anal.gif">
fe4da5cc 14*/
15//End_Html
16/////////////////////////////////////////////////////////////////////////
17// Dynamically link some shared libs
a9e2aefa 18 if (gClassTable->GetID("AliRun") < 0) {
19 gROOT->LoadMacro("loadlibs.C");
20 loadlibs();
21 } else {
22 delete gAlice;
23 gAlice = 0;
24 }
fe4da5cc 25//
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");
29
30// Get AliRun object from file or create it if not on file
31 if (!gAlice) {
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");
35 }
fe4da5cc 36 TClonesArray *PartArray = gAlice->Particles();
50f986db 37 TParticle *Part;
fe4da5cc 38
39
40// Import the Kine and Hits Trees for the event evNumber in the file
41 Int_t nparticles = gAlice->GetEvent(evNumber);
42 if (nparticles <= 0) return;
43//
44//
45 TH1F *dmass = new TH1F("dmass","Dimuon-Mass Distribution"
a9e2aefa 46 ,25,0.,5.);
47 TH1F *dmassc = new TH1F("dmassc","Dimuon-Mass Distribution"
48 ,50,0.,10.);
49 TH1F *dmassd = new TH1F("dmassd","Dimuon-Mass Distribution"
fe4da5cc 50 ,50,0.,10.);
a9e2aefa 51
fe4da5cc 52 TH1F *pt = new TH1F("pt","pT-single"
53 ,50,0.,10.);
54//
55// Generator Loop
56//
57
fe4da5cc 58 AliGenCocktailEntry *Entry, *e1, *e2;
59 AliGenCocktail* Cocktail = (AliGenCocktail*) gAlice->Generator();
60// Single Generator
61 for (Entry=Cocktail->FirstGenerator();
62 Entry;
63 Entry=Cocktail->NextGenerator()
64 ) {
65 Entry->PrintInfo();
66 }
67// Pairs of Generators
fe4da5cc 68//
69// Initialize Combinator
a9e2aefa 70 AliDimuCombinator* Combinator = new AliDimuCombinator(PartArray);
71 Combinator->SetEtaCut(-5, 5);
72 Combinator->SetPtMin(0.0);
fe4da5cc 73
74 Int_t i=0;
75//
76// Single Muon Loop
77//
a9e2aefa 78 Combinator->ResetRange();
79
80
fe4da5cc 81
a9e2aefa 82 for(Muon=Combinator->FirstMuon();
fe4da5cc 83 Muon;
a9e2aefa 84 Muon=Combinator->NextMuon()) {
fe4da5cc 85//
a9e2aefa 86 Int_t chfirst= Muon->GetFirstDaughter();
87 Int_t chlast = Muon->GetLastDaughter();
88 Int_t parent = Muon->GetFirstMother();
89 Float_t ptm = Muon->Pt();
90 Float_t eta = Muon->Eta();
fe4da5cc 91
92 printf("\n Particle %d Parent %d first child %d last child %d",
93 i,parent, chfirst, chlast);
94 printf("\n Particle pt, eta: %f , %f ",pt,eta);
95 i++;
96 }
fe4da5cc 97//
98// Di-Muon Loop
99
100 Float_t pt1,pt2;
50f986db 101 TParticle* Muon1, *Muon2;
a9e2aefa 102
fe4da5cc 103 Combinator->ResetRange();
a9e2aefa 104/*
fe4da5cc 105 for (Combinator->FirstMuonPairSelected(Muon1,Muon2);
106 (Muon1 && Muon2);
107 Combinator->NextMuonPairSelected(Muon1,Muon2))
108 {
a9e2aefa 109 pt1=Muon1->Pt();
110 pt2=Muon2->Pt();
fe4da5cc 111 Float_t mass=Combinator->Mass(Muon1, Muon2);
112 Float_t wgt =Combinator->Weight(Muon1, Muon2);
113 pt->Fill(pt1, wgt);
114 pt->Fill(pt2, wgt);
115 Float_t smeared_mass=mass;
116 Combinator->SmearGauss(0.05*mass, smeared_mass);
a9e2aefa 117 if (Combinator->Correlated(Muon1, Muon2)) {
118 dmassc->Fill(mass, wgt);
119 } else {
120 dmass->Fill(mass, wgt);
121 }
fe4da5cc 122 }
123*/
124//
125// Dimuon Loop controlled by Generator Loop
126//
127 for (Cocktail->FirstGeneratorPair(e1,e2);
128 (e1&&e2);
129 Cocktail->NextGeneratorPair(e1,e2)
130 ){
131 printf("\n ----------------------------------------------------");
132 e1->PrintInfo();
133 e2->PrintInfo();
134 printf("\n ----------------------------------------------------");
135 Combinator->SetFirstRange (e1->GetFirst(), e1->GetLast());
136 Combinator->SetSecondRange(e2->GetFirst(), e2->GetLast());
137 Combinator->SetRate(e1->Rate(), e2->Rate());
138 for (Combinator->FirstMuonPairSelected(Muon1,Muon2);
139 (Muon1 && Muon2);
140 Combinator->NextMuonPairSelected(Muon1,Muon2))
141 {
a9e2aefa 142 pt1=Muon1->Pt();
143 pt2=Muon2->Pt();
fe4da5cc 144 Float_t mass=Combinator->Mass(Muon1, Muon2);
145 Float_t wgt =Combinator->Weight(Muon1, Muon2);
146 pt->Fill(pt1, wgt);
147 pt->Fill(pt2, wgt);
148 Float_t smeared_mass=mass;
149 Combinator->SmearGauss(0.05*mass, smeared_mass);
a9e2aefa 150 Float_t DecayWeight=
151 Combinator->Decay_Prob(Muon2)*
152 Combinator->Decay_Prob(Muon2);
153// if (TMath::Min(pt1,pt2) > -0.5*TMath::Max(pt1,pt2)+2.) {
154 if (Combinator->Correlated(Muon1, Muon2)) {
155 dmassc->Fill(smeared_mass, wgt);
156 }
157 dmass->Fill(smeared_mass, wgt);
158 dmassd->Fill(smeared_mass, wgt*DecayWeight);
159// }
fe4da5cc 160 } // Dimuon Loop
161 }// Generator Loop
fe4da5cc 162//
163//Create a canvas, set the view range, show histograms
164//
165 TCanvas *c1 = new TCanvas("c1","Dimuon Plots",400,10,600,700);
166 TPad* pad11 = new TPad("pad11"," ",0.01,0.51,0.49,0.99);
167 TPad* pad12 = new TPad("pad12"," ",0.51,0.51,0.99,0.99);
168 TPad* pad13 = new TPad("pad13"," ",0.01,0.01,0.49,0.49);
169 TPad* pad14 = new TPad("pad14"," ",0.51,0.01,0.99,0.49);
170 pad11->SetFillColor(11);
171 pad12->SetFillColor(11);
172 pad13->SetFillColor(11);
173 pad14->SetFillColor(11);
174 pad11->Draw();
175 pad12->Draw();
176 pad13->Draw();
177 pad14->Draw();
178
179 pad11->cd();
180 pt->SetFillColor(42);
181 pt->SetXTitle("pT (GeV)");
182 pt->Draw();
183
184 pad12->cd();
a9e2aefa 185 pad12->SetLogy(0);
fe4da5cc 186 dmass->SetFillColor(42);
187 dmass->SetXTitle("m (GeV)");
188 dmass->Draw();
a9e2aefa 189
190 pad13->cd();
191 pad13->SetLogy(0);
192 dmassc->SetFillColor(42);
193 dmassc->SetXTitle("m (GeV)");
194 dmassc->Draw();
195
196 pad14->cd();
197 pad14->SetLogy(0);
198 dmassd->SetFillColor(42);
199 dmassd->SetXTitle("m (GeV)");
200 dmassd->Draw();
201
202
fe4da5cc 203}
204
205
206
207
208
209
210
211
212
213