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 /// \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.
23 #include "AliMUONTriggerLut.h"
31 ClassImp(AliMUONTriggerLut)
34 //----------------------------------------------------------------------
35 AliMUONTriggerLut::AliMUONTriggerLut()
38 /// Default constructor
40 fLptPlus = fLptMinu = fLptUnde = 0;
41 fHptPlus = fHptMinu = fHptUnde = 0;
42 fAptPlus = fAptMinu = fAptUnde = 0;
44 //----------------------------------------------------------------------
45 AliMUONTriggerLut::~AliMUONTriggerLut()
61 AliMUONTriggerLut::ReadFromFile(const char* filename)
63 /// Return output of LuT for corresponding TH3S
69 AliFatal(Form("Could not open file %s",filename));
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());
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);
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])
99 /// Return output of LuT for corresponding TH3S
103 ReadFromFile("$(ALICE_ROOT)/MUON/data/MUONTriggerLut.root");
108 Int_t mask = GetMask(ystrip); // get ystrip mask
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;
115 bin = fLptMinu->GetBin(circuit,xstrip,idev);
116 binc = (Short_t)fLptMinu->GetBinContent(bin);
117 if ((binc & mask)!=0) lutLpt[0]=1;
119 bin = fLptUnde->GetBin(circuit,xstrip,idev);
120 binc = (Short_t)fLptUnde->GetBinContent(bin);
121 if ((binc & mask)!=0) lutLpt[0]=lutLpt[1]=1;
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;
128 bin = fHptMinu->GetBin(circuit,xstrip,idev);
129 binc = (Short_t)fHptMinu->GetBinContent(bin);
130 if ((binc & mask)!=0) lutHpt[0]=1;
132 bin = fHptUnde->GetBin(circuit,xstrip,idev);
133 binc = (Short_t)fHptUnde->GetBinContent(bin);
134 if ((binc & mask)!=0) lutHpt[0]=lutHpt[1]=1;
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;
141 bin = fAptMinu->GetBin(circuit,xstrip,idev);
142 binc = (Short_t)fAptMinu->GetBinContent(bin);
143 if ((binc & mask)!=0) lutApt[0]=1;
145 bin = fAptUnde->GetBin(circuit,xstrip,idev);
146 binc = (Short_t)fAptUnde->GetBinContent(bin);
147 if ((binc & mask)!=0) lutApt[0]=lutApt[1]=1;
151 //----------------------------------------------------------------------
152 Int_t AliMUONTriggerLut::GetMask(Int_t ystrip)
154 /// Return the mask corresponding to ystrip
156 Int_t tabMask[16]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
159 for (Int_t i=0; i<16; i++)
161 mask += tabMask[i]<<i;