]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RICH/AliRICHv1.cxx
Fixed compiling error for HP (multiple declaration)
[u/mrichter/AliRoot.git] / RICH / AliRICHv1.cxx
CommitLineData
c28632f0 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$
7f36f6bc 18 Revision 1.2 2000/06/12 15:36:16 jbarbosa
19 Cleaned up version.
20
237c933d 21 Revision 1.1 2000/06/09 15:00:31 jbarbosa
22 New full version. All parameters configurable.
23
c28632f0 24 Revision 1.9 2000/05/31 08:19:38 jbarbosa
25 Fixed bug in StepManager
26
27 Revision 1.8 2000/05/26 17:30:08 jbarbosa
28 Cerenkov angle now stored within cerenkov data structure.
29
30 Revision 1.7 2000/05/18 10:31:36 jbarbosa
31 Fixed positioning of spacers inside freon.
32 Fixed positioning of proximity gap
33 inside methane.
34 Fixed cut on neutral particles in the StepManager.
35
36 Revision 1.6 2000/04/28 11:51:58 morsch
37 Dimensions of arrays hits and Ckov_data corrected.
38
39 Revision 1.5 2000/04/19 13:28:46 morsch
40 Major changes in geometry (parametrised), materials (updated) and
41 step manager (diagnostics) (JB, AM)
42
43*/
44
45
46
47//////////////////////////////////////////////////////////
48// Manager and hits classes for set: RICH full version //
49//////////////////////////////////////////////////////////
50
51#include <TTUBE.h>
52#include <TNode.h>
53#include <TRandom.h>
237c933d 54#include <TParticle.h>
c28632f0 55
56#include "AliRICHv1.h"
237c933d 57#include "AliRICHHit.h"
c28632f0 58#include "AliRun.h"
59#include "AliMC.h"
60#include "iostream.h"
61#include "AliCallf77.h"
62#include "AliConst.h"
63#include "AliPDG.h"
64#include "TGeant3.h"
65
66ClassImp(AliRICHv1)
67
68//___________________________________________
69AliRICHv1::AliRICHv1() : AliRICHv0()
70{
237c933d 71
72// Default constructor fo AliRICHvv1 (full version)
73
c28632f0 74 //fChambers = 0;
75}
76
77//___________________________________________
78AliRICHv1::AliRICHv1(const char *name, const char *title)
79 : AliRICHv0(name,title)
80{
c28632f0 81
237c933d 82// Full version of RICH with hits and diagnostics
83
84 fCkovNumber=0;
85 fFreonProd=0;
7f36f6bc 86 Int_t i=0;
237c933d 87
88 fChambers = new TObjArray(kNCH);
7f36f6bc 89 for (i=0; i<kNCH; i++) {
c28632f0 90
91 (*fChambers)[i] = new AliRICHChamber();
92
93 }
94}
95
237c933d 96void AliRICHv1::Init()
97{
98
99 printf("*********************************** RICH_INIT ***********************************\n");
100 printf("* *\n");
101 printf("* AliRICHv1 Configurable version started *\n");
102 printf("* *\n");
103
104
105 AliRICHSegmentation* segmentation;
106 AliRICHGeometry* geometry;
107 AliRICHResponse* response;
108
109
110 //
111 // Initialize Tracking Chambers
112 //
7f36f6bc 113 for (i=1; i<kNCH; i++) {
237c933d 114 //printf ("i:%d",i);
115 ( (AliRICHChamber*) (*fChambers)[i])->Init();
116 }
117
118 //
119 // Set the chamber (sensitive region) GEANT identifier
120
121 ((AliRICHChamber*)(*fChambers)[0])->SetGid(1);
122 ((AliRICHChamber*)(*fChambers)[1])->SetGid(2);
123 ((AliRICHChamber*)(*fChambers)[2])->SetGid(3);
124 ((AliRICHChamber*)(*fChambers)[3])->SetGid(4);
125 ((AliRICHChamber*)(*fChambers)[4])->SetGid(5);
126 ((AliRICHChamber*)(*fChambers)[5])->SetGid(6);
127 ((AliRICHChamber*)(*fChambers)[6])->SetGid(7);
128
129 Float_t pos1[3]={0,471.8999,165.2599};
130 Chamber(0).SetChamberTransform(pos1[0],pos1[1],pos1[2],new TRotMatrix("rot993","rot993",90,0,70.69,90,19.30999,-90));
131
132 Float_t pos2[3]={171,470,0};
133 Chamber(1).SetChamberTransform(pos2[0],pos2[1],pos2[2],new TRotMatrix("rot994","rot994",90,-20,90,70,0,0));
134
135 Float_t pos3[3]={0,500,0};
136 Chamber(2).SetChamberTransform(pos3[0],pos3[1],pos3[2],new TRotMatrix("rot995","rot995",90,0,90,90,0,0));
137
138 Float_t pos4[3]={-171,470,0};
139 Chamber(3).SetChamberTransform(pos4[0],pos4[1],pos4[2], new TRotMatrix("rot996","rot996",90,20,90,110,0,0));
140
141 Float_t pos5[3]={161.3999,443.3999,-165.3};
142 Chamber(4).SetChamberTransform(pos5[0],pos5[1],pos5[2],new TRotMatrix("rot997","rot997",90,340,108.1999,70,18.2,70));
143
144 Float_t pos6[3]={0., 471.9, -165.3,};
145 Chamber(5).SetChamberTransform(pos6[0],pos6[1],pos6[2],new TRotMatrix("rot998","rot998",90,0,109.3099,90,19.30999,90));
146
147 Float_t pos7[3]={-161.399,443.3999,-165.3};
148 Chamber(6).SetChamberTransform(pos7[0],pos7[1],pos7[2],new TRotMatrix("rot999","rot999",90,20,108.1999,110,18.2,110));
149
150 segmentation=Chamber(0).GetSegmentationModel(0);
151 geometry=Chamber(0).GetGeometryModel();
152 response=Chamber(0).GetResponseModel();
153
154
155 printf("* Pads : %3dx%3d *\n",segmentation->Npx(),segmentation->Npy());
156 printf("* Pad size : %5.2f x%5.2f mm2 *\n",segmentation->Dpx(),segmentation->Dpy());
157 printf("* Gap Thickness : %5.1f mm *\n",geometry->GetGapThickness());
158 printf("* Radiator Width : %5.1f mm *\n",geometry->GetQuartzWidth());
159 printf("* Radiator Length : %5.1f mm *\n",geometry->GetQuartzLength());
160 printf("* Freon Thickness : %5.1f mm *\n",geometry->GetFreonThickness());
161 printf("* Charge Slope : %5.1f ADC *\n",response->ChargeSlope());
162 printf("* Feedback Prob. : %5.2f %% *\n",response->AlphaFeedback());
163 printf("* *\n");
164 printf("* Success! *\n");
165 printf("* *\n");
166 printf("*********************************************************************************\n");
167
168}
c28632f0 169
170//___________________________________________
171void AliRICHv1::StepManager()
172{
237c933d 173
174// Full Step Manager
175
c28632f0 176 Int_t copy, id;
177 static Int_t idvol;
178 static Int_t vol[2];
179 Int_t ipart;
180 static Float_t hits[18];
237c933d 181 static Float_t ckovData[19];
182 TLorentzVector position;
183 TLorentzVector momentum;
c28632f0 184 Float_t pos[3];
185 Float_t mom[4];
237c933d 186 Float_t localPos[3];
187 Float_t localMom[4];
188 Float_t localTheta,localPhi;
c28632f0 189 Float_t theta,phi;
190 Float_t destep, step;
191 Float_t ranf[2];
237c933d 192 Int_t nPads;
c28632f0 193 Float_t coscerenkov;
194 static Float_t eloss, xhit, yhit, tlength;
237c933d 195 const Float_t kBig=1.e10;
c28632f0 196
197 TClonesArray &lhits = *fHits;
198 TGeant3 *geant3 = (TGeant3*) gMC;
199 TParticle *current = (TParticle*)(*gAlice->Particles())[gAlice->CurrentTrack()];
200
201 //if (current->Energy()>1)
202 //{
203
204 // Only gas gap inside chamber
205 // Tag chambers and record hits when track enters
206
207 idvol=-1;
208 id=gMC->CurrentVolID(copy);
237c933d 209 Float_t cherenkovLoss=0;
c28632f0 210 //gAlice->KeepTrack(gAlice->CurrentTrack());
211
237c933d 212 gMC->TrackPosition(position);
213 pos[0]=position(0);
214 pos[1]=position(1);
215 pos[2]=position(2);
216 ckovData[1] = pos[0]; // X-position for hit
217 ckovData[2] = pos[1]; // Y-position for hit
218 ckovData[3] = pos[2]; // Z-position for hit
219 //ckovData[11] = gAlice->CurrentTrack();
c28632f0 220
221 //AliRICH *RICH = (AliRICH *) gAlice->GetDetector("RICH");
222
223 /********************Store production parameters for Cerenkov photons************************/
224//is it a Cerenkov photon?
225 if (gMC->TrackPid() == 50000050) {
226
227 //if (gMC->VolId("GAP ")==gMC->CurrentVolID(copy))
228 //{
237c933d 229 Float_t ckovEnergy = current->Energy();
c28632f0 230 //energy interval for tracking
237c933d 231 if (ckovEnergy > 5.6e-09 && ckovEnergy < 7.8e-09 )
232 //if (ckovEnergy > 0)
c28632f0 233 {
234 if (gMC->IsTrackEntering()){ //is track entering?
235 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
236 { //is it in freo?
237 if (geant3->Gctrak()->nstep<1){ //is it the first step?
238 Int_t mother = current->GetFirstMother();
239
240 //printf("Second Mother:%d\n",current->GetSecondMother());
241
237c933d 242 ckovData[10] = mother;
243 ckovData[11] = gAlice->CurrentTrack();
244 ckovData[12] = 1; //Media where photon was produced 1->Freon, 2->Quarz
245 fCkovNumber++;
246 fFreonProd=1;
247 //printf("Index: %d\n",fCkovNumber);
c28632f0 248 } //first step question
249 } //freo question
250
251 if (geant3->Gctrak()->nstep<1){ //is it first step?
252 if (gMC->VolId("QUAR")==gMC->CurrentVolID(copy)) //is it in quarz?
253 {
237c933d 254 ckovData[12] = 2;
c28632f0 255 } //quarz question
256 } //first step question
257
237c933d 258 //printf("Before %d\n",fFreonProd);
c28632f0 259 } //track entering question
260
237c933d 261 if (ckovData[12] == 1) //was it produced in Freon?
262 //if (fFreonProd == 1)
c28632f0 263 {
264 if (gMC->IsTrackEntering()){ //is track entering?
265 //printf("Got in");
266 if (gMC->VolId("META")==gMC->CurrentVolID(copy)) //is it in gap?
267 {
268 //printf("Got in\n");
237c933d 269 gMC->TrackMomentum(momentum);
270 mom[0]=momentum(0);
271 mom[1]=momentum(1);
272 mom[2]=momentum(2);
273 mom[3]=momentum(3);
c28632f0 274 // Z-position for hit
275
276
277 /**************** Photons lost in second grid have to be calculated by hand************/
278
279 Float_t cophi = TMath::Cos(TMath::ATan2(mom[0], mom[1]));
280 Float_t t = (1. - .025 / cophi) * (1. - .05 / cophi);
281 gMC->Rndm(ranf, 1);
282 //printf("grid calculation:%f\n",t);
283 if (ranf[0] > t) {
284 //geant3->StopTrack();
237c933d 285 ckovData[13] = 5;
286 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
c28632f0 287 //printf("Lost one in grid\n");
288 }
289 /**********************************************************************************/
290 } //gap
291
292 if (gMC->VolId("CSI ")==gMC->CurrentVolID(copy)) //is it in csi?
293 {
237c933d 294 gMC->TrackMomentum(momentum);
295 mom[0]=momentum(0);
296 mom[1]=momentum(1);
297 mom[2]=momentum(2);
298 mom[3]=momentum(3);
c28632f0 299
300 /********* Photons lost by Fresnel reflection have to be calculated by hand********/
301 /***********************Cerenkov phtons (always polarised)*************************/
302
303 Float_t cophi = TMath::Cos(TMath::ATan2(mom[0], mom[1]));
237c933d 304 Float_t t = Fresnel(ckovEnergy*1e9,cophi,1);
c28632f0 305 gMC->Rndm(ranf, 1);
306 if (ranf[0] < t) {
307 //geant3->StopTrack();
237c933d 308 ckovData[13] = 6;
309 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
c28632f0 310 //printf("Lost by Fresnel\n");
311 }
312 /**********************************************************************************/
313 }
314 } //track entering?
315
316
317 /********************Evaluation of losses************************/
318 /******************still in the old fashion**********************/
319
320 Int_t i1 = geant3->Gctrak()->nmec; //number of physics mechanisms acting on the particle
321 for (Int_t i = 0; i < i1; ++i) {
322 // Reflection loss
323 if (geant3->Gctrak()->lmec[i] == 106) { //was it reflected
237c933d 324 ckovData[13]=10;
c28632f0 325 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
237c933d 326 ckovData[13]=1;
c28632f0 327 if (gMC->CurrentVolID(copy) == gMC->VolId("QUAR"))
237c933d 328 ckovData[13]=2;
c28632f0 329 //geant3->StopTrack();
237c933d 330 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
c28632f0 331 } //reflection question
332
333
334 // Absorption loss
335 else if (geant3->Gctrak()->lmec[i] == 101) { //was it absorbed?
237c933d 336 ckovData[13]=20;
c28632f0 337 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
237c933d 338 ckovData[13]=11;
c28632f0 339 if (gMC->CurrentVolID(copy) == gMC->VolId("QUAR"))
237c933d 340 ckovData[13]=12;
c28632f0 341 if (gMC->CurrentVolID(copy) == gMC->VolId("META"))
237c933d 342 ckovData[13]=13;
c28632f0 343 if (gMC->CurrentVolID(copy) == gMC->VolId("GAP "))
237c933d 344 ckovData[13]=13;
c28632f0 345
346 if (gMC->CurrentVolID(copy) == gMC->VolId("SRIC"))
237c933d 347 ckovData[13]=15;
c28632f0 348
349 // CsI inefficiency
350 if (gMC->CurrentVolID(copy) == gMC->VolId("CSI ")) {
237c933d 351 ckovData[13]=16;
c28632f0 352 }
353 //geant3->StopTrack();
237c933d 354 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
355 //printf("Added cerenkov %d\n",fCkovNumber);
c28632f0 356 } //absorption question
357
358
359 // Photon goes out of tracking scope
360 else if (geant3->Gctrak()->lmec[i] == 30) { //is it below energy treshold?
237c933d 361 ckovData[13]=21;
c28632f0 362 //geant3->StopTrack();
237c933d 363 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
c28632f0 364 } // energy treshold question
365 } //number of mechanisms cycle
366 /**********************End of evaluation************************/
367 } //freon production question
368 } //energy interval question
369 //}//inside the proximity gap question
370 } //cerenkov photon question
371
372 /**************************************End of Production Parameters Storing*********************/
373
374
375 /*******************************Treat photons that hit the CsI (Ckovs and Feedbacks)************/
376
377 if (gMC->TrackPid() == 50000050 || gMC->TrackPid() == 50000051) {
378 //printf("Cerenkov\n");
379 if (gMC->VolId("CSI ")==gMC->CurrentVolID(copy))
380 {
381
382 if (gMC->Edep() > 0.){
237c933d 383 gMC->TrackPosition(position);
384 gMC->TrackMomentum(momentum);
385 pos[0]=position(0);
386 pos[1]=position(1);
387 pos[2]=position(2);
388 mom[0]=momentum(0);
389 mom[1]=momentum(1);
390 mom[2]=momentum(2);
391 mom[3]=momentum(3);
c28632f0 392 Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
393 Double_t rt = TMath::Sqrt(tc);
394 theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
395 phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
237c933d 396 gMC->Gmtod(pos,localPos,1);
397 gMC->Gmtod(mom,localMom,2);
c28632f0 398
399 gMC->CurrentVolOffID(2,copy);
400 vol[0]=copy;
401 idvol=vol[0]-1;
402
403 //Int_t sector=((AliRICHChamber*) (*fChambers)[idvol])
237c933d 404 //->Sector(localPos[0], localPos[2]);
c28632f0 405 //printf("Sector:%d\n",sector);
406
407 /*if (gMC->TrackPid() == 50000051){
408 fFeedbacks++;
409 printf("Feedbacks:%d\n",fFeedbacks);
410 }*/
411
412 ((AliRICHChamber*) (*fChambers)[idvol])
237c933d 413 ->SigGenInit(localPos[0], localPos[2], localPos[1]);
414 if(idvol<kNCH) {
415 ckovData[0] = gMC->TrackPid(); // particle type
416 ckovData[1] = pos[0]; // X-position for hit
417 ckovData[2] = pos[1]; // Y-position for hit
418 ckovData[3] = pos[2]; // Z-position for hit
419 ckovData[4] = theta; // theta angle of incidence
420 ckovData[5] = phi; // phi angle of incidence
421 ckovData[8] = (Float_t) fNPadHits; // first padhit
422 ckovData[9] = -1; // last pad hit
423 ckovData[13] = 4; // photon was detected
424 ckovData[14] = mom[0];
425 ckovData[15] = mom[1];
426 ckovData[16] = mom[2];
c28632f0 427
428 destep = gMC->Edep();
237c933d 429 gMC->SetMaxStep(kBig);
430 cherenkovLoss += destep;
431 ckovData[7]=cherenkovLoss;
c28632f0 432
237c933d 433 nPads = MakePadHits(localPos[0],localPos[2],cherenkovLoss,idvol,kCerenkov);
434 if (fNPadHits > (Int_t)ckovData[8]) {
435 ckovData[8]= ckovData[8]+1;
436 ckovData[9]= (Float_t) fNPadHits;
c28632f0 437 }
438
237c933d 439 ckovData[17] = nPads;
440 //printf("nPads:%d",nPads);
c28632f0 441
442 //TClonesArray *Hits = RICH->Hits();
443 AliRICHHit *mipHit = (AliRICHHit*) (fHits->UncheckedAt(0));
444 if (mipHit)
445 {
446 mom[0] = current->Px();
447 mom[1] = current->Py();
448 mom[2] = current->Pz();
237c933d 449 Float_t mipPx = mipHit->fMomX;
450 Float_t mipPy = mipHit->fMomY;
451 Float_t mipPz = mipHit->fMomZ;
c28632f0 452
453 Float_t r = mom[0]*mom[0] + mom[1]*mom[1] + mom[2]*mom[2];
454 Float_t rt = TMath::Sqrt(r);
237c933d 455 Float_t mipR = mipPx*mipPx + mipPy*mipPy + mipPz*mipPz;
456 Float_t mipRt = TMath::Sqrt(mipR);
457 if ((rt*mipRt) > 0)
c28632f0 458 {
237c933d 459 coscerenkov = (mom[0]*mipPx + mom[1]*mipPy + mom[2]*mipPz)/(rt*mipRt);
c28632f0 460 }
461 else
462 {
463 coscerenkov = 0;
464 }
465 Float_t cherenkov = TMath::ACos(coscerenkov);
237c933d 466 ckovData[18]=cherenkov;
c28632f0 467 }
468 //if (sector != -1)
469 //{
237c933d 470 AddHit(gAlice->CurrentTrack(),vol,ckovData);
471 AddCerenkov(gAlice->CurrentTrack(),vol,ckovData);
c28632f0 472 //}
473 }
474 }
475 }
476 }
477
478 /***********************************************End of photon hits*********************************************/
479
480
481 /**********************************************Charged particles treatment*************************************/
482
483 else if (gMC->TrackCharge())
484 //else if (1 == 1)
485 {
486//If MIP
487 /*if (gMC->IsTrackEntering())
488 {
489 hits[13]=20;//is track entering?
490 }*/
491 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
492 {
237c933d 493 fFreonProd=1;
c28632f0 494 }
495
496 if (gMC->VolId("GAP ")== gMC->CurrentVolID(copy)) {
497// Get current particle id (ipart), track position (pos) and momentum (mom)
498
499 gMC->CurrentVolOffID(3,copy);
500 vol[0]=copy;
501 idvol=vol[0]-1;
502
503 //Int_t sector=((AliRICHChamber*) (*fChambers)[idvol])
237c933d 504 //->Sector(localPos[0], localPos[2]);
c28632f0 505 //printf("Sector:%d\n",sector);
506
237c933d 507 gMC->TrackPosition(position);
508 gMC->TrackMomentum(momentum);
509 pos[0]=position(0);
510 pos[1]=position(1);
511 pos[2]=position(2);
512 mom[0]=momentum(0);
513 mom[1]=momentum(1);
514 mom[2]=momentum(2);
515 mom[3]=momentum(3);
516 gMC->Gmtod(pos,localPos,1);
517 gMC->Gmtod(mom,localMom,2);
c28632f0 518
519 ipart = gMC->TrackPid();
520 //
521 // momentum loss and steplength in last step
522 destep = gMC->Edep();
523 step = gMC->TrackStep();
524
525 //
526 // record hits when track enters ...
527 if( gMC->IsTrackEntering()) {
528// gMC->SetMaxStep(fMaxStepGas);
529 Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
530 Double_t rt = TMath::Sqrt(tc);
531 theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
532 phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
533
534
237c933d 535 Double_t localTc = localMom[0]*localMom[0]+localMom[2]*localMom[2];
536 Double_t localRt = TMath::Sqrt(localTc);
537 localTheta = Float_t(TMath::ATan2(localRt,Double_t(localMom[1])))*kRaddeg;
538 localPhi = Float_t(TMath::ATan2(Double_t(localMom[2]),Double_t(localMom[0])))*kRaddeg;
c28632f0 539
540 hits[0] = Float_t(ipart); // particle type
237c933d 541 hits[1] = localPos[0]; // X-position for hit
542 hits[2] = localPos[1]; // Y-position for hit
543 hits[3] = localPos[2]; // Z-position for hit
544 hits[4] = localTheta; // theta angle of incidence
545 hits[5] = localPhi; // phi angle of incidence
c28632f0 546 hits[8] = (Float_t) fNPadHits; // first padhit
547 hits[9] = -1; // last pad hit
237c933d 548 hits[13] = fFreonProd; // did id hit the freon?
c28632f0 549 hits[14] = mom[0];
550 hits[15] = mom[1];
551 hits[16] = mom[2];
552
553 tlength = 0;
554 eloss = 0;
237c933d 555 fFreonProd = 0;
c28632f0 556
237c933d 557 Chamber(idvol).LocaltoGlobal(localPos,hits+1);
c28632f0 558
559
237c933d 560 //To make chamber coordinates x-y had to pass localPos[0], localPos[2]
561 xhit = localPos[0];
562 yhit = localPos[2];
c28632f0 563 // Only if not trigger chamber
237c933d 564 if(idvol<kNCH) {
c28632f0 565 //
566 // Initialize hit position (cursor) in the segmentation model
567 ((AliRICHChamber*) (*fChambers)[idvol])
237c933d 568 ->SigGenInit(localPos[0], localPos[2], localPos[1]);
c28632f0 569 }
570 }
571
572 //
573 // Calculate the charge induced on a pad (disintegration) in case
574 //
575 // Mip left chamber ...
576 if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
237c933d 577 gMC->SetMaxStep(kBig);
c28632f0 578 eloss += destep;
579 tlength += step;
580
581
582 // Only if not trigger chamber
237c933d 583 if(idvol<kNCH) {
c28632f0 584 if (eloss > 0)
585 {
586 if(gMC->TrackPid() == kNeutron)
587 printf("\n\n\n\n\n Neutron Making Pad Hit!!! \n\n\n\n");
237c933d 588 nPads = MakePadHits(xhit,yhit,eloss,idvol,kMip);
589 hits[17] = nPads;
590 //printf("nPads:%d",nPads);
c28632f0 591 }
592 }
593
594 hits[6]=tlength;
595 hits[7]=eloss;
596 if (fNPadHits > (Int_t)hits[8]) {
597 hits[8]= hits[8]+1;
598 hits[9]= (Float_t) fNPadHits;
599 }
600
601 //if(sector !=-1)
602 new(lhits[fNhits++]) AliRICHHit(fIshunt,gAlice->CurrentTrack(),vol,hits);
603 eloss = 0;
604 //
605 // Check additional signal generation conditions
606 // defined by the segmentation
607 // model (boundary crossing conditions)
608 } else if
609 (((AliRICHChamber*) (*fChambers)[idvol])
237c933d 610 ->SigGenCond(localPos[0], localPos[2], localPos[1]))
c28632f0 611 {
612 ((AliRICHChamber*) (*fChambers)[idvol])
237c933d 613 ->SigGenInit(localPos[0], localPos[2], localPos[1]);
c28632f0 614 if (eloss > 0)
615 {
616 if(gMC->TrackPid() == kNeutron)
617 printf("\n\n\n\n\n Neutron Making Pad Hit!!! \n\n\n\n");
237c933d 618 nPads = MakePadHits(xhit,yhit,eloss,idvol,kMip);
619 hits[17] = nPads;
c28632f0 620 //printf("Npads:%d",NPads);
621 }
237c933d 622 xhit = localPos[0];
623 yhit = localPos[2];
c28632f0 624 eloss = destep;
625 tlength += step ;
626 //
627 // nothing special happened, add up energy loss
628 } else {
629 eloss += destep;
630 tlength += step ;
631 }
632 }
633 }
634 /*************************************************End of MIP treatment**************************************/
635 //}
636}