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 - " 
  452 #if defined (DEBUG_HITS) || defined (DEBUG_MAPS) 
  453       G4cout << 
"LArG4::BarrelCryostat::CalibrationCalculator::CalibrationCalculator - " 
  454              << 
" numberOfVolumes=" << numberOfVolumes
 
  455              << 
", sizeof(volumes)=" << 
sizeof(volumes)
 
  465 #if defined (DEBUG_HITS) || defined (DEBUG_MAPS) 
  466       G4cout << 
"LArG4::BarrelCryostat::CalibrationCalculator::CalibrationCalculator - " 
  468              << 
"   initialization complete; map size=" 
  473       return StatusCode::SUCCESS;
 
  477                                           std::vector<G4double> & energies,
 
  488         for (
unsigned int i=0; 
i != 4; 
i++) energies.push_back( 0. );
 
  499           G4VPhysicalVolume* physical = 
step->GetPreStepPoint()->GetPhysicalVolume();
 
  500           G4int copyNumber = physical->GetCopyNo();
 
  501           G4String volumeName = physical->GetLogicalVolume()->GetName();
 
  504           G4cout << 
"LArG4::BarrelCryostat::CalibrationCalculator::Process - " 
  506                  << 
"   searching for volume '" 
  513           if(volumeName.find(
"LArMgr::") == 0) volumeName.erase(0,8);
 
  514           if(volumeName.find(
"LAr::Barrel::Cryostat::Sector")==0) { 
 
  515             volumeName = 
"LAr::Barrel::Cryostat::Sector";
 
  516             if(copyNumber != 7 && copyNumber !=12) copyNumber=1; 
 
  517           }
else if(volumeName.find(
"LAr::Barrel::Cryostat::Cylinder")==0){
 
  518             volumeName = 
"LAr::Barrel::Cryostat::Cylinder";
 
  519           }
else if(volumeName.find(
"LAr::Barrel::Cryostat::InnerWall")==0){
 
  520             volumeName = 
"LAr::Barrel::Cryostat::InnerWall";
 
  525           const auto v = 
volumeMap().find( volumeName );
 
  536               const auto i = identifierMap.find( copyNumber );
 
  538               if ( 
i != identifierMap.end() )
 
  544                   G4StepPoint* pre_step_point = 
step->GetPreStepPoint();
 
  545                   G4StepPoint* post_step_point = 
step->GetPostStepPoint();
 
  546                   G4ThreeVector startPoint = pre_step_point->GetPosition();
 
  547                   G4ThreeVector endPoint   = post_step_point->GetPosition();
 
  548                   G4ThreeVector 
p = (startPoint + endPoint) * 0.5;
 
  554                   G4double 
eta = fabs( 
p.pseudoRapidity() );
 
  555                   G4double 
phi = 
p.phi();
 
  565                   G4int regions = 
info->numberOfRegions;
 
  569                   G4cout << 
"LArG4::BarrelCryostat::CalibrationCalculator::Process - " 
  571                          << 
"   found volume, number of regions=" 
  573                          << 
" eta=" << 
eta << 
" phi=" << 
phi 
  578                   for ( 
r = 0; 
r < regions; 
r++, region++ )
 
  596                       G4int phiInteger = G4int( 
phi / region->
deltaPhi );
 
  598                       if (phiInteger > 63) phiInteger = 0;
 
  601                       G4cout << 
"LArG4::BarrelCryostat::CalibrationCalculator::Process - " 
  605                              << 
" eta bin=" << etaInteger << 
" phi bin=" << phiInteger
 
  611                       G4int subDetSign = 1;
 
  612                       if ( 
p.z() < 0 ) subDetSign = -1;
 
  615                       if ( etaInteger >= 0 )
 
  619                                      << 
info->subdet * subDetSign
 
  636 #if defined (DEBUG_HITS) || defined (DEBUG_VOLUMES) 
  637               std::cout << 
"LArG4::BarrelCryostat::CalibrationCalculator::Process" 
  643                         << 
" not found on tables, using backup calculator" 
  652       std::cout << 
"LArG4::BarrelCryostat::CalibrationCalculator::Process" 
  653                 << 
" vName " <<  
step->GetPreStepPoint()->GetPhysicalVolume()->GetName()
 
  656                 << 
" energies=(" << energies[0]
 
  657                 << 
"," << energies[1]
 
  658                 << 
"," << energies[2]
 
  659                 << 
"," << energies[3] << 
")"