Code from MUON-dev joined
[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 **************************************************************************/
15/*
16$Log$
17Revision 1.1.2.5 2000/06/09 21:27:01 morsch
18Most coding rule violations corrected.
19
20Revision 1.1.2.4 2000/05/05 11:34:12 morsch
21Log inside comments.
22
23Revision 1.1.2.3 2000/05/05 10:09:52 morsch
24Log messages included
25*/
26
27#include "AliMUONChamber.h"
28#include "AliMUONSegmentation.h"
29#include "AliMUONResponse.h"
30
31#include "TMath.h"
32ClassImp(AliMUONChamber)
33
34 AliMUONChamber::AliMUONChamber()
35{
36 fSegmentation = new TObjArray(2);
37 (*fSegmentation)[0] = 0;
38 (*fSegmentation)[1] = 0;
39 fResponse=0;
40 fnsec=1;
41 fReconstruction=0;
42}
43
44AliMUONChamber::~AliMUONChamber()
45{
46 if (fSegmentation) delete fSegmentation;
47}
48
49AliMUONChamber::AliMUONChamber(const AliMUONChamber& rChamber)
50{
51// Dummy copy constructor
52 ;
53}
54
55
56void AliMUONChamber::Init()
57{
58// Initalisation ..
59//
60// ... for chamber segmentation
61 if ((*fSegmentation)[0])
62 ((AliMUONSegmentation *) (*fSegmentation)[0])->Init(this);
63
64 if (fnsec==2) {
65 if ((*fSegmentation)[1])
66 ((AliMUONSegmentation *) (*fSegmentation)[1])->Init(this);
67 }
68}
69
70Int_t AliMUONChamber::SigGenCond(Float_t x, Float_t y, Float_t z)
71{
72// Ask segmentation if signal should be generated
73 if (fnsec==1) {
74 return ((AliMUONSegmentation*) (*fSegmentation)[0])
75 ->SigGenCond(x, y, z) ;
76 } else {
77 return (((AliMUONSegmentation*) (*fSegmentation)[0])
78 ->SigGenCond(x, y, z)) ||
79 (((AliMUONSegmentation*) (*fSegmentation)[1])
80 ->SigGenCond(x, y, z)) ;
81 }
82}
83
84
85void AliMUONChamber::SigGenInit(Float_t x, Float_t y, Float_t z)
86{
87//
88// Initialisation of segmentation for hit
89//
90 if (fnsec==1) {
91 ((AliMUONSegmentation*) (*fSegmentation)[0])->SigGenInit(x, y, z) ;
92 } else {
93 ((AliMUONSegmentation*) (*fSegmentation)[0])->SigGenInit(x, y, z) ;
94 ((AliMUONSegmentation*) (*fSegmentation)[1])->SigGenInit(x, y, z) ;
95 }
96}
97
98void AliMUONChamber::DisIntegration(Float_t eloss, Float_t tof,
99 Float_t xhit, Float_t yhit,
100 Int_t& nnew,Float_t newclust[6][500])
101{
102//
103// Generates pad hits (simulated cluster)
104// using the segmentation and the response model
105 Float_t dx, dy;
106 //
107 // Width of the integration area
108 //
109 dx=fResponse->SigmaIntegration()*fResponse->ChargeSpreadX();
110 dy=fResponse->SigmaIntegration()*fResponse->ChargeSpreadY();
111 //
112 // Get pulse height from energy loss
113 Float_t qtot = fResponse->IntPH(eloss);
114 //
115 // Loop Over Pads
116
117 Float_t qcheck=0, qp;
118 nnew=0;
119 for (Int_t i=1; i<=fnsec; i++) {
120 qcheck=0;
121 AliMUONSegmentation * segmentation=
122 (AliMUONSegmentation *) (*fSegmentation)[i-1];
123 for (segmentation->FirstPad(xhit, yhit, dx, dy);
124 segmentation->MorePads();
125 segmentation->NextPad())
126 {
127 qp=fResponse->IntXY(segmentation);
128 qp=TMath::Abs(qp);
129
130//
131//
132 if (qp > 1.e-4) {
133 qcheck+=qp;
134 //
135 // --- store signal information
136 newclust[0][nnew]=qtot; // total charge
137 newclust[1][nnew]=segmentation->Ix(); // ix-position of pad
138 newclust[2][nnew]=segmentation->Iy(); // iy-position of pad
139 newclust[3][nnew]=qp * qtot; // charge on pad
140 newclust[4][nnew]=segmentation->ISector(); // sector id
141 newclust[5][nnew]=(Float_t) i; // counter
142 nnew++;
143 }
144 } // Pad loop
145 } // Cathode plane loop
146}
147
148
149
150void AliMUONChamber::InitGeo(Float_t zpos)
151{
152// sensitive gas gap
153 fdGas= 0.5;
154// 3% radiation length of aluminum (X0=8.9 cm)
155 fdAlu= 3.0/100*8.9;
156}
157
158
159AliMUONChamber & AliMUONChamber::operator =(const AliMUONChamber& rhs)
160{
161// Dummy assignment operator
162 return *this;
163}