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