1004 {
1005
1006 LArG4Identifier
result = LArG4Identifier();
1007
1008
1009
1010 const G4StepPoint *thisStepPoint = a_step->GetPreStepPoint();
1011 const G4StepPoint *thisStepBackPoint = a_step->GetPostStepPoint();
1012 const G4ThreeVector startPoint = thisStepPoint->GetPosition();
1013 const G4ThreeVector endPoint = thisStepBackPoint->GetPosition();
1014 const G4ThreeVector
p = (thisStepPoint->GetPosition() + thisStepBackPoint->GetPosition()) * 0.5;
1015
1016#ifdef DEBUGHITS
1017 ATH_MSG_VERBOSE(
"Position of the step in the ATLAS frame (x,y,z) --> " <<
p.x() <<
" " <<
p.y() <<
" " <<
p.z());
1018 ATH_MSG_VERBOSE(
"Eta and Phi in the ATLAS frame --> " <<
p.eta() <<
" " <<
p.phi());
1019#endif
1020
1021
1022
1023 const G4NavigationHistory* g4navigation = thisStepPoint->GetTouchable()->GetHistory();
1024 const G4AffineTransform transformation = g4navigation->GetTransform(indECAM);
1025 const G4ThreeVector startPointinLocal = transformation.TransformPoint(startPoint);
1026 const G4ThreeVector endPointinLocal = transformation.TransformPoint (endPoint);
1027 const G4ThreeVector midinLocal = (startPointinLocal+endPointinLocal)*0.5;
1028
1029#ifdef DEBUGHITS
1030 ATH_MSG_VERBOSE(
"Position of the step in the LOCAL frame (x,y,z) --> " << midinLocal.x() <<
" " << midinLocal.y() <<
" " << midinLocal.z());
1031 ATH_MSG_VERBOSE(
"Eta and Phi of the step in LOCAL frame --> " << midinLocal.eta() <<
" " << midinLocal.phi());
1032#endif
1033
1034
1035
1036 const G4double xZpos = midinLocal.x();
1037 const G4double yZpos = midinLocal.y();
1038 const G4double zZpos = midinLocal.z();
1039 const G4double etaZpos = midinLocal.pseudoRapidity();
1040 const G4double phiZpos = (midinLocal.phi()<0.) ? midinLocal.phi() + 2.*
M_PI : midinLocal.phi();
1041 const G4double radius2Zpos = xZpos*xZpos + yZpos*yZpos;
1042 const G4double radiusZpos = sqrt(radius2Zpos);
1043
1044 CalcData currentCellData;
1046 currentCellData.zSide = 1;
1047 }
1048 else {
1049 currentCellData.zSide = zside;
1050 }
1051
1052
1053
1054
1057
1058#ifdef DEBUGHITS
1060#endif
1061
1062
1063
1064
1065
1066 const bool MapDetail(false);
1067 this->
findCell( currentCellData, xZpos, yZpos, zZpos, radiusZpos, etaZpos, phiZpos, MapDetail );
1068
1069
1070
1071 if( currentCellData.zSide == -1 )
1072 {
1073 if( currentCellData.sampling == 1 && currentCellData.region ==0 )
1074 {
1075 currentCellData.phiBin = 31 - currentCellData.phiBin;
1076 if(currentCellData.phiBin < 0 ) currentCellData.phiBin += 64;
1077 }
1078 if( currentCellData.sampling == 1 && currentCellData.region ==1 )
1079 {
1080 currentCellData.phiBin = 127 - currentCellData.phiBin;
1081 if(currentCellData.phiBin < 0 ) currentCellData.phiBin += 256;
1082 }
1083 if( currentCellData.sampling >= 2 )
1084 {
1085 currentCellData.phiBin = 127 - currentCellData.phiBin;
1086 if(currentCellData.phiBin < 0 ) currentCellData.phiBin += 256;
1087 }
1088 }
1089
1090
1091
1092
1093 if (currentCellData.sampling==1 && currentCellData.region==0 && currentCellData.etaBin==0) {
1094 currentCellData.etaBin=1;
1095 }
1096
1098 << 1
1099 << currentCellData.zSide
1100 << currentCellData.sampling
1101 << currentCellData.region
1102 << currentCellData.etaBin
1103 << currentCellData.phiBin;
1104
1105#ifdef DEBUGHITS
1108 ATH_MSG_VERBOSE(
"currentCellData.zSide ----> " << currentCellData.zSide);
1109 ATH_MSG_VERBOSE(
"currentCellData.sampling ----> " << currentCellData.sampling);
1110 ATH_MSG_VERBOSE(
"currentCellData.region ----> " << currentCellData.region);
1111 ATH_MSG_VERBOSE(
"currentCellData.etaBin ----> " << currentCellData.etaBin);
1112 ATH_MSG_VERBOSE(
"currentCellData.phiBin ----> " << currentCellData.phiBin);
1113 ATH_MSG_VERBOSE(
"And also etafirst ----> " << thisStepPoint->GetPosition().pseudoRapidity());
1114#endif
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124 }
1125
1126 else {
1127
1128 G4int sampling=0;
1129 G4int region=0;
1130 const G4int numDeadPhiBins = 64;
1131 double abs_eta = std::fabs(etaZpos);
1132 const double DM1EtaWidth = 0.1 ;
1133 const double DM1PhiWidth = 2.*
M_PI / numDeadPhiBins ;
1134 currentCellData.etaBin = (G4int) ( abs_eta * (1./DM1EtaWidth) ) ;
1135 currentCellData.phiBin = (G4int) (phiZpos/ DM1PhiWidth );
1137
1138 if (currentCellData.phiBin==numDeadPhiBins) currentCellData.phiBin=currentCellData.phiBin-1;
1139
1140
1141
1142 if ( currentCellData.zSide == -1 ) {
1143 currentCellData.phiBin = 31 - currentCellData.phiBin;
1144 if (currentCellData.phiBin < 0 ) currentCellData.phiBin +=64 ;
1145 }
1146
1147
1149 sampling =1 ;
1150 region = 3 ;
1151 if (currentCellData.etaBin > 14) currentCellData.etaBin=14;
1152
1153#ifdef DEBUGHITS
1154 ATH_MSG_VERBOSE(
"This hit is in the ECAM volume in front of the accordion (DEAD MATERIAL) !!!!! ");
1155#endif
1156
1158 sampling = 2;
1159
1160 if (abs_eta < 1.0 ) {
1161 region = 0 ;
1162#ifdef DEBUGHITS
1163 ATH_MSG_VERBOSE(
"This hit is in the ECAM volume behind accordion (DEAD MATERIAL 0) !!!!! ");
1164#endif
1165 } else if ( abs_eta >= 1.0 && abs_eta < 1.5) {
1166 region = 2;
1167 currentCellData.etaBin = currentCellData.etaBin - 10;
1168#ifdef DEBUGHITS
1169 ATH_MSG_VERBOSE(
"This hit is in the ECAM volume behind accordion (DEAD MATERIAL 2) !!!!! ");
1170#endif
1171 } else {
1172 ATH_MSG_ERROR(
" LArBarrelGeometry: hit behind accordion at eta>1.5 !!! ");
1173 region = 2;
1174 currentCellData.etaBin = 4;
1175 }
1176
1179 region=0;
1180 const G4int phisave=currentCellData.phiBin;
1181 const G4bool MapDetail(false);
1182 this->
findCell( currentCellData, xZpos, yZpos, zZpos, radiusZpos, etaZpos, phiZpos, MapDetail );
1183 sampling = currentCellData.sampling;
1184 currentCellData.etaBin=0;
1185 currentCellData.phiBin=phisave;
1186
1188 if (abs_eta >1.0 && abs_eta < 1.5) {
1189 sampling=2;
1190 region=2;
1191 currentCellData.etaBin = currentCellData.etaBin - 10;
1192 } else if (abs_eta < 1.6) {
1193 sampling=1;
1194 region=4;
1195 currentCellData.etaBin=0;
1196 } else {
1198 sampling=1;
1199 region=4;
1200 currentCellData.etaBin=0;
1201 }
1202 } else {
1204 const G4double thisStepEnergyDeposit = a_step->GetTotalEnergyDeposit() * a_step->GetTrack()->GetWeight();
1205 std::ostringstream dmLog;
1206 dmLog << "LArBarrelGeometry: cannot find region for DM hit..." << std::endl;
1207 dmLog << "LArBarrelGeometry: cannot find region for DM hit..." << std::endl;
1208 dmLog <<
"m_zMinBarrel: " <<
m_zMinBarrel << std::endl;
1209 dmLog <<
"m_zMaxBarrel: " <<
m_zMaxBarrel << std::endl;
1212 dmLog << "r,z,eta,phi " << radiusZpos << " " << zZpos << " " << etaZpos << " " << phiZpos << std::endl;
1213 dmLog <<
"x,y,z (Atlas) " <<
p.x() <<
" " <<
p.y() <<
" " <<
p.z() << std::endl;
1214 dmLog << " inSTAC " << inSTAC << std::endl;
1215 dmLog << " eDeposited " << thisStepEnergyDeposit << std::endl;
1216 const G4VPhysicalVolume* vol = thisStepPoint->GetPhysicalVolume();
1217 const G4String volName = vol->GetName();
1218 dmLog << " volName " << volName << std::endl;
1219 const G4int ndep = g4navigation->GetDepth();
1220 for (G4int ii=0;ii<=ndep;ii++) {
1221 const G4VPhysicalVolume* v1 = g4navigation->GetVolume(ii);
1222 const G4String vname = v1->GetName();
1223 dmLog << "vname " << vname << std::endl;
1224 }
1225 if (thisStepEnergyDeposit > 1.*CLHEP::MeV) {
1227 } else {
1229 }
1230 }
1231
1232
1233 else
1234 {
1235 G4bool MapDetail=false;
1236 this->
findCell( currentCellData, xZpos, yZpos, zZpos, radiusZpos, etaZpos, phiZpos, MapDetail );
1237
1238
1239
1240
1241 if (currentCellData.sampling==1 && currentCellData.region==0 && currentCellData.etaBin==0) {
1242 currentCellData.etaBin=1;
1243
1244
1245 }
1247 << 1
1248 << currentCellData.zSide
1249 << currentCellData.sampling
1250 << currentCellData.region
1251 << currentCellData.etaBin
1252 << currentCellData.phiBin;
1254 }
1255 }
1256
1258 << currentCellData.zSide * 4
1260 << sampling
1261 << region
1262 << currentCellData.etaBin
1263 << currentCellData.phiBin;
1264
1265#ifdef DEBUGHITS
1266 ATH_MSG_VERBOSE(
"Here the identifier for the barrel DEAD materials ---->");
1273#endif
1274
1275
1276
1277
1278
1279
1280
1281
1282 }
1283
1285
1286 }
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
double m_zMaxBarrelDMMargin
Gaudi::Property< bool > m_testbeam
virtual void findCell(CalcData ¤tCellData, const double &x, const double &y, const double &z, const double &r, const double &eta, const double &phi, const bool detail) const override final