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 33 of file FieldBuilder.cc.

References theField, and theFieldEquation.

35  : theField( new Field(f,p.getParameter<double>("delta"))),
36  theFieldEquation(new G4Mag_UsualEqRhs(theField.get())),
38  fieldValue(0.), minStep(0.), dChord(0.), dOneStep(0.),
41  thePSet(p) {
42 
43  theField->fieldEquation(theFieldEquation);
44 }
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 47 of file FieldBuilder.cc.

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

Referenced by RunManager::initG4().

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

Definition at line 141 of file FieldBuilder.cc.

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

Referenced by configureForVolume().

141  {
142 
143  if (fM!=0) {
144  fM->SetDetectorField(theField.get());
145  FieldStepper * theStepper = new FieldStepper(theField->fieldEquation());
146  theStepper->select(stepper);
147  G4ChordFinder * CF = new G4ChordFinder(theField.get(),minStep,theStepper);
148  CF->SetDeltaChord(dChord);
149  fM->SetChordFinder(CF);
150  fM->SetDeltaOneStep(dOneStep);
151  fM->SetDeltaIntersection(dIntersection);
152  if (dIntersectionAndOneStep != -1.)
153  fM->SetAccuraciesWithDeltaOneStep(dIntersectionAndOneStep);
154  }
155  if (fChordFinderMonopole == 0) {
156  G4MonopoleEquation* fMonopoleEquation = new G4MonopoleEquation(theField.get());
157  G4MagIntegratorStepper* theStepper = new G4ClassicalRK4(fMonopoleEquation,8);
158  fChordFinderMonopole = new G4ChordFinder(theField.get(),minStep,theStepper);
159  fChordFinderMonopole->SetDeltaChord(dChord);
160  }
161 }
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 93 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().

96  {
97 
98  G4LogicalVolumeStore* theStore = G4LogicalVolumeStore::GetInstance();
99  for (unsigned int i=0; i<(*theStore).size(); ++i ) {
100  std::string curVolName = ((*theStore)[i])->GetName();
101  if ( curVolName == volName ) {
102  theTopVolume = (*theStore)[i] ;
103  }
104  }
105 
106  fieldType = volPSet.getParameter<std::string>("Type") ;
107  stepper = volPSet.getParameter<std::string>("Stepper") ;
108  edm::ParameterSet stpPSet =
110  minStep = stpPSet.getParameter<double>("MinStep") ;
111  dChord = stpPSet.getParameter<double>("DeltaChord") ;
112  dOneStep = stpPSet.getParameter<double>("DeltaOneStep") ;
113  dIntersection = stpPSet.getParameter<double>("DeltaIntersection") ;
114  dIntersectionAndOneStep = stpPSet.getUntrackedParameter<double>("DeltaIntersectionAndOneStep",-1.);
115  maxLoopCount = stpPSet.getUntrackedParameter<double>("MaximumLoopCounts",1000);
116  minEpsilonStep = stpPSet.getUntrackedParameter<double>("MinimumEpsilonStep",0.00001);
117  maxEpsilonStep = stpPSet.getUntrackedParameter<double>("MaximumEpsilonStep",0.01);
118 
119  if (fM!=0) configureFieldManager(fM);
120  if (fP!=0) configurePropagatorInField(fP);
121 
122  return;
123 
124 }
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 163 of file FieldBuilder.cc.

References maxEpsilonStep, maxLoopCount, and minEpsilonStep.

Referenced by configureForVolume().

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

Definition at line 126 of file FieldBuilder.cc.

References theTopVolume.

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

Definition at line 128 of file FieldBuilder.cc.

References fChordFinder, and fChordFinderMonopole.

128  {
129 
130  if (fM != 0) {
131  if (val == 0) {
132  if (fChordFinder != 0) fM->SetChordFinder(fChordFinder);
133  } else {
134  fChordFinder = fM->GetChordFinder();
135  if (fChordFinderMonopole != 0) fM->SetChordFinder(fChordFinderMonopole);
136  }
137  }
138 }
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().