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