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