1134 {
1135
1136 LArG4Identifier
result = LArG4Identifier();
1137
1138
1139
1140 const G4StepPoint *thisStepPoint = a_step->GetPreStepPoint();
1141 const G4StepPoint *thisStepBackPoint = a_step->GetPostStepPoint();
1142 const G4ThreeVector startPoint = thisStepPoint->GetPosition();
1143 const G4ThreeVector endPoint = thisStepBackPoint->GetPosition();
1144 const G4ThreeVector
p = (thisStepPoint->GetPosition() + thisStepBackPoint->GetPosition()) * 0.5;
1145
1146#ifdef DEBUGHITS
1147 ATH_MSG_VERBOSE(
"Position of the step in the ATLAS frame (x,y,z) --> " <<
p.x() <<
" " <<
p.y() <<
" " <<
p.z());
1148 ATH_MSG_VERBOSE(
"Eta and Phi in the ATLAS frame --> " <<
p.eta() <<
" " <<
p.phi());
1149#endif
1150
1151
1152
1153 const G4NavigationHistory* g4navigation = thisStepPoint->GetTouchable()->GetHistory();
1154 const G4AffineTransform transformation = g4navigation->GetTransform(indECAM);
1155 const G4ThreeVector startPointinLocal = transformation.TransformPoint(startPoint);
1156 const G4ThreeVector endPointinLocal = transformation.TransformPoint (endPoint);
1157 const G4ThreeVector midinLocal = (startPointinLocal+endPointinLocal)*0.5;
1158
1159#ifdef DEBUGHITS
1160 ATH_MSG_VERBOSE(
"Position of the step in the LOCAL frame (x,y,z) --> " << midinLocal.x() <<
" " << midinLocal.y() <<
" " << midinLocal.z());
1161 ATH_MSG_VERBOSE(
"Eta and Phi of the step in LOCAL frame --> " << midinLocal.eta() <<
" " << midinLocal.phi());
1162#endif
1163
1164
1165
1166 const G4double xZpos = midinLocal.x();
1167 const G4double yZpos = midinLocal.y();
1168 const G4double zZpos = midinLocal.z();
1169 const G4double etaZpos = midinLocal.pseudoRapidity();
1170 const G4double phiZpos = (midinLocal.phi()<0.) ? midinLocal.phi() + 2.*
M_PI : midinLocal.phi();
1171 const G4double radius2Zpos = xZpos*xZpos + yZpos*yZpos;
1172 const G4double radiusZpos = sqrt(radius2Zpos);
1173
1174 CalcData currentCellData;
1176 currentCellData.zSide = 1;
1177 }
1178 else {
1179 currentCellData.zSide = zside;
1180 }
1181
1182
1183
1184
1187
1188#ifdef DEBUGHITS
1190#endif
1191
1192
1193
1194
1195
1196 const bool MapDetail(false);
1197 this->
findCell( currentCellData, xZpos, yZpos, zZpos, radiusZpos, etaZpos, phiZpos, MapDetail );
1198
1199
1200
1201 if( currentCellData.zSide == -1 )
1202 {
1203 if( currentCellData.sampling == 1 && currentCellData.region ==0 )
1204 {
1205 currentCellData.phiBin = 31 - currentCellData.phiBin;
1206 if(currentCellData.phiBin < 0 ) currentCellData.phiBin += 64;
1207 }
1208 if( currentCellData.sampling == 1 && currentCellData.region ==1 )
1209 {
1210 currentCellData.phiBin = 127 - currentCellData.phiBin;
1211 if(currentCellData.phiBin < 0 ) currentCellData.phiBin += 256;
1212 }
1213 if( currentCellData.sampling >= 2 )
1214 {
1215 currentCellData.phiBin = 127 - currentCellData.phiBin;
1216 if(currentCellData.phiBin < 0 ) currentCellData.phiBin += 256;
1217 }
1218 }
1219
1220
1221
1222
1223 if (currentCellData.sampling==1 && currentCellData.region==0 && currentCellData.etaBin==0) {
1224 currentCellData.etaBin=1;
1225 }
1226
1228 << 1
1229 << currentCellData.zSide
1230 << currentCellData.sampling
1231 << currentCellData.region
1232 << currentCellData.etaBin
1233 << currentCellData.phiBin;
1234
1235#ifdef DEBUGHITS
1238 ATH_MSG_VERBOSE(
"currentCellData.zSide ----> " << currentCellData.zSide);
1239 ATH_MSG_VERBOSE(
"currentCellData.sampling ----> " << currentCellData.sampling);
1240 ATH_MSG_VERBOSE(
"currentCellData.region ----> " << currentCellData.region);
1241 ATH_MSG_VERBOSE(
"currentCellData.etaBin ----> " << currentCellData.etaBin);
1242 ATH_MSG_VERBOSE(
"currentCellData.phiBin ----> " << currentCellData.phiBin);
1243 ATH_MSG_VERBOSE(
"And also etafirst ----> " << thisStepPoint->GetPosition().pseudoRapidity());
1244#endif
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254 }
1255
1256 else {
1257
1258 G4int sampling=0;
1259 G4int region=0;
1260 const G4int numDeadPhiBins = 64;
1261 double abs_eta = std::fabs(etaZpos);
1262 const double DM1EtaWidth = 0.1 ;
1263 const double DM1PhiWidth = 2.*
M_PI / numDeadPhiBins ;
1264 currentCellData.etaBin = (G4int) ( abs_eta * (1./DM1EtaWidth) ) ;
1265 currentCellData.phiBin = (G4int) (phiZpos/ DM1PhiWidth );
1267
1268 if (currentCellData.phiBin==numDeadPhiBins) currentCellData.phiBin=currentCellData.phiBin-1;
1269
1270
1271
1272 if ( currentCellData.zSide == -1 ) {
1273 currentCellData.phiBin = 31 - currentCellData.phiBin;
1274 if (currentCellData.phiBin < 0 ) currentCellData.phiBin +=64 ;
1275 }
1276
1277
1279 sampling =1 ;
1280 region = 3 ;
1281 if (currentCellData.etaBin > 14) currentCellData.etaBin=14;
1282
1283#ifdef DEBUGHITS
1284 ATH_MSG_VERBOSE(
"This hit is in the ECAM volume in front of the accordion (DEAD MATERIAL) !!!!! ");
1285#endif
1286
1288 sampling = 2;
1289
1290 if (abs_eta < 1.0 ) {
1291 region = 0 ;
1292#ifdef DEBUGHITS
1293 ATH_MSG_VERBOSE(
"This hit is in the ECAM volume behind accordion (DEAD MATERIAL 0) !!!!! ");
1294#endif
1295 } else if ( abs_eta >= 1.0 && abs_eta < 1.5) {
1296 region = 2;
1297 currentCellData.etaBin = currentCellData.etaBin - 10;
1298#ifdef DEBUGHITS
1299 ATH_MSG_VERBOSE(
"This hit is in the ECAM volume behind accordion (DEAD MATERIAL 2) !!!!! ");
1300#endif
1301 } else {
1302 ATH_MSG_ERROR(
" LArBarrelGeometry: hit behind accordion at eta>1.5 !!! ");
1303 region = 2;
1304 currentCellData.etaBin = 4;
1305 }
1306
1309 region=0;
1310 const G4int phisave=currentCellData.phiBin;
1311 const G4bool MapDetail(false);
1312 this->
findCell( currentCellData, xZpos, yZpos, zZpos, radiusZpos, etaZpos, phiZpos, MapDetail );
1313 sampling = currentCellData.sampling;
1314 currentCellData.etaBin=0;
1315 currentCellData.phiBin=phisave;
1316
1318 if (abs_eta >1.0 && abs_eta < 1.5) {
1319 sampling=2;
1320 region=2;
1321 currentCellData.etaBin = currentCellData.etaBin - 10;
1322 } else if (abs_eta < 1.6) {
1323 sampling=1;
1324 region=4;
1325 currentCellData.etaBin=0;
1326 } else {
1328 sampling=1;
1329 region=4;
1330 currentCellData.etaBin=0;
1331 }
1332 } else {
1334 const G4double thisStepEnergyDeposit = a_step->GetTotalEnergyDeposit() * a_step->GetTrack()->GetWeight();
1335 std::ostringstream dmLog;
1336 dmLog << "LArBarrelGeometry: cannot find region for DM hit..." << std::endl;
1337 dmLog << "LArBarrelGeometry: cannot find region for DM hit..." << std::endl;
1338 dmLog <<
"m_zMinBarrel: " <<
m_zMinBarrel << std::endl;
1339 dmLog <<
"m_zMaxBarrel: " <<
m_zMaxBarrel << std::endl;
1342 dmLog << "r,z,eta,phi " << radiusZpos << " " << zZpos << " " << etaZpos << " " << phiZpos << std::endl;
1343 dmLog <<
"x,y,z (Atlas) " <<
p.x() <<
" " <<
p.y() <<
" " <<
p.z() << std::endl;
1344 dmLog << " inSTAC " << inSTAC << std::endl;
1345 dmLog << " eDeposited " << thisStepEnergyDeposit << std::endl;
1346 const G4VPhysicalVolume* vol = thisStepPoint->GetPhysicalVolume();
1347 const G4String volName = vol->GetName();
1348 dmLog << " volName " << volName << std::endl;
1349 const G4int ndep = g4navigation->GetDepth();
1350 for (G4int ii=0;ii<=ndep;ii++) {
1351 const G4VPhysicalVolume* v1 = g4navigation->GetVolume(ii);
1352 const G4String vname = v1->GetName();
1353 dmLog << "vname " << vname << std::endl;
1354 }
1355 if (thisStepEnergyDeposit > 1.*CLHEP::MeV) {
1357 } else {
1359 }
1360 }
1361
1362
1363 else
1364 {
1365 G4bool MapDetail=false;
1366 this->
findCell( currentCellData, xZpos, yZpos, zZpos, radiusZpos, etaZpos, phiZpos, MapDetail );
1367
1368
1369
1370
1371 if (currentCellData.sampling==1 && currentCellData.region==0 && currentCellData.etaBin==0) {
1372 currentCellData.etaBin=1;
1373
1374
1375 }
1377 << 1
1378 << currentCellData.zSide
1379 << currentCellData.sampling
1380 << currentCellData.region
1381 << currentCellData.etaBin
1382 << currentCellData.phiBin;
1384 }
1385 }
1386
1388 << currentCellData.zSide * 4
1390 << sampling
1391 << region
1392 << currentCellData.etaBin
1393 << currentCellData.phiBin;
1394
1395#ifdef DEBUGHITS
1396 ATH_MSG_VERBOSE(
"Here the identifier for the barrel DEAD materials ---->");
1403#endif
1404
1405
1406
1407
1408
1409
1410
1411
1412 }
1413
1415
1416 }
#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