CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

sim::FieldBuilder Class Reference

#include <FieldBuilder.h>

List of all members.

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.

   : theField( new Field(f,p.getParameter<double>("delta"))), 
     theFieldEquation(new G4Mag_UsualEqRhs(theField.get())),
     theTopVolume(0), fChordFinder(0), fChordFinderMonopole(0),
     fieldValue(0.), minStep(0.), dChord(0.), dOneStep(0.),
     dIntersection(0.), dIntersectionAndOneStep(0.), 
     maxLoopCount(0), minEpsilonStep(0.), maxEpsilonStep(0.), 
     thePSet(p) {

  theField->fieldEquation(theFieldEquation);
}

Member Function Documentation

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

Referenced by RunManager::initG4().

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().

                                                            {

  if (fM!=0) {
    fM->SetDetectorField(theField.get());
    FieldStepper * theStepper = new FieldStepper(theField->fieldEquation());
    theStepper->select(stepper);
    G4ChordFinder * CF = new G4ChordFinder(theField.get(),minStep,theStepper);
    CF->SetDeltaChord(dChord);
    fM->SetChordFinder(CF);
    fM->SetDeltaOneStep(dOneStep);
    fM->SetDeltaIntersection(dIntersection);
    if (dIntersectionAndOneStep != -1.) 
      fM->SetAccuraciesWithDeltaOneStep(dIntersectionAndOneStep);
  }
  if (fChordFinderMonopole == 0) {
    G4MonopoleEquation* fMonopoleEquation = new G4MonopoleEquation(theField.get());
    G4MagIntegratorStepper* theStepper = new G4ClassicalRK4(fMonopoleEquation);
    fChordFinderMonopole = new G4ChordFinder(theField.get(),minStep,theStepper);
    fChordFinderMonopole->SetDeltaChord(dChord);
  }
}
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, and theTopVolume.

                                                                  {

  G4LogicalVolumeStore* theStore = G4LogicalVolumeStore::GetInstance();
  for (unsigned int i=0; i<(*theStore).size(); ++i ) {
    std::string curVolName = ((*theStore)[i])->GetName();
    if ( curVolName == volName ) {
      theTopVolume = (*theStore)[i] ;
    }
  }

  fieldType     = volPSet.getParameter<std::string>("Type") ;
  stepper       = volPSet.getParameter<std::string>("Stepper") ;
  edm::ParameterSet stpPSet = 
    volPSet.getParameter<edm::ParameterSet>(stepper) ;
  minStep       = stpPSet.getParameter<double>("MinStep") ;
  dChord        = stpPSet.getParameter<double>("DeltaChord") ;
  dOneStep      = stpPSet.getParameter<double>("DeltaOneStep") ;
  dIntersection = stpPSet.getParameter<double>("DeltaIntersection") ;
  dIntersectionAndOneStep = stpPSet.getUntrackedParameter<double>("DeltaIntersectionAndOneStep",-1.);
  maxLoopCount = stpPSet.getUntrackedParameter<double>("MaximumLoopCounts",1000);
  minEpsilonStep = stpPSet.getUntrackedParameter<double>("MinimumEpsilonStep",0.00001);
  maxEpsilonStep = stpPSet.getUntrackedParameter<double>("MaximumEpsilonStep",0.01);
   
  if (fM!=0) configureFieldManager(fM);
  if (fP!=0) configurePropagatorInField(fP);    

  return;

}
void FieldBuilder::configurePropagatorInField ( G4PropagatorInField *  fP) [private]

Definition at line 165 of file FieldBuilder.cc.

References maxEpsilonStep, maxLoopCount, and minEpsilonStep.

Referenced by configureForVolume().

                                                                      {
  if (fP==0) return;
  fP->SetMaxLoopCount(int(maxLoopCount));
  fP->SetMinimumEpsilonStep(minEpsilonStep);
  fP->SetMaximumEpsilonStep(maxEpsilonStep);
  fP->SetVerboseLevel(0);
  return;
}
G4LogicalVolume * FieldBuilder::fieldTopVolume ( )

Definition at line 128 of file FieldBuilder.cc.

References theTopVolume.

{ return theTopVolume; }
void FieldBuilder::setStepperAndChordFinder ( G4FieldManager *  fM,
int  val 
)

Definition at line 130 of file FieldBuilder.cc.

References fChordFinder, and fChordFinderMonopole.

                                                                        {

  if (fM != 0) {
    if (val == 0) {
      if (fChordFinder != 0) fM->SetChordFinder(fChordFinder);
    } else {
      fChordFinder = fM->GetChordFinder();
      if (fChordFinderMonopole != 0) fM->SetChordFinder(fChordFinderMonopole);
    }
  }
}

Member Data Documentation

double sim::FieldBuilder::dChord [private]

Definition at line 57 of file FieldBuilder.h.

Referenced by configureFieldManager(), and configureForVolume().

Definition at line 59 of file FieldBuilder.h.

Referenced by configureFieldManager(), and configureForVolume().

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().

Definition at line 54 of file FieldBuilder.h.

std::string sim::FieldBuilder::keywordField [private]

Definition at line 52 of file FieldBuilder.h.

Definition at line 63 of file FieldBuilder.h.

Referenced by configureForVolume(), and configurePropagatorInField().

Definition at line 61 of file FieldBuilder.h.

Referenced by configureForVolume(), and configurePropagatorInField().

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 configureFieldManager(), and FieldBuilder().

G4Mag_UsualEqRhs* sim::FieldBuilder::theFieldEquation [private]

Definition at line 48 of file FieldBuilder.h.

Referenced by FieldBuilder().

Definition at line 64 of file FieldBuilder.h.

G4LogicalVolume* sim::FieldBuilder::theTopVolume [private]

Definition at line 49 of file FieldBuilder.h.

Referenced by configureForVolume(), and fieldTopVolume().