]>
Commit | Line | Data |
---|---|---|
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 | **************************************************************************/ | |
15 | ||
16 | /* $Id$ */ | |
17 | ||
18 | ||
19 | //----------------------------------------------------------------------------- | |
20 | // Class AliMUONResponseTrigger | |
21 | // ------------------------------- | |
22 | // Implementation | |
23 | // of RPC response | |
24 | //----------------------------------------------------------------------------- | |
25 | ||
26 | ||
27 | #include "AliMUONResponseTrigger.h" | |
28 | #include "AliMUON.h" | |
29 | #include "AliMUONDigit.h" | |
30 | #include "AliMUONGeometryTransformer.h" | |
31 | #include "AliMUONHit.h" | |
32 | #include "AliMUONConstants.h" | |
33 | #include "AliMUONTriggerEfficiencyCells.h" | |
34 | #include "AliMUONTriggerChamberEfficiency.h" | |
35 | ||
36 | #include "AliMpPad.h" | |
37 | #include "AliMpCathodType.h" | |
38 | #include "AliMpPlaneType.h" | |
39 | #include "AliMpSegmentation.h" | |
40 | #include "AliMpVSegmentation.h" | |
41 | ||
42 | #include "AliRun.h" | |
43 | #include "AliLog.h" | |
44 | #include "TList.h" | |
45 | ||
46 | /// \cond CLASSIMP | |
47 | ClassImp(AliMUONResponseTrigger) | |
48 | /// \endcond | |
49 | ||
50 | namespace | |
51 | { | |
52 | AliMUON* muon() | |
53 | { | |
54 | return static_cast<AliMUON*>(gAlice->GetModule("MUON")); | |
55 | } | |
56 | ||
57 | void Global2Local(Int_t detElemId, Double_t xg, Double_t yg, Double_t zg, | |
58 | Double_t& xl, Double_t& yl, Double_t& zl) | |
59 | { | |
60 | // ideally should be : | |
61 | // Double_t x,y,z; | |
62 | // AliMUONGeometry::Global2Local(detElemId,xg,yg,zg,x,y,z); | |
63 | // but while waiting for this geometry singleton, let's go through | |
64 | // AliMUON still. | |
65 | ||
66 | const AliMUONGeometryTransformer* transformer = muon()->GetGeometryTransformer(); | |
67 | transformer->Global2Local(detElemId,xg,yg,zg,xl,yl,zl); | |
68 | } | |
69 | } | |
70 | ||
71 | //------------------------------------------------------------------ | |
72 | AliMUONResponseTrigger::AliMUONResponseTrigger() | |
73 | : AliMUONResponse(), | |
74 | fTriggerEfficiency(0x0) | |
75 | { | |
76 | /// Default constructor | |
77 | } | |
78 | ||
79 | //------------------------------------------------------------------ | |
80 | AliMUONResponseTrigger::~AliMUONResponseTrigger() | |
81 | { | |
82 | /// Destructor | |
83 | } | |
84 | ||
85 | //_____________________________________________________________________________ | |
86 | void | |
87 | AliMUONResponseTrigger::DisIntegrate(const AliMUONHit& hit, TList& digits, Float_t /*timeDif*/) | |
88 | { | |
89 | /// Generate 2 digits (one on each cathode) from 1 hit, i.e. no cluster-size | |
90 | /// generation (simplest response case). | |
91 | ||
92 | digits.Clear(); | |
93 | ||
94 | Float_t xhit = hit.X(); | |
95 | Float_t yhit = hit.Y(); | |
96 | Float_t zhit = hit.Z(); | |
97 | Int_t detElemId = hit.DetElemId(); | |
98 | ||
99 | Double_t x,y,z; | |
100 | Global2Local(detElemId,xhit,yhit,zhit,x,y,z); | |
101 | ||
102 | Float_t tof = hit.Age(); | |
103 | Int_t twentyNano(100); | |
104 | if (tof<AliMUONConstants::TriggerTofLimit()) | |
105 | { | |
106 | twentyNano=1; | |
107 | } | |
108 | ||
109 | Bool_t isTrig[2]={kTRUE,kTRUE}; | |
110 | ||
111 | for ( Int_t cath = AliMp::kCath0; cath <= AliMp::kCath1; ++cath ) | |
112 | { | |
113 | const AliMpVSegmentation* seg | |
114 | = AliMpSegmentation::Instance() | |
115 | ->GetMpSegmentation(detElemId,AliMp::GetCathodType(cath)); | |
116 | ||
117 | AliMpPad pad = seg->PadByPosition(x,y,kFALSE); | |
118 | Int_t ix = pad.GetIx(); | |
119 | Int_t iy = pad.GetIy(); | |
120 | ||
121 | AliDebug(1,Form("xhit,yhit=%e,%e lx,ly,lz=%e,%e,%e ix,iy=%d,%d", | |
122 | xhit,yhit,x,y,z,ix,iy)); | |
123 | ||
124 | if ( !pad.IsValid() ) | |
125 | { | |
126 | AliWarning(Form("hit w/o strip %d-%d xhit,yhit=%e,%e local x,y,z " | |
127 | "%e,%e,%e ix,iy=%d,%d",detElemId, | |
128 | cath, | |
129 | xhit,yhit,x,y,z,ix,iy)); | |
130 | continue; | |
131 | } | |
132 | AliMUONDigit* d = new AliMUONDigit(detElemId,pad.GetLocalBoardId(0), | |
133 | pad.GetLocalBoardChannel(0),cath); | |
134 | d->SetPadXY(ix,iy); | |
135 | ||
136 | //FIXME : a trigger digit can have several locations. | |
137 | //this is not currently supported by the digit class. Change that or not ? | |
138 | d->SetCharge(twentyNano); | |
139 | ||
140 | if(fTriggerEfficiency){ | |
141 | if(cath==0){ | |
142 | Int_t nboard = pad.GetLocalBoardId(0); | |
143 | fTriggerEfficiency->IsTriggered(detElemId, nboard, | |
144 | isTrig[0], isTrig[1]); | |
145 | } | |
146 | if(!isTrig[cath]) continue; | |
147 | } | |
148 | ||
149 | digits.Add(d); | |
150 | } | |
151 | ||
152 | } | |
153 | ||
154 | ||
155 | //_____________________________________________________________________________ | |
156 | void | |
157 | AliMUONResponseTrigger::InitTriggerEfficiency(AliMUONTriggerEfficiencyCells *triggerEfficiency) | |
158 | { | |
159 | /// Initialize trigger chamber efficiency (on demand) | |
160 | ||
161 | if ( triggerEfficiency ) | |
162 | { | |
163 | AliDebug(1, "Will apply trigger efficiency"); | |
164 | } | |
165 | else | |
166 | { | |
167 | AliFatal("I was requested to apply trigger efficiency, but I could " | |
168 | "not get it !"); | |
169 | } | |
170 | fTriggerEfficiency = new AliMUONTriggerChamberEfficiency(triggerEfficiency); | |
171 | ||
172 | } |