Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // 27 // 27 // 28 // ------------------------------------------- 28 // -------------------------------------------------------------------- 29 // GEANT4 class header file 29 // GEANT4 class header file 30 // 30 // 31 // Class Description: 31 // Class Description: 32 // Base class for a clipboard for communicatin 32 // Base class for a clipboard for communicating between quantum entangled tracks. 33 // 33 // 34 // ------------------ G4VEntanglementClipBoard 34 // ------------------ G4VEntanglementClipBoard ------------------ 35 // 35 // 36 // Author: J.Allison, May 2017 36 // Author: J.Allison, May 2017 37 // 37 // 38 // ------------------------------------------- 38 // -------------------------------------------------------------------- 39 39 40 // Usage: 40 // Usage: 41 // 41 // 42 // In the method that generates entangled seco 42 // In the method that generates entangled secondaries 43 // (See, for example, G4eplusAnnihilation::AtR 43 // (See, for example, G4eplusAnnihilation::AtRestDoIt) 44 // Make a shared pointer to a clip board and a 44 // Make a shared pointer to a clip board and attach it to the tracks through 45 // G4EntanglementAuxInfo. That way the clip bo 45 // G4EntanglementAuxInfo. That way the clip board lasts the life of both tracks. 46 // (G4XXXEntanglementClipBoard is your class i 46 // (G4XXXEntanglementClipBoard is your class inherited from this class) 47 // (See, for example, G4eplusAnnihilationEntan 47 // (See, for example, G4eplusAnnihilationEntanglementClipBoard) 48 // auto clipBoard = std::make_shared<G4XXXEnt 48 // auto clipBoard = std::make_shared<G4XXXEntanglementClipBoard>(); 49 // For each secondary 49 // For each secondary 50 // G4Track* track = new G4Track(... 50 // G4Track* track = new G4Track(... 51 // ... 51 // ... 52 // clipBoard->SetTrackA(track); 52 // clipBoard->SetTrackA(track); 53 // track->SetAuxiliaryTrackInformation(0,new 53 // track->SetAuxiliaryTrackInformation(0,new G4EntanglementAuxInfo(clipBoard)); 54 // Then repeat for track B 54 // Then repeat for track B 55 // 55 // 56 // In the method that does the quantum "measur 56 // In the method that does the quantum "measurement" 57 // (See, for example, G4LivermorePolarizedComp 57 // (See, for example, G4LivermorePolarizedComptonModel::SampleSecondaries) 58 // const auto* auxInfo = fParticleChange->Get 58 // const auto* auxInfo = fParticleChange->GetCurrentTrack()->GetAuxiliaryTrackInformation(0); 59 // if (auxInfo) { 59 // if (auxInfo) { 60 // const auto* entanglementAuxInfo = dynami 60 // const auto* entanglementAuxInfo = dynamic_cast<const G4EntanglementAuxInfo*>(auxInfo); 61 // if (entanglementAuxInfo) { 61 // if (entanglementAuxInfo) { 62 // auto* clipBoard = dynamic_cast<G4XXXEn 62 // auto* clipBoard = dynamic_cast<G4XXXEntanglementClipBoard*> 63 // (entanglementAuxInfo->GetEntanglementC 63 // (entanglementAuxInfo->GetEntanglementClipBoard()); 64 // if (clipBoard) { 64 // if (clipBoard) { 65 // if (clipBoard->IsTrack1Measurement() 65 // if (clipBoard->IsTrack1Measurement()) { 66 // if (clipBoard->GetTrackB() == fPar 66 // if (clipBoard->GetTrackB() == fParticleChange->GetCurrentTrack()) { 67 // clipBoard->ResetTrack1Measuremen 67 // clipBoard->ResetTrack1Measurement(); 68 // // Store information 68 // // Store information 69 // ... 69 // ... 70 // } 70 // } 71 // } else if (clipBoard->IsTrack2Measur 71 // } else if (clipBoard->IsTrack2Measurement()) { 72 // if (clipBoard->GetTrackA() == fPar 72 // if (clipBoard->GetTrackA() == fParticleChange->GetCurrentTrack()) { 73 // clipBoard->ResetTrack2Measuremen 73 // clipBoard->ResetTrack2Measurement(); 74 // // Retrieve information and appl 74 // // Retrieve information and apply quantum mechanics 75 // ... 75 // ... 76 // } 76 // } 77 // } 77 // } 78 // } 78 // } 79 // } 79 // } 80 // } 80 // } 81 81 82 #ifndef G4VEntanglementClipBoard_hh 82 #ifndef G4VEntanglementClipBoard_hh 83 #define G4VEntanglementClipBoard_hh 83 #define G4VEntanglementClipBoard_hh 84 84 85 #include "globals.hh" 85 #include "globals.hh" 86 86 87 class G4ParticleDefinition; 87 class G4ParticleDefinition; 88 class G4Track; 88 class G4Track; 89 89 90 class G4VEntanglementClipBoard { 90 class G4VEntanglementClipBoard { 91 91 92 public: 92 public: 93 93 94 G4VEntanglementClipBoard() 94 G4VEntanglementClipBoard() 95 : fpParentParticleDefinition(0) 95 : fpParentParticleDefinition(0) 96 , fTrackA(0) 96 , fTrackA(0) 97 , fTrackB(0) 97 , fTrackB(0) 98 , fTrack1Measurement(true) 98 , fTrack1Measurement(true) 99 , fTrack2Measurement(true) 99 , fTrack2Measurement(true) 100 {} 100 {} 101 virtual ~G4VEntanglementClipBoard() {} 101 virtual ~G4VEntanglementClipBoard() {} 102 102 103 void SetParentParticleDefinition(G4ParticleD 103 void SetParentParticleDefinition(G4ParticleDefinition* p) 104 {fpParentParticleDefinition = p;} 104 {fpParentParticleDefinition = p;} 105 G4ParticleDefinition* GetParentParticleDefin 105 G4ParticleDefinition* GetParentParticleDefinition() const 106 {return fpParentParticleDefinition;} 106 {return fpParentParticleDefinition;} 107 107 108 void SetTrackA(const G4Track* track) {fTrack 108 void SetTrackA(const G4Track* track) {fTrackA = track;} 109 void SetTrackB(const G4Track* track) {fTrack 109 void SetTrackB(const G4Track* track) {fTrackB = track;} 110 const G4Track* GetTrackA() const {return fTr 110 const G4Track* GetTrackA() const {return fTrackA;} 111 const G4Track* GetTrackB() const {return fTr 111 const G4Track* GetTrackB() const {return fTrackB;} 112 112 113 // The entanglement-sensitive process is res 113 // The entanglement-sensitive process is responsible for setting this. 114 void ResetTrack1Measurement() {fTrack1Measur 114 void ResetTrack1Measurement() {fTrack1Measurement = false;} 115 void ResetTrack2Measurement() {fTrack2Measur 115 void ResetTrack2Measurement() {fTrack2Measurement = false;} 116 G4bool IsTrack1Measurement() const {return f 116 G4bool IsTrack1Measurement() const {return fTrack1Measurement;} 117 G4bool IsTrack2Measurement() const {return f 117 G4bool IsTrack2Measurement() const {return fTrack2Measurement;} 118 118 119 private: 119 private: 120 120 121 G4ParticleDefinition* fpParentParticleDefini 121 G4ParticleDefinition* fpParentParticleDefinition; 122 122 123 // Use pointer values to identify tracks. We 123 // Use pointer values to identify tracks. We don't know in which order the 124 // tracks will be processed so let us call t 124 // tracks will be processed so let us call them A & B. 125 const G4Track* fTrackA; 125 const G4Track* fTrackA; 126 const G4Track* fTrackB; 126 const G4Track* fTrackB; 127 127 128 // False until first measurement... 128 // False until first measurement... 129 G4bool fTrack1Measurement; // ...of the fir 129 G4bool fTrack1Measurement; // ...of the first encountered track 130 G4bool fTrack2Measurement; // ...of the sec 130 G4bool fTrack2Measurement; // ...of the second encountered track 131 131 132 }; 132 }; 133 133 134 #endif 134 #endif 135 135