6 #include "G4ThreeVector.hh"
10 #include "G4Geantino.hh"
11 #include "G4ChargedGeantino.hh"
21 : G4VSensitiveDetector(
name )
22 , m_myRPCHitColl( hitCollectionName )
32 if (verboseLevel>5) G4cout <<
"Initializing SD" << G4endl;
38 G4Track*
track = aStep->GetTrack();
41 if (
track->GetDefinition()->GetPDGCharge() == 0.0) {
42 if (
track->GetDefinition()!=G4Geantino::GeantinoDefinition()) {
47 const G4TouchableHistory* touchHist =
static_cast<const G4TouchableHistory*
>(aStep->GetPreStepPoint()->GetTouchable());
48 G4ThreeVector position = aStep->GetPreStepPoint()->GetPosition();
49 G4ThreeVector postPosition = aStep->GetPostStepPoint()->GetPosition();
50 const G4AffineTransform trans =
track->GetTouchable()->GetHistory()->GetTopTransform();
67 int station_rotated=0;
72 double globalTime = aStep->GetPreStepPoint()->GetGlobalTime();
79 bool isAssembly =
false;
81 for (
int i=touchHist->GetHistoryDepth();
i>=0;
i--) {
83 std::string::size_type npos;
84 std::string volName = touchHist->GetVolume(
i)->GetName();
85 std::string
num=volName.substr(3,2);
89 if ((npos = volName.find(
"av_")) != std::string::npos &&
90 (npos = volName.find(
"impr_")) != std::string::npos) isAssembly =
true;
93 if ((npos = volName.find(
"station")) != std::string::npos && (!isAssembly)) {
97 int volCopyNo = touchHist->GetVolume(
i)->GetCopyNo();
99 if(abs(volCopyNo/1000)==1){
101 volCopyNo=volCopyNo%1000;
107 if(
stationEta<0&&!zNeg_original) station_rotated=1;
110 }
else if ((npos = volName.find(
"RPC")) != std::string::npos && isAssembly) {
130 if ((
loc1 = volName.find(
"Muon::")) != std::string::npos) {
134 int volCopyNo = touchHist->GetVolume(
i)->GetCopyNo();
135 int copyNrBase =
int(volCopyNo/100000);
137 int zi =
int((copyNrBase%1000)/100);
138 int mirfl =
int((copyNrBase%10000)/1000);
139 int fi =
int(copyNrBase%100);
140 if (
sideC == 1) zi = -zi;
143 zNeg_original = mirfl;
145 if(
stationEta<0&&!zNeg_original) station_rotated=1;
148 tech=volName.substr(npos,5);
152 if ((
loc1 = volName.find(
'[')) != std::string::npos) {
153 if ((
loc2 = volName.find(
']',
loc1+1)) != std::string::npos) {
155 std::istringstream istrvar(volName.substr(
loc1+1,
loc2-
loc1-1));
161 if (
kk < 0) rpcIsRotated=1;
164 mydbZ = abs(
int(
kk%10));
165 mydbPMod = abs(
int(
kk/1000));
167 }
else if ((npos = volName.find(
"rpccomponent")) != std::string::npos && (!isAssembly)) {
170 tech=volName.substr(npos-5,5);
172 if ((
loc1 = volName.find(
'[')) != std::string::npos) {
173 if ((
loc2 = volName.find(
']',
loc1+1)) != std::string::npos) {
174 std::istringstream istrvar(volName.substr(
loc1+1,
loc2-
loc1-1));
178 mydbZ = abs(
int(gmID%10));
179 mydbPMod = abs(
int(gmID/1000));
181 int kk=touchHist->GetVolume(
i)->GetCopyNo();
183 if (
kk < 0) rpcIsRotated=1;
187 }
else if ((npos = volName.find(
"layer")) != std::string::npos) {
189 int copyNo = touchHist->GetVolume(
i)->GetCopyNo();
193 }
else if (copyNo ==2) {
195 }
else if (copyNo ==3) {
198 }
else if((npos = volName.find(
"gas volume")) != std::string::npos) {
200 int copyNo = touchHist->GetVolume(
i)->GetCopyNo();
203 }
else if (copyNo == 10) {
208 int nstrippanel_in_s=0;
209 std::string::size_type
loc1;
210 if ((
loc1 = volName.find(
"gg_in_s")) != std::string::npos) {
211 std::istringstream istrvar(volName.substr(
loc1-1,1));
214 if ((
loc1 = volName.find(
"sp_in_s")) != std::string::npos) {
215 std::istringstream istrvar(volName.substr(
loc1-1,1));
216 istrvar>>nstrippanel_in_s;
218 if (ngap_in_s == 1 && nstrippanel_in_s == 2) {
219 if(localPosition.y()>0) mydbP=2;
221 }
else if (ngap_in_s == 1 && nstrippanel_in_s == 1) {
235 if (mydbP>2) mydbP=1;
250 if (verboseLevel>5) {
251 G4cout <<
"hit in station "<<
stationName<<
" on technology "<<tech << G4endl;
267 aStep->GetTotalEnergyDeposit(),
268 aStep->GetStepLength(),
269 track->GetDefinition()->GetPDGEncoding(),
270 aStep->GetPreStepPoint()->GetKineticEnergy());
273 aStep->GetTotalEnergyDeposit(),
274 aStep->GetStepLength(),
275 track->GetDefinition()->GetPDGEncoding(),
276 aStep->GetPreStepPoint()->GetKineticEnergy());