13 #include "TRT_G4Utilities/TRTParameters.hh" 
   16 #include "G4AffineTransform.hh" 
   17 #include "G4NavigationHistory.hh" 
   19 #include "G4StepPoint.hh" 
   20 #include "G4ThreeVector.hh" 
   21 #include "G4TouchableHandle.hh" 
   22 #include "G4TouchableHistory.hh" 
   33   m_barrelIdentifier(0),
 
   34   m_testLocalCoordinatesOfHits(0),
 
   35   m_numberOfStrawLayersA(0),
 
   36   m_numberOfStrawLayersB(0),
 
   37   m_numberOfStrawLayersC(0),
 
   41   m_integralDistributionOfStrawsA(nullptr),
 
   42   m_integralDistributionOfStrawsB(nullptr),
 
   43   m_integralDistributionOfStrawsC(nullptr),
 
   44   m_strawIDToLayerIDA(nullptr),
 
   45   m_strawIDToLayerIDB(nullptr),
 
   46   m_strawIDToLayerIDC(nullptr),
 
   47   m_pParameters(nullptr),
 
   48   m_pSensitiveDetector(pSensitiveDet),
 
   49   m_verboseLevel(pSensitiveDet->verboseLevel)
 
   55   if (
m_verboseLevel>5) { G4cout << 
"##### Constructor TRTProcessingOfBarrelHits" << G4endl; }
 
   61   if (
m_verboseLevel>5) { G4cout << 
"##### Constructor TRTProcessingOfBarrelHits done" << G4endl; }
 
   70   if (
m_verboseLevel>5) { G4cout << 
"##### Destructor TRTProcessingOfBarrelHits" << G4endl; }
 
   74   if (
m_verboseLevel>5) { G4cout << 
"##### Destructor TRTProcessingOfBarrelHits done" << G4endl; }
 
   83   if (
m_verboseLevel>5) { G4cout << 
"######### Method TRTProcessingOfBarrelHits::Initialize" << G4endl; }
 
  117   if (
m_verboseLevel>5) { G4cout << 
"######### Method TRTProcessingOfBarrelHits::Initialize done" << G4endl; }
 
  125   G4StepPoint* pPreStepPoint = pStep->GetPreStepPoint();
 
  127   G4TouchableHandle pTouchableHandle = pPreStepPoint->GetTouchableHandle();
 
  130   int gasID = pTouchableHandle->GetReplicaNumber();
 
  131   int strawID = pTouchableHandle->GetReplicaNumber(
depth++);
 
  132   int ringID = pTouchableHandle->GetReplicaNumber(
depth++);
 
  133   int moduleID = pTouchableHandle->GetReplicaNumber(
depth);
 
  135   int hitID = gasID % 2;
 
  137   G4Track* pTrack = pStep->GetTrack();
 
  141   G4ThreeVector globalPreStepPoint = pPreStepPoint->GetPosition();
 
  143   G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
 
  144   G4ThreeVector globalPostStepPoint = pPostStepPoint->GetPosition();
 
  147   const G4TouchableHistory* pTouchableHistory =
 
  148     static_cast<const G4TouchableHistory*
>(pPreStepPoint->GetTouchable());
 
  150   const G4AffineTransform& topTransform = pTouchableHistory->GetHistory()->
 
  153   G4ThreeVector localPreStepPoint = topTransform.TransformPoint(globalPreStepPoint);
 
  154   G4ThreeVector localPostStepPoint = topTransform.TransformPoint(globalPostStepPoint);
 
  156   double preStepZ = localPreStepPoint.z();
 
  157   double postStepZ = localPostStepPoint.z();
 
  160   double preStepX = localPreStepPoint.x();
 
  161   double preStepY = localPreStepPoint.y();
 
  163   double postStepX = localPostStepPoint.x();
 
  164   double postStepY = localPostStepPoint.y();
 
  168       double preStepR = std::sqrt(preStepX * preStepX + preStepY * preStepY);
 
  169       double postStepR = std::sqrt(postStepX * postStepX + postStepY * postStepY);
 
  171       if (preStepR > 2.0000001 || postStepR > 2.0000001)
 
  177           std::cout << 
"!!!!! Barrel. Error in local coordinates of hits!" << std::endl;
 
  178           std::cout << 
"  barrelID=" << hitID << 
"  ringID=" << ringID
 
  179                     << 
"  moduleID=" << moduleID << 
"  strawID=" << strawID
 
  180                     << 
"  trackID=" << trHelp.
GetUniqueID() << std::endl;
 
  181           std::cout << 
"  particleEncoding=" << particleEncoding;
 
  183           if (kineticEnergy < 0.0001)
 
  184             std::cout << 
"  kineticEnergy=" << kineticEnergy * 1000000. << 
" eV";
 
  185           else if (kineticEnergy < 0.1)
 
  186             std::cout << 
"  kineticEnergy=" << kineticEnergy * 1000. << 
" keV";
 
  187           else if (kineticEnergy >= 100.)
 
  188             std::cout << 
"  kineticEnergy=" << kineticEnergy / 1000. << 
" GeV";
 
  189           else if (kineticEnergy >= 100000.)
 
  190             std::cout << 
"  kineticEnergy=" << kineticEnergy / 1000000. << 
" TeV";
 
  192             std::cout << 
"  kineticEnergy=" << kineticEnergy << 
" MeV";
 
  195             std::cout << 
"  energyDeposit=" << 
energyDeposit * 1000. << 
" eV" 
  198             std::cout << 
"  energyDeposit=" << 
energyDeposit / 1000. << 
" MeV" 
  201             std::cout << 
"  energyDeposit=" << 
energyDeposit << 
" keV" << std::endl;
 
  203           std::cout << 
"  preStepX=" << preStepX << 
" mm  preStepY=" << preStepY
 
  204                     << 
" mm  preStepR=" << preStepR << 
" mm" << std::endl;
 
  205           std::cout << 
"  postStepX=" << postStepX << 
" mm  postStepY=" << postStepY
 
  206                     << 
" mm  postStepR=" << postStepR << 
" mm" << std::endl << std::endl;
 
  210   double preStepGlobalTime = pPreStepPoint->GetGlobalTime();
 
  211   double postStepGlobalTime = pPostStepPoint->GetGlobalTime();
 
  212   double globalTime = (preStepGlobalTime + postStepGlobalTime) / 2.;
 
  222   hitID += (ringID << 15);
 
  223   hitID += (moduleID << 10);
 
  224   hitID += (layerID << 5);
 
  273   else if (ringID == 1)
 
  339   else if (ringID == 1)
 
  361   if (
m_verboseLevel>5) { G4cout << 
"######### Method TRTProcessingOfBarrelHits::DeleteArrays" << G4endl; }
 
  374   if (
m_verboseLevel>5) { G4cout << 
"######### Method TRTProcessingOfBarrelHits::DeleteArrays done" << G4endl; }