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