/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Simulation/BOOST/MucSim/MucSim-00-01-03/src/BesMucHit.cc

Go to the documentation of this file.
00001 //---------------------------------------------------------------------------//
00002 //      BOOST --- BESIII Object_Oriented Simulation Tool                     //
00003 //---------------------------------------------------------------------------//
00004 //Description:
00005 //Author:  Youzy      Peking University      mail: youzy@hep.pku.cn
00006 //Created:  Nov, 2003
00007 //Modified:
00008 //Comment:
00009 //---------------------------------------------------------------------------//
00010 
00011 //
00012 // $Id: BesMucHit 
00013 
00014 #include "BesMucHit.hh"
00015 #include "G4UnitsTable.hh"
00016 #include "G4VVisManager.hh"
00017 #include "G4Circle.hh"
00018 #include "G4Colour.hh"
00019 #include "G4VisAttributes.hh"
00020 #include "G4ios.hh"
00021 #include "strstream"
00022 
00023 G4Allocator<BesMucHit> BesMucHitAllocator;
00024 
00025 BesMucHit::BesMucHit()
00026 { }
00027 
00028 BesMucHit::BesMucHit(int prt, int seg, int lay, int str, int trId, int trIndex)
00029 { 
00030   m_Part = prt; 
00031   m_Seg  = seg; 
00032   m_Gap  = lay;
00033   m_Strip = str;
00034   m_TrackID = trId; 
00035   m_TrackIndex = trIndex;
00036 }
00037 
00038 BesMucHit::~BesMucHit() 
00039 { }
00040 
00041 BesMucHit::BesMucHit(const BesMucHit& right)
00042   :G4VHit()
00043 {
00044   m_TrackID    = right.m_TrackID;
00045   m_TrackIndex = right.m_TrackIndex;
00046   m_PDGCode    = right.m_PDGCode;
00047   m_Edep       = right.m_Edep;
00048   m_Energy     = right.m_Energy;
00049   m_Time       = right.m_Time;
00050   m_Pos        = right.m_Pos;
00051   m_PosLocal   = right.m_PosLocal;
00052   m_Dir        = right.m_Dir;
00053   m_Momentum   = right.m_Momentum;
00054   m_Volume     = right.m_Volume;
00055   m_VolumeName = right.m_VolumeName;
00056   m_Part       = right.m_Part;
00057   m_Seg        = right.m_Seg;
00058   m_Gap        = right.m_Gap;
00059   m_Panel      = right.m_Panel;
00060   m_GasChamber = right.m_GasChamber;     //now it means up or down RPC! 2006.10.17
00061   m_Strip      = right.m_Strip;
00062 }
00063 
00064 const BesMucHit& BesMucHit::operator=(const BesMucHit& right)
00065 {
00066   m_TrackID    = right.m_TrackID;
00067   m_TrackIndex = right.m_TrackIndex;
00068   m_PDGCode    = right.m_PDGCode;
00069   m_Edep       = right.m_Edep;
00070   m_Energy     = right.m_Energy;
00071   m_Time       = right.m_Time;
00072   m_Pos        = right.m_Pos;
00073   m_PosLocal   = right.m_PosLocal;
00074   m_Dir        = right.m_Dir;
00075   m_Momentum   = right.m_Momentum;
00076   m_Volume     = right.m_Volume;
00077   m_VolumeName = right.m_VolumeName;
00078   m_Part       = right.m_Part;
00079   m_Seg        = right.m_Seg;
00080   m_Gap        = right.m_Gap;
00081   m_Panel      = right.m_Panel;
00082   m_GasChamber = right.m_GasChamber;
00083   m_Strip      = right.m_Strip;
00084   return *this;
00085 }
00086 
00087 int BesMucHit::operator==(const BesMucHit& right) const
00088 {
00089   return (this==&right) ? 1 : 0;
00090 }
00091 
00092 void BesMucHit::SetVolume(G4VPhysicalVolume* pv)
00093 {
00094   m_Volume     = pv; 
00095   m_VolumeName = pv->GetLogicalVolume()->GetName();
00096 
00097   G4LogicalVolume *lvGap = pv->GetMotherLogical();
00098   G4String GapName = lvGap->GetName();
00099 
00100   //G4cout<<" in BesMucHit ---- "<<m_VolumeName<<" "<<GapName<<G4endl;
00101 //    //  "logicalMucPart1Seg0Gap4Panel1GasChamber0"
00102 //    //  "logicalMucPart1Seg4Gap0"
00103 //    G4String strPart       = m_VolumeName.substr(14,1);
00104 //    G4String strSeg        =      GapName.substr(18,1);
00105 //    G4String strGap        = m_VolumeName.substr(22,1);
00106 //    G4String strPanel      = m_VolumeName.substr(28,1);
00107 //    G4String strGasChamber = m_VolumeName.substr(39,1);
00108 
00109   //   "logicalMucPart0Seg0Gap0RpcUpDown0Panel0GasChamber"   2006.10.17 liangyt
00110   //   "logicalMucPart0Seg0Gap0" 
00111 
00112   //   "lMucP0S0G0R0Pn0C"           2006.12.05 liangyt 
00113   //   "lMucP0S0G0"
00114   G4String strPart       = m_VolumeName.substr(5,1);
00115   G4String strSeg        =      GapName.substr(7,1);
00116   G4String strGap        = m_VolumeName.substr(9,1);
00117   G4String strGasChamber = m_VolumeName.substr(11,1);    //same as rpcupdown 
00118   G4String strPanel      = m_VolumeName.substr(14,1);
00119 //   G4String strPart       = m_VolumeName.substr(14,1);
00120 //   G4String strSeg        =      GapName.substr(18,1);
00121 //   G4String strGap        = m_VolumeName.substr(22,1);
00122 //   G4String strGasChamber = m_VolumeName.substr(32,1);    //same as rpcupdown 
00123 //   G4String strPanel      = m_VolumeName.substr(38,1);
00124 
00125   std::istrstream partBuf(strPart.c_str(),             strlen(strPart.c_str()));
00126   std::istrstream segBuf(strSeg.c_str(),               strlen(strSeg.c_str()));
00127   std::istrstream gapBuf(strGap.c_str(),               strlen(strGap.c_str()));
00128   std::istrstream panelBuf(strPanel.c_str(),           strlen(strPanel.c_str()));
00129   std::istrstream gasChamberBuf(strGasChamber.c_str(), strlen(strGasChamber.c_str()));
00130 
00131   partBuf       >> m_Part ;
00132   segBuf        >> m_Seg;
00133   gapBuf        >> m_Gap;
00134   panelBuf      >> m_Panel;
00135   gasChamberBuf >> m_GasChamber; 
00136 }
00137 
00138 
00139 void BesMucHit::Draw()
00140 {
00141   G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
00142   if(pVVisManager)
00143   {
00144     G4Circle circle(m_Pos);
00145     circle.SetScreenSize(4.);
00146     circle.SetFillStyle(G4Circle::filled);
00147     G4Colour colour(0.,0.,1.);
00148     G4VisAttributes attribs(colour);
00149     circle.SetVisAttributes(attribs);
00150     pVVisManager->Draw(circle);
00151     
00152     //re-visualize a physical volume where a hit is detected
00153     //
00154     //
00155   /*  const G4ThreeVector& thrVector=G4ThreeVector(1.,0.,0.);
00156     const G4RotationMatrix &rot = 
00157             G4RotationMatrix(thrVector,0.*deg);
00158     
00159     G4Transform3D trans(rot, pos);
00160     G4VisAttributes att;
00161     const G4VPhysicalVolume* pPhys= detector->GetPhysicalTrap();
00162     const G4LogicalVolume* logVol=
00163             pPhys->GetLogicalVolume();
00164     const G4VisAttributes* pVA=logVol->GetVisAttributes();
00165     if(pVA) att=*pVA;
00166     G4Colour col(1.,0.,0.);
00167     att.SetColour(col);
00168     att.SetForceSolid(true);
00169 
00170     pVVisManager->Draw(*pPhys,att,trans);*/
00171   }
00172 }
00173 
00174 void BesMucHit::Print()
00175 {
00176   
00177   G4cout << "  Track id: "       << m_TrackID
00178          << "  pdg code: "       << m_PDGCode
00179          << G4endl
00180          << "  energy deposit: " << G4BestUnit(m_Edep, "Energy")
00181          << "  pos: "            << G4BestUnit(m_Pos,  "Length") 
00182          << "  posLocal: "       << G4BestUnit(m_PosLocal,  "Length") 
00183          << G4endl
00184          << "  energy: "         << G4BestUnit(m_Energy, "Energy")
00185          << "  direction: "      << m_Dir 
00186          << "  time: "           << G4BestUnit(m_Time,"Time")
00187          << "  volume name: "    << m_VolumeName
00188          << G4endl;
00189 }
00190 
00191 
00192 
00193 

Generated on Tue Nov 29 23:14:28 2016 for BOSS_7.0.2 by  doxygen 1.4.7