Additional protection and warning message.
[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
88cb7938 16/* $Id$ */
a9e2aefa 17
18#include "AliMUONChamberTrigger.h"
a9e2aefa 19#include "AliMUONResponseTrigger.h"
76fa1113 20#include "AliMUONHit.h"
b7ef3c96 21#include "AliMUON.h"
22#include "AliMUONSegmentation.h"
76fa1113 23#include "AliMUONGeometrySegmentation.h"
b7ef3c96 24#include "AliMUONGeometryTransformer.h"
c4a97bcd 25#include "AliLog.h"
a9e2aefa 26
27ClassImp(AliMUONChamberTrigger)
28
29//-------------------------------------------
d81db581 30
03f221a7 31AliMUONChamberTrigger::AliMUONChamberTrigger()
b7ef3c96 32 : AliMUONChamber(),
33 fkGeomTransformer(0)
d81db581 34{
35// Default constructor
36}
37
38
b7ef3c96 39AliMUONChamberTrigger::AliMUONChamberTrigger(Int_t id,
40 const AliMUONGeometryTransformer* kGeometryTransformer)
41 : AliMUONChamber(id),
42 fkGeomTransformer(kGeometryTransformer)
a9e2aefa 43{
d81db581 44// Constructor using chamber id
a9e2aefa 45}
46
47//-------------------------------------------
76fa1113 48void AliMUONChamberTrigger::DisIntegration(AliMUONHit* hit,
49 Int_t& nnew,
50 Float_t newclust[6][500])
51{
52//
53// Generates pad hits (simulated cluster)
54// using the segmentation and the response model
55
56
57 Float_t tof = hit->Age();
58 Float_t xhit = hit->X();
59 Float_t yhit = hit->Y();
60 Float_t zhit = hit->Z();
61 Int_t id = hit->DetElemId();
62
63 Int_t twentyNano;
64 if (tof<75*TMath::Power(10,-9)) {
65 twentyNano=1;
66 } else {
67 twentyNano=100;
68 }
69
70 Float_t qp;
71 nnew=0;
953daa5a 72 for (Int_t i = 1; i <= 2; i++) {
b7ef3c96 73
74 AliMUONGeometrySegmentation* segmentation=
75 fMUON->GetSegmentation()->GetModuleSegmentation(fId, i-1);
76
76fa1113 77
78// Find the module & strip Id. which has fired
ba2d2202 79 Int_t ix(-1);
80 Int_t iy(-1);
76fa1113 81 segmentation->GetPadI(id,xhit,yhit,0,ix,iy);
67e7e5a7 82// treatment of GEANT hits w/o corresponding strip (due to the fact that
83// geometry & segmentation are computed in a very slightly different way)
ba2d2202 84 if ( ix<0 || iy<0 )
85 {
86 Float_t lx,ly,lz;
b7ef3c96 87 fkGeomTransformer->Global2Local(id,xhit,yhit,0,lx,ly,lz);
ba2d2202 88 AliWarning(Form("AliMUONChamberTrigger hit w/o strip %i-%d %e %e "
89 "local %e %e %e ix,iy=%d,%d\n",id,i-1,xhit,yhit,lx,ly,lz,ix,iy));
90 } else
91 {
92 segmentation->SetPad(id,ix,iy);
93 if (xhit<0) ix = -ix;
94 // printf(" fId id fnsec xhit yhit zhit ix iy %i %i %i %f %f %f %i %i \n",fId,i,id,xhit,yhit,zhit,ix,iy);
95 // if (ix < 0 || ix > 10000) return;
96 // if (iy < 0 || iy > 10000) return;
97
76fa1113 98 // --- store signal information for this strip
ba2d2202 99 newclust[0][nnew]=1.; // total charge
100 newclust[1][nnew]=ix; // ix-position of pad
101 newclust[2][nnew]=iy; // iy-position of pad
102 newclust[3][nnew]=twentyNano; // time of flight
103 newclust[4][nnew]=segmentation->ISector(); // sector id
104 newclust[5][nnew]=(Float_t) i; // counter
105 nnew++;
106
107 // cluster-size if AliMUONResponseTriggerV1, nothing if AliMUONResponseTrigger
108 if (((AliMUONResponseTrigger*) fResponse)->SetGenerCluster()) {
67e7e5a7 109
110 // set hits
111 segmentation->SetHit(id,xhit,yhit,zhit);
112 // get the list of nearest neighbours
113 Int_t nList, xList[10], yList[10];
114 segmentation->Neighbours(id,ix,iy,&nList,xList,yList);
115
116 qp = 0;
117 for (Int_t j=0; j<nList; j++){ // loop over neighbours
118 if (xList[j]!=0) { // existing neighbour
119 if (j==0||j==5||qp!=0) { // built-up cluster-size
120
121 // neighbour real coordinates (just for checks here)
122 Float_t x,y,z;
123 segmentation->GetPadC(id,xList[j],yList[j],x,y,z);
124 // set pad (fx fy & fix fiy are the current pad coord. & Id.)
125 segmentation->SetPad(id,xList[j],yList[j]);
126 // get the chamber (i.e. current strip) response
127 qp=fResponse->IntXY(id,segmentation);
128
129 if (qp > 0.5) {
130 // --- store signal information for neighbours
131 newclust[0][nnew]=qp; // total charge
132 newclust[1][nnew]=segmentation->Ix(); // ix-pos. of pad
133 newclust[2][nnew]=segmentation->Iy(); // iy-pos. of pad
134 newclust[3][nnew]=twentyNano; // time of flight
135 newclust[4][nnew]=segmentation->ISector(); // sector id
136 newclust[5][nnew]=(Float_t) i; // counter
137 nnew++;
138 } // qp > 0.5
139 } // built-up cluster-size
140 } // existing neighbour
141 } // loop over neighbours
142 } // endif hit w/o strip
76fa1113 143 } // loop over planes
144 } // if AliMUONResponseTriggerV1
145}
a9e2aefa 146
147
148
149
03f221a7 150
151