Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

BesTofSD Class Reference

#include <BesTofSD.hh>

Inheritance diagram for BesTofSD:

BesSensitiveDetector BesSensitiveDetector List of all members.

Public Member Functions

virtual void BeginOfTrack (const G4Track *)
virtual void BeginOfTrack (const G4Track *)
void BeginOfTruthEvent (const G4Event *)
void BeginOfTruthEvent (const G4Event *)
 BesTofSD (G4String name)
 BesTofSD (G4String name)
virtual void EndOfEvent (G4HCofThisEvent *HCE)
virtual void EndOfEvent (G4HCofThisEvent *HCE)
virtual void EndOfTrack (const G4Track *)
virtual void EndOfTrack (const G4Track *)
void EndOfTruthEvent (const G4Event *)
void EndOfTruthEvent (const G4Event *)
virtual void Initialize (G4HCofThisEvent *HCE)
virtual void Initialize (G4HCofThisEvent *HCE)
virtual G4bool ProcessHits (G4Step *aStep, G4TouchableHistory *)
virtual G4bool ProcessHits (G4Step *aStep, G4TouchableHistory *)
virtual ~BesTofSD ()
virtual ~BesTofSD ()

Protected Member Functions

void GetCurrentTrackIndex (G4int &trackIndex, G4int &g4TrackId) const
void GetCurrentTrackIndex (G4int &trackIndex, G4int &g4TrackId) const

Private Attributes

BesTofHitsCollectionm_besTofCollection
BesTofHitsCollectionm_besTofCollection
BesTofHitsCollectionm_besTofList
BesTofHitsCollectionm_besTofList
vector< int > m_scinIndex
vector< int > m_scinIndex
G4int m_trackIndex
vector< G4int > m_trackIndexes
vector< G4int > m_trackIndexes

Constructor & Destructor Documentation

BesTofSD::BesTofSD G4String  name  ) 
 

00024         :BesSensitiveDetector(name),m_besTofList(0)
00025 {
00026     collectionName.insert("BesTofHitsCollection");
00027     collectionName.insert("BesTofHitsList");
00028 }

BesTofSD::~BesTofSD  )  [virtual]
 

00033 { }

BesTofSD::BesTofSD G4String  name  ) 
 

virtual BesTofSD::~BesTofSD  )  [virtual]
 


Member Function Documentation

virtual void BesSensitiveDetector::BeginOfTrack const G4Track *   )  [inline, virtual, inherited]
 

00072 {;}

virtual void BesSensitiveDetector::BeginOfTrack const G4Track *   )  [inline, virtual, inherited]
 

00072 {;}

void BesTofSD::BeginOfTruthEvent const G4Event *   )  [virtual]
 

Reimplemented from BesSensitiveDetector.

void BesTofSD::BeginOfTruthEvent const G4Event *   )  [virtual]
 

Reimplemented from BesSensitiveDetector.

00045 {
00046     m_besTofList = new BesTofHitsCollection(SensitiveDetectorName, collectionName[1]);
00047     m_trackIndexes.clear();
00048     m_trackIndex = -99;
00049 }

virtual void BesTofSD::EndOfEvent G4HCofThisEvent *  HCE  )  [virtual]
 

void BesTofSD::EndOfEvent G4HCofThisEvent *  HCE  )  [virtual]
 

00205 {
00206     static G4int HCID=-1;
00207     if (HCID<0)
00208     {
00209         HCID = G4SDManager::GetSDMpointer()->
00210                GetCollectionID(collectionName[0]);
00211     }
00212     HCE->AddHitsCollection(HCID,m_besTofCollection);
00213 
00214 }

virtual void BesSensitiveDetector::EndOfTrack const G4Track *   )  [inline, virtual, inherited]
 

00074 {;}

virtual void BesSensitiveDetector::EndOfTrack const G4Track *   )  [inline, virtual, inherited]
 

00074 {;}

void BesTofSD::EndOfTruthEvent const G4Event *   )  [virtual]
 

Reimplemented from BesSensitiveDetector.

void BesTofSD::EndOfTruthEvent const G4Event *   )  [virtual]
 

Reimplemented from BesSensitiveDetector.

00052 {
00053     static G4int HLID=-1;
00054     if (HLID<0)
00055     {
00056         HLID = G4SDManager::GetSDMpointer()->
00057                GetCollectionID(collectionName[1]);
00058     }
00059 
00060     G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
00061     HCE->AddHitsCollection(HLID,m_besTofList);
00062 
00063 }

void BesSensitiveDetector::GetCurrentTrackIndex G4int &  trackIndex,
G4int &  g4TrackId
const [protected, inherited]
 

void BesSensitiveDetector::GetCurrentTrackIndex G4int &  trackIndex,
G4int &  g4TrackId
const [protected, inherited]
 

00031 {
00032   BesSensitiveManager* manager = BesSensitiveManager::GetSensitiveManager();
00033   if(manager)
00034   {
00035     trackIndex = manager->GetCurrentTrackIndex();
00036     std::vector<BesTruthTrack*>* trackList = manager->GetTrackList();
00037     if(trackList)
00038     {
00039       G4int size = trackList->size();
00040       if(size>0)
00041       {
00042         for(G4int i=0;i<size;i++)
00043         {
00044           if( (*trackList)[i]->GetIndex() == trackIndex )
00045           {
00046             g4TrackId = (*trackList)[i]->GetG4TrackId();
00047             break;
00048           }
00049         }
00050       } 
00051     }
00052   }
00053 }

virtual void BesTofSD::Initialize G4HCofThisEvent *  HCE  )  [virtual]
 

void BesTofSD::Initialize G4HCofThisEvent *  HCE  )  [virtual]
 

00038 {
00039     m_besTofCollection = new BesTofHitsCollection
00040     (SensitiveDetectorName,collectionName[0]);
00041 }

virtual G4bool BesTofSD::ProcessHits G4Step *  aStep,
G4TouchableHistory * 
[virtual]
 

G4bool BesTofSD::ProcessHits G4Step *  aStep,
G4TouchableHistory * 
[virtual]
 

00067 {
00068     G4double chg=aStep->GetTrack()->GetDefinition()->GetPDGCharge();
00069     G4double edep = aStep->GetTotalEnergyDeposit();
00070     G4double stepL=aStep->GetStepLength();
00071     G4double deltaT=aStep->GetDeltaTime();
00072     G4StepPoint* preStep = aStep->GetPreStepPoint();
00073     G4ThreeVector pDirection=preStep->GetMomentumDirection();
00074     G4String particleName = aStep->GetTrack()->GetDefinition()->GetParticleName();
00075     G4Material* scinMaterial = aStep->GetTrack()->GetMaterial();
00076     G4double charge = aStep->GetTrack()->GetDefinition()->GetPDGCharge();
00077 
00078     if (chg==0&&edep==0&&stepL==0)
00079         return false;
00080     BesTofHit *newHit = new BesTofHit();
00081 
00082     
00083     G4int trackId = aStep->GetTrack()->GetTrackID();
00084 
00085     newHit->SetTrackIndex(-99);
00086     newHit->SetG4Index(aStep->GetTrack()->GetTrackID());
00087     newHit->SetEdep(edep);
00088     newHit->SetStepL(stepL);
00089     //newHit->SetPName(particleName);
00090     newHit->SetTrackL(aStep->GetTrack()->GetTrackLength());
00091     G4ThreeVector pos=preStep->GetPosition();
00092     newHit->SetPos(pos);
00093     G4double globalTime=preStep->GetGlobalTime();
00094     newHit->SetTime(globalTime);
00095     newHit->SetDeltaT(deltaT);
00096     newHit->SetPDirection(pDirection);
00097     newHit->SetMomentum(preStep->GetMomentum());
00098     //newHit->SetMaterial(scinMaterial);
00099     newHit->SetCharge(charge);
00100 
00101     //barrel segment number: 0-175
00102     //endcap west:           0-47      z<0
00103     //endcap east:           0-47      z>0
00104 
00105     G4TouchableHistory* theTouchable
00106     = (G4TouchableHistory*)(preStep->GetTouchable());
00107 
00108     //partId: barrel(1), east endcap(0), west endcap(2);
00109     //scinNb:  barrel(0-175),east endcap(0-47), west endcap(0-47)
00110     G4String name = theTouchable->GetVolume(0)->GetName();
00111 
00112     G4int partId, scinNb, number;
00113     number = theTouchable->GetReplicaNumber(2);
00114     if (name=="physicalScinBr1")
00115     {
00116         partId = 1;
00117         scinNb = number;
00118     }
00119     else if (name=="physicalScinBr2")
00120     {
00121         partId = 1;
00122         scinNb = number+88;
00123     }
00124     else if (name=="physicalScinEcWest")
00125     {
00126         partId = 2;
00127         scinNb = number;
00128     }
00129     else if (name=="physicalScinEcEast")
00130     {
00131         partId = 0;
00132         scinNb = number;
00133     }
00134 
00135 
00136     //if construct by gdml files
00137     else if (name=="logicalScinBr1" ||name=="logicalScinBr2")
00138     {
00139         partId = 1;
00140         scinNb = (527-number)/3;
00141     }
00142     else if (name=="logicalScinEcEast")
00143     { //copy number: east:1-95(scinNb:47-0), west:1-95(scinNb:47-0)
00144         //east: partId=0  west: partId=2
00145         partId = 0;
00146         scinNb = (95-number)/2;
00147     }
00148     else if (name=="logicalScinEcWest")
00149     {
00150         partId  = 2;
00151         scinNb = (95-number)/2;
00152     }
00153     else
00154         return false;
00155 
00156     newHit->SetPartId(partId);
00157     newHit->SetScinNb(scinNb);
00158     //newHit->Draw();
00159     G4int trackIndex, g4TrackId;
00160     GetCurrentTrackIndex(trackIndex, g4TrackId);
00161     newHit->SetTrackIndex(trackIndex);
00162     //newHit->Print();
00163     if (edep>0)
00164         m_besTofCollection->insert(newHit);
00165 
00166     //for mc truth
00167     if (m_besTofList)
00168     {
00169         G4int trackIndex, g4TrackId;
00170         GetCurrentTrackIndex(trackIndex, g4TrackId);
00171         newHit->SetTrackIndex(trackIndex);
00172         if (m_trackIndex != trackIndex)
00173         {
00174             m_trackIndex = trackIndex;
00175             //G4int size = m_trackIndexes.size();
00176             //G4int flag=1;
00177             //if(size>0)
00178             //{
00179             //  for(G4int i=0;i<size;i++)
00180             //    if(m_trackIndexes[i] == trackIndex )
00181             //    {flag =0; break;}
00182             //}
00183             //if(flag && aStep->GetTrack()->GetTrackID()==g4TrackId )
00184             G4int flag=1;
00185             G4int pdg = abs(aStep->GetTrack()->GetDefinition()->GetPDGEncoding());
00186             if (pdg==12 || pdg==14 || pdg==16)
00187                 flag=0;
00188             if (flag && aStep->GetTrack()->GetTrackID()==g4TrackId)
00189             {
00190                 m_trackIndexes.push_back(trackIndex);
00191                 BesTofHit* truHit = new BesTofHit();
00192                 *truHit = *newHit;
00193                 m_besTofList->insert(truHit);
00194             }
00195         }
00196     }
00197     if (edep<=0)
00198         delete newHit;
00199     return true;
00200 }


Member Data Documentation

BesTofHitsCollection* BesTofSD::m_besTofCollection [private]
 

BesTofHitsCollection* BesTofSD::m_besTofCollection [private]
 

BesTofHitsCollection* BesTofSD::m_besTofList [private]
 

BesTofHitsCollection* BesTofSD::m_besTofList [private]
 

vector<int> BesTofSD::m_scinIndex [private]
 

vector<int> BesTofSD::m_scinIndex [private]
 

G4int BesTofSD::m_trackIndex [private]
 

vector<G4int> BesTofSD::m_trackIndexes [private]
 

vector<G4int> BesTofSD::m_trackIndexes [private]
 


The documentation for this class was generated from the following files:
Generated on Wed Feb 2 15:53:39 2011 for BOSS6.5.5 by  doxygen 1.3.9.1