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