Adding more bins in QA (Alis)
[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
3d1463c8 18
19//-----------------------------------------------------------------------------
9265505b 20// Class AliMUONResponseTrigger
21// -------------------------------
22// Implementation
23// of RPC response
3d1463c8 24//-----------------------------------------------------------------------------
30178c30 25
a9e2aefa 26
9265505b 27#include "AliMUONResponseTrigger.h"
885d501b 28#include "AliMUON.h"
29#include "AliMUONDigit.h"
30#include "AliMUONGeometryTransformer.h"
31#include "AliMUONHit.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 }
885d501b 67}
68
a9e2aefa 69//------------------------------------------------------------------
30178c30 70AliMUONResponseTrigger::AliMUONResponseTrigger()
d5315275 71 : AliMUONResponse()
30178c30 72{
9265505b 73/// Default constructor
74}
75
76//------------------------------------------------------------------
77AliMUONResponseTrigger::~AliMUONResponseTrigger()
78{
79/// Destructor
925e6570 80}
30178c30 81
885d501b 82//_____________________________________________________________________________
83void
a572c9f4 84AliMUONResponseTrigger::DisIntegrate(const AliMUONHit& hit, TList& digits, Float_t /*timeDif*/)
885d501b 85{
9265505b 86 /// Generate 2 digits (one on each cathode) from 1 hit, i.e. no cluster-size
87 /// generation (simplest response case).
885d501b 88
89 digits.Clear();
90
91 Float_t xhit = hit.X();
92 Float_t yhit = hit.Y();
89f3e7d6 93 Float_t zhit = hit.Z();
885d501b 94 Int_t detElemId = hit.DetElemId();
95
96 Double_t x,y,z;
97 Global2Local(detElemId,xhit,yhit,zhit,x,y,z);
98
99 Float_t tof = hit.Age();
100 Int_t twentyNano(100);
d344444e 101 if (tof<AliMUONConstants::TriggerTofLimit())
885d501b 102 {
103 twentyNano=1;
104 }
d5315275 105
7fde4d96 106 Int_t nboard=0;
7d7d22a6 107
866c3232 108 for ( Int_t cath = AliMp::kCath0; cath <= AliMp::kCath1; ++cath )
885d501b 109 {
9265505b 110 const AliMpVSegmentation* seg
866c3232 111 = AliMpSegmentation::Instance()
112 ->GetMpSegmentation(detElemId,AliMp::GetCathodType(cath));
885d501b 113
6e97fbb8 114 AliMpPad pad = seg->PadByPosition(x,y,kFALSE);
168e9c4d 115 Int_t ix = pad.GetIx();
116 Int_t iy = pad.GetIy();
885d501b 117
118 AliDebug(1,Form("xhit,yhit=%e,%e lx,ly,lz=%e,%e,%e ix,iy=%d,%d",
119 xhit,yhit,x,y,z,ix,iy));
120
121 if ( !pad.IsValid() )
122 {
123 AliWarning(Form("hit w/o strip %d-%d xhit,yhit=%e,%e local x,y,z "
124 "%e,%e,%e ix,iy=%d,%d",detElemId,
125 cath,
126 xhit,yhit,x,y,z,ix,iy));
127 continue;
128 }
7fde4d96 129
d5315275 130 if ( cath == AliMp::kCath0 ) nboard = pad.GetLocalBoardId(0);
131
132 AliMUONDigit* d = new AliMUONDigit(detElemId,nboard,
168e9c4d 133 pad.GetLocalBoardChannel(0),cath);
2a7d64a9 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);
7d7d22a6 139
7d7d22a6 140
885d501b 141 digits.Add(d);
885d501b 142 }
7d7d22a6 143}