G4VTrajectory.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id: G4VTrajectory.cc 67009 2013-01-29 16:00:21Z gcosmo $
00028 //
00029 // ---------------------------------------------------------------
00030 //
00031 // G4VTrajectory.cc
00032 //
00033 // Contact:
00034 //   Questions and comments to this code should be sent to
00035 //     Katsuya Amako  (e-mail: Katsuya.Amako@kek.jp)
00036 //     Makoto  Asai   (e-mail: asai@kekvax.kek.jp)
00037 //     Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
00038 //
00039 // ---------------------------------------------------------------
00040 
00041 #include "G4VTrajectory.hh"
00042 #include "G4VTrajectoryPoint.hh"
00043 #include "G4AttDefStore.hh"
00044 #include "G4AttDef.hh"
00045 #include "G4AttValue.hh"
00046 #include "G4AttCheck.hh"
00047 #include "G4VVisManager.hh"
00048 #include "G4VisAttributes.hh"
00049 #include "G4Polyline.hh"
00050 #include "G4Polymarker.hh"
00051 #include "G4Colour.hh"
00052 
00053 G4VTrajectory::G4VTrajectory() {;}
00054 G4VTrajectory::~G4VTrajectory() {;}
00055 
00056 G4bool G4VTrajectory::operator == (const G4VTrajectory& right) const
00057 {
00058   return (this==&right);
00059 }
00060 
00061 void G4VTrajectory::ShowTrajectory(std::ostream& os) const
00062 {
00063   // Makes use of attribute values implemented in the concrete class.
00064   // Note: the user needs to follow with new-line or end-of-string,
00065   // depending on the nature of os.
00066 
00067   std::vector<G4AttValue>* attValues = CreateAttValues();
00068   const std::map<G4String,G4AttDef>* attDefs = GetAttDefs();
00069 
00070   // Ensure validity...
00071   if (G4AttCheck(attValues,attDefs).Check("G4VTrajectory::ShowTrajectory")) {
00072     return;
00073   }
00074 
00075   os << "Trajectory:";
00076 
00077   std::vector<G4AttValue>::iterator iAttVal;
00078   for (iAttVal = attValues->begin();
00079        iAttVal != attValues->end(); ++iAttVal) {
00080     std::map<G4String,G4AttDef>::const_iterator iAttDef =
00081       attDefs->find(iAttVal->GetName());
00082     os << "\n  " << iAttDef->second.GetDesc()
00083        << " (" << iAttVal->GetName()
00084        << "): " << iAttVal->GetValue();
00085   }
00086 
00087   delete attValues;  // AttValues must be deleted after use.
00088 
00089   //Now do trajectory points...
00090   for (G4int i = 0; i < GetPointEntries(); i++) {
00091 
00092     G4VTrajectoryPoint* aTrajectoryPoint = GetPoint(i);
00093     attValues = aTrajectoryPoint->CreateAttValues();
00094     attDefs = aTrajectoryPoint->GetAttDefs();
00095 
00096     // Ensure validity...
00097     if (G4AttCheck(attValues,attDefs).Check("G4VTrajectory::ShowTrajectory")) {
00098       return;
00099     }
00100 
00101     for (iAttVal = attValues->begin();
00102          iAttVal != attValues->end(); ++iAttVal) {
00103       std::map<G4String,G4AttDef>::const_iterator iAttDef =
00104         attDefs->find(iAttVal->GetName());
00105       os << "\n    " << iAttDef->second.GetDesc()
00106          << " (" << iAttVal->GetName()
00107          << "): " << iAttVal->GetValue();
00108     }
00109 
00110     delete attValues;  // AttValues must be deleted after use.
00111   }
00112 }
00113 
00114 /***
00115 void G4VTrajectory::DrawTrajectory() const
00116 {
00117   G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
00118 
00119   if (0 != pVVisManager) {
00120     pVVisManager->DispatchToModel(*this);
00121   }
00122 }
00123 ***/
00124 
00125 void G4VTrajectory::DrawTrajectory(G4int i_mode) const
00126 {
00127   G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
00128 
00129   static G4bool warnedAboutIMode = false;
00130   if (!warnedAboutIMode && i_mode != 0) {
00131     G4Exception
00132         ("G4VTrajectory::DrawTrajectory()",
00133          "Tracking0100", JustWarning,
00134          "DEPRECATED! The use of i_mode argument in DrawTrajectory()"
00135          "\n  is deprecated and will be removed at the next major release.");
00136     warnedAboutIMode = true;
00137   }
00138 
00139   if (0 != pVVisManager) {
00140     pVVisManager->DispatchToModel(*this, i_mode);
00141   }
00142 }

Generated on Mon May 27 17:50:23 2013 for Geant4 by  doxygen 1.4.7