]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONTriggerLut.cxx
Restoring some modifications done in version 1.22
[u/mrichter/AliRoot.git] / MUON / AliMUONTriggerLut.cxx
CommitLineData
a9e2aefa 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 **************************************************************************/
cbc57deb 15
88cb7938 16/* $Id$ */
c1651df4 17
5398f946 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.
d1525c79 22
a9e2aefa 23#include "AliMUONTriggerLut.h"
9afd2481 24
8c343c7c 25#include "AliLog.h"
a9e2aefa 26
9afd2481 27#include "TFile.h"
28#include "TH3.h"
29
5398f946 30/// \cond CLASSIMP
a9e2aefa 31ClassImp(AliMUONTriggerLut)
5398f946 32/// \endcond
a9e2aefa 33
34//----------------------------------------------------------------------
30178c30 35AliMUONTriggerLut::AliMUONTriggerLut()
36 : TNamed()
37{
5398f946 38/// Default constructor
39
a9e2aefa 40 fLptPlus = fLptMinu = fLptUnde = 0;
41 fHptPlus = fHptMinu = fHptUnde = 0;
42 fAptPlus = fAptMinu = fAptUnde = 0;
43}
44//----------------------------------------------------------------------
9afd2481 45AliMUONTriggerLut::~AliMUONTriggerLut()
46{
5398f946 47/// Destructor
48
a9e2aefa 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;
a9e2aefa 58}
59
9afd2481 60void
61AliMUONTriggerLut::ReadFromFile(const char* filename)
62{
5398f946 63/// Return output of LuT for corresponding TH3S
64
9afd2481 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
a9e2aefa 94//----------------------------------------------------------------------
95void AliMUONTriggerLut::GetLutOutput(Int_t circuit, Int_t xstrip, Int_t idev,
96 Int_t ystrip, Int_t lutLpt[2],
9afd2481 97 Int_t lutHpt[2], Int_t lutApt[2])
98{
5398f946 99/// Return output of LuT for corresponding TH3S
d56db588 100
9afd2481 101 if ( !fLptPlus )
102 {
103 ReadFromFile("$(ALICE_ROOT)/MUON/data/MUONTriggerLut.root");
d56db588 104 }
9afd2481 105
a9e2aefa 106 Int_t bin;
107 Short_t binc;
108 Int_t mask = GetMask(ystrip); // get ystrip mask
109
110 // Low pt..............................................
9afd2481 111 bin = fLptPlus->GetBin(circuit,xstrip,idev);
112 binc = (Short_t)fLptPlus->GetBinContent(bin);
a9e2aefa 113 if ((binc & mask)!=0) lutLpt[1]=1;
114
9afd2481 115 bin = fLptMinu->GetBin(circuit,xstrip,idev);
116 binc = (Short_t)fLptMinu->GetBinContent(bin);
a9e2aefa 117 if ((binc & mask)!=0) lutLpt[0]=1;
118
9afd2481 119 bin = fLptUnde->GetBin(circuit,xstrip,idev);
120 binc = (Short_t)fLptUnde->GetBinContent(bin);
a9e2aefa 121 if ((binc & mask)!=0) lutLpt[0]=lutLpt[1]=1;
122
123 // High pt.............................................
9afd2481 124 bin = fHptPlus->GetBin(circuit,xstrip,idev);
125 binc = (Short_t)fHptPlus->GetBinContent(bin);
a9e2aefa 126 if ((binc & mask)!=0) lutHpt[1]=1;
127
9afd2481 128 bin = fHptMinu->GetBin(circuit,xstrip,idev);
129 binc = (Short_t)fHptMinu->GetBinContent(bin);
a9e2aefa 130 if ((binc & mask)!=0) lutHpt[0]=1;
131
9afd2481 132 bin = fHptUnde->GetBin(circuit,xstrip,idev);
133 binc = (Short_t)fHptUnde->GetBinContent(bin);
a9e2aefa 134 if ((binc & mask)!=0) lutHpt[0]=lutHpt[1]=1;
135
136 // All pts.............................................
9afd2481 137 bin = fAptPlus->GetBin(circuit,xstrip,idev);
138 binc = (Short_t)fAptPlus->GetBinContent(bin);
a9e2aefa 139 if ((binc & mask)!=0) lutApt[1]=1;
140
9afd2481 141 bin = fAptMinu->GetBin(circuit,xstrip,idev);
142 binc = (Short_t)fAptMinu->GetBinContent(bin);
a9e2aefa 143 if ((binc & mask)!=0) lutApt[0]=1;
144
9afd2481 145 bin = fAptUnde->GetBin(circuit,xstrip,idev);
146 binc = (Short_t)fAptUnde->GetBinContent(bin);
a9e2aefa 147 if ((binc & mask)!=0) lutApt[0]=lutApt[1]=1;
148
a9e2aefa 149}
150
151//----------------------------------------------------------------------
9afd2481 152Int_t AliMUONTriggerLut::GetMask(Int_t ystrip)
153{
5398f946 154/// Return the mask corresponding to ystrip
155
a9e2aefa 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;
9afd2481 159 for (Int_t i=0; i<16; i++)
160 {
161 mask += tabMask[i]<<i;
a9e2aefa 162 }
163 return mask;
164}
165
a9e2aefa 166
167
168
169