]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONTriggerLut.cxx
Updated list of MUON libraries
[u/mrichter/AliRoot.git] / MUON / AliMUONTriggerLut.cxx
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 /// -----------------------
19 /// Class AliMUONTriggerLut
20 /// -----------------------
21 /// Local Trigger Look Up Table
22 /// reading interface LUT data is stored into TH3S histograms and readout 
23 /// from the Local Trigger algorithm
24 /// Author: Philippe Crochet
25
26 #include "AliMUONTriggerLut.h"
27
28 #include "AliLog.h"
29
30 #include "TFile.h"
31 #include "TH3.h"
32
33 /// \cond CLASSIMP
34 ClassImp(AliMUONTriggerLut)
35 /// \endcond
36
37 //----------------------------------------------------------------------
38 AliMUONTriggerLut::AliMUONTriggerLut() 
39     : TNamed(),
40       fLptPlus(0),
41       fLptMinu(0),
42       fLptUnde(0),
43       fHptPlus(0),
44       fHptMinu(0),
45       fHptUnde(0),
46       fAptPlus(0),
47       fAptMinu(0),
48       fAptUnde(0)
49 {
50     //ctor
51 }
52
53 //----------------------------------------------------------------------
54 AliMUONTriggerLut::~AliMUONTriggerLut() 
55 {
56 /// Destructor
57   
58   delete fLptPlus;  
59   delete fLptMinu;
60   delete fLptUnde;
61   delete fHptPlus;  
62   delete fHptMinu;
63   delete fHptUnde;
64   delete fAptPlus;  
65   delete fAptMinu;
66   delete fAptUnde;
67 }
68
69 //----------------------------------------------------------------------
70 void AliMUONTriggerLut::ReadFromFile(const char* filename)
71 {
72 /// Return output of LuT for corresponding TH3S  
73
74   TFile f(filename);
75   
76   if ( f.IsZombie() )
77   {
78     AliFatal(Form("Could not open file %s",filename));
79   }
80   
81   AliDebug(1,Form("filename=%s",filename));
82   
83 //  fLptPlus = (TH3*)(f.Get("LptPlus")->Clone());  
84 //  fLptMinu = (TH3*)(f.Get("LptMinu")->Clone());
85 //  fLptUnde = (TH3*)(f.Get("LptUnde")->Clone());
86 //  fHptPlus = (TH3*)(f.Get("HptPlus")->Clone());  
87 //  fHptMinu = (TH3*)(f.Get("HptMinu")->Clone());
88 //  fHptUnde = (TH3*)(f.Get("HptUnde")->Clone());
89 //  fAptPlus = (TH3*)(f.Get("AptPlus")->Clone());  
90 //  fAptMinu = (TH3*)(f.Get("AptMinu")->Clone());
91 //  fAptUnde = (TH3*)(f.Get("AptUnde")->Clone());
92
93   fLptPlus = (TH3*)(f.Get("LptPlus"));  
94   fLptMinu = (TH3*)(f.Get("LptMinu"));
95   fLptUnde = (TH3*)(f.Get("LptUnde"));
96   fHptPlus = (TH3*)(f.Get("HptPlus"));  
97   fHptMinu = (TH3*)(f.Get("HptMinu"));
98   fHptUnde = (TH3*)(f.Get("HptUnde"));
99   fAptPlus = (TH3*)(f.Get("AptPlus"));  
100   fAptMinu = (TH3*)(f.Get("AptMinu"));
101   fAptUnde = (TH3*)(f.Get("AptUnde"));
102   
103   // insure we "detach" those histograms from file f
104   fLptPlus->SetDirectory(0);
105   fLptMinu->SetDirectory(0);
106   fLptUnde->SetDirectory(0);
107   fHptPlus->SetDirectory(0);
108   fHptMinu->SetDirectory(0);
109   fHptUnde->SetDirectory(0);
110   fAptPlus->SetDirectory(0);
111   fAptMinu->SetDirectory(0);
112   fAptUnde->SetDirectory(0);
113 }
114
115 //----------------------------------------------------------------------
116 void AliMUONTriggerLut::GetLutOutput(Int_t circuit, Int_t xstrip, Int_t idev,
117                                      Int_t ystrip, Int_t lutLpt[2], 
118                                      Int_t lutHpt[2])
119 {
120 /// Return output of LuT for corresponding TH3S  
121
122   if ( !fLptPlus )
123   {
124     ReadFromFile("$(ALICE_ROOT)/MUON/data/MUONTriggerLut.root");
125   }
126   
127   Int_t bin;
128   Short_t binc; 
129   Int_t mask = GetMask(ystrip);        // get ystrip mask
130   
131   // Low pt.............................................. 
132   bin    =          fLptPlus->GetBin(circuit,xstrip,idev);
133   binc   = (Short_t)fLptPlus->GetBinContent(bin);
134   if ((binc & mask)!=0) lutLpt[1]=1;
135
136   bin    =          fLptMinu->GetBin(circuit,xstrip,idev);
137   binc   = (Short_t)fLptMinu->GetBinContent(bin);
138   if ((binc & mask)!=0) lutLpt[0]=1;
139   
140   bin    =          fLptUnde->GetBin(circuit,xstrip,idev);
141   binc   = (Short_t)fLptUnde->GetBinContent(bin);
142   if ((binc & mask)!=0) lutLpt[0]=lutLpt[1]=1;
143
144   // High pt.............................................
145   bin    =          fHptPlus->GetBin(circuit,xstrip,idev);
146   binc   = (Short_t)fHptPlus->GetBinContent(bin);
147   if ((binc & mask)!=0) lutHpt[1]=1;
148
149   bin    =          fHptMinu->GetBin(circuit,xstrip,idev);
150   binc   = (Short_t)fHptMinu->GetBinContent(bin);
151   if ((binc & mask)!=0) lutHpt[0]=1;
152
153   bin    =          fHptUnde->GetBin(circuit,xstrip,idev);
154   binc   = (Short_t)fHptUnde->GetBinContent(bin);
155   if ((binc & mask)!=0) lutHpt[0]=lutHpt[1]=1;
156 /*
157   // All pts.............................................
158   bin    =          fAptPlus->GetBin(circuit,xstrip,idev);
159   binc   = (Short_t)fAptPlus->GetBinContent(bin);
160   if ((binc & mask)!=0) lutApt[1]=1;
161
162   bin    =          fAptMinu->GetBin(circuit,xstrip,idev);
163   binc   = (Short_t)fAptMinu->GetBinContent(bin);
164   if ((binc & mask)!=0) lutApt[0]=1;
165
166   bin    =          fAptUnde->GetBin(circuit,xstrip,idev);
167   binc   = (Short_t)fAptUnde->GetBinContent(bin);
168   if ((binc & mask)!=0) lutApt[0]=lutApt[1]=1;
169 */
170 }
171
172 //----------------------------------------------------------------------
173 Int_t AliMUONTriggerLut::GetMask(Int_t ystrip)
174 {
175 /// Return the mask corresponding to ystrip
176
177     return (Int_t)(1<<ystrip);
178 }
179
180
181
182
183