43 #include "AliTrackReference.h"
46 #include <TClonesArray.h>
49 #include <TGeoGlobalMagField.h>
50 #include <TGeoMatrix.h>
53 #include <TVirtualMC.h>
71 fStepMaxInActiveGas(0.6),
78 fAngleEffectNorma(0x0),
79 fMagAngleEffectNorma(0x0)
83 AliDebug(1,Form(
"default (empty) ctor this=%p",
this));
91 fStepMaxInActiveGas(0.6),
98 fAngleEffectNorma(0x0),
99 fMagAngleEffectNorma(0x0)
103 AliDebug(1,Form(
"ctor this=%p",
this));
107 AliFatal(
"Could not access mapping from OCDB !");
119 fElossRatio =
new TF1(
"ElossRatio",
"[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x",0.5,5.);
127 fAngleEffect10 =
new TF1(
"AngleEffect10",
"[0]+[1]*x+[2]*x*x",0.5,3.0);
133 fAngleEffectNorma =
new TF1(
"AngleEffectNorma",
"[0]+[1]*x+[2]*x*x+[3]*x*x*x",0.0,10.0);
141 fMagAngleEffectNorma =
new TF2(
"MagAngleEffectNorma",
"121.24/(([1]+[2]*abs(y))+[3]*abs(x-[0]*y)+[4]*abs((x-[0]*y)*(x-[0]*y))+[5]*abs((x-[0]*y)*(x-[0]*y)*(x-[0]*y))+[6]*abs((x-[0]*y)*(x-[0]*y)*(x-[0]*y)*(x-[0]*y)))",-20.0,20.0,-1.,1.);
150 AliDebug(1,Form(
"dtor this=%p",
this));
182 AliFatal(
"Could not access mapping from OCDB !");
202 AliDebug(1,
"Start Init for version 1 - CPC chamber type");
205 AliDebug(1,
"Finished Init for version 1 - CPC chamber type");
214 respFactory.
Build(
this);
244 name = TVirtualMC::GetMC()->CurrentVolOffName(imother);
245 TVirtualMC::GetMC()->CurrentVolOffID(imother++, copyNo);
252 while ( name != TString(
"ALIC") );
263 if( !(TVirtualMC::GetMC()->TrackCharge()) )
return;
268 static Int_t idvol=-1, iEnter = 0;
270 const Float_t kBig = 1.e10;
271 static Double_t xyzEnter[3];
276 Int_t
id=TVirtualMC::GetMC()->CurrentVolID(copy);
278 if (iGeomModule == -1)
return;
295 if (detElement) detElemId = detElement->GetUniqueID();
299 <<
"Geometry module id: "
300 << setw(3) << iGeomModule <<
" "
304 << setw(5) << detElemId
307 TVirtualMC::GetMC()->TrackPosition(x, y, z);
309 <<
" global position: "
310 << x <<
", " << y <<
", " << z
312 AliErrorStream() <<
"DetElemId not identified." << endl;
319 if ( (TVirtualMC::GetMC()->IsTrackEntering() || TVirtualMC::GetMC()->IsTrackExiting() ) ) {
320 AliTrackReference* trackReference
321 = AddTrackReference(
gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kMUON);
322 trackReference->SetUserId(detElemId);
325 if( TVirtualMC::GetMC()->IsTrackEntering() ) {
327 if (
fIsMaxStep && (TMath::Pi()-theta)*kRaddeg>=15. ) {
331 TVirtualMC::GetMC()->TrackPosition(xyzEnter[0], xyzEnter[1], xyzEnter[2]);
338 Int_t ipart = TVirtualMC::GetMC()->TrackPid();
339 Float_t mass = TVirtualMC::GetMC()->TrackMass();
341 fDestepSum[idvol]+=TVirtualMC::GetMC()->Edep();
344 fStepSum[idvol]+=TVirtualMC::GetMC()->TrackStep();
358 if ( TVirtualMC::GetMC()->IsTrackExiting() ||
359 TVirtualMC::GetMC()->IsTrackStop() ||
360 TVirtualMC::GetMC()->IsTrackDisappeared()||
364 ( TVirtualMC::GetMC()->IsTrackExiting() ||
365 TVirtualMC::GetMC()->IsTrackStop() ||
366 TVirtualMC::GetMC()->IsTrackDisappeared() ) ) TVirtualMC::GetMC()->SetMaxStep(kBig);
379 Double_t xyz0[3]={0}, xyz1[3]={0}, tmp[3]={0};
380 if (TVirtualMC::GetMC()->IsTrackExiting() && iEnter != 0) {
388 TVirtualMC::GetMC()->Gmtod(xyzEnter, xyz0, 1);
391 TVirtualMC::GetMC()->Gmtod(tmp, xyz1, 1);
392 Float_t dx = xyz0[0] - xyz1[0];
393 Float_t dy = xyz0[1] - xyz1[1];
394 Float_t thLoc = TMath::ATan2 (TMath::Sqrt(dx*dx+dy*dy), TMath::Abs(xyz0[2]-xyz1[2]));
395 if (thLoc * TMath::RadToDeg() < 15) merge = 1;
400 if (xyz1[2] != xyz0[2]) dz = xyz0[2] / (xyz1[2] - xyz0[2]);
401 tmp[0] = xyz0[0] - (xyz1[0] - xyz0[0]) * dz;
402 tmp[1] = xyz0[1] - (xyz1[1] - xyz0[1]) * dz;
403 tmp[2] = xyz0[2] - (xyz1[2] - xyz0[2]) * dz;
404 TVirtualMC::GetMC()->Gdtom(tmp, xyz1, 1);
407 TLorentzVector backToWire(
fStepSum[idvol]/2.*sin(theta)*cos(phi),
408 fStepSum[idvol]/2.*sin(theta)*sin(phi),
409 fStepSum[idvol]/2.*cos(theta),0.0 );
422 Float_t sigmaEffect10degrees;
423 Float_t sigmaEffectThetadegrees;
424 Float_t eLossParticleELossMip;
425 Float_t yAngleEffect=0.;
426 Float_t thetawires = TMath::ASin( TMath::Sin(TMath::Pi()-theta) * TMath::Sin(phi) ) ;
427 Double_t bField[3] = {0};
429 TGeoGlobalMagField::Instance()->Field(tmp,bField);
432 thetawires = TMath::Abs(thetawires);
433 if ( (betaxGamma >3.2) && (thetawires*kRaddeg<=15.) ) {
434 betaxGamma=TMath::Log(betaxGamma);
435 eLossParticleELossMip =
fElossRatio->Eval(betaxGamma);
439 sigmaEffectThetadegrees = sigmaEffect10degrees/
fAngleEffectNorma->Eval(thetawires*kRaddeg);
440 if ( (iChamber==1) || (iChamber==2) )
441 sigmaEffectThetadegrees/=(1.09833e+00+1.70000e-02*(thetawires*kRaddeg));
442 yAngleEffect=1.e-04*gRandom->Gaus(0,sigmaEffectThetadegrees);
446 if ( (betaxGamma >3.2) && (TMath::Abs(thetawires*kRaddeg)<=15.) ) {
447 betaxGamma=TMath::Log(betaxGamma);
448 eLossParticleELossMip =
fElossRatio->Eval(betaxGamma);
452 sigmaEffectThetadegrees = sigmaEffect10degrees/
fMagAngleEffectNorma->Eval(thetawires*kRaddeg,bField[0]/10.);
453 if ( (iChamber==1) || (iChamber==2) )
454 sigmaEffectThetadegrees/=(1.09833e+00+1.70000e-02*(thetawires*kRaddeg));
455 yAngleEffect=1.e-04*gRandom->Gaus(0,sigmaEffectThetadegrees);
460 gAlice->GetMCApp()->GetCurrentTrackNumber(),
465 TVirtualMC::GetMC()->TrackTime(),
const AliMUONGeometry * GetGeometry() const
AliMUONVHitStore * fHitStore
! container of hits
TString CurrentVolumePath() const
Bool_t fAngleEffect
Angle Effect along wires, Default is true.
virtual void UpdateInternalGeometry()
Float_t * fDestepSum
! Sum of energy deposits per chamber
AliMUONGeometryDetElement * FindBySensitiveVolume(const TString &volumePath) const
virtual void CreateMaterials()
virtual void AddAlignableVolumes() const
Float_t * fStepSum
! Sum of track steps per chamber
TF1 * fElossRatio
Ratio of particle mean eloss with respect MIP's.
TF1 * fAngleEffectNorma
Angle effect: Normalisation form theta=10 degres to theta between 0 and 10 (Khalil BOUDJEMLINE sep 20...
void InitGeometry()
Initialize geometry.
AliDetector class for MUON subsystem providing simulation data management.
TF2 * fMagAngleEffectNorma
Magnetic field effect: Normalisation from theta=16 degres to theta between -20 and 20 (Lamia Benhabib...
TLorentzVector fTrackPosition
Position of the particle exiting the active gas of chamber.
Bool_t fIsTailEffect
Switch to turn on/off the tail effect.
Factory for muon response.
static Int_t GetChamberId(Int_t detElemId, Bool_t warn=true)
AliDetector class for MUON subsystem which implements functions for simulation.
Float_t fStepMaxInActiveGas
Step max in active gas default 0.6cm.
static Int_t NGeomModules()
Return number of geometry modules.
const AliMUONGeometryTransformer * GetGeometryTransformer() const
virtual Bool_t Add(TObject *object)
Add an object, if of type AliMUONHit.
AliMUONGeometryBuilder * fGeometryBuilder
Geometry builder.
static Int_t NCh()
Return number of chambers.
virtual Int_t GetGeomModuleId(Int_t volId) const
Bool_t fMagEffect
Magnetic Field Effect along wires, Default is true.
TLorentzVector fTrackMomentum
Momentum of the particle entering in the active gas of chamber.
const AliMUONGeometryModule * GetModule(Int_t index, Bool_t warn=true) const
Geometry parameters for detector module.
TF1 * fAngleEffect10
Angle effect in tracking chambers at theta =10 degres as a function of ElossRatio (Khalil BOUDJEMLINE...
void UpdateInternalGeometry()
virtual void StepManager()
Class for storing detection element transformations.
Bool_t IsSensitiveVolume(Int_t volId) const
static Bool_t LoadMpSegmentation(Bool_t warn=false)
void Build(AliMUON *where)
virtual void CreateGeometry()
Bool_t fIsMaxStep
Flag to inactivate calls to TVirtualMC::GetMC()->SetMaxStep.