43 collectionName.insert(
"BesMucHitsCollection" );
44 collectionName.insert(
"BesMucHitsList" );
45 HitID =
new G4int[500];
49 G4String GeometryPath2 = GeometryPath;
52 G4cout <<
"BOOST environment not set!" << G4endl;
55 GeometryPath +=
"/dat/muc-effi.dat";
56 GeometryPath2 +=
"/dat/muc-noise.dat";
62 ISvcLocator* svcLocator = Gaudi::svcLocator();
64 StatusCode sc = svcLocator->service(
"G4Svc", iG4Svc );
68 G4cout <<
"MucNoiseMode:\t" << m_noiseMode << G4endl;
70 if ( m_noiseMode != 0 )
73 G4LogicalVolume* logicalMuc = detector->GetPhysicalMuc()->GetLogicalVolume();
74 m_noise->Initialize( GeometryPath2, logicalMuc );
78 m_PreviousPrimaryTrackG4Id = 0;
117 G4Track* curTrack = aStep->GetTrack();
119 m_CurEvent = G4EventManager::GetEventManager()->GetConstCurrentEvent();
123 m_TrackCon = m_CurEvent->GetTrajectoryContainer();
136 if ( curTrack->GetDefinition()->GetPDGCharge() == 0. )
return false;
138 G4double edep = aStep->GetTotalEnergyDeposit();
142 G4int trackIndex = -99, g4TrackId = -99;
145 G4TouchableHistory* theTouchable =
146 (G4TouchableHistory*)( aStep->GetPreStepPoint()->GetTouchable() );
150 G4int trackID = curTrack->GetTrackID();
151 G4int parentID = curTrack->GetParentID();
155 G4int pdg = curTrack->GetDefinition()->GetPDGEncoding();
160 G4ThreeVector pos = 0.5 * ( aStep->GetPostStepPoint()->GetPosition() +
161 aStep->GetPreStepPoint()->GetPosition() );
164 G4ThreeVector posInGas = theTouchable->GetHistory()->GetTopTransform().TransformPoint( pos );
165 G4int stackDepth = theTouchable->GetHistory()->GetDepth();
166 G4ThreeVector posInBox =
167 theTouchable->GetHistory()->GetTransform( stackDepth - 1 ).TransformPoint( pos );
170 G4ThreeVector posInGap =
171 theTouchable->GetHistory()->GetTransform( stackDepth - 2 ).TransformPoint( pos );
176 G4double
energy = aStep->GetPreStepPoint()->GetKineticEnergy();
179 G4ThreeVector dir = aStep->GetPreStepPoint()->GetMomentumDirection();
182 G4ThreeVector
momentum = aStep->GetPreStepPoint()->GetMomentum();
185 G4double GlobalTime = aStep->GetPostStepPoint()->GetGlobalTime();
188 G4VPhysicalVolume* vl = theTouchable->GetVolume( 0 );
198 m_PreviousPrimaryTrackG4Id = g4TrackId;
216 G4int newTrackFlag = 0;
218 if ( m_trackIndex != trackIndex )
220 m_trackIndex = trackIndex;
221 G4int size = m_trackIndexes.size();
225 for ( G4int i = 0; i < size; i++ )
226 if ( m_trackIndexes[i] == trackIndex )
236 m_trackIndexes.push_back( trackIndex );
244 if ( g4TrackId != trackID )
254 G4int curPart, curSeg, curGap, curStrip;
260 m_effi->CheckCalibSvc();
261 m_effi->SetHit( truHit );
262 G4double need_eff = m_effi->GetEfficiency();
266 if ( curPart == m_prePart && curSeg == m_preSeg && curGap == m_preGap &&
267 curStrip == m_preStrip )
290 bool truHitExist =
false;
291 G4int n_hit = MucHitList->entries();
292 for ( G4int iTru = 0; iTru < n_hit; iTru++ )
294 BesMucHit* aTruHit = ( *MucHitList )[iTru];
304 G4float random = G4UniformRand();
307 if ( random <= need_eff ) { MucHitCollection->insert( newHit ); }
309 if ( !truHitExist && random <= need_eff ) { MucHitList->insert( truHit ); }
314 m_preStrip = curStrip;