1 void MUONcombi (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.
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
13 <img src="gif/anal.gif">
16 /////////////////////////////////////////////////////////////////////////
17 // Dynamically link some shared libs
18 if (gClassTable->GetID("AliRun") < 0) {
19 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");
36 TClonesArray *PartArray = gAlice->Particles();
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;
45 TH1F *dmass = new TH1F("dmass","Dimuon-Mass Distribution"
47 TH1F *dmassc = new TH1F("dmassc","Dimuon-Mass Distribution"
49 TH1F *dmassd = new TH1F("dmassd","Dimuon-Mass Distribution"
52 TH1F *pt = new TH1F("pt","pT-single"
58 AliGenCocktailEntry *Entry, *e1, *e2;
59 AliGenCocktail* Cocktail = (AliGenCocktail*) gAlice->Generator();
61 for (Entry=Cocktail->FirstGenerator();
63 Entry=Cocktail->NextGenerator()
67 // Pairs of Generators
69 // Initialize Combinator
70 AliDimuCombinator* Combinator = new AliDimuCombinator(PartArray);
71 Combinator->SetEtaCut(-5, 5);
72 Combinator->SetPtMin(0.0);
78 Combinator->ResetRange();
82 for(Muon=Combinator->FirstMuon();
84 Muon=Combinator->NextMuon()) {
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();
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);
101 TParticle* Muon1, *Muon2;
103 Combinator->ResetRange();
105 for (Combinator->FirstMuonPairSelected(Muon1,Muon2);
107 Combinator->NextMuonPairSelected(Muon1,Muon2))
111 Float_t mass=Combinator->Mass(Muon1, Muon2);
112 Float_t wgt =Combinator->Weight(Muon1, Muon2);
115 Float_t smeared_mass=mass;
116 Combinator->SmearGauss(0.05*mass, smeared_mass);
117 if (Combinator->Correlated(Muon1, Muon2)) {
118 dmassc->Fill(mass, wgt);
120 dmass->Fill(mass, wgt);
125 // Dimuon Loop controlled by Generator Loop
127 for (Cocktail->FirstGeneratorPair(e1,e2);
129 Cocktail->NextGeneratorPair(e1,e2)
131 printf("\n ----------------------------------------------------");
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);
140 Combinator->NextMuonPairSelected(Muon1,Muon2))
144 Float_t mass=Combinator->Mass(Muon1, Muon2);
145 Float_t wgt =Combinator->Weight(Muon1, Muon2);
148 Float_t smeared_mass=mass;
149 Combinator->SmearGauss(0.05*mass, smeared_mass);
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);
157 dmass->Fill(smeared_mass, wgt);
158 dmassd->Fill(smeared_mass, wgt*DecayWeight);
163 //Create a canvas, set the view range, show histograms
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);
180 pt->SetFillColor(42);
181 pt->SetXTitle("pT (GeV)");
186 dmass->SetFillColor(42);
187 dmass->SetXTitle("m (GeV)");
192 dmassc->SetFillColor(42);
193 dmassc->SetXTitle("m (GeV)");
198 dmassd->SetFillColor(42);
199 dmassd->SetXTitle("m (GeV)");