FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairFastSimDetector.cxx
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 #include "FairFastSimDetector.h"
9 
10 #include "FairGeoBuilder.h"
11 #include "FairGeoInterface.h" // for FairGeoInterface
12 #include "FairGeoLoader.h" // for FairGeoLoader
13 #include "FairGeoMedia.h"
14 #include "FairGeoMedium.h" // for FairGeoMedium
15 
16 // #include <TGeoMedium.h>
17 #include <TGeoManager.h> // gGeoManager
18 
20  : FairDetector("FastSimulation", kTRUE)
21  , fFastSimMedium(nullptr)
22 {}
23 
24 FairFastSimDetector::FairFastSimDetector(const char* name, Int_t DetId)
25  : FairDetector(name, kTRUE, DetId)
26  , fFastSimMedium(nullptr)
27 {}
28 
30  : FairDetector(right)
31  , fFastSimMedium(right.fFastSimMedium)
32 {}
33 
35 
37 {
39  FairGeoInterface* geoFace = geoLoad->getGeoInterface();
40  FairGeoMedia* geoMedia = geoFace->getMedia();
41  FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder();
42 
43  TGeoMedium* medium = gGeoManager->GetMedium("FastSimMedium");
44  if (!medium) {
45  FairGeoMedium* fairMedium = geoMedia->getMedium("FastSimMedium");
46  if (!fairMedium) {
47  fairMedium = new FairGeoMedium("FastSimMedium");
48  fairMedium->setMediumIndex(geoMedia->getListOfMedia()->GetEntries());
49  fairMedium->setNComponents(1);
50  fairMedium->setComponent(0, 1, 1, 1.);
51  fairMedium->setDensity(1e-16);
52  fairMedium->setMediumPar(1, 1, 20., 0.001);
53  geoMedia->addMedium(fairMedium);
54  }
55  geoBuild->createMedium(fairMedium);
56  fFastSimMedium = gGeoManager->GetMedium("FastSimMedium");
57  } else {
58  fFastSimMedium = medium;
59  }
60 }
61 
63 {
65 
66  return kTRUE;
67 }
68 
void setDensity(Double_t d)
Definition: FairGeoMedium.h:57
TList * getListOfMedia()
Definition: FairGeoMedia.h:37
FairGeoMedia * getMedia()
void addMedium(FairGeoMedium *m)
void setNComponents(Int_t)
Bool_t setComponent(Int_t, Double_t, Double_t, Double_t w=1.)
FairGeoMedium * getMedium(const char *)
FairGeoInterface * getGeoInterface()
Definition: FairGeoLoader.h:34
static FairGeoLoader * Instance()
virtual Bool_t ProcessHits(FairVolume *vol=0) final
ClassImp(FairEventBuilder)
virtual void FastSimProcessParticle()=0
void setMediumIndex(Int_t i)
Definition: FairGeoMedium.h:48
virtual void ConstructGeometry()
FairGeoBuilder * getGeoBuilder()
Definition: FairGeoLoader.h:35
void setMediumPar(Int_t, Int_t, Double_t, Double_t, Double_t maxDeviation=-1., Double_t maxStep=-1., Double_t maxDE=-1., Double_t minStepDouble_t=-1.)
virtual Int_t createMedium(FairGeoMedium *)=0