/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Private Attributes
DsOpStackAction Class Reference

#include <DsOpStackAction.h>

Collaboration diagram for DsOpStackAction:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 DsOpStackAction (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~DsOpStackAction ()
virtual StatusCode initialize ()
virtual StatusCode finalize ()
virtual G4ClassificationOfNewTrack ClassifyNewTrack (const G4Track *aTrack)
virtual void NewStage ()
virtual void PrepareNewEvent ()
virtual G4bool IsNeutronDaughter (const G4int id, const vector< G4int > aList)
virtual G4bool IsAInterestingTrack (const G4Track *aTrack)
virtual G4bool PossibleInterestingTrack (const G4Track *aTrack)

Private Attributes

G4int stage
G4int PhotonNumbers
G4int NeutronNumbers
G4bool interestingEvt
std::vector< G4int > neutronList
G4bool m_tightCut
G4bool m_photonCut
G4double m_maxPhoton
ICoordSysSvcm_csvc

Detailed Description

Definition at line 27 of file DsOpStackAction.h.


Constructor & Destructor Documentation

DsOpStackAction::DsOpStackAction ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Definition at line 22 of file DsOpStackAction.cc.

  : GiGaStackActionBase( type, name, parent ) ,
    stage(0),
    PhotonNumbers(0),
    NeutronNumbers(0),
    interestingEvt(false),
    m_csvc(0)
{ 
    declareProperty("TightCut",m_tightCut = false, " cut to select Neutron only event in the AD.");
    declareProperty("PhotonCut",m_photonCut = false, " Kill all the optical photons in the process.");
    declareProperty("MaxPhoton",m_maxPhoton = 1e6, " Max number of photons to be hold.");
}
virtual DsOpStackAction::~DsOpStackAction ( ) [inline, virtual]

Definition at line 32 of file DsOpStackAction.h.

{};

Member Function Documentation

StatusCode DsOpStackAction::initialize ( ) [virtual]

Definition at line 38 of file DsOpStackAction.cc.

{
  info() << "DsOpStackAction::initialize()" << endreq;
  
  StatusCode sc = GiGaStackActionBase::initialize();
  if (sc.isFailure()) return sc;

 
  if ( service("CoordSysSvc", m_csvc).isFailure()) {
    error() << " No CoordSysSvc available." << endreq;
    return StatusCode::FAILURE;
  }
  
  return StatusCode::SUCCESS; 
}
StatusCode DsOpStackAction::finalize ( ) [virtual]

Definition at line 54 of file DsOpStackAction.cc.

{
  info() << "DsOpStackAction::finalize()" << endreq;
  neutronList.clear();
  return  GiGaStackActionBase::finalize();
}
G4ClassificationOfNewTrack DsOpStackAction::ClassifyNewTrack ( const G4Track *  aTrack) [virtual]

Definition at line 63 of file DsOpStackAction.cc.

                                                                                   {
  
  //  info() << "DsOpStackAction::ClassifyNewTrack: " << endreq;
  
  G4ClassificationOfNewTrack classification = fUrgent;
  //info()<< " ParentID: "<< aTrack->GetParentID()<< " CurrentID: "<<aTrack->GetTrackID()<<endreq;
  

  switch(stage)
    {
    case 0: // if optical photon is the the secondary particles and below memory threshold,
      // put them in waiting.
      
      // tightcut selection here.
      if(aTrack->GetDefinition()  != G4OpticalPhoton::OpticalPhotonDefinition()){
        if(m_tightCut){
          if( aTrack->GetDefinition()==G4Neutron::NeutronDefinition())
            {
              info()<<" It is a neutron event! " <<endreq;
              NeutronNumbers++;
              neutronList.push_back(aTrack->GetTrackID()); //save neutron's trackID for later use.
              break;
            }
          
          
          if( aTrack->GetDefinition()==G4Gamma::GammaDefinition()
              && (aTrack->GetTrackID()-aTrack->GetParentID())==1)  //only if the gamma has a direct parent.
            {
              if(!interestingEvt){
                interestingEvt=this->IsAInterestingTrack(aTrack);
                //info()<< "Particle: "<<aTrack->GetDefinition()->GetParticleName() <<endreq;
              }
              break;        
            }
        }
        else {
          if( aTrack->GetDefinition()==G4Neutron::NeutronDefinition())
            {
              NeutronNumbers++;
              break;
            }
          if (aTrack->GetDefinition() != G4OpticalPhoton::OpticalPhotonDefinition()) {
            if(!interestingEvt){
              interestingEvt=this->PossibleInterestingTrack(aTrack);
            }
            break;
          }
        }
      }
      else{
        
        PhotonNumbers++;
        
        
        // ------unother way of doing this is to use the processname to select events--
        //  if(aTrack->GetCreatorProcess()){
        //    G4String ProcessName=aTrack->GetCreatorProcess()->GetProcessName();
        //    info()<< " Proccess Name: "<< ProcessName<<endreq;
        //  }
        
        
        if (m_photonCut) {
          classification=fKill;
          break;
        }
        else if(aTrack->GetParentID()>0 && PhotonNumbers<=m_maxPhoton && !interestingEvt)
          {
            //if too many optical photons been generated and  too many optical photons hold
            //in the stack, may cause 'out of memory' problem
            
            // only hold optical photon if it is secondary
            
            //  G4ThreeVector position  = aTrack->GetPosition();
            //  G4ThreeVector direction = aTrack->GetMomentumDirection();
            //  G4ThreeVector polarization = aTrack->GetPolarization();
            //  G4double energy = aTrack->GetKineticEnergy();
            //  G4double time  = aTrack->GetGlobalTime();
            //  info()<<  "  Position  " << position.x()<< " time: " <<time<<endreq;
            classification=fWaiting;
            break;
          }
      }
      
      classification = fUrgent;
      break;
      
    case 1:
      //      info()<<" In Stage 1, propogating all the stacked optical photons! "<<endreq;
      classification = fUrgent;
      break;
      
    default:
      classification = fUrgent;
    } 
  return classification;
}
void DsOpStackAction::NewStage ( ) [virtual]

Definition at line 166 of file DsOpStackAction.cc.

{

  info()<< " StackingAction::NewStage! "<<endreq;
  info()<< " Number of Optical Photons generated:  "<< PhotonNumbers<<endreq;
  info()<< " Number of Neutron generated:  "<< NeutronNumbers<<endreq;
  
  if(m_tightCut){
    info() << "Tight Cut selected: only select AD gamma events from neutrons! " <<endreq;
  }
  else{
    info() << " select Events with any new particles generated in the AD! " <<endreq;
  }

  if(PhotonNumbers>m_maxPhoton) {
    info() << " Get an event with Large number of Photons! " <<endreq;
  }
  
  if(m_photonCut){
    info() << " All the Optical Photons killed in this event! " <<endreq;
  }

  stage++;
  
  if(interestingEvt)
    {
      info()<<" An interesting event! Let's go on!"<<endreq;
      stackManager->ReClassify();
    }
  else {
    info()<< "Boring event, aborting..."<<endreq;
    stackManager->clear();  //abort the event
  }
}
void DsOpStackAction::PrepareNewEvent ( ) [virtual]

Definition at line 203 of file DsOpStackAction.cc.

{
  info()<< " StackingAction::PrepareNewEvent! "<<endreq;
  interestingEvt=false;
  stage=0;
  PhotonNumbers=0;
  NeutronNumbers=0;
  neutronList.clear();
}
G4bool DsOpStackAction::IsNeutronDaughter ( const G4int  id,
const vector< G4int >  aList 
) [virtual]

Definition at line 215 of file DsOpStackAction.cc.

{
  
  //check if the gamma is the daughter of neutrons.
  G4bool isDaughter(false);
  for(size_t ii=0;ii<aList.size();ii++){
    if(aList[ii]==id || aList[ii]==id-1) {
      info()<<" neutron TrackID: "<<aList[ii]<< " been Captured! "<< endreq;
      isDaughter=true;
      break;
    }
  }
  return isDaughter;
};
G4bool DsOpStackAction::IsAInterestingTrack ( const G4Track *  aTrack) [virtual]

Definition at line 232 of file DsOpStackAction.cc.

{
  
  //  info()<< " Am I an interesting event???" <<endreq;
  
  G4int trkID=aTrack->GetParentID();  //get Gamma's parentID
  
  IDetectorElement *de;
  Gaudi::XYZPoint gp(aTrack->GetPosition().x(),aTrack->GetPosition().y(),aTrack->GetPosition().z());
  
  //Get DetectorElement from the global postion.
  de = m_csvc->coordSysDE(gp);
  if(!de){
    debug()<<" Particle Name: "<<aTrack->GetDefinition()->GetParticleName()<< " at position: "<<gp
           <<" with Process Name: "<<aTrack->GetCreatorProcess()->GetProcessName()<<endreq;
  }
  
  //Ignore the track outside of our global volumes.
  if(de){
    IGeometryInfo *ginfo=de->geometry();
    if(ginfo){
      if( IsNeutronDaughter(trkID, neutronList))
        //if Gamma's parent is neutron, check if they are in the AD.
        {
          //      G4String ProcessName=aTrack->GetCreatorProcess()->GetProcessName();
          const ILVolume *lv=ginfo->lvolume();
          if(lv){
            G4String MaterialName = lv->materialName();
            
            //      info() << " materialName: "<< MaterialName <<endreq;
            
            if( MaterialName=="/dd/Materials/MineralOil"
                || MaterialName== "/dd/Materials/GdDopedLS"
                || MaterialName== "/dd/Materials/LiquidScintillator" 
                || MaterialName== "/dd/Materials/Acrylic") {
              
              info()<< "Find a Interesting Event in %s !!!" << MaterialName<<endreq; 
              return true;
            }
          }
        }
    }
  }
  return false;
}
G4bool DsOpStackAction::PossibleInterestingTrack ( const G4Track *  aTrack) [virtual]

Definition at line 281 of file DsOpStackAction.cc.

{
  
  //info()<< " Am I an possible interesting event???" <<endreq;
  
  IDetectorElement *de;
  Gaudi::XYZPoint gp(aTrack->GetPosition().x(),aTrack->GetPosition().y(),aTrack->GetPosition().z());
  
  //Get DetectorElement from the global postion.
  de = m_csvc->coordSysDE(gp);
  
  // If the new particle generated inside of the AD, accept it
  if(de){
    IGeometryInfo *ginfo=de->geometry();
    if(ginfo){
      {
        const ILVolume *lv=ginfo->lvolume();
        if(lv){
          G4String MaterialName = lv->materialName();
          
          if( MaterialName=="/dd/Materials/MineralOil"
              || MaterialName== "/dd/Materials/GdDopedLS"
              || MaterialName== "/dd/Materials/LiquidScintillator" 
              || MaterialName== "/dd/Materials/Acrylic") {
            
            info()<< "Find a good Event in AD in "<<  MaterialName<< " !! "<< endreq; 
            return true;
          }
        }
      }
    }
  }
  return false;
}

Member Data Documentation

G4int DsOpStackAction::stage [private]

Definition at line 48 of file DsOpStackAction.h.

Definition at line 49 of file DsOpStackAction.h.

Definition at line 50 of file DsOpStackAction.h.

Definition at line 51 of file DsOpStackAction.h.

std::vector<G4int> DsOpStackAction::neutronList [private]

Definition at line 53 of file DsOpStackAction.h.

G4bool DsOpStackAction::m_tightCut [private]

Definition at line 57 of file DsOpStackAction.h.

G4bool DsOpStackAction::m_photonCut [private]

Definition at line 60 of file DsOpStackAction.h.

G4double DsOpStackAction::m_maxPhoton [private]

Definition at line 63 of file DsOpStackAction.h.

Definition at line 68 of file DsOpStackAction.h.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 10:17:58 for DetSim by doxygen 1.7.4