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