Back to home page

EIC code displayed by LXR

 
 

    


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

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 /// \file ClassifiedDamage.cc
0028 /// \brief Implementation of the ClassifiedDamage class
0029 
0030 #include "ClassifiedDamage.hh"
0031 
0032 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
0033 
0034 ClassifiedDamage::ClassifiedDamage()
0035 {
0036     fType = fNA;
0037     fDamage.clear();
0038     fBp_begin = 0;
0039     fBp_end = 0;
0040     fComplexity = -1;
0041     fIncludeBase = false;
0042 }
0043 
0044 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0045 
0046 void ClassifiedDamage::AddDamage(Damage pDmg)
0047 {
0048     fDamage.push_back(pDmg);
0049 }
0050 
0051 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0052 
0053 void ClassifiedDamage::ComputeBp()
0054 {
0055     fBp_begin = fDamage[0].GetCopyNb();
0056     fBp_end = fDamage[fDamage.size()-1].GetCopyNb();
0057 
0058     fBp_barycenter=0;
0059     for(auto it=fDamage.begin();it!=fDamage.end();it++)
0060     {
0061         fBp_barycenter+=it->GetCopyNb();
0062     }
0063     fBp_barycenter = fBp_barycenter/fDamage.size();
0064 }
0065 
0066 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0067 
0068 void ClassifiedDamage::ComputePosition()
0069 {
0070     // TODO
0071 }
0072 
0073 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0074 
0075 void ClassifiedDamage::ComputeComplexity()
0076 {
0077     if(fDamage.size()==0)
0078     {
0079         fComplexity = -1;
0080     }
0081     else
0082     {
0083         fComplexity = -1;
0084         for(auto it=fDamage.begin();it!=fDamage.end();it++)
0085         {
0086             if((it->GetDamageType()==Damage::DamageType::fBackbone))
0087             {
0088                 fComplexity++;
0089             }
0090             else
0091             {
0092                 if(fIncludeBase)
0093                 {
0094                     fComplexity++;
0095                 }
0096             }
0097         }
0098     }
0099 }
0100 
0101 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0102 
0103 void ClassifiedDamage::ComputeType()
0104 {
0105     bool firstStrandTouched = false;
0106     bool secondStrandTouched = false;
0107 
0108     if(fDamage.size()==0)
0109     {
0110         fType = fNA;
0111     }
0112     else
0113     {
0114         for(auto it=fDamage.begin();it!=fDamage.end();it++)
0115         {
0116             if((it->GetDamageType()==Damage::DamageType::fBackbone))
0117             {
0118                 int strand = it->GetStrand();
0119                 if(strand == 1)
0120                 {
0121                     firstStrandTouched = true;
0122                 }
0123                 if(strand == 2)
0124                 {
0125                     secondStrandTouched = true;
0126                 }
0127             }
0128 
0129             if (it->GetCause() == Damage::DamageCause::fDirect) {
0130                 fIsThereDirectContribution = true;
0131             }
0132 
0133             if (it->GetCause() == Damage::DamageCause::fIndirect) {
0134                 fIsThereIndirectContribution = true;
0135             }
0136         }
0137 
0138         if(firstStrandTouched && secondStrandTouched)
0139         {
0140             fType = fDSB;
0141         }
0142         else
0143         {
0144             fType = fSSB;
0145         }
0146     }
0147 }
0148 
0149 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0150 
0151 void ClassifiedDamage::Reset()
0152 {
0153     fType = fNA;
0154     fDamage.clear();
0155     fBp_begin = 0;
0156     fBp_end = 0;
0157     fComplexity = -1;
0158 }