43 #include "AliTrackReference.h"
46 #include <TClonesArray.h>
49 #include <TGeoGlobalMagField.h>
50 #include <TGeoMatrix.h>
53 #include <TVirtualMC.h>
73 fStepMaxInActiveGas(0.6),
80 fAngleEffectNorma(0x0),
81 fMagAngleEffectNorma(0x0)
85 AliDebug(1,Form(
"default (empty) ctor this=%p",
this));
93 fStepMaxInActiveGas(0.6),
100 fAngleEffectNorma(0x0),
101 fMagAngleEffectNorma(0x0)
105 AliDebug(1,Form(
"ctor this=%p",
this));
109 AliFatal(
"Could not access mapping from OCDB !");
121 fElossRatio =
new TF1(
"ElossRatio",
"[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x",0.5,5.);
129 fAngleEffect10 =
new TF1(
"AngleEffect10",
"[0]+[1]*x+[2]*x*x",0.5,3.0);
135 fAngleEffectNorma =
new TF1(
"AngleEffectNorma",
"[0]+[1]*x+[2]*x*x+[3]*x*x*x",0.0,10.0);
143 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.);
152 AliDebug(1,Form(
"dtor this=%p",
this));
184 AliFatal(
"Could not access mapping from OCDB !");
204 AliDebug(1,
"Start Init for version 1 - CPC chamber type");
207 AliDebug(1,
"Finished Init for version 1 - CPC chamber type");
216 respFactory.
Build(
this);
246 name = TVirtualMC::GetMC()->CurrentVolOffName(imother);
247 TVirtualMC::GetMC()->CurrentVolOffID(imother++, copyNo);
254 while ( name != TString(
"ALIC") );
265 if( !(TVirtualMC::GetMC()->TrackCharge()) )
return;
270 static Int_t idvol=-1, iEnter = 0;
272 const Float_t kBig = 1.e10;
273 static Double_t xyzEnter[3];
278 Int_t
id=TVirtualMC::GetMC()->CurrentVolID(copy);
280 if (iGeomModule == -1)
return;
297 if (detElement) detElemId = detElement->GetUniqueID();
301 <<
"Geometry module id: "
302 << setw(3) << iGeomModule <<
" "
306 << setw(5) << detElemId
309 TVirtualMC::GetMC()->TrackPosition(x, y, z);
311 <<
" global position: "
312 << x <<
", " << y <<
", " << z
314 AliErrorStream() <<
"DetElemId not identified." << endl;
321 if ( (TVirtualMC::GetMC()->IsTrackEntering() || TVirtualMC::GetMC()->IsTrackExiting() ) ) {
322 AliTrackReference* trackReference
323 = AddTrackReference(
gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kMUON);
324 trackReference->SetUserId(detElemId);
327 if( TVirtualMC::GetMC()->IsTrackEntering() ) {
329 if (
fIsMaxStep && (TMath::Pi()-theta)*kRaddeg>=15. ) {
333 TVirtualMC::GetMC()->TrackPosition(xyzEnter[0], xyzEnter[1], xyzEnter[2]);
340 Int_t ipart = TVirtualMC::GetMC()->TrackPid();
341 Float_t mass = TVirtualMC::GetMC()->TrackMass();
343 fDestepSum[idvol]+=TVirtualMC::GetMC()->Edep();
346 fStepSum[idvol]+=TVirtualMC::GetMC()->TrackStep();
360 if ( TVirtualMC::GetMC()->IsTrackExiting() ||
361 TVirtualMC::GetMC()->IsTrackStop() ||
362 TVirtualMC::GetMC()->IsTrackDisappeared()||
366 ( TVirtualMC::GetMC()->IsTrackExiting() ||
367 TVirtualMC::GetMC()->IsTrackStop() ||
368 TVirtualMC::GetMC()->IsTrackDisappeared() ) ) TVirtualMC::GetMC()->SetMaxStep(kBig);
381 Double_t xyz0[3]={0}, xyz1[3]={0}, tmp[3]={0};
382 if (TVirtualMC::GetMC()->IsTrackExiting() && iEnter != 0) {
390 TVirtualMC::GetMC()->Gmtod(xyzEnter, xyz0, 1);
393 TVirtualMC::GetMC()->Gmtod(tmp, xyz1, 1);
394 Float_t dx = xyz0[0] - xyz1[0];
395 Float_t dy = xyz0[1] - xyz1[1];
396 Float_t thLoc = TMath::ATan2 (TMath::Sqrt(dx*dx+dy*dy), TMath::Abs(xyz0[2]-xyz1[2]));
397 if (thLoc * TMath::RadToDeg() < 15) merge = 1;
402 if (xyz1[2] != xyz0[2]) dz = xyz0[2] / (xyz1[2] - xyz0[2]);
403 tmp[0] = xyz0[0] - (xyz1[0] - xyz0[0]) * dz;
404 tmp[1] = xyz0[1] - (xyz1[1] - xyz0[1]) * dz;
405 tmp[2] = xyz0[2] - (xyz1[2] - xyz0[2]) * dz;
406 TVirtualMC::GetMC()->Gdtom(tmp, xyz1, 1);
409 TLorentzVector backToWire(
fStepSum[idvol]/2.*sin(theta)*cos(phi),
410 fStepSum[idvol]/2.*sin(theta)*sin(phi),
411 fStepSum[idvol]/2.*cos(theta),0.0 );
424 Float_t sigmaEffect10degrees;
425 Float_t sigmaEffectThetadegrees;
426 Float_t eLossParticleELossMip;
427 Float_t yAngleEffect=0.;
428 Float_t thetawires = TMath::ASin( TMath::Sin(TMath::Pi()-theta) * TMath::Sin(phi) ) ;
429 Double_t bField[3] = {0};
431 TGeoGlobalMagField::Instance()->Field(tmp,bField);
434 thetawires = TMath::Abs(thetawires);
435 if ( (betaxGamma >3.2) && (thetawires*kRaddeg<=15.) ) {
436 betaxGamma=TMath::Log(betaxGamma);
437 eLossParticleELossMip =
fElossRatio->Eval(betaxGamma);
441 sigmaEffectThetadegrees = sigmaEffect10degrees/
fAngleEffectNorma->Eval(thetawires*kRaddeg);
442 if ( (iChamber==1) || (iChamber==2) )
443 sigmaEffectThetadegrees/=(1.09833e+00+1.70000e-02*(thetawires*kRaddeg));
444 yAngleEffect=1.e-04*gRandom->Gaus(0,sigmaEffectThetadegrees);
448 if ( (betaxGamma >3.2) && (TMath::Abs(thetawires*kRaddeg)<=15.) ) {
449 betaxGamma=TMath::Log(betaxGamma);
450 eLossParticleELossMip =
fElossRatio->Eval(betaxGamma);
454 sigmaEffectThetadegrees = sigmaEffect10degrees/
fMagAngleEffectNorma->Eval(thetawires*kRaddeg,bField[0]/10.);
455 if ( (iChamber==1) || (iChamber==2) )
456 sigmaEffectThetadegrees/=(1.09833e+00+1.70000e-02*(thetawires*kRaddeg));
457 yAngleEffect=1.e-04*gRandom->Gaus(0,sigmaEffectThetadegrees);
462 gAlice->GetMCApp()->GetCurrentTrackNumber(),
467 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.