#include <SimG4Core/MagneticField/interface/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 () |
Private Member Functions | |
void | configureFieldManager (G4FieldManager *fM) |
void | configurePropagatorInField (G4PropagatorInField *fP) |
Private Attributes | |
double | dChord |
double | dIntersection |
double | dIntersectionAndOneStep |
double | dOneStep |
std::string | fieldType |
double | fieldValue |
std::string | keywordField |
double | maxEpsilonStep |
double | maxLoopCount |
double | minEpsilonStep |
double | minStep |
std::string | stepper |
std::auto_ptr< Field > | theField |
G4Mag_UsualEqRhs * | theFieldEquation |
edm::ParameterSet | thePSet |
G4LogicalVolume * | theTopVolume |
Definition at line 18 of file FieldBuilder.h.
FieldBuilder::FieldBuilder | ( | const MagneticField * | f, | |
const edm::ParameterSet & | p | |||
) |
Definition at line 33 of file FieldBuilder.cc.
References theField, and theFieldEquation.
00035 : theField( new Field(f,p.getParameter<double>("delta"))), 00036 theFieldEquation(new G4Mag_UsualEqRhs(theField.get())), 00037 theTopVolume(0), 00038 fieldValue(0.), minStep(0.), dChord(0.), dOneStep(0.), 00039 dIntersection(0.), dIntersectionAndOneStep(0.), 00040 maxLoopCount(0), minEpsilonStep(0.), maxEpsilonStep(0.), 00041 thePSet(p) 00042 { 00043 theField->fieldEquation(theFieldEquation); 00044 }
void FieldBuilder::build | ( | G4FieldManager * | fM = 0 , |
|
G4PropagatorInField * | fP = 0 | |||
) |
Definition at line 73 of file FieldBuilder.cc.
References configureForVolume(), GenMuonPlsPt100GeV_cfg::cout, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), i, sim::LocalFieldManager::SetVerbosity(), theField, thePSet, and theTopVolume.
00074 { 00075 00076 edm::ParameterSet thePSetForGMFM = 00077 thePSet.getParameter<edm::ParameterSet>("ConfGlobalMFM"); 00078 00079 std::string volName = thePSetForGMFM.getParameter< std::string >("Volume"); 00080 00081 edm::ParameterSet volPSet = 00082 thePSetForGMFM.getParameter< edm::ParameterSet >( volName ); 00083 00084 configureForVolume( volName, volPSet, fM, fP ); 00085 00086 // configure( "MagneticFieldType", fM, fP ) ; 00087 00088 if ( thePSet.getParameter<bool>("UseLocalMagFieldManager") ) 00089 { 00090 00091 edm::ParameterSet defpset ; 00092 edm::ParameterSet thePSetForLMFM = 00093 thePSet.getUntrackedParameter<edm::ParameterSet>("ConfLocalMFM", defpset); 00094 // 00095 // Patology !!! LocalFM requested but configuration not given ! 00096 // In principal, need to throw an exception 00097 // 00098 if ( thePSetForLMFM == defpset ) 00099 { 00100 std::cout << " Patology ! Local Mag.Field Manager requested but config not given !\n"; 00101 return ; 00102 } 00103 00104 std::vector<std::string> ListOfVolumes = 00105 thePSetForLMFM.getParameter< std::vector<std::string> >("ListOfVolumes"); 00106 00107 // creating Local Mag.Field Manager 00108 for (unsigned int i = 0; i < ListOfVolumes.size(); ++ i ) 00109 { 00110 volPSet = thePSetForLMFM.getParameter< edm::ParameterSet >(ListOfVolumes[i]); 00111 G4FieldManager* fAltM = new G4FieldManager() ; 00112 configureForVolume( ListOfVolumes[i], volPSet, fAltM ) ; 00113 //configureLocalFM( ListOfVolumes[i], fAltM ) ; 00114 LocalFieldManager* fLM = new LocalFieldManager( theField.get(), fM, fAltM ) ; 00115 fLM->SetVerbosity(thePSet.getUntrackedParameter<bool>("Verbosity",false)); 00116 theTopVolume->SetFieldManager( fLM, true ) ; 00117 } 00118 } 00119 return ; 00120 00121 }
void FieldBuilder::configureFieldManager | ( | G4FieldManager * | fM | ) | [private] |
Definition at line 176 of file FieldBuilder.cc.
References dChord, dIntersection, dIntersectionAndOneStep, dOneStep, minStep, sim::FieldStepper::select(), stepper, and theField.
Referenced by configureForVolume().
00177 { 00178 if (fM==0) return; 00179 fM->SetDetectorField(theField.get()); 00180 FieldStepper * theStepper = new FieldStepper(theField->fieldEquation()); 00181 theStepper->select(stepper); 00182 G4ChordFinder * CF = new G4ChordFinder(theField.get(),minStep,theStepper); 00183 CF->SetDeltaChord(dChord); 00184 fM->SetChordFinder(CF); 00185 fM->SetDeltaOneStep(dOneStep); 00186 fM->SetDeltaIntersection(dIntersection); 00187 if (dIntersectionAndOneStep != -1.) 00188 fM->SetAccuraciesWithDeltaOneStep(dIntersectionAndOneStep); 00189 return; 00190 }
void FieldBuilder::configureForVolume | ( | const std::string & | volName, | |
edm::ParameterSet & | volPSet, | |||
G4FieldManager * | fM = 0 , |
|||
G4PropagatorInField * | fP = 0 | |||
) |
Definition at line 140 of file FieldBuilder.cc.
References configureFieldManager(), configurePropagatorInField(), dChord, dIntersection, dIntersectionAndOneStep, dOneStep, fieldType, edm::ParameterSet::getParameter(), i, maxEpsilonStep, maxLoopCount, minEpsilonStep, minStep, stepper, and theTopVolume.
Referenced by build().
00144 { 00145 00146 G4LogicalVolumeStore* theStore = G4LogicalVolumeStore::GetInstance(); 00147 for (unsigned int i=0; i<(*theStore).size(); ++i ) 00148 { 00149 std::string curVolName = ((*theStore)[i])->GetName(); 00150 if ( curVolName == volName ) 00151 { 00152 theTopVolume = (*theStore)[i] ; 00153 } 00154 } 00155 00156 fieldType = volPSet.getParameter<std::string>("Type") ; 00157 stepper = volPSet.getParameter<std::string>("Stepper") ; 00158 edm::ParameterSet stpPSet = 00159 volPSet.getParameter<edm::ParameterSet>(stepper) ; 00160 minStep = stpPSet.getParameter<double>("MinStep") ; 00161 dChord = stpPSet.getParameter<double>("DeltaChord") ; 00162 dOneStep = stpPSet.getParameter<double>("DeltaOneStep") ; 00163 dIntersection = stpPSet.getParameter<double>("DeltaIntersection") ; 00164 dIntersectionAndOneStep = stpPSet.getUntrackedParameter<double>("DeltaIntersectionAndOneStep",-1.); 00165 maxLoopCount = stpPSet.getUntrackedParameter<double>("MaximumLoopCounts",1000); 00166 minEpsilonStep = stpPSet.getUntrackedParameter<double>("MinimumEpsilonStep",0.00001); 00167 maxEpsilonStep = stpPSet.getUntrackedParameter<double>("MaximumEpsilonStep",0.01); 00168 00169 if (fM!=0) configureFieldManager(fM); 00170 if (fP!=0) configurePropagatorInField(fP); 00171 00172 return; 00173 00174 }
void FieldBuilder::configurePropagatorInField | ( | G4PropagatorInField * | fP | ) | [private] |
Definition at line 192 of file FieldBuilder.cc.
References maxEpsilonStep, maxLoopCount, and minEpsilonStep.
Referenced by configureForVolume().
00193 { 00194 if (fP==0) return; 00195 fP->SetMaxLoopCount(int(maxLoopCount)); 00196 fP->SetMinimumEpsilonStep(minEpsilonStep); 00197 fP->SetMaximumEpsilonStep(maxEpsilonStep); 00198 fP->SetVerboseLevel(0); 00199 return; 00200 }
G4LogicalVolume * FieldBuilder::fieldTopVolume | ( | ) |
Definition at line 202 of file FieldBuilder.cc.
References theTopVolume.
00202 { return theTopVolume; }
double sim::FieldBuilder::dChord [private] |
Definition at line 55 of file FieldBuilder.h.
Referenced by configureFieldManager(), and configureForVolume().
double sim::FieldBuilder::dIntersection [private] |
Definition at line 57 of file FieldBuilder.h.
Referenced by configureFieldManager(), and configureForVolume().
double sim::FieldBuilder::dIntersectionAndOneStep [private] |
Definition at line 58 of file FieldBuilder.h.
Referenced by configureFieldManager(), and configureForVolume().
double sim::FieldBuilder::dOneStep [private] |
Definition at line 56 of file FieldBuilder.h.
Referenced by configureFieldManager(), and configureForVolume().
std::string sim::FieldBuilder::fieldType [private] |
double sim::FieldBuilder::fieldValue [private] |
Definition at line 52 of file FieldBuilder.h.
std::string sim::FieldBuilder::keywordField [private] |
Definition at line 50 of file FieldBuilder.h.
double sim::FieldBuilder::maxEpsilonStep [private] |
Definition at line 61 of file FieldBuilder.h.
Referenced by configureForVolume(), and configurePropagatorInField().
double sim::FieldBuilder::maxLoopCount [private] |
Definition at line 59 of file FieldBuilder.h.
Referenced by configureForVolume(), and configurePropagatorInField().
double sim::FieldBuilder::minEpsilonStep [private] |
Definition at line 60 of file FieldBuilder.h.
Referenced by configureForVolume(), and configurePropagatorInField().
double sim::FieldBuilder::minStep [private] |
Definition at line 54 of file FieldBuilder.h.
Referenced by configureFieldManager(), and configureForVolume().
std::string sim::FieldBuilder::stepper [private] |
Definition at line 53 of file FieldBuilder.h.
Referenced by configureFieldManager(), and configureForVolume().
std::auto_ptr<Field> sim::FieldBuilder::theField [private] |
Definition at line 46 of file FieldBuilder.h.
Referenced by build(), configureFieldManager(), and FieldBuilder().
G4Mag_UsualEqRhs* sim::FieldBuilder::theFieldEquation [private] |
edm::ParameterSet sim::FieldBuilder::thePSet [private] |
G4LogicalVolume* sim::FieldBuilder::theTopVolume [private] |
Definition at line 48 of file FieldBuilder.h.
Referenced by build(), configureForVolume(), and fieldTopVolume().