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