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