Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 09:22:53

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 /// \file B5/src/DriftChamberHit.cc
0028 /// \brief Implementation of the B5::DriftChamberHit class
0029 
0030 #include "DriftChamberHit.hh"
0031 
0032 #include "G4AttDef.hh"
0033 #include "G4AttDefStore.hh"
0034 #include "G4AttValue.hh"
0035 #include "G4Circle.hh"
0036 #include "G4Colour.hh"
0037 #include "G4SystemOfUnits.hh"
0038 #include "G4UIcommand.hh"
0039 #include "G4UnitsTable.hh"
0040 #include "G4VVisManager.hh"
0041 #include "G4VisAttributes.hh"
0042 
0043 namespace B5
0044 {
0045 
0046 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0047 
0048 G4ThreadLocal G4Allocator<DriftChamberHit>* DriftChamberHitAllocator;
0049 
0050 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0051 
0052 DriftChamberHit::DriftChamberHit(G4int layerID) : fLayerID(layerID) {}
0053 
0054 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0055 
0056 G4bool DriftChamberHit::operator==(const DriftChamberHit& /*right*/) const
0057 {
0058   return false;
0059 }
0060 
0061 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0062 
0063 void DriftChamberHit::Draw()
0064 {
0065   auto visManager = G4VVisManager::GetConcreteInstance();
0066   if (!visManager) return;
0067 
0068   G4Circle circle(fWorldPos);
0069   circle.SetScreenSize(2);
0070   circle.SetFillStyle(G4Circle::filled);
0071   G4VisAttributes attribs(G4Colour::Yellow());
0072   circle.SetVisAttributes(attribs);
0073   visManager->Draw(circle);
0074 }
0075 
0076 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0077 
0078 const std::map<G4String, G4AttDef>* DriftChamberHit::GetAttDefs() const
0079 {
0080   G4bool isNew;
0081   auto store = G4AttDefStore::GetInstance("DriftChamberHit", isNew);
0082 
0083   if (isNew) {
0084     (*store)["HitType"] = G4AttDef("HitType", "Hit Type", "Physics", "", "G4String");
0085 
0086     (*store)["ID"] = G4AttDef("ID", "ID", "Physics", "", "G4int");
0087 
0088     (*store)["Time"] = G4AttDef("Time", "Time", "Physics", "G4BestUnit", "G4double");
0089 
0090     (*store)["Pos"] = G4AttDef("Pos", "Position", "Physics", "G4BestUnit", "G4ThreeVector");
0091   }
0092 
0093   return store;
0094 }
0095 
0096 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0097 
0098 std::vector<G4AttValue>* DriftChamberHit::CreateAttValues() const
0099 {
0100   auto values = new std::vector<G4AttValue>;
0101 
0102   values->push_back(G4AttValue("HitType", "DriftChamberHit", ""));
0103   values->push_back(G4AttValue("ID", G4UIcommand::ConvertToString(fLayerID), ""));
0104   values->push_back(G4AttValue("Time", G4BestUnit(fTime, "Time"), ""));
0105   values->push_back(G4AttValue("Pos", G4BestUnit(fWorldPos, "Length"), ""));
0106 
0107   return values;
0108 }
0109 
0110 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0111 
0112 void DriftChamberHit::Print()
0113 {
0114   G4cout << "  Layer[" << fLayerID << "] : time " << fTime / ns << " (nsec) --- local (x,y) "
0115          << fLocalPos.x() << ", " << fLocalPos.y() << G4endl;
0116 }
0117 
0118 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0119 
0120 }  // namespace B5