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