1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 // -----------------------------------
19 // Class AliMUONTriggerLut
20 // -----------------------------------
21 // Local Trigger Look Up Table - reading interface
22 // LUT data is stored into TH3S histograms and readout
23 // from the Local Trigger algorithm.
25 #include "AliMUONTriggerLut.h"
32 ClassImp(AliMUONTriggerLut)
34 //----------------------------------------------------------------------
35 AliMUONTriggerLut::AliMUONTriggerLut()
39 fLptPlus = fLptMinu = fLptUnde = 0;
40 fHptPlus = fHptMinu = fHptUnde = 0;
41 fAptPlus = fAptMinu = fAptUnde = 0;
43 //----------------------------------------------------------------------
44 AliMUONTriggerLut::~AliMUONTriggerLut()
58 //----------------------------------------------------------------------
59 AliMUONTriggerLut::AliMUONTriggerLut (const AliMUONTriggerLut& theMUONTriggerLut)
60 : TNamed(theMUONTriggerLut)
62 // Protected copy constructor
64 AliFatal("Not implemented.");
67 //----------------------------------------------------------------------
69 AliMUONTriggerLut::operator=(const AliMUONTriggerLut& rhs)
71 // Protected assignement operator
73 if (this == &rhs) return *this;
75 AliFatal( "Not implemented.");
81 AliMUONTriggerLut::ReadFromFile(const char* filename)
83 // return output of LuT for corresponding TH3S
88 AliFatal(Form("Could not open file %s",filename));
91 fLptPlus = (TH3*)(f.Get("LptPlus")->Clone());
92 fLptMinu = (TH3*)(f.Get("LptMinu")->Clone());
93 fLptUnde = (TH3*)(f.Get("LptUnde")->Clone());
94 fHptPlus = (TH3*)(f.Get("HptPlus")->Clone());
95 fHptMinu = (TH3*)(f.Get("HptMinu")->Clone());
96 fHptUnde = (TH3*)(f.Get("HptUnde")->Clone());
97 fAptPlus = (TH3*)(f.Get("AptPlus")->Clone());
98 fAptMinu = (TH3*)(f.Get("AptMinu")->Clone());
99 fAptUnde = (TH3*)(f.Get("AptUnde")->Clone());
101 // insure we "detach" those histograms from file f
102 fLptPlus->SetDirectory(0);
103 fLptMinu->SetDirectory(0);
104 fLptUnde->SetDirectory(0);
105 fHptPlus->SetDirectory(0);
106 fHptMinu->SetDirectory(0);
107 fHptUnde->SetDirectory(0);
108 fAptPlus->SetDirectory(0);
109 fAptMinu->SetDirectory(0);
110 fAptUnde->SetDirectory(0);
113 //----------------------------------------------------------------------
114 void AliMUONTriggerLut::GetLutOutput(Int_t circuit, Int_t xstrip, Int_t idev,
115 Int_t ystrip, Int_t lutLpt[2],
116 Int_t lutHpt[2], Int_t lutApt[2])
118 // return output of LuT for corresponding TH3S
122 ReadFromFile("$(ALICE_ROOT)/MUON/data/MUONTriggerLut.root");
127 Int_t mask = GetMask(ystrip); // get ystrip mask
129 // Low pt..............................................
130 bin = fLptPlus->GetBin(circuit,xstrip,idev);
131 binc = (Short_t)fLptPlus->GetBinContent(bin);
132 if ((binc & mask)!=0) lutLpt[1]=1;
134 bin = fLptMinu->GetBin(circuit,xstrip,idev);
135 binc = (Short_t)fLptMinu->GetBinContent(bin);
136 if ((binc & mask)!=0) lutLpt[0]=1;
138 bin = fLptUnde->GetBin(circuit,xstrip,idev);
139 binc = (Short_t)fLptUnde->GetBinContent(bin);
140 if ((binc & mask)!=0) lutLpt[0]=lutLpt[1]=1;
142 // High pt.............................................
143 bin = fHptPlus->GetBin(circuit,xstrip,idev);
144 binc = (Short_t)fHptPlus->GetBinContent(bin);
145 if ((binc & mask)!=0) lutHpt[1]=1;
147 bin = fHptMinu->GetBin(circuit,xstrip,idev);
148 binc = (Short_t)fHptMinu->GetBinContent(bin);
149 if ((binc & mask)!=0) lutHpt[0]=1;
151 bin = fHptUnde->GetBin(circuit,xstrip,idev);
152 binc = (Short_t)fHptUnde->GetBinContent(bin);
153 if ((binc & mask)!=0) lutHpt[0]=lutHpt[1]=1;
155 // All pts.............................................
156 bin = fAptPlus->GetBin(circuit,xstrip,idev);
157 binc = (Short_t)fAptPlus->GetBinContent(bin);
158 if ((binc & mask)!=0) lutApt[1]=1;
160 bin = fAptMinu->GetBin(circuit,xstrip,idev);
161 binc = (Short_t)fAptMinu->GetBinContent(bin);
162 if ((binc & mask)!=0) lutApt[0]=1;
164 bin = fAptUnde->GetBin(circuit,xstrip,idev);
165 binc = (Short_t)fAptUnde->GetBinContent(bin);
166 if ((binc & mask)!=0) lutApt[0]=lutApt[1]=1;
170 //----------------------------------------------------------------------
171 Int_t AliMUONTriggerLut::GetMask(Int_t ystrip)
173 // returns the mask corresponding to ystrip
174 Int_t tabMask[16]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
177 for (Int_t i=0; i<16; i++)
179 mask += tabMask[i]<<i;