]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ACORDE/macros/readACORDEESD.C
Adding ANALYSIS
[u/mrichter/AliRoot.git] / ACORDE / macros / readACORDEESD.C
1 /*************************************************************
2
3         Macro used for reading the information
4         recorded by ACORDE detector from ESD fles and test the
5         correction of ACORDE ESDs
6         
7         Author: 
8         
9                 Mario Rodriguez Cahuantzi <mrodrigu@mail.cern.ch>
10
11         Created: Sep. 24th 2009 @ CERN
12
13
14 **************************************************************/
15
16 void readACORDEESD()
17 {
18
19         // Time's counter
20         
21         TStopwatch timer;
22         
23         timer.Start();
24
25         TH1D *h1 = new TH1D("h1","ACORDE - Single Muon Trigger Hits",60,-0.5,59.5);
26         TH1D *h2 = new TH1D("h2","ACORDE - Single Muon Trigger Hit Multiplicity",60,-1,60);
27         TH1D *h3 = new TH1D("h3","ACORDE - Multi Muon Trigger Hits",60,-0.5,59.5);
28         TH1D *h4 = new TH1D("h4","ACORDE - Multi Muon Trigger Hit Multiplicity",60,-1,60);
29
30         // Pointer to the ESD file
31         
32         TFile *ef = TFile::Open("AliESDs.root");
33     
34         // Check if the ESD file is OK
35                     
36         if (!ef || !ef->IsOpen()) 
37         {
38                 cerr<<"Can't read AliESDs.root !\n"; 
39                 return 1;
40         }
41         
42         // Pointer to the ESD event
43         
44         AliESDEvent* fESD = new AliESDEvent();
45         
46         // Pointer to the esdTree 
47         
48         TTree* tree = (TTree*) ef->Get("esdTree");
49         
50         // Check if the  esdTree is Ok
51         
52         if (!tree) 
53         {
54                 cerr<<"no ESD tree found\n"; 
55                 return 1;
56         }
57         
58         fESD->ReadFromTree(tree);
59
60         Int_t n=1;
61
62         // Loop over all events
63         
64         while (tree->GetEvent(n))
65         {
66
67                 Int_t nMuons = 0;
68         
69                 cout<<endl<<"Processing event number : "<<n++<<endl;
70                 
71                 // We select only events triggered by ACORDE
72         
73                 TString ActiveTriggerDetector = fESD->GetFiredTriggerClasses();
74                 printf("Event:%d, Trigger:%s\n",fESD->GetEventNumberInFile(),ActiveTriggerDetector.Data());
75
76                 // if ACORDE trigger is on
77                 // else if ACORDE is working as readout just comment the condition
78                 if (ActiveTriggerDetector.Contains("AMU") || ActiveTriggerDetector.Contains("SL0") )            
79                 {
80
81                         cout<<endl<<"Processing event number : "<<n++<<endl;
82                         printf("Trigger Mask:%s\n",ActiveTriggerDetector.Data());
83
84                         AliESDACORDE *acordeESD = fESD->GetACORDEData();
85                         Int_t contMulti = 0;
86                         for(Int_t i=0;i<60;i++)
87                         {
88                                 if (acordeESD->GetHitChannel(i)==kTRUE) 
89                                 //if (acordeESD->GetACORDEBitPattern(i))
90                                 {
91                                         h1->Fill(i);
92                                         contMulti++;
93                                 }
94                         }               
95                         h2->Fill(contMulti);
96                 } //Only acorde trigger
97         } // Loop over all events from AliESDs.root             
98
99         TCanvas *c1 = new TCanvas();
100         c1->Divide(2,1);
101         c1->cd(1);
102         h1->Draw();
103         c1->cd(2);
104         h2->Draw();
105
106         timer.Stop();
107         timer.Print();  
108
109
110
111 } // Main Procedure 
112