#include <LCDG4CalSD.hh>
Inheritance diagram for LCDG4CalSD:


Public Member Functions | |
| LCDG4CalSD (G4String name) | |
| ~LCDG4CalSD () | |
| G4bool | ProcessHits (G4Step *aStep, G4TouchableHistory *ROhist) |
| void | Initialize (G4HCofThisEvent *HCE) |
| void | EndOfEvent (G4HCofThisEvent *HCE) |
| virtual unsigned int | findCell (const G4ThreeVector &position)=0 |
| virtual G4ThreeVector | getCellCenter (unsigned int cellIndex)=0 |
| virtual unsigned int | getIndex1 (unsigned int cellIndex) const =0 |
| virtual unsigned int | getIndex2 (unsigned int cellIndex) const =0 |
| virtual unsigned int | getIndex3 (unsigned int cellIndex) const =0 |
| void | clear () |
| void | DrawAll () |
| void | PrintAll () |
| G4int | AddLogVolInfo (G4LogicalVolume *g4vxdlog, G4int startlayerNo, G4int sysNo, G4int be, G4int ns, G4int fsens) |
| void | SetLayerZeroCenterDepth (G4double cd) |
| void | SetLayerThickness (G4double t) |
Protected Attributes | |
| G4int | HCID |
| LCDG4CalHitsCollection * | _hitCollection |
| std::map< G4LogicalVolume *, G4int > | _maplayer |
| std::map< G4LogicalVolume *, G4int > | _mapsys |
| std::map< G4LogicalVolume *, G4int > | _mapbe |
| std::map< G4LogicalVolume *, G4int > | _mapns |
| std::map< G4LogicalVolume *, G4int > | _mapsens |
| std::map< G4int, LCDG4CalHit * > | _cellhit |
| G4double | layer0CenterDepth |
| G4double | layerThickness |
| G4int | north |
| G4int | barend |
| int | debugLevel |
| unsigned int | index [4] |
|
|
Definition at line 17 of file LCDG4CalSD.cc. References debugLevel.
00018 : G4VSensitiveDetector(G4String("/lcddet/")+name) 00019 , HCID(-1) 00020 , layer0CenterDepth(0) 00021 , layerThickness(0) 00022 , debugLevel(0) 00023 { 00024 // read debugLevel flag from file ./debfile. 00025 // If no file is present, debugLevel = 0 00026 // The higher its value, the more output 00027 ifstream* debfile = new ifstream("debfile"); 00028 if(debfile) { 00029 *debfile >> debugLevel; 00030 debfile->close(); 00031 delete debfile; 00032 debfile = 0; 00033 } 00034 00035 // save name of hits collection associated to this Sensitive Detector 00036 G4String HCname = name+"Collection"; 00037 collectionName.insert( HCname ); 00038 00039 G4cout<< "SensitiveDetectorName = "<< SensitiveDetectorName << G4endl; 00040 } |
|
|
Definition at line 45 of file LCDG4CalSD.cc.
00045 {
00046 // methinks this causes Seg Fault JM062503
00047 // delete _hitCollection;
00048 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 186 of file LCDG4CalSD.cc. References _mapbe, _maplayer, _mapns, _mapsens, _mapsys, and ns.
00190 {
00191 _maplayer.insert(std::pair<G4LogicalVolume*,G4int>(g4logvol,startlayerNo));
00192 _mapsys.insert(std::pair<G4LogicalVolume*,G4int>(g4logvol,sysNo));
00193 _mapbe.insert(std::pair<G4LogicalVolume*,G4int>(g4logvol,be));
00194 _mapns.insert(std::pair<G4LogicalVolume*,G4int>(g4logvol,ns));
00195 _mapsens.insert(std::pair<G4LogicalVolume*,G4int>(g4logvol,sens));
00196 return _maplayer.size();
00197 }
|
|
|
Definition at line 202 of file LCDG4CalSD.cc.
00202 {
00203 }
|
|
|
Definition at line 208 of file LCDG4CalSD.cc.
00208 {
00209 }
|
|
|
Definition at line 175 of file LCDG4CalSD.cc. References _cellhit.
00175 {
00176 if(HCE) ; // make compiler happy
00177 // clear member hit collections. The hits are owned by the event,
00178 // so deleting them here will produce a crash
00179 _cellhit.clear();
00180 }
|
|
|
Implemented in LCDG4CalSDNonProj, and LCDG4CalSDProj. Referenced by ProcessHits(). |
|
|
Implemented in LCDG4CalSDNonProj, and LCDG4CalSDProj. Referenced by ProcessHits(). |
|
|
Implemented in LCDG4CalSDNonProj, and LCDG4CalSDProj. Referenced by ProcessHits(). |
|
|
Implemented in LCDG4CalSDNonProj, and LCDG4CalSDProj. Referenced by ProcessHits(). |
|
|
Implemented in LCDG4CalSDNonProj, and LCDG4CalSDProj. Referenced by ProcessHits(). |
|
|
Definition at line 53 of file LCDG4CalSD.cc. References _hitCollection, HCID, and LCDG4CalHitsCollection.
00053 {
00054 // Create a new hit collection for this event
00055 _hitCollection =
00056 new LCDG4CalHitsCollection(SensitiveDetectorName,
00057 collectionName[0]);
00058 // save hit collection id
00059 if(HCID < 0) HCID = GetCollectionID(0);
00060 // add hit collection to event
00061 HCE->AddHitsCollection(HCID,_hitCollection);
00062 }
|
|
|
Definition at line 214 of file LCDG4CalSD.cc.
00214 {
00215 }
|
|
||||||||||||
|
Definition at line 67 of file LCDG4CalSD.cc. References _cellhit, _hitCollection, _mapbe, _maplayer, _mapns, _mapsens, _mapsys, LCDG4CalHit::AddMcPart(), LCDG4CalHit::AddMcPartAbs(), barend, debugLevel, findCell(), getCellCenter(), LCDG4CalHit::GetEdep(), LCDG4CalHit::GetEdepAbs(), getIndex1(), getIndex2(), getIndex3(), index, north, LCDG4CalHit::SetBarEnd(), LCDG4CalHit::SetLayer(), LCDG4CalHit::SetNorth(), LCDG4CalHit::SetPhi(), LCDG4CalHit::SetPos(), LCDG4CalHit::SetSystem(), and LCDG4CalHit::SetTheta().
00067 {
00068
00069 G4double edep = aStep->GetTotalEnergyDeposit();
00070 if(edep==0) return false;
00071
00072 const G4VPhysicalVolume* physVol
00073 = aStep->GetPreStepPoint()->GetPhysicalVolume();
00074 if( ROhist!=NULL ) {
00075 G4VPhysicalVolume* ROvol = ROhist->GetVolume();
00076 if(ROvol!=physVol) {
00077 G4cout<<"ROvol="<< ROvol <<", physVol="<< physVol <<G4endl;
00078 }
00079 }
00080
00081 // some aliases
00082 unsigned int& sysNo = index[0];
00083 unsigned int& layno = index[1];
00084
00085 G4LogicalVolume* logVol=physVol->GetLogicalVolume();
00086 #ifndef TXT_MODE
00087 // no need to keep track of hits in absorbers
00088 if (!_mapsens[logVol]) return false;
00089 #endif
00090
00091 sysNo = _mapsys[logVol];
00092 layno = _maplayer[logVol];
00093 barend = _mapbe[logVol];
00094 north = _mapns[logVol];
00095
00096 G4Track* ptrk = aStep->GetTrack();
00097 G4int trkID = ptrk->GetTrackID();
00098 G4double tdep = ptrk->GetGlobalTime();
00099
00100 // edep hit position is at middle of preStep and postStep points
00101 G4ThreeVector pos = 0.5*(aStep->GetPreStepPoint()->GetPosition()+
00102 aStep->GetPostStepPoint()->GetPosition() );
00103
00104 if(debugLevel) {
00105 G4cout << "\nCheck PhysVol on pre/post step: "
00106 <<aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName() <<' '
00107 <<aStep->GetPostStepPoint()->GetPhysicalVolume()->GetName()<<G4endl;
00108 G4cout << "Hit in layer " << layno << G4endl
00109 << "hit info (x,y,z)=("<< pos.x() <<';'<< pos.y() <<';'<< pos.z()
00110 <<"), cylRho="<< pos.rho() <<", th="<< pos.theta() <<", phi="<< pos.phi()
00111 << G4endl;
00112 }
00113
00114 // Geometry dependent calculations
00115 unsigned int cellIndex = findCell(pos);
00116 G4ThreeVector cellCenter = getCellCenter(cellIndex);
00117 if(debugLevel) {
00118 G4cout<< "cellIndex="<< cellIndex
00119 <<'/'<< getIndex3(cellIndex)
00120 <<'/'<< getIndex2(cellIndex)
00121 <<'/'<< getIndex1(cellIndex) <<'/'<< sysNo
00122 << " -> cell center info (x,y,z)=("<< cellCenter.x() <<';'<< cellCenter.y() <<';'<< cellCenter.z()
00123 <<"), cylRho="<< cellCenter.rho() <<", th="<< cellCenter.theta() <<", phi="<< cellCenter.phi() <<' '<<", north="<< north << G4endl;
00124 }
00125
00126 // Get a pointer to hit if it exists, or create a new one
00127 LCDG4CalHit *hit = NULL;
00128 map<int,LCDG4CalHit*>::iterator pcellhit = _cellhit.find(cellIndex);
00129 if( pcellhit!=_cellhit.end() ) hit = _cellhit.find(cellIndex)->second;
00130 if(hit == NULL) {
00131 if (debugLevel>3) G4cout << "creating new hit cell" << G4endl;
00132 hit = new LCDG4CalHit();
00133 hit->SetSystem(sysNo);
00134 hit->SetBarEnd(barend);
00135 hit->SetNorth(north);
00136 hit->SetLayer(layno);
00137
00138 // set hit position to center of cell
00139 hit->SetPos(cellCenter);
00140
00141 // save cell indices (virtual cells)
00142 hit->SetPhi( getIndex1(cellIndex) );
00143 hit->SetTheta( getIndex2(cellIndex) );
00144
00145 // Insert hit into hit collection
00146 _hitCollection->insert(hit);
00147 _cellhit.insert( std::pair<G4int,LCDG4CalHit*>( cellIndex, hit) );
00148 }
00149
00150 if (_mapsens[logVol]) {
00151 // hit in sensitive material
00152 hit->AddMcPart(trkID,edep,tdep);
00153 } else {
00154 // hit in absorber
00155 hit->AddMcPartAbs(edep);
00156 }
00157 if(debugLevel>3) {
00158 G4cout<<"After adding hit: hit(edep,edepa) = "
00159 << hit->GetEdep() <<' '<< hit->GetEdepAbs() << G4endl;
00160 }
00161 // if ( hit->GetNMC() > 1 ) {
00162 // G4cout <<"CalSD: cellid,nmc = "<< layno <<' '<< sphi <<' '<< sthe <<' '<< hit->GetNMC() << G4endl;
00163 // for(int i=0; i<hit->GetNMC(); i++) {
00164 // G4cout <<" hit,id,emc = " <<' '<< i <<' '<< hit->GetMCIdx(i) <<' '<< hit->GetEMC(i) << G4endl;
00165 // }
00166 // }
00167
00168 return true;
00169 }
|
|
|
Definition at line 55 of file LCDG4CalSD.hh. References layerThickness.
00055 { layerThickness = t; }
|
|
|
Definition at line 54 of file LCDG4CalSD.hh. References layer0CenterDepth.
00054 { layer0CenterDepth = cd; }
|
|
|
Definition at line 74 of file LCDG4CalSD.hh. Referenced by EndOfEvent(), and ProcessHits(). |
|
|
Definition at line 61 of file LCDG4CalSD.hh. Referenced by Initialize(), and ProcessHits(). |
|
|
Definition at line 67 of file LCDG4CalSD.hh. Referenced by AddLogVolInfo(), and ProcessHits(). |
|
|
Definition at line 63 of file LCDG4CalSD.hh. Referenced by AddLogVolInfo(), and ProcessHits(). |
|
|
Definition at line 69 of file LCDG4CalSD.hh. Referenced by AddLogVolInfo(), and ProcessHits(). |
|
|
Definition at line 71 of file LCDG4CalSD.hh. Referenced by AddLogVolInfo(), and ProcessHits(). |
|
|
Definition at line 65 of file LCDG4CalSD.hh. Referenced by AddLogVolInfo(), and ProcessHits(). |
|
|
Definition at line 80 of file LCDG4CalSD.hh. Referenced by ProcessHits(). |
|
|
Definition at line 83 of file LCDG4CalSD.hh. Referenced by LCDG4CalSD(), and ProcessHits(). |
|
|
Definition at line 59 of file LCDG4CalSD.hh. Referenced by Initialize(). |
|
|
Definition at line 89 of file LCDG4CalSD.hh. Referenced by LCDG4CalSDProj::findCell(), LCDG4CalSDProj::getCellCenter(), LCDG4CalSDNonProj::getCellCenter(), and ProcessHits(). |
|
|
Definition at line 78 of file LCDG4CalSD.hh. Referenced by LCDG4CalSDProj::getCellCenter(), and SetLayerZeroCenterDepth(). |
|
|
Definition at line 79 of file LCDG4CalSD.hh. Referenced by LCDG4CalSDProj::getCellCenter(), and SetLayerThickness(). |
|
|
Definition at line 80 of file LCDG4CalSD.hh. Referenced by LCDG4CalSDProj::getCellCenter(), and ProcessHits(). |
1.3.4