]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONChamber.cxx
Minor fixes in the event tag to take into account the new way of storing the trigger...
[u/mrichter/AliRoot.git] / MUON / AliMUONChamber.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 **************************************************************************/
2682e810 15
88cb7938 16/* $Id$ */
a9e2aefa 17
d19b6003 18// -----------------------
19// Class AliMUONChamber
20// -----------------------
21// MUON tracking chamber class
22// now only providing DisIntegration function
23
30178c30 24// --- ROOT includes ---
25#include <TRandom.h>
26#include <TMath.h>
a713db22 27#include "AliRun.h"
28
30178c30 29
681d067b 30// --- MUON includes ---
a713db22 31#include "AliMUON.h"
a9e2aefa 32#include "AliMUONChamber.h"
cbf9f933 33#include "AliMUONSegmentation.h"
a713db22 34#include "AliMUONHit.h"
8c343c7c 35#include "AliLog.h"
a9e2aefa 36
a9e2aefa 37ClassImp(AliMUONChamber)
38
30178c30 39AliMUONChamber::AliMUONChamber()
40 : TObject(),
41 fId(0),
30178c30 42 fCurrentCorrel(1), // to avoid mistakes if ChargeCorrelInit is not called
30178c30 43 fResponse(0),
a713db22 44 fMUON(0)
d81db581 45{
d19b6003 46/// Default constructor
cbf9f933 47
48 AliDebug(1, Form("default (empty) ctor this = %p", this));
d81db581 49}
50
a713db22 51//_______________________________________________________
30178c30 52AliMUONChamber::AliMUONChamber(Int_t id)
53 : TObject(),
54 fId(id),
30178c30 55 fCurrentCorrel(1), // to avoid mistakes if ChargeCorrelInit is not called
30178c30 56 fResponse(0),
a713db22 57 fMUON(0)
a9e2aefa 58{
d19b6003 59/// Standard constructor
a713db22 60
61 // muon
62 fMUON = (AliMUON*)gAlice->GetModule("MUON");
63 if (!fMUON) {
64 AliFatal("MUON detector not defined.");
65 return;
66 }
002920d1 67
cbf9f933 68 AliDebug(1, Form("ctor this = %p", this) );
30178c30 69}
70
a713db22 71//_______________________________________________________
30178c30 72AliMUONChamber::AliMUONChamber(const AliMUONChamber& rChamber)
73 : TObject(rChamber)
74{
d19b6003 75/// Protected copy constructor
30178c30 76
8c343c7c 77 AliFatal("Not implemented.");
a713db22 78 // Dummy copy constructor
a9e2aefa 79}
80
a713db22 81//_______________________________________________________
a9e2aefa 82AliMUONChamber::~AliMUONChamber()
83{
d19b6003 84/// Destructor
002920d1 85
cbf9f933 86 AliDebug(1, Form("dtor this = %p", this));
a9e2aefa 87}
88
a713db22 89//_______________________________________________________
30178c30 90AliMUONChamber & AliMUONChamber::operator =(const AliMUONChamber& rhs)
390151b8 91{
d19b6003 92/// Protected assignement operator
a9e2aefa 93
30178c30 94 if (this == &rhs) return *this;
95
8c343c7c 96 AliFatal("Not implemented.");
30178c30 97
98 return *this;
99}
a9e2aefa 100
a713db22 101//_____________________________________________________
d19b6003 102void AliMUONChamber::ChargeCorrelationInit()
103{
104/// Initialisation of charge correlation for current hit
105/// the value is stored, and then used by Disintegration
953daa5a 106
107 // exponential is here to avoid eventual problems in 0
108 // factor 2 because chargecorrel is q1/q2 and not q1/qtrue
16d57990 109 fCurrentCorrel = TMath::Exp(gRandom->Gaus(0,fResponse->ChargeCorrel()/2));
681d067b 110}
111
a713db22 112//_______________________________________________________
113void AliMUONChamber::DisIntegration(AliMUONHit *hit,
114 Int_t& nnew,Float_t newclust[6][500])
115{
d19b6003 116/// Generates pad hits (simulated cluster)
117/// using the segmentation and the response model
118
a713db22 119 Float_t dx, dy;
120
121 Float_t xhit = hit->X();
122 Float_t yhit = hit->Y();
123 Float_t zhit = hit->Z();
124 Int_t id = hit->DetElemId();
125 Float_t eloss = hit->Eloss();
a9e2aefa 126
a713db22 127 //
128 // Width of the integration area
129 //
130 dx=fResponse->SigmaIntegration()*fResponse->ChargeSpreadX();
131 dy=fResponse->SigmaIntegration()*fResponse->ChargeSpreadY();
132 //
133 // Get pulse height from energy loss
134 Float_t qtot = fResponse->IntPH(eloss);
135 //
136 // Loop Over Pads
137
138 Float_t qp;
139 nnew=0;
140
141 // Cathode plane loop
953daa5a 142 for (Int_t i = 1; i <= 2; i++) {
a713db22 143 Float_t qcath = qtot * (i==1? fCurrentCorrel : 1/fCurrentCorrel);
cbf9f933 144
a713db22 145 AliMUONGeometrySegmentation* segmentation=
cbf9f933 146 fMUON->GetSegmentation()->GetModuleSegmentation(fId, i-1);
a713db22 147
148 for (segmentation->FirstPad(id, xhit, yhit, zhit, dx, dy);
149 segmentation->MorePads(id);
150 segmentation->NextPad(id))
151 {
152 qp=fResponse->IntXY(id, segmentation);
153 qp=TMath::Abs(qp);
154 //
155 //
156 if (qp > 1.e-4)
157 {
158 if (nnew >= 500) // Perform a bounds check on nnew since it is assumed
159 // newclust only contains 500 elements.
160 {
161 AliError("Limit of 500 pad responses reached.");
162 return;
163 };
164 //
165 // --- store signal information
166 newclust[0][nnew]=qcath; // total charge
167 newclust[1][nnew]=segmentation->Ix(); // ix-position of pad
168 newclust[2][nnew]=segmentation->Iy(); // iy-position of pad
169 newclust[3][nnew]=qp * qcath; // charge on pad
170 newclust[4][nnew]=segmentation->ISector(); // sector id
171 newclust[5][nnew]=(Float_t) i; // counter
172 nnew++;
173
174 }
175 } // Pad loop
176 } // Cathode plane loop
177}