36 #include "G4StepPoint.hh"
37 #include "G4VPhysicalVolume.hh"
38 #include "G4ThreeVector.hh"
47 namespace BarrelCryostat {
128 { { 0, 0.0, 1.5, 0.1,
M_PI/32. },
129 { 4, 1.5, 1.6, 0.1,
M_PI/32. },
130 { 5, 1.5, 1.8, 0.1,
M_PI/32. },
131 { 6, 1.3, 3.2, 0.1,
M_PI/32. } };
134 static const RegionInfo_t region011[] =
137 { { 1, 0.0, 1.5, 0.1,
M_PI/32. },
138 { 4, 1.5, 1.6, 0.1,
M_PI/32. },
139 { 5, 1.5, 1.8, 0.1,
M_PI/32. } };
142 static const RegionInfo_t region012[] =
145 { { 4, 1.5, 1.6, 0.1,
M_PI/32. },
146 { 5, 1.5, 1.8, 0.1,
M_PI/32. },
147 { 6, 1.3, 3.2, 0.1,
M_PI/32. } };
150 static const RegionInfo_t region020[] =
153 { { 0, 0.0, 1.0, 0.1,
M_PI/32. },
154 { 2, 1.0, 1.5, 0.1,
M_PI/32. } };
156 static const RegionInfo_t region021[] =
160 { { 1, 0.0, 1.0, 0.1,
M_PI/32. },
161 { 2, 1.0, 1.5, 0.1,
M_PI/32. } };
166 static const CopyNumberInfo_t info1[] =
180 sizeof(region010)/
sizeof(RegionInfo_t),
234 sizeof(region020)/
sizeof(RegionInfo_t),
240 sizeof(region021)/
sizeof(RegionInfo_t),
246 sizeof(region020)/
sizeof(RegionInfo_t),
252 sizeof(region021)/
sizeof(RegionInfo_t),
258 sizeof(region021)/
sizeof(RegionInfo_t),
273 sizeof(region020)/
sizeof(RegionInfo_t),
279 sizeof(region020)/
sizeof(RegionInfo_t),
284 static const CopyNumberInfo_t info2[] =
290 sizeof(region010)/
sizeof(RegionInfo_t),
295 static const CopyNumberInfo_t info3[] =
302 sizeof(region021)/
sizeof(RegionInfo_t),
308 sizeof(region021)/
sizeof(RegionInfo_t),
314 sizeof(region012)/
sizeof(RegionInfo_t),
340 static const VolumeInfo_t volume1 =
341 {
"LAr::Barrel::Cryostat::Cylinder",
342 sizeof(info1) /
sizeof(CopyNumberInfo_t),
351 static const VolumeInfo_t volume2 =
352 {
"LAr::Barrel::Cryostat::InnerWall",
353 sizeof(info2) /
sizeof(CopyNumberInfo_t),
357 static const VolumeInfo_t volume3 =
358 {
"LAr::Barrel::Cryostat::Sector",
359 sizeof(info3) /
sizeof(CopyNumberInfo_t),
369 static const VolumeInfo_t volumes[] = { volume1, volume2, volume3};
370 static const G4int numberOfVolumes =
sizeof(volumes) /
sizeof(VolumeInfo_t);
385 for (G4int
v = 0;
v != numberOfVolumes;
v++)
389 #if defined (DEBUG_HITS) || defined (DEBUG_MAPS)
390 G4cout <<
"LArG4::BarrelCryostat::CalibrationCalculator::CalibrationCalculator - "
405 copy <= copyInfo->copyNumberHigh;
408 #if defined (DEBUG_HITS) || defined (DEBUG_MAPS)
409 G4cout <<
"LArG4::BarrelCryostat::CalibrationCalculator::CalibrationCalculator - "
410 <<
" adding copy=" <<
copy
411 <<
" to identifierMap"
423 #if defined (DEBUG_HITS) || defined (DEBUG_MAPS)
424 G4cout <<
"LArG4::BarrelCryostat::CalibrationCalculator::CalibrationCalculator - "
445 , m_backupCalculator(
"BarrelCryostatCalibrationLArCalculator",
name)
454 #if defined (DEBUG_HITS) || defined (DEBUG_MAPS)
455 G4cout <<
"LArG4::BarrelCryostat::CalibrationCalculator::CalibrationCalculator - "
456 <<
" numberOfVolumes=" << numberOfVolumes
457 <<
", sizeof(volumes)=" <<
sizeof(volumes)
467 #if defined (DEBUG_HITS) || defined (DEBUG_MAPS)
468 G4cout <<
"LArG4::BarrelCryostat::CalibrationCalculator::CalibrationCalculator - "
470 <<
" initialization complete; map size="
475 return StatusCode::SUCCESS;
487 std::vector<G4double> & energies,
499 for (
unsigned int i=0;
i != 4;
i++) energies.push_back( 0. );
510 G4VPhysicalVolume* physical =
step->GetPreStepPoint()->GetPhysicalVolume();
511 G4int copyNumber = physical->GetCopyNo();
512 G4String volumeName = physical->GetLogicalVolume()->GetName();
515 G4cout <<
"LArG4::BarrelCryostat::CalibrationCalculator::Process - "
517 <<
" searching for volume '"
524 if(volumeName.find(
"LArMgr::") == 0) volumeName.erase(0,8);
525 if(volumeName.find(
"LAr::Barrel::Cryostat::Sector")==0) {
526 volumeName =
"LAr::Barrel::Cryostat::Sector";
527 if(copyNumber != 7 && copyNumber !=12) copyNumber=1;
528 }
else if(volumeName.find(
"LAr::Barrel::Cryostat::Cylinder")==0){
529 volumeName =
"LAr::Barrel::Cryostat::Cylinder";
530 }
else if(volumeName.find(
"LAr::Barrel::Cryostat::InnerWall")==0){
531 volumeName =
"LAr::Barrel::Cryostat::InnerWall";
536 const auto v =
volumeMap().find( volumeName );
547 const auto i = identifierMap.find( copyNumber );
549 if (
i != identifierMap.end() )
555 G4StepPoint* pre_step_point =
step->GetPreStepPoint();
556 G4StepPoint* post_step_point =
step->GetPostStepPoint();
557 G4ThreeVector startPoint = pre_step_point->GetPosition();
558 G4ThreeVector endPoint = post_step_point->GetPosition();
559 G4ThreeVector
p = (startPoint + endPoint) * 0.5;
565 G4double eta = fabs(
p.pseudoRapidity() );
566 G4double phi =
p.phi();
570 if ( phi < 0 ) phi += 2*
M_PI;
576 G4int regions =
info->numberOfRegions;
580 G4cout <<
"LArG4::BarrelCryostat::CalibrationCalculator::Process - "
582 <<
" found volume, number of regions="
584 <<
" eta=" << eta <<
" phi=" << phi
589 for (
r = 0;
r < regions;
r++, region++ )
591 if ( eta > region->
etaMin &&
606 G4int etaInteger = G4int( (eta - region->
etaMin) / region->
deltaEta );
607 G4int phiInteger = G4int( phi / region->
deltaPhi );
609 if (phiInteger > 63) phiInteger = 0;
612 G4cout <<
"LArG4::BarrelCryostat::CalibrationCalculator::Process - "
616 <<
" eta bin=" << etaInteger <<
" phi bin=" << phiInteger
622 G4int subDetSign = 1;
623 if (
p.z() < 0 ) subDetSign = -1;
626 if ( etaInteger >= 0 )
630 <<
info->subdet * subDetSign
647 #if defined (DEBUG_HITS) || defined (DEBUG_VOLUMES)
648 std::cout <<
"LArG4::BarrelCryostat::CalibrationCalculator::Process"
654 <<
" not found on tables, using backup calculator"
663 std::cout <<
"LArG4::BarrelCryostat::CalibrationCalculator::Process"
664 <<
" vName " <<
step->GetPreStepPoint()->GetPhysicalVolume()->GetName()
667 <<
" energies=(" << energies[0]
668 <<
"," << energies[1]
669 <<
"," << energies[2]
670 <<
"," << energies[3] <<
")"