]>
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 | ||
9afd2481 | 69 | void |
70 | AliMUONTriggerLut::ReadFromFile(const char* filename) | |
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 | ||
81 | fLptPlus = (TH3*)(f.Get("LptPlus")->Clone()); | |
82 | fLptMinu = (TH3*)(f.Get("LptMinu")->Clone()); | |
83 | fLptUnde = (TH3*)(f.Get("LptUnde")->Clone()); | |
84 | fHptPlus = (TH3*)(f.Get("HptPlus")->Clone()); | |
85 | fHptMinu = (TH3*)(f.Get("HptMinu")->Clone()); | |
86 | fHptUnde = (TH3*)(f.Get("HptUnde")->Clone()); | |
87 | fAptPlus = (TH3*)(f.Get("AptPlus")->Clone()); | |
88 | fAptMinu = (TH3*)(f.Get("AptMinu")->Clone()); | |
89 | fAptUnde = (TH3*)(f.Get("AptUnde")->Clone()); | |
90 | ||
91 | // insure we "detach" those histograms from file f | |
92 | fLptPlus->SetDirectory(0); | |
93 | fLptMinu->SetDirectory(0); | |
94 | fLptUnde->SetDirectory(0); | |
95 | fHptPlus->SetDirectory(0); | |
96 | fHptMinu->SetDirectory(0); | |
97 | fHptUnde->SetDirectory(0); | |
98 | fAptPlus->SetDirectory(0); | |
99 | fAptMinu->SetDirectory(0); | |
100 | fAptUnde->SetDirectory(0); | |
101 | } | |
102 | ||
a9e2aefa | 103 | //---------------------------------------------------------------------- |
104 | void AliMUONTriggerLut::GetLutOutput(Int_t circuit, Int_t xstrip, Int_t idev, | |
105 | Int_t ystrip, Int_t lutLpt[2], | |
6ae22475 | 106 | Int_t lutHpt[2]) |
9afd2481 | 107 | { |
5398f946 | 108 | /// Return output of LuT for corresponding TH3S |
d56db588 | 109 | |
9afd2481 | 110 | if ( !fLptPlus ) |
111 | { | |
112 | ReadFromFile("$(ALICE_ROOT)/MUON/data/MUONTriggerLut.root"); | |
d56db588 | 113 | } |
9afd2481 | 114 | |
a9e2aefa | 115 | Int_t bin; |
116 | Short_t binc; | |
117 | Int_t mask = GetMask(ystrip); // get ystrip mask | |
118 | ||
119 | // Low pt.............................................. | |
9afd2481 | 120 | bin = fLptPlus->GetBin(circuit,xstrip,idev); |
121 | binc = (Short_t)fLptPlus->GetBinContent(bin); | |
a9e2aefa | 122 | if ((binc & mask)!=0) lutLpt[1]=1; |
123 | ||
9afd2481 | 124 | bin = fLptMinu->GetBin(circuit,xstrip,idev); |
125 | binc = (Short_t)fLptMinu->GetBinContent(bin); | |
a9e2aefa | 126 | if ((binc & mask)!=0) lutLpt[0]=1; |
127 | ||
9afd2481 | 128 | bin = fLptUnde->GetBin(circuit,xstrip,idev); |
129 | binc = (Short_t)fLptUnde->GetBinContent(bin); | |
a9e2aefa | 130 | if ((binc & mask)!=0) lutLpt[0]=lutLpt[1]=1; |
131 | ||
132 | // High pt............................................. | |
9afd2481 | 133 | bin = fHptPlus->GetBin(circuit,xstrip,idev); |
134 | binc = (Short_t)fHptPlus->GetBinContent(bin); | |
a9e2aefa | 135 | if ((binc & mask)!=0) lutHpt[1]=1; |
136 | ||
9afd2481 | 137 | bin = fHptMinu->GetBin(circuit,xstrip,idev); |
138 | binc = (Short_t)fHptMinu->GetBinContent(bin); | |
a9e2aefa | 139 | if ((binc & mask)!=0) lutHpt[0]=1; |
140 | ||
9afd2481 | 141 | bin = fHptUnde->GetBin(circuit,xstrip,idev); |
142 | binc = (Short_t)fHptUnde->GetBinContent(bin); | |
a9e2aefa | 143 | if ((binc & mask)!=0) lutHpt[0]=lutHpt[1]=1; |
6ae22475 | 144 | /* |
a9e2aefa | 145 | // All pts............................................. |
9afd2481 | 146 | bin = fAptPlus->GetBin(circuit,xstrip,idev); |
147 | binc = (Short_t)fAptPlus->GetBinContent(bin); | |
a9e2aefa | 148 | if ((binc & mask)!=0) lutApt[1]=1; |
149 | ||
9afd2481 | 150 | bin = fAptMinu->GetBin(circuit,xstrip,idev); |
151 | binc = (Short_t)fAptMinu->GetBinContent(bin); | |
a9e2aefa | 152 | if ((binc & mask)!=0) lutApt[0]=1; |
153 | ||
9afd2481 | 154 | bin = fAptUnde->GetBin(circuit,xstrip,idev); |
155 | binc = (Short_t)fAptUnde->GetBinContent(bin); | |
a9e2aefa | 156 | if ((binc & mask)!=0) lutApt[0]=lutApt[1]=1; |
6ae22475 | 157 | */ |
a9e2aefa | 158 | } |
159 | ||
160 | //---------------------------------------------------------------------- | |
9afd2481 | 161 | Int_t AliMUONTriggerLut::GetMask(Int_t ystrip) |
162 | { | |
5398f946 | 163 | /// Return the mask corresponding to ystrip |
164 | ||
a9e2aefa | 165 | Int_t tabMask[16]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; |
166 | Int_t mask=0; | |
167 | tabMask[ystrip]=1; | |
9afd2481 | 168 | for (Int_t i=0; i<16; i++) |
169 | { | |
170 | mask += tabMask[i]<<i; | |
a9e2aefa | 171 | } |
172 | return mask; | |
173 | } | |
174 | ||
a9e2aefa | 175 | |
176 | ||
177 | ||
178 |