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