]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONResponseTrigger.cxx
Be sure to load mapping when needed
[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"
7d7d22a6 33#include "AliMUONTriggerEfficiencyCells.h"
f3d288ab 34#include "AliMUONTriggerChamberEfficiency.h"
9265505b 35
885d501b 36#include "AliMpPad.h"
866c3232 37#include "AliMpCathodType.h"
885d501b 38#include "AliMpPlaneType.h"
9265505b 39#include "AliMpSegmentation.h"
885d501b 40#include "AliMpVSegmentation.h"
9265505b 41
885d501b 42#include "AliRun.h"
9265505b 43#include "AliLog.h"
885d501b 44#include "TList.h"
885d501b 45
9265505b 46/// \cond CLASSIMP
a9e2aefa 47ClassImp(AliMUONResponseTrigger)
9265505b 48/// \endcond
a9e2aefa 49
885d501b 50namespace
51{
885d501b 52 AliMUON* muon()
53 {
54 return static_cast<AliMUON*>(gAlice->GetModule("MUON"));
55 }
56
57 void Global2Local(Int_t detElemId, Double_t xg, Double_t yg, Double_t zg,
58 Double_t& xl, Double_t& yl, Double_t& zl)
59 {
60 // ideally should be :
61 // Double_t x,y,z;
62 // AliMUONGeometry::Global2Local(detElemId,xg,yg,zg,x,y,z);
63 // but while waiting for this geometry singleton, let's go through
64 // AliMUON still.
65
66 const AliMUONGeometryTransformer* transformer = muon()->GetGeometryTransformer();
67 transformer->Global2Local(detElemId,xg,yg,zg,xl,yl,zl);
68 }
885d501b 69}
70
30178c30 71//------------------------------------------------------------------
72AliMUONResponseTrigger::AliMUONResponseTrigger()
7d7d22a6 73 : AliMUONResponse(),
74 fTriggerEfficiency(0x0)
30178c30 75{
9265505b 76/// Default constructor
77}
78
79//------------------------------------------------------------------
80AliMUONResponseTrigger::~AliMUONResponseTrigger()
81{
82/// Destructor
925e6570 83}
30178c30 84
885d501b 85//_____________________________________________________________________________
86void
a572c9f4 87AliMUONResponseTrigger::DisIntegrate(const AliMUONHit& hit, TList& digits, Float_t /*timeDif*/)
885d501b 88{
9265505b 89 /// Generate 2 digits (one on each cathode) from 1 hit, i.e. no cluster-size
90 /// generation (simplest response case).
885d501b 91
92 digits.Clear();
93
94 Float_t xhit = hit.X();
95 Float_t yhit = hit.Y();
89f3e7d6 96 Float_t zhit = hit.Z();
885d501b 97 Int_t detElemId = hit.DetElemId();
98
99 Double_t x,y,z;
100 Global2Local(detElemId,xhit,yhit,zhit,x,y,z);
101
102 Float_t tof = hit.Age();
103 Int_t twentyNano(100);
d344444e 104 if (tof<AliMUONConstants::TriggerTofLimit())
885d501b 105 {
106 twentyNano=1;
107 }
7d7d22a6 108
109 Bool_t isTrig[2]={kTRUE,kTRUE};
7fde4d96 110 Int_t nboard=0;
7d7d22a6 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
6e97fbb8 118 AliMpPad pad = seg->PadByPosition(x,y,kFALSE);
168e9c4d 119 Int_t ix = pad.GetIx();
120 Int_t iy = pad.GetIy();
885d501b 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 }
7fde4d96 133
134 if(fTriggerEfficiency){
135 if(cath==0){
136 nboard = pad.GetLocalBoardId(0);
137 fTriggerEfficiency->IsTriggered(detElemId, nboard,
138 isTrig[0], isTrig[1]);
139 }
140 if(!isTrig[cath]) continue;
141 }
142
168e9c4d 143 AliMUONDigit* d = new AliMUONDigit(detElemId,pad.GetLocalBoardId(0),
144 pad.GetLocalBoardChannel(0),cath);
2a7d64a9 145 d->SetPadXY(ix,iy);
146
147 //FIXME : a trigger digit can have several locations.
148 //this is not currently supported by the digit class. Change that or not ?
149 d->SetCharge(twentyNano);
7d7d22a6 150
7d7d22a6 151
885d501b 152 digits.Add(d);
885d501b 153 }
154
7fde4d96 155 if ( fTriggerEfficiency ) AliDebug(1,Form("MTReff: DetElemId %i Board %3i Fired %i %i", detElemId, nboard, isTrig[0], isTrig[1]));
885d501b 156}
157
a9e2aefa 158
7d7d22a6 159//_____________________________________________________________________________
160void
161AliMUONResponseTrigger::InitTriggerEfficiency(AliMUONTriggerEfficiencyCells *triggerEfficiency)
162{
163/// Initialize trigger chamber efficiency (on demand)
a9e2aefa 164
f3d288ab 165 if ( triggerEfficiency )
7d7d22a6 166 {
167 AliDebug(1, "Will apply trigger efficiency");
168 }
169 else
170 {
171 AliFatal("I was requested to apply trigger efficiency, but I could "
172 "not get it !");
173 }
f3d288ab 174 fTriggerEfficiency = new AliMUONTriggerChamberEfficiency(triggerEfficiency);
175
7d7d22a6 176}