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