43 G4Exception(
"TGCSensitiveDetectorCosmics::ProcessHits",
"TGCCosmicHitCollectionMissing", FatalException,
44 "Hit collection not initialized; did SetupEvent run?");
48 G4Track* track = aStep->GetTrack();
50 if (track->GetDefinition()->GetPDGCharge() == 0.0) {
51 if (track->GetDefinition()!=G4Geantino::GeantinoDefinition())
return true;
52 else if (track->GetDefinition()==G4ChargedGeantino::ChargedGeantinoDefinition())
return true;
54 const G4TouchableHistory* touchHist =
static_cast<const G4TouchableHistory*
>(aStep->GetPreStepPoint()->GetTouchable());
55 G4ThreeVector position = aStep->GetPreStepPoint()->GetPosition();
56 const G4AffineTransform trans = track->GetTouchable()->GetHistory()->GetTopTransform();
59 std::string stationName;
65 double globalTime = aStep->GetPreStepPoint()->GetGlobalTime();
67 G4ThreeVector direcos = aStep->GetPreStepPoint()->GetMomentumDirection();
72 G4ThreeVector globVrtx = aStep->GetPreStepPoint()->GetPosition();
75 double dist = globVrtx.mag();
76 double inv_lightspeed = 1. / CLHEP::c_light;
77 double tOrigin = dist * inv_lightspeed;
79 G4int trackid = aStep->GetTrack()->GetTrackID();
94 double globalDist = sqrt((
m_globH[0] - globVrtx[0])*(
m_globH[0] - globVrtx[0]) +
97 double tof = globalDist * inv_lightspeed;
102 for (
int i=touchHist->GetHistoryDepth();i>=0;i--) {
104 std::string::size_type npos;
105 std::string volName = touchHist->GetVolume(i)->GetName();
108 if ((npos = volName.find(
"station")) != std::string::npos) {
110 stationName = volName.substr(0,npos-2);
111 int volCopyNo = touchHist->GetVolume(i)->GetCopyNo();
117 if (stationName.compare(2,1,
"F") == 0) {
119 stationPhi = (abs(volCopyNo%100)-1)*3;
120 if (abs(volCopyNo/100) > 3) {
121 stationPhi += abs(volCopyNo/100)-3;
123 stationPhi += abs(volCopyNo/100);
127 if (stationPhi <= 0) {
128 stationPhi = 24 - stationPhi;
131 }
else if (stationName.compare(2,1,
"E") == 0) {
132 if (stationName.compare(1,1,
"4") == 0) {
134 stationPhi = (abs(volCopyNo%100)-1)*3+abs(volCopyNo/100);
136 if (abs(volCopyNo%100) < 4) {
137 stationPhi = stationPhi - 1;
138 if (stationPhi <= 0) {
139 stationPhi = 21 - stationPhi;
141 }
else if(abs(volCopyNo%100) < 7) {
142 stationPhi = stationPhi - 1 - 1;
144 stationPhi = stationPhi - 2 - 1;
149 stationPhi = (abs(volCopyNo%100)-1)*6+abs(volCopyNo/100);
152 if (stationPhi <= 0) {
153 stationPhi = 48 - stationPhi;
159 }
else if ((npos = volName.find(
"tgccomponent")) != std::string::npos) {
160 int volCopyNo = abs(touchHist->GetVolume(i)->GetCopyNo());
161 stationEta = zside*volCopyNo%100;
162 if (volCopyNo > 1000) {
163 stationPhi = volCopyNo/1000;
167 }
else if ((npos = volName.find(
"Gas Volume Layer")) != std::string::npos) {
168 int volCopyNo = touchHist->GetVolume(i)->GetCopyNo();
169 int iStation = atoi(stationName.substr(1,1).c_str());
172 gasGap = 3-(volCopyNo-3)/4;
174 gasGap = 2-(volCopyNo-3)/4;
177 gasGap = (volCopyNo-3)/4+1;
181 }
else if ((npos = volName.find(
"TGCGas")) != std::string::npos) {
183 int volCopyNo = touchHist->GetVolume(i)->GetCopyNo();
212 aStep->GetTotalEnergyDeposit(),
213 aStep->GetStepLength());