]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/ReadRecoCocktail.C
ALIROOT-5420 Additional header file
[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 /// \ingroup macros
19 /// \file ReadRecoCocktail.C
20 /// \brief Base macro to read the trees generated with DecodeRecoCocktail.C 
21 ///
22 /// \author A. De Falco, H. Woehri, INFN Cagliari, July 2006 
23
24 #if !defined(__CINT__) || defined(__MAKECINT__)
25 #include "TFile.h"
26 #include "TTree.h"
27 #include "TCanvas.h"
28 #include "TClonesArray.h"
29
30 #include "AliMUONTrackLight.h"
31 #include "AliMUONPairLight.h"
32 #endif
33
34 void ReadRecoCocktail(char* fname="./MuonLight.root"){ 
35   TFile *file = new TFile(fname); 
36   TClonesArray *muonArray   = new TClonesArray("AliMUONTrackLight",100); 
37   TClonesArray *dimuonArray = new TClonesArray("AliMUONPairLight",100); 
38   TTree *tree = (TTree*) file->Get("tree"); 
39   tree->SetBranchAddress("muons",&muonArray); 
40   tree->SetBranchAddress("dimuons",&dimuonArray); 
41   Int_t nev = tree->GetEntriesFast(); 
42   printf ("%d events in tree\n",nev); 
43   Int_t ndimuUncorr=0; 
44   for (Int_t iev=0; iev<nev; iev++) { 
45     tree->GetEvent(iev); 
46 //     Int_t nmu = muonArray->GetEntries(); 
47 //     for (Int_t imu=0; imu<nmu; imu++) { 
48 //       AliMUONTrackLight *mu = (AliMUONTrackLight*) muonArray->At(imu); 
49 //       mu->Dump(); 
50 //     }
51     Int_t ndimu = dimuonArray->GetEntriesFast(); 
52     for (Int_t idimu=0; idimu<ndimu; idimu++) { 
53       AliMUONPairLight *dimu = (AliMUONPairLight*) dimuonArray->At(idimu); 
54       //      dimu->Dump(); 
55       if (!dimu->IsCorrelated()) { 
56         printf ("Event %d / %d; dimuon %d not correlated\n",iev,nev,idimu); 
57         dimu->PrintInfo("H"); 
58         ndimuUncorr++; 
59       }
60     }
61   }
62   printf ("%d uncorrelated dimuons in file\n",ndimuUncorr);  
63   TCanvas *c1=new TCanvas(); 
64   c1->Divide(2);
65   printf ("plotting the mass and pt spectra of opposite sign dimuons\n");
66   c1->cd(1);
67   tree->Draw("dimuons.GetPRec().M()","dimuons.GetCharge()==0");
68   c1->cd(2);
69   tree->Draw("dimuons.GetPRec().Pt()","dimuons.GetCharge()==0");
70 }