cout replaced by printf
[u/mrichter/AliRoot.git] / MUON / AliMUONChamberTrigger.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/*
17$Log$
cbc57deb 18Revision 1.9 2002/10/23 07:24:56 alibrary
19Introducing Riostream.h
20
70479d0e 21Revision 1.8 2000/11/20 21:44:17 pcrochet
22some modifications to account for the new class AliMUONResponseTriggerV1
23
03f221a7 24Revision 1.7 2000/10/02 16:58:29 egangler
25Cleaning of the code :
26-> coding conventions
27-> void Streamers
28-> some useless includes removed or replaced by "class" statement
29
ecfa008b 30Revision 1.6 2000/07/03 11:54:57 morsch
31AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
32The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
33
a30a000f 34Revision 1.5 2000/06/29 12:34:09 morsch
35AliMUONSegmentation class has been made independent of AliMUONChamber. This makes
36it usable with any other geometry class. The link to the object to which it belongs is
37established via an index. This assumes that there exists a global geometry manager
38from which the pointer to the parent object can be obtained (in our case gAlice).
39
d81db581 40Revision 1.4 2000/06/29 06:52:02 pcrochet
41pow changed to TMath::Power
42
39f5a0e6 43Revision 1.3 2000/06/28 15:16:35 morsch
44(1) Client code adapted to new method signatures in AliMUONSegmentation (see comments there)
45to allow development of slat-muon chamber simulation and reconstruction code in the MUON
46framework. The changes should have no side effects (mostly dummy arguments).
47(2) Hit disintegration uses 3-dim hit coordinates to allow simulation
48of chambers with overlapping modules (MakePadHits, Disintegration).
49
802a864d 50Revision 1.2 2000/06/15 07:58:48 morsch
51Code from MUON-dev joined
52
a9e2aefa 53Revision 1.1.2.3 2000/06/09 21:27:35 morsch
54Most coding rule violations corrected.
55
56Revision 1.1.2.2 2000/04/26 12:28:25 morsch
57- flag pad hits with condition on ToF (CP)
58- Tof included in the method DisIntegration (CP)
59
60Revision 1.1.2.1 2000/02/17 14:30:54 morsch
61Draft version
62
63*/
64
65#include "AliMUONChamberTrigger.h"
66#include "AliMUONSegmentationTrigger.h"
67#include "AliMUONResponseTrigger.h"
03f221a7 68#include "AliMUONResponseTriggerV1.h"
a9e2aefa 69#include <TObjArray.h>
70#include <TMath.h>
70479d0e 71#include <Riostream.h>
a9e2aefa 72
73ClassImp(AliMUONChamberTrigger)
74
75//-------------------------------------------
d81db581 76
03f221a7 77AliMUONChamberTrigger::AliMUONChamberTrigger()
d81db581 78{
79// Default constructor
80}
81
82
83AliMUONChamberTrigger::AliMUONChamberTrigger(Int_t id) : AliMUONChamber(id)
a9e2aefa 84{
d81db581 85// Constructor using chamber id
a9e2aefa 86}
87
88//-------------------------------------------
89void AliMUONChamberTrigger::DisIntegration(Float_t eloss, Float_t tof,
802a864d 90 Float_t xhit, Float_t yhit, Float_t zhit,
a9e2aefa 91 Int_t& nnew,
92 Float_t newclust[6][500])
93{
94//
95// Generates pad hits (simulated cluster)
96// using the segmentation and the response model
97
98 Int_t twentyNano;
39f5a0e6 99 if (tof<75*TMath::Power(10,-9)) {
a9e2aefa 100 twentyNano=1;
101 } else {
102 twentyNano=100;
103 }
104
a9e2aefa 105 Float_t qp;
106 nnew=0;
107 for (Int_t i=1; i<=fnsec; i++) {
a30a000f 108 AliSegmentation * segmentation=
109 (AliSegmentation*) (*fSegmentation)[i-1];
a9e2aefa 110
111// Find the module & strip Id. which has fired
112 Int_t ix,iy;
113
a30a000f 114 segmentation->GetPadI(xhit,yhit,0,ix,iy);
a9e2aefa 115 segmentation->SetPad(ix,iy);
116
117// treatment of GEANT hits w/o corresponding strip (due to the fact that
118// the 2 geometries are computed in a very slightly different way)
119 if (ix==0&&iy==0) {
cbc57deb 120 printf("AliMUONChamberTrigger hit w/o strip %f %f \n",xhit,yhit);
a9e2aefa 121 } else {
122 // --- store signal information for this strip
123 newclust[0][nnew]=1.; // total charge
124 newclust[1][nnew]=ix; // ix-position of pad
125 newclust[2][nnew]=iy; // iy-position of pad
126 newclust[3][nnew]=twentyNano; // time of flight
127 newclust[4][nnew]=segmentation->ISector(); // sector id
128 newclust[5][nnew]=(Float_t) i; // counter
129 nnew++;
03f221a7 130
131// cluster-size if AliMUONResponseTriggerV1, nothing if AliMUONResponseTrigger
132 if (((AliMUONResponseTrigger*) fResponse)->SetGenerCluster()) {
133
134 // set hits
135 segmentation->SetHit(xhit,yhit,zhit);
136 // get the list of nearest neighbours
137 Int_t nList, xList[10], yList[10];
138 segmentation->Neighbours(ix,iy,&nList,xList,yList);
a9e2aefa 139
03f221a7 140 qp = 0;
141 for (Int_t j=0; j<nList; j++){ // loop over neighbours
142 if (xList[j]!=0) { // existing neighbour
143 if (j==0||j==5||qp!=0) { // built-up cluster-size
144
145 // neighbour real coordinates (just for checks here)
146 Float_t x,y,z;
147 segmentation->GetPadC(xList[j],yList[j],x,y,z);
148 // set pad (fx fy & fix fiy are the current pad coord. & Id.)
149 segmentation->SetPad(xList[j],yList[j]);
150 // get the chamber (i.e. current strip) response
151 qp=fResponse->IntXY(segmentation);
152
153 if (qp > 0.5) {
154 // --- store signal information for neighbours
155 newclust[0][nnew]=qp; // total charge
156 newclust[1][nnew]=segmentation->Ix(); // ix-pos. of pad
157 newclust[2][nnew]=segmentation->Iy(); // iy-pos. of pad
158 newclust[3][nnew]=twentyNano; // time of flight
159 newclust[4][nnew]=segmentation->ISector(); // sector id
160 newclust[5][nnew]=(Float_t) i; // counter
161 nnew++;
162 } // qp > 0.5
163 } // built-up cluster-size
164 } // existing neighbour
165 } // loop over neighbours
166 } // endif hit w/o strip
167 } // loop over planes
168 } // if AliMUONResponseTriggerV1
a9e2aefa 169}
170
171
172
173
174
175
176
177
03f221a7 178
179