]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/ReadRecoCocktail.C
8d75d844a91d1f799148590a7c1ab47991edda48
[u/mrichter/AliRoot.git] / MUON / ReadRecoCocktail.C
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /* $Id$ */
17
18 // A. De Falco, H. Woehri, INFN Cagliari, July 2006 
19 // base macro to read the trees generated with DecodeRecoCocktail.C 
20 // 
21
22 void ReadRecoCocktail(char* fname="./MuonLight.root"){ 
23   TFile *file = new TFile(fname); 
24   TClonesArray *muonArray   = new TClonesArray("AliMUONTrackLight",100); 
25   TClonesArray *dimuonArray = new TClonesArray("AliMUONPairLight",100); 
26   TTree *tree = (TTree*) file->Get("tree"); 
27   tree->SetBranchAddress("muons",&muonArray); 
28   tree->SetBranchAddress("dimuons",&dimuonArray); 
29   Int_t nev = tree->GetEntriesFast(); 
30   printf ("%d events in tree\n",nev); 
31   Int_t ndimuUncorr=0; 
32   for (Int_t iev=0; iev<nev; iev++) { 
33     tree->GetEvent(iev); 
34     Int_t nmu = muonArray->GetEntries(); 
35     for (Int_t imu=0; imu<nmu; imu++) { 
36       AliMUONTrackLight *mu = (AliMUONTrackLight*) muonArray->At(imu); 
37       //      mu->Dump(); 
38     }
39     Int_t ndimu = dimuonArray->GetEntriesFast(); 
40     for (Int_t idimu=0; idimu<ndimu; idimu++) { 
41       AliMUONPairLight *dimu = (AliMUONPairLight*) dimuonArray->At(idimu); 
42       //      dimu->Dump(); 
43       if (!dimu->IsCorrelated()) { 
44         printf ("Event %d / %d; dimuon %d not correlated\n",iev,nev,idimu); 
45         dimu->PrintInfo("H"); 
46         ndimuUncorr++; 
47       }
48     }
49   }
50   printf ("%d uncorrelated dimuons in file\n",ndimuUncorr);  
51   TCanvas *c1=new TCanvas(); 
52   c1->Divide(2);
53   printf ("plotting the mass and pt spectra of opposite sign dimuons\n");
54   c1->cd(1);
55   tree->Draw("dimuons.GetPRec().M()","dimuons.GetCharge()==0");
56   c1->cd(2);
57   tree->Draw("dimuons.GetPRec().Pt()","dimuons.GetCharge()==0");
58 }