1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * SigmaEffect_thetadegrees *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 purpeateose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 /////////////////////////////////////////////////////////
19 // Manager and hits classes for set:MUON version 1 //
20 /////////////////////////////////////////////////////////
24 #include <TClonesArray.h>
26 #include <TVirtualMC.h>
27 #include <TGeoMatrix.h>
29 #include "AliMUONv1.h"
31 #include "AliMUONChamber.h"
32 #include "AliMUONConstants.h"
33 #include "AliMUONFactory.h"
34 #include "AliMUONHit.h"
35 #include "AliMUONTriggerCircuit.h"
36 #include "AliMUONGeometryBuilder.h"
37 #include "AliMUONGeometryModule.h"
38 #include "AliMUONGeometrySVMap.h"
39 #include "AliMUONGeometryDetElement.h"
47 //___________________________________________
48 AliMUONv1::AliMUONv1()
50 fStepManagerVersionOld(kFALSE),
51 fStepManagerVersionDE(kFALSE),
53 fStepMaxInActiveGas(0.6),
60 fAngleEffectNorma(0x0)
62 // Default constructor
65 //___________________________________________
66 AliMUONv1::AliMUONv1(const char *name, const char *title)
67 : AliMUON(name,title),
68 fStepManagerVersionOld(kFALSE),
69 fStepManagerVersionDE(kFALSE),
71 fStepMaxInActiveGas(0.6),
78 fAngleEffectNorma(0x0)
80 // Standard onstructor
82 // By default include all stations
83 AliMUONFactory factory;
84 factory.Build(this, title);
86 fStepSum = new Float_t [AliMUONConstants::NCh()];
87 fDestepSum = new Float_t [AliMUONConstants::NCh()];
88 for (Int_t i=0; i<AliMUONConstants::NCh(); i++) {
92 // Ratio of particle mean eloss with respect MIP's Khalil Boudjemline, sep 2003, PhD.Thesis and Particle Data Book
93 fElossRatio = new TF1("ElossRatio","[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x",0.5,5.);
94 fElossRatio->SetParameter(0,1.02138);
95 fElossRatio->SetParameter(1,-9.54149e-02);
96 fElossRatio->SetParameter(2,+7.83433e-02);
97 fElossRatio->SetParameter(3,-9.98208e-03);
98 fElossRatio->SetParameter(4,+3.83279e-04);
100 // Angle effect in tracking chambers at theta =10 degres as a function of ElossRatio (Khalil BOUDJEMLINE sep 2003 Ph.D Thesis) (in micrometers)
101 fAngleEffect10 = new TF1("AngleEffect10","[0]+[1]*x+[2]*x*x",0.5,3.0);
102 fAngleEffect10->SetParameter(0, 1.90691e+02);
103 fAngleEffect10->SetParameter(1,-6.62258e+01);
104 fAngleEffect10->SetParameter(2,+1.28247e+01);
105 // Angle effect: Normalisation form theta=10 degres to theta between 0 and 10 (Khalil BOUDJEMLINE sep 2003 Ph.D Thesis)
106 // Angle with respect to the wires assuming that chambers are perpendicular to the z axis.
107 fAngleEffectNorma = new TF1("AngleEffectNorma","[0]+[1]*x+[2]*x*x+[3]*x*x*x",0.0,10.0);
108 fAngleEffectNorma->SetParameter(0,4.148);
109 fAngleEffectNorma->SetParameter(1,-6.809e-01);
110 fAngleEffectNorma->SetParameter(2,5.151e-02);
111 fAngleEffectNorma->SetParameter(3,-1.490e-03);
114 //_____________________________________________________________________________
115 AliMUONv1::AliMUONv1(const AliMUONv1& right)
118 // copy constructor (not implemented)
120 AliFatal("Copy constructor not provided.");
123 //___________________________________________
124 AliMUONv1::~AliMUONv1()
129 delete [] fDestepSum;
131 delete fAngleEffect10;
132 delete fAngleEffectNorma;
135 //_____________________________________________________________________________
136 AliMUONv1& AliMUONv1::operator=(const AliMUONv1& right)
138 // assignement operator (not implemented)
140 // check assignement to self
141 if (this == &right) return *this;
143 AliFatal("Assignement operator not provided.");
148 //__________________________________________________
149 void AliMUONv1::CreateGeometry()
152 // Construct geometry using geometry builder
155 fGeometryBuilder->CreateGeometry();
158 //________________________________________________________________
159 void AliMUONv1::CreateMaterials()
162 // Construct materials using geometry builder
165 fGeometryBuilder->CreateMaterials();
168 //___________________________________________
169 void AliMUONv1::Init()
172 // Initialize Tracking Chambers
174 AliDebug(1,"Start Init for version 1 - CPC chamber type");
176 for (i=0; i<AliMUONConstants::NCh(); i++) {
177 ( (AliMUONChamber*) (*fChambers)[i])->Init();
181 // Initialize geometry
183 fGeometryBuilder->InitGeometry();
184 AliDebug(1,"Finished Init for version 1 - CPC chamber type");
187 AliDebug(1,"Start Init for Trigger Circuits");
188 for (i=0; i<AliMUONConstants::NTriggerCircuit(); i++) {
189 ( (AliMUONTriggerCircuit*) (*fTriggerCircuits)[i])->Init(i);
191 AliDebug(1,"Finished Init for Trigger Circuits");
195 //__________________________________________________________________
196 Int_t AliMUONv1::GetChamberId(Int_t volId) const
198 // Check if the volume with specified volId is a sensitive volume (gas)
199 // of some chamber and returns the chamber number;
200 // if not sensitive volume - return 0.
204 for (Int_t i = 1; i <= AliMUONConstants::NCh(); i++)
205 if (volId==((AliMUONChamber*)(*fChambers)[i-1])->GetGid()) return i;
207 for (Int_t i = 1; i <= AliMUONConstants::NCh(); i++)
208 if ( ((AliMUONChamber*)(*fChambers)[i-1])->IsSensId(volId) ) return i;
213 //_______________________________________________________________________________
214 TString AliMUONv1::CurrentVolumePath() const
216 // Returns current volume path
217 // (Could be removed when this function is available via gMC)
225 name = gMC->CurrentVolOffName(imother);
226 gMC->CurrentVolOffID(imother++, copyNo);
233 while ( name != TString("ALIC") );
238 //_______________________________________________________________________________
239 void AliMUONv1::StepManager()
241 // Stepmanager for the chambers
244 if (fStepManagerVersionDE) {
249 if (fStepManagerVersionOld) {
254 // Only charged tracks
255 if( !(gMC->TrackCharge()) ) return;
256 // Only charged tracks
258 // Only gas gap inside chamber
259 // Tag chambers and record hits when track enters
260 static Int_t idvol=-1;
264 const Float_t kBig = 1.e10;
268 // Only gas gap inside chamber
269 // Tag chambers and record hits when track enters
270 id=gMC->CurrentVolID(copy);
271 iChamber = GetChamberId(id);
274 if (idvol == -1) return;
276 // Filling TrackRefs file for MUON. Our Track references are the active volume of the chambers
277 if ( (gMC->IsTrackEntering() || gMC->IsTrackExiting() ) )
278 AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber());
280 if( gMC->IsTrackEntering() ) {
281 Float_t theta = fTrackMomentum.Theta();
282 if ((TMath::Pi()-theta)*kRaddeg>=15.) gMC->SetMaxStep(fStepMaxInActiveGas); // We use Pi-theta because z is negative
286 // Float_t z = ( (AliMUONChamber*)(*fChambers)[idvol])->Z() ;
287 // Info("StepManager Step","Active volume found %d chamber %d Z chamber is %f ",idvol,iChamber, z);
289 // Particule id and mass,
290 Int_t ipart = gMC->TrackPid();
291 Float_t mass = gMC->TrackMass();
293 fDestepSum[idvol]+=gMC->Edep();
294 // Get current particle id (ipart), track position (pos) and momentum (mom)
295 if ( fStepSum[idvol]==0.0 ) gMC->TrackMomentum(fTrackMomentum);
296 fStepSum[idvol]+=gMC->TrackStep();
299 // Info("StepManager Step","iChamber %d, Particle %d, theta %f phi %f mass %f StepSum %f eloss %g",
300 // iChamber,ipart, fTrackMomentum.Theta()*kRaddeg, fTrackMomentum.Phi()*kRaddeg, mass, fStepSum[idvol], gMC->Edep());// Info("StepManager Step","Track Momentum %f %f %f", fTrackMomentum.X(), fTrackMomentum.Y(), fTrackMomentum.Z()) ;
301 // gMC->TrackPosition(fTrackPosition);
302 // Info("StepManager Step","Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z()) ;
305 // Track left chamber or StepSum larger than fStepMaxInActiveGas
306 if ( gMC->IsTrackExiting() ||
307 gMC->IsTrackStop() ||
308 gMC->IsTrackDisappeared()||
309 (fStepSum[idvol]>fStepMaxInActiveGas) ) {
311 if ( gMC->IsTrackExiting() ||
312 gMC->IsTrackStop() ||
313 gMC->IsTrackDisappeared() ) gMC->SetMaxStep(kBig);
315 gMC->TrackPosition(fTrackPosition);
316 Float_t theta = fTrackMomentum.Theta();
317 Float_t phi = fTrackMomentum.Phi();
319 TLorentzVector backToWire( fStepSum[idvol]/2.*sin(theta)*cos(phi),
320 fStepSum[idvol]/2.*sin(theta)*sin(phi),
321 fStepSum[idvol]/2.*cos(theta),0.0 );
323 // Info("StepManager Exit","Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z()) ;
325 // Info("StepManager Exit ","Track backToWire %f %f %f",backToWire.X(),backToWire.Y(),backToWire.Z()) ;
326 fTrackPosition-=backToWire;
328 //-------------- Angle effect
329 // Ratio between energy loss of particle and Mip as a function of BetaGamma of particle (Energy/Mass)
331 Float_t betaxGamma = fTrackMomentum.P()/mass;// pc/mc2
332 Float_t sigmaEffect10degrees;
333 Float_t sigmaEffectThetadegrees;
334 Float_t eLossParticleELossMip;
335 Float_t yAngleEffect=0.;
336 Float_t thetawires = TMath::Abs( TMath::ASin( TMath::Sin(TMath::Pi()-theta) * TMath::Sin(phi) ) );// We use Pi-theta because z is negative
340 if ( (betaxGamma >3.2) && (thetawires*kRaddeg<=15.) ) {
341 betaxGamma=TMath::Log(betaxGamma);
342 eLossParticleELossMip = fElossRatio->Eval(betaxGamma);
343 // 10 degrees is a reference for a model (arbitrary)
344 sigmaEffect10degrees=fAngleEffect10->Eval(eLossParticleELossMip);// in micrometers
345 // Angle with respect to the wires assuming that chambers are perpendicular to the z axis.
346 sigmaEffectThetadegrees = sigmaEffect10degrees/fAngleEffectNorma->Eval(thetawires*kRaddeg); // For 5mm gap
347 if ( (iChamber==1) || (iChamber==2) )
348 sigmaEffectThetadegrees/=(1.09833e+00+1.70000e-02*(thetawires*kRaddeg)); // The gap is different (4mm)
349 yAngleEffect=1.e-04*gRandom->Gaus(0,sigmaEffectThetadegrees); // Error due to the angle effect in cm
353 // Detection elements ids
354 AliMUONGeometryModule* geometry
355 = Chamber(iChamber-1).GetGeometry();
357 AliMUONGeometryDetElement* detElement
358 = geometry->FindBySensitiveVolume(CurrentVolumePath());
361 if (detElement) detElemId = detElement->GetUniqueID();
364 cerr << "Chamber id: "
365 << setw(3) << iChamber << " "
367 << CurrentVolumePath()
369 << setw(5) << detElemId
372 gMC->TrackPosition(x, y, z);
373 cerr << " global position: "
374 << x << ", " << y << ", " << z
376 AliWarning("DetElemId not identified.");
379 // One hit per chamber
380 GetMUONData()->AddHit(fIshunt,
381 gAlice->GetMCApp()->GetCurrentTrackNumber(),
384 fTrackPosition.Y()+yAngleEffect,
397 // Info("StepManager Exit","Particle exiting from chamber %d",iChamber);
398 // Info("StepManager Exit","StepSum %f eloss geant %g ",fStepSum[idvol],fDestepSum[idvol]);
399 // Info("StepManager Exit","Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z()) ;
401 fStepSum[idvol] =0; // Reset for the next event
402 fDestepSum[idvol]=0; // Reset for the next event
406 //_______________________________________________________________________________
407 void AliMUONv1::StepManager2()
409 // Stepmanager for the chambers
411 if (fStepManagerVersionOld) {
416 // Only charged tracks
417 if( !(gMC->TrackCharge()) ) return;
418 // Only charged tracks
420 // Only gas gap inside chamber
421 // Tag chambers and record hits when track enters
422 static Int_t idvol=-1;
426 const Float_t kBig = 1.e10;
430 // Only gas gap inside chamber
431 // Tag chambers and record hits when track enters
432 id=gMC->CurrentVolID(copy);
433 iChamber = GetChamberId(id);
436 if (idvol == -1) return;
438 // Filling TrackRefs file for MUON. Our Track references are the active volume of the chambers
439 if ( (gMC->IsTrackEntering() || gMC->IsTrackExiting() ) )
440 AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber());
442 if( gMC->IsTrackEntering() ) {
443 Float_t theta = fTrackMomentum.Theta();
444 if ((TMath::Pi()-theta)*kRaddeg>=15.) gMC->SetMaxStep(fStepMaxInActiveGas); // We use Pi-theta because z is negative
448 // Float_t z = ( (AliMUONChamber*)(*fChambers)[idvol])->Z() ;
449 // Info("StepManager Step","Active volume found %d chamber %d Z chamber is %f ",idvol,iChamber, z);
451 // Particule id and mass,
452 Int_t ipart = gMC->TrackPid();
453 Float_t mass = gMC->TrackMass();
455 fDestepSum[idvol]+=gMC->Edep();
456 // Get current particle id (ipart), track position (pos) and momentum (mom)
457 if ( fStepSum[idvol]==0.0 ) gMC->TrackMomentum(fTrackMomentum);
458 fStepSum[idvol]+=gMC->TrackStep();
461 // Info("StepManager Step","iChamber %d, Particle %d, theta %f phi %f mass %f StepSum %f eloss %g",
462 // iChamber,ipart, fTrackMomentum.Theta()*kRaddeg, fTrackMomentum.Phi()*kRaddeg, mass, fStepSum[idvol], gMC->Edep());// Info("StepManager Step","Track Momentum %f %f %f", fTrackMomentum.X(), fTrackMomentum.Y(), fTrackMomentum.Z()) ;
463 // gMC->TrackPosition(fTrackPosition);
464 // Info("StepManager Step","Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z()) ;
467 // Track left chamber or StepSum larger than fStepMaxInActiveGas
468 if ( gMC->IsTrackExiting() ||
469 gMC->IsTrackStop() ||
470 gMC->IsTrackDisappeared()||
471 (fStepSum[idvol]>fStepMaxInActiveGas) ) {
473 if ( gMC->IsTrackExiting() ||
474 gMC->IsTrackStop() ||
475 gMC->IsTrackDisappeared() ) gMC->SetMaxStep(kBig);
477 gMC->TrackPosition(fTrackPosition);
478 Float_t theta = fTrackMomentum.Theta();
479 Float_t phi = fTrackMomentum.Phi();
481 TLorentzVector backToWire( fStepSum[idvol]/2.*sin(theta)*cos(phi),
482 fStepSum[idvol]/2.*sin(theta)*sin(phi),
483 fStepSum[idvol]/2.*cos(theta),0.0 );
485 // Info("StepManager Exit","Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z()) ;
487 // Info("StepManager Exit ","Track backToWire %f %f %f",backToWire.X(),backToWire.Y(),backToWire.Z()) ;
488 fTrackPosition-=backToWire;
490 //-------------- Angle effect
491 // Ratio between energy loss of particle and Mip as a function of BetaGamma of particle (Energy/Mass)
493 Float_t betaxGamma = fTrackMomentum.P()/mass;// pc/mc2
494 Float_t sigmaEffect10degrees;
495 Float_t sigmaEffectThetadegrees;
496 Float_t eLossParticleELossMip;
497 Float_t yAngleEffect=0.;
498 Float_t thetawires = TMath::Abs( TMath::ASin( TMath::Sin(TMath::Pi()-theta) * TMath::Sin(phi) ) );// We use Pi-theta because z is negative
502 if ( (betaxGamma >3.2) && (thetawires*kRaddeg<=15.) ) {
503 betaxGamma=TMath::Log(betaxGamma);
504 eLossParticleELossMip = fElossRatio->Eval(betaxGamma);
505 // 10 degrees is a reference for a model (arbitrary)
506 sigmaEffect10degrees=fAngleEffect10->Eval(eLossParticleELossMip);// in micrometers
507 // Angle with respect to the wires assuming that chambers are perpendicular to the z axis.
508 sigmaEffectThetadegrees = sigmaEffect10degrees/fAngleEffectNorma->Eval(thetawires*kRaddeg); // For 5mm gap
509 if ( (iChamber==1) || (iChamber==2) )
510 sigmaEffectThetadegrees/=(1.09833e+00+1.70000e-02*(thetawires*kRaddeg)); // The gap is different (4mm)
511 yAngleEffect=1.e-04*gRandom->Gaus(0,sigmaEffectThetadegrees); // Error due to the angle effect in cm
515 // Detection elements ids
516 AliMUONGeometryModule* geometry
517 = Chamber(iChamber-1).GetGeometry();
519 AliMUONGeometryDetElement* detElement
520 = geometry->FindBySensitiveVolume(CurrentVolumePath());
523 if (detElement) detElemId = detElement->GetUniqueID();
526 cerr << "Chamber id: "
527 << setw(3) << iChamber << " "
529 << CurrentVolumePath()
531 << setw(5) << detElemId
534 gMC->TrackPosition(x, y, z);
535 cerr << " global position: "
536 << x << ", " << y << ", " << z
538 AliError("DetElemId not identified.");
541 // One hit per chamber
542 GetMUONData()->AddHit2(fIshunt,
543 gAlice->GetMCApp()->GetCurrentTrackNumber(),
546 fTrackPosition.Y()+yAngleEffect,
559 // Info("StepManager Exit","Particle exiting from chamber %d",iChamber);
560 // Info("StepManager Exit","StepSum %f eloss geant %g ",fStepSum[idvol],fDestepSum[idvol]);
561 // Info("StepManager Exit","Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z()) ;
563 fStepSum[idvol] =0; // Reset for the next event
564 fDestepSum[idvol]=0; // Reset for the next event
568 //__________________________________________
569 void AliMUONv1::StepManagerOld()
571 // Old Stepmanager for the chambers
575 static Int_t idvol =-1;
581 Float_t destep, step;
583 static Float_t sstep;
584 static Float_t eloss, eloss2, xhit, yhit, zhit, tof, tlength;
585 const Float_t kBig = 1.e10;
586 static Float_t hits[15];
588 TClonesArray &lhits = *fHits;
592 // Only charged tracks
593 if( !(gMC->TrackCharge()) ) return;
595 // Only gas gap inside chamber
596 // Tag chambers and record hits when track enters
597 id=gMC->CurrentVolID(copy);
598 vol[0] = GetChamberId(id);
601 if (idvol == -1) return;
604 // Get current particle id (ipart), track position (pos) and momentum (mom)
605 gMC->TrackPosition(pos);
606 gMC->TrackMomentum(mom);
608 ipart = gMC->TrackPid();
611 // momentum loss and steplength in last step
612 destep = gMC->Edep();
613 step = gMC->TrackStep();
614 // cout<<"------------"<<step<<endl;
616 // record hits when track enters ...
617 if( gMC->IsTrackEntering()) {
619 gMC->SetMaxStep(fMaxStepGas);
620 Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
621 Double_t rt = TMath::Sqrt(tc);
622 Double_t pmom = TMath::Sqrt(tc+mom[2]*mom[2]);
623 Double_t tx = mom[0]/pmom;
624 Double_t ty = mom[1]/pmom;
625 Double_t tz = mom[2]/pmom;
626 Double_t s = ((AliMUONChamber*)(*fChambers)[idvol])
629 theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
630 phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
631 hits[0] = Float_t(ipart); // Geant3 particle type
632 hits[1] = pos[0]+s*tx; // X-position for hit
633 hits[2] = pos[1]+s*ty; // Y-position for hit
634 hits[3] = pos[2]+s*tz; // Z-position for hit
635 hits[4] = theta; // theta angle of incidence
636 hits[5] = phi; // phi angle of incidence
637 hits[8] = 0;//PadHits does not exist anymore (Float_t) fNPadHits; // first padhit
638 hits[9] = -1; // last pad hit
639 hits[10] = mom[3]; // hit momentum P
640 hits[11] = mom[0]; // Px
641 hits[12] = mom[1]; // Py
642 hits[13] = mom[2]; // Pz
643 tof=gMC->TrackTime();
644 hits[14] = tof; // Time of flight
652 Chamber(idvol).ChargeCorrelationInit();
653 // Only if not trigger chamber
655 // printf("---------------------------\n");
656 // printf(">>>> Y = %f \n",hits[2]);
657 // printf("---------------------------\n");
661 // if(idvol < AliMUONConstants::NTrackingCh()) {
663 // // Initialize hit position (cursor) in the segmentation model
664 // ((AliMUONChamber*) (*fChambers)[idvol])
665 // ->SigGenInit(pos[0], pos[1], pos[2]);
667 // //geant3->Gpcxyz();
668 // //printf("In the Trigger Chamber #%d\n",idvol-9);
674 // cout<<sstep<<endl;
677 // Calculate the charge induced on a pad (disintegration) in case
679 // Mip left chamber ...
680 if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
681 gMC->SetMaxStep(kBig);
687 Float_t globalPos[3] = {pos[0], pos[1], pos[2]};
688 gMC->Gmtod(globalPos,localPos,1);
690 if(idvol < AliMUONConstants::NTrackingCh()) {
692 x0 = 0.5*(xhit+pos[0]);
693 y0 = 0.5*(yhit+pos[1]);
694 z0 = 0.5*(zhit+pos[2]);
703 // if (eloss >0) MakePadHits(x0,y0,z0,eloss,tof,idvol);
706 hits[6] = tlength; // track length
707 hits[7] = eloss2; // de/dx energy loss
710 // if (fNPadHits > (Int_t)hits[8]) {
711 // hits[8] = hits[8]+1;
712 // hits[9] = 0: // PadHits does not exist anymore (Float_t) fNPadHits;
718 AliMUONHit(fIshunt, gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits, kTRUE);
721 // Check additional signal generation conditions
722 // defined by the segmentation
723 // model (boundary crossing conditions)
724 // only for tracking chambers
726 ((idvol < AliMUONConstants::NTrackingCh()) &&
727 ((AliMUONChamber*) (*fChambers)[idvol])->SigGenCond(pos[0], pos[1], pos[2]))
729 ((AliMUONChamber*) (*fChambers)[idvol])
730 ->SigGenInit(pos[0], pos[1], pos[2]);
733 Float_t globalPos[3] = {pos[0], pos[1], pos[2]};
734 gMC->Gmtod(globalPos,localPos,1);
738 // if (eloss > 0 && idvol < AliMUONConstants::NTrackingCh())
739 // MakePadHits(0.5*(xhit+pos[0]),0.5*(yhit+pos[1]),pos[2],eloss,tof,idvol);
746 // nothing special happened, add up energy loss
753 //__________________________________________
754 void AliMUONv1::StepManagerOld2()
756 // Old Stepmanager for the chambers
758 static Int_t idvol =-1;
764 Float_t destep, step;
766 static Float_t sstep;
767 static Float_t eloss, eloss2, xhit, yhit, zhit, tof, tlength;
768 const Float_t kBig = 1.e10;
769 static Float_t hits[15];
771 TClonesArray &lhits = *fHits;
775 // Only charged tracks
776 if( !(gMC->TrackCharge()) ) return;
778 // Only gas gap inside chamber
779 // Tag chambers and record hits when track enters
780 id=gMC->CurrentVolID(copy);
782 Int_t iChamber = GetChamberId(id);
785 if (idvol == -1) return;
787 // Detection elements id
788 AliMUONGeometryModule* geometry
789 = Chamber(iChamber-1).GetGeometry();
791 AliMUONGeometryDetElement* detElement
792 = geometry->FindBySensitiveVolume(CurrentVolumePath());
795 if (detElement) detElemId = detElement->GetUniqueID();
798 cerr << "Chamber id: "
799 << setw(3) << iChamber << " "
801 << CurrentVolumePath()
803 << setw(5) << detElemId
806 gMC->TrackPosition(x, y, z);
807 cerr << " global position: "
808 << x << ", " << y << ", " << z
810 AliError("DetElemId not identified.");
815 // Get current particle id (ipart), track position (pos) and momentum (mom)
816 gMC->TrackPosition(pos);
817 gMC->TrackMomentum(mom);
819 ipart = gMC->TrackPid();
822 // momentum loss and steplength in last step
823 destep = gMC->Edep();
824 step = gMC->TrackStep();
825 // cout<<"------------"<<step<<endl;
827 // record hits when track enters ...
828 if( gMC->IsTrackEntering()) {
830 gMC->SetMaxStep(fMaxStepGas);
831 Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
832 Double_t rt = TMath::Sqrt(tc);
833 Double_t pmom = TMath::Sqrt(tc+mom[2]*mom[2]);
834 Double_t tx = mom[0]/pmom;
835 Double_t ty = mom[1]/pmom;
836 Double_t tz = mom[2]/pmom;
837 Double_t s = ((AliMUONChamber*)(*fChambers)[idvol])
840 theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
841 phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
842 hits[0] = Float_t(ipart); // Geant3 particle type
843 hits[1] = pos[0]+s*tx; // X-position for hit
844 hits[2] = pos[1]+s*ty; // Y-position for hit
845 hits[3] = pos[2]+s*tz; // Z-position for hit
846 hits[4] = theta; // theta angle of incidence
847 hits[5] = phi; // phi angle of incidence
848 hits[8] = 0;//PadHits does not exist anymore (Float_t) fNPadHits; // first padhit
849 hits[9] = -1; // last pad hit
850 hits[10] = mom[3]; // hit momentum P
851 hits[11] = mom[0]; // Px
852 hits[12] = mom[1]; // Py
853 hits[13] = mom[2]; // Pz
854 tof=gMC->TrackTime();
855 hits[14] = tof; // Time of flight
863 Chamber(idvol).ChargeCorrelationInit();
864 // Only if not trigger chamber
866 // printf("---------------------------\n");
867 // printf(">>>> Y = %f \n",hits[2]);
868 // printf("---------------------------\n");
872 // if(idvol < AliMUONConstants::NTrackingCh()) {
874 // // Initialize hit position (cursor) in the segmentation model
875 // ((AliMUONChamber*) (*fChambers)[idvol])
876 // ->SigGenInit(pos[0], pos[1], pos[2]);
878 // //geant3->Gpcxyz();
879 // //printf("In the Trigger Chamber #%d\n",idvol-9);
885 // cout<<sstep<<endl;
888 // Calculate the charge induced on a pad (disintegration) in case
890 // Mip left chamber ...
891 if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
892 gMC->SetMaxStep(kBig);
898 Float_t globalPos[3] = {pos[0], pos[1], pos[2]};
899 gMC->Gmtod(globalPos,localPos,1);
901 if(idvol < AliMUONConstants::NTrackingCh()) {
903 x0 = 0.5*(xhit+pos[0]);
904 y0 = 0.5*(yhit+pos[1]);
905 z0 = 0.5*(zhit+pos[2]);
914 // if (eloss >0) MakePadHits(x0,y0,z0,eloss,tof,idvol);
917 hits[6] = tlength; // track length
918 hits[7] = eloss2; // de/dx energy loss
921 // if (fNPadHits > (Int_t)hits[8]) {
922 // hits[8] = hits[8]+1;
923 // hits[9] = 0: // PadHits does not exist anymore (Float_t) fNPadHits;
929 AliMUONHit(fIshunt, gAlice->GetMCApp()->GetCurrentTrackNumber(), vol,hits);
932 // Check additional signal generation conditions
933 // defined by the segmentation
934 // model (boundary crossing conditions)
935 // only for tracking chambers
937 ((idvol < AliMUONConstants::NTrackingCh()) &&
938 ((AliMUONChamber*) (*fChambers)[idvol])->SigGenCond(pos[0], pos[1], pos[2]))
940 ((AliMUONChamber*) (*fChambers)[idvol])
941 ->SigGenInit(pos[0], pos[1], pos[2]);
944 Float_t globalPos[3] = {pos[0], pos[1], pos[2]};
945 gMC->Gmtod(globalPos,localPos,1);
949 // if (eloss > 0 && idvol < AliMUONConstants::NTrackingCh())
950 // MakePadHits(0.5*(xhit+pos[0]),0.5*(yhit+pos[1]),pos[2],eloss,tof,idvol);
957 // nothing special happened, add up energy loss