Changes to compile with Root6 on macosx64
authorhristov <Peter.Hristov@cern.ch>
Sat, 3 May 2014 17:19:54 +0000 (19:19 +0200)
committerhristov <Peter.Hristov@cern.ch>
Sat, 3 May 2014 17:19:54 +0000 (19:19 +0200)
194 files changed:
ACORDE/AliACORDEv0.cxx
ACORDE/AliACORDEv1.cxx
AD/AliADv1.cxx
ANALYSIS/AliAODv0KineCuts.cxx
ANALYSIS/AliESDv0KineCuts.cxx
BCM/AliBCM.cxx
EMCAL/AliEMCAL.cxx
EMCAL/AliEMCALTracker.cxx
EMCAL/AliEMCALTriggerRawDigitMaker.cxx
EMCAL/AliEMCALWsuCosmicRaySetUp.cxx
EMCAL/AliEMCALv0.cxx
EMCAL/AliEMCALv1.cxx
EMCAL/AliEMCALv2.cxx
EVGEN/AliGenCorrHF.cxx
EVGEN/AliGenEMCocktail.cxx
EVGEN/AliGenHIJINGpara.cxx
EVGEN/AliGenMUONCocktailpp.cxx
EVGEN/AliGenParam.cxx
EVGEN/AliGenReaderCwn.cxx
EVGEN/AliGenTunedOnPbPb.cxx
FIT/AliFITv0.cxx
FIT/AliFITv1.cxx
FMD/AliFMD.cxx
HLT/BASE/AliHLTComponent.cxx
HLT/CALO/AliHLTCaloClusterizerComponent.cxx
HMPID/AliHMPIDv1.cxx
HMPID/AliHMPIDv2.cxx
HMPID/AliHMPIDv3.cxx
ITS/AliITS.cxx
ITS/AliITSMultReconstructor.cxx
ITS/AliITSV0Finder.cxx
ITS/AliITSgeomMatrix.cxx
ITS/AliITSsimulationFastPoints.cxx
ITS/AliITStrackerMI.cxx
ITS/AliITSv11.cxx
ITS/UPGRADE/AliITSU.cxx
ITS/UPGRADE/AliITSUv0.cxx
ITS/UPGRADE/AliITSUv1.cxx
ITS/UPGRADE/v0/AliITSupgrade.cxx
MFT/AliMFT.cxx
MFT/AliMuonForwardTrackFinder.cxx
MONITOR/CMakebinmonitorGDC.pkg
MUON/AliMUON.h
MUON/AliMUONGain.cxx
MUON/AliMUONGeometryBuilder.cxx
MUON/AliMUONGeometryModule.cxx
MUON/AliMUONLocalStruct.cxx
MUON/AliMUONLocalTrigger.cxx
MUON/AliMUONSlatGeometryBuilder.cxx
MUON/AliMUONSt1GeometryBuilder.cxx
MUON/AliMUONSt1GeometryBuilderV2.cxx
MUON/AliMUONSt2GeometryBuilder.cxx
MUON/AliMUONSt2GeometryBuilderV2.cxx
MUON/AliMUONTrackHitPattern.cxx
MUON/AliMUONTriggerGeometryBuilder.cxx
MUON/AliMUONTriggerQAChecker.cxx
MUON/AliMUONTriggerQADataMakerRec.cxx
MUON/AliMUONVGeometryBuilder.cxx
MUON/AliMUONv1.cxx
PHOS/AliPHOSDebug.cxx
PHOS/AliPHOSv0.cxx
PHOS/AliPHOSv1.cxx
PHOS/AliPHOSvFast.cxx
PHOS/AliPHOSvImpacts.cxx
PMD/AliPMDv0.cxx
PMD/AliPMDv1.cxx
PMD/AliPMDv2008.cxx
PWG/FLOW/Tasks/AliAnalysisTaskVnV0.cxx
PWG/muon/AliAnalysisTaskMuonCollisionMultiplicity.cxx
PWG/muon/AliMuonsHFHeader.cxx
PWGCF/Correlations/DPhi/AliAnalysisTaskLongRangeCorrelations.cxx
PWGCF/Correlations/DPhi/AliAnalysisTaskMinijet.cxx
PWGCF/Correlations/DPhi/AliLeadingV0Correlation.cxx
PWGCF/Correlations/DPhi/PhiEffMC/AliAnalysisTaskPhiEffMc.cxx
PWGCF/Correlations/DPhi/PidPid/AliAnalysisTaskPidPidCorrelations.cxx
PWGCF/Correlations/JCORRAN/AliJBaseTrack.h
PWGCF/Correlations/JCORRAN/AliJCORRANTask.cxx
PWGCF/Correlations/JCORRAN/AliJCORRANTask.h
PWGCF/Correlations/JCORRAN/AliJConst.h
PWGCF/Correlations/JCORRAN/AliJPhoton.cxx
PWGCF/Correlations/JCORRAN/AliJPhoton.h
PWGCF/Correlations/JCORRAN/AliJRunHeader.cxx
PWGCF/EBYE/Fluctuations/AliEbyEHigherMomentsEffContTask.cxx
PWGCF/EBYE/Fluctuations/AliEbyEHigherMomentsTask.cxx
PWGCF/EBYE/Fluctuations/AliEbyEHigherMomentsTaskPID.cxx
PWGCF/EBYE/Fluctuations/AliHigherMomentsToyModel.cxx
PWGCF/EBYE/NetParticle/AliAnalysisNetParticleDistribution.cxx
PWGCF/EBYE/NetParticle/AliAnalysisNetParticleHelper.cxx
PWGCF/FEMTOSCOPY/PLamAnalysis/AliAnalysisTaskProtonLambda.cxx
PWGGA/EMCALTasks/AliAnalysisTaskEMCALMesonGGSDM.cxx
PWGGA/EMCALTasks/AliAnalysisTaskEMCALMesonGGSDMpPb.cxx
PWGGA/EMCALTasks/AliAnalysisTaskSDMGammaMC.cxx
PWGGA/PHOSTasks/PHOS_embedding/AliPHOSEmbedding.cxx
PWGHF/correlationHF/AliAnalysisTaskSEHFCJqa.cxx
PWGHF/correlationHF/AliAnalysisTaskSEmcCorr.cxx
PWGHF/hfe/AliAnalysisTaskFlowTPCEMCalEP.cxx
PWGHF/hfe/AliHFENonPhotonicElectron.cxx
PWGHF/hfe/AliHFEV0cuts.cxx
PWGHF/vertexingHF/AliAnalysisTaskSEDplus.cxx
PWGHF/vertexingHF/AliAnalysisVertexingHF.cxx
PWGJE/AliAnalysisTaskJetCore.cxx
PWGJE/AliAnalysisTaskJetSpectrum2.cxx
PWGJE/AliFragmentationFunctionCorrections.cxx
PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskHJetEmbed.cxx
PWGJE/FlavourJetTasks/AliAnalysisTaskFlavourJetCorrelations.cxx
PWGJE/UserTasks/AliAnalysisTaskIDFragmentationFunction.cxx
PWGJE/UserTasks/AliAnalysisTaskPID.cxx
PWGLF/SPECTRA/ChargedHadrons/dNdPt/AlidNdPtAnalysis.cxx
PWGLF/SPECTRA/ChargedHadrons/dNdPt/AlidNdPtAnalysisPbPb.cxx
PWGLF/SPECTRA/ChargedHadrons/dNdPt/AlidNdPtAnalysisPbPbAOD.cxx
PWGLF/SPECTRA/ChargedHadrons/dNdPt/AlidNdPtAnalysispPb.cxx
PWGLF/SPECTRA/ChargedHadrons/dNdPt/AlidNdPtCorrection.cxx
PWGLF/SPECTRA/ChargedHadrons/dNdPt/AlidNdPtCutAnalysis.cxx
PWGLF/SPECTRA/ChargedHadrons/dNdPt/AlidNdPtCutAnalysisPbPb.cxx
PWGLF/SPECTRA/ChargedHadrons/dNdPt/AlidNdPtEfficiency.cxx
PWGLF/SPECTRA/Nuclei/deuteronpA/AliAnalysisDeuteronpA.cxx
PWGLF/SPECTRA/PiKaPr/TPCTOF/AliAnalysisCombinedHadronSpectra.cxx
PWGLF/SPECTRA/PiKaPr/TPCTOFpA/AliAnalysisTPCTOFpA.cxx
PWGLF/STRANGENESS/Correlations/AliAnalysisTaskLambdaOverK0sJets.cxx
PWGLF/STRANGENESS/Correlations/AliAnalysisTaskV0ChCorrelations.cxx
PWGLF/STRANGENESS/Hypernuclei/AliAnalysisTaskAntiHe4.cxx
PWGLF/STRANGENESS/Hypernuclei/AliAnalysisTaskHdibaryonLPpi.cxx
PWGLF/STRANGENESS/LambdaK0PbPb/AliAnalysisTaskCTauPbPb.cxx
PWGLF/STRANGENESS/LambdaK0PbPb/AliAnalysisTaskCTauPbPbaod.cxx
PWGPP/EVCHAR/AliAnalysisTaskSPDdNdEta.cxx
PWGPP/EVCHAR/AliTrackletAlg.cxx
PWGPP/EvTrkSelection/AliAnalysisTrackingUncertainties.cxx
PWGPP/ITS/AliAnalysisTaskITSTrackingCheck.cxx
PWGPP/MUON/dep/AliAnalysisTaskMuonTrackingEff.cxx
PWGPP/TPC/AliAnalysisNoiseTPC.cxx
PWGPP/TPC/AliESDRecV0Info.cxx
PWGPP/TPC/AliGenV0Info.cxx
PWGPP/TPC/AliPerformanceEff.cxx
PWGPP/TPC/AliPerformanceMatch.cxx
PWGPP/TPC/AliPerformanceTPC.cxx
PWGPP/TPC/AliRecInfoMaker.cxx
PWGPP/pid/AliAnalysisTaskK0sBayes.cxx
PWGPP/pid/AliAnalysisTaskLambdaBayes.cxx
PWGPP/pid/AliAnalysisTaskPhiBayes.cxx
PWGUD/DIFFRACTIVE/xsAndTwoProng/AliAnalysisTaskCDMeson.cxx
PWGUD/DIFFRACTIVE/xsAndTwoProng/AliCDMesonBase.cxx
STEER/STEER/AliLego.cxx
STEER/STEER/AliMC.cxx
STEER/STEER/AliModule.cxx
STEER/STEER/AliRun.cxx
STEER/STEER/AliSimulation.cxx
STEER/STEERBase/AliTrackReference.cxx
STRUCT/AliBODY.cxx
STRUCT/AliDIPOv2.cxx
STRUCT/AliFRAMEv2.cxx
STRUCT/AliHALL.cxx
STRUCT/AliHALLv3.cxx
STRUCT/AliPIPEv0.cxx
STRUCT/AliPIPEv1.cxx
T0/AliT0v0.cxx
T0/AliT0v1.cxx
T0/AliT0v2.cxx
TOF/AliTOF.cxx
TOF/AliTOFAnalysisTaskCalibPass0.cxx
TOF/AliTOFGeometry.cxx
TOF/AliTOFTrigger.cxx
TOF/AliTOFtrackerMI.cxx
TOF/AliTOFtrackerV1.cxx
TOF/AliTOFv6T0.cxx
TPC/Base/AliTPCCalibCE.cxx
TPC/Base/AliTPCCalibRaw.cxx
TPC/Base/AliTPCCorrection.cxx
TPC/Base/AliTPCTransform.cxx
TPC/Calib/AliTPCcalibAlign.cxx
TPC/Calib/AliTPCcalibCalib.cxx
TPC/Calib/AliTPCcalibCosmic.cxx
TPC/Calib/AliTPCcalibGainMult.cxx
TPC/Calib/AliTPCcalibLaser.cxx
TPC/Calib/AliTPCcalibTime.cxx
TPC/Calib/AliTPCcalibTimeGain.cxx
TPC/Calib/AliTPCcalibV0.cxx
TPC/Rec/AliTPCClusterParam.cxx
TPC/Rec/AliTPCclusterer.cxx
TPC/Rec/AliTPCclustererKr.cxx
TPC/Rec/AliTPCtracker.cxx
TPC/Sim/AliTPCLaser.cxx
TPC/Sim/AliTPCv2.cxx
TPC/Sim/AliTPCv4.cxx
TPC/Upgrade/AliToyMCDrawer.cxx
TPC/Upgrade/AliToyMCEventGenerator.cxx
TPC/Upgrade/AliToyMCReconstruction.cxx
TRD/AliTRDCalibChamberStatus.cxx
TRD/AliTRDdEdxCalibHistArray.cxx
TRD/AliTRDgeometry.cxx
TRD/AliTRDsimTR.cxx
TRD/AliTRDv1.cxx
VZERO/AliVZEROv7.cxx
ZDC/AliZDCv3.cxx
ZDC/AliZDCv4.cxx

index d434fbe..5464252 100644 (file)
@@ -98,8 +98,8 @@ void AliACORDEv0::CreateCavern()
   //pbox[0] = 12073;
   pbox[1] = AliACORDEConstants::Instance()->Depth();
   pbox[2] = pbox[0];
-  gMC->Gsvolu("ACORDE", "BOX", idtmed[1114], pbox, 3);
-  gMC->Gspos("ACORDE", 1, "ALIC", 0, 0, 0, 0, "ONLY");
+  TVirtualMC::GetMC()->Gsvolu("ACORDE", "BOX", idtmed[1114], pbox, 3);
+  TVirtualMC::GetMC()->Gspos("ACORDE", 1, "ALIC", 0, 0, 0, 0, "ONLY");
   CreateShafts();
   CreateMolasse();
 }
@@ -127,7 +127,7 @@ void AliACORDEv0::CreateShafts()
   ptube[0] = 0;    // inner radius
   ptube[1] = 1250; // outer radius
   ptube[2] = 5150/2; // Half lenght in Z
-  gMC->Gsvolu("CSF1", "TUBE", idtmed[1114], ptube, 3);
+  TVirtualMC::GetMC()->Gsvolu("CSF1", "TUBE", idtmed[1114], ptube, 3);
 
   Float_t ptubs[5];
   // The open section of the PX24
@@ -136,90 +136,90 @@ void AliACORDEv0::CreateShafts()
   ptubs[2] = 1300; // Half length
   ptubs[3] = 180 + kRaddeg*TMath::ASin(1070/ptubs[0]); // starting angle
   ptubs[4] = 180 -  kRaddeg*TMath::ASin(1070/ptubs[0]);
-  gMC->Gsvolu("CSF2", "TUBS", idtmed[1116], ptubs, 5);
-  gMC->Gspos("CSF2", 1, "CSF1", 0, 0, -ptube[2] + ptubs[2], 0, "MANY");
+  TVirtualMC::GetMC()->Gsvolu("CSF2", "TUBS", idtmed[1116], ptubs, 5);
+  TVirtualMC::GetMC()->Gspos("CSF2", 1, "CSF1", 0, 0, -ptube[2] + ptubs[2], 0, "MANY");
 
   // The other part of the shaft.
   ptube[0] = ptubs[0]; // Inner radius
   ptube[1] = ptubs[1]; // Outer radius
   ptube[2] = 5150/2 - ptubs[2]; // Half lenght
-  gMC->Gsvolu("CSF3", "TUBE", idtmed[1116], ptube, 3);
-  gMC->Gspos("CSF3", 1, "CSF1", 0, 0, 5150/2 - ptube[2], 0, "MANY");
+  TVirtualMC::GetMC()->Gsvolu("CSF3", "TUBE", idtmed[1116], ptube, 3);
+  TVirtualMC::GetMC()->Gspos("CSF3", 1, "CSF1", 0, 0, 5150/2 - ptube[2], 0, "MANY");
 
   Float_t pbox[3];
   // Concrete walls along the shaft (next to the elevator.)
   pbox[0] = 480/2;  // Half length in X
   pbox[1] = 120/2;  // Half length in Y
   pbox[2] = 5150/2; // Half length in Z
-  gMC->Gsvolu("CSW1", "BOX", idtmed[1116], pbox, 3);
-  gMC->Gspos("CSW1", 1, "CSF1", 820+pbox[0],  150+pbox[1], 0, 0, "MANY");
-  gMC->Gspos("CSW1", 2, "CSF1", 820+pbox[0], -300-pbox[1], 0, 0, "MANY");
+  TVirtualMC::GetMC()->Gsvolu("CSW1", "BOX", idtmed[1116], pbox, 3);
+  TVirtualMC::GetMC()->Gspos("CSW1", 1, "CSF1", 820+pbox[0],  150+pbox[1], 0, 0, "MANY");
+  TVirtualMC::GetMC()->Gspos("CSW1", 2, "CSF1", 820+pbox[0], -300-pbox[1], 0, 0, "MANY");
 
   //
   pbox[0] = 120/2;  // Half length in X
   pbox[1] = 750/2;  // Half length in Y
   pbox[2] = 5150/2; // Half length in Z
-  gMC->Gsvolu("CSW2", "BOX", idtmed[1116], pbox, 3);
-  gMC->Gspos("CSW2", 1, "CSF1", 820-60, 150+pbox[1], 0, 0, "MANY");
+  TVirtualMC::GetMC()->Gsvolu("CSW2", "BOX", idtmed[1116], pbox, 3);
+  TVirtualMC::GetMC()->Gspos("CSW2", 1, "CSF1", 820-60, 150+pbox[1], 0, 0, "MANY");
 
   //
   pbox[0] = 120/2;  // Half length in X
   pbox[1] = 600/2;  // Half lenght in Y
   pbox[2] = 5150/2; // Half length in Z
-  gMC->Gsvolu("CSW3", "BOX", idtmed[1116], pbox, 3);
-  gMC->Gspos("CSW3", 1, "CSF1", 820-60, -300-pbox[1], 0, 0, "MANY");
+  TVirtualMC::GetMC()->Gsvolu("CSW3", "BOX", idtmed[1116], pbox, 3);
+  TVirtualMC::GetMC()->Gspos("CSW3", 1, "CSF1", 820-60, -300-pbox[1], 0, 0, "MANY");
 
   // Material below the counting rooms.
   pbox[0] = 400/2;
   pbox[1] = 2300/2;
   pbox[2] = 300/2;
-  gMC->Gsvolu("CSW4", "BOX", idtmed[1116], pbox, 3);
-  gMC->Gspos("CSW4",1,"CSF1",2300/2-pbox[0],0,3000-5150/2-pbox[2], 0, "MANY");
+  TVirtualMC::GetMC()->Gsvolu("CSW4", "BOX", idtmed[1116], pbox, 3);
+  TVirtualMC::GetMC()->Gspos("CSW4",1,"CSF1",2300/2-pbox[0],0,3000-5150/2-pbox[2], 0, "MANY");
 
   // Shielding plug.
   pbox[0] = 1400/2;
   pbox[1] = 2300/2;
   pbox[2] = 170/2;
-  gMC->Gsvolu("CSW5", "BOX", idtmed[1116], pbox, 3);
-  gMC->Gspos("CSW5", 1, "CSF1", 0, 0, 3000-5150/2-130, 0, "MANY");
+  TVirtualMC::GetMC()->Gsvolu("CSW5", "BOX", idtmed[1116], pbox, 3);
+  TVirtualMC::GetMC()->Gspos("CSW5", 1, "CSF1", 0, 0, 3000-5150/2-130, 0, "MANY");
 
   // The end of the support for the shielding plug.
   pbox[0] = 170/2;
   pbox[1] = 2300/2;
   pbox[2] = 300/2;
-  gMC->Gsvolu("CSW6", "BOX", idtmed[1116], pbox, 3);
-  gMC->Gspos("CSW6",1,"CSF1",-1400/2-pbox[0],0,3000-5150/2-pbox[2],0,"MANY");
+  TVirtualMC::GetMC()->Gsvolu("CSW6", "BOX", idtmed[1116], pbox, 3);
+  TVirtualMC::GetMC()->Gspos("CSW6",1,"CSF1",-1400/2-pbox[0],0,3000-5150/2-pbox[2],0,"MANY");
 
   // ...
   pbox[0] = 100/2;
   pbox[1] = 2300/2;
   pbox[2] = 450/2;
-  gMC->Gsvolu("CSW7", "BOX", idtmed[1116], pbox, 3);
-  gMC->Gspos("CSW7",1,"CSF1",-1400/2-170-pbox[0],0,3000-5150/2+pbox[2],0,"MANY");
+  TVirtualMC::GetMC()->Gsvolu("CSW7", "BOX", idtmed[1116], pbox, 3);
+  TVirtualMC::GetMC()->Gspos("CSW7",1,"CSF1",-1400/2-170-pbox[0],0,3000-5150/2+pbox[2],0,"MANY");
 
   // Material close to the pipe.
   pbox[0] = 300/2;
   pbox[1] = 2300/2;
   pbox[2] = 170/2;
-  gMC->Gsvolu("CSW8", "BOX", idtmed[1116], pbox, 3);
-  gMC->Gspos("CSW8",1,"CSF1",-2300/2+pbox[0],0,2500-5150/2,0,"MANY");
+  TVirtualMC::GetMC()->Gsvolu("CSW8", "BOX", idtmed[1116], pbox, 3);
+  TVirtualMC::GetMC()->Gspos("CSW8",1,"CSF1",-2300/2+pbox[0],0,2500-5150/2,0,"MANY");
 
   // Now put the shaft into the mother volume.
-  gMC->Gspos("CSF1", 1, "ACORDE", 0, AliACORDEConstants::Instance()->Depth() - 5150/2, 2300, idrotm[2001], "MANY");
+  TVirtualMC::GetMC()->Gspos("CSF1", 1, "ACORDE", 0, AliACORDEConstants::Instance()->Depth() - 5150/2, 2300, idrotm[2001], "MANY");
 
   // PM25 Access Shaft
   ptube[0] = 910/2;
   ptube[1] = ptube[0] + 100;
   ptube[2] = (5150 - 1166)/2;
-  gMC->Gsvolu("CSF4", "TUBE", idtmed[1116], ptube, 3);
-  gMC->Gspos("CSF4", 1, "ACORDE", 2100, AliACORDEConstants::Instance()->Depth()-ptube[2], 0, idrotm[2001], "MANY");
+  TVirtualMC::GetMC()->Gsvolu("CSF4", "TUBE", idtmed[1116], ptube, 3);
+  TVirtualMC::GetMC()->Gspos("CSF4", 1, "ACORDE", 2100, AliACORDEConstants::Instance()->Depth()-ptube[2], 0, idrotm[2001], "MANY");
 
   // PGC2 Access Shaft
   ptube[0] = 1100/2;
   ptube[1] = ptube[0] + 100;
   ptube[2] = (5150 - 690)/2;
-  gMC->Gsvolu("CSF5", "TUBE", idtmed[1116], ptube, 3);
-  gMC->Gspos("CSF5", 1, "ACORDE", -375, AliACORDEConstants::Instance()->Depth()-ptube[2], -1900 - 2987.7, idrotm[2001], "MANY");
+  TVirtualMC::GetMC()->Gsvolu("CSF5", "TUBE", idtmed[1116], ptube, 3);
+  TVirtualMC::GetMC()->Gspos("CSF5", 1, "ACORDE", -375, AliACORDEConstants::Instance()->Depth()-ptube[2], -1900 - 2987.7, idrotm[2001], "MANY");
 
 }
 
@@ -255,7 +255,7 @@ void AliACORDEv0::CreateMolasse()
   pbox[0] = AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad);
   pbox[1] = AliACORDEConstants::Instance()->Depth()/2;
   pbox[2] = pbox[0];
-  gMC->Gsvolu("CMO1", "BOX", idtmed[1114], pbox, 3);
+  TVirtualMC::GetMC()->Gsvolu("CMO1", "BOX", idtmed[1114], pbox, 3);
 
   // Now put the molasse exactly above the hall. OK
   // Above the ceiling
@@ -265,8 +265,8 @@ void AliACORDEv0::CreateMolasse()
   ptubs[2] = 1900/2 + px24radius;
   ptubs[3] = 0;
   ptubs[4] = 180;
-  gMC->Gsvolu("CMO2", "TUBS", idtmed[1123], ptubs, 5);
-  gMC->Gspos("CMO2", 1, "CMO1", 0, 500-AliACORDEConstants::Instance()->Depth()/2, ptubs[2]-1900, 0, "MANY");
+  TVirtualMC::GetMC()->Gsvolu("CMO2", "TUBS", idtmed[1123], ptubs, 5);
+  TVirtualMC::GetMC()->Gspos("CMO2", 1, "CMO1", 0, 500-AliACORDEConstants::Instance()->Depth()/2, ptubs[2]-1900, 0, "MANY");
 
   // Molasse around the RB24/26 Wall. OK
   ptubs[0] = 220 + 1600;
@@ -274,34 +274,34 @@ void AliACORDEv0::CreateMolasse()
   ptubs[2] = 2987.7/2 - 1100/4 - concreteWidth/2;
   ptubs[3] = 0;
   ptubs[4] = 180;
-  gMC->Gsvolu("CMO3", "TUBS", idtmed[1123], ptubs, 5);
-  gMC->Gspos("CMO3", 1, "CMO1", 70, 40-AliACORDEConstants::Instance()->Depth()/2, -1900 - ptubs[2], 0, "MANY");
+  TVirtualMC::GetMC()->Gsvolu("CMO3", "TUBS", idtmed[1123], ptubs, 5);
+  TVirtualMC::GetMC()->Gspos("CMO3", 1, "CMO1", 70, 40-AliACORDEConstants::Instance()->Depth()/2, -1900 - ptubs[2], 0, "MANY");
 
   // A big block above the RB24/26 wall. OK
   pbox[0] = AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad);
   pbox[1] = (AliACORDEConstants::Instance()->Depth() - 220 - 1600)/2;
   pbox[2] = 2987.7/2 - 1100/4 - concreteWidth/2;
-  gMC->Gsvolu("CMO4", "BOX", idtmed[1123], pbox, 3);
-  gMC->Gspos("CMO4", 1, "CMO1", 0, AliACORDEConstants::Instance()->Depth()/2 - pbox[1], -1900 - pbox[2], 0, "MANY");
+  TVirtualMC::GetMC()->Gsvolu("CMO4", "BOX", idtmed[1123], pbox, 3);
+  TVirtualMC::GetMC()->Gspos("CMO4", 1, "CMO1", 0, AliACORDEConstants::Instance()->Depth()/2 - pbox[1], -1900 - pbox[2], 0, "MANY");
   // Small blocks below the volume CMO4 on both sides of the wall RB24/26. OK
   pbox[0] = (AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad) -
 ptubs[0])/2;
   pbox[1] = AliACORDEConstants::Instance()->Depth()/2 - pbox[1];
-  gMC->Gsvolu("CM17", "BOX", idtmed[1123], pbox, 3);
-  gMC->Gspos("CM17", 1, "CMO1", AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad) - pbox[0], -AliACORDEConstants::Instance()->Depth()/2 + pbox[1], -1900 - pbox[2], 0, "MANY");
-  gMC->Gspos("CM17", 2, "CMO1", -AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad)+ pbox[0], -AliACORDEConstants::Instance()->Depth()/2 + pbox[1], -1900 - pbox[2], 0, "MANY");
+  TVirtualMC::GetMC()->Gsvolu("CM17", "BOX", idtmed[1123], pbox, 3);
+  TVirtualMC::GetMC()->Gspos("CM17", 1, "CMO1", AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad) - pbox[0], -AliACORDEConstants::Instance()->Depth()/2 + pbox[1], -1900 - pbox[2], 0, "MANY");
+  TVirtualMC::GetMC()->Gspos("CM17", 2, "CMO1", -AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad)+ pbox[0], -AliACORDEConstants::Instance()->Depth()/2 + pbox[1], -1900 - pbox[2], 0, "MANY");
 
   // And a big block of molasse above the hall up to the surface. OK
   pbox[0] = pm25X - pm25radius;
   pbox[1] = (AliACORDEConstants::Instance()->Depth()-500-1170)/2;
   pbox[2] = (1900 + 1150)/2;
-  gMC->Gsvolu("CMO5", "BOX", idtmed[1123], pbox, 3);
-  gMC->Gspos("CMO5", 1, "CMO1", 0,AliACORDEConstants::Instance()->Depth()/2-pbox[1], pbox[2]-1900, 0, "MANY");
+  TVirtualMC::GetMC()->Gsvolu("CMO5", "BOX", idtmed[1123], pbox, 3);
+  TVirtualMC::GetMC()->Gspos("CMO5", 1, "CMO1", 0,AliACORDEConstants::Instance()->Depth()/2-pbox[1], pbox[2]-1900, 0, "MANY");
   // Small blocks of molasse betwen the blocks CMO2, CMO5 and PM25. Ok
   pbox[0] = (pm25X - pm25radius - 1170)/2;
   pbox[1] = 1000;
-  gMC->Gsvolu("CM16", "BOX", idtmed[1123], pbox, 3);
-  gMC->Gspos("CM16", 1, "CMO1", 1170 + pbox[0], -AliACORDEConstants::Instance()->Depth()/2+pbox[1], pbox[2] - 1900, 0, "MANY");
+  TVirtualMC::GetMC()->Gsvolu("CM16", "BOX", idtmed[1123], pbox, 3);
+  TVirtualMC::GetMC()->Gspos("CM16", 1, "CMO1", 1170 + pbox[0], -AliACORDEConstants::Instance()->Depth()/2+pbox[1], pbox[2] - 1900, 0, "MANY");
 
   // Molasse around the shafts.
   AliMatrix(idrotm[2003], 0, 0, 90, 0, 90, 90);
@@ -311,80 +311,80 @@ ptubs[0])/2;
   ptubs[2] = (2300 - (5150 - AliACORDEConstants::Instance()->Depth()))/2;
   ptubs[3] = 180 + kRaddeg*TMath::ASin(1070/ptubs[0]);
   ptubs[4] = 180 -  kRaddeg*TMath::ASin(1070/ptubs[0]);
-  gMC->Gsvolu("CMO6", "TUBS", idtmed[1123], ptubs, 5);
-  gMC->Gspos("CMO6", 1, "CMO1", px24X, ptubs[2] - AliACORDEConstants::Instance()->Depth()/2, px24Z, idrotm[2003], "MANY");
+  TVirtualMC::GetMC()->Gsvolu("CMO6", "TUBS", idtmed[1123], ptubs, 5);
+  TVirtualMC::GetMC()->Gspos("CMO6", 1, "CMO1", px24X, ptubs[2] - AliACORDEConstants::Instance()->Depth()/2, px24Z, idrotm[2003], "MANY");
   // Around the PX24, the closed section. OK
   Float_t ptube[3];
   ptube[0] = px24radius + concreteWidth;
   ptube[1] = ptube[0] + 1000;
   ptube[2] = (5150 - 2300)/2;
-  gMC->Gsvolu("CMO7", "TUBE", idtmed[1123], ptube, 3);
-  gMC->Gspos("CMO7", 1, "CMO1", px24X, AliACORDEConstants::Instance()->Depth()/2 - ptube[2], px24Z, idrotm[2003], "MANY");
+  TVirtualMC::GetMC()->Gsvolu("CMO7", "TUBE", idtmed[1123], ptube, 3);
+  TVirtualMC::GetMC()->Gspos("CMO7", 1, "CMO1", px24X, AliACORDEConstants::Instance()->Depth()/2 - ptube[2], px24Z, idrotm[2003], "MANY");
 
   // Around PM25. OK
   ptube[0] = pm25radius + concreteWidth;
   ptube[1] = ptube[0] + 400;
   ptube[2] = AliACORDEConstants::Instance()->Depth()/2;
-  gMC->Gsvolu("CMO8", "TUBE", idtmed[1123], ptube, 3);
-  gMC->Gspos("CMO8", 1, "CMO1", pm25X, 0, pm25Z, idrotm[2003], "MANY");
+  TVirtualMC::GetMC()->Gsvolu("CMO8", "TUBE", idtmed[1123], ptube, 3);
+  TVirtualMC::GetMC()->Gspos("CMO8", 1, "CMO1", pm25X, 0, pm25Z, idrotm[2003], "MANY");
   // On both sides of the PM25 along the HALL.
   pbox[0] = (2100 + pm25radius - 1170)/2;
   pbox[1] = AliACORDEConstants::Instance()->Depth()/2;
   pbox[2] = (3*px24radius - pm25radius)/2;
-  gMC->Gsvolu("CM18", "BOX", idtmed[1123], pbox, 3);
-  gMC->Gspos("CM18", 1, "CMO1", 2100, 0, pbox[2] + pm25radius, 0, "MANY");
+  TVirtualMC::GetMC()->Gsvolu("CM18", "BOX", idtmed[1123], pbox, 3);
+  TVirtualMC::GetMC()->Gspos("CM18", 1, "CMO1", 2100, 0, pbox[2] + pm25radius, 0, "MANY");
 
   pbox[2] = (1900 - pm25radius)/2;
-  gMC->Gsvolu("CM19", "BOX", idtmed[1123], pbox, 3);
-  gMC->Gspos("CM19", 1, "CMO1", 2100, 0, -pbox[2] - pm25radius, 0, "MANY");
+  TVirtualMC::GetMC()->Gsvolu("CM19", "BOX", idtmed[1123], pbox, 3);
+  TVirtualMC::GetMC()->Gspos("CM19", 1, "CMO1", 2100, 0, -pbox[2] - pm25radius, 0, "MANY");
 
   // Around the PGC2. OK
   ptube[0] = pgc2radius + concreteWidth;
   ptube[1] = 2987.7 - 740;
   ptube[2] = AliACORDEConstants::Instance()->Depth()/2;
-  gMC->Gsvolu("CMO9", "TUBE", idtmed[1123], ptube, 3);
-  gMC->Gspos("CMO9", 1, "CMO1", pgc2X, 0, pgc2Z, idrotm[2003], "MANY");
+  TVirtualMC::GetMC()->Gsvolu("CMO9", "TUBE", idtmed[1123], ptube, 3);
+  TVirtualMC::GetMC()->Gspos("CMO9", 1, "CMO1", pgc2X, 0, pgc2Z, idrotm[2003], "MANY");
 
   // On both sides of the PGC2.OK
   pbox[0] = (AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad) -
 1100 - 375)/2;
   pbox[1] = AliACORDEConstants::Instance()->Depth()/2;
   pbox[2] = pgc2radius + concreteWidth;
-  gMC->Gsvolu("CM10", "BOX", idtmed[1123], pbox, 3);
-  gMC->Gspos("CM10", 1, "CMO1", AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad) - pbox[0], 0, pgc2Z, 0, "MANY");
-  gMC->Gspos("CM10", 2, "CMO1", -AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad) + pbox[0], 0, pgc2Z, 0, "MANY");
+  TVirtualMC::GetMC()->Gsvolu("CM10", "BOX", idtmed[1123], pbox, 3);
+  TVirtualMC::GetMC()->Gspos("CM10", 1, "CMO1", AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad) - pbox[0], 0, pgc2Z, 0, "MANY");
+  TVirtualMC::GetMC()->Gspos("CM10", 2, "CMO1", -AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad) + pbox[0], 0, pgc2Z, 0, "MANY");
 
   // big block of molasse behind the PX24. OK
   pbox[0] = AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad);
   pbox[1] = AliACORDEConstants::Instance()->Depth()/2;
   pbox[2] = (pbox[0] - (2300 + 1150 + 100))/2;
-  gMC->Gsvolu("CM12", "BOX", idtmed[1123], pbox, 3);
-  gMC->Gspos("CM12", 1, "CMO1", px24X, 0, px24Z + px24radius + concreteWidth + pbox[2], 0, "MANY");
+  TVirtualMC::GetMC()->Gsvolu("CM12", "BOX", idtmed[1123], pbox, 3);
+  TVirtualMC::GetMC()->Gspos("CM12", 1, "CMO1", px24X, 0, px24Z + px24radius + concreteWidth + pbox[2], 0, "MANY");
 
   // big block of molasse in the opposite side of the PM25. OK
   pbox[0] = (AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad) -
 1150)/2;
   pbox[1] = AliACORDEConstants::Instance()->Depth()/2;
   pbox[2] = (1900 + 2300 + 1150)/2;
-  gMC->Gsvolu("CM13", "BOX", idtmed[1123], pbox, 3);
-  gMC->Gspos("CM13", 1, "CMO1", -1150 - pbox[0], 0, pbox[2] - 1900, 0, "MANY");
+  TVirtualMC::GetMC()->Gsvolu("CM13", "BOX", idtmed[1123], pbox, 3);
+  TVirtualMC::GetMC()->Gspos("CM13", 1, "CMO1", -1150 - pbox[0], 0, pbox[2] - 1900, 0, "MANY");
 
   // big block of molasse behind the PM25. OK
   pbox[0] = (AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad) -
 (2100 + 910/2 + 100))/2;
   pbox[1] = AliACORDEConstants::Instance()->Depth()/2;
   pbox[2] = (1900 + 2300 + 1150)/2;
-  gMC->Gsvolu("CM14", "BOX", idtmed[1123], pbox, 3);
-  gMC->Gspos("CM14", 1, "CMO1", pm25X + pm25radius + concreteWidth + pbox[0], 0, pbox[2] - 1900, 0, "MANY");
+  TVirtualMC::GetMC()->Gsvolu("CM14", "BOX", idtmed[1123], pbox, 3);
+  TVirtualMC::GetMC()->Gspos("CM14", 1, "CMO1", pm25X + pm25radius + concreteWidth + pbox[0], 0, pbox[2] - 1900, 0, "MANY");
 
   // big block of molasse behind the PGC2. OK
   pbox[0] = AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad);
   pbox[1] = AliACORDEConstants::Instance()->Depth()/2;
   pbox[2] = (pbox[0] - (2987.7 + 1900 + 1100/2 + 100))/2;
-  gMC->Gsvolu("CM15", "BOX", idtmed[1123], pbox, 3);
-  gMC->Gspos("CM15", 1, "CMO1", 0, 0, -pbox[0] + pbox[2], 0, "MANY");
+  TVirtualMC::GetMC()->Gsvolu("CM15", "BOX", idtmed[1123], pbox, 3);
+  TVirtualMC::GetMC()->Gspos("CM15", 1, "CMO1", 0, 0, -pbox[0] + pbox[2], 0, "MANY");
 
-  gMC->Gspos("CMO1",1,"ACORDE",0,AliACORDEConstants::Instance()->Depth()/2,0,0,"MANY");
+  TVirtualMC::GetMC()->Gspos("CMO1",1,"ACORDE",0,AliACORDEConstants::Instance()->Depth()/2,0,0,"MANY");
 
 }
 
@@ -427,21 +427,21 @@ void AliACORDEv0::CreateAcorde()
   box[0] = constants->ModuleLength()/2;
   box[1] = constants->ModuleHeight()/2;
   box[2] = constants->ModuleWidth()/2;
-  gMC->Gsvolu("ACORDE1", "BOX", idtmed[1114], box, 3);
+  TVirtualMC::GetMC()->Gsvolu("ACORDE1", "BOX", idtmed[1114], box, 3);
 
   // The scintillators
   box[0] = constants->PlasticLength()/2;
   box[1] = constants->PlasticHeight()/2;
   box[2] = constants->PlasticWidth()/2;
-  gMC->Gsvolu("ACORDE2", "BOX", idtmed[1112], box, 3);
+  TVirtualMC::GetMC()->Gsvolu("ACORDE2", "BOX", idtmed[1112], box, 3);
 
   // it is important to keep this order for easy assignment of 
   // a volume to a physical module:
   placed_at = box[1]+constants->ProfileThickness()
     - constants->ModuleHeight()/2+small;
-  gMC->Gspos("ACORDE2", 1, "ACORDE1", 0, placed_at, 0, 0, "MANY");
+  TVirtualMC::GetMC()->Gspos("ACORDE2", 1, "ACORDE1", 0, placed_at, 0, 0, "MANY");
   placed_at = placed_at + 2.0*box[1]+small;
-  gMC->Gspos("ACORDE2", 2, "ACORDE1", 0, placed_at, 0, 0, "MANY");
+  TVirtualMC::GetMC()->Gspos("ACORDE2", 2, "ACORDE1", 0, placed_at, 0, 0, "MANY");
 
 
   // The metallic frame: long walls of box
@@ -453,57 +453,57 @@ void AliACORDEv0::CreateAcorde()
   box[0] = constants->ModuleLength()/2;
   box[1] = constants->ModuleHeight()/2;
   box[2] = constants->ProfileThickness()/2.0; 
-  gMC->Gsvolu("ACORDE3", "BOX", idtmed[1108], box, 3);
+  TVirtualMC::GetMC()->Gsvolu("ACORDE3", "BOX", idtmed[1108], box, 3);
   // front wall
   placed_at = constants->ModuleWidth()/2-constants->ProfileThickness()/2.0;
-  gMC->Gspos("ACORDE3", 1, "ACORDE1", 0, 0, placed_at, 0, "MANY");
+  TVirtualMC::GetMC()->Gspos("ACORDE3", 1, "ACORDE1", 0, 0, placed_at, 0, "MANY");
   // back wall
-  gMC->Gspos("ACORDE3", 2, "ACORDE1", 0, 0, -placed_at , 0, "MANY");
+  TVirtualMC::GetMC()->Gspos("ACORDE3", 2, "ACORDE1", 0, 0, -placed_at , 0, "MANY");
 
   // The metallic frame: end caps
   box[0] = constants->ProfileThickness()/2.0;
   box[1] = constants->ModuleHeight()/2;
   box[2] = constants->ModuleWidth()/2;
-  gMC->Gsvolu("ACORDE4", "BOX", idtmed[1108], box, 3);
+  TVirtualMC::GetMC()->Gsvolu("ACORDE4", "BOX", idtmed[1108], box, 3);
   // right cap
   placed_at = constants->ModuleLength()/2-constants->ProfileThickness()/2.0;
-  gMC->Gspos("ACORDE4", 1, "ACORDE1", placed_at, 0, 0, 0, "MANY");
+  TVirtualMC::GetMC()->Gspos("ACORDE4", 1, "ACORDE1", placed_at, 0, 0, 0, "MANY");
   // left cap
-  gMC->Gspos("ACORDE4", 2, "ACORDE1", -placed_at, 0, 0, 0, "MANY");
+  TVirtualMC::GetMC()->Gspos("ACORDE4", 2, "ACORDE1", -placed_at, 0, 0, 0, "MANY");
 
   // The metallic frame: the profile, long stripes
   box[0] = constants->ModuleLength()/2.0;
   box[1] = constants->ProfileThickness()/2;
   box[2] = constants->ProfileWidth()/2;
-  gMC->Gsvolu("ACORDE5", "BOX", idtmed[1108], box, 3);
+  TVirtualMC::GetMC()->Gsvolu("ACORDE5", "BOX", idtmed[1108], box, 3);
   // upper front
   placed_at = constants->ModuleHeight()/2-box[1];
   placed_at2 = constants->ModuleWidth()/2-
     constants->ProfileThickness()-box[2];
-  gMC->Gspos("ACORDE5", 1, "ACORDE1",0,placed_at,placed_at2, 0, "MANY");
+  TVirtualMC::GetMC()->Gspos("ACORDE5", 1, "ACORDE1",0,placed_at,placed_at2, 0, "MANY");
   // upper back
-  gMC->Gspos("ACORDE5", 2, "ACORDE1",0,placed_at,-placed_at2, 0, "MANY");
+  TVirtualMC::GetMC()->Gspos("ACORDE5", 2, "ACORDE1",0,placed_at,-placed_at2, 0, "MANY");
   // lower front
-  gMC->Gspos("ACORDE5", 3, "ACORDE1",0,-placed_at,placed_at2, 0, "MANY");
+  TVirtualMC::GetMC()->Gspos("ACORDE5", 3, "ACORDE1",0,-placed_at,placed_at2, 0, "MANY");
   // lower back
-  gMC->Gspos("ACORDE5", 4, "ACORDE1",0,-placed_at,-placed_at2, 0, "MANY");
+  TVirtualMC::GetMC()->Gspos("ACORDE5", 4, "ACORDE1",0,-placed_at,-placed_at2, 0, "MANY");
 
   // The metallic frame: the profile, long stripes
   box[0] = constants->ProfileWidth()/2.0;
   box[1] = constants->ProfileThickness()/2;
   box[2] = constants->ModuleWidth()/2-constants->ProfileWidth();
-  gMC->Gsvolu("ACORDE6", "BOX", idtmed[1108], box, 3);
+  TVirtualMC::GetMC()->Gsvolu("ACORDE6", "BOX", idtmed[1108], box, 3);
   // upper right
   placed_at = constants->ModuleHeight()/2-box[1];
   placed_at2 = constants->ModuleLength()/2-
     constants->ProfileThickness()-box[0];
-  gMC->Gspos("ACORDE6", 1, "ACORDE1",placed_at2,placed_at,0, 0, "MANY");
+  TVirtualMC::GetMC()->Gspos("ACORDE6", 1, "ACORDE1",placed_at2,placed_at,0, 0, "MANY");
   // upper left
-  gMC->Gspos("ACORDE6", 2, "ACORDE1",-placed_at2,placed_at,0, 0, "MANY");
+  TVirtualMC::GetMC()->Gspos("ACORDE6", 2, "ACORDE1",-placed_at2,placed_at,0, 0, "MANY");
   // lower right
-  gMC->Gspos("ACORDE6", 3, "ACORDE1",placed_at2,-placed_at,0, 0, "MANY");
+  TVirtualMC::GetMC()->Gspos("ACORDE6", 3, "ACORDE1",placed_at2,-placed_at,0, 0, "MANY");
   // lower left
-  gMC->Gspos("ACORDE6", 4, "ACORDE1",-placed_at2,-placed_at,0, 0, "MANY");
+  TVirtualMC::GetMC()->Gspos("ACORDE6", 4, "ACORDE1",-placed_at2,-placed_at,0, 0, "MANY");
 
   // End of MODULE definition
 
@@ -530,78 +530,78 @@ void AliACORDEv0::CreateAcorde()
 
   // first column, except first and last  modules
   for (Int_t copy = 2; copy < 10; copy++)
-    gMC->Gspos("ACORDE1",copy,"ALIC",
+    TVirtualMC::GetMC()->Gspos("ACORDE1",copy,"ALIC",
               constants->OldModulePositionX(copy-1),
               constants->OldModulePositionY(copy-1),
               constants->OldModulePositionZ(copy-1),
               idrotm[232], "MANY");
   // second column
   for (Int_t copy = 11; copy < 21; copy++)
-    gMC->Gspos("ACORDE1",copy,"ALIC",
+    TVirtualMC::GetMC()->Gspos("ACORDE1",copy,"ALIC",
               constants->OldModulePositionX(copy-1),
               constants->OldModulePositionY(copy-1),
               constants->OldModulePositionZ(copy-1),
               idrotm[232], "MANY");
   // third and fourth columns
   for (Int_t copy = 21; copy < 41; copy++)
-    gMC->Gspos("ACORDE1",copy,"ALIC",
+    TVirtualMC::GetMC()->Gspos("ACORDE1",copy,"ALIC",
               constants->OldModulePositionX(copy-1),
               constants->OldModulePositionY(copy-1),
               constants->OldModulePositionZ(copy-1),
               0, "MANY");
   // fifth column
   for (Int_t copy = 41; copy < 51; copy++)
-    gMC->Gspos("ACORDE1",copy,"ALIC",
+    TVirtualMC::GetMC()->Gspos("ACORDE1",copy,"ALIC",
               constants->OldModulePositionX(copy-1),
               constants->OldModulePositionY(copy-1),
               constants->OldModulePositionZ(copy-1),
               idrotm[231], "MANY");
   // last column, except first and last  modules
   for (Int_t copy = 52; copy < 60; copy++)
-    gMC->Gspos("ACORDE1",copy,"ALIC",
+    TVirtualMC::GetMC()->Gspos("ACORDE1",copy,"ALIC",
               constants->OldModulePositionX(copy-1),
               constants->OldModulePositionY(copy-1),
               constants->OldModulePositionZ(copy-1),
               idrotm[231], "MANY");
   // the last four modules
   if (Get4CentralModulesGeometry()) {
-    gMC->Gspos("ACORDE1",1,"ALIC",
+    TVirtualMC::GetMC()->Gspos("ACORDE1",1,"ALIC",
               constants->OldExtraModulePositionX(),
               constants->OldExtraModulePositionY(),
               constants->OldExtraModulePositionZ(0),
               0, "MANY");  
-    gMC->Gspos("ACORDE1",10,"ALIC",
+    TVirtualMC::GetMC()->Gspos("ACORDE1",10,"ALIC",
               constants->OldExtraModulePositionX(),
               constants->OldExtraModulePositionY(),
               constants->OldExtraModulePositionZ(1),
               0, "MANY");  
-    gMC->Gspos("ACORDE1",51,"ALIC",
+    TVirtualMC::GetMC()->Gspos("ACORDE1",51,"ALIC",
               constants->OldExtraModulePositionX(),
               constants->OldExtraModulePositionY(),
               constants->OldExtraModulePositionZ(2),
               0, "MANY");  
-    gMC->Gspos("ACORDE1",60,"ALIC",
+    TVirtualMC::GetMC()->Gspos("ACORDE1",60,"ALIC",
               constants->OldExtraModulePositionX(),
               constants->OldExtraModulePositionY(),
               constants->OldExtraModulePositionZ(3),
               0, "MANY");  
   } else {
-    gMC->Gspos("ACORDE1",1,"ALIC",
+    TVirtualMC::GetMC()->Gspos("ACORDE1",1,"ALIC",
               constants->OldModulePositionX(0),
               constants->OldModulePositionY(0),
               constants->OldModulePositionZ(0),
               idrotm[232], "MANY");
-    gMC->Gspos("ACORDE1",10,"ALIC",
+    TVirtualMC::GetMC()->Gspos("ACORDE1",10,"ALIC",
               constants->OldModulePositionX(9),
               constants->OldModulePositionY(9),
               constants->OldModulePositionZ(9),
               idrotm[232], "MANY");
-    gMC->Gspos("ACORDE1",51,"ALIC",
+    TVirtualMC::GetMC()->Gspos("ACORDE1",51,"ALIC",
               constants->OldModulePositionX(50),
               constants->OldModulePositionY(50),
               constants->OldModulePositionZ(50),
               idrotm[231], "MANY");
-    gMC->Gspos("ACORDE1",60,"ALIC",
+    TVirtualMC::GetMC()->Gspos("ACORDE1",60,"ALIC",
               constants->OldModulePositionX(59),
               constants->OldModulePositionY(59),
               constants->OldModulePositionZ(59),
@@ -655,7 +655,7 @@ void AliACORDEv0::StepManager()
   static Float_t eloss;
   static Float_t step;
   // scintillator volume
-  static Int_t idScint = gMC->VolId("ACORDE2");
+  static Int_t idScint = TVirtualMC::GetMC()->VolId("ACORDE2");
 
   // local variables
   Int_t copy;
@@ -663,19 +663,19 @@ void AliACORDEv0::StepManager()
   TLorentzVector mom;
 
   // only charged tracks
-  if ( !gMC->TrackCharge() || !gMC->IsTrackAlive() ) return;
+  if ( !TVirtualMC::GetMC()->TrackCharge() || !TVirtualMC::GetMC()->IsTrackAlive() ) return;
 
   // only in sensitive material
-  if (gMC->CurrentVolID(copy) == idScint) {
-    step  += gMC->TrackStep();
-    eloss += gMC->Edep();
+  if (TVirtualMC::GetMC()->CurrentVolID(copy) == idScint) {
+    step  += TVirtualMC::GetMC()->TrackStep();
+    eloss += TVirtualMC::GetMC()->Edep();
     // set all hit variables except eloss which is resetted
     // set volume variables
-    if (gMC->IsTrackEntering()) {
+    if (TVirtualMC::GetMC()->IsTrackEntering()) {
       eloss = 0.0;
       step = 0.0;
-      gMC->TrackPosition(pos);
-      gMC->TrackMomentum(mom);
+      TVirtualMC::GetMC()->TrackPosition(pos);
+      TVirtualMC::GetMC()->TrackMomentum(mom);
       // hit
       // [0] = PID
       // [1-3] = x, y, z 
@@ -683,32 +683,32 @@ void AliACORDEv0::StepManager()
       // [5-7] = px, py, pz
       // [8] = energy 
       // [9] = energy loss
-      hits[0]  = (Float_t ) gMC->TrackPid(); 
+      hits[0]  = (Float_t ) TVirtualMC::GetMC()->TrackPid(); 
       hits[1] = pos[0]; 
       hits[2] = pos[1]; 
       hits[3] = pos[2]; 
-      hits[4] = gMC->TrackTime();
+      hits[4] = TVirtualMC::GetMC()->TrackTime();
       hits[5] = mom[0]; 
       hits[6] = mom[1]; 
       hits[7] = mom[2]; 
-      hits[8] = gMC->Etot();
+      hits[8] = TVirtualMC::GetMC()->Etot();
       // volume: 
       //  [0] = module number 1-60 (1==>(0-0), 60 (5-9)
       //  [1] = Plastic number: 0 (down) to 1 (up)
       Int_t copyPlastic; // plastic: down=1, up=2
       Int_t copyModule; // module: 1-60
-      gMC->CurrentVolID(copyPlastic);
-      gMC->CurrentVolOffID(1, copyModule);
+      TVirtualMC::GetMC()->CurrentVolID(copyPlastic);
+      TVirtualMC::GetMC()->CurrentVolOffID(1, copyModule);
       // module
       vol[0] = copyModule;
       // plastic: 0 = down, 1 = up
       vol[1] = copyPlastic;
-    } // end if gMC->IsTrackEntering()
+    } // end if TVirtualMC::GetMC()->IsTrackEntering()
 
     // set hit[9] = total energy loss and book hit
-    if( gMC->IsTrackExiting() || 
-       gMC->IsTrackStop() || 
-       gMC->IsTrackDisappeared()){
+    if( TVirtualMC::GetMC()->IsTrackExiting() || 
+       TVirtualMC::GetMC()->IsTrackStop() || 
+       TVirtualMC::GetMC()->IsTrackDisappeared()){
       hits[9] = eloss;
       hits[10] = step;
       eloss = 0.0;
index 38a4d0b..f9762cf 100644 (file)
@@ -727,27 +727,27 @@ void AliACORDEv1::StepManager()
   static Float_t eloss;
   static Float_t step;
   // scintillator volume
- static Int_t idScint = gMC->VolId("ACORDESCINTILLATORMODULE");
+ static Int_t idScint = TVirtualMC::GetMC()->VolId("ACORDESCINTILLATORMODULE");
   // local variables
   Int_t copy;
   TLorentzVector pos;
   TLorentzVector mom;
 
   // only charged tracks
-  if ( !gMC->TrackCharge() || !gMC->IsTrackAlive() ) return;
+  if ( !TVirtualMC::GetMC()->TrackCharge() || !TVirtualMC::GetMC()->IsTrackAlive() ) return;
 
   // only in sensitive material
-  if (gMC->CurrentVolID(copy) == idScint) {
+  if (TVirtualMC::GetMC()->CurrentVolID(copy) == idScint) {
 
-    step  += gMC->TrackStep();
-    eloss += gMC->Edep();
+    step  += TVirtualMC::GetMC()->TrackStep();
+    eloss += TVirtualMC::GetMC()->Edep();
     // set all hit variables except eloss which is resetted
     // set volume variables
-    if (gMC->IsTrackEntering()) {
+    if (TVirtualMC::GetMC()->IsTrackEntering()) {
       eloss = 0.0;
       step = 0.0;
-      gMC->TrackPosition(pos);
-      gMC->TrackMomentum(mom);
+      TVirtualMC::GetMC()->TrackPosition(pos);
+      TVirtualMC::GetMC()->TrackMomentum(mom);
       // hit
       // [0] = PID
       // [1-3] = x, y, z 
@@ -755,35 +755,35 @@ void AliACORDEv1::StepManager()
       // [5-7] = px, py, pz
       // [8] = energy 
       // [9] = energy loss
-      hits[0]  = (Float_t ) gMC->TrackPid(); 
+      hits[0]  = (Float_t ) TVirtualMC::GetMC()->TrackPid(); 
 
 
       hits[1] = pos[0]; 
       hits[2] = pos[1]; 
       hits[3] = pos[2]; 
-      hits[4] = gMC->TrackTime();
+      hits[4] = TVirtualMC::GetMC()->TrackTime();
       hits[5] = mom[0];
       hits[6] = mom[1];
       hits[7] = mom[2];
-      hits[8] = gMC->Etot();
+      hits[8] = TVirtualMC::GetMC()->Etot();
       // volume: 
       //  [0] = module number 1-60 (1==>(0-0), 60 (5-9)
       //  [1] = Plastic number: 0 (down) to 1 (up)
       Int_t copyPlastic; // plastic: down=1, up=2
       Int_t copyModule; // module: 1-60
-      gMC->CurrentVolID(copyPlastic);
-      gMC->CurrentVolOffID(1, copyModule);
+      TVirtualMC::GetMC()->CurrentVolID(copyPlastic);
+      TVirtualMC::GetMC()->CurrentVolOffID(1, copyModule);
       // module
       vol[0] = copyModule;
       // plastic: 0 = down, 1 = up
       vol[1] = copyPlastic - 4 ; // !!!!!!!
     // vol[1] = copyPlastic;
-    } // end if gMC->IsTrackEntering()
+    } // end if TVirtualMC::GetMC()->IsTrackEntering()
 
     // set hit[9] = total energy loss and book hit
-    if( gMC->IsTrackExiting() || 
-       gMC->IsTrackStop() || 
-       gMC->IsTrackDisappeared()){
+    if( TVirtualMC::GetMC()->IsTrackExiting() || 
+       TVirtualMC::GetMC()->IsTrackStop() || 
+       TVirtualMC::GetMC()->IsTrackDisappeared()){
       hits[9] = eloss;
       hits[10] = step;
       eloss = 0.0;
index d0f0867..74de1bb 100644 (file)
@@ -426,16 +426,16 @@ void AliADv1::StepManager()
       
       
    // Get sensitive volumes id (scintillator pads)
-   static Int_t idADA = gMC->VolId( "ADApad" );
-   static Int_t idADC = gMC->VolId( "ADCpad" );
+   static Int_t idADA = TVirtualMC::GetMC()->VolId( "ADApad" );
+   static Int_t idADC = TVirtualMC::GetMC()->VolId( "ADCpad" );
    
    // We keep only charged tracks : 
-   // if ( !gMC->TrackCharge() || !gMC->IsTrackAlive() ) return;   
+   // if ( !TVirtualMC::GetMC()->TrackCharge() || !TVirtualMC::GetMC()->IsTrackAlive() ) return;   
    // We keep charged and non-charged tracks : 
-   if ( !gMC->IsTrackAlive() ) return;   
+   if ( !TVirtualMC::GetMC()->IsTrackAlive() ) return;   
    
    Int_t copy;
-   Int_t current_volid = gMC->CurrentVolID( copy );
+   Int_t current_volid = TVirtualMC::GetMC()->CurrentVolID( copy );
 
    // check is the track is in a sensitive volume
    if( current_volid != idADA && current_volid != idADC ) {
@@ -445,7 +445,7 @@ void AliADv1::StepManager()
    // First read the position, otherwise weird reults! //ecv
    Double_t s[3];
    Float_t  x[3];
-   gMC->TrackPosition( s[0], s[1], s[2] );
+   TVirtualMC::GetMC()->TrackPosition( s[0], s[1], s[2] );
    for ( Int_t j=0; j<3; j++ ) x[j] = s[j];
    
    // Set detectro type: ADA or ADC
@@ -453,11 +453,11 @@ void AliADv1::StepManager()
    
    // Get sector copy (1,2,3,4) ( 1 level up from pad )
    Int_t sect;
-   gMC->CurrentVolOffID( 1, sect );
+   TVirtualMC::GetMC()->CurrentVolOffID( 1, sect );
 
    // Get Detector copy (1,2) ( 2 levels up from pad )
    Int_t detc;
-   gMC->CurrentVolOffID( 2, detc );
+   TVirtualMC::GetMC()->CurrentVolOffID( 2, detc );
    
    // Sector number 
    // ADA1 = 10-14
@@ -477,8 +477,8 @@ void AliADv1::StepManager()
       photoCathodeEfficiency = fADAPhotoCathodeEfficiency;
    }
       
-   Float_t destep_ad = gMC->Edep();
-   Float_t step_ad   = gMC->TrackStep();
+   Float_t destep_ad = TVirtualMC::GetMC()->Edep();
+   Float_t step_ad   = TVirtualMC::GetMC()->TrackStep();
    Int_t  nPhotonsInStep_ad = Int_t( destep_ad / (lightYield_ad * 1e-9) ); 
    nPhotonsInStep_ad = gRandom->Poisson( nPhotonsInStep_ad );
    
@@ -491,10 +491,10 @@ void AliADv1::StepManager()
    eloss_ad   += destep_ad;
    tlength_ad += step_ad;  
  
-   if ( gMC->IsTrackEntering() ) { 
+   if ( TVirtualMC::GetMC()->IsTrackEntering() ) { 
       nPhotons_ad = nPhotonsInStep_ad;
       Double_t p[4];
-      gMC->TrackMomentum( p[0], p[1], p[2], p[3] );
+      TVirtualMC::GetMC()->TrackMomentum( p[0], p[1], p[2], p[3] );
       Float_t pt  = TMath::Sqrt( p[0]*p[0] + p[1]*p[1] + p[2]*p[2] ); 
       TParticle *par = gAlice->GetMCApp()->Particle(gAlice->GetMCApp()->GetCurrentTrackNumber());
       Int_t imo = par->GetFirstMother();
@@ -517,7 +517,7 @@ void AliADv1::StepManager()
       hits_ad[5]  = p[0];     // Px
       hits_ad[6]  = p[1];     // Py
       hits_ad[7]  = p[2];     // Pz
-      hits_ad[8]  = 1.0e09*gMC->TrackTime(); // in ns!
+      hits_ad[8]  = 1.0e09*TVirtualMC::GetMC()->TrackTime(); // in ns!
   
       tlength_ad = 0.0;
       eloss_ad   = 0.0; 
@@ -527,7 +527,7 @@ void AliADv1::StepManager()
    
    nPhotons_ad += nPhotonsInStep_ad;
 
-   if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared() ) {
+   if( TVirtualMC::GetMC()->IsTrackExiting() || TVirtualMC::GetMC()->IsTrackStop() || TVirtualMC::GetMC()->IsTrackDisappeared() ) {
 
       // Set integer values
       vol_ad[3]  = nPhotons_ad;
@@ -568,7 +568,7 @@ void AliADv1::StepManager()
    }
        
    //   Do we need track reference ????
-   // if( gMC->IsTrackEntering() || gMC->IsTrackExiting() ) {
+   // if( TVirtualMC::GetMC()->IsTrackEntering() || TVirtualMC::GetMC()->IsTrackExiting() ) {
    //    AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), 49);
    // }
 }
index 9168b10..acb491f 100644 (file)
@@ -556,9 +556,9 @@ Bool_t  AliAODv0KineCuts::CaseLambda(AliAODv0* const v0, Int_t &pdgV0, Int_t &pd
   kfMother[1] = CreateMotherParticle(daughter[0], daughter[1], TMath::Abs(kPiPlus), TMath::Abs(kProton));
   if(!kfMother[1]) return kFALSE;
 
-  Float_t dMass[2] = {TMath::Abs(mMass[0] - cL0mass), TMath::Abs(mMass[1] - cL0mass)};
+  Float_t dMass[2] = {static_cast<Float_t>(TMath::Abs(mMass[0] - cL0mass)), static_cast<Float_t>(TMath::Abs(mMass[1] - cL0mass))};
   
-  Float_t p[2] = {daughter[0]->P(), daughter[1]->P()}; 
+  Float_t p[2] = {static_cast<Float_t>(daughter[0]->P()), static_cast<Float_t>(daughter[1]->P())}; 
 
   // check the 3 lambda - antilambda variables
   Int_t check[2] = {-1, -1};   // 0 : lambda, 1 : antilambda
index 2a34852..4e5735b 100644 (file)
@@ -559,14 +559,14 @@ Bool_t  AliESDv0KineCuts::CaseLambda(AliESDv0* const v0, Int_t &pdgV0, Int_t &pd
   kfMother[1] = CreateMotherParticle(daughter[0], daughter[1], TMath::Abs(kPiPlus), TMath::Abs(kProton));
   if(!kfMother[1]) return kFALSE;
 
-  Float_t dMass[2] = {TMath::Abs(mMass[0] - cL0mass), TMath::Abs(mMass[1] - cL0mass)};
+  Float_t dMass[2] = {static_cast<Float_t>(TMath::Abs(mMass[0] - cL0mass)), static_cast<Float_t>(TMath::Abs(mMass[1] - cL0mass))};
   
   AliESDtrack* d[2];
   d[0] = dynamic_cast<AliESDtrack*>(fEvent->GetTrack(pIndex));
   d[1] = dynamic_cast<AliESDtrack*>(fEvent->GetTrack(nIndex));
   if(!d[0] || !d[1])    return kFALSE;
   
-  Float_t p[2] = {d[0]->GetP(), d[1]->GetP()}; 
+  Float_t p[2] = {static_cast<Float_t>(d[0]->GetP()), static_cast<Float_t>(d[1]->GetP())}; 
 
   // check the 3 lambda - antilambda variables
   Int_t check[2] = {-1, -1};   // 0 : lambda, 1 : antilambda
index 5fda6f7..63dc63a 100644 (file)
@@ -83,27 +83,27 @@ void AliBCM::StepManager()
     Int_t   copy = -1; 
     
     
-    if (gMC->TrackCharge() && 
-       gMC->CurrentVolID(copy) == fVolId) {
+    if (TVirtualMC::GetMC()->TrackCharge() && 
+       TVirtualMC::GetMC()->CurrentVolID(copy) == fVolId) {
        // Charged particle inside sensitive volume
        //
        // Entering
-       if (gMC->IsTrackEntering()) {
+       if (TVirtualMC::GetMC()->IsTrackEntering()) {
            edepT = 0.;
-           gMC->TrackPosition(xh[0],xh[1],xh[2]);
-           xh[3] = gMC->TrackTime();
+           TVirtualMC::GetMC()->TrackPosition(xh[0],xh[1],xh[2]);
+           xh[3] = TVirtualMC::GetMC()->TrackTime();
        }
        
        //
        // Any step
-       if ((edep = gMC->Edep()) > 0.) {
+       if ((edep = TVirtualMC::GetMC()->Edep()) > 0.) {
            Double_t x[3];   
-           gMC->TrackPosition(x[0],x[1],x[2]); 
+           TVirtualMC::GetMC()->TrackPosition(x[0],x[1],x[2]); 
            edepT += edep;
        }
        //
        // Exiting 
-       if(gMC->IsTrackExiting()||gMC->IsTrackStop()||gMC->IsTrackDisappeared())
+       if(TVirtualMC::GetMC()->IsTrackExiting()||TVirtualMC::GetMC()->IsTrackStop()||TVirtualMC::GetMC()->IsTrackDisappeared())
        {
            Int_t track = gAlice->GetMCApp()->GetCurrentTrackNumber();
            TClonesArray &lhits = *fHits;
@@ -198,7 +198,7 @@ void AliBCM::Init()
 
     //
     // Here the BCM initialisation code (if any!)
-    fVolId =  gMC->VolId("BCMpcd");
+    fVolId =  TVirtualMC::GetMC()->VolId("BCMpcd");
 }
 
 void AliBCM::MakeBranch(Option_t* option)
index 9262520..58fcab1 100644 (file)
@@ -140,53 +140,53 @@ void AliEMCAL::InitConstants()
 //     cutele = cutgam = 5.e-4;
 //   }
 
-//   gMC->Gstpar(idtmed[1600],"CUTGAM", cutgam);
-//   gMC->Gstpar(idtmed[1600],"CUTELE", cutele); // 1MEV -> 0.1MEV; 15-aug-05
-//   gMC->Gstpar(idtmed[1600],"BCUTE",  cutgam);  // BCUTE and BCUTM start from GUTGUM
-//   gMC->Gstpar(idtmed[1600],"BCUTM",  cutgam);  // BCUTE and BCUTM start from GUTGUM
+//   TVirtualMC::GetMC()->Gstpar(idtmed[1600],"CUTGAM", cutgam);
+//   TVirtualMC::GetMC()->Gstpar(idtmed[1600],"CUTELE", cutele); // 1MEV -> 0.1MEV; 15-aug-05
+//   TVirtualMC::GetMC()->Gstpar(idtmed[1600],"BCUTE",  cutgam);  // BCUTE and BCUTM start from GUTGUM
+//   TVirtualMC::GetMC()->Gstpar(idtmed[1600],"BCUTM",  cutgam);  // BCUTE and BCUTM start from GUTGUM
 //   // --- Generate explicitly delta rays in Lead ---
-//   gMC->Gstpar(idtmed[1600], "LOSS", 3) ;
-//   gMC->Gstpar(idtmed[1600], "DRAY", 1) ;
-//   gMC->Gstpar(idtmed[1600], "DCUTE", cutele) ;
-//   gMC->Gstpar(idtmed[1600], "DCUTM", cutele) ;
+//   TVirtualMC::GetMC()->Gstpar(idtmed[1600], "LOSS", 3) ;
+//   TVirtualMC::GetMC()->Gstpar(idtmed[1600], "DRAY", 1) ;
+//   TVirtualMC::GetMC()->Gstpar(idtmed[1600], "DCUTE", cutele) ;
+//   TVirtualMC::GetMC()->Gstpar(idtmed[1600], "DCUTM", cutele) ;
 
 // // --- in aluminium parts ---
-//   gMC->Gstpar(idtmed[1602],"CUTGAM", cutgam) ;
-//   gMC->Gstpar(idtmed[1602],"CUTELE", cutele) ;
-//   gMC->Gstpar(idtmed[1602],"BCUTE",  cutgam);  // BCUTE and BCUTM start from GUTGUM
-//   gMC->Gstpar(idtmed[1602],"BCUTM",  cutgam);  // BCUTE and BCUTM start from GUTGUM
-//   gMC->Gstpar(idtmed[1602], "LOSS",3.) ;
-//   gMC->Gstpar(idtmed[1602], "DRAY",1.) ;
-//   gMC->Gstpar(idtmed[1602], "DCUTE", cutele) ;
-//   gMC->Gstpar(idtmed[1602], "DCUTM", cutele) ;
+//   TVirtualMC::GetMC()->Gstpar(idtmed[1602],"CUTGAM", cutgam) ;
+//   TVirtualMC::GetMC()->Gstpar(idtmed[1602],"CUTELE", cutele) ;
+//   TVirtualMC::GetMC()->Gstpar(idtmed[1602],"BCUTE",  cutgam);  // BCUTE and BCUTM start from GUTGUM
+//   TVirtualMC::GetMC()->Gstpar(idtmed[1602],"BCUTM",  cutgam);  // BCUTE and BCUTM start from GUTGUM
+//   TVirtualMC::GetMC()->Gstpar(idtmed[1602], "LOSS",3.) ;
+//   TVirtualMC::GetMC()->Gstpar(idtmed[1602], "DRAY",1.) ;
+//   TVirtualMC::GetMC()->Gstpar(idtmed[1602], "DCUTE", cutele) ;
+//   TVirtualMC::GetMC()->Gstpar(idtmed[1602], "DCUTM", cutele) ;
 
 // // --- and finally thresholds for photons and electrons in the scintillator ---
-//   gMC->Gstpar(idtmed[1601],"CUTGAM", cutgam) ;
-//   gMC->Gstpar(idtmed[1601],"CUTELE", cutele) ;// 1MEV -> 0.1MEV; 15-aug-05
-//   gMC->Gstpar(idtmed[1601],"BCUTE",  cutgam);  // BCUTE and BCUTM start from GUTGUM
-//   gMC->Gstpar(idtmed[1601],"BCUTM",  cutgam);  // BCUTE and BCUTM start from GUTGUM
-//   gMC->Gstpar(idtmed[1601], "LOSS",3) ; // generate delta rays 
-//   gMC->Gstpar(idtmed[1601], "DRAY",1) ;
-//   gMC->Gstpar(idtmed[1601], "DCUTE", cutele) ;
-//   gMC->Gstpar(idtmed[1601], "DCUTM", cutele) ;
+//   TVirtualMC::GetMC()->Gstpar(idtmed[1601],"CUTGAM", cutgam) ;
+//   TVirtualMC::GetMC()->Gstpar(idtmed[1601],"CUTELE", cutele) ;// 1MEV -> 0.1MEV; 15-aug-05
+//   TVirtualMC::GetMC()->Gstpar(idtmed[1601],"BCUTE",  cutgam);  // BCUTE and BCUTM start from GUTGUM
+//   TVirtualMC::GetMC()->Gstpar(idtmed[1601],"BCUTM",  cutgam);  // BCUTE and BCUTM start from GUTGUM
+//   TVirtualMC::GetMC()->Gstpar(idtmed[1601], "LOSS",3) ; // generate delta rays 
+//   TVirtualMC::GetMC()->Gstpar(idtmed[1601], "DRAY",1) ;
+//   TVirtualMC::GetMC()->Gstpar(idtmed[1601], "DCUTE", cutele) ;
+//   TVirtualMC::GetMC()->Gstpar(idtmed[1601], "DCUTM", cutele) ;
 
 //   // S steel - 
-//   gMC->Gstpar(idtmed[1603],"CUTGAM", cutgam);
-//   gMC->Gstpar(idtmed[1603],"CUTELE", cutele);
-//   gMC->Gstpar(idtmed[1603],"BCUTE",  cutgam);  // BCUTE and BCUTM start from GUTGUM
-//   gMC->Gstpar(idtmed[1603],"BCUTM",  cutgam);  // BCUTE and BCUTM start from GUTGUM
+//   TVirtualMC::GetMC()->Gstpar(idtmed[1603],"CUTGAM", cutgam);
+//   TVirtualMC::GetMC()->Gstpar(idtmed[1603],"CUTELE", cutele);
+//   TVirtualMC::GetMC()->Gstpar(idtmed[1603],"BCUTE",  cutgam);  // BCUTE and BCUTM start from GUTGUM
+//   TVirtualMC::GetMC()->Gstpar(idtmed[1603],"BCUTM",  cutgam);  // BCUTE and BCUTM start from GUTGUM
 //   // --- Generate explicitly delta rays 
-//   gMC->Gstpar(idtmed[1603], "LOSS",3);
-//   gMC->Gstpar(idtmed[1603], "DRAY",1);
-//   gMC->Gstpar(idtmed[1603], "DCUTE", cutele) ;
-//   gMC->Gstpar(idtmed[1603], "DCUTM", cutele) ;
+//   TVirtualMC::GetMC()->Gstpar(idtmed[1603], "LOSS",3);
+//   TVirtualMC::GetMC()->Gstpar(idtmed[1603], "DRAY",1);
+//   TVirtualMC::GetMC()->Gstpar(idtmed[1603], "DCUTE", cutele) ;
+//   TVirtualMC::GetMC()->Gstpar(idtmed[1603], "DCUTM", cutele) ;
 
 //   AliEMCALGeometry* geom = GetGeometry();
 //   if(geom->GetILOSS()>=0) {
-//     for(int i=1600; i<=1603; i++) gMC->Gstpar(idtmed[i], "LOSS", geom->GetILOSS()) ; 
+//     for(int i=1600; i<=1603; i++) TVirtualMC::GetMC()->Gstpar(idtmed[i], "LOSS", geom->GetILOSS()) ; 
 //   } 
 //   if(geom->GetIHADR()>=0) {
-//     for(int i=1600; i<=1603; i++) gMC->Gstpar(idtmed[i], "HADR", geom->GetIHADR()) ; 
+//     for(int i=1600; i<=1603; i++) TVirtualMC::GetMC()->Gstpar(idtmed[i], "HADR", geom->GetIHADR()) ; 
 //   }
 // }
 
@@ -439,9 +439,9 @@ AliEMCALGeometry* AliEMCAL::GetGeometry() const
   // Pass the transpor model name (Geant3, Geant4, Fluka) and title to the geometry
   TString mcname   = "";
   TString mctitle  = "";
-  if(gMC){
-    mcname  = gMC->GetName()  ;
-    mctitle = gMC->GetTitle() ;
+  if(TVirtualMC::GetMC()){
+    mcname  = TVirtualMC::GetMC()->GetName()  ;
+    mctitle = TVirtualMC::GetMC()->GetTitle() ;
   }
  
   TString geoName(GetTitle());
index b571bef..4824781 100644 (file)
@@ -409,7 +409,7 @@ Int_t AliEMCALTracker::FindMatchedCluster(AliESDtrack *track)
   Int_t nclusters = fClusters->GetEntries();
   for (Int_t ic=0; ic<nclusters; ic++) {
     AliEMCALMatchCluster *cluster = (AliEMCALMatchCluster*)fClusters->At(ic);
-    Float_t clsPos[3] = {cluster->X(),cluster->Y(),cluster->Z()};
+    Float_t clsPos[3] = {static_cast<Float_t>(cluster->X()),static_cast<Float_t>(cluster->Y()),static_cast<Float_t>(cluster->Z())};
     Double_t dR = TMath::Sqrt(TMath::Power(trkPos[0]-clsPos[0],2)+TMath::Power(trkPos[1]-clsPos[1],2)+TMath::Power(trkPos[2]-clsPos[2],2));
     //printf("\n dR=%f,wind=%f\n",dR,fClusterWindow); //MARCEL
     if (dR > fClusterWindow) continue;
index 2804a3f..5a31fdc 100644 (file)
@@ -324,25 +324,25 @@ void AliEMCALTriggerRawDigitMaker::PostProcess()
                        fTriggerData->SetL1JetThreshold(  i, fSTURawStream->GetL1JetThreshold(i)  );
                }
                
-               Int_t v0[2] = {fSTURawStream->GetV0A(), fSTURawStream->GetV0C()};
+               Int_t v0[2] = { static_cast<Int_t>(fSTURawStream->GetV0A()),  static_cast<Int_t>(fSTURawStream->GetV0C())};
                
                Int_t type[15] = 
                {
-                       fSTURawStream->GetG(0, 0),
-                       fSTURawStream->GetG(1, 0),
-                       fSTURawStream->GetG(2, 0),
-                       fSTURawStream->GetJ(0, 0),
-                       fSTURawStream->GetJ(1, 0),
-                       fSTURawStream->GetJ(2, 0),
-                       fSTURawStream->GetG(0, 1),
-                       fSTURawStream->GetG(1, 1),
-                       fSTURawStream->GetG(2, 1),
-                       fSTURawStream->GetJ(0, 1),
-                       fSTURawStream->GetJ(1, 1),
-                       fSTURawStream->GetJ(2, 1),
-                       fSTURawStream->GetRawData(), 
-                       fSTURawStream->GetRegionEnable(), 
-                       fSTURawStream->GetFwVersion()
+                 static_cast<Int_t>(fSTURawStream->GetG(0, 0)),
+                 static_cast<Int_t>(fSTURawStream->GetG(1, 0)),
+                 static_cast<Int_t>(fSTURawStream->GetG(2, 0)),
+                 static_cast<Int_t>(fSTURawStream->GetJ(0, 0)),
+                 static_cast<Int_t>(fSTURawStream->GetJ(1, 0)),
+                 static_cast<Int_t>(fSTURawStream->GetJ(2, 0)),
+                 static_cast<Int_t>(fSTURawStream->GetG(0, 1)),
+                 static_cast<Int_t>(fSTURawStream->GetG(1, 1)),
+                 static_cast<Int_t>(fSTURawStream->GetG(2, 1)),
+                 static_cast<Int_t>(fSTURawStream->GetJ(0, 1)),
+                 static_cast<Int_t>(fSTURawStream->GetJ(1, 1)),
+                 static_cast<Int_t>(fSTURawStream->GetJ(2, 1)),
+                 static_cast<Int_t>(fSTURawStream->GetRawData()), 
+                 static_cast<Int_t>(fSTURawStream->GetRegionEnable()), 
+                 static_cast<Int_t>(fSTURawStream->GetFwVersion())
                };              
 
                // Modify DCS config from STU payload content
index 97f5779..9908592 100644 (file)
@@ -111,7 +111,7 @@ void AliEMCALWsuCosmicRaySetUp::CreateGeometry()
 
   Int_t *idtmed = fIdtmed->GetArray()+1;
   int idAir = idtmed[0];
-  gMC->Gsvolu(GetName(),"BOX",idAir, fMasterVolume,3); // Master volume
+  TVirtualMC::GetMC()->Gsvolu(GetName(),"BOX",idAir, fMasterVolume,3); // Master volume
   //
   // Sc counters
   //
@@ -121,24 +121,24 @@ void AliEMCALWsuCosmicRaySetUp::CreateGeometry()
   sc[2] = 1.0; // thicness of Sc is 2 cm
   Float_t zsc[3] = {10.,330.6, 810.1}; 
   int idSC = idtmed[1];
-  gMC->Gsvolu("SCOU","TUBE",idSC, sc,3); // Master volume
+  TVirtualMC::GetMC()->Gsvolu("SCOU","TUBE",idSC, sc,3); // Master volume
   printf(" idtmed[0] %i idtmed[1] %i \n", idtmed[0] , idtmed[1]); 
   Int_t idRot=0; // no rotation
   for(Int_t i=0; i<3; i++) {
     Float_t zpos = zsc[i] - fMasterVolume[2];
-    gMC->Gspos("SCOU", i+1, "WSUC", 0.0, 0.0, zpos, idRot, "ONLY"); 
+    TVirtualMC::GetMC()->Gspos("SCOU", i+1, "WSUC", 0.0, 0.0, zpos, idRot, "ONLY"); 
   }
   //
   // Dead end : Dec 2,2010
   //
   Float_t zbox[3]={30., 30.0, 0.1};
-  gMC->Gsvolu("SEND","BOX",idAir, zbox,3); // Master volume
-  gMC->Gspos("SEND", 1, "WSUC", 0.0, 0.0, 448.0, idRot, "ONLY"); 
+  TVirtualMC::GetMC()->Gsvolu("SEND","BOX",idAir, zbox,3); // Master volume
+  TVirtualMC::GetMC()->Gspos("SEND", 1, "WSUC", 0.0, 0.0, 448.0, idRot, "ONLY"); 
   // Hists
   fLHists = new TList;
   fLHists->SetName("hists");
   //
-  //AliMC *ALIMC  = dynamic_cast<AliMC *>(gMC);
+  //AliMC *ALIMC  = dynamic_cast<AliMC *>(TVirtualMC::GetMC());
   //AliGenBox* gB = dynamic_cast<AliGenBox *>(ALIMC->Generator());
   //Double_t p = gB->
   Double_t pmom=1.5; 
@@ -183,15 +183,15 @@ void AliEMCALWsuCosmicRaySetUp::DefineCuts(const Int_t idtmed)
   // Dec 2,2010 : it works
   Float_t cutgam=10.e-5; // 100 kev;
   Float_t cutele=10.e-5; // 100 kev;
-  gMC->Gstpar(idtmed,"CUTGAM", cutgam);
-  gMC->Gstpar(idtmed,"CUTELE", cutele); // 1MEV -> 0.1MEV; 15-aug-05
-  gMC->Gstpar(idtmed,"BCUTE",  cutgam);  // BCUTE and BCUTM start from GUTGUM
-  gMC->Gstpar(idtmed,"BCUTM",  cutgam);  // BCUTE and BCUTM start from GUTGUM
+  TVirtualMC::GetMC()->Gstpar(idtmed,"CUTGAM", cutgam);
+  TVirtualMC::GetMC()->Gstpar(idtmed,"CUTELE", cutele); // 1MEV -> 0.1MEV; 15-aug-05
+  TVirtualMC::GetMC()->Gstpar(idtmed,"BCUTE",  cutgam);  // BCUTE and BCUTM start from GUTGUM
+  TVirtualMC::GetMC()->Gstpar(idtmed,"BCUTM",  cutgam);  // BCUTE and BCUTM start from GUTGUM
   // --- Generate explicitly delta rays in Lead ---
-  gMC->Gstpar(idtmed, "LOSS", 3) ;
-  gMC->Gstpar(idtmed, "DRAY", 1) ;
-  gMC->Gstpar(idtmed, "DCUTE", cutele) ;
-  gMC->Gstpar(idtmed, "DCUTM", cutele) ;
+  TVirtualMC::GetMC()->Gstpar(idtmed, "LOSS", 3) ;
+  TVirtualMC::GetMC()->Gstpar(idtmed, "DRAY", 1) ;
+  TVirtualMC::GetMC()->Gstpar(idtmed, "DCUTE", cutele) ;
+  TVirtualMC::GetMC()->Gstpar(idtmed, "DCUTM", cutele) ;
 }
  
 void AliEMCALWsuCosmicRaySetUp::StepManager(void)
@@ -202,17 +202,17 @@ void AliEMCALWsuCosmicRaySetUp::StepManager(void)
   static TLorentzVector pos;  // Lorentz vector of the track current position.
   static TLorentzVector mom;  // Lorentz vector of the track current momentum.
 
-  if(pri>=2) printf("<I> AliEMCALWsuCosmicRaySetUp::StepManager %s \n", gMC->CurrentVolName());
+  if(pri>=2) printf("<I> AliEMCALWsuCosmicRaySetUp::StepManager %s \n", TVirtualMC::GetMC()->CurrentVolName());
   Int_t tracknumber =  gAlice->GetMCApp()->GetCurrentTrackNumber();
   //  Int_t parent=0;
   TParticle* part=0;
-  curVolName = gMC->CurrentVolName();
+  curVolName = TVirtualMC::GetMC()->CurrentVolName();
   if(curVolName.Contains("SEND")) {
-    gMC->TrackMomentum(mom);
-    gMC->TrackPosition(pos);
+    TVirtualMC::GetMC()->TrackMomentum(mom);
+    TVirtualMC::GetMC()->TrackPosition(pos);
     if(pri>=2) printf(" %s tracknumber %i p %f \n", curVolName.Data(), tracknumber, mom.P());
     if(pri>=2) printf(" x %f y %f z %f \n", pos[0], pos[1], pos[2]);
-    if(gMC->IsTrackEntering()) { // primary only TList *l = GetLhists(1);
+    if(TVirtualMC::GetMC()->IsTrackEntering()) { // primary only TList *l = GetLhists(1);
       TList *l = 0;
       if(tracknumber==0){
         l = GetLhists(1);
index 6d4abec..816a504 100644 (file)
@@ -101,8 +101,8 @@ AliEMCALv0::AliEMCALv0(const char *name, const char *title,
   fGeometry = g;
   fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
   if(gn.Contains("V1")) fSampleWidth += 2.*g->GetTrd1BondPaperThick();
-  AliDebug(2,Form("fGeometry %p : gMC %p : fSampleWidth %5.4f\n", 
-        fGeometry, gMC, fSampleWidth));
+  AliDebug(2,Form("fGeometry %p : TVirtualMC::GetMC() %p : fSampleWidth %5.4f\n", 
+        fGeometry, TVirtualMC::GetMC(), fSampleWidth));
   //Set geometry name again, in case it was changed during the initialization of the geometry.
   SetTitle(fGeometry->GetEMCGeometry()->GetName());
 
@@ -126,7 +126,7 @@ void AliEMCALv0::CreateGeometry()
   fIdTmedArr = fIdtmed->GetArray() - 1599 ;
   
   fIdRotm = 1;
-  //  gMC->Matrix(nmat, theta1, phi1, theta2, phi2, theta3, phi3) - see AliModule
+  //  TVirtualMC::GetMC()->Matrix(nmat, theta1, phi1, theta2, phi2, theta3, phi3) - see AliModule
   AliMatrix(fIdRotm, 90.0, 0., 90.0, 90.0, 0.0, 0.0) ; 
   
   // Create the EMCAL Mother Volume (a polygone) within which to place the Detector and named XEN1 
@@ -137,12 +137,12 @@ void AliEMCALv0::CreateGeometry()
     envelopA[0] = 30.;
     envelopA[1] = 30;
     envelopA[2] = 20;
-    gMC->Gsvolu("XEN1", "BOX", fIdTmedArr[kIdSC], envelopA, 3) ;
+    TVirtualMC::GetMC()->Gsvolu("XEN1", "BOX", fIdTmedArr[kIdSC], envelopA, 3) ;
     fEnvelop1.Set(3);
     for(int i=0; i<3; i++) fEnvelop1[i] = envelopA[i]; // 23-may-05  
     // Position the EMCAL Mother Volume (XEN1) in WSUC.
     // Look to AliEMCALWsuCosmicRaySetUp.  
-    gMC->Gspos("XEN1", 1, "WSUC", 0.0, 0.0, + 265., fIdRotm, "ONLY") ;
+    TVirtualMC::GetMC()->Gspos("XEN1", 1, "WSUC", 0.0, 0.0, + 265., fIdRotm, "ONLY") ;
   } else { 
     envelopA[0] = geom->GetArm1PhiMin();                         // minimum phi angle
     envelopA[1] = geom->GetArm1PhiMax() - geom->GetArm1PhiMin(); // angular range in phi
@@ -156,14 +156,14 @@ void AliEMCALv0::CreateGeometry()
     envelopA[8] = envelopA[5] ;                                  // radii are the same.
     envelopA[9] = envelopA[6] ;                                  // radii are the same.
 
-    gMC->Gsvolu("XEN1", "PGON", fIdTmedArr[kIdAIR], envelopA, 10) ;   // Polygone filled with air 
+    TVirtualMC::GetMC()->Gsvolu("XEN1", "PGON", fIdTmedArr[kIdAIR], envelopA, 10) ;   // Polygone filled with air 
     fEnvelop1.Set(10, envelopA);
     if (gDebug==2) {
       printf("CreateGeometry: XEN1 = %f, %f\n", envelopA[5], envelopA[6]); 
       printf("CreateGeometry: XU0 = %f, %f\n", envelopA[5], envelopA[6]); 
     }
     // Position the EMCAL Mother Volume (XEN1) in Alice (ALIC)  
-    gMC->Gspos(geom->GetNameOfEMCALEnvelope(), 1, "ALIC", 0.0, 0.0, 0.0, fIdRotm, "ONLY") ;
+    TVirtualMC::GetMC()->Gspos(geom->GetNameOfEMCALEnvelope(), 1, "ALIC", 0.0, 0.0, 0.0, fIdRotm, "ONLY") ;
   }
 
   // COMPACT, TRD1
@@ -245,17 +245,17 @@ void AliEMCALv0::CreateShishKebabGeometry()
     double wallThickness = g->GetPhiModuleSize()/g->GetNPHIdiv() -  g->GetPhiTileSize();
     for(int i=0; i<3; i++) parSCM0[i] = fParEMOD[i] - wallThickness;
     parSCM0[3] = fParEMOD[3];
-    gMC->Gsvolu("SCM0", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
-    gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
+    TVirtualMC::GetMC()->Gsvolu("SCM0", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
+    TVirtualMC::GetMC()->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
   } else {
     double wTh = g->GetLateralSteelStrip();
     parSCM0[0] = fParEMOD[0] - wTh + tanTrd1*g->GetTrd1AlFrontThick();
     parSCM0[1] = fParEMOD[1] - wTh;
     parSCM0[2] = fParEMOD[2] - wTh;
     parSCM0[3] = fParEMOD[3] - g->GetTrd1AlFrontThick()/2.;
-    gMC->Gsvolu("SCM0", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
+    TVirtualMC::GetMC()->Gsvolu("SCM0", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
     double zshift = g->GetTrd1AlFrontThick()/2.;
-    gMC->Gspos("SCM0", 1, "EMOD", 0., 0., zshift, 0, "ONLY");
+    TVirtualMC::GetMC()->Gspos("SCM0", 1, "EMOD", 0., 0., zshift, 0, "ONLY");
     // 
     CreateAlFrontPlate("EMOD","ALFP");
   }
@@ -263,7 +263,7 @@ void AliEMCALv0::CreateShishKebabGeometry()
   if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
     // Division to tile size - 1-oct-04
     AliDebug(2,Form(" Divide SCM0 on y-axis %i\n", g->GetNETAdiv()));
-    gMC->Gsdvn("SCMY","SCM0", g->GetNETAdiv(), 2); // y-axis
+    TVirtualMC::GetMC()->Gsdvn("SCMY","SCM0", g->GetNETAdiv(), 2); // y-axis
     // Trapesoid 2x2
     parTRAP[0] = parSCM0[3];    // dz
     parTRAP[1] = TMath::ATan2((parSCM0[1]-parSCM0[0])/2.,2.*parSCM0[3])*180./TMath::Pi(); // theta
@@ -281,14 +281,14 @@ void AliEMCALv0::CreateShishKebabGeometry()
     AliDebug(2,Form(" ** TRAP ** \n"));
     for(int i=0; i<11; i++) AliDebug(3, Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
     
-    gMC->Gsvolu("SCMX", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
+    TVirtualMC::GetMC()->Gsvolu("SCMX", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
     xpos = +(parSCM0[1]+parSCM0[0])/4.;
-    gMC->Gspos("SCMX", 1, "SCMY", xpos, 0.0, 0.0, 0, "ONLY") ;
+    TVirtualMC::GetMC()->Gspos("SCMX", 1, "SCMY", xpos, 0.0, 0.0, 0, "ONLY") ;
 
     // Using rotation because SCMX should be the same due to Pb tiles
     xpos = -xpos; 
     AliMatrix(fIdRotm, 90.0,180., 90.0, 270.0, 0.0,0.0) ;
-    gMC->Gspos("SCMX", 2, "SCMY", xpos, 0.0, 0.0, fIdRotm, "ONLY");
+    TVirtualMC::GetMC()->Gspos("SCMX", 2, "SCMY", xpos, 0.0, 0.0, fIdRotm, "ONLY");
     // put LED to the SCM0 
     AliEMCALShishKebabTrd1Module *mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(0);
     Double_t tanBetta = mod->GetTanBetta();
@@ -299,13 +299,13 @@ void AliEMCALv0::CreateShishKebabGeometry()
     if(!gn.Contains("V1")) {
       par[1] = parSCM0[2]/2;            // y 
       par[2] = g->GetECPbRadThick()/2.; // z
-      gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
+      TVirtualMC::GetMC()->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
       zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
       AliDebug(2,Form(" Pb tiles \n"));
       for(int iz=0; iz<g->GetNECLayers(); iz++){
         par[0] = (parSCM0[0] + tanBetta*fSampleWidth*iz)/2.;
         xpos   = par[0] - xCenterSCMX;
-        gMC->Gsposp("PBTI", ++nr, "SCMX", xpos, ypos, zpos, 0, "ONLY", par, 3) ;
+        TVirtualMC::GetMC()->Gsposp("PBTI", ++nr, "SCMX", xpos, ypos, zpos, 0, "ONLY", par, 3) ;
         AliDebug(3,Form(" %i xpos %f zpos %f par[0] %f \n", iz+1, xpos, zpos, par[0]));
         zpos += fSampleWidth;
       } 
@@ -316,10 +316,10 @@ void AliEMCALv0::CreateShishKebabGeometry()
       par[1] = parSCM0[2]/2.;                 // y 
       par[2] = g->GetTrd1BondPaperThick()/2.; // z
       par[0] = parSCM0[0]/2.;                 // x 
-      gMC->Gsvolu("PAP1", "BOX", fIdTmedArr[kIdPAPER], par, 3);
+      TVirtualMC::GetMC()->Gsvolu("PAP1", "BOX", fIdTmedArr[kIdPAPER], par, 3);
       xpos = par[0] - xCenterSCMX;
       zpos = -parSCM0[3] + g->GetTrd1BondPaperThick()/2.;
-      gMC->Gspos("PAP1", 1, "SCMX", xpos, ypos, zpos, 0, "ONLY");
+      TVirtualMC::GetMC()->Gspos("PAP1", 1, "SCMX", xpos, ypos, zpos, 0, "ONLY");
       for(int iz=0; iz<g->GetNECLayers()-1; iz++){
         nr = iz + 1;
         Double_t dz = g->GetECScintThick() + g->GetTrd1BondPaperThick() + fSampleWidth*iz;
@@ -327,15 +327,15 @@ void AliEMCALv0::CreateShishKebabGeometry()
         par[2] = g->GetECPbRadThick()/2. + g->GetTrd1BondPaperThick(); // z
         par[0] = (parSCM0[0] + tanBetta*dz)/2.;
         TString pa(Form("PA%2.2i",nr));
-       gMC->Gsvolu(pa.Data(), "BOX", fIdTmedArr[kIdPAPER], par, 3);
+       TVirtualMC::GetMC()->Gsvolu(pa.Data(), "BOX", fIdTmedArr[kIdPAPER], par, 3);
         xpos   = par[0] - xCenterSCMX;
         zpos   = -parSCM0[3] + dz + par[2];
-        gMC->Gspos(pa.Data(), 1, "SCMX", xpos, ypos, zpos, 0, "ONLY") ;
+        TVirtualMC::GetMC()->Gspos(pa.Data(), 1, "SCMX", xpos, ypos, zpos, 0, "ONLY") ;
        // Pb
         TString pb(Form("PB%2.2i",nr));
         par[2] = g->GetECPbRadThick()/2.; // z
-       gMC->Gsvolu(pb.Data(), "BOX", fIdTmedArr[kIdPB], par, 3);
-        gMC->Gspos(pb.Data(), 1, pa.Data(), 0.0, 0.0, 0.0, 0, "ONLY") ;
+       TVirtualMC::GetMC()->Gsvolu(pb.Data(), "BOX", fIdTmedArr[kIdPB], par, 3);
+        TVirtualMC::GetMC()->Gspos(pb.Data(), 1, pa.Data(), 0.0, 0.0, 0.0, 0, "ONLY") ;
       } 
     }
     
@@ -387,7 +387,7 @@ void AliEMCALv0::CreateSmod(const char* mother)
     par[1] = g->GetShellThickness()/2.;
     par[2] = g->GetEtaModuleSize()*g->GetNZ()/2. + 5; 
 
-    gMC->Gsvolu("SMOD", "BOX", fIdTmedArr[kIdAIR], par, 3);
+    TVirtualMC::GetMC()->Gsvolu("SMOD", "BOX", fIdTmedArr[kIdAIR], par, 3);
 
     AliDebug(2,Form("SMOD in WSUC : tmed %i | dx %7.2f dy %7.2f dz %7.2f (SMOD, BOX)\n", 
                    fIdTmedArr[kIdAIR], par[0],par[1],par[2]));
@@ -398,7 +398,7 @@ void AliEMCALv0::CreateSmod(const char* mother)
     for(int i=0; i<nphism; i++) {
       xpos = ypos = zpos = 0.0;
       fIdRotm = 0;
-      gMC->Gspos("SMOD", 1, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
+      TVirtualMC::GetMC()->Gspos("SMOD", 1, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
       printf(" fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f \n", 
       fIdRotm, phi, phiRad, xpos, ypos, zpos);
       nr++;
@@ -451,7 +451,7 @@ void AliEMCALv0::CreateSmod(const char* mother)
       } else AliError("Unkown SM Type!!");
 
       if(SMOrder == 1) {//first time, create the SM
-        gMC->Gsvolu(smName.Data(), "BOX", fIdTmedArr[kIdAIR], parC, 3);
+        TVirtualMC::GetMC()->Gsvolu(smName.Data(), "BOX", fIdTmedArr[kIdAIR], parC, 3);
         AliDebug(2,Form(" Super module with name \"%s\" was created in \"box\" with: par[0] = %f, par[1] = %f, par[2] = %f\n", smName.Data(), parC[0], parC[1], parC[2]));
       }
 
@@ -462,7 +462,7 @@ void AliEMCALv0::CreateSmod(const char* mother)
         zpos *= -1.;
       }
       AliMatrix(fIdRotm, 90.0, phi, 90.0, phiy, phiz, 0.0);
-      gMC->Gspos(smName.Data(), SMOrder, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
+      TVirtualMC::GetMC()->Gspos(smName.Data(), SMOrder, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
       AliDebug(3, Form(" %s : %2i, fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f : i %i \n",            
                        smName.Data(), SMOrder, fIdRotm, phi, phiRad, xpos, ypos, zpos, smodnum));
     }
@@ -472,10 +472,10 @@ void AliEMCALv0::CreateSmod(const char* mother)
   // Steel plate
   if(g->GetSteelFrontThickness() > 0.0) { // 28-mar-05
     par[0] = g->GetSteelFrontThickness()/2.;
-    gMC->Gsvolu("STPL", "BOX", fIdTmedArr[kIdSTEEL], par, 3);
+    TVirtualMC::GetMC()->Gsvolu("STPL", "BOX", fIdTmedArr[kIdSTEEL], par, 3);
     printf("tmed %i | dx %7.2f dy %7.2f dz %7.2f (STPL) \n", fIdTmedArr[kIdSTEEL], par[0],par[1],par[2]);
     xpos = -(g->GetShellThickness() - g->GetSteelFrontThickness())/2.;
-    gMC->Gspos("STPL", 1, "SMOD", xpos, 0.0, 0.0, 0, "ONLY") ;
+    TVirtualMC::GetMC()->Gspos("STPL", 1, "SMOD", xpos, 0.0, 0.0, 0, "ONLY") ;
   }
 }
 
@@ -495,7 +495,7 @@ void AliEMCALv0::CreateEmod(const char* mother, const char* child)
     fParEMOD[1] = g->Get2Trd1Dx2()/2.;        // dx2
     fParEMOD[2] = g->GetPhiModuleSize()/2.;;  // dy
     fParEMOD[3] = g->GetLongModuleSize()/2.;  // dz
-    gMC->Gsvolu(child, "TRD1", fIdTmedArr[kIdSTEEL], fParEMOD, 4);
+    TVirtualMC::GetMC()->Gsvolu(child, "TRD1", fIdTmedArr[kIdSTEEL], fParEMOD, 4);
   }
   
   int nr=0;
@@ -529,7 +529,7 @@ void AliEMCALv0::CreateEmod(const char* mother, const char* child)
         AliError("Unknown super module Type!!");
       for(int iy=0; iy<iyMax; iy++) { // flat in phi
         ypos = g->GetPhiModuleSize()*(2*iy+1 - iyMax)/2.;
-        gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
+        TVirtualMC::GetMC()->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
         //
         //printf(" %2i xpos %7.2f ypos %7.2f zpos %7.2f fIdRotm %i\n", nr, xpos, ypos, zpos, fIdRotm);
         AliDebug(3,Form("%3.3i(%2.2i,%2.2i) ", nr,iy+1,iz+1));
@@ -547,7 +547,7 @@ void AliEMCALv0::CreateEmod(const char* mother, const char* child)
       for(int ix=0; ix<g->GetNPhi(); ix++) 
       { // flat in phi
         xpos = g->GetPhiModuleSize()*(2*ix+1 - g->GetNPhi())/2.;
-        gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
+        TVirtualMC::GetMC()->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
         printf(" %7.2f ", xpos);
       }
       printf("\n");
@@ -568,9 +568,9 @@ void AliEMCALv0::CreateAlFrontPlate(const char* mother, const char* child)
   parALFP[1] = parALFP[0]               + tanTrd1*g->GetTrd1AlFrontThick(); // dx2
   parALFP[2] = g->GetPhiModuleSize()/2. - g->GetLateralSteelStrip();    // dy
   parALFP[3] = g->GetTrd1AlFrontThick()/2.; // dz
-  gMC->Gsvolu(child, "TRD1", fIdTmedArr[kIdAL], parALFP, 4);
+  TVirtualMC::GetMC()->Gsvolu(child, "TRD1", fIdTmedArr[kIdAL], parALFP, 4);
   zposALFP   = -fParEMOD[3] + g->GetTrd1AlFrontThick()/2.;
-  gMC->Gspos (child, 1, mother, 0.0, 0.0, zposALFP, 0, "ONLY");
+  TVirtualMC::GetMC()->Gspos (child, 1, mother, 0.0, 0.0, zposALFP, 0, "ONLY");
 }
 
 //______________________________________________________________________
@@ -588,11 +588,11 @@ void AliEMCALv0::Trd1Tower3X3(const double *parSCM0)
   gn.ToUpper(); 
  // Division to tile size 
   AliDebug(2,Form("Trd1Tower3X3() : Divide SCM0 on y-axis %i", g->GetNETAdiv()));
-  gMC->Gsdvn("SCMY","SCM0", g->GetNETAdiv(), 2); // y-axis
+  TVirtualMC::GetMC()->Gsdvn("SCMY","SCM0", g->GetNETAdiv(), 2); // y-axis
   double dx1=parSCM0[0], dx2=parSCM0[1], dy=parSCM0[2], dz=parSCM0[3];
   double ndiv=3., xpos=0.0;
   // should be defined once
-  gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
+  TVirtualMC::GetMC()->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
   for(int ix=1; ix<=3; ix++) { // 3X3
     scmx = "SCX"; // Nov 10,2006 
     // ix=1
@@ -626,8 +626,8 @@ void AliEMCALv0::Trd1Tower3X3(const double *parSCM0)
     for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
 
     scmx += ix;
-    gMC->Gsvolu(scmx.Data(), "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
-    gMC->Gspos(scmx.Data(), 1, "SCMY", xpos, 0.0, 0.0, 0, "ONLY") ;
+    TVirtualMC::GetMC()->Gsvolu(scmx.Data(), "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
+    TVirtualMC::GetMC()->Gspos(scmx.Data(), 1, "SCMY", xpos, 0.0, 0.0, 0, "ONLY") ;
 
     PbInTrap(parTRAP, scmx);
   }
@@ -657,7 +657,7 @@ void AliEMCALv0::PbInTrap(const double parTRAP[11], TString n)
     par[0] = parTRAP[4] + coef*fSampleWidth*iz;
     xpos   = par[0] - xCenterSCMX;
     if(parTRAP[1] < 0.) xpos = -xpos;
-    gMC->Gsposp("PBTI", ++nr, n.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
+    TVirtualMC::GetMC()->Gsposp("PBTI", ++nr, n.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
     AliDebug(2,Form(" %i xpos %9.3f zpos %9.3f par[0] %9.3f |", iz+1, xpos, zpos, par[0]));
     zpos += fSampleWidth;
     if(iz%2>0) printf("\n");
@@ -686,14 +686,14 @@ void AliEMCALv0::Trd1Tower1X1(double *parSCM0)
   // and as consequence the same abs is scheme
   AliDebug(2,"Trd1Tower1X1() : Create SCMX(SCMY) as SCM0");
 
-  gMC->Gsvolu("SCMY", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
-  gMC->Gspos("SCMY", 1, "SCM0", 0.0, 0.0, 0.0, 0, "ONLY");
-  gMC->Gsvolu("SCMX", "TRD1", fIdTmedArr[kIdSC], parSCM0, 4);
-  gMC->Gspos("SCMX", 1, "SCMY", 0.0, 0.0, 0.0, 0, "ONLY");
+  TVirtualMC::GetMC()->Gsvolu("SCMY", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
+  TVirtualMC::GetMC()->Gspos("SCMY", 1, "SCM0", 0.0, 0.0, 0.0, 0, "ONLY");
+  TVirtualMC::GetMC()->Gsvolu("SCMX", "TRD1", fIdTmedArr[kIdSC], parSCM0, 4);
+  TVirtualMC::GetMC()->Gspos("SCMX", 1, "SCMY", 0.0, 0.0, 0.0, 0, "ONLY");
 
   // should be defined once
   double *dummy=0;
-  gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
+  TVirtualMC::GetMC()->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
 
   PbInTrd1(parSCM0, "SCMX");
 
@@ -718,7 +718,7 @@ void AliEMCALv0::PbInTrd1(const double *parTrd1, TString n)
 
   for(int iz=0; iz<g->GetNECLayers(); iz++){
     par[0] = parTrd1[0] + coef*fSampleWidth*iz;
-    gMC->Gsposp("PBTI", ++nr, n.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
+    TVirtualMC::GetMC()->Gsposp("PBTI", ++nr, n.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
     AliDebug(2,Form(" %i xpos %9.3f zpos %9.3f par[0] %9.3f |", iz+1, xpos, zpos, par[0]));
     zpos += fSampleWidth;
     if(iz%2>0) printf("\n");
@@ -740,8 +740,8 @@ void AliEMCALv0::Scm0InTrd2(const AliEMCALGeometry * g, const Double_t emodPar[5
                    i, parSCM0[i],emodPar[i], parSCM0[i]-emodPar[i]));
   }
   parSCM0[4] = emodPar[4];
-  gMC->Gsvolu("SCM0", "TRD2", fIdTmedArr[kIdSC], parSCM0, 5); // kIdAIR -> kIdSC
-  gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
+  TVirtualMC::GetMC()->Gsvolu("SCM0", "TRD2", fIdTmedArr[kIdSC], parSCM0, 5); // kIdAIR -> kIdSC
+  TVirtualMC::GetMC()->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
   // Division 
   if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
     Division2X2InScm0(g, parSCM0);
@@ -787,14 +787,14 @@ void AliEMCALv0::Division2X2InScm0(const AliEMCALGeometry * g, const Double_t pa
           for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
 
   fIdRotm=0;
-  gMC->Gsvolu("SCMY", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11); // kIdAIR -> kIdSC
+  TVirtualMC::GetMC()->Gsvolu("SCMY", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11); // kIdAIR -> kIdSC
   ypos = +(parTRAP[3]+parTRAP[7])/2.; //
   AliDebug(2,Form(" Y shift SCMY inside SCM0 : %7.3f : opt %s\n", ypos, overLapFlagSCMY.Data())); 
-  gMC->Gspos("SCMY", 1, "SCM0", 0.0, ypos, 0.0, fIdRotm,  overLapFlagSCMY.Data()) ;
+  TVirtualMC::GetMC()->Gspos("SCMY", 1, "SCM0", 0.0, ypos, 0.0, fIdRotm,  overLapFlagSCMY.Data()) ;
   // Rotation SCMY around z-axis on 180 degree; x'=-x; y'=-y and z=z
   AliMatrix(fIdRotm, 90.0,180., 90.0, 270.0, 0.0,0.0) ;
   // We may have problem with numeration due to rotation - 4-feb-05
-  gMC->Gspos("SCMY", 2, "SCM0", 0.0, -ypos, 0.0, fIdRotm,  overLapFlagSCMY.Data()); 
+  TVirtualMC::GetMC()->Gspos("SCMY", 2, "SCM0", 0.0, -ypos, 0.0, fIdRotm,  overLapFlagSCMY.Data()); 
 
   Info("Division2X2InScm0","Divide SCMY on x-axis %i\n", g->GetNPHIdiv());
   dx1 = parSCM0[0]; 
@@ -819,13 +819,13 @@ void AliEMCALv0::Division2X2InScm0(const AliEMCALGeometry * g, const Double_t pa
   for(int i=0; i<11; i++) AliDebug(2,Form(" par[%2.2i] %9.4f\n", i, parTRAP[i]));
 
   fIdRotm=0;
-  gMC->Gsvolu("SCMX", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
+  TVirtualMC::GetMC()->Gsvolu("SCMX", "TRAP", fIdTmedArr[kIdSC], parTRAP, 11);
   xpos = (parTRAP[4]+parTRAP[8])/2.;
   AliDebug(2,Form(" X shift SCMX inside SCMX : %7.3f : opt %s\n", xpos, overLapFlagSCMX.Data())); 
-  gMC->Gspos("SCMX", 1, "SCMY", xpos, 0.0, 0.0, fIdRotm,  overLapFlagSCMX.Data()) ;
+  TVirtualMC::GetMC()->Gspos("SCMX", 1, "SCMY", xpos, 0.0, 0.0, fIdRotm,  overLapFlagSCMX.Data()) ;
   //  AliMatrix(fIdRotm, 90.0,270., 90.0, 0.0, 0.0,0.0); // x'=-y; y'=x; z'=z
   AliMatrix(fIdRotm, 90.0,90., 90.0, -180.0, 0.0,0.0);     // x'=y;  y'=-x; z'=z
-  gMC->Gspos("SCMX", 2, "SCMY", -xpos, 0.0, 0.0, fIdRotm,  overLapFlagSCMX.Data()) ;
+  TVirtualMC::GetMC()->Gspos("SCMX", 2, "SCMY", -xpos, 0.0, 0.0, fIdRotm,  overLapFlagSCMX.Data()) ;
   // PB:
   if(n=="SCMX" && overLapFlagSCMY == "ONLY") {
     PbInTrapForTrd2(parTRAP, n);
@@ -843,7 +843,7 @@ void AliEMCALv0::PbInTrapForTrd2(const double *parTRAP, TString name)
     pbShape    = "TRD2";
     //    pbtiChonly = "MANY";
   }
-  gMC->Gsvolu("PBTI", pbShape.Data(), fIdTmedArr[kIdPB], dummy, 0);
+  TVirtualMC::GetMC()->Gsvolu("PBTI", pbShape.Data(), fIdTmedArr[kIdPB], dummy, 0);
 
   int nr=0;
   Info("PbInTrapForTrd2"," Pb tiles inside %s: shape %s :pbtiChonly %s\n nrstart %i\n", 
@@ -864,7 +864,7 @@ void AliEMCALv0::PbInTrapForTrd2(const double *parTRAP, TString name)
       par[1] = par[0];
       xpos   = ypos = par[0] - xCenterSCMX;
     //if(parTRAP[1] < 0.) xpos = -xpos;
-      gMC->Gsposp("PBTI", ++nr, name.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
+      TVirtualMC::GetMC()->Gsposp("PBTI", ++nr, name.Data(), xpos, ypos, zpos, 0, "ONLY", par, 3) ;
       AliDebug(2,Form(" %2.2i xpos %8.5f zpos %6.3f par[0,1] %6.3f |", iz+1, xpos, zpos, par[0]));
       if(iz%2>0) AliDebug(2,Form("\n"));
       zpos += fSampleWidth;
@@ -886,14 +886,14 @@ void AliEMCALv0::PbInTrapForTrd2(const double *parTRAP, TString name)
       parPB[1] = parPB[0]   + tanx*g->GetECPbRadThick();
       parPB[2] = parTRAP[2] + tany*ztmp;
       parPB[3] = parPB[2]   + tany*g->GetECPbRadThick();
-      gMC->Gsposp("PBTI", ++nr, name.Data(), xpos, ypos, zpos, 0, pbtiChonly.Data(), parPB, 5) ;
+      TVirtualMC::GetMC()->Gsposp("PBTI", ++nr, name.Data(), xpos, ypos, zpos, 0, pbtiChonly.Data(), parPB, 5) ;
       AliDebug(2,Form("\n PBTI %2i | zpos %6.3f | par = ", nr, zpos));
       /*
       for(int i=0; i<5; i++) printf(" %9.5f ", parPB[i]);
       // individual SC tile
       parSC[0] = parPB[0];
       parSC[1] = parPB[1];
-      gMC->Gsposp("SCTI", nr, name.Data(), xpos, ypos, zpos+g->GetECScintThick(), 
+      TVirtualMC::GetMC()->Gsposp("SCTI", nr, name.Data(), xpos, ypos, zpos+g->GetECScintThick(), 
       0, pbtiChonly.Data(), parSC, 3) ;
       printf("\n SCTI     zpos %6.3f | par = ", zpos+g->GetECScintThick());
       for(int i=0; i<3; i++) printf(" %9.5f ", parPB[i]);
@@ -919,8 +919,8 @@ void AliEMCALv0::PbmoInTrd2(const AliEMCALGeometry * g, const Double_t emodPar[5
                    i, parPBMO[i],emodPar[i], parPBMO[i]-emodPar[i]));
   }
   parPBMO[4] = emodPar[4];
-  gMC->Gsvolu("PBMO", "TRD2", fIdTmedArr[kIdPB], parPBMO, 5);
-  gMC->Gspos("PBMO", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
+  TVirtualMC::GetMC()->Gsvolu("PBMO", "TRD2", fIdTmedArr[kIdPB], parPBMO, 5);
+  TVirtualMC::GetMC()->Gspos("PBMO", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
   // Division 
   if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
     Division2X2InPbmo(g, parPBMO);
@@ -937,7 +937,7 @@ void AliEMCALv0::Division2X2InPbmo(const AliEMCALGeometry * g, const Double_t pa
   // Division 2X2
   Info("Division2X2InPbmo"," started : geometry %s ", g->GetName());
   //Double_t *dummy=0;
-  //  gMC->Gsvolu("SCTI", "BOX", fIdTmedArr[kIdSC], dummy, 0);
+  //  TVirtualMC::GetMC()->Gsvolu("SCTI", "BOX", fIdTmedArr[kIdSC], dummy, 0);
 
   double parSC[3];
   double xpos = 0.0, ypos = 0.0, zpos = 0.0, ztmp=0;;
@@ -959,18 +959,18 @@ void AliEMCALv0::Division2X2InPbmo(const AliEMCALGeometry * g, const Double_t pa
     parSC[1] =  parPBMO[2] + tany*ztmp;
 
     snprintf(name,buffersize,"SC%2.2i", iz+1);
-    gMC->Gsvolu(name, "BOX", fIdTmedArr[kIdSC], parSC, 3);
-    gMC->Gspos(name, 1, "PBMO", xpos, ypos, zpos, 0, "ONLY") ;
+    TVirtualMC::GetMC()->Gsvolu(name, "BOX", fIdTmedArr[kIdSC], parSC, 3);
+    TVirtualMC::GetMC()->Gspos(name, 1, "PBMO", xpos, ypos, zpos, 0, "ONLY") ;
     AliDebug(2,Form("%s | zpos %6.3f | parSC[0,1]=(%7.5f,%7.5f) -> ", 
                    name, zpos, parSC[0], parSC[1]));
     
     snprintf(named,buffersize,"SY%2.2i", iz+1);
     printf(" %s -> ", named);
-    gMC->Gsdvn(named,name, 2, 2);
+    TVirtualMC::GetMC()->Gsdvn(named,name, 2, 2);
 
     snprintf(named2,buffersize,"SX%2.2i", iz+1);
     printf(" %s \n", named2);
-    gMC->Gsdvn(named2,named, 2, 1);
+    TVirtualMC::GetMC()->Gsdvn(named2,named, 2, 1);
 
     zpos    += fSampleWidth;
   }
index b34f1ec..2bdd6a8 100644 (file)
@@ -140,11 +140,11 @@ void AliEMCALv1::StepManager(void){
   TParticle *part=0;
   Int_t parent=-1;
 
-  static Int_t idXPHI = gMC->VolId("XPHI");
-  if(gMC->CurrentVolID(copy) == idXPHI ) { // We are in a Scintillator Layer 
+  static Int_t idXPHI = TVirtualMC::GetMC()->VolId("XPHI");
+  if(TVirtualMC::GetMC()->CurrentVolID(copy) == idXPHI ) { // We are in a Scintillator Layer 
     Float_t depositedEnergy ; 
     
-    if( ((depositedEnergy = gMC->Edep()) > 0.)  && (gMC->TrackTime() < fTimeCut)){// Track is inside a scintillator and deposits some energy
+    if( ((depositedEnergy = TVirtualMC::GetMC()->Edep()) > 0.)  && (TVirtualMC::GetMC()->TrackTime() < fTimeCut)){// Track is inside a scintillator and deposits some energy
        if (fCurPrimary==-1) 
        fCurPrimary=gAlice->GetMCApp()->GetPrimary(tracknumber);
 
@@ -185,20 +185,20 @@ void AliEMCALv1::StepManager(void){
        }
        fCurTrack=tracknumber;
       }    
-      gMC->TrackPosition(pos);
+      TVirtualMC::GetMC()->TrackPosition(pos);
       xyzte[0] = pos[0];
       xyzte[1] = pos[1];
       xyzte[2] = pos[2];
-      xyzte[3] = gMC->TrackTime() ;       
+      xyzte[3] = TVirtualMC::GetMC()->TrackTime() ;       
       
-      gMC->TrackMomentum(mom);
+      TVirtualMC::GetMC()->TrackMomentum(mom);
       pmom[0] = mom[0];
       pmom[1] = mom[1];
       pmom[2] = mom[2];
       pmom[3] = mom[3];
       
-      gMC->CurrentVolOffID(1, id[0]); // get the POLY copy number;
-      gMC->CurrentVolID(id[1]); // get the phi number inside the layer
+      TVirtualMC::GetMC()->CurrentVolOffID(1, id[0]); // get the POLY copy number;
+      TVirtualMC::GetMC()->CurrentVolID(id[1]); // get the phi number inside the layer
       
       Int_t tower = (id[0]-1) % geom->GetNZ() + 1 + (id[1] - 1) * geom->GetNZ() ;  
       Int_t layer = static_cast<Int_t>((id[0]-1)/(geom->GetNZ())) + 1 ; 
@@ -210,17 +210,17 @@ void AliEMCALv1::StepManager(void){
       Float_t lightYield =  depositedEnergy ;
       // Apply Birk's law (copied from G3BIRK)
 
-      if (gMC->TrackCharge()!=0) { // Check
+      if (TVirtualMC::GetMC()->TrackCharge()!=0) { // Check
          Float_t birkC1Mod = 0;
        if (fBirkC0==1){ // Apply correction for higher charge states
-         if (TMath::Abs(gMC->TrackCharge())>=2)
+         if (TMath::Abs(TVirtualMC::GetMC()->TrackCharge())>=2)
            birkC1Mod=fBirkC1*7.2/12.6;
          else
            birkC1Mod=fBirkC1;
        }
        Float_t dedxcm=0.;
-       if (gMC->TrackStep()>0) 
-         dedxcm=1000.*gMC->Edep()/gMC->TrackStep();
+       if (TVirtualMC::GetMC()->TrackStep()>0) 
+         dedxcm=1000.*TVirtualMC::GetMC()->Edep()/TVirtualMC::GetMC()->TrackStep();
        else
          dedxcm=0;
        lightYield=lightYield/(1.+birkC1Mod*dedxcm+fBirkC2*dedxcm*dedxcm);
index 9aa7322..9c56a5a 100644 (file)
@@ -137,22 +137,22 @@ void AliEMCALv2::StepManager(void){
 
   if(keyGeom == 0) {
     keyGeom = 2;
-    if(gMC->VolId("PBMO")==0 || gMC->VolId("WSUC")==1) {
+    if(TVirtualMC::GetMC()->VolId("PBMO")==0 || TVirtualMC::GetMC()->VolId("WSUC")==1) {
       vn      = "SCMX";   // old TRD2(TRD1) or WSUC
       keyGeom = 1;
     }    
     printf("AliEMCALv2::StepManager():  keyGeom %i : Sensetive volume %s \n", 
     keyGeom, vn); 
-    if(gMC->VolId("WSUC")==1) printf(" WSUC - cosmic ray stand geometry \n");
+    if(TVirtualMC::GetMC()->VolId("WSUC")==1) printf(" WSUC - cosmic ray stand geometry \n");
   }
   Int_t tracknumber =  gAlice->GetMCApp()->GetCurrentTrackNumber();
   Int_t parent=0;
   TParticle* part=0;
 
-  curVolName = gMC->CurrentVolName();
+  curVolName = TVirtualMC::GetMC()->CurrentVolName();
   if(curVolName.Contains(vn) || curVolName.Contains("SCX")) { // We are in a scintillator layer; SCX for 3X3
     
-    if( ((depositedEnergy = gMC->Edep()) > 0.)  && (gMC->TrackTime() < fTimeCut)){// Track is inside a scintillator and deposits some energy
+    if( ((depositedEnergy = TVirtualMC::GetMC()->Edep()) > 0.)  && (TVirtualMC::GetMC()->TrackTime() < fTimeCut)){// Track is inside a scintillator and deposits some energy
       //       Info("StepManager "," entry %i DE %f",++ientry, depositedEnergy); // for testing
        if (fCurPrimary==-1) 
        fCurPrimary=gAlice->GetMCApp()->GetPrimary(tracknumber);
@@ -198,13 +198,13 @@ void AliEMCALv2::StepManager(void){
        }
        fCurTrack=tracknumber;
       }    
-      gMC->TrackPosition(pos);
+      TVirtualMC::GetMC()->TrackPosition(pos);
       xyzte[0] = pos[0];
       xyzte[1] = pos[1];
       xyzte[2] = pos[2];
-      xyzte[3] = gMC->TrackTime() ;       
+      xyzte[3] = TVirtualMC::GetMC()->TrackTime() ;       
       
-      gMC->TrackMomentum(mom);
+      TVirtualMC::GetMC()->TrackMomentum(mom);
       pmom[0] = mom[0];
       pmom[1] = mom[1];
       pmom[2] = mom[2];
@@ -213,35 +213,35 @@ void AliEMCALv2::StepManager(void){
       //      if(ientry%200 > 0) return; // testing
       supModuleNumber = moduleNumber = yNumber = xNumber = absid = 0;
       if(keyGeom >= 1) { // TRD1 case now
-        gMC->CurrentVolOffID(4, supModuleNumber);
-        gMC->CurrentVolOffID(3, moduleNumber);
-        gMC->CurrentVolOffID(1, yNumber);
-        gMC->CurrentVolOffID(0, xNumber); // really x number now
+        TVirtualMC::GetMC()->CurrentVolOffID(4, supModuleNumber);
+        TVirtualMC::GetMC()->CurrentVolOffID(3, moduleNumber);
+        TVirtualMC::GetMC()->CurrentVolOffID(1, yNumber);
+        TVirtualMC::GetMC()->CurrentVolOffID(0, xNumber); // really x number now
         Int_t CurrentSMType = 0;
-        if(strcmp(gMC->CurrentVolOffName(4),"SMOD")==0)  CurrentSMType = AliEMCALGeometry::kEMCAL_Standard ;
-        else if(strcmp(gMC->CurrentVolOffName(4),"SM10")==0)  CurrentSMType = AliEMCALGeometry::kEMCAL_Half ;
-        else if(strcmp(gMC->CurrentVolOffName(4),"SM3rd")==0) CurrentSMType = AliEMCALGeometry::kEMCAL_3rd  ;
-        else if(strcmp(gMC->CurrentVolOffName(4),"DCSM")==0)  CurrentSMType = AliEMCALGeometry::kDCAL_Standard ;
-        else if(strcmp(gMC->CurrentVolOffName(4),"DCEXT")==0) CurrentSMType = AliEMCALGeometry::kDCAL_Ext   ;
+        if(strcmp(TVirtualMC::GetMC()->CurrentVolOffName(4),"SMOD")==0)  CurrentSMType = AliEMCALGeometry::kEMCAL_Standard ;
+        else if(strcmp(TVirtualMC::GetMC()->CurrentVolOffName(4),"SM10")==0)  CurrentSMType = AliEMCALGeometry::kEMCAL_Half ;
+        else if(strcmp(TVirtualMC::GetMC()->CurrentVolOffName(4),"SM3rd")==0) CurrentSMType = AliEMCALGeometry::kEMCAL_3rd  ;
+        else if(strcmp(TVirtualMC::GetMC()->CurrentVolOffName(4),"DCSM")==0)  CurrentSMType = AliEMCALGeometry::kDCAL_Standard ;
+        else if(strcmp(TVirtualMC::GetMC()->CurrentVolOffName(4),"DCEXT")==0) CurrentSMType = AliEMCALGeometry::kDCAL_Ext   ;
         else AliError("Unkown SM Type!!");
 
         Int_t preSM = 0;
         while( fGeometry->GetSMType(preSM) != CurrentSMType ) preSM++;
         supModuleNumber += preSM;
        // Nov 10,2006
-        if(strcmp(gMC->CurrentVolOffName(0),vn) != 0) { // 3X3 case
-          if     (strcmp(gMC->CurrentVolOffName(0),"SCX1")==0) xNumber=1;
-          else if(strcmp(gMC->CurrentVolOffName(0),"SCX2")==0) xNumber=2;
-          else if(strcmp(gMC->CurrentVolOffName(0),"SCX3")==0) xNumber=3;
-          else Fatal("StepManager()", "Wrong name of sensitive volume in 3X3 case : %s ", gMC->CurrentVolOffName(0));
+        if(strcmp(TVirtualMC::GetMC()->CurrentVolOffName(0),vn) != 0) { // 3X3 case
+          if     (strcmp(TVirtualMC::GetMC()->CurrentVolOffName(0),"SCX1")==0) xNumber=1;
+          else if(strcmp(TVirtualMC::GetMC()->CurrentVolOffName(0),"SCX2")==0) xNumber=2;
+          else if(strcmp(TVirtualMC::GetMC()->CurrentVolOffName(0),"SCX3")==0) xNumber=3;
+          else Fatal("StepManager()", "Wrong name of sensitive volume in 3X3 case : %s ", TVirtualMC::GetMC()->CurrentVolOffName(0));
        }
       } else {
-        gMC->CurrentVolOffID(5, supModuleNumber);
-        gMC->CurrentVolOffID(4, moduleNumber);
-        gMC->CurrentVolOffID(1, yNumber);
-        gMC->CurrentVolOffID(0, xNumber);
-        if     (strcmp(gMC->CurrentVolOffName(5),"SMOP")==0) supModuleNumber = 2*(supModuleNumber-1)+1;
-        else if(strcmp(gMC->CurrentVolOffName(5),"SMON")==0) supModuleNumber = 2*(supModuleNumber-1)+2;
+        TVirtualMC::GetMC()->CurrentVolOffID(5, supModuleNumber);
+        TVirtualMC::GetMC()->CurrentVolOffID(4, moduleNumber);
+        TVirtualMC::GetMC()->CurrentVolOffID(1, yNumber);
+        TVirtualMC::GetMC()->CurrentVolOffID(0, xNumber);
+        if     (strcmp(TVirtualMC::GetMC()->CurrentVolOffName(5),"SMOP")==0) supModuleNumber = 2*(supModuleNumber-1)+1;
+        else if(strcmp(TVirtualMC::GetMC()->CurrentVolOffName(5),"SMON")==0) supModuleNumber = 2*(supModuleNumber-1)+2;
         else   assert(0); // something wrong
       }
                
@@ -255,13 +255,13 @@ void AliEMCALv2::StepManager(void){
       Int_t smType   = 1;
       fGeometry->GetCellPhiEtaIndexInSModule(smNumber,moduleNumber-1,yNumber-1,xNumber-1, iphi, ieta);
       if (smNumber%2 == 0) {
-       if(strcmp(gMC->CurrentVolOffName(4),"DCSM")==0) smType = 3; //DCal supermodule. previous design/idea
+       if(strcmp(TVirtualMC::GetMC()->CurrentVolOffName(4),"DCSM")==0) smType = 3; //DCal supermodule. previous design/idea
         else smType = 2;
        ieta = ((fGeometry->GetCentersOfCellsEtaDir()).GetSize()* 2/smType -1)-ieta;// 47/31-ieta, revert the ordering on A side in order to keep convention.
       } else {  
-       if(strcmp(gMC->CurrentVolOffName(4),"SM10")==0) smType = 2 ; //half supermodule. previous design/idea
-       if(strcmp(gMC->CurrentVolOffName(4),"SM3rd")==0) smType = 3 ; //one third (installed in 2012) supermodule
-       if(strcmp(gMC->CurrentVolOffName(4),"DCEXT")==0) smType = 3 ; //one third (installed in 2012) supermodule
+       if(strcmp(TVirtualMC::GetMC()->CurrentVolOffName(4),"SM10")==0) smType = 2 ; //half supermodule. previous design/idea
+       if(strcmp(TVirtualMC::GetMC()->CurrentVolOffName(4),"SM3rd")==0) smType = 3 ; //one third (installed in 2012) supermodule
+       if(strcmp(TVirtualMC::GetMC()->CurrentVolOffName(4),"DCEXT")==0) smType = 3 ; //one third (installed in 2012) supermodule
        iphi= ((fGeometry->GetCentersOfCellsPhiDir()).GetSize()/smType-1)-iphi;// 23/7-iphi, revert the ordering on C side in order to keep convention.
       }
       
@@ -277,15 +277,15 @@ void AliEMCALv2::StepManager(void){
       Float_t lightYield =  depositedEnergy ;
       // Apply Birk's law (copied from G3BIRK)
 
-      if (gMC->TrackCharge()!=0) { // Check
+      if (TVirtualMC::GetMC()->TrackCharge()!=0) { // Check
          Float_t birkC1Mod = 0;
        if (fBirkC0==1){ // Apply correction for higher charge states
-         if (TMath::Abs(gMC->TrackCharge())>=2) birkC1Mod = fBirkC1*7.2/12.6;
+         if (TMath::Abs(TVirtualMC::GetMC()->TrackCharge())>=2) birkC1Mod = fBirkC1*7.2/12.6;
          else                                   birkC1Mod = fBirkC1;
        }
 
        Float_t dedxcm=0.;
-       if (gMC->TrackStep()>0)  dedxcm=1000.*gMC->Edep()/gMC->TrackStep();
+       if (TVirtualMC::GetMC()->TrackStep()>0)  dedxcm=1000.*TVirtualMC::GetMC()->Edep()/TVirtualMC::GetMC()->TrackStep();
        else                     dedxcm=0;
        lightYield=lightYield/(1.+birkC1Mod*dedxcm+fBirkC2*dedxcm*dedxcm);
       } 
index 024c2ec..4e5ba35 100644 (file)
@@ -273,7 +273,7 @@ void AliGenCorrHF::Init()
 
 // particle decay related initialization
 
-    if (gMC) fDecayer = gMC->GetDecayer();
+    if (TVirtualMC::GetMC()) fDecayer = TVirtualMC::GetMC()->GetDecayer();
     fDecayer->SetForceDecay(fForceDecay);
     fDecayer->Init();
 
index bb6f8d3..3be063f 100644 (file)
@@ -254,7 +254,7 @@ void AliGenEMCocktail::AddSource2Generator(Char_t* nameSource,
   genSource->SetPhiRange(phiMin, phiMax);
   genSource->SetWeighting(fWeightingMode);
   genSource->SetForceGammaConversion(fForceConv);
-  if (!gMC) genSource->SetDecayer(fDecayer);  
+  if (!TVirtualMC::GetMC()) genSource->SetDecayer(fDecayer);  
   genSource->Init();
     
   AddGenerator(genSource,nameSource,1.); // Adding Generator    
index f3fa75d..8906351 100644 (file)
@@ -279,8 +279,8 @@ void AliGenHIJINGpara::Init()
     }
 //
 //
-    if (fPi0Decays && gMC)
-       fDecayer = gMC->GetDecayer();
+    if (fPi0Decays && TVirtualMC::GetMC())
+       fDecayer = TVirtualMC::GetMC()->GetDecayer();
 
     if (fPi0Decays)
     {
index 4096c7b..0d0dd40 100644 (file)
@@ -562,7 +562,7 @@ void AliGenMUONCocktailpp::CreateCocktail()
     gencharm->SetMomentumRange(0,9999);
     gencharm->SetForceDecay(kAll);
     Double_t ratioccbar = chard[fCentralityBin]*sigmaccbar/fSigmaReaction;
-    if (!gMC) gencharm->SetDecayer(fDecayer);  
+    if (!TVirtualMC::GetMC()) gencharm->SetDecayer(fDecayer);  
     gencharm->Init();
     if (!fSigmaSilent) {
       AliInfo(Form("c-cbar prod. cross-section in pp %5.3g b",sigmaccbar));
@@ -575,7 +575,7 @@ void AliGenMUONCocktailpp::CreateCocktail()
     genbeauty->SetMomentumRange(0,9999);
     genbeauty->SetForceDecay(kAll);
     Double_t ratiobbbar = bhard[fCentralityBin]*sigmabbbar/fSigmaReaction;
-    if (!gMC) genbeauty->SetDecayer(fDecayer);  
+    if (!TVirtualMC::GetMC()) genbeauty->SetDecayer(fDecayer);  
     genbeauty->Init();
     if (!fSigmaSilent) {
       AliInfo(Form("b-bbar prod. cross-section in pp  %5.3g b",sigmabbbar));
@@ -620,7 +620,7 @@ void AliGenMUONCocktailpp::AddReso2Generator(Char_t* nameReso,
     genReso->SetYRange(-8.,8.);
     genReso->SetPhiRange(0.,360.);
     genReso->SetForceDecay(fDecayModeResonance);
-    if (!gMC) genReso->SetDecayer(fDecayer);  
+    if (!TVirtualMC::GetMC()) genReso->SetDecayer(fDecayer);  
     genReso->Init();  // generation in 4pi
 // Ratios with respect to the reaction cross-section in the 
 // kinematics limit of the MUONCocktail
index a2dafd2..662a185 100644 (file)
@@ -427,7 +427,7 @@ void AliGenParam::Init()
 {
   // Initialisation
 
-    if (gMC) fDecayer = gMC->GetDecayer();
+    if (TVirtualMC::GetMC()) fDecayer = TVirtualMC::GetMC()->GetDecayer();
   //Begin_Html
   /*
     <img src="picts/AliGenParam.gif">
index 33f75e5..0844449 100644 (file)
@@ -142,7 +142,7 @@ TParticle* AliGenReaderCwn::NextParticle()
     Float_t prwn;
     Float_t p[4];
 // Read the next particle
-    if (fCode == kGEANT3) fIdpart=gMC->PDGFromId(fIdpart);
+    if (fCode == kGEANT3) fIdpart=TVirtualMC::GetMC()->PDGFromId(fIdpart);
     Double_t amass = TDatabasePDG::Instance()->GetParticle(fIdpart)->Mass();
     if(fE<=amass) {
        Warning("Generate","Particle %d  E = %f mass = %f %f %f \n",
index 1a3fe9f..fd52f9e 100644 (file)
@@ -187,7 +187,7 @@ void AliGenTunedOnPbPb::Generate()
       Double_t phi = fgV2->GetRandom(-TMath::Pi(),TMath::Pi());
       Double_t px = pt*TMath::Cos(phi);
       Double_t py = pt*TMath::Sin(phi);
-      Float_t p[3] = {px,py,pz};
+      Float_t p[3] = {static_cast<Float_t>(px),static_cast<Float_t>(py),static_cast<Float_t>(pz)};
       Float_t polar[3] = {0.,0.,0.};
       
       if(TMath::Abs(y)< fYlimitForFlatness || gRandom->Rndm() < 1 - fYdecreaseSp*(TMath::Abs(y) - fYlimitForFlatness)){// check on pseudorapidity distribution
index 4b81d41..ac5ce4e 100644 (file)
@@ -135,24 +135,24 @@ void AliFITv0::CreateGeometry()
   
   
   //mother tube
-   gMC->Gsvolu("0STR","TUBE",idtmed[kAir],pstart,18);
-   gMC->Gspos("0STR",1,"ALIC",0.,0.,-zdetC-pstart[2],idrotm[901],"ONLY");
-   gMC->Gspos("0STR",2,"ALIC",0.,0.,zdetA+pstart[2],0,"ONLY");
+   TVirtualMC::GetMC()->Gsvolu("0STR","TUBE",idtmed[kAir],pstart,18);
+   TVirtualMC::GetMC()->Gspos("0STR",1,"ALIC",0.,0.,-zdetC-pstart[2],idrotm[901],"ONLY");
+   TVirtualMC::GetMC()->Gspos("0STR",2,"ALIC",0.,0.,zdetA+pstart[2],0,"ONLY");
    
    //T0 interior
-   gMC->Gsvolu("0INS","BOX",idtmed[kAir],pinstart,3);
+   TVirtualMC::GetMC()->Gsvolu("0INS","BOX",idtmed[kAir],pinstart,3);
     z=-pstart[2]+pinstart[2];
    for (Int_t is=0; is<20; is++) {
-     gMC->Gspos ("0INS", is + 1, "0STR", x1[is], y1[is], z, 0, "ONLY");
-     gMC->Gspos ("0INS", is + 21, "0STR", x1[is], y1[is], z, 0, "ONLY");
+     TVirtualMC::GetMC()->Gspos ("0INS", is + 1, "0STR", x1[is], y1[is], z, 0, "ONLY");
+     TVirtualMC::GetMC()->Gspos ("0INS", is + 21, "0STR", x1[is], y1[is], z, 0, "ONLY");
      printf(" 0INS is %i x %f y %f z %f \n",is, x1[is],y1[is], z);
    }
    // 
   x=y=0;
   // Entry window (glass)
-  gMC->Gsvolu("0TOP","BOX",idtmed[kAir],ptop,3); //glass
-  gMC->Gsvolu ("0REG", "BOX", idtmed[kSensAir], preg, 3); 
-  gMC->Gsvolu("0MCP","BOX",idtmed[kGlass],pmcp,3); //glass
+  TVirtualMC::GetMC()->Gsvolu("0TOP","BOX",idtmed[kAir],ptop,3); //glass
+  TVirtualMC::GetMC()->Gsvolu ("0REG", "BOX", idtmed[kSensAir], preg, 3); 
+  TVirtualMC::GetMC()->Gsvolu("0MCP","BOX",idtmed[kGlass],pmcp,3); //glass
   Int_t ntops=0;
   Float_t xin=0, yin=0;
   for (Int_t ix=0; ix<4; ix++) {
@@ -161,10 +161,10 @@ void AliFITv0::CreateGeometry()
       z = - pinstart[2]+ptop[2];
       yin = - pinstart[1] + 0.35 + (iy+0.5)*2*ptop[1];
       ntops++;
-      gMC->Gspos("0TOP",ntops,"0INS",xin,yin,z,0,"ONLY");
+      TVirtualMC::GetMC()->Gspos("0TOP",ntops,"0INS",xin,yin,z,0,"ONLY");
      //   printf(" 0TOP  full x %f y %f z %f \n", xin, yin, z);
       z = -pinstart[2] + 2 * ptop[2] + preg[2];
-      gMC->Gspos ("0REG",ntops, "0INS", xin, yin, z, 0, "ONLY");
+      TVirtualMC::GetMC()->Gspos ("0REG",ntops, "0INS", xin, yin, z, 0, "ONLY");
       printf(" GEOGEO  %i %i %i %f %f %f %f %f %f", ntops, ix, iy,
             xin,yin,x1[ntops],y1[ntops],x1[ntops]+xin,y1[ntops]+yin);
     }
@@ -173,7 +173,7 @@ void AliFITv0::CreateGeometry()
  // MCP
  //  TGeoVolume* mcp =  gGeoManager->MakeBox("0MCP",kMedMCPGlass, 2.95, 2.95, 1.5);  
    z=-pinstart[2] + 2*ptop[2] + 2*preg[2] + pmcp[2];
-   gMC->Gspos("0MCP",1,"0INS",0,0,z,0,"ONLY");
+   TVirtualMC::GetMC()->Gspos("0MCP",1,"0INS",0,0,z,0,"ONLY");
     
 }    
 //------------------------------------------------------------------------
@@ -248,7 +248,7 @@ void AliFITv0::Init()
   // Initialises version 0 of the Forward Multiplicity Detector
   //
   AliFIT::Init();
-  fIdSens1=gMC->VolId("0REG");
+  fIdSens1=TVirtualMC::GetMC()->VolId("0REG");
   
   AliDebug(1,Form("%s: *** FIT version 0 initialized ***\n",ClassName()));
 }
@@ -268,16 +268,16 @@ void AliFITv0::StepManager()
   
   //   TClonesArray &lhits = *fHits;
   
-  if(!gMC->IsTrackAlive()) return; // particle has disappeared
+  if(!TVirtualMC::GetMC()->IsTrackAlive()) return; // particle has disappeared
   
-  id=gMC->CurrentVolID(copy);  
+  id=TVirtualMC::GetMC()->CurrentVolID(copy);  
   // Check the sensetive volume
   if(id==fIdSens1 ) { 
-    if(gMC->IsTrackEntering()) {
-      gMC->CurrentVolOffID(1,copy1);
+    if(TVirtualMC::GetMC()->IsTrackEntering()) {
+      TVirtualMC::GetMC()->CurrentVolOffID(1,copy1);
       vol[1] = copy1;
       vol[0]=copy;
-      gMC->TrackPosition(pos);
+      TVirtualMC::GetMC()->TrackPosition(pos);
       hits[0] = pos[0];
       hits[1] = pos[1];
       hits[2] = pos[2];
@@ -285,19 +285,19 @@ void AliFITv0::StepManager()
       else vol[2] = 1 ;
       printf(" volumes pmt %i mcp %i side %i x %f y %f z %f\n",  vol[0], vol[1],  vol[2], hits[0], hits[1], hits[2] );
       
-      Float_t etot=gMC->Etot();
+      Float_t etot=TVirtualMC::GetMC()->Etot();
       hits[3]=etot;
-      Int_t iPart= gMC->TrackPid();
-      Int_t partID=gMC->IdFromPDG(iPart);
+      Int_t iPart= TVirtualMC::GetMC()->TrackPid();
+      Int_t partID=TVirtualMC::GetMC()->IdFromPDG(iPart);
       hits[4]=partID;
-      Float_t ttime=gMC->TrackTime();
+      Float_t ttime=TVirtualMC::GetMC()->TrackTime();
       hits[5]=ttime*1e12;
       AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,hits);
       // Create a track reference at the exit of photocatode
     }
     
     //charge particle 
-    if ( gMC->TrackCharge() )
+    if ( TVirtualMC::GetMC()->TrackCharge() )
       AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kFIT);
   } //sensitive
 
index 192ec2c..2b5efb4 100644 (file)
@@ -133,7 +133,7 @@ void AliFITv1::CreateGeometry()
    
   TGeoVolumeAssembly * stlin = new TGeoVolumeAssembly("0STL");//empty segment  
  //T0 interior
-  gMC->Gsvolu("0INS","BOX",idtmed[kAir],pinstart,3);
+  TVirtualMC::GetMC()->Gsvolu("0INS","BOX",idtmed[kAir],pinstart,3);
   TGeoVolume *ins = gGeoManager->GetVolume("0INS");
  // 
   TGeoTranslation *tr [20];
@@ -154,11 +154,11 @@ void AliFITv1::CreateGeometry()
   y=0;
    
   // Entry window (glass)
-  gMC->Gsvolu("0TOP","BOX",idtmed[kOpGlass],ptop,3); //glass
+  TVirtualMC::GetMC()->Gsvolu("0TOP","BOX",idtmed[kOpGlass],ptop,3); //glass
   TGeoVolume *top = gGeoManager->GetVolume("0TOP");
-  gMC->Gsvolu ("0REG", "BOX", idtmed[kOpGlassCathode], preg, 3); 
+  TVirtualMC::GetMC()->Gsvolu ("0REG", "BOX", idtmed[kOpGlassCathode], preg, 3); 
   TGeoVolume *cat = gGeoManager->GetVolume("0REG");
-  gMC->Gsvolu("0MCP","BOX",idtmed[kGlass],pmcp,3); //glass
+  TVirtualMC::GetMC()->Gsvolu("0MCP","BOX",idtmed[kGlass],pmcp,3); //glass
   TGeoVolume *mcp = gGeoManager->GetVolume("0MCP");
  
   Int_t ntops=0;
@@ -314,16 +314,16 @@ void AliFITv1::DefineOpticalProperties()
 
     }
   
-  gMC->SetCerenkov (idtmed[kOpGlass], kNbins, aPckov, aAbsSiO2, efficAll, rindexSiO2 );
-   // gMC->SetCerenkov (idtmed[kOpGlassCathode], kNbins, aPckov, aAbsSiO2, effCathode, rindexSiO2 );
-   gMC->SetCerenkov (idtmed[kOpGlassCathode], kNbins, aPckov, aAbsSiO2,efficAll , rindexSiO2 );
-   //  gMC->SetCerenkov (idtmed[kOpAir], kNbins, aPckov,absorAir , efficAll,rindexAir );
-   //   gMC->SetCerenkov (idtmed[kOpAirNext], kNbins, aPckov,absorbCathodeNext , efficAll, rindexCathodeNext);
+  TVirtualMC::GetMC()->SetCerenkov (idtmed[kOpGlass], kNbins, aPckov, aAbsSiO2, efficAll, rindexSiO2 );
+   // TVirtualMC::GetMC()->SetCerenkov (idtmed[kOpGlassCathode], kNbins, aPckov, aAbsSiO2, effCathode, rindexSiO2 );
+   TVirtualMC::GetMC()->SetCerenkov (idtmed[kOpGlassCathode], kNbins, aPckov, aAbsSiO2,efficAll , rindexSiO2 );
+   //  TVirtualMC::GetMC()->SetCerenkov (idtmed[kOpAir], kNbins, aPckov,absorAir , efficAll,rindexAir );
+   //   TVirtualMC::GetMC()->SetCerenkov (idtmed[kOpAirNext], kNbins, aPckov,absorbCathodeNext , efficAll, rindexCathodeNext);
 
    //Define a boarder for radiator optical properties
-   gMC->DefineOpSurface("surfRd", kUnified /*kGlisur*/,kDielectric_metal,kPolished, 0.);
-   gMC->SetMaterialProperty("surfRd", "EFFICIENCY", kNbins, dPckov, efficMet);
-   gMC->SetMaterialProperty("surfRd", "REFLECTIVITY", kNbins, dPckov, aReflMet);
+   TVirtualMC::GetMC()->DefineOpSurface("surfRd", kUnified /*kGlisur*/,kDielectric_metal,kPolished, 0.);
+   TVirtualMC::GetMC()->SetMaterialProperty("surfRd", "EFFICIENCY", kNbins, dPckov, efficMet);
+   TVirtualMC::GetMC()->SetMaterialProperty("surfRd", "REFLECTIVITY", kNbins, dPckov, aReflMet);
 
 
 }
@@ -334,7 +334,7 @@ void AliFITv1::Init()
 // Initialises version 0 of the Forward Multiplicity Detector
 //
   AliFIT::Init();
-  fIdSens1=gMC->VolId("0REG");
+  fIdSens1=TVirtualMC::GetMC()->VolId("0REG");
 
    AliDebug(1,Form("%s: *** FIT version 1 initialized ***\n",ClassName()));
 }
@@ -354,16 +354,16 @@ void AliFITv1::StepManager()
   
   //   TClonesArray &lhits = *fHits;
   
-  if(!gMC->IsTrackAlive()) return; // particle has disappeared
+  if(!TVirtualMC::GetMC()->IsTrackAlive()) return; // particle has disappeared
   
-  id=gMC->CurrentVolID(copy);  
+  id=TVirtualMC::GetMC()->CurrentVolID(copy);  
   // Check the sensetive volume
   if(id==fIdSens1 ) { 
-    if(gMC->IsTrackEntering()) {
-      gMC->CurrentVolOffID(1,copy1);
+    if(TVirtualMC::GetMC()->IsTrackEntering()) {
+      TVirtualMC::GetMC()->CurrentVolOffID(1,copy1);
       vol[1] = copy1;
       vol[0]=copy;
-      gMC->TrackPosition(pos);
+      TVirtualMC::GetMC()->TrackPosition(pos);
       hits[0] = pos[0];
       hits[1] = pos[1];
       hits[2] = pos[2];
@@ -371,14 +371,14 @@ void AliFITv1::StepManager()
       else vol[2] = 1 ;
       //      printf(" volumes pmt %i mcp %i side %i x %f y %f z %f\n",  vol[0], vol[1],  vol[2], hits[0], hits[1], hits[2] );
       
-      Float_t etot=gMC->Etot();
+      Float_t etot=TVirtualMC::GetMC()->Etot();
       hits[3]=etot;
-      Int_t iPart= gMC->TrackPid();
-      Int_t partID=gMC->IdFromPDG(iPart);
+      Int_t iPart= TVirtualMC::GetMC()->TrackPid();
+      Int_t partID=TVirtualMC::GetMC()->IdFromPDG(iPart);
       hits[4]=partID;
-      Float_t ttime=gMC->TrackTime();
+      Float_t ttime=TVirtualMC::GetMC()->TrackTime();
       hits[5]=ttime*1e12;
-      if (gMC->TrackPid() == 50000050)   // If particles is photon then ...
+      if (TVirtualMC::GetMC()->TrackPid() == 50000050)   // If particles is photon then ...
        {
          //      if(RegisterPhotoE(vol[1]-1,hits[3])) {
          if(RegisterPhotoE(hits[3])) {
@@ -388,7 +388,7 @@ void AliFITv1::StepManager()
        }
       
       //charge particle 
-      if ( gMC->TrackCharge() )
+      if ( TVirtualMC::GetMC()->TrackCharge() )
        AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kFIT);
       
      }// trck entering         
index aa0e671..9f950a9 100644 (file)
@@ -458,30 +458,30 @@ AliFMD::SetTrackingParameters(Int_t imed,
                              Int_t   rayleigh_scattering)
 {
   // Disabled by request of FCA, kept for reference only
-  if (!gMC) return;
+  if (!TVirtualMC::GetMC()) return;
   TArrayI& idtmed = *(GetIdtmed());
   Int_t    iimed  = idtmed[imed];
-  // gMC->Gstpar(iimed, "CUTGAM",      gamma);
-  // gMC->Gstpar(iimed, "CUTELE",      electron);
-  // gMC->Gstpar(iimed, "CUTNEU",      neutral_hadron);
-  // gMC->Gstpar(iimed, "CUTHAD",      charged_hadron);
-  // gMC->Gstpar(iimed, "CUTMUO",      muon);
-  // gMC->Gstpar(iimed, "BCUTE",       electron_bremstrahlung);
-  // gMC->Gstpar(iimed, "BCUTM",       muon__bremstrahlung);
-  // gMC->Gstpar(iimed, "DCUTE",       electron_delta);
-  // gMC->Gstpar(iimed, "DCUTM",       muon_delta);
-  // gMC->Gstpar(iimed, "PPCUTM",      muon_pair);
-  // gMC->Gstpar(iimed, "ANNI",        Float_t(annihilation));
-  // gMC->Gstpar(iimed, "BREM",        Float_t(bremstrahlung));
-  // gMC->Gstpar(iimed, "COMP",        Float_t(compton_scattering));
-  // gMC->Gstpar(iimed, "DCAY",        Float_t(decay));
-  // gMC->Gstpar(iimed, "DRAY",        Float_t(delta_ray));
-  // gMC->Gstpar(iimed, "HADR",        Float_t(hadronic));
-  // gMC->Gstpar(iimed, "LOSS",        Float_t(energy_loss));
-  // gMC->Gstpar(iimed, "MULS",        Float_t(multiple_scattering));
-  // gMC->Gstpar(iimed, "PAIR",        Float_t(pair_production));
-  // gMC->Gstpar(iimed, "PHOT",        Float_t(photon_production));
-  // gMC->Gstpar(iimed, "RAYL",        Float_t(rayleigh_scattering));
+  // TVirtualMC::GetMC()->Gstpar(iimed, "CUTGAM",      gamma);
+  // TVirtualMC::GetMC()->Gstpar(iimed, "CUTELE",      electron);
+  // TVirtualMC::GetMC()->Gstpar(iimed, "CUTNEU",      neutral_hadron);
+  // TVirtualMC::GetMC()->Gstpar(iimed, "CUTHAD",      charged_hadron);
+  // TVirtualMC::GetMC()->Gstpar(iimed, "CUTMUO",      muon);
+  // TVirtualMC::GetMC()->Gstpar(iimed, "BCUTE",       electron_bremstrahlung);
+  // TVirtualMC::GetMC()->Gstpar(iimed, "BCUTM",       muon__bremstrahlung);
+  // TVirtualMC::GetMC()->Gstpar(iimed, "DCUTE",       electron_delta);
+  // TVirtualMC::GetMC()->Gstpar(iimed, "DCUTM",       muon_delta);
+  // TVirtualMC::GetMC()->Gstpar(iimed, "PPCUTM",      muon_pair);
+  // TVirtualMC::GetMC()->Gstpar(iimed, "ANNI",        Float_t(annihilation));
+  // TVirtualMC::GetMC()->Gstpar(iimed, "BREM",        Float_t(bremstrahlung));
+  // TVirtualMC::GetMC()->Gstpar(iimed, "COMP",        Float_t(compton_scattering));
+  // TVirtualMC::GetMC()->Gstpar(iimed, "DCAY",        Float_t(decay));
+  // TVirtualMC::GetMC()->Gstpar(iimed, "DRAY",        Float_t(delta_ray));
+  // TVirtualMC::GetMC()->Gstpar(iimed, "HADR",        Float_t(hadronic));
+  // TVirtualMC::GetMC()->Gstpar(iimed, "LOSS",        Float_t(energy_loss));
+  // TVirtualMC::GetMC()->Gstpar(iimed, "MULS",        Float_t(multiple_scattering));
+  // TVirtualMC::GetMC()->Gstpar(iimed, "PAIR",        Float_t(pair_production));
+  // TVirtualMC::GetMC()->Gstpar(iimed, "PHOT",        Float_t(photon_production));
+  // TVirtualMC::GetMC()->Gstpar(iimed, "RAYL",        Float_t(rayleigh_scattering));
 }
 #endif
 
@@ -730,7 +730,7 @@ AliFMD::AddHitByFields(Int_t    track,
   hit = new (a[fNhits]) AliFMDHit(fIshunt, track, detector, ring, sector, 
                                  strip, x, y, z, px, py, pz, edep, pdg, t, 
                                  l, stop);
-  // gMC->AddTrackReference(track, 12);
+  // TVirtualMC::GetMC()->AddTrackReference(track, 12);
   fNhits++;
   
   //Reference track
index ebcdba1..1b64a0f 100644 (file)
@@ -85,7 +85,7 @@ AliHLTComponent::AliHLTComponent()
   fpStopwatches(new TObjArray(kSWTypeCount)),
   fMemFiles(),
   fpRunDesc(NULL),
-  fCDBSetRunNoFunc(false),
+  fCDBSetRunNoFunc(NULL),
   fChainId(),
   fChainIdCrc(0),
   fpBenchmark(NULL),
index dc26fc4..cde658f 100644 (file)
@@ -43,7 +43,7 @@ ClassImp(AliHLTCaloClusterizerComponent);
 AliHLTCaloClusterizerComponent::AliHLTCaloClusterizerComponent(TString det):
         AliHLTCaloProcessor(),
         AliHLTCaloConstantsHandler(det),
-        fDataOrigin('\0'),
+        fDataOrigin(0),
         fAnalyserPtr(0),
         fRecoParamsPtr(0),
         fClusterizerPtr(0),
index 0ce7e8d..5d89fd4 100644 (file)
@@ -20,7 +20,7 @@
 #include "AliHMPIDDigit.h"  //Digits2Raw(), Raw2SDigits()
 #include "AliHMPIDRawStream.h"  //Digits2Raw(), Raw2SDigits()
 #include "AliRawReader.h"  //Raw2SDigits()
-#include <TVirtualMC.h>    //StepManager() for gMC
+#include <TVirtualMC.h>    //StepManager() for TVirtualMC::GetMC()
 #include <TPDGCode.h>      //StepHistory() 
 #include <AliStack.h>      //StepManager(),Hits2SDigits()
 #include <AliLoader.h>        //Hits2SDigits()
@@ -93,7 +93,7 @@ void AliHMPIDv1::CreateGeometry()
 {
 //Creates detailed geometry simulation (currently GEANT volumes tree)         
   AliDebug(1,"Start main.");
-  if(!gMC->IsRootGeometrySupported()) return;     
+  if(!TVirtualMC::GetMC()->IsRootGeometrySupported()) return;     
   
   Double_t cm=1,mm=0.1*cm,mkm=0.001*mm,dx,dy,dz;//default is cm
   
@@ -109,90 +109,90 @@ void AliHMPIDv1::CreateGeometry()
   Float_t par[3];
   Int_t matrixIdReturn=0; //matrix id returned by AliMatrix
 //Pad Panel frame  6 sectors
-  par[0]=648*mm/2;par[1]=  411*mm/2;par[2]=40  *mm/2;gMC->Gsvolu("Rppf"     ,"BOX ",(*fIdtmed)[kAl]  ,par,3);//PPF 2001P2 inner size of the slab by 1mm more
-  par[0]=181*mm/2;par[1]=89.25*mm/2;par[2]=38.3*mm/2;gMC->Gsvolu("RppfLarge","BOX ",(*fIdtmed)[kAir] ,par,3);//large whole
-  par[0]=114*mm/2;par[1]=89.25*mm/2;par[2]=38.3*mm/2;gMC->Gsvolu("RppfSmall","BOX ",(*fIdtmed)[kAir] ,par,3);//small whole
-  par[0]=644*mm/2;par[1]=  407*mm/2;par[2]= 1.7*mm/2;gMC->Gsvolu("Rpc"      ,"BOX ",(*fIdtmed)[kCsI] ,par,3);//by 0.2 mm more then actual size (PCB 2006P1)
+  par[0]=648*mm/2;par[1]=  411*mm/2;par[2]=40  *mm/2;TVirtualMC::GetMC()->Gsvolu("Rppf"     ,"BOX ",(*fIdtmed)[kAl]  ,par,3);//PPF 2001P2 inner size of the slab by 1mm more
+  par[0]=181*mm/2;par[1]=89.25*mm/2;par[2]=38.3*mm/2;TVirtualMC::GetMC()->Gsvolu("RppfLarge","BOX ",(*fIdtmed)[kAir] ,par,3);//large whole
+  par[0]=114*mm/2;par[1]=89.25*mm/2;par[2]=38.3*mm/2;TVirtualMC::GetMC()->Gsvolu("RppfSmall","BOX ",(*fIdtmed)[kAir] ,par,3);//small whole
+  par[0]=644*mm/2;par[1]=  407*mm/2;par[2]= 1.7*mm/2;TVirtualMC::GetMC()->Gsvolu("Rpc"      ,"BOX ",(*fIdtmed)[kCsI] ,par,3);//by 0.2 mm more then actual size (PCB 2006P1)
   
-  gMC->Gspos("Rppf",0,"HMPID",    -335*mm,      -433*mm,  8*cm+20*mm,  0,"ONLY");//F1 2040P1 z p.84 TDR
-  gMC->Gspos("Rppf",1,"HMPID",    +335*mm,      -433*mm,  8*cm+20*mm,  0,"ONLY");
-  gMC->Gspos("Rppf",2,"HMPID",    -335*mm,         0*mm,  8*cm+20*mm,  0,"ONLY");
-  gMC->Gspos("Rppf",3,"HMPID",    +335*mm,         0*mm,  8*cm+20*mm,  0,"ONLY");
-  gMC->Gspos("Rppf",4,"HMPID",    -335*mm,      +433*mm,  8*cm+20*mm,  0,"ONLY");
-  gMC->Gspos("Rppf",5,"HMPID",    +335*mm,      +433*mm,  8*cm+20*mm,  0,"ONLY");  
-    gMC->Gspos("Rpc"      ,1,"Rppf",       0*mm,         0*mm,   -19.15*mm,  0,"ONLY");//PPF 2001P2 
-    gMC->Gspos("RppfLarge",1,"Rppf",  -224.5*mm,  -151.875*mm,     0.85*mm,  0,"ONLY");
-    gMC->Gspos("RppfLarge",2,"Rppf",  -224.5*mm,  - 50.625*mm,     0.85*mm,  0,"ONLY");
-    gMC->Gspos("RppfLarge",3,"Rppf",  -224.5*mm,  + 50.625*mm,     0.85*mm,  0,"ONLY");
-    gMC->Gspos("RppfLarge",4,"Rppf",  -224.5*mm,  +151.875*mm,     0.85*mm,  0,"ONLY");
-    gMC->Gspos("RppfSmall",1,"Rppf",  - 65.0*mm,  -151.875*mm,     0.85*mm,  0,"ONLY");
-    gMC->Gspos("RppfSmall",2,"Rppf",  - 65.0*mm,  - 50.625*mm,     0.85*mm,  0,"ONLY");
-    gMC->Gspos("RppfSmall",3,"Rppf",  - 65.0*mm,  + 50.625*mm,     0.85*mm,  0,"ONLY");
-    gMC->Gspos("RppfSmall",4,"Rppf",  - 65.0*mm,  +151.875*mm,     0.85*mm,  0,"ONLY");
-    gMC->Gspos("RppfSmall",5,"Rppf",  + 65.0*mm,  -151.875*mm,     0.85*mm,  0,"ONLY");
-    gMC->Gspos("RppfSmall",6,"Rppf",  + 65.0*mm,  - 50.625*mm,     0.85*mm,  0,"ONLY");
-    gMC->Gspos("RppfSmall",7,"Rppf",  + 65.0*mm,  + 50.625*mm,     0.85*mm,  0,"ONLY");
-    gMC->Gspos("RppfSmall",8,"Rppf",  + 65.0*mm,  +151.875*mm,     0.85*mm,  0,"ONLY"); 
-    gMC->Gspos("RppfLarge",5,"Rppf",  +224.5*mm,  -151.875*mm,     0.85*mm,  0,"ONLY");
-    gMC->Gspos("RppfLarge",6,"Rppf",  +224.5*mm,  - 50.625*mm,     0.85*mm,  0,"ONLY");
-    gMC->Gspos("RppfLarge",7,"Rppf",  +224.5*mm,  + 50.625*mm,     0.85*mm,  0,"ONLY");
-    gMC->Gspos("RppfLarge",8,"Rppf",  +224.5*mm,  +151.875*mm,     0.85*mm,  0,"ONLY");
+  TVirtualMC::GetMC()->Gspos("Rppf",0,"HMPID",    -335*mm,      -433*mm,  8*cm+20*mm,  0,"ONLY");//F1 2040P1 z p.84 TDR
+  TVirtualMC::GetMC()->Gspos("Rppf",1,"HMPID",    +335*mm,      -433*mm,  8*cm+20*mm,  0,"ONLY");
+  TVirtualMC::GetMC()->Gspos("Rppf",2,"HMPID",    -335*mm,         0*mm,  8*cm+20*mm,  0,"ONLY");
+  TVirtualMC::GetMC()->Gspos("Rppf",3,"HMPID",    +335*mm,         0*mm,  8*cm+20*mm,  0,"ONLY");
+  TVirtualMC::GetMC()->Gspos("Rppf",4,"HMPID",    -335*mm,      +433*mm,  8*cm+20*mm,  0,"ONLY");
+  TVirtualMC::GetMC()->Gspos("Rppf",5,"HMPID",    +335*mm,      +433*mm,  8*cm+20*mm,  0,"ONLY");  
+    TVirtualMC::GetMC()->Gspos("Rpc"      ,1,"Rppf",       0*mm,         0*mm,   -19.15*mm,  0,"ONLY");//PPF 2001P2 
+    TVirtualMC::GetMC()->Gspos("RppfLarge",1,"Rppf",  -224.5*mm,  -151.875*mm,     0.85*mm,  0,"ONLY");
+    TVirtualMC::GetMC()->Gspos("RppfLarge",2,"Rppf",  -224.5*mm,  - 50.625*mm,     0.85*mm,  0,"ONLY");
+    TVirtualMC::GetMC()->Gspos("RppfLarge",3,"Rppf",  -224.5*mm,  + 50.625*mm,     0.85*mm,  0,"ONLY");
+    TVirtualMC::GetMC()->Gspos("RppfLarge",4,"Rppf",  -224.5*mm,  +151.875*mm,     0.85*mm,  0,"ONLY");
+    TVirtualMC::GetMC()->Gspos("RppfSmall",1,"Rppf",  - 65.0*mm,  -151.875*mm,     0.85*mm,  0,"ONLY");
+    TVirtualMC::GetMC()->Gspos("RppfSmall",2,"Rppf",  - 65.0*mm,  - 50.625*mm,     0.85*mm,  0,"ONLY");
+    TVirtualMC::GetMC()->Gspos("RppfSmall",3,"Rppf",  - 65.0*mm,  + 50.625*mm,     0.85*mm,  0,"ONLY");
+    TVirtualMC::GetMC()->Gspos("RppfSmall",4,"Rppf",  - 65.0*mm,  +151.875*mm,     0.85*mm,  0,"ONLY");
+    TVirtualMC::GetMC()->Gspos("RppfSmall",5,"Rppf",  + 65.0*mm,  -151.875*mm,     0.85*mm,  0,"ONLY");
+    TVirtualMC::GetMC()->Gspos("RppfSmall",6,"Rppf",  + 65.0*mm,  - 50.625*mm,     0.85*mm,  0,"ONLY");
+    TVirtualMC::GetMC()->Gspos("RppfSmall",7,"Rppf",  + 65.0*mm,  + 50.625*mm,     0.85*mm,  0,"ONLY");
+    TVirtualMC::GetMC()->Gspos("RppfSmall",8,"Rppf",  + 65.0*mm,  +151.875*mm,     0.85*mm,  0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("RppfLarge",5,"Rppf",  +224.5*mm,  -151.875*mm,     0.85*mm,  0,"ONLY");
+    TVirtualMC::GetMC()->Gspos("RppfLarge",6,"Rppf",  +224.5*mm,  - 50.625*mm,     0.85*mm,  0,"ONLY");
+    TVirtualMC::GetMC()->Gspos("RppfLarge",7,"Rppf",  +224.5*mm,  + 50.625*mm,     0.85*mm,  0,"ONLY");
+    TVirtualMC::GetMC()->Gspos("RppfLarge",8,"Rppf",  +224.5*mm,  +151.875*mm,     0.85*mm,  0,"ONLY");
 //Gap - anod wires 6 copies to HMPID
-  par[0]=648*mm/2;par[1]=  411*mm/2 ;par[2]=4.45*mm/2;gMC->Gsvolu("Rgap","BOX ",(*fIdtmed)[kCH4] ,par,3);//xy as PPF 2001P2 z WP 2099P1
-  par[0]=  0*mm  ;par[1]=  20*mkm/2 ;par[2]= 648*mm/2;gMC->Gsvolu("Rano","TUBE",(*fIdtmed)[kW]   ,par,3);//WP 2099P1 z = gap x PPF 2001P2
+  par[0]=648*mm/2;par[1]=  411*mm/2 ;par[2]=4.45*mm/2;TVirtualMC::GetMC()->Gsvolu("Rgap","BOX ",(*fIdtmed)[kCH4] ,par,3);//xy as PPF 2001P2 z WP 2099P1
+  par[0]=  0*mm  ;par[1]=  20*mkm/2 ;par[2]= 648*mm/2;TVirtualMC::GetMC()->Gsvolu("Rano","TUBE",(*fIdtmed)[kW]   ,par,3);//WP 2099P1 z = gap x PPF 2001P2
   AliMatrix(matrixIdReturn,180,0, 90,90, 90,0); //wires along x
   
-  gMC->Gspos("Rgap",0,"HMPID",    -335*mm,      -433*mm,8*cm-2.225*mm, 0,"ONLY"); //F1 2040P1 z WP 2099P1
-  gMC->Gspos("Rgap",1,"HMPID",    +335*mm,      -433*mm,8*cm-2.225*mm, 0,"ONLY"); 
-  gMC->Gspos("Rgap",2,"HMPID",    -335*mm,         0*mm,8*cm-2.225*mm, 0,"ONLY"); 
-  gMC->Gspos("Rgap",3,"HMPID",    +335*mm,         0*mm,8*cm-2.225*mm, 0,"ONLY"); 
-  gMC->Gspos("Rgap",4,"HMPID",    -335*mm,      +433*mm,8*cm-2.225*mm, 0,"ONLY"); 
-  gMC->Gspos("Rgap",5,"HMPID",    +335*mm,      +433*mm,8*cm-2.225*mm, 0,"ONLY"); 
+  TVirtualMC::GetMC()->Gspos("Rgap",0,"HMPID",    -335*mm,      -433*mm,8*cm-2.225*mm, 0,"ONLY"); //F1 2040P1 z WP 2099P1
+  TVirtualMC::GetMC()->Gspos("Rgap",1,"HMPID",    +335*mm,      -433*mm,8*cm-2.225*mm, 0,"ONLY"); 
+  TVirtualMC::GetMC()->Gspos("Rgap",2,"HMPID",    -335*mm,         0*mm,8*cm-2.225*mm, 0,"ONLY"); 
+  TVirtualMC::GetMC()->Gspos("Rgap",3,"HMPID",    +335*mm,         0*mm,8*cm-2.225*mm, 0,"ONLY"); 
+  TVirtualMC::GetMC()->Gspos("Rgap",4,"HMPID",    -335*mm,      +433*mm,8*cm-2.225*mm, 0,"ONLY"); 
+  TVirtualMC::GetMC()->Gspos("Rgap",5,"HMPID",    +335*mm,      +433*mm,8*cm-2.225*mm, 0,"ONLY"); 
   for(int i=1;i<=96;i++)
-    gMC->Gspos("Rano",i,"Rgap",     0*mm, -411/2*mm+i*4*mm, 0.185*mm, matrixIdReturn,"ONLY"); //WP 2099P1  
+    TVirtualMC::GetMC()->Gspos("Rano",i,"Rgap",     0*mm, -411/2*mm+i*4*mm, 0.185*mm, matrixIdReturn,"ONLY"); //WP 2099P1  
 //Defines radiators geometry  
-  par[0]=1330*mm/2 ;par[1]= 413*mm/2  ;par[2]=  24*mm/2;  gMC->Gsvolu("Rrad"      ,"BOX ",(*fIdtmed)[kC6F14]     ,par,3); // Rad 2011P1
-  par[0]=1330*mm/2 ;par[1]= 413*mm/2  ;par[2]=   4*mm/2;  gMC->Gsvolu("RradFront" ,"BOX ",(*fIdtmed)[kRoha]      ,par,3); //front 
-  par[0]=1330*mm/2 ;par[1]= 413*mm/2  ;par[2]=   5*mm/2;  gMC->Gsvolu("RradWin"   ,"BOX ",(*fIdtmed)[kSiO2]      ,par,3); //window
-  par[0]=1330*mm/2 ;par[1]=   5*mm/2  ;par[2]=  15*mm/2;  gMC->Gsvolu("RradLong"  ,"BOX ",(*fIdtmed)[kRoha]      ,par,3); //long side  
-  par[0]=  10*mm/2 ;par[1]= 403*mm/2  ;par[2]=  15*mm/2;  gMC->Gsvolu("RradShort" ,"BOX ",(*fIdtmed)[kRoha]      ,par,3); //short side 
-  par[0]=   0      ;par[1]=  10*mm/2  ;par[2]=  15*mm/2;  gMC->Gsvolu("RradSpacer","TUBE",(*fIdtmed)[kSiO2]      ,par,3); //spacer        
+  par[0]=1330*mm/2 ;par[1]= 413*mm/2  ;par[2]=  24*mm/2;  TVirtualMC::GetMC()->Gsvolu("Rrad"      ,"BOX ",(*fIdtmed)[kC6F14]     ,par,3); // Rad 2011P1
+  par[0]=1330*mm/2 ;par[1]= 413*mm/2  ;par[2]=   4*mm/2;  TVirtualMC::GetMC()->Gsvolu("RradFront" ,"BOX ",(*fIdtmed)[kRoha]      ,par,3); //front 
+  par[0]=1330*mm/2 ;par[1]= 413*mm/2  ;par[2]=   5*mm/2;  TVirtualMC::GetMC()->Gsvolu("RradWin"   ,"BOX ",(*fIdtmed)[kSiO2]      ,par,3); //window
+  par[0]=1330*mm/2 ;par[1]=   5*mm/2  ;par[2]=  15*mm/2;  TVirtualMC::GetMC()->Gsvolu("RradLong"  ,"BOX ",(*fIdtmed)[kRoha]      ,par,3); //long side  
+  par[0]=  10*mm/2 ;par[1]= 403*mm/2  ;par[2]=  15*mm/2;  TVirtualMC::GetMC()->Gsvolu("RradShort" ,"BOX ",(*fIdtmed)[kRoha]      ,par,3); //short side 
+  par[0]=   0      ;par[1]=  10*mm/2  ;par[2]=  15*mm/2;  TVirtualMC::GetMC()->Gsvolu("RradSpacer","TUBE",(*fIdtmed)[kSiO2]      ,par,3); //spacer        
     
-  gMC->Gspos("Rrad",1,"HMPID",   0*mm,-434*mm,   -12*mm,  0,"ONLY"); //3 radiators to HMPID
-  gMC->Gspos("Rrad",2,"HMPID",   0*mm,   0*mm,   -12*mm,  0,"ONLY"); 
-  gMC->Gspos("Rrad",3,"HMPID",   0*mm,+434*mm,   -12*mm,  0,"ONLY"); 
-    gMC->Gspos("RradFront",1,"Rrad",   0*mm,   0*mm, -10.0*mm,  0,"ONLY"); //front cover 
-    gMC->Gspos("RradWin"  ,1,"Rrad",   0*mm,   0*mm,   9.5*mm,  0,"ONLY"); //quartz window (back cover)
-    gMC->Gspos("RradLong" ,1,"Rrad",   0*mm,-204*mm,  -0.5*mm,  0,"ONLY"); //long side
-    gMC->Gspos("RradLong" ,2,"Rrad",   0*mm,+204*mm,  -0.5*mm,  0,"ONLY"); //long side
-    gMC->Gspos("RradShort",1,"Rrad",-660*mm,   0*mm,  -0.5*mm,  0,"ONLY"); //short side
-    gMC->Gspos("RradShort",2,"Rrad",+660*mm,   0*mm,  -0.5*mm,  0,"ONLY"); //short side 
+  TVirtualMC::GetMC()->Gspos("Rrad",1,"HMPID",   0*mm,-434*mm,   -12*mm,  0,"ONLY"); //3 radiators to HMPID
+  TVirtualMC::GetMC()->Gspos("Rrad",2,"HMPID",   0*mm,   0*mm,   -12*mm,  0,"ONLY"); 
+  TVirtualMC::GetMC()->Gspos("Rrad",3,"HMPID",   0*mm,+434*mm,   -12*mm,  0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("RradFront",1,"Rrad",   0*mm,   0*mm, -10.0*mm,  0,"ONLY"); //front cover 
+    TVirtualMC::GetMC()->Gspos("RradWin"  ,1,"Rrad",   0*mm,   0*mm,   9.5*mm,  0,"ONLY"); //quartz window (back cover)
+    TVirtualMC::GetMC()->Gspos("RradLong" ,1,"Rrad",   0*mm,-204*mm,  -0.5*mm,  0,"ONLY"); //long side
+    TVirtualMC::GetMC()->Gspos("RradLong" ,2,"Rrad",   0*mm,+204*mm,  -0.5*mm,  0,"ONLY"); //long side
+    TVirtualMC::GetMC()->Gspos("RradShort",1,"Rrad",-660*mm,   0*mm,  -0.5*mm,  0,"ONLY"); //short side
+    TVirtualMC::GetMC()->Gspos("RradShort",2,"Rrad",+660*mm,   0*mm,  -0.5*mm,  0,"ONLY"); //short side 
     for(int i=0;i<3;i++)
       for(int j=0;j<10;j++)
-        gMC->Gspos("RradSpacer",10*i+j,"Rrad",-1330*mm/2+116*mm+j*122*mm,(i-1)*105*mm,-0.5*mm,0,"ONLY");//spacers
+        TVirtualMC::GetMC()->Gspos("RradSpacer",10*i+j,"Rrad",-1330*mm/2+116*mm+j*122*mm,(i-1)*105*mm,-0.5*mm,0,"ONLY");//spacers
 //Defines SandBox geometry
-  par[0]=1419*mm/2 ;par[1]=1378*mm/2;par[2]=50.5*mm/2; gMC->Gsvolu("Rsb"     ,"BOX ",(*fIdtmed)[kAir]  ,par,3);  //2072P1   
-  par[0]=1419*mm/2 ;par[1]=1378*mm/2;par[2]= 0.5*mm/2; gMC->Gsvolu("RsbCover","BOX ",(*fIdtmed)[kAl]   ,par,3);  //cover
-  par[0]=1359*mm/2 ;par[1]=1318*mm/2;par[2]=49.5*mm/2; gMC->Gsvolu("RsbComb" ,"BOX ",(*fIdtmed)[kRoha] ,par,3);  //honeycomb structure 
+  par[0]=1419*mm/2 ;par[1]=1378*mm/2;par[2]=50.5*mm/2; TVirtualMC::GetMC()->Gsvolu("Rsb"     ,"BOX ",(*fIdtmed)[kAir]  ,par,3);  //2072P1   
+  par[0]=1419*mm/2 ;par[1]=1378*mm/2;par[2]= 0.5*mm/2; TVirtualMC::GetMC()->Gsvolu("RsbCover","BOX ",(*fIdtmed)[kAl]   ,par,3);  //cover
+  par[0]=1359*mm/2 ;par[1]=1318*mm/2;par[2]=49.5*mm/2; TVirtualMC::GetMC()->Gsvolu("RsbComb" ,"BOX ",(*fIdtmed)[kRoha] ,par,3);  //honeycomb structure 
   
-  gMC->Gspos("Rsb",1,"HMPID",   0*mm, 0*mm, -73.75*mm, 0,"ONLY"); //p.84 TDR sandbox to rich
-    gMC->Gspos("RsbComb" ,1,"Rsb", 0*mm, 0*mm,      0*mm, 0,"ONLY"); //2072P1 honeycomv to sandbox
-    gMC->Gspos("RsbCover",1,"Rsb", 0*mm, 0*mm,    +25*mm, 0,"ONLY"); //cover to sandbox
-    gMC->Gspos("RsbCover",2,"Rsb", 0*mm, 0*mm,    -25*mm, 0,"ONLY"); //cover to sandbox
+  TVirtualMC::GetMC()->Gspos("Rsb",1,"HMPID",   0*mm, 0*mm, -73.75*mm, 0,"ONLY"); //p.84 TDR sandbox to rich
+    TVirtualMC::GetMC()->Gspos("RsbComb" ,1,"Rsb", 0*mm, 0*mm,      0*mm, 0,"ONLY"); //2072P1 honeycomv to sandbox
+    TVirtualMC::GetMC()->Gspos("RsbCover",1,"Rsb", 0*mm, 0*mm,    +25*mm, 0,"ONLY"); //cover to sandbox
+    TVirtualMC::GetMC()->Gspos("RsbCover",2,"Rsb", 0*mm, 0*mm,    -25*mm, 0,"ONLY"); //cover to sandbox
   AliDebug(1,"Stop v1. HMPID option");  
 }//CreateGeometry()
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void AliHMPIDv1::Init()
 {
-// This methode defines ID for sensitive volumes, i.e. such geometry volumes for which there are if(gMC->CurrentVolID()==XXX) statements in StepManager()
+// This methode defines ID for sensitive volumes, i.e. such geometry volumes for which there are if(TVirtualMC::GetMC()->CurrentVolID()==XXX) statements in StepManager()
 // Arguments: none
 //   Returns: none      
   AliDebug(1,"Start v1 HMPID.");    
-  fIdRad     = gMC->VolId("Rrad");
-  fIdWin     = gMC->VolId("RradWin");
-  fIdPc      = gMC->VolId("Rpc");
-  fIdAmpGap  = gMC->VolId("Rgap");
-  fIdProxGap = gMC->VolId("Rgap");
+  fIdRad     = TVirtualMC::GetMC()->VolId("Rrad");
+  fIdWin     = TVirtualMC::GetMC()->VolId("RradWin");
+  fIdPc      = TVirtualMC::GetMC()->VolId("Rpc");
+  fIdAmpGap  = TVirtualMC::GetMC()->VolId("Rgap");
+  fIdProxGap = TVirtualMC::GetMC()->VolId("Rgap");
 
   AliDebug(1,"Stop v1 HMPID.");    
 }
@@ -233,19 +233,19 @@ void AliHMPIDv1::DefineOpticalProperties()
     dQePc [i]=pQeF->Eval(eV);
     dReflMet[i] = 0.;     // no reflection on the surface of the pc (?)                                       
   }
-  gMC->SetCerenkov((*fIdtmed)[kC6F14]    , kNbins, aEckov, aAbsRad  , aQeAll , aIdxRad );    
-  gMC->SetCerenkov((*fIdtmed)[kSiO2]     , kNbins, aEckov, aAbsWin  , aQeAll , aIdxWin );    
-  gMC->SetCerenkov((*fIdtmed)[kCH4]      , kNbins, aEckov, aAbsGap  , aQeAll , aIdxGap );    
-  gMC->SetCerenkov((*fIdtmed)[kCu]       , kNbins, aEckov, aAbsMet  , aQeAll , aIdxMet );    
-  gMC->SetCerenkov((*fIdtmed)[kW]        , kNbins, aEckov, aAbsMet  , aQeAll , aIdxMet ); //n=0 means reflect photons       
-  gMC->SetCerenkov((*fIdtmed)[kCsI]      , kNbins, aEckov, aAbsMet  , aQePc  , aIdxPc  ); //n=1 means convert photons    
-  gMC->SetCerenkov((*fIdtmed)[kAl]       , kNbins, aEckov, aAbsMet  , aQeAll , aIdxMet );    
+  TVirtualMC::GetMC()->SetCerenkov((*fIdtmed)[kC6F14]    , kNbins, aEckov, aAbsRad  , aQeAll , aIdxRad );    
+  TVirtualMC::GetMC()->SetCerenkov((*fIdtmed)[kSiO2]     , kNbins, aEckov, aAbsWin  , aQeAll , aIdxWin );    
+  TVirtualMC::GetMC()->SetCerenkov((*fIdtmed)[kCH4]      , kNbins, aEckov, aAbsGap  , aQeAll , aIdxGap );    
+  TVirtualMC::GetMC()->SetCerenkov((*fIdtmed)[kCu]       , kNbins, aEckov, aAbsMet  , aQeAll , aIdxMet );    
+  TVirtualMC::GetMC()->SetCerenkov((*fIdtmed)[kW]        , kNbins, aEckov, aAbsMet  , aQeAll , aIdxMet ); //n=0 means reflect photons       
+  TVirtualMC::GetMC()->SetCerenkov((*fIdtmed)[kCsI]      , kNbins, aEckov, aAbsMet  , aQePc  , aIdxPc  ); //n=1 means convert photons    
+  TVirtualMC::GetMC()->SetCerenkov((*fIdtmed)[kAl]       , kNbins, aEckov, aAbsMet  , aQeAll , aIdxMet );    
 
   // Define a skin surface for the photocatode to enable 'detection' in G4
-  gMC->DefineOpSurface("surfPc", kGlisur /*kUnified*/,kDielectric_metal,kPolished, 0.);
-  gMC->SetMaterialProperty("surfPc", "EFFICIENCY", kNbins, dEckov, dQePc);
-  gMC->SetMaterialProperty("surfPc", "REFLECTIVITY", kNbins, dEckov, dReflMet);
-  gMC->SetSkinSurface("skinPc", "Rpc", "surfPc");
+  TVirtualMC::GetMC()->DefineOpSurface("surfPc", kGlisur /*kUnified*/,kDielectric_metal,kPolished, 0.);
+  TVirtualMC::GetMC()->SetMaterialProperty("surfPc", "EFFICIENCY", kNbins, dEckov, dQePc);
+  TVirtualMC::GetMC()->SetMaterialProperty("surfPc", "REFLECTIVITY", kNbins, dEckov, dReflMet);
+  TVirtualMC::GetMC()->SetSkinSurface("skinPc", "Rpc", "surfPc");
 
   delete pRaAF;delete pWiAF;delete pGaAF; delete pRaIF; delete pWiIF; delete pGaIF; delete pQeF;
 }
@@ -255,13 +255,13 @@ Bool_t AliHMPIDv1::IsLostByFresnel()
 // Calculate probability for the photon to be lost by Fresnel reflection.
   TLorentzVector p4;
   Double_t mom[3],localMom[3];
-  gMC->TrackMomentum(p4);   mom[0]=p4(1);   mom[1]=p4(2);   mom[2]=p4(3);
+  TVirtualMC::GetMC()->TrackMomentum(p4);   mom[0]=p4(1);   mom[1]=p4(2);   mom[2]=p4(3);
   localMom[0]=0; localMom[1]=0; localMom[2]=0;
-  gMC->Gmtod(mom,localMom,2);
+  TVirtualMC::GetMC()->Gmtod(mom,localMom,2);
   Double_t localTc    = localMom[0]*localMom[0]+localMom[2]*localMom[2];
   Double_t localTheta = TMath::ATan2(TMath::Sqrt(localTc),localMom[1]);
   Double_t cotheta = TMath::Abs(TMath::Cos(localTheta));
-  if(gMC->GetRandom()->Rndm() < Fresnel(p4.E()*1e9,cotheta,1)){
+  if(TVirtualMC::GetMC()->GetRandom()->Rndm() < Fresnel(p4.E()*1e9,cotheta,1)){
     AliDebug(1,"Photon lost");
     return kTRUE;
   }else
@@ -273,21 +273,21 @@ void AliHMPIDv1::GenFee(Float_t qtot)
 // Generate FeedBack photons for the current particle. To be invoked from StepManager().
 // eloss=0 means photon so only pulse height distribution is to be analysed.
   TLorentzVector x4;
-  gMC->TrackPosition(x4); 
-  Int_t iNphotons=gMC->GetRandom()->Poisson(0.02*qtot);  //# of feedback photons is proportional to the charge of hit
+  TVirtualMC::GetMC()->TrackPosition(x4); 
+  Int_t iNphotons=TVirtualMC::GetMC()->GetRandom()->Poisson(0.02*qtot);  //# of feedback photons is proportional to the charge of hit
   AliDebug(1,Form("N photons=%i",iNphotons));
   Int_t j;
   Float_t cthf, phif, enfp = 0, sthf, e1[3], e2[3], e3[3], vmod, uswop,dir[3], phi,pol[3], mom[4];
 //Generate photons
   for(Int_t i=0;i<iNphotons;i++){//feedbacks loop
     Double_t ranf[2];
-    gMC->GetRandom()->RndmArray(2,ranf);    //Sample direction
+    TVirtualMC::GetMC()->GetRandom()->RndmArray(2,ranf);    //Sample direction
     cthf=ranf[0]*2-1.0;
     if(cthf<0) continue;
     sthf = TMath::Sqrt((1. - cthf) * (1. + cthf));
     phif = ranf[1] * 2 * TMath::Pi();
     
-    if(Double_t randomNumber=gMC->GetRandom()->Rndm()<=0.57)
+    if(Double_t randomNumber=TVirtualMC::GetMC()->GetRandom()->Rndm()<=0.57)
       enfp = 7.5e-9;
     else if(randomNumber<=0.7)
       enfp = 6.4e-9;
@@ -296,7 +296,7 @@ void AliHMPIDv1::GenFee(Float_t qtot)
     
 
     dir[0] = sthf * TMath::Sin(phif);    dir[1] = cthf;    dir[2] = sthf * TMath::Cos(phif);
-    gMC->Gdtom(dir, mom, 2);
+    TVirtualMC::GetMC()->Gdtom(dir, mom, 2);
     mom[0]*=enfp;    mom[1]*=enfp;    mom[2]*=enfp;
     mom[3] = TMath::Sqrt(mom[0]*mom[0]+mom[1]*mom[1]+mom[2]*mom[2]);
     
@@ -323,9 +323,9 @@ void AliHMPIDv1::GenFee(Float_t qtot)
     vmod=0;  for(j=0;j<3;j++) vmod+=e1[j]*e1[j];  vmod=TMath::Sqrt(1/vmod);  for(j=0;j<3;j++) e1[j]*=vmod;    
     vmod=0;  for(j=0;j<3;j++) vmod+=e2[j]*e2[j];  vmod=TMath::Sqrt(1/vmod);  for(j=0;j<3;j++) e2[j]*=vmod;
     
-    phi = gMC->GetRandom()->Rndm()* 2 * TMath::Pi();
+    phi = TVirtualMC::GetMC()->GetRandom()->Rndm()* 2 * TMath::Pi();
     for(j=0;j<3;j++) pol[j]=e1[j]*TMath::Sin(phi)+e2[j]*TMath::Cos(phi);
-    gMC->Gdtom(pol, pol, 2);
+    TVirtualMC::GetMC()->Gdtom(pol, pol, 2);
     Int_t outputNtracksStored;    
     gAlice->GetMCApp()->PushTrack(1,                             //transport
                      gAlice->GetMCApp()->GetCurrentTrackNumber(),//parent track 
@@ -497,7 +497,7 @@ void AliHMPIDv1::StepHistory()
 // This methode is invoked from StepManager() in order to print out 
   static Int_t iStepN;
   const char *sParticle;
-  switch(gMC->TrackPid()){
+  switch(TVirtualMC::GetMC()->TrackPid()){
     case kProton:      sParticle="PROTON"    ;break;
     case kNeutron:     sParticle="neutron"   ;break;
     case kGamma:       sParticle="gamma"     ;break;
@@ -510,28 +510,28 @@ void AliHMPIDv1::StepHistory()
   }
 
   TString flag="fanny combination";
-  if(gMC->IsTrackAlive()) {
-    if(gMC->IsTrackEntering())      flag="enters to";
-    else if(gMC->IsTrackExiting())  flag="exits from";
-    else if(gMC->IsTrackInside())   flag="inside";
+  if(TVirtualMC::GetMC()->IsTrackAlive()) {
+    if(TVirtualMC::GetMC()->IsTrackEntering())      flag="enters to";
+    else if(TVirtualMC::GetMC()->IsTrackExiting())  flag="exits from";
+    else if(TVirtualMC::GetMC()->IsTrackInside())   flag="inside";
   } else {
-    if(gMC->IsTrackStop())          flag="stopped in";        
+    if(TVirtualMC::GetMC()->IsTrackStop())          flag="stopped in";        
   }
   
   Int_t vid=0,copy=0;
-  TString path=gMC->CurrentVolName(); path.Prepend("-");path.Prepend(gMC->CurrentVolOffName(1));//current volume and his mother are always there
-  vid=gMC->CurrentVolOffID(2,copy);  if(vid) {path.Prepend("-");path.Prepend(gMC->VolName(vid));}
-  vid=gMC->CurrentVolOffID(3,copy);  if(vid) {path.Prepend("-");path.Prepend(gMC->VolName(vid));}
+  TString path=TVirtualMC::GetMC()->CurrentVolName(); path.Prepend("-");path.Prepend(TVirtualMC::GetMC()->CurrentVolOffName(1));//current volume and his mother are always there
+  vid=TVirtualMC::GetMC()->CurrentVolOffID(2,copy);  if(vid) {path.Prepend("-");path.Prepend(TVirtualMC::GetMC()->VolName(vid));}
+  vid=TVirtualMC::GetMC()->CurrentVolOffID(3,copy);  if(vid) {path.Prepend("-");path.Prepend(TVirtualMC::GetMC()->VolName(vid));}
   
-  Printf("Step %i: %s (%i) %s %s m=%.6f GeV q=%.1f dEdX=%.4f",iStepN,sParticle,gMC->TrackPid(),flag.Data(),path.Data(),gMC->TrackMass(),gMC->TrackCharge(),gMC->Edep()*1e9);
+  Printf("Step %i: %s (%i) %s %s m=%.6f GeV q=%.1f dEdX=%.4f",iStepN,sParticle,TVirtualMC::GetMC()->TrackPid(),flag.Data(),path.Data(),TVirtualMC::GetMC()->TrackMass(),TVirtualMC::GetMC()->TrackCharge(),TVirtualMC::GetMC()->Edep()*1e9);
   
   Printf("Step %i: tid=%i flags alive=%i disap=%i enter=%i exit=%i inside=%i out=%i stop=%i new=%i",
                             iStepN, gAlice->GetMCApp()->GetCurrentTrackNumber(),
-                            gMC->IsTrackAlive(), gMC->IsTrackDisappeared(),gMC->IsTrackEntering(), gMC->IsTrackExiting(),
-                            gMC->IsTrackInside(),gMC->IsTrackOut(),        gMC->IsTrackStop(),     gMC->IsNewTrack());
+                            TVirtualMC::GetMC()->IsTrackAlive(), TVirtualMC::GetMC()->IsTrackDisappeared(),TVirtualMC::GetMC()->IsTrackEntering(), TVirtualMC::GetMC()->IsTrackExiting(),
+                            TVirtualMC::GetMC()->IsTrackInside(),TVirtualMC::GetMC()->IsTrackOut(),        TVirtualMC::GetMC()->IsTrackStop(),     TVirtualMC::GetMC()->IsNewTrack());
   
   Float_t a,z,den,rad,abs; a=z=den=rad=abs=-1;
-  Int_t mid=gMC->CurrentMaterial(a,z,den,rad,abs);
+  Int_t mid=TVirtualMC::GetMC()->CurrentMaterial(a,z,den,rad,abs);
   Printf("Step %i: id=%i a=%7.2f z=%7.2f den=%9.4f rad=%9.2f abs=%9.2f\n\n",iStepN,mid,a,z,den,rad,abs);
   iStepN++;
 }//StepHistory()
@@ -547,15 +547,15 @@ void AliHMPIDv1::StepManager()
   Int_t   copy; //volume copy aka node
   
 //Treat photons    
-  if((gMC->TrackPid()==50000050||gMC->TrackPid()==50000051)&&gMC->CurrentVolID(copy)==fIdPc){  //photon (Ckov or feedback) hit PC (fIdPc)
-    if(gMC->Edep()>0){                                                                           //photon survided QE test i.e. produces electron
-      if(IsLostByFresnel()){ gMC->StopTrack(); return;}                                          //photon lost due to fersnel reflection on PC       
-                       gMC->CurrentVolOffID(2,copy);                                             //current chamber since geomtry tree is HMPID-Rppf-Rpc
-      Int_t   tid=     gMC->GetStack()->GetCurrentTrackNumber();                                 //take TID
-      Int_t   pid=     gMC->TrackPid();                                                          //take PID
-      Float_t etot=    gMC->Etot();                                                              //total hpoton energy, [GeV] 
-      Double_t x[3];   gMC->TrackPosition(x[0],x[1],x[2]);                                       //take MARS position at entrance to PC
-      Float_t  hitTime=(Float_t)gMC->TrackTime();                                                //hit formation time
+  if((TVirtualMC::GetMC()->TrackPid()==50000050||TVirtualMC::GetMC()->TrackPid()==50000051)&&TVirtualMC::GetMC()->CurrentVolID(copy)==fIdPc){  //photon (Ckov or feedback) hit PC (fIdPc)
+    if(TVirtualMC::GetMC()->Edep()>0){                                                                           //photon survided QE test i.e. produces electron
+      if(IsLostByFresnel()){ TVirtualMC::GetMC()->StopTrack(); return;}                                          //photon lost due to fersnel reflection on PC       
+                       TVirtualMC::GetMC()->CurrentVolOffID(2,copy);                                             //current chamber since geomtry tree is HMPID-Rppf-Rpc
+      Int_t   tid=     TVirtualMC::GetMC()->GetStack()->GetCurrentTrackNumber();                                 //take TID
+      Int_t   pid=     TVirtualMC::GetMC()->TrackPid();                                                          //take PID
+      Float_t etot=    TVirtualMC::GetMC()->Etot();                                                              //total hpoton energy, [GeV] 
+      Double_t x[3];   TVirtualMC::GetMC()->TrackPosition(x[0],x[1],x[2]);                                       //take MARS position at entrance to PC
+      Float_t  hitTime=(Float_t)TVirtualMC::GetMC()->TrackTime();                                                //hit formation time
       Float_t xl,yl;   AliHMPIDParam::Instance()->Mars2Lors(copy,x,xl,yl);                       //take LORS position
       new((*fHits)[fNhits++])AliHMPIDHit(copy,etot,pid,tid,xl,yl,hitTime,x);                     //HIT for photon, position at P, etot will be set to Q
       GenFee(etot);                                                                              //generate feedback photons etot is modified in hit ctor to Q of hit
@@ -565,17 +565,17 @@ void AliHMPIDv1::StepManager()
 //Treat charged particles  
   static Float_t eloss;                                                                           //need to store mip parameters between different steps    
   static Double_t in[3];
-  if(gMC->TrackCharge() && gMC->CurrentVolID(copy)==fIdAmpGap){                                   //charged particle in amplification gap (fIdAmpGap)
-    if(gMC->IsTrackEntering()||gMC->IsNewTrack()) {                                               //entering or newly created
+  if(TVirtualMC::GetMC()->TrackCharge() && TVirtualMC::GetMC()->CurrentVolID(copy)==fIdAmpGap){                                   //charged particle in amplification gap (fIdAmpGap)
+    if(TVirtualMC::GetMC()->IsTrackEntering()||TVirtualMC::GetMC()->IsNewTrack()) {                                               //entering or newly created
       eloss=0;                                                                                    //reset Eloss collector                         
-      gMC->TrackPosition(in[0],in[1],in[2]);                                                      //take position at the entrance
-    }else if(gMC->IsTrackExiting()||gMC->IsTrackStop()||gMC->IsTrackDisappeared()){               //exiting or disappeared
-      eloss              +=gMC->Edep();                                                           //take into account last step Eloss
-                          gMC->CurrentVolOffID(1,copy);                                           //take current chamber since geometry tree is HMPID-Rgap
-      Int_t tid=          gMC->GetStack()->GetCurrentTrackNumber();                               //take TID
-      Int_t pid=          gMC->TrackPid();                                                        //take PID
-      Double_t out[3];    gMC->TrackPosition(out[0],out[1],out[2]);                               //take MARS position at exit
-      Float_t hitTime=    (Float_t)gMC->TrackTime();                                              //hit formation time
+      TVirtualMC::GetMC()->TrackPosition(in[0],in[1],in[2]);                                                      //take position at the entrance
+    }else if(TVirtualMC::GetMC()->IsTrackExiting()||TVirtualMC::GetMC()->IsTrackStop()||TVirtualMC::GetMC()->IsTrackDisappeared()){               //exiting or disappeared
+      eloss              +=TVirtualMC::GetMC()->Edep();                                                           //take into account last step Eloss
+                          TVirtualMC::GetMC()->CurrentVolOffID(1,copy);                                           //take current chamber since geometry tree is HMPID-Rgap
+      Int_t tid=          TVirtualMC::GetMC()->GetStack()->GetCurrentTrackNumber();                               //take TID
+      Int_t pid=          TVirtualMC::GetMC()->TrackPid();                                                        //take PID
+      Double_t out[3];    TVirtualMC::GetMC()->TrackPosition(out[0],out[1],out[2]);                               //take MARS position at exit
+      Float_t hitTime=    (Float_t)TVirtualMC::GetMC()->TrackTime();                                              //hit formation time
       out[0]=0.5*(out[0]+in[0]);                                                                  //>
       out[1]=0.5*(out[1]+in[1]);                                                                  //take hit position at the anod plane
       out[2]=0.5*(out[2]+in[2]);                                                                  //>
@@ -583,7 +583,7 @@ void AliHMPIDv1::StepManager()
       new((*fHits)[fNhits++])AliHMPIDHit(copy,eloss,pid,tid,xl,yl,hitTime,out);                   //HIT for MIP, position near anod plane, eloss will be set to Q 
       GenFee(eloss);                                                                              //generate feedback photons 
     }else                                                                                         //just going inside
-      eloss          += gMC->Edep();                                                              //collect this step eloss 
+      eloss          += TVirtualMC::GetMC()->Edep();                                                              //collect this step eloss 
   }//MIP in GAP
 }//StepManager()
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
index fea5c6b..cf809cc 100644 (file)
@@ -21,7 +21,7 @@
 #include "AliHMPIDRawStream.h"  //Digits2Raw(), Raw2SDigits()
 #include "AliRawReader.h"     //Raw2SDigits()
 #include "AliTrackReference.h"
-#include <TVirtualMC.h>       //StepManager() for gMC
+#include <TVirtualMC.h>       //StepManager() for TVirtualMC::GetMC()
 #include <TPDGCode.h>         //StepHistory() 
 #include <AliStack.h>         //StepManager(),Hits2SDigits()78.6
 #include <AliLoader.h>        //Hits2SDigits()
@@ -158,81 +158,81 @@ HMPID 12  1.e-5 1.e-5 1.e-4  -1.   1.e-4 -1.   -1.    5.e-5 5.e-5 -1.  -1   -1
     Int_t imed;
     
     imed = kSiO2;   // * Quarz Window        (>1000 keV delta-electrons)
-    gMC->Gstpar(idtmed[imed], "CUTGAM",1.e-4);
-    gMC->Gstpar(idtmed[imed], "CUTELE",1.e-4);
-    gMC->Gstpar(idtmed[imed], "CUTNEU",1.e-4);
-    gMC->Gstpar(idtmed[imed], "CUTMUO",1.e-4);    
-    gMC->Gstpar(idtmed[imed], "DCUTE" ,1.e-3);    
-    gMC->Gstpar(idtmed[imed], "CUTHAD",1.e-3);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTGAM",1.e-4);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTELE",1.e-4);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTNEU",1.e-4);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTMUO",1.e-4);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "DCUTE" ,1.e-3);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTHAD",1.e-3);    
     
-    gMC->Gstpar(idtmed[imed], "DRAY",1);    
-    gMC->Gstpar(idtmed[imed], "LOSS",1);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "DRAY",1);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "LOSS",1);    
 
     imed = kC6F14;  // * Freon Radiator      (>  500 keV delta-electrons)
-    gMC->Gstpar(idtmed[imed], "CUTGAM",1.e-4);
-    gMC->Gstpar(idtmed[imed], "CUTELE",1.e-4);
-    gMC->Gstpar(idtmed[imed], "CUTNEU",1.e-4);
-    gMC->Gstpar(idtmed[imed], "CUTMUO",1.e-4);    
-    gMC->Gstpar(idtmed[imed], "DCUTE" ,5.e-4);    
-    gMC->Gstpar(idtmed[imed], "CUTHAD",5.e-4);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTGAM",1.e-4);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTELE",1.e-4);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTNEU",1.e-4);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTMUO",1.e-4);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "DCUTE" ,5.e-4);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTHAD",5.e-4);    
     
-    gMC->Gstpar(idtmed[imed], "DRAY",1);    
-    gMC->Gstpar(idtmed[imed], "LOSS",1);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "DRAY",1);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "LOSS",1);    
     
     imed = kCH4;  // * Methane Gap         (>  100 keV delta-electrons)
-    gMC->Gstpar(idtmed[imed], "CUTGAM",5.e-5);
-    gMC->Gstpar(idtmed[imed], "CUTELE",5.e-5);
-    gMC->Gstpar(idtmed[imed], "CUTNEU",1.e-4);
-    gMC->Gstpar(idtmed[imed], "CUTMUO",1.e-4);    
-    gMC->Gstpar(idtmed[imed], "DCUTE" ,1.e-4);    
-    gMC->Gstpar(idtmed[imed], "CUTHAD",1.e-4);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTGAM",5.e-5);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTELE",5.e-5);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTNEU",1.e-4);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTMUO",1.e-4);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "DCUTE" ,1.e-4);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTHAD",1.e-4);    
     
-    gMC->Gstpar(idtmed[imed], "DRAY",1);    
-    gMC->Gstpar(idtmed[imed], "LOSS",1);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "DRAY",1);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "LOSS",1);    
     
     imed = kCsI;  // * CSI    (>  50 keV delta-electrons)
-    gMC->Gstpar(idtmed[imed], "CUTGAM",1.e-5);
-    gMC->Gstpar(idtmed[imed], "CUTELE",1.e-5);
-    gMC->Gstpar(idtmed[imed], "CUTNEU",1.e-4);
-    gMC->Gstpar(idtmed[imed], "CUTMUO",1.e-4);    
-    gMC->Gstpar(idtmed[imed], "DCUTE" ,5.e-5);    
-    gMC->Gstpar(idtmed[imed], "CUTHAD",5.e-5);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTGAM",1.e-5);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTELE",1.e-5);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTNEU",1.e-4);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTMUO",1.e-4);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "DCUTE" ,5.e-5);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTHAD",5.e-5);    
     
-    gMC->Gstpar(idtmed[imed], "DRAY",1);    
-    gMC->Gstpar(idtmed[imed], "LOSS",1);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "DRAY",1);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "LOSS",1);
     
     imed = kAl;  // * Alluminium    (>  50 keV delta-electrons)
-    gMC->Gstpar(idtmed[imed], "CUTGAM",1.e-5);
-    gMC->Gstpar(idtmed[imed], "CUTELE",1.e-5);
-    gMC->Gstpar(idtmed[imed], "CUTNEU",1.e-4);
-    gMC->Gstpar(idtmed[imed], "CUTMUO",1.e-4);    
-    gMC->Gstpar(idtmed[imed], "DCUTE" ,5.e-5);    
-    gMC->Gstpar(idtmed[imed], "CUTHAD",5.e-5);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTGAM",1.e-5);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTELE",1.e-5);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTNEU",1.e-4);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTMUO",1.e-4);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "DCUTE" ,5.e-5);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTHAD",5.e-5);    
     
-    gMC->Gstpar(idtmed[imed], "DRAY",1);    
-    gMC->Gstpar(idtmed[imed], "LOSS",1);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "DRAY",1);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "LOSS",1);    
     
     imed = kCu;  // * Copper       (>  50 keV delta-electrons)
-    gMC->Gstpar(idtmed[imed], "CUTGAM",1.e-5);
-    gMC->Gstpar(idtmed[imed], "CUTELE",1.e-5);
-    gMC->Gstpar(idtmed[imed], "CUTNEU",1.e-4);
-    gMC->Gstpar(idtmed[imed], "CUTMUO",1.e-4);    
-    gMC->Gstpar(idtmed[imed], "DCUTE" ,5.e-5);    
-    gMC->Gstpar(idtmed[imed], "CUTHAD",5.e-5);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTGAM",1.e-5);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTELE",1.e-5);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTNEU",1.e-4);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTMUO",1.e-4);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "DCUTE" ,5.e-5);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTHAD",5.e-5);    
     
-    gMC->Gstpar(idtmed[imed], "DRAY",1);    
-    gMC->Gstpar(idtmed[imed], "LOSS",1);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "DRAY",1);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "LOSS",1);    
     
     imed = kW;  // * Tungsten     (>  50 keV delta-electrons)
-    gMC->Gstpar(idtmed[imed], "CUTGAM",1.e-5);
-    gMC->Gstpar(idtmed[imed], "CUTELE",1.e-5);
-    gMC->Gstpar(idtmed[imed], "CUTNEU",1.e-4);
-    gMC->Gstpar(idtmed[imed], "CUTMUO",1.e-4);    
-    gMC->Gstpar(idtmed[imed], "DCUTE" ,5.e-5);    
-    gMC->Gstpar(idtmed[imed], "CUTHAD",5.e-5);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTGAM",1.e-5);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTELE",1.e-5);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTNEU",1.e-4);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTMUO",1.e-4);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "DCUTE" ,5.e-5);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTHAD",5.e-5);    
     
-    gMC->Gstpar(idtmed[imed], "DRAY",1);    
-    gMC->Gstpar(idtmed[imed], "LOSS",1);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "DRAY",1);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "LOSS",1);    
     
 }*/
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -240,7 +240,7 @@ void AliHMPIDv2::CreateGeometry()
 {
 //Creates detailed geometry simulation (currently GEANT volumes tree)         
   AliDebug(1,"Start main.");
-  if(!gMC->IsRootGeometrySupported()) return;                
+  if(!TVirtualMC::GetMC()->IsRootGeometrySupported()) return;                
  
  Double_t cm=1,mm=0.1*cm,um=0.001*mm;//default is cm
  
@@ -434,13 +434,13 @@ hmp->AddNode(fr3,1,new TGeoTranslation(0.,0.,(80.-29.)*mm-34.*mm/2));
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void AliHMPIDv2::Init()
 {
-// This method defines ID for sensitive volumes, i.e. such geometry volumes for which there are if(gMC->CurrentVolID()==XXX) 
+// This method defines ID for sensitive volumes, i.e. such geometry volumes for which there are if(TVirtualMC::GetMC()->CurrentVolID()==XXX) 
 // statements in StepManager()
 // Arguments: none
 //   Returns: none      
   AliDebug(1,"Start v2 HMPID.");    
-  fIdPad     = gMC->VolId("Hpad");
-  fIdCell    = gMC->VolId("Hcel");
+  fIdPad     = TVirtualMC::GetMC()->VolId("Hpad");
+  fIdCell    = TVirtualMC::GetMC()->VolId("Hcel");
   AliDebug(1,"Stop v2 HMPID.");    
 }
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -483,19 +483,19 @@ void AliHMPIDv2::DefineOpticalProperties()
     dQePc [i]=pQeF->Eval(eV);
     dReflMet[i] = 0.;     // no reflection on the surface of the pc (?)                                       
   }
-  gMC->SetCerenkov((*fIdtmed)[kC6F14]    , kNbins, aEckov, aAbsRad  , aQeAll , aIdxRad );    
-  gMC->SetCerenkov((*fIdtmed)[kSiO2]     , kNbins, aEckov, aAbsWin  , aQeAll , aIdxWin );    
-  gMC->SetCerenkov((*fIdtmed)[kCH4]      , kNbins, aEckov, aAbsGap  , aQeAll , aIdxGap );    
-  gMC->SetCerenkov((*fIdtmed)[kCu]       , kNbins, aEckov, aAbsMet  , aQeAll , aIdxMet );    
-  gMC->SetCerenkov((*fIdtmed)[kW]        , kNbins, aEckov, aAbsMet  , aQeAll , aIdxMet ); //n=0 means reflect photons       
-  gMC->SetCerenkov((*fIdtmed)[kCsI]      , kNbins, aEckov, aAbsMet  , aQePc  , aIdxPc  ); //n=1 means convert photons    
-  gMC->SetCerenkov((*fIdtmed)[kAl]       , kNbins, aEckov, aAbsMet  , aQeAll , aIdxMet );    
+  TVirtualMC::GetMC()->SetCerenkov((*fIdtmed)[kC6F14]    , kNbins, aEckov, aAbsRad  , aQeAll , aIdxRad );    
+  TVirtualMC::GetMC()->SetCerenkov((*fIdtmed)[kSiO2]     , kNbins, aEckov, aAbsWin  , aQeAll , aIdxWin );    
+  TVirtualMC::GetMC()->SetCerenkov((*fIdtmed)[kCH4]      , kNbins, aEckov, aAbsGap  , aQeAll , aIdxGap );    
+  TVirtualMC::GetMC()->SetCerenkov((*fIdtmed)[kCu]       , kNbins, aEckov, aAbsMet  , aQeAll , aIdxMet );    
+  TVirtualMC::GetMC()->SetCerenkov((*fIdtmed)[kW]        , kNbins, aEckov, aAbsMet  , aQeAll , aIdxMet ); //n=0 means reflect photons       
+  TVirtualMC::GetMC()->SetCerenkov((*fIdtmed)[kCsI]      , kNbins, aEckov, aAbsMet  , aQePc  , aIdxPc  ); //n=1 means convert photons    
+  TVirtualMC::GetMC()->SetCerenkov((*fIdtmed)[kAl]       , kNbins, aEckov, aAbsMet  , aQeAll , aIdxMet );    
 
   // Define a skin surface for the photocatode to enable 'detection' in G4
-  gMC->DefineOpSurface("surfPc", kGlisur /*kUnified*/,kDielectric_metal,kPolished, 0.);
-  gMC->SetMaterialProperty("surfPc", "EFFICIENCY", kNbins, dEckov, dQePc);
-  gMC->SetMaterialProperty("surfPc", "REFLECTIVITY", kNbins, dEckov, dReflMet);
-  gMC->SetSkinSurface("skinPc", "Rpc", "surfPc");
+  TVirtualMC::GetMC()->DefineOpSurface("surfPc", kGlisur /*kUnified*/,kDielectric_metal,kPolished, 0.);
+  TVirtualMC::GetMC()->SetMaterialProperty("surfPc", "EFFICIENCY", kNbins, dEckov, dQePc);
+  TVirtualMC::GetMC()->SetMaterialProperty("surfPc", "REFLECTIVITY", kNbins, dEckov, dReflMet);
+  TVirtualMC::GetMC()->SetSkinSurface("skinPc", "Rpc", "surfPc");
 
   delete pRaAF;delete pWiAF;delete pGaAF; delete pRaIF; delete pWiIF; delete pGaIF; delete pQeF;
 }
@@ -505,13 +505,13 @@ Bool_t AliHMPIDv2::IsLostByFresnel()
 // Calculate probability for the photon to be lost by Fresnel reflection.
   TLorentzVector p4;
   Double_t mom[3],localMom[3];
-  gMC->TrackMomentum(p4);   mom[0]=p4(1);   mom[1]=p4(2);   mom[2]=p4(3);
+  TVirtualMC::GetMC()->TrackMomentum(p4);   mom[0]=p4(1);   mom[1]=p4(2);   mom[2]=p4(3);
   localMom[0]=0; localMom[1]=0; localMom[2]=0;
-  gMC->Gmtod(mom,localMom,2);
+  TVirtualMC::GetMC()->Gmtod(mom,localMom,2);
   Double_t localTc    = localMom[0]*localMom[0]+localMom[2]*localMom[2];
   Double_t localTheta = TMath::ATan2(TMath::Sqrt(localTc),localMom[1]);
   Double_t cotheta = TMath::Abs(TMath::Cos(localTheta));
-  if(gMC->GetRandom()->Rndm() < Fresnel(p4.E()*1e9,cotheta,1)){
+  if(TVirtualMC::GetMC()->GetRandom()->Rndm() < Fresnel(p4.E()*1e9,cotheta,1)){
     AliDebug(1,"Photon lost");
     return kTRUE;
   }else
@@ -523,21 +523,21 @@ void AliHMPIDv2::GenFee(Float_t qtot)
 // Generate FeedBack photons for the current particle. To be invoked from StepManager().
 // eloss=0 means photon so only pulse height distribution is to be analysed.
   TLorentzVector x4;
-  gMC->TrackPosition(x4); 
-  Int_t iNphotons=gMC->GetRandom()->Poisson(0.02*qtot);  //# of feedback photons is proportional to the charge of hit
+  TVirtualMC::GetMC()->TrackPosition(x4); 
+  Int_t iNphotons=TVirtualMC::GetMC()->GetRandom()->Poisson(0.02*qtot);  //# of feedback photons is proportional to the charge of hit
   AliDebug(1,Form("N photons=%i",iNphotons));
   Int_t j;
   Float_t cthf, phif, enfp = 0, sthf, e1[3], e2[3], e3[3], vmod, uswop,dir[3], phi,pol[3], mom[4];
 //Generate photons
   for(Int_t i=0;i<iNphotons;i++){//feedbacks loop
     Double_t ranf[2];
-    gMC->GetRandom()->RndmArray(2,ranf);    //Sample direction
+    TVirtualMC::GetMC()->GetRandom()->RndmArray(2,ranf);    //Sample direction
     cthf=ranf[0]*2-1.0;
     if(cthf<0) continue;
     sthf = TMath::Sqrt((1. - cthf) * (1. + cthf));
     phif = ranf[1] * 2 * TMath::Pi();
     
-    if(Double_t randomNumber=gMC->GetRandom()->Rndm()<=0.57)
+    if(Double_t randomNumber=TVirtualMC::GetMC()->GetRandom()->Rndm()<=0.57)
       enfp = 7.5e-9;
     else if(randomNumber<=0.7)
       enfp = 6.4e-9;
@@ -546,7 +546,7 @@ void AliHMPIDv2::GenFee(Float_t qtot)
     
 
     dir[0] = sthf * TMath::Sin(phif);    dir[1] = cthf;    dir[2] = sthf * TMath::Cos(phif);
-    gMC->Gdtom(dir, mom, 2);
+    TVirtualMC::GetMC()->Gdtom(dir, mom, 2);
     mom[0]*=enfp;    mom[1]*=enfp;    mom[2]*=enfp;
     mom[3] = TMath::Sqrt(mom[0]*mom[0]+mom[1]*mom[1]+mom[2]*mom[2]);
     
@@ -573,9 +573,9 @@ void AliHMPIDv2::GenFee(Float_t qtot)
     vmod=0;  for(j=0;j<3;j++) vmod+=e1[j]*e1[j];  vmod=TMath::Sqrt(1/vmod);  for(j=0;j<3;j++) e1[j]*=vmod;    
     vmod=0;  for(j=0;j<3;j++) vmod+=e2[j]*e2[j];  vmod=TMath::Sqrt(1/vmod);  for(j=0;j<3;j++) e2[j]*=vmod;
     
-    phi = gMC->GetRandom()->Rndm()* 2 * TMath::Pi();
+    phi = TVirtualMC::GetMC()->GetRandom()->Rndm()* 2 * TMath::Pi();
     for(j=0;j<3;j++) pol[j]=e1[j]*TMath::Sin(phi)+e2[j]*TMath::Cos(phi);
-    gMC->Gdtom(pol, pol, 2);
+    TVirtualMC::GetMC()->Gdtom(pol, pol, 2);
     Int_t outputNtracksStored;    
     gAlice->GetMCApp()->PushTrack(1,                             //transport
                      gAlice->GetMCApp()->GetCurrentTrackNumber(),//parent track 
@@ -747,7 +747,7 @@ void AliHMPIDv2::StepHistory()
 // This methode is invoked from StepManager() in order to print out 
   static Int_t iStepN;
   const char *sParticle;
-  switch(gMC->TrackPid()){
+  switch(TVirtualMC::GetMC()->TrackPid()){
     case kProton:      sParticle="PROTON"    ;break;
     case kNeutron:     sParticle="neutron"   ;break;
     case kGamma:       sParticle="gamma"     ;break;
@@ -760,38 +760,38 @@ void AliHMPIDv2::StepHistory()
   }
 
   TString flag="fanny combination";
-  if(gMC->IsTrackAlive()) {
-    if(gMC->IsTrackEntering())      flag="enters to";
-    else if(gMC->IsTrackExiting())  flag="exits from";
-    else if(gMC->IsTrackInside())   flag="inside";
+  if(TVirtualMC::GetMC()->IsTrackAlive()) {
+    if(TVirtualMC::GetMC()->IsTrackEntering())      flag="enters to";
+    else if(TVirtualMC::GetMC()->IsTrackExiting())  flag="exits from";
+    else if(TVirtualMC::GetMC()->IsTrackInside())   flag="inside";
   } else {
-    if(gMC->IsTrackStop())          flag="stopped in";
+    if(TVirtualMC::GetMC()->IsTrackStop())          flag="stopped in";
   }
   
   Int_t vid=0,copy=0;
-  TString path=gMC->CurrentVolName(); path.Prepend("-");path.Prepend(gMC->CurrentVolOffName(1));//current volume and his mother are always there
-  vid=gMC->CurrentVolOffID(2,copy);  if(vid) {path.Prepend("-");path.Prepend(gMC->VolName(vid));}
-  vid=gMC->CurrentVolOffID(3,copy);  if(vid) {path.Prepend("-");path.Prepend(gMC->VolName(vid));}
+  TString path=TVirtualMC::GetMC()->CurrentVolName(); path.Prepend("-");path.Prepend(TVirtualMC::GetMC()->CurrentVolOffName(1));//current volume and his mother are always there
+  vid=TVirtualMC::GetMC()->CurrentVolOffID(2,copy);  if(vid) {path.Prepend("-");path.Prepend(TVirtualMC::GetMC()->VolName(vid));}
+  vid=TVirtualMC::GetMC()->CurrentVolOffID(3,copy);  if(vid) {path.Prepend("-");path.Prepend(TVirtualMC::GetMC()->VolName(vid));}
  
   
-  Printf("Step %i: %s (%i) %s %s m=%.6f GeV q=%.1f dEdX=%.4f Etot=%.4f",iStepN,sParticle,gMC->TrackPid(),flag.Data(),path.Data(),gMC->TrackMass(),gMC->TrackCharge(),gMC->Edep()*1e9,gMC->Etot());
+  Printf("Step %i: %s (%i) %s %s m=%.6f GeV q=%.1f dEdX=%.4f Etot=%.4f",iStepN,sParticle,TVirtualMC::GetMC()->TrackPid(),flag.Data(),path.Data(),TVirtualMC::GetMC()->TrackMass(),TVirtualMC::GetMC()->TrackCharge(),TVirtualMC::GetMC()->Edep()*1e9,TVirtualMC::GetMC()->Etot());
   
-  Double_t gMcTrackPos[3]; gMC->TrackPosition(gMcTrackPos[0],gMcTrackPos[1],gMcTrackPos[2]);
-  Double_t  gMcTrackPosLoc[3]; gMC->Gmtod(gMcTrackPos,gMcTrackPosLoc,1);
-  Printf("gMC Track Position (MARS) x: %5.3lf, y: %5.3lf, z: %5.3lf (r: %5.3lf) ---> (LOC) x: %5.3f, y: %5.3f, z: %5.3f",gMcTrackPos[0],gMcTrackPos[1],gMcTrackPos[2],TMath::Sqrt(gMcTrackPos[0]*gMcTrackPos[0]+gMcTrackPos[1]*gMcTrackPos[1]+gMcTrackPos[2]*gMcTrackPos[2]),gMcTrackPosLoc[0],gMcTrackPosLoc[1],gMcTrackPosLoc[2]);
+  Double_t gMcTrackPos[3]; TVirtualMC::GetMC()->TrackPosition(gMcTrackPos[0],gMcTrackPos[1],gMcTrackPos[2]);
+  Double_t  gMcTrackPosLoc[3]; TVirtualMC::GetMC()->Gmtod(gMcTrackPos,gMcTrackPosLoc,1);
+  Printf("TVirtualMC::GetMC() Track Position (MARS) x: %5.3lf, y: %5.3lf, z: %5.3lf (r: %5.3lf) ---> (LOC) x: %5.3f, y: %5.3f, z: %5.3f",gMcTrackPos[0],gMcTrackPos[1],gMcTrackPos[2],TMath::Sqrt(gMcTrackPos[0]*gMcTrackPos[0]+gMcTrackPos[1]*gMcTrackPos[1]+gMcTrackPos[2]*gMcTrackPos[2]),gMcTrackPosLoc[0],gMcTrackPosLoc[1],gMcTrackPosLoc[2]);
   
 
   
   Printf("Step %i: tid=%i flags alive=%i disap=%i enter=%i exit=%i inside=%i out=%i stop=%i new=%i",
                             iStepN, gAlice->GetMCApp()->GetCurrentTrackNumber(),
-                            gMC->IsTrackAlive(), gMC->IsTrackDisappeared(),gMC->IsTrackEntering(), gMC->IsTrackExiting(),
-                            gMC->IsTrackInside(),gMC->IsTrackOut(),        gMC->IsTrackStop(),     gMC->IsNewTrack());
+                            TVirtualMC::GetMC()->IsTrackAlive(), TVirtualMC::GetMC()->IsTrackDisappeared(),TVirtualMC::GetMC()->IsTrackEntering(), TVirtualMC::GetMC()->IsTrackExiting(),
+                            TVirtualMC::GetMC()->IsTrackInside(),TVirtualMC::GetMC()->IsTrackOut(),        TVirtualMC::GetMC()->IsTrackStop(),     TVirtualMC::GetMC()->IsNewTrack());
   
   Float_t a,z,den,rad,abs; a=z=den=rad=abs=-1;
-  Int_t mid=gMC->CurrentMaterial(a,z,den,rad,abs);
+  Int_t mid=TVirtualMC::GetMC()->CurrentMaterial(a,z,den,rad,abs);
   Printf("Step %i: mid=%i a=%7.2f z=%7.2f den=%9.4f rad=%9.2f abs=%9.2f\n\n",iStepN,mid,a,z,den,rad,abs);
   
-  TArrayI proc;  gMC->StepProcesses(proc); 
+  TArrayI proc;  TVirtualMC::GetMC()->StepProcesses(proc); 
   Printf("Processes in this step:");
   for ( int i = 0 ; i < proc.GetSize(); i++)
   {
@@ -813,15 +813,15 @@ void AliHMPIDv2::StepManager()
   Int_t   copy; //volume copy aka node
   
 //Treat photons    
-  if((gMC->TrackPid()==50000050||gMC->TrackPid()==50000051)&&gMC->CurrentVolID(copy)==fIdPad){   //photon (Ckov or feedback) hit PC (fIdPad)
-    if(gMC->Edep()>0){                                                                           //photon survided QE test i.e. produces electron
-      if(IsLostByFresnel()){ gMC->StopTrack(); return;}                                          //photon lost due to fersnel reflection on PC       
-                       gMC->CurrentVolOffID(5,copy);                                             //current chamber since geomtry tree is Hmp-Hsec-Hgap-Hrow-Hcel-Hpad
-      Int_t   tid=     gMC->GetStack()->GetCurrentTrackNumber();                                 //take TID
-      Int_t   pid=     gMC->TrackPid();                                                          //take PID
-      Float_t etot=    gMC->Etot();                                                              //total hpoton energy, [GeV] 
-      Double_t x[3];   gMC->TrackPosition(x[0],x[1],x[2]);                                       //take MARS position at entrance to PC
-      Float_t hitTime= (Float_t)gMC->TrackTime();                                                         //hit formation time 
+  if((TVirtualMC::GetMC()->TrackPid()==50000050||TVirtualMC::GetMC()->TrackPid()==50000051)&&TVirtualMC::GetMC()->CurrentVolID(copy)==fIdPad){   //photon (Ckov or feedback) hit PC (fIdPad)
+    if(TVirtualMC::GetMC()->Edep()>0){                                                                           //photon survided QE test i.e. produces electron
+      if(IsLostByFresnel()){ TVirtualMC::GetMC()->StopTrack(); return;}                                          //photon lost due to fersnel reflection on PC       
+                       TVirtualMC::GetMC()->CurrentVolOffID(5,copy);                                             //current chamber since geomtry tree is Hmp-Hsec-Hgap-Hrow-Hcel-Hpad
+      Int_t   tid=     TVirtualMC::GetMC()->GetStack()->GetCurrentTrackNumber();                                 //take TID
+      Int_t   pid=     TVirtualMC::GetMC()->TrackPid();                                                          //take PID
+      Float_t etot=    TVirtualMC::GetMC()->Etot();                                                              //total hpoton energy, [GeV] 
+      Double_t x[3];   TVirtualMC::GetMC()->TrackPosition(x[0],x[1],x[2]);                                       //take MARS position at entrance to PC
+      Float_t hitTime= (Float_t)TVirtualMC::GetMC()->TrackTime();                                                         //hit formation time 
       Float_t xl,yl;   AliHMPIDParam::Instance()->Mars2Lors(copy,x,xl,yl);                       //take LORS position
       new((*fHits)[fNhits++])AliHMPIDHit(copy,etot,pid,tid,xl,yl,hitTime,x);                             //HIT for photon, position at P, etot will be set to Q
       if(fDoFeed) GenFee(etot);                                                                  //generate feedback photons etot is modified in hit ctor to Q of hit
@@ -831,19 +831,19 @@ void AliHMPIDv2::StepManager()
 //Treat charged particles  
   static Float_t eloss;                                                                           //need to store mip parameters between different steps    
   static Double_t in[3];                                                                          
-  if(gMC->IsTrackEntering() && gMC->TrackCharge() && gMC->CurrentVolID(copy)==fIdPad)             //Trackref stored when entering in the pad volume
-    AddTrackReference(gMC->GetStack()->GetCurrentTrackNumber(), AliTrackReference::kHMPID);       //for acceptance calculations
-  if(gMC->TrackCharge() && gMC->CurrentVolID(copy)==fIdCell){                                     //charged particle in amplification gap (fIdCell)
-    if(gMC->IsTrackEntering()||gMC->IsNewTrack()) {                                               //entering or newly created
+  if(TVirtualMC::GetMC()->IsTrackEntering() && TVirtualMC::GetMC()->TrackCharge() && TVirtualMC::GetMC()->CurrentVolID(copy)==fIdPad)             //Trackref stored when entering in the pad volume
+    AddTrackReference(TVirtualMC::GetMC()->GetStack()->GetCurrentTrackNumber(), AliTrackReference::kHMPID);       //for acceptance calculations
+  if(TVirtualMC::GetMC()->TrackCharge() && TVirtualMC::GetMC()->CurrentVolID(copy)==fIdCell){                                     //charged particle in amplification gap (fIdCell)
+    if(TVirtualMC::GetMC()->IsTrackEntering()||TVirtualMC::GetMC()->IsNewTrack()) {                                               //entering or newly created
       eloss=0;                                                                                    //reset Eloss collector                         
-      gMC->TrackPosition(in[0],in[1],in[2]);                                                      //take position at the entrance
-    }else if(gMC->IsTrackExiting()||gMC->IsTrackStop()||gMC->IsTrackDisappeared()){               //exiting or disappeared
-      eloss              +=gMC->Edep();                                                           //take into account last step Eloss
-                          gMC->CurrentVolOffID(4,copy);                                           //take current chamber since geometry tree is Hmp-Hsec-Hgap-Hrow-Hcel
-      Int_t tid=          gMC->GetStack()->GetCurrentTrackNumber();                               //take TID
-      Int_t pid=          gMC->TrackPid();                                                        //take PID
-      Double_t out[3];    gMC->TrackPosition(out[0],out[1],out[2]);                               //take MARS position at exit
-      Float_t hitTime= (Float_t)gMC->TrackTime();                                                         //hit formation time       
+      TVirtualMC::GetMC()->TrackPosition(in[0],in[1],in[2]);                                                      //take position at the entrance
+    }else if(TVirtualMC::GetMC()->IsTrackExiting()||TVirtualMC::GetMC()->IsTrackStop()||TVirtualMC::GetMC()->IsTrackDisappeared()){               //exiting or disappeared
+      eloss              +=TVirtualMC::GetMC()->Edep();                                                           //take into account last step Eloss
+                          TVirtualMC::GetMC()->CurrentVolOffID(4,copy);                                           //take current chamber since geometry tree is Hmp-Hsec-Hgap-Hrow-Hcel
+      Int_t tid=          TVirtualMC::GetMC()->GetStack()->GetCurrentTrackNumber();                               //take TID
+      Int_t pid=          TVirtualMC::GetMC()->TrackPid();                                                        //take PID
+      Double_t out[3];    TVirtualMC::GetMC()->TrackPosition(out[0],out[1],out[2]);                               //take MARS position at exit
+      Float_t hitTime= (Float_t)TVirtualMC::GetMC()->TrackTime();                                                         //hit formation time       
       out[0]=0.5*(out[0]+in[0]);                                                                  //>
       out[1]=0.5*(out[1]+in[1]);                                                                  //take hit position at the anod plane
       out[2]=0.5*(out[2]+in[2]);                                                                  //>
@@ -851,7 +851,7 @@ void AliHMPIDv2::StepManager()
       new((*fHits)[fNhits++])AliHMPIDHit(copy,eloss,pid,tid,xl,yl,hitTime,out);                   //HIT for MIP, position near anod plane, eloss will be set to Q 
       if(fDoFeed) GenFee(eloss);                                                                  //generate feedback photons 
     }else                                                                                         //just going inside
-      eloss          += gMC->Edep();                                                              //collect this step eloss 
+      eloss          += TVirtualMC::GetMC()->Edep();                                                              //collect this step eloss 
   }//MIP in GAP
 }//StepManager()
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
index fd84ee6..1cef2f4 100644 (file)
@@ -21,7 +21,7 @@
 #include "AliHMPIDRawStream.h"  //Digits2Raw(), Raw2SDigits()
 #include "AliRawReader.h"       //Raw2SDigits()
 #include "AliTrackReference.h"
-#include <TVirtualMC.h>         //StepManager() for gMC
+#include <TVirtualMC.h>         //StepManager() for TVirtualMC::GetMC()
 #include <TPDGCode.h>           //StepHistory() 
 #include <AliStack.h>           //StepManager(),Hits2SDigits()78.6
 #include <AliLoader.h>          //Hits2SDigits()
@@ -160,81 +160,81 @@ HMPID 12  1.e-5 1.e-5 1.e-4  -1.   1.e-4 -1.   -1.    5.e-5 5.e-5 -1.  -1   -1
     Int_t imed;
     
     imed = kSiO2;   // * Quarz Window        (>1000 keV delta-electrons)
-    gMC->Gstpar(idtmed[imed], "CUTGAM",1.e-4);
-    gMC->Gstpar(idtmed[imed], "CUTELE",1.e-4);
-    gMC->Gstpar(idtmed[imed], "CUTNEU",1.e-4);
-    gMC->Gstpar(idtmed[imed], "CUTMUO",1.e-4);    
-    gMC->Gstpar(idtmed[imed], "DCUTE" ,1.e-3);    
-    gMC->Gstpar(idtmed[imed], "CUTHAD",1.e-3);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTGAM",1.e-4);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTELE",1.e-4);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTNEU",1.e-4);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTMUO",1.e-4);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "DCUTE" ,1.e-3);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTHAD",1.e-3);    
     
-    gMC->Gstpar(idtmed[imed], "DRAY",1);    
-    gMC->Gstpar(idtmed[imed], "LOSS",1);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "DRAY",1);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "LOSS",1);    
 
     imed = kC6F14;  // * Freon Radiator      (>  500 keV delta-electrons)
-    gMC->Gstpar(idtmed[imed], "CUTGAM",1.e-4);
-    gMC->Gstpar(idtmed[imed], "CUTELE",1.e-4);
-    gMC->Gstpar(idtmed[imed], "CUTNEU",1.e-4);
-    gMC->Gstpar(idtmed[imed], "CUTMUO",1.e-4);    
-    gMC->Gstpar(idtmed[imed], "DCUTE" ,5.e-4);    
-    gMC->Gstpar(idtmed[imed], "CUTHAD",5.e-4);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTGAM",1.e-4);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTELE",1.e-4);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTNEU",1.e-4);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTMUO",1.e-4);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "DCUTE" ,5.e-4);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTHAD",5.e-4);    
     
-    gMC->Gstpar(idtmed[imed], "DRAY",1);    
-    gMC->Gstpar(idtmed[imed], "LOSS",1);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "DRAY",1);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "LOSS",1);    
     
     imed = kCH4;  // * Methane Gap         (>  100 keV delta-electrons)
-    gMC->Gstpar(idtmed[imed], "CUTGAM",5.e-5);
-    gMC->Gstpar(idtmed[imed], "CUTELE",5.e-5);
-    gMC->Gstpar(idtmed[imed], "CUTNEU",1.e-4);
-    gMC->Gstpar(idtmed[imed], "CUTMUO",1.e-4);    
-    gMC->Gstpar(idtmed[imed], "DCUTE" ,1.e-4);    
-    gMC->Gstpar(idtmed[imed], "CUTHAD",1.e-4);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTGAM",5.e-5);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTELE",5.e-5);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTNEU",1.e-4);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTMUO",1.e-4);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "DCUTE" ,1.e-4);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTHAD",1.e-4);    
     
-    gMC->Gstpar(idtmed[imed], "DRAY",1);    
-    gMC->Gstpar(idtmed[imed], "LOSS",1);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "DRAY",1);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "LOSS",1);    
     
     imed = kCsI;  // * CSI    (>  50 keV delta-electrons)
-    gMC->Gstpar(idtmed[imed], "CUTGAM",1.e-5);
-    gMC->Gstpar(idtmed[imed], "CUTELE",1.e-5);
-    gMC->Gstpar(idtmed[imed], "CUTNEU",1.e-4);
-    gMC->Gstpar(idtmed[imed], "CUTMUO",1.e-4);    
-    gMC->Gstpar(idtmed[imed], "DCUTE" ,5.e-5);    
-    gMC->Gstpar(idtmed[imed], "CUTHAD",5.e-5);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTGAM",1.e-5);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTELE",1.e-5);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTNEU",1.e-4);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTMUO",1.e-4);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "DCUTE" ,5.e-5);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTHAD",5.e-5);    
     
-    gMC->Gstpar(idtmed[imed], "DRAY",1);    
-    gMC->Gstpar(idtmed[imed], "LOSS",1);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "DRAY",1);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "LOSS",1);
     
     imed = kAl;  // * Alluminium    (>  50 keV delta-electrons)
-    gMC->Gstpar(idtmed[imed], "CUTGAM",1.e-5);
-    gMC->Gstpar(idtmed[imed], "CUTELE",1.e-5);
-    gMC->Gstpar(idtmed[imed], "CUTNEU",1.e-4);
-    gMC->Gstpar(idtmed[imed], "CUTMUO",1.e-4);    
-    gMC->Gstpar(idtmed[imed], "DCUTE" ,5.e-5);    
-    gMC->Gstpar(idtmed[imed], "CUTHAD",5.e-5);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTGAM",1.e-5);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTELE",1.e-5);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTNEU",1.e-4);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTMUO",1.e-4);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "DCUTE" ,5.e-5);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTHAD",5.e-5);    
     
-    gMC->Gstpar(idtmed[imed], "DRAY",1);    
-    gMC->Gstpar(idtmed[imed], "LOSS",1);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "DRAY",1);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "LOSS",1);    
     
     imed = kCu;  // * Copper       (>  50 keV delta-electrons)
-    gMC->Gstpar(idtmed[imed], "CUTGAM",1.e-5);
-    gMC->Gstpar(idtmed[imed], "CUTELE",1.e-5);
-    gMC->Gstpar(idtmed[imed], "CUTNEU",1.e-4);
-    gMC->Gstpar(idtmed[imed], "CUTMUO",1.e-4);    
-    gMC->Gstpar(idtmed[imed], "DCUTE" ,5.e-5);    
-    gMC->Gstpar(idtmed[imed], "CUTHAD",5.e-5);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTGAM",1.e-5);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTELE",1.e-5);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTNEU",1.e-4);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTMUO",1.e-4);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "DCUTE" ,5.e-5);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTHAD",5.e-5);    
     
-    gMC->Gstpar(idtmed[imed], "DRAY",1);    
-    gMC->Gstpar(idtmed[imed], "LOSS",1);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "DRAY",1);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "LOSS",1);    
     
     imed = kW;  // * Tungsten     (>  50 keV delta-electrons)
-    gMC->Gstpar(idtmed[imed], "CUTGAM",1.e-5);
-    gMC->Gstpar(idtmed[imed], "CUTELE",1.e-5);
-    gMC->Gstpar(idtmed[imed], "CUTNEU",1.e-4);
-    gMC->Gstpar(idtmed[imed], "CUTMUO",1.e-4);    
-    gMC->Gstpar(idtmed[imed], "DCUTE" ,5.e-5);    
-    gMC->Gstpar(idtmed[imed], "CUTHAD",5.e-5);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTGAM",1.e-5);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTELE",1.e-5);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTNEU",1.e-4);
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTMUO",1.e-4);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "DCUTE" ,5.e-5);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "CUTHAD",5.e-5);    
     
-    gMC->Gstpar(idtmed[imed], "DRAY",1);    
-    gMC->Gstpar(idtmed[imed], "LOSS",1);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "DRAY",1);    
+    TVirtualMC::GetMC()->Gstpar(idtmed[imed], "LOSS",1);    
     
 }*/
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -244,7 +244,7 @@ void AliHMPIDv3::CreateGeometry()
 //includind the HMPID cradle
 
   AliDebug(1,"Start main.");
-  if(!gMC->IsRootGeometrySupported()) return;                
+  if(!TVirtualMC::GetMC()->IsRootGeometrySupported()) return;                
 
   TGeoVolume *hmpcradle = CreateCradle();
   TString title=GetTitle();
@@ -503,7 +503,7 @@ return hmp;
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void AliHMPIDv3::Init()
 {
-// This method defines ID for sensitive volumes, i.e. such geometry volumes for which there are if(gMC->CurrentVolID()==XXX) 
+// This method defines ID for sensitive volumes, i.e. such geometry volumes for which there are if(TVirtualMC::GetMC()->CurrentVolID()==XXX) 
 // statements in StepManager()
 // Arguments: none
 //   Returns: none      
@@ -554,20 +554,20 @@ void AliHMPIDv3::DefineOpticalProperties()
     dQePc [i]= pQeF->Eval(eV);
     dReflMet[i] = 0.;     // no reflection on the surface of the pc (?)                                       
   }
-  gMC->SetCerenkov((*fIdtmed)[kC6F14]    , kNbins, aEckov, aAbsRad  , aQeAll , aIdxRad );    
-  gMC->SetCerenkov((*fIdtmed)[kSiO2]     , kNbins, aEckov, aAbsWin  , aQeAll , aIdxWin );    
-  gMC->SetCerenkov((*fIdtmed)[kCH4]      , kNbins, aEckov, aAbsGap  , aQeAll , aIdxGap );    
-  gMC->SetCerenkov((*fIdtmed)[kCu]       , kNbins, aEckov, aAbsMet  , aQeAll , aIdxMet );    
-  gMC->SetCerenkov((*fIdtmed)[kW]        , kNbins, aEckov, aAbsMet  , aQeAll , aIdxMet ); //n=0 means reflect photons       
-  gMC->SetCerenkov((*fIdtmed)[kCsI]      , kNbins, aEckov, aAbsMet  , aQePc  , aIdxPc  ); //n=1 means convert photons    
-  gMC->SetCerenkov((*fIdtmed)[kAl]       , kNbins, aEckov, aAbsMet  , aQeAll , aIdxMet );    
+  TVirtualMC::GetMC()->SetCerenkov((*fIdtmed)[kC6F14]    , kNbins, aEckov, aAbsRad  , aQeAll , aIdxRad );    
+  TVirtualMC::GetMC()->SetCerenkov((*fIdtmed)[kSiO2]     , kNbins, aEckov, aAbsWin  , aQeAll , aIdxWin );    
+  TVirtualMC::GetMC()->SetCerenkov((*fIdtmed)[kCH4]      , kNbins, aEckov, aAbsGap  , aQeAll , aIdxGap );    
+  TVirtualMC::GetMC()->SetCerenkov((*fIdtmed)[kCu]       , kNbins, aEckov, aAbsMet  , aQeAll , aIdxMet );    
+  TVirtualMC::GetMC()->SetCerenkov((*fIdtmed)[kW]        , kNbins, aEckov, aAbsMet  , aQeAll , aIdxMet ); //n=0 means reflect photons       
+  TVirtualMC::GetMC()->SetCerenkov((*fIdtmed)[kCsI]      , kNbins, aEckov, aAbsMet  , aQePc  , aIdxPc  ); //n=1 means convert photons    
+  TVirtualMC::GetMC()->SetCerenkov((*fIdtmed)[kAl]       , kNbins, aEckov, aAbsMet  , aQeAll , aIdxMet );    
 
   // Define a skin surface for the photocatode to enable 'detection' in G4
   for(Int_t i=0; i<7; i++){
-  gMC->DefineOpSurface(Form("surfPc%i",i), kGlisur /*kUnified*/,kDielectric_metal,kPolished, 0.);
-  gMC->SetMaterialProperty(Form("surfPc%i",i), "EFFICIENCY", kNbins, dEckov, dQePc);
-  gMC->SetMaterialProperty(Form("surfPc%i",i), "REFLECTIVITY", kNbins, dEckov, dReflMet);
-  gMC->SetSkinSurface(Form("skinPc%i",i), Form("Hpad%i",i),Form("surfPc%i",i)); }
+  TVirtualMC::GetMC()->DefineOpSurface(Form("surfPc%i",i), kGlisur /*kUnified*/,kDielectric_metal,kPolished, 0.);
+  TVirtualMC::GetMC()->SetMaterialProperty(Form("surfPc%i",i), "EFFICIENCY", kNbins, dEckov, dQePc);
+  TVirtualMC::GetMC()->SetMaterialProperty(Form("surfPc%i",i), "REFLECTIVITY", kNbins, dEckov, dReflMet);
+  TVirtualMC::GetMC()->SetSkinSurface(Form("skinPc%i",i), Form("Hpad%i",i),Form("surfPc%i",i)); }
 
   delete pRaAF;delete pWiAF;delete pGaAF; delete pRaIF; delete pWiIF; delete pGaIF; delete pQeF;
 }
@@ -577,13 +577,13 @@ Bool_t AliHMPIDv3::IsLostByFresnel()
 // Calculate probability for the photon to be lost by Fresnel reflection.
   TLorentzVector p4;
   Double_t mom[3],localMom[3];
-  gMC->TrackMomentum(p4);   mom[0]=p4(1);   mom[1]=p4(2);   mom[2]=p4(3);
+  TVirtualMC::GetMC()->TrackMomentum(p4);   mom[0]=p4(1);   mom[1]=p4(2);   mom[2]=p4(3);
   localMom[0]=0; localMom[1]=0; localMom[2]=0;
-  gMC->Gmtod(mom,localMom,2);
+  TVirtualMC::GetMC()->Gmtod(mom,localMom,2);
   Double_t localTc    = localMom[0]*localMom[0]+localMom[2]*localMom[2];
   Double_t localTheta = TMath::ATan2(TMath::Sqrt(localTc),localMom[1]);
   Double_t cotheta = TMath::Abs(TMath::Cos(localTheta));
-  if(gMC->GetRandom()->Rndm() < Fresnel(p4.E()*1e9,cotheta,1)){
+  if(TVirtualMC::GetMC()->GetRandom()->Rndm() < Fresnel(p4.E()*1e9,cotheta,1)){
     AliDebug(1,"Photon lost");
     return kTRUE;
   }else
@@ -595,21 +595,21 @@ void AliHMPIDv3::GenFee(Float_t qtot)
 // Generate FeedBack photons for the current particle. To be invoked from StepManager().
 // eloss=0 means photon so only pulse height distribution is to be analysed.
   TLorentzVector x4;
-  gMC->TrackPosition(x4); 
-  Int_t iNphotons=gMC->GetRandom()->Poisson(0.02*qtot);  //# of feedback photons is proportional to the charge of hit
+  TVirtualMC::GetMC()->TrackPosition(x4); 
+  Int_t iNphotons=TVirtualMC::GetMC()->GetRandom()->Poisson(0.02*qtot);  //# of feedback photons is proportional to the charge of hit
   AliDebug(1,Form("N photons=%i",iNphotons));
   Int_t j;
   Float_t cthf, phif, enfp = 0, sthf, e1[3], e2[3], e3[3], vmod, uswop,dir[3], phi,pol[3], mom[4];
 //Generate photons
   for(Int_t i=0;i<iNphotons;i++){//feedbacks loop
     Double_t ranf[2];
-    gMC->GetRandom()->RndmArray(2,ranf);    //Sample direction
+    TVirtualMC::GetMC()->GetRandom()->RndmArray(2,ranf);    //Sample direction
     cthf=ranf[0]*2-1.0;
     if(cthf<0) continue;
     sthf = TMath::Sqrt((1. - cthf) * (1. + cthf));
     phif = ranf[1] * 2 * TMath::Pi();
     
-    if(Double_t randomNumber=gMC->GetRandom()->Rndm()<=0.57)
+    if(Double_t randomNumber=TVirtualMC::GetMC()->GetRandom()->Rndm()<=0.57)
       enfp = 7.5e-9;
     else if(randomNumber<=0.7)
       enfp = 6.4e-9;
@@ -618,7 +618,7 @@ void AliHMPIDv3::GenFee(Float_t qtot)
     
 
     dir[0] = sthf * TMath::Sin(phif);    dir[1] = cthf;    dir[2] = sthf * TMath::Cos(phif);
-    gMC->Gdtom(dir, mom, 2);
+    TVirtualMC::GetMC()->Gdtom(dir, mom, 2);
     mom[0]*=enfp;    mom[1]*=enfp;    mom[2]*=enfp;
     mom[3] = TMath::Sqrt(mom[0]*mom[0]+mom[1]*mom[1]+mom[2]*mom[2]);
     
@@ -645,9 +645,9 @@ void AliHMPIDv3::GenFee(Float_t qtot)
     vmod=0;  for(j=0;j<3;j++) vmod+=e1[j]*e1[j];  vmod=TMath::Sqrt(1/vmod);  for(j=0;j<3;j++) e1[j]*=vmod;    
     vmod=0;  for(j=0;j<3;j++) vmod+=e2[j]*e2[j];  vmod=TMath::Sqrt(1/vmod);  for(j=0;j<3;j++) e2[j]*=vmod;
     
-    phi = gMC->GetRandom()->Rndm()* 2 * TMath::Pi();
+    phi = TVirtualMC::GetMC()->GetRandom()->Rndm()* 2 * TMath::Pi();
     for(j=0;j<3;j++) pol[j]=e1[j]*TMath::Sin(phi)+e2[j]*TMath::Cos(phi);
-    gMC->Gdtom(pol, pol, 2);
+    TVirtualMC::GetMC()->Gdtom(pol, pol, 2);
     Int_t outputNtracksStored;    
     gAlice->GetMCApp()->PushTrack(1,                             //transport
                      gAlice->GetMCApp()->GetCurrentTrackNumber(),//parent track 
@@ -821,7 +821,7 @@ void AliHMPIDv3::StepHistory()
 // This methode is invoked from StepManager() in order to print out 
   static Int_t iStepN;
   const char *sParticle;
-  switch(gMC->TrackPid()){
+  switch(TVirtualMC::GetMC()->TrackPid()){
     case kProton:      sParticle="PROTON"    ;break;
     case kNeutron:     sParticle="neutron"   ;break;
     case kGamma:       sParticle="gamma"     ;break;
@@ -834,38 +834,38 @@ void AliHMPIDv3::StepHistory()
   }
 
   TString flag="fanny combination";
-  if(gMC->IsTrackAlive()) {
-    if(gMC->IsTrackEntering())      flag="enters to";
-    else if(gMC->IsTrackExiting())  flag="exits from";
-    else if(gMC->IsTrackInside())   flag="inside";
+  if(TVirtualMC::GetMC()->IsTrackAlive()) {
+    if(TVirtualMC::GetMC()->IsTrackEntering())      flag="enters to";
+    else if(TVirtualMC::GetMC()->IsTrackExiting())  flag="exits from";
+    else if(TVirtualMC::GetMC()->IsTrackInside())   flag="inside";
   } else {
-    if(gMC->IsTrackStop())          flag="stopped in";
+    if(TVirtualMC::GetMC()->IsTrackStop())          flag="stopped in";
   }
   
   Int_t vid=0,copy=0;
-  TString path=gMC->CurrentVolName(); path.Prepend("-");path.Prepend(gMC->CurrentVolOffName(1));//current volume and his mother are always there
-  vid=gMC->CurrentVolOffID(2,copy);  if(vid) {path.Prepend("-");path.Prepend(gMC->VolName(vid));}
-  vid=gMC->CurrentVolOffID(3,copy);  if(vid) {path.Prepend("-");path.Prepend(gMC->VolName(vid));}
+  TString path=TVirtualMC::GetMC()->CurrentVolName(); path.Prepend("-");path.Prepend(TVirtualMC::GetMC()->CurrentVolOffName(1));//current volume and his mother are always there
+  vid=TVirtualMC::GetMC()->CurrentVolOffID(2,copy);  if(vid) {path.Prepend("-");path.Prepend(TVirtualMC::GetMC()->VolName(vid));}
+  vid=TVirtualMC::GetMC()->CurrentVolOffID(3,copy);  if(vid) {path.Prepend("-");path.Prepend(TVirtualMC::GetMC()->VolName(vid));}
  
   
-  Printf("Step %i: %s (%i) %s %s m=%.6f GeV q=%.1f dEdX=%.4f Etot=%.4f",iStepN,sParticle,gMC->TrackPid(),flag.Data(),path.Data(),gMC->TrackMass(),gMC->TrackCharge(),gMC->Edep()*1e9,gMC->Etot());
+  Printf("Step %i: %s (%i) %s %s m=%.6f GeV q=%.1f dEdX=%.4f Etot=%.4f",iStepN,sParticle,TVirtualMC::GetMC()->TrackPid(),flag.Data(),path.Data(),TVirtualMC::GetMC()->TrackMass(),TVirtualMC::GetMC()->TrackCharge(),TVirtualMC::GetMC()->Edep()*1e9,TVirtualMC::GetMC()->Etot());
   
-  Double_t gMcTrackPos[3]; gMC->TrackPosition(gMcTrackPos[0],gMcTrackPos[1],gMcTrackPos[2]);
-  Double_t  gMcTrackPosLoc[3]; gMC->Gmtod(gMcTrackPos,gMcTrackPosLoc,1);
-  Printf("gMC Track Position (MARS) x: %5.3lf, y: %5.3lf, z: %5.3lf (r: %5.3lf) ---> (LOC) x: %5.3f, y: %5.3f, z: %5.3f",gMcTrackPos[0],gMcTrackPos[1],gMcTrackPos[2],TMath::Sqrt(gMcTrackPos[0]*gMcTrackPos[0]+gMcTrackPos[1]*gMcTrackPos[1]+gMcTrackPos[2]*gMcTrackPos[2]),gMcTrackPosLoc[0],gMcTrackPosLoc[1],gMcTrackPosLoc[2]);
+  Double_t gMcTrackPos[3]; TVirtualMC::GetMC()->TrackPosition(gMcTrackPos[0],gMcTrackPos[1],gMcTrackPos[2]);
+  Double_t  gMcTrackPosLoc[3]; TVirtualMC::GetMC()->Gmtod(gMcTrackPos,gMcTrackPosLoc,1);
+  Printf("TVirtualMC::GetMC() Track Position (MARS) x: %5.3lf, y: %5.3lf, z: %5.3lf (r: %5.3lf) ---> (LOC) x: %5.3f, y: %5.3f, z: %5.3f",gMcTrackPos[0],gMcTrackPos[1],gMcTrackPos[2],TMath::Sqrt(gMcTrackPos[0]*gMcTrackPos[0]+gMcTrackPos[1]*gMcTrackPos[1]+gMcTrackPos[2]*gMcTrackPos[2]),gMcTrackPosLoc[0],gMcTrackPosLoc[1],gMcTrackPosLoc[2]);
   
 
   
   Printf("Step %i: tid=%i flags alive=%i disap=%i enter=%i exit=%i inside=%i out=%i stop=%i new=%i",
                             iStepN, gAlice->GetMCApp()->GetCurrentTrackNumber(),
-                            gMC->IsTrackAlive(), gMC->IsTrackDisappeared(),gMC->IsTrackEntering(), gMC->IsTrackExiting(),
-                            gMC->IsTrackInside(),gMC->IsTrackOut(),        gMC->IsTrackStop(),     gMC->IsNewTrack());
+                            TVirtualMC::GetMC()->IsTrackAlive(), TVirtualMC::GetMC()->IsTrackDisappeared(),TVirtualMC::GetMC()->IsTrackEntering(), TVirtualMC::GetMC()->IsTrackExiting(),
+                            TVirtualMC::GetMC()->IsTrackInside(),TVirtualMC::GetMC()->IsTrackOut(),        TVirtualMC::GetMC()->IsTrackStop(),     TVirtualMC::GetMC()->IsNewTrack());
   
   Float_t a,z,den,rad,abs; a=z=den=rad=abs=-1;
-  Int_t mid=gMC->CurrentMaterial(a,z,den,rad,abs);
+  Int_t mid=TVirtualMC::GetMC()->CurrentMaterial(a,z,den,rad,abs);
   Printf("Step %i: mid=%i a=%7.2f z=%7.2f den=%9.4f rad=%9.2f abs=%9.2f\n\n",iStepN,mid,a,z,den,rad,abs);
   
-  TArrayI proc;  gMC->StepProcesses(proc); 
+  TArrayI proc;  TVirtualMC::GetMC()->StepProcesses(proc); 
   Printf("Processes in this step:");
   for ( int i = 0 ; i < proc.GetSize(); i++)
   {
@@ -884,17 +884,17 @@ void AliHMPIDv3::StepManager()
 //  StepHistory(); return; //uncomment to print tracks history
  //  StepCount(); return;     //uncomment to count photons
   
-   TString volname = gMC->CurrentVolName();
+   TString volname = TVirtualMC::GetMC()->CurrentVolName();
 
 //Treat photons    
-    if((gMC->TrackPid()==50000050||gMC->TrackPid()==50000051)&&volname.Contains("Hpad")){ //photon (Ckov or feedback) hits on module PC (Hpad)
-    if(gMC->Edep()>0){                                                                           //photon survided QE test i.e. produces electron
-      if(IsLostByFresnel()){ gMC->StopTrack(); return;}                                          //photon lost due to fersnel reflection on PC       
-      Int_t   tid=     gMC->GetStack()->GetCurrentTrackNumber();                                 //take TID
-      Int_t   pid=     gMC->TrackPid();                                                          //take PID
-      Float_t etot=    gMC->Etot();                                                              //total hpoton energy, [GeV] 
-      Double_t x[3];   gMC->TrackPosition(x[0],x[1],x[2]);                                       //take MARS position at entrance to PC
-      Float_t hitTime= (Float_t)gMC->TrackTime();                                                //hit formation time       
+    if((TVirtualMC::GetMC()->TrackPid()==50000050||TVirtualMC::GetMC()->TrackPid()==50000051)&&volname.Contains("Hpad")){ //photon (Ckov or feedback) hits on module PC (Hpad)
+    if(TVirtualMC::GetMC()->Edep()>0){                                                                           //photon survided QE test i.e. produces electron
+      if(IsLostByFresnel()){ TVirtualMC::GetMC()->StopTrack(); return;}                                          //photon lost due to fersnel reflection on PC       
+      Int_t   tid=     TVirtualMC::GetMC()->GetStack()->GetCurrentTrackNumber();                                 //take TID
+      Int_t   pid=     TVirtualMC::GetMC()->TrackPid();                                                          //take PID
+      Float_t etot=    TVirtualMC::GetMC()->Etot();                                                              //total hpoton energy, [GeV] 
+      Double_t x[3];   TVirtualMC::GetMC()->TrackPosition(x[0],x[1],x[2]);                                       //take MARS position at entrance to PC
+      Float_t hitTime= (Float_t)TVirtualMC::GetMC()->TrackTime();                                                //hit formation time       
       TString tmpname = volname; tmpname.Remove(0,4); Int_t idch = tmpname.Atoi();               //retrieve the chamber number
       Float_t xl,yl;   AliHMPIDParam::Instance()->Mars2Lors(idch,x,xl,yl);                       //take LORS position 
       new((*fHits)[fNhits++])AliHMPIDHit(idch,etot,pid,tid,xl,yl,hitTime,x);                             //HIT for photon, position at P, etot will be set to Q
@@ -907,20 +907,20 @@ void AliHMPIDv3::StepManager()
   static Float_t eloss;                                                                           //need to store mip parameters between different steps    
   static Double_t in[3];                                                                          
 
-  if(gMC->IsTrackEntering() && gMC->TrackCharge() && volname.Contains("Hpad")) //Trackref stored when entering in the pad volume
-    AddTrackReference(gMC->GetStack()->GetCurrentTrackNumber(), AliTrackReference::kHMPID);       //for acceptance calculations
+  if(TVirtualMC::GetMC()->IsTrackEntering() && TVirtualMC::GetMC()->TrackCharge() && volname.Contains("Hpad")) //Trackref stored when entering in the pad volume
+    AddTrackReference(TVirtualMC::GetMC()->GetStack()->GetCurrentTrackNumber(), AliTrackReference::kHMPID);       //for acceptance calculations
    
 
-  if(gMC->TrackCharge() && volname.Contains("Hcel")){                                           //charged particle in amplification gap (Hcel)
-    if(gMC->IsTrackEntering()||gMC->IsNewTrack()) {                                               //entering or newly created
+  if(TVirtualMC::GetMC()->TrackCharge() && volname.Contains("Hcel")){                                           //charged particle in amplification gap (Hcel)
+    if(TVirtualMC::GetMC()->IsTrackEntering()||TVirtualMC::GetMC()->IsNewTrack()) {                                               //entering or newly created
       eloss=0;                                                                                    //reset Eloss collector                         
-      gMC->TrackPosition(in[0],in[1],in[2]);                                                      //take position at the entrance
-    }else if(gMC->IsTrackExiting()||gMC->IsTrackStop()||gMC->IsTrackDisappeared()){               //exiting or disappeared
-      eloss              +=gMC->Edep();                                                           //take into account last step Eloss
-      Int_t tid=          gMC->GetStack()->GetCurrentTrackNumber();                               //take TID
-      Int_t pid=          gMC->TrackPid();                                                        //take PID
-      Double_t out[3];    gMC->TrackPosition(out[0],out[1],out[2]);                               //take MARS position at exit
-      Float_t hitTime= (Float_t)gMC->TrackTime();                                                         //hit formation time       
+      TVirtualMC::GetMC()->TrackPosition(in[0],in[1],in[2]);                                                      //take position at the entrance
+    }else if(TVirtualMC::GetMC()->IsTrackExiting()||TVirtualMC::GetMC()->IsTrackStop()||TVirtualMC::GetMC()->IsTrackDisappeared()){               //exiting or disappeared
+      eloss              +=TVirtualMC::GetMC()->Edep();                                                           //take into account last step Eloss
+      Int_t tid=          TVirtualMC::GetMC()->GetStack()->GetCurrentTrackNumber();                               //take TID
+      Int_t pid=          TVirtualMC::GetMC()->TrackPid();                                                        //take PID
+      Double_t out[3];    TVirtualMC::GetMC()->TrackPosition(out[0],out[1],out[2]);                               //take MARS position at exit
+      Float_t hitTime= (Float_t)TVirtualMC::GetMC()->TrackTime();                                                         //hit formation time       
       out[0]=0.5*(out[0]+in[0]);                                                                  //
       out[1]=0.5*(out[1]+in[1]);                                                                  //take hit position at the anod plane
       out[2]=0.5*(out[2]+in[2]);
@@ -931,7 +931,7 @@ void AliHMPIDv3::StepManager()
         if(fDoFeed) GenFee(eloss);                                                                  //generate feedback photons 
       }
     }else                                                                                         //just going inside
-      eloss          += gMC->Edep();                                                              //collect this step eloss 
+      eloss          += TVirtualMC::GetMC()->Edep();                                                              //collect this step eloss 
   }//MIP in GAP
  
 }//StepManager()
index d62eebd..ae9d9b5 100644 (file)
@@ -286,7 +286,7 @@ void AliITS::Init(){
     //      none.
     Int_t i;
     // Array of TStrings
-    if(gMC) for(i=0;i<fIdN;i++) fIdSens[i] = gMC->VolId(fIdName[i]);
+    if(TVirtualMC::GetMC()) for(i=0;i<fIdN;i++) fIdSens[i] = TVirtualMC::GetMC()->VolId(fIdName[i]);
  
 }
 //______________________________________________________________________
index 88cb54a..a1881bb 100644 (file)
@@ -422,7 +422,7 @@ void AliITSMultReconstructor::Reconstruct(AliESDEvent* esd, TTree* treeRP)
     vtx = 0;
   }
   if(vtx){
-    float vtxf[3] = {vtx->GetX(),vtx->GetY(),vtx->GetZ()};
+    float vtxf[3] = {static_cast<float>(vtx->GetX()),static_cast<float>(vtx->GetY()),static_cast<float>(vtx->GetZ())};
     FindTracklets(vtxf);
   }
   else {
index fef4e33..89c95a2 100644 (file)
@@ -273,7 +273,7 @@ void AliITSV0Finder::FindV02(AliESDEvent *event,
   dummy->SetLabel(0);
   AliITStrackMI  trackat0;    //temporary track for DCA calculation
   //
-  Float_t primvertex[3]={tracker->GetX(),tracker->GetY(),tracker->GetZ()};
+  Float_t primvertex[3]={static_cast<Float_t>(tracker->GetX()),static_cast<Float_t>(tracker->GetY()),static_cast<Float_t>(tracker->GetZ())};
   //
   // make ITS -  ESD map
   //
@@ -1052,7 +1052,7 @@ void AliITSV0Finder::RefitV02(const AliESDEvent *event,
   TTreeSRedirector &cstream = *(tracker->GetDebugStreamer());
   //
   Int_t  nv0s = event->GetNumberOfV0s();
-  Float_t primvertex[3]={tracker->GetX(),tracker->GetY(),tracker->GetZ()};
+  Float_t primvertex[3]={static_cast<Float_t>(tracker->GetX()),static_cast<Float_t>(tracker->GetY()),static_cast<Float_t>(tracker->GetZ())};
   AliV0 v0temp;
   for (Int_t iv0 = 0; iv0<nv0s;iv0++){
     AliV0 * v0mi = (AliV0*)event->GetV0(iv0);
index f1264fe..d4fbdef 100644 (file)
@@ -1062,19 +1062,19 @@ TNode* AliITSgeomMatrix::CreateNode(const Char_t *nodeName,
         Int_t i,j;
         const Float_t kScale=0.5,kLw=0.2;
         Float_t xchar[13][2]={
-            {0.5*kLw,1.},{0.,0.5*kLw},{0.5-0.5*kLw,0.5},
-            {0.,0.5*kLw},{0.5*kLw,0.},{0.5,0.5-0.5*kLw},
-            {1-0.5*kLw,0.},{1.,0.5*kLw},{0.5+0.5*kLw,0.5},
-            {1.,1.-0.5*kLw},{1.-0.5*kLw,1.},{0.5,0.5+0.5*kLw},
-            {0.5*kLw,1.}};
+         {static_cast<Float_t>(0.5*kLw),1.},{0.,static_cast<Float_t>(0.5*kLw)},{static_cast<Float_t>(0.5-0.5*kLw),0.5},
+         {0.,static_cast<Float_t>(0.5*kLw)},{static_cast<Float_t>(0.5*kLw),0.},{0.5,static_cast<Float_t>(0.5-0.5*kLw)},
+         {static_cast<Float_t>(1-0.5*kLw),0.},{1.,static_cast<Float_t>(0.5*kLw)},{static_cast<Float_t>(0.5+0.5*kLw),0.5},
+         {1.,static_cast<Float_t>(1.-0.5*kLw)},{static_cast<Float_t>(1.-0.5*kLw),1.},{0.5,static_cast<Float_t>(0.5+0.5*kLw)},
+         {static_cast<Float_t>(0.5*kLw),1.}};
         Float_t ychar[10][2]={
-            {.5-0.5*kLw,0.},{.5+0.5*kLw,0.},{.5+0.5*kLw,0.5-0.5*kLw},
-            {1.,1.-0.5*kLw},{1.-0.5*kLw,1.},{0.5+0.5*kLw,0.5},
-            {0.5*kLw,1.}   ,{0.,1-0.5*kLw} ,{0.5-0.5*kLw,0.5},
-            {.5-0.5*kLw,0.}};
+         {static_cast<Float_t>(.5-0.5*kLw),0.},{static_cast<Float_t>(.5+0.5*kLw),0.},{static_cast<Float_t>(.5+0.5*kLw),static_cast<Float_t>(0.5-0.5*kLw)},
+         {1.,static_cast<Float_t>(1.-0.5*kLw)},{static_cast<Float_t>(1.-0.5*kLw),1.},{static_cast<Float_t>(0.5+0.5*kLw),0.5},
+         {static_cast<Float_t>(0.5*kLw),1.}   ,{0.,static_cast<Float_t>(1-0.5*kLw)} ,{static_cast<Float_t>(0.5-0.5*kLw),0.5},
+         {static_cast<Float_t>(.5-0.5*kLw),0.}};
         Float_t zchar[11][2]={
-            {0.,1.},{0,1.-kLw},{1.-kLw,1.-kLw},{0.,kLw}   ,{0.,0.},
-            {1.,0.},{1.,kLw}  ,{kLw,kLw}      ,{1.,1.-kLw},{1.,1.},
+         {0.,1.},{0,static_cast<Float_t>(1.-kLw)},{static_cast<Float_t>(1.-kLw),static_cast<Float_t>(1.-kLw)},{0.,kLw}   ,{0.,0.},
+         {1.,0.},{1.,kLw}  ,{kLw,kLw}      ,{1.,static_cast<Float_t>(1.-kLw)},{1.,1.},
             {0.,1.}};
         for(i=0;i<13;i++)for(j=0;j<2;j++){
             if(i<13) xchar[i][j] = kScale*xchar[i][j];
@@ -1091,17 +1091,17 @@ TNode* AliITSgeomMatrix::CreateNode(const Char_t *nodeName,
         for(i=0;i<10;i++) axiszl->DefineVertex(i,zchar[i][0],zchar[i][1]);
         axiszl->DefineSection(0,-0.5*kLw);axiszl->DefineSection(1,0.5*kLw);
         Float_t lxy[13][2]={
-            {-0.5*kLw,-0.5*kLw},{0.8,-0.5*kLw},{0.8,-0.1},{1.0,0.0},
-            {0.8,0.1},{0.8,0.5*kLw},{0.5*kLw,0.5*kLw},{0.5*kLw,0.8},
-            {0.1,0.8},{0.0,1.0},{-0.1,0.8},{-0.5*kLw,0.8},
-            {-0.5*kLw,-0.5*kLw}};
+         {static_cast<Float_t>(-0.5*kLw),static_cast<Float_t>(-0.5*kLw)},{0.8,static_cast<Float_t>(-0.5*kLw)},{0.8,-0.1},{1.0,0.0},
+         {0.8,0.1},{0.8,static_cast<Float_t>(0.5*kLw)},{static_cast<Float_t>(0.5*kLw),static_cast<Float_t>(0.5*kLw)},{static_cast<Float_t>(0.5*kLw),0.8},
+         {0.1,0.8},{0.0,1.0},{-0.1,0.8},{static_cast<Float_t>(-0.5*kLw),0.8},
+         {static_cast<Float_t>(-0.5*kLw),static_cast<Float_t>(-0.5*kLw)}};
         TXTRU *axisxy = new TXTRU("axisxy","axisxy","text",13,2);
         for(i=0;i<13;i++) axisxy->DefineVertex(i,lxy[i][0],lxy[i][1]);
         axisxy->DefineSection(0,-0.5*kLw);axisxy->DefineSection(1,0.5*kLw);
         Float_t lz[8][2]={
-            {0.5*kLw,-0.5*kLw},{0.8,-0.5*kLw},{0.8,-0.1},{1.0,0.0},
-            {0.8,0.1},{0.8,0.5*kLw},{0.5*kLw,0.5*kLw},
-            {0.5*kLw,-0.5*kLw}};
+         {static_cast<Float_t>(0.5*kLw),static_cast<Float_t>(-0.5*kLw)},{0.8,static_cast<Float_t>(-0.5*kLw)},{0.8,-0.1},{1.0,0.0},
+         {0.8,0.1},{0.8,static_cast<Float_t>(0.5*kLw)},{static_cast<Float_t>(0.5*kLw),static_cast<Float_t>(0.5*kLw)},
+         {static_cast<Float_t>(0.5*kLw),static_cast<Float_t>(-0.5*kLw)}};
         TXTRU *axisz = new TXTRU("axisz","axisz","text",8,2);
         for(i=0;i<8;i++) axisz->DefineVertex(i,lz[i][0],lz[i][1]);
         axisz->DefineSection(0,-0.5*kLw);axisz->DefineSection(1,0.5*kLw);
index 84afdd3..e5510e3 100644 (file)
@@ -132,7 +132,7 @@ void AliITSsimulationFastPoints::CreateFastRecPoints(AliITSmodule *mod,
          Int_t lab[4] = {hit->GetTrack(),-3,-3,ind};
          Float_t q=kdEdXtoQ*(hitdestep+deltaDe);
          if(hitlay<3) q=1.; // SPD binary readout
-         Float_t hitv[6] = {locals[0],locals[2],sigmarphi*sigmarphi,sigmaz*sigmaz,q,q};
+         Float_t hitv[6] = {locals[0],locals[2],static_cast<Float_t>(sigmarphi*sigmarphi),static_cast<Float_t>(sigmaz*sigmaz),q,q};
          Int_t info[3] = {0,0,lyr};
          AliITSRecPoint rp(lab,hitv,info,kTRUE);
 
index 425bb14..d7df282 100644 (file)
@@ -449,8 +449,8 @@ Int_t AliITStrackerMI::LoadClusters(TTree *cTree) {
          Float_t q      = 0.; // this identifies virtual clusters
          Float_t hit[6] = {xdead,
                            0.,
-                           AliITSReconstructor::GetRecoParam()->GetSigmaXDeadZoneHit2(),
-                           AliITSReconstructor::GetRecoParam()->GetSigmaZDeadZoneHit2(),
+                           static_cast<Float_t>(AliITSReconstructor::GetRecoParam()->GetSigmaXDeadZoneHit2()),
+                           static_cast<Float_t>(AliITSReconstructor::GetRecoParam()->GetSigmaZDeadZoneHit2()),
                            q,
                            0.};
          Bool_t local   = kTRUE;
@@ -1447,7 +1447,7 @@ void AliITStrackerMI::FollowProlongationTree(AliITStrackMI * otrack, Int_t esdin
   // update TPC V0 information
   //
   if (otrack->GetESDtrack()->GetV0Index(0)>0){    
-    Float_t fprimvertex[3]={GetX(),GetY(),GetZ()};
+    Float_t fprimvertex[3]={static_cast<Float_t>(GetX()),static_cast<Float_t>(GetY()),static_cast<Float_t>(GetZ())};
     for (Int_t i=0;i<3;i++){
       Int_t  index = otrack->GetESDtrack()->GetV0Index(i); 
       if (index==0) break;
index 091df06..97fb276 100644 (file)
@@ -1560,7 +1560,7 @@ void AliITSv11::Init()
     UpdateInternalGeometry();
     AliITS::Init();
 
-    fIDMother = gMC->VolId("ITSV"); // ITS Mother Volume ID.
+    fIDMother = TVirtualMC::GetMC()->VolId("ITSV"); // ITS Mother Volume ID.
 }
 
 //______________________________________________________________________
@@ -1607,16 +1607,16 @@ void AliITSv11::StepManager()
     //   none.
 
     if(!(this->IsActive())) return;
-    if(!(gMC->TrackCharge())) return;
+    if(!(TVirtualMC::GetMC()->TrackCharge())) return;
 
     Int_t copy, lay = 0;
-    Int_t id = gMC->CurrentVolID(copy);
+    Int_t id = TVirtualMC::GetMC()->CurrentVolID(copy);
 
     Bool_t notSens = kFALSE;
     while ((lay<fIdN)  && (notSens = id != fIdSens[lay])) ++lay;
     if (notSens) return;
 
-    if(gMC->IsTrackExiting()) {
+    if(TVirtualMC::GetMC()->IsTrackExiting()) {
        AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kITS);
     } // if Outer ITS mother Volume
 
@@ -1627,32 +1627,32 @@ void AliITSv11::StepManager()
     Int_t   cpn0, cpn1, mod, status = 0;
     //
     // Track status
-    if(gMC->IsTrackInside())      status +=  1;
-    if(gMC->IsTrackEntering())    status +=  2;
-    if(gMC->IsTrackExiting())     status +=  4;
-    if(gMC->IsTrackOut())         status +=  8;
-    if(gMC->IsTrackDisappeared()) status += 16;
-    if(gMC->IsTrackStop())        status += 32;
-    if(gMC->IsTrackAlive())       status += 64;
+    if(TVirtualMC::GetMC()->IsTrackInside())      status +=  1;
+    if(TVirtualMC::GetMC()->IsTrackEntering())    status +=  2;
+    if(TVirtualMC::GetMC()->IsTrackExiting())     status +=  4;
+    if(TVirtualMC::GetMC()->IsTrackOut())         status +=  8;
+    if(TVirtualMC::GetMC()->IsTrackDisappeared()) status += 16;
+    if(TVirtualMC::GetMC()->IsTrackStop())        status += 32;
+    if(TVirtualMC::GetMC()->IsTrackAlive())       status += 64;
 
     //
     // retrieve the indices with the volume path
     //
     switch (lay) {
     case 0:case 1: // SPD
-      gMC->CurrentVolOffID(1,copy); // ladder
-      gMC->CurrentVolOffID(3,cpn1); // stave
-      gMC->CurrentVolOffID(5,cpn0); // sector
+      TVirtualMC::GetMC()->CurrentVolOffID(1,copy); // ladder
+      TVirtualMC::GetMC()->CurrentVolOffID(3,cpn1); // stave
+      TVirtualMC::GetMC()->CurrentVolOffID(5,cpn0); // sector
       break;
     case 2:case 3: // SDD
       copy = 1;
-      gMC->CurrentVolOffID(2,cpn1);
-      gMC->CurrentVolOffID(3,cpn0);
+      TVirtualMC::GetMC()->CurrentVolOffID(2,cpn1);
+      TVirtualMC::GetMC()->CurrentVolOffID(3,cpn0);
       break;
     case 4:case 5: // SSD
       copy = 1;
-      gMC->CurrentVolOffID(1,cpn1);
-      gMC->CurrentVolOffID(2,cpn0);
+      TVirtualMC::GetMC()->CurrentVolOffID(1,cpn1);
+      TVirtualMC::GetMC()->CurrentVolOffID(2,cpn0);
       break;
     default:
       AliError(Form("Invalid value: lay= %d . Not an ITS sensitive volume",lay));
@@ -1671,17 +1671,17 @@ void AliITSv11::StepManager()
     //
     hit.SetModule(mod);
     hit.SetTrack(gAlice->GetMCApp()->GetCurrentTrackNumber());
-    gMC->TrackPosition(position);
-    gMC->TrackMomentum(momentum);
+    TVirtualMC::GetMC()->TrackPosition(position);
+    TVirtualMC::GetMC()->TrackMomentum(momentum);
     hit.SetPosition(position);
-    hit.SetTime(gMC->TrackTime());
+    hit.SetTime(TVirtualMC::GetMC()->TrackTime());
     hit.SetMomentum(momentum);
     hit.SetStatus(status);
-    hit.SetEdep(gMC->Edep());
+    hit.SetEdep(TVirtualMC::GetMC()->Edep());
     hit.SetShunt(GetIshunt());
-    if(gMC->IsTrackEntering()){
+    if(TVirtualMC::GetMC()->IsTrackEntering()){
         hit.SetStartPosition(position);
-        hit.SetStartTime(gMC->TrackTime());
+        hit.SetStartTime(TVirtualMC::GetMC()->TrackTime());
         hit.SetStartStatus(status);
         return; // don't save entering hit.
     } // end if IsEntering
@@ -1690,7 +1690,7 @@ void AliITSv11::StepManager()
     new(lhits[fNhits++]) AliITShit(hit); // Use Copy Construtor.
     // Save old position... for next hit.
     hit.SetStartPosition(position);
-    hit.SetStartTime(gMC->TrackTime());
+    hit.SetStartTime(TVirtualMC::GetMC()->TrackTime());
     hit.SetStartStatus(status);
 
     return;
index 85e676c..6cb32ac 100644 (file)
@@ -237,7 +237,7 @@ void AliITSU::Init()
   // classes therefore it should be called after a call to CreateGeometry.
   //
   if (!fIdSens) fIdSens = new Int_t[fNLayers];
-  for(int i=0;i<fNLayers;i++) fIdSens[i] = gMC ? gMC->VolId(fLayerName[i]) : 0;
+  for(int i=0;i<fNLayers;i++) fIdSens[i] = TVirtualMC::GetMC() ? TVirtualMC::GetMC()->VolId(fLayerName[i]) : 0;
   fGeomTGeo     = new AliITSUGeomTGeo(kTRUE);
   InitSimulation();
   //
index 4ab4d27..b7d2c39 100644 (file)
@@ -682,10 +682,10 @@ void AliITSUv0::StepManager()
   // Return:
   //   none.
   if(!(this->IsActive())) return;
-  if(!(gMC->TrackCharge())) return;
+  if(!(TVirtualMC::GetMC()->TrackCharge())) return;
   //
   Int_t copy, lay = 0;
-  Int_t id = gMC->CurrentVolID(copy);
+  Int_t id = TVirtualMC::GetMC()->CurrentVolID(copy);
 
   Bool_t notSens = kFALSE;
   while ((lay<fNLayers)  && (notSens = (id!=fIdSens[lay]))) ++lay;
@@ -693,7 +693,7 @@ void AliITSUv0::StepManager()
           
   if (notSens) return;
 
-  if(gMC->IsTrackExiting()) {
+  if(TVirtualMC::GetMC()->IsTrackExiting()) {
     AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kITS);
   } // if Outer ITS mother Volume
 
@@ -704,13 +704,13 @@ void AliITSUv0::StepManager()
   Int_t   cpn0, cpn1, mod, status = 0;
   //
   // Track status
-  if(gMC->IsTrackInside())      status +=  1;
-  if(gMC->IsTrackEntering())    status +=  2;
-  if(gMC->IsTrackExiting())     status +=  4;
-  if(gMC->IsTrackOut())         status +=  8;
-  if(gMC->IsTrackDisappeared()) status += 16;
-  if(gMC->IsTrackStop())        status += 32;
-  if(gMC->IsTrackAlive())       status += 64;
+  if(TVirtualMC::GetMC()->IsTrackInside())      status +=  1;
+  if(TVirtualMC::GetMC()->IsTrackEntering())    status +=  2;
+  if(TVirtualMC::GetMC()->IsTrackExiting())     status +=  4;
+  if(TVirtualMC::GetMC()->IsTrackOut())         status +=  8;
+  if(TVirtualMC::GetMC()->IsTrackDisappeared()) status += 16;
+  if(TVirtualMC::GetMC()->IsTrackStop())        status += 32;
+  if(TVirtualMC::GetMC()->IsTrackAlive())       status += 64;
 
   //
   // retrieve the indices with the volume path
@@ -720,8 +720,8 @@ void AliITSUv0::StepManager()
     return; // not an ITS sensitive volume.
   } else {
     copy = 1;
-    gMC->CurrentVolOffID(1,cpn1);
-    gMC->CurrentVolOffID(2,cpn0);
+    TVirtualMC::GetMC()->CurrentVolOffID(1,cpn1);
+    TVirtualMC::GetMC()->CurrentVolOffID(2,cpn0);
   } //
 
   mod = fGeomTGeo->GetChipIndex(lay,cpn0,cpn1);
@@ -731,17 +731,17 @@ void AliITSUv0::StepManager()
   //
   hit.SetChip(mod);
   hit.SetTrack(gAlice->GetMCApp()->GetCurrentTrackNumber());
-  gMC->TrackPosition(position);
-  gMC->TrackMomentum(momentum);
+  TVirtualMC::GetMC()->TrackPosition(position);
+  TVirtualMC::GetMC()->TrackMomentum(momentum);
   hit.SetPosition(position);
-  hit.SetTime(gMC->TrackTime());
+  hit.SetTime(TVirtualMC::GetMC()->TrackTime());
   hit.SetMomentum(momentum);
   hit.SetStatus(status);
-  hit.SetEdep(gMC->Edep());
+  hit.SetEdep(TVirtualMC::GetMC()->Edep());
   hit.SetShunt(GetIshunt());
-  if(gMC->IsTrackEntering()){
+  if(TVirtualMC::GetMC()->IsTrackEntering()){
     hit.SetStartPosition(position);
-    hit.SetStartTime(gMC->TrackTime());
+    hit.SetStartTime(TVirtualMC::GetMC()->TrackTime());
     hit.SetStartStatus(status);
     return; // don't save entering hit.
   } // end if IsEntering
@@ -750,7 +750,7 @@ void AliITSUv0::StepManager()
   new(lhits[fNhits++]) AliITSUHit(hit); // Use Copy Construtor.
   // Save old position... for next hit.
   hit.SetStartPosition(position);
-  hit.SetStartTime(gMC->TrackTime());
+  hit.SetStartTime(TVirtualMC::GetMC()->TrackTime());
   hit.SetStartStatus(status);
 
   return;
index e7b8504..d63857f 100644 (file)
@@ -759,10 +759,10 @@ void AliITSUv1::StepManager()
   //   none.
   //
   if(!(this->IsActive())) return;
-  if(!(gMC->TrackCharge())) return;
+  if(!(TVirtualMC::GetMC()->TrackCharge())) return;
   //
   Int_t copy, lay = 0;
-  Int_t id = gMC->CurrentVolID(copy);
+  Int_t id = TVirtualMC::GetMC()->CurrentVolID(copy);
 
   Bool_t notSens = kFALSE;
   while ((lay<fNLayers)  && (notSens = (id!=fIdSens[lay]))) ++lay;
@@ -782,42 +782,42 @@ void AliITSUv1::StepManager()
   Int_t chipID, status = 0;
   //
   // Track status
-  if(gMC->IsTrackInside())      status +=  1;
-  if(gMC->IsTrackEntering())    status +=  2;
-  if(gMC->IsTrackExiting()) {
+  if(TVirtualMC::GetMC()->IsTrackInside())      status +=  1;
+  if(TVirtualMC::GetMC()->IsTrackEntering())    status +=  2;
+  if(TVirtualMC::GetMC()->IsTrackExiting()) {
     AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kITS);
     status +=  4;
   } // if Outer ITS mother Volume
-  if(gMC->IsTrackOut())         status +=  8;
-  if(gMC->IsTrackDisappeared()) status += 16;
-  if(gMC->IsTrackStop())        status += 32;
-  if(gMC->IsTrackAlive())       status += 64;
+  if(TVirtualMC::GetMC()->IsTrackOut())         status +=  8;
+  if(TVirtualMC::GetMC()->IsTrackDisappeared()) status += 16;
+  if(TVirtualMC::GetMC()->IsTrackStop())        status += 32;
+  if(TVirtualMC::GetMC()->IsTrackAlive())       status += 64;
   //
   // retrieve the indices with the volume path
   //
-  gMC->TrackPosition(position);
+  TVirtualMC::GetMC()->TrackPosition(position);
   int chip=-1,module=-1,sstave=-1,stave=-1,level=0; // volume copies on different levels
-  gMC->CurrentVolOffID(++level,chip);
-  if (fGeomTGeo->GetNModules(lay)>0)    gMC->CurrentVolOffID(++level,module);
-  if (fGeomTGeo->GetNHalfStaves(lay)>0) gMC->CurrentVolOffID(++level,sstave);
-  gMC->CurrentVolOffID(++level,stave);
+  TVirtualMC::GetMC()->CurrentVolOffID(++level,chip);
+  if (fGeomTGeo->GetNModules(lay)>0)    TVirtualMC::GetMC()->CurrentVolOffID(++level,module);
+  if (fGeomTGeo->GetNHalfStaves(lay)>0) TVirtualMC::GetMC()->CurrentVolOffID(++level,sstave);
+  TVirtualMC::GetMC()->CurrentVolOffID(++level,stave);
   //
   chipID = fGeomTGeo->GetChipIndex(lay,stave,sstave,module,chip);
   // Fill hit structure.
   //
   hit.SetChip(chipID);
   hit.SetTrack(gAlice->GetMCApp()->GetCurrentTrackNumber());
-  gMC->TrackPosition(position);
-  gMC->TrackMomentum(momentum);
+  TVirtualMC::GetMC()->TrackPosition(position);
+  TVirtualMC::GetMC()->TrackMomentum(momentum);
   hit.SetPosition(position);
-  hit.SetTime(gMC->TrackTime());
+  hit.SetTime(TVirtualMC::GetMC()->TrackTime());
   hit.SetMomentum(momentum);
   hit.SetStatus(status);
-  hit.SetEdep(gMC->Edep());
+  hit.SetEdep(TVirtualMC::GetMC()->Edep());
   hit.SetShunt(GetIshunt());
-  if(gMC->IsTrackEntering()){
+  if(TVirtualMC::GetMC()->IsTrackEntering()){
     hit.SetStartPosition(position);
-    hit.SetStartTime(gMC->TrackTime());
+    hit.SetStartTime(TVirtualMC::GetMC()->TrackTime());
     hit.SetStartStatus(status);
     return; // don't save entering hit.
   } // end if IsEntering
@@ -826,7 +826,7 @@ void AliITSUv1::StepManager()
   new(lhits[fNhits++]) AliITSUHit(hit); // Use Copy Construtor.
   // Save old position... for next hit.
   hit.SetStartPosition(position);
-  hit.SetStartTime(gMC->TrackTime());
+  hit.SetStartTime(TVirtualMC::GetMC()->TrackTime());
   hit.SetStartStatus(status);
 
   return;
index 2b210ae..7cc766c 100644 (file)
@@ -21,7 +21,7 @@
 #include <TGeoManager.h>    
 #include <TGeoVolume.h>         //CreateGeometry()
 #include <TGeoMatrix.h>
-#include <TVirtualMC.h>         //->gMC in StepManager
+#include <TVirtualMC.h>         //->TVirtualMC::GetMC() in StepManager
 #include <TPDGCode.h>           //StepHistory
 #include <TClonesArray.h>
 #include <TGeoGlobalMagField.h>
@@ -251,7 +251,7 @@ void AliITSupgrade::CreateGeometry()
   //Creates detailed geometry simulation (currently GEANT volumes tree)        
   //
   AliInfo("Start ITS upgrade preliminary version building");
-  if(!gMC->IsRootGeometrySupported()) return;                
+  if(!TVirtualMC::GetMC()->IsRootGeometrySupported()) return;                
   TGeoVolumeAssembly *vol= CreateVol();
   gGeoManager->GetVolume("ALIC")->AddNode(vol,0);
   AliInfo("Stop ITS upgrade preliminary version building");
@@ -269,11 +269,11 @@ void AliITSupgrade::StepManager()
   if(!fSegmentation) AliFatal("No segmentation available");
 
   if(!(this->IsActive())) return;
-  if(!(gMC->TrackCharge())) return;
-  TString volumeName=gMC->CurrentVolName();
+  if(!(TVirtualMC::GetMC()->TrackCharge())) return;
+  TString volumeName=TVirtualMC::GetMC()->CurrentVolName();
   if(volumeName.Contains("Be")) return;
   if(volumeName.Contains("Cu")) return;
-  if(gMC->IsTrackExiting()) {
+  if(TVirtualMC::GetMC()->IsTrackExiting()) {
     AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kITS);
   } // if Outer ITS mother Volume
 
@@ -285,36 +285,36 @@ void AliITSupgrade::StepManager()
   
   //
   // Track status
-  if(gMC->IsTrackInside())      status +=  1;
-  if(gMC->IsTrackEntering())    status +=  2;
-  if(gMC->IsTrackExiting())     status +=  4;
-  if(gMC->IsTrackOut())         status +=  8;
-  if(gMC->IsTrackDisappeared()) status += 16;
-  if(gMC->IsTrackStop())        status += 32;
-  if(gMC->IsTrackAlive())       status += 64;
+  if(TVirtualMC::GetMC()->IsTrackInside())      status +=  1;
+  if(TVirtualMC::GetMC()->IsTrackEntering())    status +=  2;
+  if(TVirtualMC::GetMC()->IsTrackExiting())     status +=  4;
+  if(TVirtualMC::GetMC()->IsTrackOut())         status +=  8;
+  if(TVirtualMC::GetMC()->IsTrackDisappeared()) status += 16;
+  if(TVirtualMC::GetMC()->IsTrackStop())        status += 32;
+  if(TVirtualMC::GetMC()->IsTrackAlive())       status += 64;
 
   //
   // Fill hit structure.
   //
   Int_t copy=-1;
-  gMC->CurrentVolID(copy);   
+  TVirtualMC::GetMC()->CurrentVolID(copy);   
 
   volumeName.Remove(0,12);          // remove letters to get the layer number
   hit.SetModule(fSegmentation->GetIdIndex(volumeName.Atoi(),copy)); // layer and sector information are together in the IdIndex (if copy=0 the idIndex is the layer)); 
   hit.SetTrack(gAlice->GetMCApp()->GetCurrentTrackNumber());
     
-  gMC->TrackPosition(position);
-  gMC->TrackMomentum(momentum);
+  TVirtualMC::GetMC()->TrackPosition(position);
+  TVirtualMC::GetMC()->TrackMomentum(momentum);
   hit.SetPosition(position);
     
-  hit.SetTime(gMC->TrackTime());
+  hit.SetTime(TVirtualMC::GetMC()->TrackTime());
   hit.SetMomentum(momentum);
   hit.SetStatus(status);
-  hit.SetEdep(gMC->Edep());
+  hit.SetEdep(TVirtualMC::GetMC()->Edep());
   hit.SetShunt(GetIshunt());
-  if(gMC->IsTrackEntering()){
+  if(TVirtualMC::GetMC()->IsTrackEntering()){
     hit.SetStartPosition(position);
-    hit.SetStartTime(gMC->TrackTime());
+    hit.SetStartTime(TVirtualMC::GetMC()->TrackTime());
     hit.SetStartStatus(status);
     return; // don't save entering hit.
   } 
@@ -323,7 +323,7 @@ void AliITSupgrade::StepManager()
   new((*fHits)[fNhits++]) AliITShit(hit); // Use Copy Construtor.
   // Save old position... for next hit.
   hit.SetStartPosition(position);
-  hit.SetStartTime(gMC->TrackTime());
+  hit.SetStartTime(TVirtualMC::GetMC()->TrackTime());
   hit.SetStartStatus(status);
   return;
 
@@ -401,11 +401,11 @@ void AliITSupgrade::SetFullSegmentation(TArrayD xsize,TArrayD zsize){
 void AliITSupgrade::StepHistory()
 { 
   // This methode is invoked from StepManager() in order to print out
-  TString volumeName=gMC->CurrentVolName();
+  TString volumeName=TVirtualMC::GetMC()->CurrentVolName();
   if(!volumeName.Contains("Silicon")) return;
   static Int_t iStepN;
   const char *sParticle;
-  switch(gMC->TrackPid()){
+  switch(TVirtualMC::GetMC()->TrackPid()){
   case kProton:      sParticle="PROTON"    ;break;
   case kNeutron:     sParticle="neutron"   ;break;
   case kGamma:       sParticle="gamma"     ;break;
@@ -417,40 +417,40 @@ void AliITSupgrade::StepHistory()
   }
 
   TString flag="funny combination";
-  if(gMC->IsTrackAlive()) {
-    if(gMC->IsTrackEntering())      flag="enters to";
-    else if(gMC->IsTrackExiting())  flag="exits from";
-    else if(gMC->IsTrackInside())   flag="inside";
-    else if(gMC->IsTrackStop())     flag="stopped in";
+  if(TVirtualMC::GetMC()->IsTrackAlive()) {
+    if(TVirtualMC::GetMC()->IsTrackEntering())      flag="enters to";
+    else if(TVirtualMC::GetMC()->IsTrackExiting())  flag="exits from";
+    else if(TVirtualMC::GetMC()->IsTrackInside())   flag="inside";
+    else if(TVirtualMC::GetMC()->IsTrackStop())     flag="stopped in";
   }
 
   Int_t vid=0,copy=0;
-  TString path=gMC->CurrentVolName(); path.Prepend("-");path.Prepend(gMC->CurrentVolOffName(1));//current volume and his mother are always there
-  vid=gMC->CurrentVolOffID(2,copy);  if(vid) {path.Prepend("-");path.Prepend(gMC->VolName(vid));}
-  vid=gMC->CurrentVolOffID(3,copy);  if(vid) {path.Prepend("-");path.Prepend(gMC->VolName(vid));}
+  TString path=TVirtualMC::GetMC()->CurrentVolName(); path.Prepend("-");path.Prepend(TVirtualMC::GetMC()->CurrentVolOffName(1));//current volume and his mother are always there
+  vid=TVirtualMC::GetMC()->CurrentVolOffID(2,copy);  if(vid) {path.Prepend("-");path.Prepend(TVirtualMC::GetMC()->VolName(vid));}
+  vid=TVirtualMC::GetMC()->CurrentVolOffID(3,copy);  if(vid) {path.Prepend("-");path.Prepend(TVirtualMC::GetMC()->VolName(vid));}
   
 
-  AliInfo(Form("\n Step %i: %s (%i) %s %s m=%.6f GeV q=%.1f dEdX=%.4f Etot=%.4f",iStepN,sParticle,gMC->TrackPid(),flag.Data(),path.Data(),gMC->TrackMass(),gMC->TrackCharge(),gMC->Edep()*1e9,gMC->Etot()));
+  AliInfo(Form("\n Step %i: %s (%i) %s %s m=%.6f GeV q=%.1f dEdX=%.4f Etot=%.4f",iStepN,sParticle,TVirtualMC::GetMC()->TrackPid(),flag.Data(),path.Data(),TVirtualMC::GetMC()->TrackMass(),TVirtualMC::GetMC()->TrackCharge(),TVirtualMC::GetMC()->Edep()*1e9,TVirtualMC::GetMC()->Etot()));
 
-  Double_t gMcTrackPos[3]; gMC->TrackPosition(gMcTrackPos[0],gMcTrackPos[1],gMcTrackPos[2]);
-  Double_t  gMcTrackPosLoc[3]; gMC->Gmtod(gMcTrackPos,gMcTrackPosLoc,1);
+  Double_t gMcTrackPos[3]; TVirtualMC::GetMC()->TrackPosition(gMcTrackPos[0],gMcTrackPos[1],gMcTrackPos[2]);
+  Double_t  gMcTrackPosLoc[3]; TVirtualMC::GetMC()->Gmtod(gMcTrackPos,gMcTrackPosLoc,1);
   TString v(volumeName.Data());
   v.ReplaceAll("LayerSilicon","");
   Int_t ilayer = v.Atoi();
   Double_t rXY = TMath::Sqrt(gMcTrackPos[0]*gMcTrackPos[0]+gMcTrackPos[1]*gMcTrackPos[1]);
-  AliInfo(Form("gMC Track Position (MARS) x: %5.3lf, y: %5.3lf, z: %5.3lf (r: %5.3lf) (deltaR %5.5lf - width %5.5f)",gMcTrackPos[0],gMcTrackPos[1],gMcTrackPos[2], rXY , rXY - (fRadii.At(ilayer)),fWidths.At(ilayer)));
+  AliInfo(Form("TVirtualMC::GetMC() Track Position (MARS) x: %5.3lf, y: %5.3lf, z: %5.3lf (r: %5.3lf) (deltaR %5.5lf - width %5.5f)",gMcTrackPos[0],gMcTrackPos[1],gMcTrackPos[2], rXY , rXY - (fRadii.At(ilayer)),fWidths.At(ilayer)));
 
 
   AliDebug(10,Form("Step %i: tid=%i flags alive=%i disap=%i enter=%i exit=%i inside=%i out=%i stop=%i new=%i",
                   iStepN, gAlice->GetMCApp()->GetCurrentTrackNumber(),
-                  gMC->IsTrackAlive(), gMC->IsTrackDisappeared(),gMC->IsTrackEntering(), gMC->IsTrackExiting(),
-                  gMC->IsTrackInside(),gMC->IsTrackOut(),        gMC->IsTrackStop(),     gMC->IsNewTrack()));
+                  TVirtualMC::GetMC()->IsTrackAlive(), TVirtualMC::GetMC()->IsTrackDisappeared(),TVirtualMC::GetMC()->IsTrackEntering(), TVirtualMC::GetMC()->IsTrackExiting(),
+                  TVirtualMC::GetMC()->IsTrackInside(),TVirtualMC::GetMC()->IsTrackOut(),        TVirtualMC::GetMC()->IsTrackStop(),     TVirtualMC::GetMC()->IsNewTrack()));
 
   Float_t a,z,den,rad,abs; a=z=den=rad=abs=-1;
-  Int_t mid=gMC->CurrentMaterial(a,z,den,rad,abs);
+  Int_t mid=TVirtualMC::GetMC()->CurrentMaterial(a,z,den,rad,abs);
   AliDebug(10, Form("Step %i: mid=%i a=%7.2f z=%7.2f den=%9.4f rad=%9.2f abs=%9.2f\n\n",iStepN,mid,a,z,den,rad,abs));
 /*
-  TArrayI proc;  gMC->StepProcesses(proc);
+  TArrayI proc;  TVirtualMC::GetMC()->StepProcesses(proc);
 
   AliInfo("Processes in this step:");
   for ( int i = 0 ; i < proc.GetSize(); i++)
index 1d179ae..0b1e35a 100644 (file)
@@ -224,7 +224,7 @@ void AliMFT::CreateGeometry() {
   // Creates detailed geometry simulation (currently GEANT volumes tree)        
 
   AliInfo("Start MFT preliminary version building");
-  if(!gMC->IsRootGeometrySupported()) return;                
+  if(!TVirtualMC::GetMC()->IsRootGeometrySupported()) return;                
   TGeoVolumeAssembly *vol = CreateVol();
   AliInfo("TGeoVolumeAssembly created!");
   gGeoManager->GetVolume("ALIC")->AddNode(vol,0);
@@ -257,15 +257,15 @@ void AliMFT::StepManager() {
 
   // Full Step Manager
 
-  AliDebug(2, Form("Entering StepManager: gMC->CurrentVolName() = %s", gMC->CurrentVolName()));
+  AliDebug(2, Form("Entering StepManager: TVirtualMC::GetMC()->CurrentVolName() = %s", TVirtualMC::GetMC()->CurrentVolName()));
 
   if (!fSegmentation) AliFatal("No segmentation available");    // DO WE HAVE A SEGMENTATION???
 
   if (!(this->IsActive())) return;
-  if (!(gMC->TrackCharge())) return;
+  if (!(TVirtualMC::GetMC()->TrackCharge())) return;
 
-  TString planeNumber   = gMC->CurrentVolName();
-  TString detElemNumber = gMC->CurrentVolName();
+  TString planeNumber   = TVirtualMC::GetMC()->CurrentVolName();
+  TString detElemNumber = TVirtualMC::GetMC()->CurrentVolName();
   if (planeNumber.Contains("support")) return;
   if (planeNumber.Contains("readout")) return;
   planeNumber.Remove(0,9);
@@ -274,7 +274,7 @@ void AliMFT::StepManager() {
   detElemNumber.Remove(3);
   Int_t detElemID = fSegmentation->GetDetElemGlobalID(planeNumber.Atoi(), detElemNumber.Atoi());
 
-  if (gMC->IsTrackExiting()) {
+  if (TVirtualMC::GetMC()->IsTrackExiting()) {
     AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kMFT);
   }
 
@@ -284,13 +284,13 @@ void AliMFT::StepManager() {
   Int_t  status = 0;
   
   // Track status
-  if (gMC->IsTrackInside())      status +=  1;
-  if (gMC->IsTrackEntering())    status +=  2;
-  if (gMC->IsTrackExiting())     status +=  4;
-  if (gMC->IsTrackOut())         status +=  8;
-  if (gMC->IsTrackDisappeared()) status += 16;
-  if (gMC->IsTrackStop())        status += 32;
-  if (gMC->IsTrackAlive())       status += 64;
+  if (TVirtualMC::GetMC()->IsTrackInside())      status +=  1;
+  if (TVirtualMC::GetMC()->IsTrackEntering())    status +=  2;
+  if (TVirtualMC::GetMC()->IsTrackExiting())     status +=  4;
+  if (TVirtualMC::GetMC()->IsTrackOut())         status +=  8;
+  if (TVirtualMC::GetMC()->IsTrackDisappeared()) status += 16;
+  if (TVirtualMC::GetMC()->IsTrackStop())        status += 32;
+  if (TVirtualMC::GetMC()->IsTrackAlive())       status += 64;
 
   // ---------- Fill hit structure
 
@@ -298,21 +298,21 @@ void AliMFT::StepManager() {
   hit.SetPlane(planeNumber.Atoi());
   hit.SetTrack(gAlice->GetMCApp()->GetCurrentTrackNumber());
     
-  gMC->TrackPosition(position);
-  gMC->TrackMomentum(momentum);
+  TVirtualMC::GetMC()->TrackPosition(position);
+  TVirtualMC::GetMC()->TrackMomentum(momentum);
 
   AliDebug(1, Form("AliMFT::StepManager()->%s Hit #%06d (x=%f, y=%f, z=%f) belongs to track %02d\n", 
-                  gMC->CurrentVolName(), fNhits, position.X(), position.Y(), position.Z(), gAlice->GetMCApp()->GetCurrentTrackNumber())); 
+                  TVirtualMC::GetMC()->CurrentVolName(), fNhits, position.X(), position.Y(), position.Z(), gAlice->GetMCApp()->GetCurrentTrackNumber())); 
 
   hit.SetPosition(position);
-  hit.SetTOF(gMC->TrackTime());
+  hit.SetTOF(TVirtualMC::GetMC()->TrackTime());
   hit.SetMomentum(momentum);
   hit.SetStatus(status);
-  hit.SetEloss(gMC->Edep());
+  hit.SetEloss(TVirtualMC::GetMC()->Edep());
   //  hit.SetShunt(GetIshunt());
-//   if (gMC->IsTrackEntering()) {
+//   if (TVirtualMC::GetMC()->IsTrackEntering()) {
 //     hit.SetStartPosition(position);
-//     hit.SetStartTime(gMC->TrackTime());
+//     hit.SetStartTime(TVirtualMC::GetMC()->TrackTime());
 //     hit.SetStartStatus(status);
 //     return; // don't save entering hit.
 //   } 
@@ -322,7 +322,7 @@ void AliMFT::StepManager() {
 
   // Save old position... for next hit.
 //   hit.SetStartPosition(position);
-//   hit.SetStartTime(gMC->TrackTime());
+//   hit.SetStartTime(TVirtualMC::GetMC()->TrackTime());
 //   hit.SetStartStatus(status);
 
   return;
index aea3265..484d132 100644 (file)
@@ -701,26 +701,26 @@ Int_t AliMuonForwardTrackFinder::LoadNextTrack() {
 
     //    fOutputQAFile->cd();
 
-    Float_t finalCandidatesInfo[] = {Double_t(fRun),
-                                    Double_t(fEv),
-                                    Double_t(fCountRealTracksAnalyzedOfEvent),
-                                    Double_t(nFinalTracks),
-                                    Double_t(fLabelMC>=0),
-                                    xVtx, yVtx, zVtx,
-                                    motherPdg,
-                                    Double_t(fMuonTrackReco->GetMatchTrigger()),
-                                    Double_t(nClustersMC),
-                                    Double_t(nGoodClusters),
-                                    pt, theta, eta, 
-                                    chi2AtPlane[0],
-                                    chi2AtPlane[1],
-                                    chi2AtPlane[2],
-                                    chi2AtPlane[3],
-                                    chi2AtPlane[4],
-                                    chi2AtPlane[5],
-                                    chi2AtPlane[6],
-                                    chi2AtPlane[7],
-                                    chi2AtPlane[8]};
+    Float_t finalCandidatesInfo[] = {static_cast<Float_t>(fRun),
+                                    static_cast<Float_t>(fEv),
+                                    static_cast<Float_t>(fCountRealTracksAnalyzedOfEvent),
+                                    static_cast<Float_t>(nFinalTracks),
+                                    static_cast<Float_t>(fLabelMC>=0),
+                                    static_cast<Float_t>(xVtx), static_cast<Float_t>(yVtx), static_cast<Float_t>(zVtx),
+                                    static_cast<Float_t>(motherPdg),
+                                    static_cast<Float_t>(fMuonTrackReco->GetMatchTrigger()),
+                                    static_cast<Float_t>(nClustersMC),
+                                    static_cast<Float_t>(nGoodClusters),
+                                    static_cast<Float_t>(pt), static_cast<Float_t>(theta), static_cast<Float_t>(eta), 
+                                    static_cast<Float_t>(chi2AtPlane[0]),
+                                    static_cast<Float_t>(chi2AtPlane[1]),
+                                    static_cast<Float_t>(chi2AtPlane[2]),
+                                    static_cast<Float_t>(chi2AtPlane[3]),
+                                    static_cast<Float_t>(chi2AtPlane[4]),
+                                    static_cast<Float_t>(chi2AtPlane[5]),
+                                    static_cast<Float_t>(chi2AtPlane[6]),
+                                    static_cast<Float_t>(chi2AtPlane[7]),
+                                    static_cast<Float_t>(chi2AtPlane[8])};
     
     fNtuFinalCandidates -> Fill(finalCandidatesInfo);
 
@@ -763,35 +763,35 @@ Int_t AliMuonForwardTrackFinder::LoadNextTrack() {
 
   //  fOutputQAFile->cd();
   
-  Float_t finalBestCandidatesInfo[] = {Double_t(fRun),
-                                      Double_t(fEv),
-                                      Double_t(fCountRealTracksAnalyzedOfEvent),
-                                      Double_t(nFinalTracks),
-                                      Double_t(fLabelMC>=0),
-                                      xVtx, yVtx, zVtx,
-                                      motherPdg,
-                                      Double_t(fMuonTrackReco->GetMatchTrigger()),
-                                      Double_t(nClustersMC),
-                                      Double_t(nGoodClustersBestCandidate),
-                                      pt, theta, eta,
-                                      chi2HistoryForBestCandidate[0],
-                                      chi2HistoryForBestCandidate[1],
-                                      chi2HistoryForBestCandidate[2],
-                                      chi2HistoryForBestCandidate[3],
-                                      chi2HistoryForBestCandidate[4],
-                                      chi2HistoryForBestCandidate[5],
-                                      chi2HistoryForBestCandidate[6],
-                                      chi2HistoryForBestCandidate[7],
-                                      chi2HistoryForBestCandidate[8],
-                                      nClustersPerPlane[0],
-                                      nClustersPerPlane[1],
-                                      nClustersPerPlane[2],
-                                      nClustersPerPlane[3],
-                                      nClustersPerPlane[4],
-                                      nClustersPerPlane[5],
-                                      nClustersPerPlane[6],
-                                      nClustersPerPlane[7],
-                                      nClustersPerPlane[8]};
+  Float_t finalBestCandidatesInfo[] = {static_cast<Float_t>(fRun),
+                                      static_cast<Float_t>(fEv),
+                                      static_cast<Float_t>(fCountRealTracksAnalyzedOfEvent),
+                                      static_cast<Float_t>(nFinalTracks),
+                                      static_cast<Float_t>(fLabelMC>=0),
+                                      static_cast<Float_t>(xVtx), static_cast<Float_t>(yVtx), static_cast<Float_t>(zVtx),
+                                      static_cast<Float_t>(motherPdg),
+                                      static_cast<Float_t>(fMuonTrackReco->GetMatchTrigger()),
+                                      static_cast<Float_t>(nClustersMC),
+                                      static_cast<Float_t>(nGoodClustersBestCandidate),
+                                      static_cast<Float_t>(pt), static_cast<Float_t>(theta), static_cast<Float_t>(eta),
+                                      static_cast<Float_t>(chi2HistoryForBestCandidate[0]),
+                                      static_cast<Float_t>(chi2HistoryForBestCandidate[1]),
+                                      static_cast<Float_t>(chi2HistoryForBestCandidate[2]),
+                                      static_cast<Float_t>(chi2HistoryForBestCandidate[3]),
+                                      static_cast<Float_t>(chi2HistoryForBestCandidate[4]),
+                                      static_cast<Float_t>(chi2HistoryForBestCandidate[5]),
+                                      static_cast<Float_t>(chi2HistoryForBestCandidate[6]),
+                                      static_cast<Float_t>(chi2HistoryForBestCandidate[7]),
+                                      static_cast<Float_t>(chi2HistoryForBestCandidate[8]),
+                                      static_cast<Float_t>(nClustersPerPlane[0]),
+                                      static_cast<Float_t>(nClustersPerPlane[1]),
+                                      static_cast<Float_t>(nClustersPerPlane[2]),
+                                      static_cast<Float_t>(nClustersPerPlane[3]),
+                                      static_cast<Float_t>(nClustersPerPlane[4]),
+                                      static_cast<Float_t>(nClustersPerPlane[5]),
+                                      static_cast<Float_t>(nClustersPerPlane[6]),
+                                      static_cast<Float_t>(nClustersPerPlane[7]),
+                                      static_cast<Float_t>(nClustersPerPlane[8])};
   
   fNtuFinalBestCandidates -> Fill(finalBestCandidatesInfo);
   
index a993556..e595809 100644 (file)
@@ -54,9 +54,3 @@ if (DATE_ROOT)
 
 endif(DATE_ROOT)
 
-if( ALICE_TARGET MATCHES "macosx")
-
-  ALICE_Format(TEMP "-Wl,-u,_G__cpp_setupG__" "" ${ELIBS})
-  set ( PACKLDFLAGS "${LDFLAGS} ${TEMP}")
-       
-endif( ALICE_TARGET MATCHES "macosx")
index 04cd318..c6150b2 100644 (file)
@@ -98,7 +98,7 @@ class AliMUON : public  AliDetector
     virtual void  SetAlign(Bool_t align = true);
     virtual void  SetAlign(const TString& fileName, Bool_t align = true);
     
-                    /// Set flag to inactivate calls to gMC->SetMaxStep
+                    /// Set flag to inactivate calls to TVirtualMC::GetMC()->SetMaxStep
     virtual void  SetIsMaxStep(Bool_t isMaxStep) { fIsMaxStep = isMaxStep; }
     
                    /// Set scaler event for trigger
@@ -175,7 +175,7 @@ class AliMUON : public  AliDetector
     Int_t fCurIterPad;        ///< Current pad index
    
     // Options
-    Bool_t fIsMaxStep;          ///< Flag to inactivate calls to gMC->SetMaxStep
+    Bool_t fIsMaxStep;          ///< Flag to inactivate calls to TVirtualMC::GetMC()->SetMaxStep
     Bool_t fTriggerScalerEvent; ///< Flag to generates scaler event
     Int_t  fTriggerResponseV1;  ///< Flag to select TriggerResponseV1 (for cluster size in MTR)
     Int_t  fTriggerCoinc44;     ///< Flag to select TriggerCoinc44 
index 1a7c0c9..8c3a0a6 100644 (file)
@@ -492,7 +492,7 @@ void AliMUONGain::MakeGainStore(TString shuttleFile)
 
          // 1. - linear fit over gAlinbpf1 points
 
-         Double_t par[4] = {0.,0.5,0.,ADCMax()};
+         Double_t par[4] = {0.,0.5,0.,static_cast<Double_t>(ADCMax())};
          Int_t nbs   = nEntries - fnInit;
          if(nbs < fnbpf1)fnbpf1=nbs;
 
index 7fbd5aa..1811e43 100644 (file)
@@ -253,9 +253,9 @@ void AliMUONGeometryBuilder::PlaceVolume(const TString& name, const TString& mNa
        
   // Place the volume
   if (npar == 0)
-    gMC->Gspos(name, copyNo, mName, xyz[0], xyz[1], xyz[2] , krot, only);
+    TVirtualMC::GetMC()->Gspos(name, copyNo, mName, xyz[0], xyz[1], xyz[2] , krot, only);
   else 
-    gMC->Gsposp(name, copyNo, mName, xyz[0], xyz[1], xyz[2] , krot, only,
+    TVirtualMC::GetMC()->Gsposp(name, copyNo, mName, xyz[0], xyz[1], xyz[2] , krot, only,
                 param, npar);
 } 
 
@@ -556,7 +556,7 @@ void AliMUONGeometryBuilder::CreateGeometry()
 {
 /// Construct geometry using geometry builders.
 
-  if ( gMC->IsRootGeometrySupported() ) {
+  if ( TVirtualMC::GetMC()->IsRootGeometrySupported() ) {
        
    CreateGeometryWithTGeo();
   } 
index 01f3c91..db3eb5f 100644 (file)
@@ -150,7 +150,7 @@ void  AliMUONGeometryModule::SetSensitiveVolume(const TString& volName)
 /// Add the volume specified by volName to the list of sensitive
 /// volumes
 
-  SetSensitiveVolume(gMC->VolId(volName));
+  SetSensitiveVolume(TVirtualMC::GetMC()->VolId(volName));
 }      
 
 //______________________________________________________________________________
@@ -193,5 +193,5 @@ Bool_t AliMUONGeometryModule::IsSensitiveVolume(const TString& volName) const
 /// Check if the volume specified by volName  is present in the list
 /// of sensitive volumes.
 
-  return IsSensitiveVolume(gMC->VolId(volName));
+  return IsSensitiveVolume(TVirtualMC::GetMC()->VolId(volName));
 }
index b98ab0d..efc294e 100644 (file)
@@ -137,7 +137,7 @@ AliMUONLocalStruct::operator=(const AliMUONLocalStruct& event)
 void AliMUONLocalStruct::GetXPattern(TArrayS& array) const
 {
     /// return array of X pattern
-    Short_t vec[4] = {GetX1(), GetX2(), GetX3(), GetX4()};
+  Short_t vec[4] = {static_cast<Short_t>(GetX1()), static_cast<Short_t>(GetX2()), static_cast<Short_t>(GetX3()), static_cast<Short_t>(GetX4())};
     array.Set(4, vec);
 }
 
@@ -145,7 +145,7 @@ void AliMUONLocalStruct::GetXPattern(TArrayS& array) const
 void AliMUONLocalStruct::GetYPattern(TArrayS& array) const
 {
     /// return array of Y pattern
-    Short_t vec[4] = {GetY1(), GetY2(), GetY3(), GetY4()};
+  Short_t vec[4] = {static_cast<Short_t>(GetY1()), static_cast<Short_t>(GetY2()), static_cast<Short_t>(GetY3()), static_cast<Short_t>(GetY4())};
     array.Set(4, vec);
 }
 
index 8edceef..39a6a15 100644 (file)
@@ -154,7 +154,7 @@ Char_t AliMUONLocalTrigger::GetLoDecision() const
 void AliMUONLocalTrigger::GetXPattern(TArrayS& array) const
 {
     /// return array of X pattern
-    Short_t vec[4] = {GetX1Pattern(), GetX2Pattern(), GetX3Pattern(), GetX4Pattern()};
+  Short_t vec[4] = {static_cast<Short_t>(GetX1Pattern()), static_cast<Short_t>(GetX2Pattern()), static_cast<Short_t>(GetX3Pattern()), static_cast<Short_t>(GetX4Pattern())};
     array.Set(4, vec);
 }
 
@@ -162,7 +162,7 @@ void AliMUONLocalTrigger::GetXPattern(TArrayS& array) const
 void AliMUONLocalTrigger::GetYPattern(TArrayS& array) const
 {
     /// return array of Y pattern
-    Short_t vec[4] = {GetY1Pattern(), GetY2Pattern(), GetY3Pattern(), GetY4Pattern()};
+  Short_t vec[4] = {static_cast<Short_t>(GetY1Pattern()), static_cast<Short_t>(GetY2Pattern()), static_cast<Short_t>(GetY3Pattern()), static_cast<Short_t>(GetY4Pattern())};
     array.Set(4, vec);
 }
 
index c5df652..6f16210 100644 (file)
@@ -208,22 +208,22 @@ void AliMUONSlatGeometryBuilder::CreateGeometry()
   Int_t moduleId;
 
   // the panel volume contains the nomex
-  Float_t panelpar[3] = { kPanelLength/2., kPanelHeight/2., kPanelWidth/2. }; 
-  Float_t nomexpar[3] = { kNomexLength/2., kNomexHeight/2., kNomexWidth/2. }; 
+  Float_t panelpar[3] = { static_cast<Float_t>(kPanelLength/2.), static_cast<Float_t>(kPanelHeight/2.), static_cast<Float_t>(kPanelWidth/2.) }; 
+  Float_t nomexpar[3] = { static_cast<Float_t>(kNomexLength/2.), static_cast<Float_t>(kNomexHeight/2.), static_cast<Float_t>(kNomexWidth/2.) }; 
   Float_t twidth =  kPanelWidth +  kNomexBWidth; 
-  Float_t nomexbpar[3] = {kNomexLength/2., kNomexHeight/2.,twidth/2. };// bulk nomex 
+  Float_t nomexbpar[3] = {static_cast<Float_t>(kNomexLength/2.), static_cast<Float_t>(kNomexHeight/2.),static_cast<Float_t>(twidth/2.) };// bulk nomex 
 
   // insulating material contains PCB-> gas   
   twidth = 2*(kInsuWidth + kPcbWidth) + kSensWidth ; 
-  Float_t insupar[3] = {kInsuLength/2., kInsuHeight/2., twidth/2. }; 
+  Float_t insupar[3] = {static_cast<Float_t>(kInsuLength/2.), static_cast<Float_t>(kInsuHeight/2.), static_cast<Float_t>(twidth/2.) }; 
   twidth -= 2 * kInsuWidth; 
-  Float_t pcbpar[3]  = {kPcbLength/2., kPcbHeight/2., twidth/2. }; 
-  Float_t senspar[3] = {kSensLength/2., kSensHeight/2., kSensWidth/2. }; 
+  Float_t pcbpar[3]  = {static_cast<Float_t>(kPcbLength/2.), static_cast<Float_t>(kPcbHeight/2.), static_cast<Float_t>(twidth/2.) }; 
+  Float_t senspar[3] = {static_cast<Float_t>(kSensLength/2.), static_cast<Float_t>(kSensHeight/2.), static_cast<Float_t>(kSensWidth/2.) }; 
   Float_t theight    = 2 * kHframeHeight + kSensHeight;
-  Float_t hFramepar[3] = {kHframeLength/2., theight/2., kHframeWidth/2.}; 
-  Float_t bFramepar[3] = {kBframeLength/2., kBframeHeight/2., kBframeWidth/2.}; 
-  Float_t vFramepar[3] = {kVframeLength/2., kVframeHeight/2., kVframeWidth/2.};
-  Float_t nulocpar[3]  = {kNulocLength/2.,  kNulocHeight/2.,  kNulocWidth/2.}; 
+  Float_t hFramepar[3] = {static_cast<Float_t>(kHframeLength/2.), static_cast<Float_t>(theight/2.), static_cast<Float_t>(kHframeWidth/2.)}; 
+  Float_t bFramepar[3] = {static_cast<Float_t>(kBframeLength/2.), static_cast<Float_t>(kBframeHeight/2.), static_cast<Float_t>(kBframeWidth/2.)}; 
+  Float_t vFramepar[3] = {static_cast<Float_t>(kVframeLength/2.), static_cast<Float_t>(kVframeHeight/2.), static_cast<Float_t>(kVframeWidth/2.)};
+  Float_t nulocpar[3]  = {static_cast<Float_t>(kNulocLength/2.),  static_cast<Float_t>(kNulocHeight/2.),  static_cast<Float_t>(kNulocWidth/2.)}; 
 
   Float_t xx;
   Float_t xxmax = (kBframeLength - kNulocLength)/2.; 
@@ -255,26 +255,26 @@ void AliMUONSlatGeometryBuilder::CreateGeometry()
       // Only for chamber 5: slat 1 has a PCB shorter by 5cm!
 
       Float_t tlength = 35.;
-      Float_t panelpar2[3]  = { tlength/2., panelpar[1],  panelpar[2]}; 
-      Float_t nomexpar2[3]  = { tlength/2., nomexpar[1],  nomexpar[2]}; 
-      Float_t nomexbpar2[3] = { tlength/2., nomexbpar[1],  nomexbpar[2]}; 
-      Float_t insupar2[3]   = { tlength/2., insupar[1],   insupar[2]}; 
-      Float_t pcbpar2[3]    = { tlength/2., pcbpar[1],    pcbpar[2]}; 
-      Float_t senspar2[3]   = { tlength/2., senspar[1],   senspar[2]}; 
-      Float_t hFramepar2[3] = { tlength/2., hFramepar[1], hFramepar[2]}; 
-      Float_t bFramepar2[3] = { tlength/2., bFramepar[1], bFramepar[2]}; 
+      Float_t panelpar2[3]  = { static_cast<Float_t>(tlength/2.), panelpar[1],  panelpar[2]}; 
+      Float_t nomexpar2[3]  = { static_cast<Float_t>(tlength/2.), nomexpar[1],  nomexpar[2]}; 
+      Float_t nomexbpar2[3] = { static_cast<Float_t>(tlength/2.), nomexbpar[1],  nomexbpar[2]}; 
+      Float_t insupar2[3]   = { static_cast<Float_t>(tlength/2.), insupar[1],   insupar[2]}; 
+      Float_t pcbpar2[3]    = { static_cast<Float_t>(tlength/2.), pcbpar[1],    pcbpar[2]}; 
+      Float_t senspar2[3]   = { static_cast<Float_t>(tlength/2.), senspar[1],   senspar[2]}; 
+      Float_t hFramepar2[3] = { static_cast<Float_t>(tlength/2.), hFramepar[1], hFramepar[2]}; 
+      Float_t bFramepar2[3] = { static_cast<Float_t>(tlength/2.), bFramepar[1], bFramepar[2]}; 
       Float_t pcbDLength3   = (kPcbLength - tlength);
       
       // For rounded pcb of central slat
       Float_t csvPcbLength = 59.25-40.; // PQ-LAT-SR1
-      Float_t panelpar3[3]  = { csvPcbLength/2., panelpar[1],  panelpar[2]}; 
-      Float_t nomexpar3[3]  = { csvPcbLength/2., nomexpar[1],  nomexpar[2]}; 
-      Float_t nomexbpar3[3] = { csvPcbLength/2., nomexbpar[1],  nomexbpar[2]}; 
-      Float_t insupar3[3]   = { csvPcbLength/2., insupar[1],   insupar[2]}; 
-      Float_t pcbpar3[3]    = { csvPcbLength/2., pcbpar[1],    pcbpar[2]}; 
-      Float_t senspar3[3]   = { csvPcbLength/2., senspar[1],   senspar[2]}; 
-      Float_t hFramepar3[3] = { csvPcbLength/2., hFramepar[1], hFramepar[2]}; 
-      Float_t bFramepar3[3] = { csvPcbLength/2., bFramepar[1], bFramepar[2]}; 
+      Float_t panelpar3[3]  = { static_cast<Float_t>(csvPcbLength/2.), panelpar[1],  panelpar[2]}; 
+      Float_t nomexpar3[3]  = { static_cast<Float_t>(csvPcbLength/2.), nomexpar[1],  nomexpar[2]}; 
+      Float_t nomexbpar3[3] = {static_cast<Float_t>( csvPcbLength/2.), nomexbpar[1],  nomexbpar[2]}; 
+      Float_t insupar3[3]   = { static_cast<Float_t>(csvPcbLength/2.), insupar[1],   insupar[2]}; 
+      Float_t pcbpar3[3]    = { static_cast<Float_t>(csvPcbLength/2.), pcbpar[1],    pcbpar[2]}; 
+      Float_t senspar3[3]   = { static_cast<Float_t>(csvPcbLength/2.), senspar[1],   senspar[2]}; 
+      Float_t hFramepar3[3] = { static_cast<Float_t>(csvPcbLength/2.), hFramepar[1], hFramepar[2]}; 
+      Float_t bFramepar3[3] = { static_cast<Float_t>(csvPcbLength/2.), bFramepar[1], bFramepar[2]}; 
       Float_t cPhi = TMath::RadToDeg()*(TMath::Pi()/2.-TMath::ACos(hFramepar3[1]/(AliMUONConstants::Rmin(2)-kRframeLength)));
       Float_t cFramepar3[5] = { AliMUONConstants::Rmin(2)-kRframeLength, AliMUONConstants::Rmin(2), kRframeWidth, -cPhi, cPhi}; 
 
@@ -446,98 +446,98 @@ void AliMUONSlatGeometryBuilder::CreateGeometry()
      
       // create the panel volume 
  
-      gMC->Gsvolu("S05C","BOX",kCarbonMaterial,panelpar,3);
-      gMC->Gsvolu("SB5C","BOX",kCarbonMaterial,panelpar2,3);
-      gMC->Gsvolu("SC5C","BOX",kCarbonMaterial,panelpar3,3);
-      gMC->Gsvolu("SD5C","BOX",kCarbonMaterial,panelpar,3);
-      gMC->Gsvolu("S06C","BOX",kCarbonMaterial,panelpar,3);
-      gMC->Gsvolu("SC6C","BOX",kCarbonMaterial,panelpar3,3);
-      gMC->Gsvolu("SD6C","BOX",kCarbonMaterial,panelpar,3);
+      TVirtualMC::GetMC()->Gsvolu("S05C","BOX",kCarbonMaterial,panelpar,3);
+      TVirtualMC::GetMC()->Gsvolu("SB5C","BOX",kCarbonMaterial,panelpar2,3);
+      TVirtualMC::GetMC()->Gsvolu("SC5C","BOX",kCarbonMaterial,panelpar3,3);
+      TVirtualMC::GetMC()->Gsvolu("SD5C","BOX",kCarbonMaterial,panelpar,3);
+      TVirtualMC::GetMC()->Gsvolu("S06C","BOX",kCarbonMaterial,panelpar,3);
+      TVirtualMC::GetMC()->Gsvolu("SC6C","BOX",kCarbonMaterial,panelpar3,3);
+      TVirtualMC::GetMC()->Gsvolu("SD6C","BOX",kCarbonMaterial,panelpar,3);
  
       // create the nomex volume (honey comb)
 
-      gMC->Gsvolu("S05N","BOX",kNomexMaterial,nomexpar,3);
-      gMC->Gsvolu("SB5N","BOX",kNomexMaterial,nomexpar2,3);
-      gMC->Gsvolu("SC5N","BOX",kNomexMaterial,nomexpar3,3);
-      gMC->Gsvolu("SD5N","BOX",kNomexMaterial,nomexpar,3);
-      gMC->Gsvolu("S06N","BOX",kNomexMaterial,nomexpar,3);
-      gMC->Gsvolu("SC6N","BOX",kNomexMaterial,nomexpar3,3);
-      gMC->Gsvolu("SD6N","BOX",kNomexMaterial,nomexpar,3);
+      TVirtualMC::GetMC()->Gsvolu("S05N","BOX",kNomexMaterial,nomexpar,3);
+      TVirtualMC::GetMC()->Gsvolu("SB5N","BOX",kNomexMaterial,nomexpar2,3);
+      TVirtualMC::GetMC()->Gsvolu("SC5N","BOX",kNomexMaterial,nomexpar3,3);
+      TVirtualMC::GetMC()->Gsvolu("SD5N","BOX",kNomexMaterial,nomexpar,3);
+      TVirtualMC::GetMC()->Gsvolu("S06N","BOX",kNomexMaterial,nomexpar,3);
+      TVirtualMC::GetMC()->Gsvolu("SC6N","BOX",kNomexMaterial,nomexpar3,3);
+      TVirtualMC::GetMC()->Gsvolu("SD6N","BOX",kNomexMaterial,nomexpar,3);
  
       // create the nomex volume (bulk)
 
-      gMC->Gsvolu("S05X","BOX",kNomexBMaterial,nomexbpar,3);
-      gMC->Gsvolu("SB5X","BOX",kNomexBMaterial,nomexbpar2,3);
-      gMC->Gsvolu("SC5X","BOX",kNomexBMaterial,nomexbpar3,3);
-      gMC->Gsvolu("SD5X","BOX",kNomexBMaterial,nomexbpar,3);
-      gMC->Gsvolu("S06X","BOX",kNomexBMaterial,nomexbpar,3);
-      gMC->Gsvolu("SC6X","BOX",kNomexBMaterial,nomexbpar3,3);
-      gMC->Gsvolu("SD6X","BOX",kNomexBMaterial,nomexbpar,3);
+      TVirtualMC::GetMC()->Gsvolu("S05X","BOX",kNomexBMaterial,nomexbpar,3);
+      TVirtualMC::GetMC()->Gsvolu("SB5X","BOX",kNomexBMaterial,nomexbpar2,3);
+      TVirtualMC::GetMC()->Gsvolu("SC5X","BOX",kNomexBMaterial,nomexbpar3,3);
+      TVirtualMC::GetMC()->Gsvolu("SD5X","BOX",kNomexBMaterial,nomexbpar,3);
+      TVirtualMC::GetMC()->Gsvolu("S06X","BOX",kNomexBMaterial,nomexbpar,3);
+      TVirtualMC::GetMC()->Gsvolu("SC6X","BOX",kNomexBMaterial,nomexbpar3,3);
+      TVirtualMC::GetMC()->Gsvolu("SD6X","BOX",kNomexBMaterial,nomexbpar,3);
 
       // create the insulating material volume 
 
-      gMC->Gsvolu("S05I","BOX",kInsuMaterial,insupar,3);
-      gMC->Gsvolu("SB5I","BOX",kInsuMaterial,insupar2,3);
-      gMC->Gsvolu("SC5I","BOX",kInsuMaterial,insupar3,3);
-      gMC->Gsvolu("SD5I","BOX",kInsuMaterial,insupar,3);
-      gMC->Gsvolu("S06I","BOX",kInsuMaterial,insupar,3);
-      gMC->Gsvolu("SC6I","BOX",kInsuMaterial,insupar3,3);
-      gMC->Gsvolu("SD6I","BOX",kInsuMaterial,insupar,3);
+      TVirtualMC::GetMC()->Gsvolu("S05I","BOX",kInsuMaterial,insupar,3);
+      TVirtualMC::GetMC()->Gsvolu("SB5I","BOX",kInsuMaterial,insupar2,3);
+      TVirtualMC::GetMC()->Gsvolu("SC5I","BOX",kInsuMaterial,insupar3,3);
+      TVirtualMC::GetMC()->Gsvolu("SD5I","BOX",kInsuMaterial,insupar,3);
+      TVirtualMC::GetMC()->Gsvolu("S06I","BOX",kInsuMaterial,insupar,3);
+      TVirtualMC::GetMC()->Gsvolu("SC6I","BOX",kInsuMaterial,insupar3,3);
+      TVirtualMC::GetMC()->Gsvolu("SD6I","BOX",kInsuMaterial,insupar,3);
  
       // create the PCB volume 
 
-      gMC->Gsvolu("S05P","BOX",kPcbMaterial,pcbpar,3);
-      gMC->Gsvolu("SB5P","BOX",kPcbMaterial,pcbpar2,3);
-      gMC->Gsvolu("SC5P","BOX",kPcbMaterial,pcbpar3,3);
-      gMC->Gsvolu("SD5P","BOX",kPcbMaterial,pcbpar,3);
-      gMC->Gsvolu("S06P","BOX",kPcbMaterial,pcbpar,3);
-      gMC->Gsvolu("SC6P","BOX",kPcbMaterial,pcbpar3,3);
-      gMC->Gsvolu("SD6P","BOX",kPcbMaterial,pcbpar,3);
+      TVirtualMC::GetMC()->Gsvolu("S05P","BOX",kPcbMaterial,pcbpar,3);
+      TVirtualMC::GetMC()->Gsvolu("SB5P","BOX",kPcbMaterial,pcbpar2,3);
+      TVirtualMC::GetMC()->Gsvolu("SC5P","BOX",kPcbMaterial,pcbpar3,3);
+      TVirtualMC::GetMC()->Gsvolu("SD5P","BOX",kPcbMaterial,pcbpar,3);
+      TVirtualMC::GetMC()->Gsvolu("S06P","BOX",kPcbMaterial,pcbpar,3);
+      TVirtualMC::GetMC()->Gsvolu("SC6P","BOX",kPcbMaterial,pcbpar3,3);
+      TVirtualMC::GetMC()->Gsvolu("SD6P","BOX",kPcbMaterial,pcbpar,3);
  
       // create the sensitive volumes,
 
-      gMC->Gsvolu("S05G","BOX",kSensMaterial,dum,0);
-      gMC->Gsvolu("SC5G","BOX",kSensMaterial,senspar3,3);
-      gMC->Gsvolu("SD5G","BOX",kSensMaterial,senspar,3);
-      gMC->Gsvolu("S06G","BOX",kSensMaterial,dum,0);
-      gMC->Gsvolu("SC6G","BOX",kSensMaterial,senspar3,3);
-      gMC->Gsvolu("SD6G","BOX",kSensMaterial,senspar,3);
+      TVirtualMC::GetMC()->Gsvolu("S05G","BOX",kSensMaterial,dum,0);
+      TVirtualMC::GetMC()->Gsvolu("SC5G","BOX",kSensMaterial,senspar3,3);
+      TVirtualMC::GetMC()->Gsvolu("SD5G","BOX",kSensMaterial,senspar,3);
+      TVirtualMC::GetMC()->Gsvolu("S06G","BOX",kSensMaterial,dum,0);
+      TVirtualMC::GetMC()->Gsvolu("SC6G","BOX",kSensMaterial,senspar3,3);
+      TVirtualMC::GetMC()->Gsvolu("SD6G","BOX",kSensMaterial,senspar,3);
 
       // create the vertical frame volume 
 
-      gMC->Gsvolu("S05V","BOX",kVframeMaterial,vFramepar,3);
-      gMC->Gsvolu("S06V","BOX",kVframeMaterial,vFramepar,3);
+      TVirtualMC::GetMC()->Gsvolu("S05V","BOX",kVframeMaterial,vFramepar,3);
+      TVirtualMC::GetMC()->Gsvolu("S06V","BOX",kVframeMaterial,vFramepar,3);
 
       // create the rounded vertical frame volume 
 
-      gMC->Gsvolu("SC5D","TUBS",kRframeMaterial,cFramepar3,5);
-      gMC->Gsvolu("SD5D","TUBS",kRframeMaterial,rFramepar3,5);
-      gMC->Gsvolu("SC6D","TUBS",kRframeMaterial,cFramepar3,5);
-      gMC->Gsvolu("SD6D","TUBS",kRframeMaterial,rFramepar3,5);
+      TVirtualMC::GetMC()->Gsvolu("SC5D","TUBS",kRframeMaterial,cFramepar3,5);
+      TVirtualMC::GetMC()->Gsvolu("SD5D","TUBS",kRframeMaterial,rFramepar3,5);
+      TVirtualMC::GetMC()->Gsvolu("SC6D","TUBS",kRframeMaterial,cFramepar3,5);
+      TVirtualMC::GetMC()->Gsvolu("SD6D","TUBS",kRframeMaterial,rFramepar3,5);
 
       // create the horizontal frame volume 
 
-      gMC->Gsvolu("S05H","BOX",kHframeMaterial,hFramepar,3);
-      gMC->Gsvolu("SB5H","BOX",kHframeMaterial,hFramepar2,3);
-      gMC->Gsvolu("SC5H","BOX",kHframeMaterial,hFramepar3,3);
-      gMC->Gsvolu("SD5H","BOX",kHframeMaterial,hFramepar,3);
-      gMC->Gsvolu("S06H","BOX",kHframeMaterial,hFramepar,3);
-      gMC->Gsvolu("SC6H","BOX",kHframeMaterial,hFramepar3,3);
-      gMC->Gsvolu("SD6H","BOX",kHframeMaterial,hFramepar,3);
+      TVirtualMC::GetMC()->Gsvolu("S05H","BOX",kHframeMaterial,hFramepar,3);
+      TVirtualMC::GetMC()->Gsvolu("SB5H","BOX",kHframeMaterial,hFramepar2,3);
+      TVirtualMC::GetMC()->Gsvolu("SC5H","BOX",kHframeMaterial,hFramepar3,3);
+      TVirtualMC::GetMC()->Gsvolu("SD5H","BOX",kHframeMaterial,hFramepar,3);
+      TVirtualMC::GetMC()->Gsvolu("S06H","BOX",kHframeMaterial,hFramepar,3);
+      TVirtualMC::GetMC()->Gsvolu("SC6H","BOX",kHframeMaterial,hFramepar3,3);
+      TVirtualMC::GetMC()->Gsvolu("SD6H","BOX",kHframeMaterial,hFramepar,3);
  
       // create the horizontal border volume 
 
-      gMC->Gsvolu("S05B","BOX",kBframeMaterial,bFramepar,3);
-      gMC->Gsvolu("SB5B","BOX",kBframeMaterial,bFramepar2,3);
-      gMC->Gsvolu("SC5B","BOX",kBframeMaterial,bFramepar3,3);
-      gMC->Gsvolu("SD5B","BOX",kBframeMaterial,bFramepar,3);
-      gMC->Gsvolu("S06B","BOX",kBframeMaterial,bFramepar,3);
-      gMC->Gsvolu("SC6B","BOX",kBframeMaterial,bFramepar3,3);
-      gMC->Gsvolu("SD6B","BOX",kBframeMaterial,bFramepar,3);
+      TVirtualMC::GetMC()->Gsvolu("S05B","BOX",kBframeMaterial,bFramepar,3);
+      TVirtualMC::GetMC()->Gsvolu("SB5B","BOX",kBframeMaterial,bFramepar2,3);
+      TVirtualMC::GetMC()->Gsvolu("SC5B","BOX",kBframeMaterial,bFramepar3,3);
+      TVirtualMC::GetMC()->Gsvolu("SD5B","BOX",kBframeMaterial,bFramepar,3);
+      TVirtualMC::GetMC()->Gsvolu("S06B","BOX",kBframeMaterial,bFramepar,3);
+      TVirtualMC::GetMC()->Gsvolu("SC6B","BOX",kBframeMaterial,bFramepar3,3);
+      TVirtualMC::GetMC()->Gsvolu("SD6B","BOX",kBframeMaterial,bFramepar,3);
 
       // Replace the volume shape with a composite shape
       // with substracted overlap with beam shield     
-      if ( gMC->IsRootGeometrySupported() ) { 
+      if ( TVirtualMC::GetMC()->IsRootGeometrySupported() ) { 
        
        // Get shape
        Int_t nSlatType = 2;
@@ -764,75 +764,75 @@ void AliMUONSlatGeometryBuilder::CreateGeometry()
 
       
       // position the nomex volume inside the panel volume
-      gMC->Gspos("S05N",1,"S05C",0.,0.,0.,0,"ONLY"); 
-      gMC->Gspos("SB5N",1,"SB5C",0.,0.,0.,0,"ONLY"); 
-      gMC->Gspos("SC5N",1,"SC5C",0.,0.,0.,0,"ONLY"); 
-      gMC->Gspos("SD5N",1,"SD5C",0.,0.,0.,0,"ONLY"); 
-      gMC->Gspos("S06N",1,"S06C",0.,0.,0.,0,"ONLY"); 
-      gMC->Gspos("SC6N",1,"SC6C",0.,0.,0.,0,"ONLY"); 
-      gMC->Gspos("SD6N",1,"SD6C",0.,0.,0.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("S05N",1,"S05C",0.,0.,0.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("SB5N",1,"SB5C",0.,0.,0.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("SC5N",1,"SC5C",0.,0.,0.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("SD5N",1,"SD5C",0.,0.,0.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("S06N",1,"S06C",0.,0.,0.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("SC6N",1,"SC6C",0.,0.,0.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("SD6N",1,"SD6C",0.,0.,0.,0,"ONLY"); 
   
       // position panel volume inside the bulk nomex material volume
-      gMC->Gspos("S05C",1,"S05X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
-      gMC->Gspos("SB5C",1,"SB5X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
-      gMC->Gspos("SC5C",1,"SC5X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
-      gMC->Gspos("SD5C",1,"SD5X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
-      gMC->Gspos("S06C",1,"S06X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
-      gMC->Gspos("SC6C",1,"SC6X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
-      gMC->Gspos("SD6C",1,"SD6X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("S05C",1,"S05X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("SB5C",1,"SB5X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("SC5C",1,"SC5X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("SD5C",1,"SD5X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("S06C",1,"S06X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("SC6C",1,"SC6X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("SD6C",1,"SD6X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
 
       // position the PCB volume inside the insulating material volume
-      gMC->Gspos("S05P",1,"S05I",0.,0.,0.,0,"ONLY"); 
-      gMC->Gspos("SB5P",1,"SB5I",0.,0.,0.,0,"ONLY"); 
-      gMC->Gspos("SC5P",1,"SC5I",0.,0.,0.,0,"ONLY"); 
-      gMC->Gspos("SD5P",1,"SD5I",0.,0.,0.,0,"ONLY"); 
-      gMC->Gspos("S06P",1,"S06I",0.,0.,0.,0,"ONLY"); 
-      gMC->Gspos("SC6P",1,"SC6I",0.,0.,0.,0,"ONLY"); 
-      gMC->Gspos("SD6P",1,"SD6I",0.,0.,0.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("S05P",1,"S05I",0.,0.,0.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("SB5P",1,"SB5I",0.,0.,0.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("SC5P",1,"SC5I",0.,0.,0.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("SD5P",1,"SD5I",0.,0.,0.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("S06P",1,"S06I",0.,0.,0.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("SC6P",1,"SC6I",0.,0.,0.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("SD6P",1,"SD6I",0.,0.,0.,0,"ONLY"); 
   
       // position the horizontal frame volume inside the PCB volume
-      gMC->Gspos("S05H",1,"S05P",0.,0.,0.,0,"ONLY"); 
-      gMC->Gspos("SB5H",1,"SB5P",0.,0.,0.,0,"ONLY"); 
-      gMC->Gspos("SC5H",1,"SC5P",0.,0.,0.,0,"ONLY"); 
-      gMC->Gspos("SD5H",1,"SD5P",0.,0.,0.,0,"ONLY"); 
-      gMC->Gspos("S06H",1,"S06P",0.,0.,0.,0,"ONLY"); 
-      gMC->Gspos("SC6H",1,"SC6P",0.,0.,0.,0,"ONLY"); 
-      gMC->Gspos("SD6H",1,"SD6P",0.,0.,0.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("S05H",1,"S05P",0.,0.,0.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("SB5H",1,"SB5P",0.,0.,0.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("SC5H",1,"SC5P",0.,0.,0.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("SD5H",1,"SD5P",0.,0.,0.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("S06H",1,"S06P",0.,0.,0.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("SC6H",1,"SC6P",0.,0.,0.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("SD6H",1,"SD6P",0.,0.,0.,0,"ONLY"); 
   
       // position the sensitive volume inside the horizontal frame volume
-      gMC->Gsposp("S05G",1,"S05H",0.,0.,0.,0,"ONLY",senspar,3); 
-      gMC->Gsposp("S05G",1,"SB5H",0.,0.,0.,0,"ONLY",senspar2,3); 
-      gMC->Gspos("SC5G",1,"SC5H",0.,0.,0.,0,"ONLY"); 
-      gMC->Gspos("SD5G",1,"SD5H",0.,0.,0.,0,"ONLY"); 
-      gMC->Gsposp("S06G",1,"S06H",0.,0.,0.,0,"ONLY",senspar,3); 
-      gMC->Gspos("SC6G",1,"SC6H",0.,0.,0.,0,"ONLY"); 
-      gMC->Gspos("SD6G",1,"SD6H",0.,0.,0.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gsposp("S05G",1,"S05H",0.,0.,0.,0,"ONLY",senspar,3); 
+      TVirtualMC::GetMC()->Gsposp("S05G",1,"SB5H",0.,0.,0.,0,"ONLY",senspar2,3); 
+      TVirtualMC::GetMC()->Gspos("SC5G",1,"SC5H",0.,0.,0.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("SD5G",1,"SD5H",0.,0.,0.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gsposp("S06G",1,"S06H",0.,0.,0.,0,"ONLY",senspar,3); 
+      TVirtualMC::GetMC()->Gspos("SC6G",1,"SC6H",0.,0.,0.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("SD6G",1,"SD6H",0.,0.,0.,0,"ONLY"); 
   
  
       // position the border volumes inside the PCB volume
       Float_t yborder = ( kPcbHeight - kBframeHeight ) / 2.; 
       Int_t rotB = 0;
-      gMC->Matrix(rotB,90,0,90,270,180,0); // rotation around x for second border
-
-      gMC->Gspos("S05B",1,"S05P",0., yborder,0.,0,"ONLY"); 
-      gMC->Gspos("S05B",2,"S05P",0.,-yborder,0.,0,"ONLY"); 
-      gMC->Gspos("SB5B",1,"SB5P",0., yborder,0.,0,"ONLY"); 
-      gMC->Gspos("SB5B",2,"SB5P",0.,-yborder,0.,0,"ONLY"); 
-      gMC->Gspos("SC5B",1,"SC5P",0., yborder,0.,rotB,"ONLY"); 
-      gMC->Gspos("SC5B",2,"SC5P",0.,-yborder,0.,0,"ONLY"); 
-      gMC->Gspos("S05B",1,"SD5P",0., yborder,0.,0,"ONLY"); 
-      gMC->Gspos("SD5B",1,"SD5P",0.,-yborder,0.,0,"ONLY"); 
-
-      gMC->Gspos("S06B",1,"S06P",0., yborder,0.,0,"ONLY"); 
-      gMC->Gspos("S06B",2,"S06P",0.,-yborder,0.,0,"ONLY"); 
-      gMC->Gspos("SC6B",1,"SC6P",0., yborder,0.,rotB,"ONLY"); 
-      gMC->Gspos("SC6B",2,"SC6P",0.,-yborder,0.,0,"ONLY"); 
-      gMC->Gspos("S06B",1,"SD6P",0., yborder,0.,0,"ONLY"); 
-      gMC->Gspos("SD6B",1,"SD6P",0.,-yborder,0.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Matrix(rotB,90,0,90,270,180,0); // rotation around x for second border
+
+      TVirtualMC::GetMC()->Gspos("S05B",1,"S05P",0., yborder,0.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("S05B",2,"S05P",0.,-yborder,0.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("SB5B",1,"SB5P",0., yborder,0.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("SB5B",2,"SB5P",0.,-yborder,0.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("SC5B",1,"SC5P",0., yborder,0.,rotB,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("SC5B",2,"SC5P",0.,-yborder,0.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("S05B",1,"SD5P",0., yborder,0.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("SD5B",1,"SD5P",0.,-yborder,0.,0,"ONLY"); 
+
+      TVirtualMC::GetMC()->Gspos("S06B",1,"S06P",0., yborder,0.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("S06B",2,"S06P",0.,-yborder,0.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("SC6B",1,"SC6P",0., yborder,0.,rotB,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("SC6B",2,"SC6P",0.,-yborder,0.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("S06B",1,"SD6P",0., yborder,0.,0,"ONLY"); 
+      TVirtualMC::GetMC()->Gspos("SD6B",1,"SD6P",0.,-yborder,0.,0,"ONLY"); 
   
       // create the NULOC volume and position it in the horizontal frame
-      gMC->Gsvolu("S05E","BOX",kNulocMaterial,nulocpar,3);
-      gMC->Gsvolu("S06E","BOX",kNulocMaterial,nulocpar,3);
+      TVirtualMC::GetMC()->Gsvolu("S05E","BOX",kNulocMaterial,nulocpar,3);
+      TVirtualMC::GetMC()->Gsvolu("S06E","BOX",kNulocMaterial,nulocpar,3);
       index = 0;
       Float_t xxmax2 = xxmax - pcbDLength3/2.;
       Float_t xxmax3 = xxmax - (kPcbLength-csvPcbLength)/2.;
@@ -840,25 +840,25 @@ void AliMUONSlatGeometryBuilder::CreateGeometry()
       Float_t xxmax4 = (AliMUONConstants::Rmin(2)*TMath::Cos(rPhi3)-kVframeLength/2.) - (kBframeLength - kNulocLength)/2.;
       for (xx = -xxmax; xx <= xxmax; xx += 2*kNulocLength) { 
        index++; 
-       gMC->Gspos("S05E",2*index-1,"S05B", xx, 0.,-kBframeWidth/2. + kNulocWidth/2, 0, "ONLY");
-       gMC->Gspos("S05E",2*index  ,"S05B", xx, 0., kBframeWidth/2. - kNulocWidth/2, 0, "ONLY");
-       gMC->Gspos("S06E",2*index-1,"S06B", xx, 0.,-kBframeWidth/2. + kNulocWidth/2, 0, "ONLY");
-       gMC->Gspos("S06E",2*index  ,"S06B", xx, 0., kBframeWidth/2.-  kNulocWidth/2, 0, "ONLY");
+       TVirtualMC::GetMC()->Gspos("S05E",2*index-1,"S05B", xx, 0.,-kBframeWidth/2. + kNulocWidth/2, 0, "ONLY");
+       TVirtualMC::GetMC()->Gspos("S05E",2*index  ,"S05B", xx, 0., kBframeWidth/2. - kNulocWidth/2, 0, "ONLY");
+       TVirtualMC::GetMC()->Gspos("S06E",2*index-1,"S06B", xx, 0.,-kBframeWidth/2. + kNulocWidth/2, 0, "ONLY");
+       TVirtualMC::GetMC()->Gspos("S06E",2*index  ,"S06B", xx, 0., kBframeWidth/2.-  kNulocWidth/2, 0, "ONLY");
        if (xx > -xxmax2 && xx< xxmax2) {
-         gMC->Gspos("S05E",2*index-1,"SB5B", xx, 0.,-kBframeWidth/2.+ kNulocWidth/2, 0, "ONLY");
-         gMC->Gspos("S05E",2*index  ,"SB5B", xx, 0., kBframeWidth/2.- kNulocWidth/2, 0, "ONLY");
+         TVirtualMC::GetMC()->Gspos("S05E",2*index-1,"SB5B", xx, 0.,-kBframeWidth/2.+ kNulocWidth/2, 0, "ONLY");
+         TVirtualMC::GetMC()->Gspos("S05E",2*index  ,"SB5B", xx, 0., kBframeWidth/2.- kNulocWidth/2, 0, "ONLY");
        }
        if (xx > -xxmax3 && xx< xxmax3) {
-         gMC->Gspos("S05E",2*index-1,"SC5B", xx, 0.,-kBframeWidth/2.+ kNulocWidth/2., 0, "ONLY");
-         gMC->Gspos("S05E",2*index  ,"SC5B", xx, 0., kBframeWidth/2.- kNulocWidth/2., 0, "ONLY");
-         gMC->Gspos("S06E",2*index-1,"SC6B", xx, 0.,-kBframeWidth/2.+ kNulocWidth/2, 0, "ONLY");
-         gMC->Gspos("S06E",2*index  ,"SC6B", xx, 0., kBframeWidth/2.- kNulocWidth/2, 0, "ONLY");
+         TVirtualMC::GetMC()->Gspos("S05E",2*index-1,"SC5B", xx, 0.,-kBframeWidth/2.+ kNulocWidth/2., 0, "ONLY");
+         TVirtualMC::GetMC()->Gspos("S05E",2*index  ,"SC5B", xx, 0., kBframeWidth/2.- kNulocWidth/2., 0, "ONLY");
+         TVirtualMC::GetMC()->Gspos("S06E",2*index-1,"SC6B", xx, 0.,-kBframeWidth/2.+ kNulocWidth/2, 0, "ONLY");
+         TVirtualMC::GetMC()->Gspos("S06E",2*index  ,"SC6B", xx, 0., kBframeWidth/2.- kNulocWidth/2, 0, "ONLY");
        }
        if (xx > xxmax4 && xx< xxmax) {
-         gMC->Gspos("S05E",2*index-1,"SD5B", xx, 0.,-kBframeWidth/2.+ kNulocWidth/2, 0, "ONLY");
-         gMC->Gspos("S05E",2*index  ,"SD5B", xx, 0., kBframeWidth/2.- kNulocWidth/2, 0, "ONLY");
-         gMC->Gspos("S06E",2*index-1,"SD6B", xx, 0.,-kBframeWidth/2.+ kNulocWidth/2, 0, "ONLY");
-         gMC->Gspos("S06E",2*index  ,"SD6B", xx, 0., kBframeWidth/2.- kNulocWidth/2, 0, "ONLY");
+         TVirtualMC::GetMC()->Gspos("S05E",2*index-1,"SD5B", xx, 0.,-kBframeWidth/2.+ kNulocWidth/2, 0, "ONLY");
+         TVirtualMC::GetMC()->Gspos("S05E",2*index  ,"SD5B", xx, 0., kBframeWidth/2.- kNulocWidth/2, 0, "ONLY");
+         TVirtualMC::GetMC()->Gspos("S06E",2*index-1,"SD6B", xx, 0.,-kBframeWidth/2.+ kNulocWidth/2, 0, "ONLY");
+         TVirtualMC::GetMC()->Gspos("S06E",2*index  ,"SD6B", xx, 0., kBframeWidth/2.- kNulocWidth/2, 0, "ONLY");
        }
       }      
       
@@ -905,16 +905,16 @@ void AliMUONSlatGeometryBuilder::CreateGeometry()
 
 
       // Add readout cables
-      gMC->Gsvolu("S05L","BOX",kCableMaterial,dum,0);
-      gMC->Gsvolu("S06L","BOX",kCableMaterial,dum,0);
+      TVirtualMC::GetMC()->Gsvolu("S05L","BOX",kCableMaterial,dum,0);
+      TVirtualMC::GetMC()->Gsvolu("S06L","BOX",kCableMaterial,dum,0);
 
       ySlat3 = 0.;
       Float_t lCableX = 0.;
       Float_t lCableX6 = 0.;
       Float_t lCableY = 0.;
       Float_t lCableZ = 0.;
-      Float_t cablepar[3] = {supporthlength/2., kCableHeight/2., kCableWidth/2.};
-      Float_t cablepar6[3] = {supporthlengthCh6/2., kCableHeight/2., kCableWidth/2.};
+      Float_t cablepar[3] = {static_cast<Float_t>(supporthlength/2.), static_cast<Float_t>(kCableHeight/2.), static_cast<Float_t>(kCableWidth/2.)};
+      Float_t cablepar6[3] = {static_cast<Float_t>(supporthlengthCh6/2.), static_cast<Float_t>(kCableHeight/2.), static_cast<Float_t>(kCableWidth/2.)};
       Float_t lCableDY = 0.;
       Int_t cIndex = 0;
       Int_t cIndex6 = 0;
@@ -940,10 +940,10 @@ void AliMUONSlatGeometryBuilder::CreateGeometry()
            cablepar6[0] -= (kPcbLength-csvPcbLength)/2.;
            lCableX6 = (kPcbLength-csvPcbLength)/2.;
          }
-         gMC->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,lCableY+lCableDY,lCableZ,0,"ONLY",cablepar,3);       
-         gMC->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,-(lCableY+lCableDY),lCableZ,0,"ONLY",cablepar,3);
-         gMC->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,lCableY+lCableDY,lCableZ,0,"ONLY",cablepar6,3);    
-         gMC->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,-(lCableY+lCableDY),lCableZ,0,"ONLY",cablepar6,3);
+         TVirtualMC::GetMC()->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,lCableY+lCableDY,lCableZ,0,"ONLY",cablepar,3);       
+         TVirtualMC::GetMC()->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,-(lCableY+lCableDY),lCableZ,0,"ONLY",cablepar,3);
+         TVirtualMC::GetMC()->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,lCableY+lCableDY,lCableZ,0,"ONLY",cablepar6,3);    
+         TVirtualMC::GetMC()->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,-(lCableY+lCableDY),lCableZ,0,"ONLY",cablepar6,3);
 
          // Then bottom cables
          if(i>0){
@@ -960,10 +960,10 @@ void AliMUONSlatGeometryBuilder::CreateGeometry()
                lCableDY = lCableY - dMotherInner - cablepar[1];
              }
            }
-           gMC->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,lCableY-lCableDY,lCableZ,0,"ONLY",cablepar,3); 
-           gMC->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,-(lCableY-lCableDY),lCableZ,0,"ONLY",cablepar,3); 
-           gMC->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,lCableY-lCableDY,lCableZ,0,"ONLY",cablepar6,3); 
-           gMC->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,-(lCableY-lCableDY),lCableZ,0,"ONLY",cablepar6,3); 
+           TVirtualMC::GetMC()->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,lCableY-lCableDY,lCableZ,0,"ONLY",cablepar,3); 
+           TVirtualMC::GetMC()->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,-(lCableY-lCableDY),lCableZ,0,"ONLY",cablepar,3); 
+           TVirtualMC::GetMC()->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,lCableY-lCableDY,lCableZ,0,"ONLY",cablepar6,3); 
+           TVirtualMC::GetMC()->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,-(lCableY-lCableDY),lCableZ,0,"ONLY",cablepar6,3); 
          }
        }
        
@@ -976,16 +976,16 @@ void AliMUONSlatGeometryBuilder::CreateGeometry()
          lCableX6 = (kPcbLength+kVframeLength)/2.;
          lCableDY = (kYpos3[i+1]+kYpos3[i+2])/2.-cablepar[1]; // half way between 2 slats on same side
          lCableZ = TMath::Power(-1,i)*(nomexthickness/2.+carbonthickness+(-1+iCable++)*kCableWidth+kCableWidth/2.);
-         gMC->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,lCableY+lCableDY,lCableZ,0,"ONLY",cablepar,3);       
-         gMC->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,-(lCableY+lCableDY),lCableZ,0,"ONLY",cablepar,3);
-         gMC->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,lCableY+lCableDY,lCableZ,0,"ONLY",cablepar6,3);    
-         gMC->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,-(lCableY+lCableDY),lCableZ,0,"ONLY",cablepar6,3);
+         TVirtualMC::GetMC()->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,lCableY+lCableDY,lCableZ,0,"ONLY",cablepar,3);       
+         TVirtualMC::GetMC()->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,-(lCableY+lCableDY),lCableZ,0,"ONLY",cablepar,3);
+         TVirtualMC::GetMC()->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,lCableY+lCableDY,lCableZ,0,"ONLY",cablepar6,3);    
+         TVirtualMC::GetMC()->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,-(lCableY+lCableDY),lCableZ,0,"ONLY",cablepar6,3);
          // Then bottom cables
          lCableDY = (kYpos3[i]+kYpos3[i])/2.-cablepar[1];
-         gMC->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,lCableY-lCableDY,lCableZ,0,"ONLY",cablepar,3); 
-         gMC->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,-(lCableY-lCableDY),lCableZ,0,"ONLY",cablepar,3); 
-         gMC->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,lCableY-lCableDY,lCableZ,0,"ONLY",cablepar6,3); 
-         gMC->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,-(lCableY-lCableDY),lCableZ,0,"ONLY",cablepar6,3); 
+         TVirtualMC::GetMC()->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,lCableY-lCableDY,lCableZ,0,"ONLY",cablepar,3); 
+         TVirtualMC::GetMC()->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,-(lCableY-lCableDY),lCableZ,0,"ONLY",cablepar,3); 
+         TVirtualMC::GetMC()->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,lCableY-lCableDY,lCableZ,0,"ONLY",cablepar6,3); 
+         TVirtualMC::GetMC()->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,-(lCableY-lCableDY),lCableZ,0,"ONLY",cablepar6,3); 
        }
        
        // Cables going out from the end of the slats
@@ -1006,10 +1006,10 @@ void AliMUONSlatGeometryBuilder::CreateGeometry()
          cablepar[0] += pcbDLength3/2.;
          lCableX -=  pcbDLength3/2.;
        } 
-       gMC->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,lCableY+lCableDY,lCableZ,0,"ONLY",cablepar,3); 
-       gMC->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,-(lCableY+lCableDY),lCableZ,0,"ONLY",cablepar,3); 
-       gMC->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,lCableY+lCableDY,lCableZ,0,"ONLY",cablepar6,3); 
-       gMC->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,-(lCableY+lCableDY),lCableZ,0,"ONLY",cablepar6,3); 
+       TVirtualMC::GetMC()->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,lCableY+lCableDY,lCableZ,0,"ONLY",cablepar,3); 
+       TVirtualMC::GetMC()->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,-(lCableY+lCableDY),lCableZ,0,"ONLY",cablepar,3); 
+       TVirtualMC::GetMC()->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,lCableY+lCableDY,lCableZ,0,"ONLY",cablepar6,3); 
+       TVirtualMC::GetMC()->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,-(lCableY+lCableDY),lCableZ,0,"ONLY",cablepar6,3); 
        // Then bottom cables
        if(i>0){ // Loop is over top half of slats, lower half are symmetric 
          if (i==1) {
@@ -1018,10 +1018,10 @@ void AliMUONSlatGeometryBuilder::CreateGeometry()
          else{
            lCableDY = (kYpos3[i]+kYpos3[i-1])/2.-cablepar[1]; // half way between 2 slats on same side
          }
-         gMC->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,lCableY-lCableDY,lCableZ,0,"ONLY",cablepar,3); 
-         gMC->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,-(lCableY-lCableDY),lCableZ,0,"ONLY",cablepar,3); 
-         gMC->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,lCableY-lCableDY,lCableZ,0,"ONLY",cablepar6,3); 
-         gMC->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,-(lCableY-lCableDY),lCableZ,0,"ONLY",cablepar6,3); 
+         TVirtualMC::GetMC()->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,lCableY-lCableDY,lCableZ,0,"ONLY",cablepar,3); 
+         TVirtualMC::GetMC()->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,-(lCableY-lCableDY),lCableZ,0,"ONLY",cablepar,3); 
+         TVirtualMC::GetMC()->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,lCableY-lCableDY,lCableZ,0,"ONLY",cablepar6,3); 
+         TVirtualMC::GetMC()->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,-(lCableY-lCableDY),lCableZ,0,"ONLY",cablepar6,3); 
        }
       }
 
@@ -1206,74 +1206,74 @@ void AliMUONSlatGeometryBuilder::CreateGeometry()
      
     // create the panel volume 
  
-    gMC->Gsvolu("S07C","BOX",kCarbonMaterial,panelpar,3);
-    gMC->Gsvolu("SD7C","BOX",kCarbonMaterial,panelpar,3);
-    gMC->Gsvolu("S08C","BOX",kCarbonMaterial,panelpar,3);
-    gMC->Gsvolu("SD8C","BOX",kCarbonMaterial,panelpar,3);
+    TVirtualMC::GetMC()->Gsvolu("S07C","BOX",kCarbonMaterial,panelpar,3);
+    TVirtualMC::GetMC()->Gsvolu("SD7C","BOX",kCarbonMaterial,panelpar,3);
+    TVirtualMC::GetMC()->Gsvolu("S08C","BOX",kCarbonMaterial,panelpar,3);
+    TVirtualMC::GetMC()->Gsvolu("SD8C","BOX",kCarbonMaterial,panelpar,3);
 
     // create the nomex volume 
 
-    gMC->Gsvolu("S07N","BOX",kNomexMaterial,nomexpar,3);
-    gMC->Gsvolu("SD7N","BOX",kNomexMaterial,nomexpar,3);
-    gMC->Gsvolu("S08N","BOX",kNomexMaterial,nomexpar,3);
-    gMC->Gsvolu("SD8N","BOX",kNomexMaterial,nomexpar,3);
+    TVirtualMC::GetMC()->Gsvolu("S07N","BOX",kNomexMaterial,nomexpar,3);
+    TVirtualMC::GetMC()->Gsvolu("SD7N","BOX",kNomexMaterial,nomexpar,3);
+    TVirtualMC::GetMC()->Gsvolu("S08N","BOX",kNomexMaterial,nomexpar,3);
+    TVirtualMC::GetMC()->Gsvolu("SD8N","BOX",kNomexMaterial,nomexpar,3);
 
 
     // create the nomex volume (bulk)
 
-    gMC->Gsvolu("S07X","BOX",kNomexBMaterial,nomexbpar,3);
-    gMC->Gsvolu("SD7X","BOX",kNomexBMaterial,nomexbpar,3);
-    gMC->Gsvolu("S08X","BOX",kNomexBMaterial,nomexbpar,3);
-    gMC->Gsvolu("SD8X","BOX",kNomexBMaterial,nomexbpar,3);
+    TVirtualMC::GetMC()->Gsvolu("S07X","BOX",kNomexBMaterial,nomexbpar,3);
+    TVirtualMC::GetMC()->Gsvolu("SD7X","BOX",kNomexBMaterial,nomexbpar,3);
+    TVirtualMC::GetMC()->Gsvolu("S08X","BOX",kNomexBMaterial,nomexbpar,3);
+    TVirtualMC::GetMC()->Gsvolu("SD8X","BOX",kNomexBMaterial,nomexbpar,3);
 
     // create the insulating material volume 
 
-    gMC->Gsvolu("S07I","BOX",kInsuMaterial,insupar,3);
-    gMC->Gsvolu("SD7I","BOX",kInsuMaterial,insupar,3);
-    gMC->Gsvolu("S08I","BOX",kInsuMaterial,insupar,3);
-    gMC->Gsvolu("SD8I","BOX",kInsuMaterial,insupar,3);
+    TVirtualMC::GetMC()->Gsvolu("S07I","BOX",kInsuMaterial,insupar,3);
+    TVirtualMC::GetMC()->Gsvolu("SD7I","BOX",kInsuMaterial,insupar,3);
+    TVirtualMC::GetMC()->Gsvolu("S08I","BOX",kInsuMaterial,insupar,3);
+    TVirtualMC::GetMC()->Gsvolu("SD8I","BOX",kInsuMaterial,insupar,3);
 
     // create the PCB volume 
 
-    gMC->Gsvolu("S07P","BOX",kPcbMaterial,pcbpar,3);
-    gMC->Gsvolu("SD7P","BOX",kPcbMaterial,pcbpar,3);
-    gMC->Gsvolu("S08P","BOX",kPcbMaterial,pcbpar,3);
-    gMC->Gsvolu("SD8P","BOX",kPcbMaterial,pcbpar,3);
+    TVirtualMC::GetMC()->Gsvolu("S07P","BOX",kPcbMaterial,pcbpar,3);
+    TVirtualMC::GetMC()->Gsvolu("SD7P","BOX",kPcbMaterial,pcbpar,3);
+    TVirtualMC::GetMC()->Gsvolu("S08P","BOX",kPcbMaterial,pcbpar,3);
+    TVirtualMC::GetMC()->Gsvolu("SD8P","BOX",kPcbMaterial,pcbpar,3);
  
     // create the sensitive volumes,
 
-    gMC->Gsvolu("S07G","BOX",kSensMaterial,dum,0);
-    gMC->Gsvolu("SD7G","BOX",kSensMaterial,senspar,3);
-    gMC->Gsvolu("S08G","BOX",kSensMaterial,dum,0);
-    gMC->Gsvolu("SD8G","BOX",kSensMaterial,senspar,3);
+    TVirtualMC::GetMC()->Gsvolu("S07G","BOX",kSensMaterial,dum,0);
+    TVirtualMC::GetMC()->Gsvolu("SD7G","BOX",kSensMaterial,senspar,3);
+    TVirtualMC::GetMC()->Gsvolu("S08G","BOX",kSensMaterial,dum,0);
+    TVirtualMC::GetMC()->Gsvolu("SD8G","BOX",kSensMaterial,senspar,3);
 
     // create the vertical frame volume 
 
-    gMC->Gsvolu("S07V","BOX",kVframeMaterial,vFramepar,3);
-    gMC->Gsvolu("S08V","BOX",kVframeMaterial,vFramepar,3);
+    TVirtualMC::GetMC()->Gsvolu("S07V","BOX",kVframeMaterial,vFramepar,3);
+    TVirtualMC::GetMC()->Gsvolu("S08V","BOX",kVframeMaterial,vFramepar,3);
 
     // create the rounded vertical frame volume 
 
-    gMC->Gsvolu("SD7D","TUBS",kRframeMaterial,rFramepar4,5);
-    gMC->Gsvolu("SD8D","TUBS",kRframeMaterial,rFramepar4,5);
+    TVirtualMC::GetMC()->Gsvolu("SD7D","TUBS",kRframeMaterial,rFramepar4,5);
+    TVirtualMC::GetMC()->Gsvolu("SD8D","TUBS",kRframeMaterial,rFramepar4,5);
     
     // create the horizontal frame volume 
 
-    gMC->Gsvolu("S07H","BOX",kHframeMaterial,hFramepar,3);
-    gMC->Gsvolu("SD7H","BOX",kHframeMaterial,hFramepar,3);
-    gMC->Gsvolu("S08H","BOX",kHframeMaterial,hFramepar,3);
-    gMC->Gsvolu("SD8H","BOX",kHframeMaterial,hFramepar,3);
+    TVirtualMC::GetMC()->Gsvolu("S07H","BOX",kHframeMaterial,hFramepar,3);
+    TVirtualMC::GetMC()->Gsvolu("SD7H","BOX",kHframeMaterial,hFramepar,3);
+    TVirtualMC::GetMC()->Gsvolu("S08H","BOX",kHframeMaterial,hFramepar,3);
+    TVirtualMC::GetMC()->Gsvolu("SD8H","BOX",kHframeMaterial,hFramepar,3);
 
     // create the horizontal border volume 
 
-    gMC->Gsvolu("S07B","BOX",kBframeMaterial,bFramepar,3);
-    gMC->Gsvolu("SD7B","BOX",kBframeMaterial,bFramepar,3);
-    gMC->Gsvolu("S08B","BOX",kBframeMaterial,bFramepar,3);
-    gMC->Gsvolu("SD8B","BOX",kBframeMaterial,bFramepar,3);
+    TVirtualMC::GetMC()->Gsvolu("S07B","BOX",kBframeMaterial,bFramepar,3);
+    TVirtualMC::GetMC()->Gsvolu("SD7B","BOX",kBframeMaterial,bFramepar,3);
+    TVirtualMC::GetMC()->Gsvolu("S08B","BOX",kBframeMaterial,bFramepar,3);
+    TVirtualMC::GetMC()->Gsvolu("SD8B","BOX",kBframeMaterial,bFramepar,3);
 
     // Replace the volume shape with a composite shape
     // with substracted overlap with beam shield     
-    if ( gMC->IsRootGeometrySupported() ) { 
+    if ( TVirtualMC::GetMC()->IsRootGeometrySupported() ) { 
        
       // Get shape
       Int_t nSlatType = 1;
@@ -1424,65 +1424,65 @@ void AliMUONSlatGeometryBuilder::CreateGeometry()
     }
 
     // position the nomex volume inside the panel volume
-    gMC->Gspos("S07N",1,"S07C",0.,0.,0.,0,"ONLY"); 
-    gMC->Gspos("SD7N",1,"SD7C",0.,0.,0.,0,"ONLY"); 
-    gMC->Gspos("S08N",1,"S08C",0.,0.,0.,0,"ONLY"); 
-    gMC->Gspos("SD8N",1,"SD8C",0.,0.,0.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("S07N",1,"S07C",0.,0.,0.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("SD7N",1,"SD7C",0.,0.,0.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("S08N",1,"S08C",0.,0.,0.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("SD8N",1,"SD8C",0.,0.,0.,0,"ONLY"); 
 
     // position panel volume inside the bulk nomex material volume
-    gMC->Gspos("S07C",1,"S07X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
-    gMC->Gspos("SD7C",1,"SD7X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
-    gMC->Gspos("S08C",1,"S08X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
-    gMC->Gspos("SD8C",1,"SD8X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("S07C",1,"S07X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("SD7C",1,"SD7X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("S08C",1,"S08X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("SD8C",1,"SD8X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
 
     // position the PCB volume inside the insulating material volume
-    gMC->Gspos("S07P",1,"S07I",0.,0.,0.,0,"ONLY"); 
-    gMC->Gspos("SD7P",1,"SD7I",0.,0.,0.,0,"ONLY"); 
-    gMC->Gspos("S08P",1,"S08I",0.,0.,0.,0,"ONLY"); 
-    gMC->Gspos("SD8P",1,"SD8I",0.,0.,0.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("S07P",1,"S07I",0.,0.,0.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("SD7P",1,"SD7I",0.,0.,0.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("S08P",1,"S08I",0.,0.,0.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("SD8P",1,"SD8I",0.,0.,0.,0,"ONLY"); 
 
     // position the horizontal frame volume inside the PCB volume
-    gMC->Gspos("S07H",1,"S07P",0.,0.,0.,0,"ONLY"); 
-    gMC->Gspos("SD7H",1,"SD7P",0.,0.,0.,0,"ONLY"); 
-    gMC->Gspos("S08H",1,"S08P",0.,0.,0.,0,"ONLY"); 
-    gMC->Gspos("SD8H",1,"SD8P",0.,0.,0.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("S07H",1,"S07P",0.,0.,0.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("SD7H",1,"SD7P",0.,0.,0.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("S08H",1,"S08P",0.,0.,0.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("SD8H",1,"SD8P",0.,0.,0.,0,"ONLY"); 
 
     // position the sensitive volume inside the horizontal frame volume
-    gMC->Gsposp("S07G",1,"S07H",0.,0.,0.,0,"ONLY",senspar,3); 
-    gMC->Gspos("SD7G",1,"SD7H",0.,0.,0.,0,"ONLY"); 
-    gMC->Gsposp("S08G",1,"S08H",0.,0.,0.,0,"ONLY",senspar,3); 
-    gMC->Gspos("SD8G",1,"SD8H",0.,0.,0.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gsposp("S07G",1,"S07H",0.,0.,0.,0,"ONLY",senspar,3); 
+    TVirtualMC::GetMC()->Gspos("SD7G",1,"SD7H",0.,0.,0.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gsposp("S08G",1,"S08H",0.,0.,0.,0,"ONLY",senspar,3); 
+    TVirtualMC::GetMC()->Gspos("SD8G",1,"SD8H",0.,0.,0.,0,"ONLY"); 
 
     // position the border volumes inside the PCB volume
     Float_t yborder = ( kPcbHeight - kBframeHeight ) / 2.; 
-    gMC->Gspos("S07B",1,"S07P",0., yborder,0.,0,"ONLY"); 
-    gMC->Gspos("S07B",2,"S07P",0.,-yborder,0.,0,"ONLY");
-    gMC->Gspos("S07B",1,"SD7P",0., yborder,0.,0,"ONLY");
-    gMC->Gspos("SD7B",1,"SD7P",0.,-yborder,0.,0,"ONLY");  
-    gMC->Gspos("S08B",1,"S08P",0., yborder,0.,0,"ONLY"); 
-    gMC->Gspos("S08B",2,"S08P",0.,-yborder,0.,0,"ONLY"); 
-    gMC->Gspos("S08B",1,"SD8P",0., yborder,0.,0,"ONLY"); 
-    gMC->Gspos("SD8B",1,"SD8P",0.,-yborder,0.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("S07B",1,"S07P",0., yborder,0.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("S07B",2,"S07P",0.,-yborder,0.,0,"ONLY");
+    TVirtualMC::GetMC()->Gspos("S07B",1,"SD7P",0., yborder,0.,0,"ONLY");
+    TVirtualMC::GetMC()->Gspos("SD7B",1,"SD7P",0.,-yborder,0.,0,"ONLY");  
+    TVirtualMC::GetMC()->Gspos("S08B",1,"S08P",0., yborder,0.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("S08B",2,"S08P",0.,-yborder,0.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("S08B",1,"SD8P",0., yborder,0.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("SD8B",1,"SD8P",0.,-yborder,0.,0,"ONLY"); 
 
     // create the NULOC volume and position it in the horizontal frame
 
-    gMC->Gsvolu("S07E","BOX",kNulocMaterial,nulocpar,3);
-    gMC->Gsvolu("S08E","BOX",kNulocMaterial,nulocpar,3);
+    TVirtualMC::GetMC()->Gsvolu("S07E","BOX",kNulocMaterial,nulocpar,3);
+    TVirtualMC::GetMC()->Gsvolu("S08E","BOX",kNulocMaterial,nulocpar,3);
     index = 0;
     Float_t rPhi3 = TMath::ASin((kYpos41[1]-kPcbHeight/2.)/AliMUONConstants::Rmin(3));
     Float_t xxmax4 = (AliMUONConstants::Rmin(3)*TMath::Cos(rPhi3)-kVframeLength/2.) - (kBframeLength - kNulocLength)/2.;
     for (xx = -xxmax; xx <= xxmax; xx += 2*kNulocLength) { 
       index++; 
-      gMC->Gspos("S07E",2*index-1,"S07B", xx, 0.,-kBframeWidth/2. + kNulocWidth/2, 0, "ONLY");
-      gMC->Gspos("S07E",2*index  ,"S07B", xx, 0., kBframeWidth/2. - kNulocWidth/2, 0, "ONLY");
-      gMC->Gspos("S08E",2*index-1,"S08B", xx, 0.,-kBframeWidth/2. + kNulocWidth/2, 0, "ONLY");
-      gMC->Gspos("S08E",2*index  ,"S08B", xx, 0., kBframeWidth/2. - kNulocWidth/2, 0, "ONLY");
+      TVirtualMC::GetMC()->Gspos("S07E",2*index-1,"S07B", xx, 0.,-kBframeWidth/2. + kNulocWidth/2, 0, "ONLY");
+      TVirtualMC::GetMC()->Gspos("S07E",2*index  ,"S07B", xx, 0., kBframeWidth/2. - kNulocWidth/2, 0, "ONLY");
+      TVirtualMC::GetMC()->Gspos("S08E",2*index-1,"S08B", xx, 0.,-kBframeWidth/2. + kNulocWidth/2, 0, "ONLY");
+      TVirtualMC::GetMC()->Gspos("S08E",2*index  ,"S08B", xx, 0., kBframeWidth/2. - kNulocWidth/2, 0, "ONLY");
     }
     if (xx > xxmax4 && xx< xxmax) {
-      gMC->Gspos("S07E",2*index-1,"SD7B", xx, 0.,-kBframeWidth/2.+ kNulocWidth/2, 0, "ONLY");
-      gMC->Gspos("S07E",2*index  ,"SD7B", xx, 0., kBframeWidth/2.- kNulocWidth/2, 0, "ONLY");
-      gMC->Gspos("S08E",2*index-1,"SD8B", xx, 0.,-kBframeWidth/2.+ kNulocWidth/2, 0, "ONLY");
-      gMC->Gspos("S08E",2*index  ,"SD8B", xx, 0., kBframeWidth/2.- kNulocWidth/2, 0, "ONLY");
+      TVirtualMC::GetMC()->Gspos("S07E",2*index-1,"SD7B", xx, 0.,-kBframeWidth/2.+ kNulocWidth/2, 0, "ONLY");
+      TVirtualMC::GetMC()->Gspos("S07E",2*index  ,"SD7B", xx, 0., kBframeWidth/2.- kNulocWidth/2, 0, "ONLY");
+      TVirtualMC::GetMC()->Gspos("S08E",2*index-1,"SD8B", xx, 0.,-kBframeWidth/2.+ kNulocWidth/2, 0, "ONLY");
+      TVirtualMC::GetMC()->Gspos("S08E",2*index  ,"SD8B", xx, 0., kBframeWidth/2.- kNulocWidth/2, 0, "ONLY");
     }
 
     //
@@ -1516,8 +1516,8 @@ void AliMUONSlatGeometryBuilder::CreateGeometry()
     voNomexSupportSt4Ch8->AddNode(voCarbonSupportSt4Ch8,2,trCarbon2St4);
  
     // Add readout cables
-    gMC->Gsvolu("S07L","BOX",kCableMaterial,dum,0);
-    gMC->Gsvolu("S08L","BOX",kCableMaterial,dum,0);
+    TVirtualMC::GetMC()->Gsvolu("S07L","BOX",kCableMaterial,dum,0);
+    TVirtualMC::GetMC()->Gsvolu("S08L","BOX",kCableMaterial,dum,0);
 
     ySlat41 = 0.;
     ySlat42 = 0.;
@@ -1525,7 +1525,7 @@ void AliMUONSlatGeometryBuilder::CreateGeometry()
     Float_t lCableY = 0.;
     Float_t lCableY8 = 0.;
     Float_t lCableZ = 0.;
-    Float_t cablepar[3] = {supporthlength/2., kCableHeight/2., kCableWidth/2.};
+    Float_t cablepar[3] = {static_cast<Float_t>(supporthlength/2.), static_cast<Float_t>(kCableHeight/2.), static_cast<Float_t>(kCableWidth/2.)};
     Float_t lCableDY = 0.;
     Float_t lCableDY8 = 0.;
     for (i = 0; i<kNslats4; i++){
@@ -1546,10 +1546,10 @@ void AliMUONSlatGeometryBuilder::CreateGeometry()
        lCableDY = (kYpos41[i+1]+kYpos41[i+2])/2.-cablepar[1];
        lCableDY8 = (kYpos42[i+1]+kYpos42[i+2])/2.-cablepar[1];
        lCableZ = TMath::Power(-1,i)*(nomexthickness/2.+carbonthickness+(-1+iCable++)*kCableWidth+kCableWidth/2.);
-       gMC->Gsposp("S07L",10*i+cIndex++,"S07S",lCableX,lCableY+lCableDY,lCableZ,0,"ONLY",cablepar,3);  
-       gMC->Gsposp("S07L",10*i+cIndex++,"S07S",lCableX,-(lCableY+lCableDY),lCableZ,0,"ONLY",cablepar,3);
-       gMC->Gsposp("S08L",10*i+cIndex8++,"S08S",lCableX,lCableY8+lCableDY8,lCableZ,0,"ONLY",cablepar,3);       
-       gMC->Gsposp("S08L",10*i+cIndex8++,"S08S",lCableX,-(lCableY8+lCableDY8),lCableZ,0,"ONLY",cablepar,3);
+       TVirtualMC::GetMC()->Gsposp("S07L",10*i+cIndex++,"S07S",lCableX,lCableY+lCableDY,lCableZ,0,"ONLY",cablepar,3);  
+       TVirtualMC::GetMC()->Gsposp("S07L",10*i+cIndex++,"S07S",lCableX,-(lCableY+lCableDY),lCableZ,0,"ONLY",cablepar,3);
+       TVirtualMC::GetMC()->Gsposp("S08L",10*i+cIndex8++,"S08S",lCableX,lCableY8+lCableDY8,lCableZ,0,"ONLY",cablepar,3);       
+       TVirtualMC::GetMC()->Gsposp("S08L",10*i+cIndex8++,"S08S",lCableX,-(lCableY8+lCableDY8),lCableZ,0,"ONLY",cablepar,3);
        // Then bottom cables
        if (i>0){
          if (i==1) { // Rounded slat. Bottom cable starts at dMotherInner (beam pipe)
@@ -1568,10 +1568,10 @@ void AliMUONSlatGeometryBuilder::CreateGeometry()
              lCableDY8 = lCableY8 - dMotherInner - cablepar[1];
            }
          }
-         gMC->Gsposp("S07L",10*i+cIndex++,"S07S",lCableX,lCableY-lCableDY,lCableZ,0,"ONLY",cablepar,3); 
-         gMC->Gsposp("S07L",10*i+cIndex++,"S07S",lCableX,-(lCableY-lCableDY),lCableZ,0,"ONLY",cablepar,3); 
-         gMC->Gsposp("S08L",10*i+cIndex8++,"S08S",lCableX,lCableY8-lCableDY8,lCableZ,0,"ONLY",cablepar,3); 
-         gMC->Gsposp("S08L",10*i+cIndex8++,"S08S",lCableX,-(lCableY8-lCableDY8),lCableZ,0,"ONLY",cablepar,3); 
+         TVirtualMC::GetMC()->Gsposp("S07L",10*i+cIndex++,"S07S",lCableX,lCableY-lCableDY,lCableZ,0,"ONLY",cablepar,3); 
+         TVirtualMC::GetMC()->Gsposp("S07L",10*i+cIndex++,"S07S",lCableX,-(lCableY-lCableDY),lCableZ,0,"ONLY",cablepar,3); 
+         TVirtualMC::GetMC()->Gsposp("S08L",10*i+cIndex8++,"S08S",lCableX,lCableY8-lCableDY8,lCableZ,0,"ONLY",cablepar,3); 
+         TVirtualMC::GetMC()->Gsposp("S08L",10*i+cIndex8++,"S08S",lCableX,-(lCableY8-lCableDY8),lCableZ,0,"ONLY",cablepar,3); 
        }
       }
 
@@ -1583,10 +1583,10 @@ void AliMUONSlatGeometryBuilder::CreateGeometry()
        lCableDY = (kYpos41[i+1]+kYpos41[i+2])/2.-cablepar[1]; // half way between 2 slats on same side
        lCableDY8 = (kYpos42[i+1]+kYpos42[i+2])/2.-cablepar[1]; // half way between 2 slats on same side
        lCableZ = TMath::Power(-1,i)*(nomexthickness/2.+carbonthickness+(-1+iCable++)*kCableWidth+kCableWidth/2.);
-       gMC->Gsposp("S07L",10*i+cIndex++,"S07S",lCableX,lCableY+lCableDY,lCableZ,0,"ONLY",cablepar,3); 
-       gMC->Gsposp("S07L",10*i+cIndex++,"S07S",lCableX,-(lCableY+lCableDY),lCableZ,0,"ONLY",cablepar,3); 
-       gMC->Gsposp("S08L",10*i+cIndex8++,"S08S",lCableX,lCableY8+lCableDY8,lCableZ,0,"ONLY",cablepar,3); 
-       gMC->Gsposp("S08L",10*i+cIndex8++,"S08S",lCableX,-(lCableY8+lCableDY8),lCableZ,0,"ONLY",cablepar,3); 
+       TVirtualMC::GetMC()->Gsposp("S07L",10*i+cIndex++,"S07S",lCableX,lCableY+lCableDY,lCableZ,0,"ONLY",cablepar,3); 
+       TVirtualMC::GetMC()->Gsposp("S07L",10*i+cIndex++,"S07S",lCableX,-(lCableY+lCableDY),lCableZ,0,"ONLY",cablepar,3); 
+       TVirtualMC::GetMC()->Gsposp("S08L",10*i+cIndex8++,"S08S",lCableX,lCableY8+lCableDY8,lCableZ,0,"ONLY",cablepar,3); 
+       TVirtualMC::GetMC()->Gsposp("S08L",10*i+cIndex8++,"S08S",lCableX,-(lCableY8+lCableDY8),lCableZ,0,"ONLY",cablepar,3); 
       }        
 
       // Cables going out from the end of the slats
@@ -1601,10 +1601,10 @@ void AliMUONSlatGeometryBuilder::CreateGeometry()
        lCableDY8 = (kYpos42[i+1]+kYpos42[i+2])/2.-cablepar[1];
       }
       lCableZ = TMath::Power(-1,i)*(nomexthickness/2.+carbonthickness+(-1+iCable++)*kCableWidth+kCableWidth/2.);
-      gMC->Gsposp("S07L",10*i+cIndex++,"S07S",lCableX,lCableY+lCableDY,lCableZ,0,"ONLY",cablepar,3); 
-      gMC->Gsposp("S07L",10*i+cIndex++,"S07S",lCableX,-(lCableY+lCableDY),lCableZ,0,"ONLY",cablepar,3); 
-      gMC->Gsposp("S08L",10*i+cIndex8++,"S08S",lCableX,lCableY8+lCableDY8,lCableZ,0,"ONLY",cablepar,3); 
-      gMC->Gsposp("S08L",10*i+cIndex8++,"S08S",lCableX,-(lCableY8+lCableDY8),lCableZ,0,"ONLY",cablepar,3); 
+      TVirtualMC::GetMC()->Gsposp("S07L",10*i+cIndex++,"S07S",lCableX,lCableY+lCableDY,lCableZ,0,"ONLY",cablepar,3); 
+      TVirtualMC::GetMC()->Gsposp("S07L",10*i+cIndex++,"S07S",lCableX,-(lCableY+lCableDY),lCableZ,0,"ONLY",cablepar,3); 
+      TVirtualMC::GetMC()->Gsposp("S08L",10*i+cIndex8++,"S08S",lCableX,lCableY8+lCableDY8,lCableZ,0,"ONLY",cablepar,3); 
+      TVirtualMC::GetMC()->Gsposp("S08L",10*i+cIndex8++,"S08S",lCableX,-(lCableY8+lCableDY8),lCableZ,0,"ONLY",cablepar,3); 
       // Then bottom cables
       if(i>0){
        if (i==1) {
@@ -1621,10 +1621,10 @@ void AliMUONSlatGeometryBuilder::CreateGeometry()
            lCableDY8 = lCableY8 - dMotherInner - cablepar[1];
          }
        }
-       gMC->Gsposp("S07L",10*i+cIndex++,"S07S",lCableX,lCableY-lCableDY,lCableZ,0,"ONLY",cablepar,3); 
-       gMC->Gsposp("S07L",10*i+cIndex++,"S07S",lCableX,-(lCableY-lCableDY),lCableZ,0,"ONLY",cablepar,3); 
-       gMC->Gsposp("S08L",10*i+cIndex8++,"S08S",lCableX,lCableY8-lCableDY8,lCableZ,0,"ONLY",cablepar,3); 
-       gMC->Gsposp("S08L",10*i+cIndex8++,"S08S",lCableX,-(lCableY8-lCableDY8),lCableZ,0,"ONLY",cablepar,3); 
+       TVirtualMC::GetMC()->Gsposp("S07L",10*i+cIndex++,"S07S",lCableX,lCableY-lCableDY,lCableZ,0,"ONLY",cablepar,3); 
+       TVirtualMC::GetMC()->Gsposp("S07L",10*i+cIndex++,"S07S",lCableX,-(lCableY-lCableDY),lCableZ,0,"ONLY",cablepar,3); 
+       TVirtualMC::GetMC()->Gsposp("S08L",10*i+cIndex8++,"S08S",lCableX,lCableY8-lCableDY8,lCableZ,0,"ONLY",cablepar,3); 
+       TVirtualMC::GetMC()->Gsposp("S08L",10*i+cIndex8++,"S08S",lCableX,-(lCableY8-lCableDY8),lCableZ,0,"ONLY",cablepar,3); 
       }        
     }
     
@@ -1809,74 +1809,74 @@ void AliMUONSlatGeometryBuilder::CreateGeometry()
 
     // create the panel volume 
  
-    gMC->Gsvolu("S09C","BOX",kCarbonMaterial,panelpar,3);
-    gMC->Gsvolu("SD9C","BOX",kCarbonMaterial,panelpar,3);
-    gMC->Gsvolu("S10C","BOX",kCarbonMaterial,panelpar,3);
-    gMC->Gsvolu("SD0C","BOX",kCarbonMaterial,panelpar,3);
+    TVirtualMC::GetMC()->Gsvolu("S09C","BOX",kCarbonMaterial,panelpar,3);
+    TVirtualMC::GetMC()->Gsvolu("SD9C","BOX",kCarbonMaterial,panelpar,3);
+    TVirtualMC::GetMC()->Gsvolu("S10C","BOX",kCarbonMaterial,panelpar,3);
+    TVirtualMC::GetMC()->Gsvolu("SD0C","BOX",kCarbonMaterial,panelpar,3);
 
     // create the nomex volume 
 
-    gMC->Gsvolu("S09N","BOX",kNomexMaterial,nomexpar,3);
-    gMC->Gsvolu("SD9N","BOX",kNomexMaterial,nomexpar,3);
-    gMC->Gsvolu("S10N","BOX",kNomexMaterial,nomexpar,3);
-    gMC->Gsvolu("SD0N","BOX",kNomexMaterial,nomexpar,3);
+    TVirtualMC::GetMC()->Gsvolu("S09N","BOX",kNomexMaterial,nomexpar,3);
+    TVirtualMC::GetMC()->Gsvolu("SD9N","BOX",kNomexMaterial,nomexpar,3);
+    TVirtualMC::GetMC()->Gsvolu("S10N","BOX",kNomexMaterial,nomexpar,3);
+    TVirtualMC::GetMC()->Gsvolu("SD0N","BOX",kNomexMaterial,nomexpar,3);
 
 
     // create the nomex volume (bulk)
 
-    gMC->Gsvolu("S09X","BOX",kNomexBMaterial,nomexbpar,3);
-    gMC->Gsvolu("SD9X","BOX",kNomexBMaterial,nomexbpar,3);
-    gMC->Gsvolu("S10X","BOX",kNomexBMaterial,nomexbpar,3);
-    gMC->Gsvolu("SD0X","BOX",kNomexBMaterial,nomexbpar,3);
+    TVirtualMC::GetMC()->Gsvolu("S09X","BOX",kNomexBMaterial,nomexbpar,3);
+    TVirtualMC::GetMC()->Gsvolu("SD9X","BOX",kNomexBMaterial,nomexbpar,3);
+    TVirtualMC::GetMC()->Gsvolu("S10X","BOX",kNomexBMaterial,nomexbpar,3);
+    TVirtualMC::GetMC()->Gsvolu("SD0X","BOX",kNomexBMaterial,nomexbpar,3);
 
     // create the insulating material volume 
 
-    gMC->Gsvolu("S09I","BOX",kInsuMaterial,insupar,3);
-    gMC->Gsvolu("SD9I","BOX",kInsuMaterial,insupar,3);
-    gMC->Gsvolu("S10I","BOX",kInsuMaterial,insupar,3);
-    gMC->Gsvolu("SD0I","BOX",kInsuMaterial,insupar,3);
+    TVirtualMC::GetMC()->Gsvolu("S09I","BOX",kInsuMaterial,insupar,3);
+    TVirtualMC::GetMC()->Gsvolu("SD9I","BOX",kInsuMaterial,insupar,3);
+    TVirtualMC::GetMC()->Gsvolu("S10I","BOX",kInsuMaterial,insupar,3);
+    TVirtualMC::GetMC()->Gsvolu("SD0I","BOX",kInsuMaterial,insupar,3);
 
     // create the PCB volume 
 
-    gMC->Gsvolu("S09P","BOX",kPcbMaterial,pcbpar,3);
-    gMC->Gsvolu("SD9P","BOX",kPcbMaterial,pcbpar,3);
-    gMC->Gsvolu("S10P","BOX",kPcbMaterial,pcbpar,3);
-    gMC->Gsvolu("SD0P","BOX",kPcbMaterial,pcbpar,3);
+    TVirtualMC::GetMC()->Gsvolu("S09P","BOX",kPcbMaterial,pcbpar,3);
+    TVirtualMC::GetMC()->Gsvolu("SD9P","BOX",kPcbMaterial,pcbpar,3);
+    TVirtualMC::GetMC()->Gsvolu("S10P","BOX",kPcbMaterial,pcbpar,3);
+    TVirtualMC::GetMC()->Gsvolu("SD0P","BOX",kPcbMaterial,pcbpar,3);
  
     // create the sensitive volumes,
 
-    gMC->Gsvolu("S09G","BOX",kSensMaterial,dum,0);
-    gMC->Gsvolu("SD9G","BOX",kSensMaterial,senspar,3);
-    gMC->Gsvolu("S10G","BOX",kSensMaterial,dum,0);
-    gMC->Gsvolu("SD0G","BOX",kSensMaterial,senspar,3);
+    TVirtualMC::GetMC()->Gsvolu("S09G","BOX",kSensMaterial,dum,0);
+    TVirtualMC::GetMC()->Gsvolu("SD9G","BOX",kSensMaterial,senspar,3);
+    TVirtualMC::GetMC()->Gsvolu("S10G","BOX",kSensMaterial,dum,0);
+    TVirtualMC::GetMC()->Gsvolu("SD0G","BOX",kSensMaterial,senspar,3);
 
     // create the vertical frame volume 
 
-    gMC->Gsvolu("S09V","BOX",kVframeMaterial,vFramepar,3);
-    gMC->Gsvolu("S10V","BOX",kVframeMaterial,vFramepar,3);
+    TVirtualMC::GetMC()->Gsvolu("S09V","BOX",kVframeMaterial,vFramepar,3);
+    TVirtualMC::GetMC()->Gsvolu("S10V","BOX",kVframeMaterial,vFramepar,3);
 
     // create the rounded vertical frame volume 
 
-    gMC->Gsvolu("SD9D","TUBS",kRframeMaterial,rFramepar5,5);
-    gMC->Gsvolu("SD0D","TUBS",kRframeMaterial,rFramepar5,5);
+    TVirtualMC::GetMC()->Gsvolu("SD9D","TUBS",kRframeMaterial,rFramepar5,5);
+    TVirtualMC::GetMC()->Gsvolu("SD0D","TUBS",kRframeMaterial,rFramepar5,5);
 
     // create the horizontal frame volume 
 
-    gMC->Gsvolu("S09H","BOX",kHframeMaterial,hFramepar,3);
-    gMC->Gsvolu("SD9H","BOX",kHframeMaterial,hFramepar,3);
-    gMC->Gsvolu("S10H","BOX",kHframeMaterial,hFramepar,3);
-    gMC->Gsvolu("SD0H","BOX",kHframeMaterial,hFramepar,3);
+    TVirtualMC::GetMC()->Gsvolu("S09H","BOX",kHframeMaterial,hFramepar,3);
+    TVirtualMC::GetMC()->Gsvolu("SD9H","BOX",kHframeMaterial,hFramepar,3);
+    TVirtualMC::GetMC()->Gsvolu("S10H","BOX",kHframeMaterial,hFramepar,3);
+    TVirtualMC::GetMC()->Gsvolu("SD0H","BOX",kHframeMaterial,hFramepar,3);
 
     // create the horizontal border volume 
 
-    gMC->Gsvolu("S09B","BOX",kBframeMaterial,bFramepar,3);
-    gMC->Gsvolu("SD9B","BOX",kBframeMaterial,bFramepar,3);
-    gMC->Gsvolu("S10B","BOX",kBframeMaterial,bFramepar,3);
-    gMC->Gsvolu("SD0B","BOX",kBframeMaterial,bFramepar,3);
+    TVirtualMC::GetMC()->Gsvolu("S09B","BOX",kBframeMaterial,bFramepar,3);
+    TVirtualMC::GetMC()->Gsvolu("SD9B","BOX",kBframeMaterial,bFramepar,3);
+    TVirtualMC::GetMC()->Gsvolu("S10B","BOX",kBframeMaterial,bFramepar,3);
+    TVirtualMC::GetMC()->Gsvolu("SD0B","BOX",kBframeMaterial,bFramepar,3);
 
     // Replace the volume shape with a composite shape
     // with substracted overlap with beam shield     
-    if ( gMC->IsRootGeometrySupported() ) { 
+    if ( TVirtualMC::GetMC()->IsRootGeometrySupported() ) { 
        
       // Get shape
       Int_t nSlatType = 1;
@@ -2027,65 +2027,65 @@ void AliMUONSlatGeometryBuilder::CreateGeometry()
     }
 
     // position the nomex volume inside the panel volume
-    gMC->Gspos("S09N",1,"S09C",0.,0.,0.,0,"ONLY"); 
-    gMC->Gspos("SD9N",1,"SD9C",0.,0.,0.,0,"ONLY"); 
-    gMC->Gspos("S10N",1,"S10C",0.,0.,0.,0,"ONLY"); 
-    gMC->Gspos("SD0N",1,"SD0C",0.,0.,0.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("S09N",1,"S09C",0.,0.,0.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("SD9N",1,"SD9C",0.,0.,0.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("S10N",1,"S10C",0.,0.,0.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("SD0N",1,"SD0C",0.,0.,0.,0,"ONLY"); 
 
     // position panel  volume inside the bulk nomex material volume
-    gMC->Gspos("S09C",1,"S09X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
-    gMC->Gspos("SD9C",1,"SD9X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
-    gMC->Gspos("S10C",1,"S10X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
-    gMC->Gspos("SD0C",1,"SD0X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("S09C",1,"S09X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("SD9C",1,"SD9X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("S10C",1,"S10X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("SD0C",1,"SD0X",0.,0.,kNomexBWidth/2.,0,"ONLY"); 
 
     // position the PCB volume inside the insulating material volume
-    gMC->Gspos("S09P",1,"S09I",0.,0.,0.,0,"ONLY"); 
-    gMC->Gspos("SD9P",1,"SD9I",0.,0.,0.,0,"ONLY"); 
-    gMC->Gspos("S10P",1,"S10I",0.,0.,0.,0,"ONLY"); 
-    gMC->Gspos("SD0P",1,"SD0I",0.,0.,0.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("S09P",1,"S09I",0.,0.,0.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("SD9P",1,"SD9I",0.,0.,0.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("S10P",1,"S10I",0.,0.,0.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("SD0P",1,"SD0I",0.,0.,0.,0,"ONLY"); 
 
     // position the horizontal frame volume inside the PCB volume
-    gMC->Gspos("S09H",1,"S09P",0.,0.,0.,0,"ONLY"); 
-    gMC->Gspos("SD9H",1,"SD9P",0.,0.,0.,0,"ONLY"); 
-    gMC->Gspos("S10H",1,"S10P",0.,0.,0.,0,"ONLY"); 
-    gMC->Gspos("SD0H",1,"SD0P",0.,0.,0.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("S09H",1,"S09P",0.,0.,0.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("SD9H",1,"SD9P",0.,0.,0.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("S10H",1,"S10P",0.,0.,0.,0,"ONLY"); 
+    TVirtualMC::GetMC()->Gspos("SD0H",1,"SD0P",0.,0.,0.,0,"ONLY");