/scratch0/jsnuveri/BDSIM/BDSIMgit/bdsim/src/BDSBeamlineElement.cc

00001 #include "BDSBeamlineElement.hh"
00002 
00003 #include "BDSAcceleratorComponent.hh"
00004 #include "BDSDebug.hh"
00005 #include "BDSGeometryComponent.hh"
00006 
00007 #include "globals.hh" // geant4 globals / types
00008 #include "G4RotationMatrix.hh"
00009 #include "G4ThreeVector.hh"
00010 
00011 #include <ostream>
00012 
00013 BDSBeamlineElement::BDSBeamlineElement(BDSAcceleratorComponent* componentIn,
00014                                        G4ThreeVector            positionStartIn,
00015                                        G4ThreeVector            positionMiddleIn,
00016                                        G4ThreeVector            positionEndIn,
00017                                        G4RotationMatrix*        rotationStartIn,
00018                                        G4RotationMatrix*        rotationMiddleIn,
00019                                        G4RotationMatrix*        rotationEndIn,
00020                                        G4ThreeVector            referencePositionStartIn,
00021                                        G4ThreeVector            referencePositionMiddleIn,
00022                                        G4ThreeVector            referencePositionEndIn,
00023                                        G4RotationMatrix*        referenceRotationStartIn,
00024                                        G4RotationMatrix*        referenceRotationMiddleIn,
00025                                        G4RotationMatrix*        referenceRotationEndIn,
00026                                        G4double                 sPositionStartIn,
00027                                        G4double                 sPositionMiddleIn,
00028                                        G4double                 sPositionEndIn,
00029                                        G4ThreeVector            xAxisReferenceStartIn,
00030                                        G4ThreeVector            yAxisReferenceStartIn,
00031                                        G4ThreeVector            zAxisReferenceStartIn,
00032                                        G4ThreeVector            xAxisReferenceMiddleIn,
00033                                        G4ThreeVector            yAxisReferenceMiddleIn,
00034                                        G4ThreeVector            zAxisReferenceMiddleIn,
00035                                        G4ThreeVector            xAxisReferenceEndIn,
00036                                        G4ThreeVector            yAxisReferenceEndIn,
00037                                        G4ThreeVector            zAxisReferenceEndIn):
00038   BDSGeometryComponent(*((BDSGeometryComponent*)componentIn)),
00039   component(componentIn),
00040   positionStart(positionStartIn), positionMiddle(positionMiddleIn), positionEnd(positionEndIn),
00041   rotationStart(rotationStartIn), rotationMiddle(rotationMiddleIn), rotationEnd(rotationEndIn),
00042   referencePositionStart(referencePositionStartIn),
00043   referencePositionMiddle(referencePositionMiddleIn),
00044   referencePositionEnd(referencePositionEndIn),
00045   referenceRotationStart(referenceRotationStartIn),
00046   referenceRotationMiddle(referenceRotationMiddleIn),
00047   referenceRotationEnd(referenceRotationEndIn),
00048   sPositionStart(sPositionStartIn), sPositionMiddle(sPositionMiddleIn), sPositionEnd(sPositionEndIn),
00049   xAxisReferenceStart(xAxisReferenceStartIn),
00050   yAxisReferenceStart(yAxisReferenceStartIn),
00051   zAxisReferenceStart(zAxisReferenceStartIn),
00052   xAxisReferenceMiddle(xAxisReferenceMiddleIn),
00053   yAxisReferenceMiddle(yAxisReferenceMiddleIn),
00054   zAxisReferenceMiddle(zAxisReferenceMiddleIn),
00055   xAxisReferenceEnd(xAxisReferenceEndIn),
00056   yAxisReferenceEnd(yAxisReferenceEndIn),
00057   zAxisReferenceEnd(zAxisReferenceEndIn)
00058 {
00059 #ifdef BDSDEBUG
00060   G4cout << __METHOD_NAME__;
00061   if (componentIn)
00062     {G4cout << componentIn->GetName();}
00063   else
00064     {G4cerr << "WARNING - supplied component is in valid!" << G4endl;}
00065   G4cout << G4endl;
00066 #endif
00067 }
00068 
00069 BDSBeamlineElement::~BDSBeamlineElement()
00070 {
00071   delete component;
00072   delete rotationStart;
00073   delete rotationMiddle;
00074   delete rotationEnd;
00075   delete referenceRotationStart;
00076   delete referenceRotationMiddle;
00077   delete referenceRotationEnd;  
00078 }
00079 
00080 std::ostream& operator<< (std::ostream& out, BDSBeamlineElement const &e)
00081 {
00082   out << "Beamline element: " << e.component->GetName() << G4endl;
00083   out << "Start, middle & end position: "
00084       << e.GetPositionStart()  << " " << e.GetPositionMiddle()  << " " << e.GetPositionEnd()  << G4endl
00085       << "Start, middle & end rotation: "
00086       << *(e.GetRotationStart())  << " " << *(e.GetRotationMiddle())  << " " << *(e.GetRotationEnd())  << G4endl
00087       << "Start, middle & end s position: "
00088       << e.GetSPositionStart() << " " << e.GetSPositionMiddle() << " " << e.GetSPositionEnd() << G4endl
00089       << "X axis at the start, middle & end: "
00090       << e.GetXAxisReferenceStart() << " " << e.GetXAxisReferenceMiddle() << " " << e.GetXAxisReferenceEnd() << G4endl
00091       << "Y axis at the start, middle & end: "
00092       << e.GetYAxisReferenceStart() << " " << e.GetYAxisReferenceMiddle() << " " << e.GetYAxisReferenceEnd() << G4endl
00093       << "Z axis at the start, middle & end: "
00094       << e.GetZAxisReferenceStart() << " " << e.GetZAxisReferenceMiddle() << " " << e.GetZAxisReferenceEnd() << G4endl;
00095 
00096   return out;
00097 }

Generated on 28 Jun 2015 for BDSIM by  doxygen 1.4.7