]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONResponseTrigger.cxx
Corrected mapping management group definition
[u/mrichter/AliRoot.git] / MUON / AliMUONResponseTrigger.cxx
CommitLineData
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 **************************************************************************/
15
88cb7938 16/* $Id$ */
a9e2aefa 17
30178c30 18
a9e2aefa 19#include "AliMUONResponseTrigger.h"
a9e2aefa 20
885d501b 21#include "AliLog.h"
22#include "AliMUON.h"
23#include "AliMUONDigit.h"
24#include "AliMUONGeometryTransformer.h"
25#include "AliMUONHit.h"
26#include "AliMUONSegmentation.h"
27#include "AliMpPad.h"
28#include "AliMpPlaneType.h"
29#include "AliMpVSegmentation.h"
30#include "AliRun.h"
31#include "TList.h"
32#include "AliMUONTriggerSegmentationV2.h"
33
a9e2aefa 34ClassImp(AliMUONResponseTrigger)
35
885d501b 36namespace
37{
38 Float_t TOFLIMIT = 75E-9;
39
40 AliMUON* muon()
41 {
42 return static_cast<AliMUON*>(gAlice->GetModule("MUON"));
43 }
44
45 void Global2Local(Int_t detElemId, Double_t xg, Double_t yg, Double_t zg,
46 Double_t& xl, Double_t& yl, Double_t& zl)
47 {
48 // ideally should be :
49 // Double_t x,y,z;
50 // AliMUONGeometry::Global2Local(detElemId,xg,yg,zg,x,y,z);
51 // but while waiting for this geometry singleton, let's go through
52 // AliMUON still.
53
54 const AliMUONGeometryTransformer* transformer = muon()->GetGeometryTransformer();
55 transformer->Global2Local(detElemId,xg,yg,zg,xl,yl,zl);
56 }
57
58 AliMUONSegmentation* Segmentation()
59 {
60 static AliMUONSegmentation* segmentation = muon()->GetSegmentation();
61 return segmentation;
62 }
63}
64
30178c30 65//------------------------------------------------------------------
66AliMUONResponseTrigger::AliMUONResponseTrigger()
7e4a628d 67 : AliMUONResponse()
30178c30 68{
69// Default constructor
925e6570 70}
30178c30 71
a9e2aefa 72//------------------------------------------------------------------
9aba451b 73Int_t AliMUONResponseTrigger::DigitResponse(Int_t digit,
5b082c5d 74 AliMUONTransientDigit* /*where*/){
a9e2aefa 75// only digital (0/1) information available
7871af75 76
77 if (digit)
78 return kTRUE;
79 else
80 return digit;
81
a9e2aefa 82}
83
84
885d501b 85//_____________________________________________________________________________
86void
87AliMUONResponseTrigger::DisIntegrate(const AliMUONHit& hit, TList& digits)
88{
89 //
90 // Generate 2 digits (one on each cathode) from 1 hit, i.e. no cluster-size
91 // generation (simplest response case).
92 //
93
94 digits.Clear();
95
96 Float_t xhit = hit.X();
97 Float_t yhit = hit.Y();
98 Float_t zhit = 0; // FIXME : should it be hit.Z() ?
99 Int_t detElemId = hit.DetElemId();
100
101 Double_t x,y,z;
102 Global2Local(detElemId,xhit,yhit,zhit,x,y,z);
103
104 Float_t tof = hit.Age();
105 Int_t twentyNano(100);
106 if (tof<TOFLIMIT)
107 {
108 twentyNano=1;
109 }
110
111 for ( Int_t cath = 0; cath < 2; ++cath )
112 {
113 const AliMpVSegmentation* seg = Segmentation()->GetMpSegmentation(detElemId,cath);
114
115 AliMpPad pad = seg->PadByPosition(TVector2(x,y),kFALSE);
116 Int_t ix = pad.GetIndices().GetFirst();
117 Int_t iy = pad.GetIndices().GetSecond();
118
119 AliDebug(1,Form("xhit,yhit=%e,%e lx,ly,lz=%e,%e,%e ix,iy=%d,%d",
120 xhit,yhit,x,y,z,ix,iy));
121
122 if ( !pad.IsValid() )
123 {
124 AliWarning(Form("hit w/o strip %d-%d xhit,yhit=%e,%e local x,y,z "
125 "%e,%e,%e ix,iy=%d,%d",detElemId,
126 cath,
127 xhit,yhit,x,y,z,ix,iy));
128 continue;
129 }
130 AliMUONDigit* d = new AliMUONDigit;
131 d->SetDetElemId(detElemId);
0a04ebd2 132/* pc 09/02/06 no need for that anymore : trigger is in local numbering
133
885d501b 134 //FIXME: >> the following code to get the ixGlo and iyGlo is a bad hack
135 // because trigger has not yet switched to local numbering of its indices !
136 // We should be able to use directly the (local) ix,iy from the pad !
137 const AliMUONTriggerSegmentationV2* old =
138 dynamic_cast<const AliMUONTriggerSegmentationV2*>
139 (Segmentation()->GetDESegmentation(detElemId,cath));
140 if ( !old )
141 {
142 AliFatal("Got a wrong TriggerSegmentation object! Check that!");
143 }
144 Int_t ixGlo;
145 Int_t iyGlo;
146 old->ILoc2IGlo(ix,iy,ixGlo,iyGlo);
147 if ( xhit < 0 ) ixGlo = -ixGlo;
148 // << end of bad hack.
149 d->SetPadX(ixGlo);
150 d->SetPadY(iyGlo);
0a04ebd2 151*/
152 d->SetPadX(ix);
153 d->SetPadY(iy);
154
885d501b 155 d->SetSignal(twentyNano);
156 d->AddPhysicsSignal(d->Signal());
157 d->SetCathode(cath);
158 digits.Add(d);
159 // AliDebug(1,Form("Adding digit DE %d Cathode %d (%d,%d) signal %d",
160// detElemId,cath,ixGlo,iyGlo,twentyNano));
161 }
162
163// StdoutToAliDebug(1,digits.Print(););
164// AliDebug(1,Form("Number of digits for detelem %d track %d : %d",
165// hit.DetElemId(),hit.Track(),digits.GetSize()));
166//
167}
168
a9e2aefa 169
170
171
172