Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:21

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 //
0028 // --------------------------------------------------------------------
0029 // GEANT4 class header file
0030 //
0031 // Class Description:
0032 // Base class for a clipboard for communicating between quantum entangled tracks.
0033 //
0034 // ------------------ G4VEntanglementClipBoard ------------------
0035 //
0036 // Author: J.Allison, May 2017
0037 //
0038 // --------------------------------------------------------------------
0039 
0040 // Usage:
0041 //
0042 // In the method that generates entangled secondaries
0043 // (See, for example, G4eplusAnnihilation::AtRestDoIt)
0044 // Make a shared pointer to a clip board and attach it to the tracks through
0045 // G4EntanglementAuxInfo. That way the clip board lasts the life of both tracks.
0046 // (G4XXXEntanglementClipBoard is your class inherited from this class)
0047 // (See, for example, G4eplusAnnihilationEntanglementClipBoard)
0048 //  auto clipBoard = std::make_shared<G4XXXEntanglementClipBoard>();
0049 // For each secondary
0050 //  G4Track* track = new G4Track(...
0051 //  ...
0052 //  clipBoard->SetTrackA(track);
0053 //  track->SetAuxiliaryTrackInformation(0,new G4EntanglementAuxInfo(clipBoard));
0054 // Then repeat for track B
0055 //
0056 // In the method that does the quantum "measurement"
0057 // (See, for example, G4LivermorePolarizedComptonModel::SampleSecondaries)
0058 //  const auto* auxInfo = fParticleChange->GetCurrentTrack()->GetAuxiliaryTrackInformation(0);
0059 //  if (auxInfo) {
0060 //    const auto* entanglementAuxInfo = dynamic_cast<const G4EntanglementAuxInfo*>(auxInfo);
0061 //    if (entanglementAuxInfo) {
0062 //      auto* clipBoard = dynamic_cast<G4XXXEntanglementClipBoard*>
0063 //      (entanglementAuxInfo->GetEntanglementClipBoard());
0064 //      if (clipBoard) {
0065 //        if (clipBoard->IsTrack1Measurement()) {
0066 //          if (clipBoard->GetTrackB() == fParticleChange->GetCurrentTrack()) {
0067 //            clipBoard->ResetTrack1Measurement();
0068 //            // Store information
0069 //            ...
0070 //          }
0071 //        } else if (clipBoard->IsTrack2Measurement()) {
0072 //          if (clipBoard->GetTrackA() == fParticleChange->GetCurrentTrack()) {
0073 //            clipBoard->ResetTrack2Measurement();
0074 //            // Retrieve information and apply quantum mechanics
0075 //            ...
0076 //          }
0077 //        }
0078 //      }
0079 //    }
0080 //  }
0081 
0082 #ifndef G4VEntanglementClipBoard_hh
0083 #define G4VEntanglementClipBoard_hh
0084 
0085 #include "globals.hh"
0086 
0087 class G4ParticleDefinition;
0088 class G4Track;
0089 
0090 class G4VEntanglementClipBoard {
0091 
0092 public:
0093   
0094   G4VEntanglementClipBoard()
0095   : fpParentParticleDefinition(0)
0096   , fTrackA(0)
0097   , fTrackB(0)
0098   , fTrack1Measurement(true)
0099   , fTrack2Measurement(true)
0100   {}
0101   virtual ~G4VEntanglementClipBoard() {}
0102 
0103   void SetParentParticleDefinition(G4ParticleDefinition* p)
0104   {fpParentParticleDefinition = p;}
0105   G4ParticleDefinition* GetParentParticleDefinition() const
0106   {return fpParentParticleDefinition;}
0107 
0108   void SetTrackA(const G4Track* track) {fTrackA = track;}
0109   void SetTrackB(const G4Track* track) {fTrackB = track;}
0110   const G4Track* GetTrackA() const {return fTrackA;}
0111   const G4Track* GetTrackB() const {return fTrackB;}
0112 
0113   // The entanglement-sensitive process is responsible for setting this.
0114   void ResetTrack1Measurement() {fTrack1Measurement = false;}
0115   void ResetTrack2Measurement() {fTrack2Measurement = false;}
0116   G4bool IsTrack1Measurement() const {return fTrack1Measurement;}
0117   G4bool IsTrack2Measurement() const {return fTrack2Measurement;}
0118   
0119 private:
0120 
0121   G4ParticleDefinition* fpParentParticleDefinition;
0122 
0123   // Use pointer values to identify tracks. We don't know in which order the
0124   // tracks will be processed so let us call them A & B.
0125   const G4Track* fTrackA;
0126   const G4Track* fTrackB;
0127 
0128   // False until first measurement...
0129   G4bool fTrack1Measurement;  // ...of the first encountered track
0130   G4bool fTrack2Measurement;  // ...of the second encountered track
0131   
0132 };
0133 
0134 #endif