CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
sim::FieldBuilder Class Reference

#include <FieldBuilder.h>

Public Member Functions

void build (G4FieldManager *fM=0, G4PropagatorInField *fP=0)
 
void configureForVolume (const std::string &volName, edm::ParameterSet &volPSet, G4FieldManager *fM=0, G4PropagatorInField *fP=0)
 
 FieldBuilder (const MagneticField *, const edm::ParameterSet &)
 
G4LogicalVolume * fieldTopVolume ()
 
void setStepperAndChordFinder (G4FieldManager *fM, int val)
 

Private Member Functions

void configureFieldManager (G4FieldManager *fM)
 
void configurePropagatorInField (G4PropagatorInField *fP)
 

Private Attributes

double dChord
 
double dIntersection
 
double dIntersectionAndOneStep
 
double dOneStep
 
G4ChordFinder * fChordFinder
 
G4ChordFinder * fChordFinderMonopole
 
std::string fieldType
 
double fieldValue
 
std::string keywordField
 
double maxEpsilonStep
 
double maxLoopCount
 
double minEpsilonStep
 
double minStep
 
std::string stepper
 
std::auto_ptr< FieldtheField
 
G4Mag_UsualEqRhs * theFieldEquation
 
edm::ParameterSet thePSet
 
G4LogicalVolume * theTopVolume
 

Detailed Description

Definition at line 19 of file FieldBuilder.h.

Constructor & Destructor Documentation

FieldBuilder::FieldBuilder ( const MagneticField f,
const edm::ParameterSet p 
)

Definition at line 35 of file FieldBuilder.cc.

References theField, and theFieldEquation.

37  : theField( new Field(f,p.getParameter<double>("delta"))),
38  theFieldEquation(new G4Mag_UsualEqRhs(theField.get())),
40  fieldValue(0.), minStep(0.), dChord(0.), dOneStep(0.),
43  thePSet(p) {
44 
45  theField->fieldEquation(theFieldEquation);
46 }
T getParameter(std::string const &) const
G4ChordFinder * fChordFinder
Definition: FieldBuilder.h:50
G4ChordFinder * fChordFinderMonopole
Definition: FieldBuilder.h:50
G4LogicalVolume * theTopVolume
Definition: FieldBuilder.h:49
double dIntersectionAndOneStep
Definition: FieldBuilder.h:60
std::auto_ptr< Field > theField
Definition: FieldBuilder.h:47
G4Mag_UsualEqRhs * theFieldEquation
Definition: FieldBuilder.h:48
edm::ParameterSet thePSet
Definition: FieldBuilder.h:64

Member Function Documentation

void FieldBuilder::build ( G4FieldManager *  fM = 0,
G4PropagatorInField *  fP = 0 
)

Definition at line 49 of file FieldBuilder.cc.

References configureForVolume(), gather_cfg::cout, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), i, hitfit::return, sim::LocalFieldManager::SetVerbosity(), AlCaHLTBitMon_QueryRunRegistry::string, theField, thePSet, and theTopVolume.

Referenced by RunManager::initG4().

49  {
50 
51  edm::ParameterSet thePSetForGMFM =
52  thePSet.getParameter<edm::ParameterSet>("ConfGlobalMFM");
53 
54  std::string volName = thePSetForGMFM.getParameter< std::string >("Volume");
55 
56  edm::ParameterSet volPSet =
57  thePSetForGMFM.getParameter< edm::ParameterSet >( volName );
58 
59  configureForVolume( volName, volPSet, fM, fP );
60 
61  // configure( "MagneticFieldType", fM, fP ) ;
62 
63  if ( thePSet.getParameter<bool>("UseLocalMagFieldManager") ) {
64 
65  edm::ParameterSet defpset ;
66  edm::ParameterSet thePSetForLMFM =
67  thePSet.getUntrackedParameter<edm::ParameterSet>("ConfLocalMFM", defpset);
68  //
69  // Patology !!! LocalFM requested but configuration not given !
70  // In principal, need to throw an exception
71  //
72  if ( thePSetForLMFM == defpset ) {
73  std::cout << " Patology ! Local Mag.Field Manager requested but config not given !\n";
74  return ;
75  }
76 
77  std::vector<std::string> ListOfVolumes =
78  thePSetForLMFM.getParameter< std::vector<std::string> >("ListOfVolumes");
79 
80  // creating Local Mag.Field Manager
81  for (unsigned int i = 0; i < ListOfVolumes.size(); ++ i ) {
82  volPSet = thePSetForLMFM.getParameter< edm::ParameterSet >(ListOfVolumes[i]);
83  G4FieldManager* fAltM = new G4FieldManager() ;
84  configureForVolume( ListOfVolumes[i], volPSet, fAltM ) ;
85  //configureLocalFM( ListOfVolumes[i], fAltM ) ;
86  LocalFieldManager* fLM = new LocalFieldManager( theField.get(), fM, fAltM ) ;
87  fLM->SetVerbosity(thePSet.getUntrackedParameter<bool>("Verbosity",false));
88  theTopVolume->SetFieldManager( fLM, true ) ;
89  }
90  }
91  return ;
92 
93 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
void configureForVolume(const std::string &volName, edm::ParameterSet &volPSet, G4FieldManager *fM=0, G4PropagatorInField *fP=0)
Definition: FieldBuilder.cc:95
G4LogicalVolume * theTopVolume
Definition: FieldBuilder.h:49
std::auto_ptr< Field > theField
Definition: FieldBuilder.h:47
tuple cout
Definition: gather_cfg.py:121
edm::ParameterSet thePSet
Definition: FieldBuilder.h:64
void FieldBuilder::configureFieldManager ( G4FieldManager *  fM)
private

Definition at line 143 of file FieldBuilder.cc.

References dChord, dIntersection, dIntersectionAndOneStep, dOneStep, fChordFinderMonopole, minStep, sim::FieldStepper::select(), stepper, and theField.

Referenced by configureForVolume().

143  {
144 
145  if (fM!=0) {
146  fM->SetDetectorField(theField.get());
147  FieldStepper * theStepper = new FieldStepper(theField->fieldEquation());
148  theStepper->select(stepper);
149  G4ChordFinder * CF = new G4ChordFinder(theField.get(),minStep,theStepper);
150  CF->SetDeltaChord(dChord);
151  fM->SetChordFinder(CF);
152  fM->SetDeltaOneStep(dOneStep);
153  fM->SetDeltaIntersection(dIntersection);
154  if (dIntersectionAndOneStep != -1.)
155  fM->SetAccuraciesWithDeltaOneStep(dIntersectionAndOneStep);
156  }
157  if (fChordFinderMonopole == 0) {
158  G4MonopoleEquation* fMonopoleEquation = new G4MonopoleEquation(theField.get());
159  G4MagIntegratorStepper* theStepper = new G4ClassicalRK4(fMonopoleEquation,8);
160  fChordFinderMonopole = new G4ChordFinder(theField.get(),minStep,theStepper);
161  fChordFinderMonopole->SetDeltaChord(dChord);
162  }
163 }
G4ChordFinder * fChordFinderMonopole
Definition: FieldBuilder.h:50
double dIntersectionAndOneStep
Definition: FieldBuilder.h:60
std::auto_ptr< Field > theField
Definition: FieldBuilder.h:47
std::string stepper
Definition: FieldBuilder.h:55
void FieldBuilder::configureForVolume ( const std::string &  volName,
edm::ParameterSet volPSet,
G4FieldManager *  fM = 0,
G4PropagatorInField *  fP = 0 
)

Definition at line 95 of file FieldBuilder.cc.

References configureFieldManager(), configurePropagatorInField(), dChord, dIntersection, dIntersectionAndOneStep, dOneStep, fieldType, edm::ParameterSet::getParameter(), i, maxEpsilonStep, maxLoopCount, minEpsilonStep, minStep, stepper, AlCaHLTBitMon_QueryRunRegistry::string, and theTopVolume.

Referenced by build().

98  {
99 
100  G4LogicalVolumeStore* theStore = G4LogicalVolumeStore::GetInstance();
101  for (unsigned int i=0; i<(*theStore).size(); ++i ) {
102  std::string curVolName = ((*theStore)[i])->GetName();
103  if ( curVolName == volName ) {
104  theTopVolume = (*theStore)[i] ;
105  }
106  }
107 
108  fieldType = volPSet.getParameter<std::string>("Type") ;
109  stepper = volPSet.getParameter<std::string>("Stepper") ;
110  edm::ParameterSet stpPSet =
112  minStep = stpPSet.getParameter<double>("MinStep") ;
113  dChord = stpPSet.getParameter<double>("DeltaChord") ;
114  dOneStep = stpPSet.getParameter<double>("DeltaOneStep") ;
115  dIntersection = stpPSet.getParameter<double>("DeltaIntersection") ;
116  dIntersectionAndOneStep = stpPSet.getUntrackedParameter<double>("DeltaIntersectionAndOneStep",-1.);
117  maxLoopCount = stpPSet.getUntrackedParameter<double>("MaximumLoopCounts",1000);
118  minEpsilonStep = stpPSet.getUntrackedParameter<double>("MinimumEpsilonStep",0.00001);
119  maxEpsilonStep = stpPSet.getUntrackedParameter<double>("MaximumEpsilonStep",0.01);
120 
121  if (fM!=0) configureFieldManager(fM);
122  if (fP!=0) configurePropagatorInField(fP);
123 
124  return;
125 
126 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
std::string fieldType
Definition: FieldBuilder.h:53
G4LogicalVolume * theTopVolume
Definition: FieldBuilder.h:49
double dIntersectionAndOneStep
Definition: FieldBuilder.h:60
void configureFieldManager(G4FieldManager *fM)
std::string stepper
Definition: FieldBuilder.h:55
void configurePropagatorInField(G4PropagatorInField *fP)
void FieldBuilder::configurePropagatorInField ( G4PropagatorInField *  fP)
private

Definition at line 165 of file FieldBuilder.cc.

References maxEpsilonStep, maxLoopCount, and minEpsilonStep.

Referenced by configureForVolume().

165  {
166  if (fP==0) return;
167  fP->SetMaxLoopCount(int(maxLoopCount));
168  fP->SetMinimumEpsilonStep(minEpsilonStep);
169  fP->SetMaximumEpsilonStep(maxEpsilonStep);
170  fP->SetVerboseLevel(0);
171  return;
172 }
G4LogicalVolume * FieldBuilder::fieldTopVolume ( )

Definition at line 128 of file FieldBuilder.cc.

References theTopVolume.

128 { return theTopVolume; }
G4LogicalVolume * theTopVolume
Definition: FieldBuilder.h:49
void FieldBuilder::setStepperAndChordFinder ( G4FieldManager *  fM,
int  val 
)

Definition at line 130 of file FieldBuilder.cc.

References fChordFinder, and fChordFinderMonopole.

130  {
131 
132  if (fM != 0) {
133  if (val == 0) {
134  if (fChordFinder != 0) fM->SetChordFinder(fChordFinder);
135  } else {
136  fChordFinder = fM->GetChordFinder();
137  if (fChordFinderMonopole != 0) fM->SetChordFinder(fChordFinderMonopole);
138  }
139  }
140 }
G4ChordFinder * fChordFinder
Definition: FieldBuilder.h:50
G4ChordFinder * fChordFinderMonopole
Definition: FieldBuilder.h:50

Member Data Documentation

double sim::FieldBuilder::dChord
private

Definition at line 57 of file FieldBuilder.h.

Referenced by configureFieldManager(), and configureForVolume().

double sim::FieldBuilder::dIntersection
private

Definition at line 59 of file FieldBuilder.h.

Referenced by configureFieldManager(), and configureForVolume().

double sim::FieldBuilder::dIntersectionAndOneStep
private

Definition at line 60 of file FieldBuilder.h.

Referenced by configureFieldManager(), and configureForVolume().

double sim::FieldBuilder::dOneStep
private

Definition at line 58 of file FieldBuilder.h.

Referenced by configureFieldManager(), and configureForVolume().

G4ChordFinder* sim::FieldBuilder::fChordFinder
private

Definition at line 50 of file FieldBuilder.h.

Referenced by setStepperAndChordFinder().

G4ChordFinder * sim::FieldBuilder::fChordFinderMonopole
private

Definition at line 50 of file FieldBuilder.h.

Referenced by configureFieldManager(), and setStepperAndChordFinder().

std::string sim::FieldBuilder::fieldType
private

Definition at line 53 of file FieldBuilder.h.

Referenced by configureForVolume().

double sim::FieldBuilder::fieldValue
private

Definition at line 54 of file FieldBuilder.h.

std::string sim::FieldBuilder::keywordField
private

Definition at line 52 of file FieldBuilder.h.

double sim::FieldBuilder::maxEpsilonStep
private

Definition at line 63 of file FieldBuilder.h.

Referenced by configureForVolume(), and configurePropagatorInField().

double sim::FieldBuilder::maxLoopCount
private

Definition at line 61 of file FieldBuilder.h.

Referenced by configureForVolume(), and configurePropagatorInField().

double sim::FieldBuilder::minEpsilonStep
private

Definition at line 62 of file FieldBuilder.h.

Referenced by configureForVolume(), and configurePropagatorInField().

double sim::FieldBuilder::minStep
private

Definition at line 56 of file FieldBuilder.h.

Referenced by configureFieldManager(), and configureForVolume().

std::string sim::FieldBuilder::stepper
private

Definition at line 55 of file FieldBuilder.h.

Referenced by configureFieldManager(), and configureForVolume().

std::auto_ptr<Field> sim::FieldBuilder::theField
private

Definition at line 47 of file FieldBuilder.h.

Referenced by build(), configureFieldManager(), and FieldBuilder().

G4Mag_UsualEqRhs* sim::FieldBuilder::theFieldEquation
private

Definition at line 48 of file FieldBuilder.h.

Referenced by FieldBuilder().

edm::ParameterSet sim::FieldBuilder::thePSet
private

Definition at line 64 of file FieldBuilder.h.

Referenced by build().

G4LogicalVolume* sim::FieldBuilder::theTopVolume
private

Definition at line 49 of file FieldBuilder.h.

Referenced by build(), configureForVolume(), and fieldTopVolume().