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