Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

LCDG4LumSD Class Reference

#include <LCDG4LumSD.hh>

Inheritance diagram for LCDG4LumSD:

Inheritance graph
[legend]
Collaboration diagram for LCDG4LumSD:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 LCDG4LumSD (G4String name)
 ~LCDG4LumSD ()
void Initialize (G4HCofThisEvent *HCE)
G4bool ProcessHits (G4Step *aStep, G4TouchableHistory *ROhist)
void EndOfEvent (G4HCofThisEvent *HCE)
void clear ()
void DrawAll ()
void PrintAll ()
G4int AddLogVolInfo (G4LogicalVolume *g4vxdlog, G4int startlayerNo, G4int sysNo, G4int be, G4int ns, G4int fsens)
void SetSegmentation (G4int phiseg, G4int thetaseg, G4int barend)

Private Attributes

LCDG4CalHitsCollectionm_lumCollection
std::map< G4LogicalVolume *,
G4int > 
m_maplayer
std::map< G4LogicalVolume *,
G4int > 
m_mapsys
std::map< G4LogicalVolume *,
G4int > 
m_mapbe
std::map< G4LogicalVolume *,
G4int > 
m_mapns
std::map< G4LogicalVolume *,
G4int > 
m_mapsens
std::map< G4int, LCDG4CalHit * > m_cellhitb
std::map< G4int, LCDG4CalHit * > m_cellhite
G4int m_phiseg [2]
G4int m_thetaseg [2]

Constructor & Destructor Documentation

LCDG4LumSD::LCDG4LumSD G4String  name  ) 
 

Definition at line 14 of file LCDG4LumSD.cc.

References m_cellhitb, m_cellhite, m_phiseg, and m_thetaseg.

00014                                    :G4VSensitiveDetector(name) {
00015   G4String HCname;
00016   collectionName.insert(HCname="lumCollection");
00017   m_cellhitb.clear();
00018   m_cellhite.clear();
00019   m_phiseg  [0]=1; m_phiseg  [1]=1;
00020   m_thetaseg[0]=1; m_thetaseg[1]=1;
00021 }

LCDG4LumSD::~LCDG4LumSD  ) 
 

Definition at line 26 of file LCDG4LumSD.cc.

00026                        {
00027 }


Member Function Documentation

G4int LCDG4LumSD::AddLogVolInfo G4LogicalVolume *  g4vxdlog,
G4int  startlayerNo,
G4int  sysNo,
G4int  be,
G4int  ns,
G4int  fsens
 

Definition at line 148 of file LCDG4LumSD.cc.

References ns.

00149              {
00150   m_maplayer.insert(std::pair<G4LogicalVolume*,G4int>(g4lumlog,startlayerNo));
00151   m_mapsys.insert(std::pair<G4LogicalVolume*,G4int>(g4lumlog,sysNo));
00152   m_mapbe.insert(std::pair<G4LogicalVolume*,G4int>(g4lumlog,be));
00153   m_mapns.insert(std::pair<G4LogicalVolume*,G4int>(g4lumlog,ns));
00154   m_mapsens.insert(std::pair<G4LogicalVolume*,G4int>(g4lumlog,sens));
00155   return m_maplayer.size();
00156 }

void LCDG4LumSD::clear  ) 
 

Definition at line 129 of file LCDG4LumSD.cc.

00129                        {
00130 }

void LCDG4LumSD::DrawAll  ) 
 

Definition at line 135 of file LCDG4LumSD.cc.

00135                          {
00136 }

void LCDG4LumSD::EndOfEvent G4HCofThisEvent *  HCE  ) 
 

Definition at line 120 of file LCDG4LumSD.cc.

References m_cellhitb, and m_cellhite.

00120                                                {
00121   if(HCE) ;  // make compiler happy about unused vars
00122   m_cellhitb.clear();
00123   m_cellhite.clear();
00124 }

void LCDG4LumSD::Initialize G4HCofThisEvent *  HCE  ) 
 

Definition at line 33 of file LCDG4LumSD.cc.

References LCDG4CalHitsCollection, and m_lumCollection.

00033                                                {
00034   static int HCID = -1;
00035   m_lumCollection = new LCDG4CalHitsCollection
00036     (SensitiveDetectorName,collectionName[0]);
00037   if(HCID < 0) {
00038     HCID = GetCollectionID(0);
00039   }
00040   HCE->AddHitsCollection(HCID,m_lumCollection);
00041 }

void LCDG4LumSD::PrintAll  ) 
 

Definition at line 141 of file LCDG4LumSD.cc.

00141                           {
00142 }

G4bool LCDG4LumSD::ProcessHits G4Step *  aStep,
G4TouchableHistory *  ROhist
 

Definition at line 47 of file LCDG4LumSD.cc.

References LCDG4CalHit::AddMcPart(), LCDG4CalHit::AddMcPartAbs(), m_cellhitb, m_cellhite, m_lumCollection, m_mapbe, m_maplayer, m_mapsens, m_mapsys, m_phiseg, m_thetaseg, LCDG4CalHit::SetBarEnd(), LCDG4CalHit::SetLayer(), LCDG4CalHit::SetPhi(), LCDG4CalHit::SetPos(), LCDG4CalHit::SetSystem(), and LCDG4CalHit::SetTheta().

00047                                                                         {
00048 
00049   G4double edep = aStep->GetTotalEnergyDeposit();
00050 
00051   if(edep==0.) return false;
00052 
00053   const G4VPhysicalVolume* physVol
00054     = aStep->GetPreStepPoint()->GetPhysicalVolume();
00055   if( ROhist!=NULL ) {
00056     G4VPhysicalVolume* phyVol = ROhist->GetVolume();
00057     if(phyVol != physVol) G4cout<<"phy,phys="<< phyVol<<' '<<physVol <<G4endl;
00058   }
00059 
00060   G4LogicalVolume* logVol=physVol->GetLogicalVolume();
00061 
00062   G4Track* mclum = aStep->GetTrack();
00063   G4int    trkID  = mclum->GetTrackID();
00064   G4double tdep   = mclum->GetGlobalTime();
00065   G4int    layno  = m_maplayer[logVol];
00066   G4int    sysNo  = m_mapsys[logVol];
00067   G4int    barend = m_mapbe[logVol];
00068 
00069   G4ThreeVector pos = 0.5*(aStep->GetPreStepPoint()->GetPosition() +
00070                            aStep->GetPostStepPoint()->GetPosition() );
00071   G4double dphi     = 360.0*degree/m_phiseg[barend];
00072   G4double dtheta   = 180.0*degree/m_thetaseg[barend];
00073   G4double trkphi   = pos.phi();
00074   if (trkphi < 0.0) {
00075     trkphi += 360.0*degree;
00076   }
00077   G4double trkthe = pos.theta();
00078   G4int    sphi   = int(trkphi/dphi);
00079   G4int    sthe   = int(trkthe/dtheta);
00080   G4int    icell  = sthe + m_thetaseg[barend]*sphi
00081     + m_thetaseg[barend]*m_phiseg[barend]*layno;
00082 
00083   std::map<G4int,LCDG4CalHit*>* pcellhit=0;
00084   if (barend == 0) {
00085     pcellhit=&m_cellhitb;
00086   } else {
00087     pcellhit=&m_cellhite;
00088   }
00089   LCDG4CalHit *hit=(*pcellhit)[icell];
00090 
00091   if(hit == 0) {
00092     G4double r = pos.mag();
00093     G4ThreeVector hpos(r*sin((sthe+0.5)*dtheta)*cos((sphi+0.5)*dphi),
00094                        r*sin((sthe+0.5)*dtheta)*sin((sphi+0.5)*dphi),
00095                        r*cos((sthe+0.5)*dtheta));
00096 
00097     (*pcellhit).erase(icell);
00098     hit = new LCDG4CalHit();
00099     hit->SetLayer(layno);
00100     hit->SetSystem(sysNo);
00101     hit->SetBarEnd(barend);
00102     hit->SetPhi(sphi);
00103     hit->SetTheta(sthe);
00104     hit->SetPos(hpos);
00105     m_lumCollection->insert(hit);
00106     pcellhit->insert(std::pair<G4int,LCDG4CalHit*>(icell,hit));
00107   }
00108 
00109   if (m_mapsens[logVol]) {
00110     hit->AddMcPart(trkID,edep,tdep);
00111   } else {
00112     hit->AddMcPartAbs(edep);
00113   }
00114   return true;
00115 }

void LCDG4LumSD::SetSegmentation G4int  phiseg,
G4int  thetaseg,
G4int  barend
[inline]
 

Definition at line 35 of file LCDG4LumSD.hh.

References m_phiseg, and m_thetaseg.

00036   { m_phiseg[barend] = phiseg; m_thetaseg[barend] = thetaseg; }


Member Data Documentation

std::map<G4int,LCDG4CalHit*> LCDG4LumSD::m_cellhitb [private]
 

Definition at line 45 of file LCDG4LumSD.hh.

Referenced by EndOfEvent(), LCDG4LumSD(), and ProcessHits().

std::map<G4int,LCDG4CalHit*> LCDG4LumSD::m_cellhite [private]
 

Definition at line 46 of file LCDG4LumSD.hh.

Referenced by EndOfEvent(), LCDG4LumSD(), and ProcessHits().

LCDG4CalHitsCollection* LCDG4LumSD::m_lumCollection [private]
 

Definition at line 39 of file LCDG4LumSD.hh.

Referenced by Initialize(), and ProcessHits().

std::map<G4LogicalVolume*,G4int> LCDG4LumSD::m_mapbe [private]
 

Definition at line 42 of file LCDG4LumSD.hh.

Referenced by ProcessHits().

std::map<G4LogicalVolume*,G4int> LCDG4LumSD::m_maplayer [private]
 

Definition at line 40 of file LCDG4LumSD.hh.

Referenced by ProcessHits().

std::map<G4LogicalVolume*,G4int> LCDG4LumSD::m_mapns [private]
 

Definition at line 43 of file LCDG4LumSD.hh.

std::map<G4LogicalVolume*,G4int> LCDG4LumSD::m_mapsens [private]
 

Definition at line 44 of file LCDG4LumSD.hh.

Referenced by ProcessHits().

std::map<G4LogicalVolume*,G4int> LCDG4LumSD::m_mapsys [private]
 

Definition at line 41 of file LCDG4LumSD.hh.

Referenced by ProcessHits().

G4int LCDG4LumSD::m_phiseg[2] [private]
 

Definition at line 47 of file LCDG4LumSD.hh.

Referenced by LCDG4LumSD(), ProcessHits(), and SetSegmentation().

G4int LCDG4LumSD::m_thetaseg[2] [private]
 

Definition at line 48 of file LCDG4LumSD.hh.

Referenced by LCDG4LumSD(), ProcessHits(), and SetSegmentation().


The documentation for this class was generated from the following files:
Generated on Thu Oct 7 18:45:05 2004 for LCDG4 by doxygen 1.3.4