return;
}
AliFMDSimulator::DefineMaterials();
- fSi = gGeoManager->GetMedium("FMD Si$");
- fC = gGeoManager->GetMedium("FMD Carbon$");
- fAl = gGeoManager->GetMedium("FMD Aluminum$");
- fChip = gGeoManager->GetMedium("FMD Chip$");
- fAir = gGeoManager->GetMedium("FMD Air$");
- fPCB = gGeoManager->GetMedium("FMD PCB$");
- fPlastic = gGeoManager->GetMedium("FMD Plastic$");
+ fSi = gGeoManager->GetMedium("FMDSi$");
+ fC = gGeoManager->GetMedium("FMDCarbon$");
+ fAl = gGeoManager->GetMedium("FMDAluminum$");
+ fChip = gGeoManager->GetMedium("FMDChip$");
+ fAir = gGeoManager->GetMedium("FMDAir$");
+ fPCB = gGeoManager->GetMedium("FMDPCB$");
+ fPlastic = gGeoManager->GetMedium("FMDPlastic$");
}
//____________________________________________________________________
precision = .001;
minStepSize = .001;
id = kSiId;
- fFMD->AliMaterial(id, "FMD Si$",
+ fFMD->AliMaterial(id, "Si$",
a, z, density, radiationLength, absorbtionLength);
- fFMD->AliMedium(kSiId, "FMD Si$",
+ fFMD->AliMedium(kSiId, "Si$",
id,1,fieldType,maxField,maxBending,
maxStepSize,maxEnergyLoss,precision,minStepSize);
precision = .003;
minStepSize = .003;
id = kCarbonId;
- fFMD->AliMaterial(id, "FMD Carbon$",
+ fFMD->AliMaterial(id, "Carbon$",
a, z, density, radiationLength, absorbtionLength);
- fFMD->AliMedium(kCarbonId, "FMD Carbon$",
+ fFMD->AliMedium(kCarbonId, "Carbon$",
id,0,fieldType,maxField,maxBending,
maxStepSize,maxEnergyLoss,precision,minStepSize);
density = 2.7;
radiationLength = 8.9;
id = kAlId;
- fFMD->AliMaterial(id, "FMD Aluminum$",
+ fFMD->AliMaterial(id, "Aluminum$",
a, z, density, radiationLength, absorbtionLength);
- fFMD->AliMedium(kAlId, "FMD Aluminum$",
+ fFMD->AliMedium(kAlId, "Aluminum$",
id, 0, fieldType, maxField, maxBending,
maxStepSize, maxEnergyLoss, precision, minStepSize);
precision = .003;
minStepSize = .003;
id = kSiChipId;
- fFMD->AliMixture(id, "FMD Si Chip$", as, zs, density, 6, ws);
- fFMD->AliMedium(kSiChipId, "FMD Si Chip$",
+ fFMD->AliMixture(id, "Si Chip$", as, zs, density, 6, ws);
+ fFMD->AliMedium(kSiChipId, "Si Chip$",
id, 0, fieldType, maxField, maxBending,
maxStepSize, maxEnergyLoss, precision, minStepSize);
}
precision = .001;
minStepSize = .001;
id = KaptionId;
- fFMD->AliMixture(id, "FMD Kaption$", as, zs, density, 4, ws);
- fFMD->AliMedium(kAlId, "FMD Kaption$",
+ fFMD->AliMixture(id, "Kaption$", as, zs, density, 4, ws);
+ fFMD->AliMedium(kAlId, "Kaption$",
id,0,fieldType,maxField,maxBending,
maxStepSize,maxEnergyLoss,precision,minStepSize);
}
precision = .001;
minStepSize = .001;
id = kAirId;
- fFMD->AliMixture(id, "FMD Air$", as, zs, density, 4, ws);
- fFMD->AliMedium(kAirId, "FMD Air$",
+ fFMD->AliMixture(id, "Air$", as, zs, density, 4, ws);
+ fFMD->AliMedium(kAirId, "Air$",
id,0,fieldType,maxField,maxBending,
maxStepSize,maxEnergyLoss,precision,minStepSize);
}
precision = .001;
minStepSize = .001;
id = kPcbId;
- fFMD->AliMixture(id, "FMD PCB$", as, zs, density, 14, ws);
- fFMD->AliMedium(kPcbId, "FMD PCB$",
+ fFMD->AliMixture(id, "PCB$", as, zs, density, 14, ws);
+ fFMD->AliMedium(kPcbId, "PCB$",
id,0,fieldType,maxField,maxBending,
maxStepSize,maxEnergyLoss,precision,minStepSize);
}
precision = .003;
minStepSize = .003;
id = kPlasticId;
- fFMD->AliMixture(id, "FMD Plastic$", as, zs, density, -2, ws);
- fFMD->AliMedium(kPlasticId, "FMD Plastic$",
+ fFMD->AliMixture(id, "Plastic$", as, zs, density, -2, ws);
+ fFMD->AliMedium(kPlasticId, "Plastic$",
id,0,fieldType,maxField,maxBending,
maxStepSize,maxEnergyLoss,precision,minStepSize);
}
#include <TStopwatch.h>
#include <TSystem.h>
#include <TVirtualMC.h>
-#include "TGeant3.h"
+#include <TGeoManager.h>
+#include "TGeant3.h"
-
#include "AliLog.h"
#include "AliDetector.h"
#include "AliGenerator.h"
void AliMC::ConstructGeometry()
{
//
- // Create modules, materials, geometry
+ // Either load geometry from file or create it through usual
+ // loop on detectors. In the first case the method
+ // AliModule::CreateMaterials() only builds fIdtmed and is postponed
+ // at InitGeometry().
//
+ if(gAlice->IsRootGeometry()){
+ // Load geometry
+ const char *geomfilename = gAlice->GetGeometryFileName();
+ if(gSystem->ExpandPathName(geomfilename)){
+ AliInfo(Form("Loading geometry from file:\n %40s\n\n",geomfilename));
+ TGeoManager::Import(geomfilename);
+ }else{
+ AliInfo(Form("Geometry file %40s not found!\n",geomfilename));
+ return;
+ }
+
+ }else{
+
+ // Create modules, materials, geometry
TStopwatch stw;
TIter next(gAlice->Modules());
AliModule *detector;
AliInfo(Form("%10s R:%.2fs C:%.2fs",
detector->GetName(),stw.RealTime(),stw.CpuTime()));
}
+
+ }
+
}
//_______________________________________________________________________
while((detector = dynamic_cast<AliModule*>(next()))) {
stw.Start();
// Initialise detector and display geometry
+ if (gAlice->IsRootGeometry()) detector->CreateMaterials();
detector->Init();
detector->BuildGeometry();
AliInfo(Form("%10s R:%.2fs C:%.2fs",
void AliMC::PostTrack()
{
// Posts tracks for each module
- TObjArray &dets = *gAlice->Modules();
- AliModule *module;
-
- for(Int_t i=0; i<=gAlice->GetNdets(); i++)
- if((module = dynamic_cast<AliModule*>(dets[i])))
- module->PostTrack();
+ TObjArray &dets = *gAlice->Modules();
+ AliModule *module;
+
+ for(Int_t i=0; i<=gAlice->GetNdets(); i++)
+ if((module = dynamic_cast<AliModule*>(dets[i])))
+ module->PostTrack();
}
//_______________________________________________________________________
#include <TSystem.h>
#include <TDirectory.h>
#include <TVirtualMC.h>
+#include <TGeoManager.h>
#include "AliLog.h"
#include "AliConfig.h"
// nwbuf number of user words
//
Int_t kmat;
- gMC->Material(kmat, name, a, z, dens, radl, absl, buf, nwbuf);
- (*fIdmate)[imat]=kmat;
+ TString uniquename = GetName();
+ uniquename.Append(name);
+ if(gAlice->IsRootGeometry()){
+ TGeoMaterial *mat = gGeoManager->GetMaterial(uniquename.Data());
+ kmat = mat->GetUniqueID();
+ (*fIdmate)[imat]=kmat;
+ }else{
+ gMC->Material(kmat, uniquename.Data(), a, z, dens, radl, absl, buf, nwbuf);
+ (*fIdmate)[imat]=kmat;
+ }
}
-
+
//_______________________________________________________________________
void AliModule::AliGetMaterial(Int_t imat, char* name, Float_t &a,
Float_t &z, Float_t &dens, Float_t &radl,
kmat=(*fIdmate)[imat];
gMC->Gfmate(kmat, name, a, z, dens, radl, absl, buf, nwbuf);
}
-
//_______________________________________________________________________
void AliModule::AliMixture(Int_t imat, const char *name, Float_t *a,
// wmat array of concentrations
//
Int_t kmat;
- gMC->Mixture(kmat, name, a, z, dens, nlmat, wmat);
- (*fIdmate)[imat]=kmat;
+ TString uniquename = GetName();
+ uniquename.Append(name);
+ if(gAlice->IsRootGeometry()){
+ TGeoMaterial *mat = gGeoManager->GetMaterial(uniquename.Data());
+ kmat = mat->GetUniqueID();
+ (*fIdmate)[imat]=kmat;
+ }else{
+ gMC->Mixture(kmat, uniquename.Data(), a, z, dens, nlmat, wmat);
+ (*fIdmate)[imat]=kmat;
+ }
}
-
+
//_______________________________________________________________________
void AliModule::AliMedium(Int_t numed, const char *name, Int_t nmat,
Int_t isvol, Int_t ifield, Float_t fieldm,
// = 3 constant magnetic field along z
//
Int_t kmed;
- gMC->Medium(kmed,name, (*fIdmate)[nmat], isvol, ifield, fieldm,
- tmaxfd, stemax, deemax, epsil, stmin, ubuf, nbuf);
- (*fIdtmed)[numed]=kmed;
+ TString uniquename = GetName();
+ uniquename.Append(name);
+ if(gAlice->IsRootGeometry()){
+ TList *medialist = gGeoManager->GetListOfMedia();
+ TIter next(medialist);
+ TGeoMedium *med = 0;
+ while((med = (TGeoMedium*) next())){
+ if(!strcmp(uniquename.Data(),med->GetName())){
+ kmed = med->GetId();
+ (*fIdtmed)[numed]=kmed;
+ break;
+ }
+ }
+ }else{
+ gMC->Medium(kmed, uniquename.Data(), (*fIdmate)[nmat], isvol, ifield,
+ fieldm, tmaxfd, stemax, deemax, epsil, stmin, ubuf, nbuf);
+ (*fIdtmed)[numed]=kmed;
+ }
}
-
+
//_______________________________________________________________________
void AliModule::AliMatrix(Int_t &nmat, Float_t theta1, Float_t phi1,
Float_t theta2, Float_t phi2, Float_t theta3,
#include <TRandom3.h>
#include <TSystem.h>
#include <TVirtualMC.h>
+#include <TGeoManager.h>
//
#include "AliLog.h"
#include "AliDetector.h"
fPDGDB(0), //Particle factory object
fConfigFunction("\0"),
fRandom(0),
+ fIsRootGeometry(kFALSE),
fRunLoader(0x0)
{
//
fPDGDB(0), //Particle factory object
fConfigFunction("\0"),
fRandom(0),
+ fIsRootGeometry(kFALSE),
fRunLoader(0x0)
{
//
fPDGDB(TDatabasePDG::Instance()), //Particle factory object!
fConfigFunction("Config();"),
fRandom(new TRandom3()),
- fRunLoader(0x0)
+ fIsRootGeometry(kFALSE),
+ fRunLoader(0x0)
{
//
// Constructor for the main processor.
fField->ReadField();
}
+//_______________________________________________________________________
+void AliRun::SetRootGeometry(Bool_t flag)
+{
+// Instruct application that the geometry is to be retreived from a root file.
+ fIsRootGeometry = flag;
+ if (flag) gMC->SetRootGeometry();
+}
+
//_______________________________________________________________________
void AliRun::SetField(Int_t type, Int_t version, Float_t scale,
Float_t maxField, const char* filename)
//Hits moved to begin event -> now we are crating separate tree for each event
gMC->ProcessRun(nevent);
+// cout<<"\n***** "<<gGeoManager->GetMaterial("TPCEpoxy")->GetA()<<" ****\n";
// End of this run, close files
if(nevent>0) FinishRun();
virtual void InitMC(const char *setup="Config.C");
virtual void Init(const char *setup="Config.C") {InitMC(setup);}
Bool_t IsFolder() const {return kTRUE;}
+ Bool_t IsRootGeometry() const {return fIsRootGeometry;}
+ void SetRootGeometry(Bool_t flag=kTRUE);
+ const char* GetGeometryFileName() const {return fGeometryFileName.Data();}
+ void SetGeometryFileName(const char *name) {fGeometryFileName = name;}
virtual AliLego* Lego() const {return fLego;}
virtual void ResetDigits();
TString fConfigFunction; // Configuration file to be executed
TRandom *fRandom; // Pointer to the random number generator
TString fBaseFileName; // Name of the base root file
+ Bool_t fIsRootGeometry; //! Flag telling if the geometry is loaded from file
+ TString fGeometryFileName; //! Name of the geometry file
AliRunLoader *fRunLoader; //!run getter - written as a separate object
private: