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