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 //
0028 /// \file ScanDamage.hh
0029 /// \brief Definition of the ScanDamage class
0030 
0031 #ifndef ScanDamage_h
0032 #define ScanDamage_h
0033 
0034 #include <map>
0035 #include <vector>
0036 #include <string>
0037 #include <tuple>
0038 #include <set>
0039 #include "Damage.hh"
0040 #include <filesystem>
0041 namespace fs = std::filesystem;
0042 class TFile;
0043 using ullint = unsigned long long int;
0044 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
0045 
0046 struct VoxelData
0047 {
0048     VoxelData(int chromo, int domain, ullint firstBpCN)
0049     {
0050         fChromosome = chromo;
0051         fDomain = domain;
0052         fFirstBpCopyNum = firstBpCN;
0053     }
0054 
0055     ~VoxelData() {}
0056 
0057     int fChromosome{0};
0058     int fDomain{0};
0059     ullint fFirstBpCopyNum{0};
0060 };
0061 
0062 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
0063 
0064 typedef std::vector<std::vector<ullint> > Table;
0065 
0066 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
0067 
0068 class Trier {
0069 public:
0070     bool operator()(const std::vector<ullint>& a, const std::vector<ullint>& b)
0071     {
0072         bool bb = false;
0073         if(a[0] < b[0]) bb = true;
0074         return bb;
0075     }
0076 };
0077 
0078 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
0079 
0080 class ScanDamage
0081 {
0082 public:
0083     ScanDamage();
0084     ~ScanDamage() = default;  
0085     std::map<unsigned int,std::map<unsigned int,std::vector<Damage> > > ExtractDamage();
0086     void SetThresholdEnergy(double e) {fThresholdEnergy = e;}
0087     void SetProbabilityForIndirectSBSelection(double p) {fProbabilityForIndirectSB = p;}
0088     double GetThresholdEnergy() {return fThresholdEnergy;}
0089     double GetProbabilityForIndirectSBSelection() {return fProbabilityForIndirectSB;}
0090     std::map<int, Table> GetMergedSBData() {return fMergedTables;}
0091     double GetEdepSumInNucleus() {return fEdepSumInNucleus;} //eV
0092     double GetTotalNbBpPlacedInGeo() {return fTotalNbBpPlacedInGeo;}
0093     double GetTotalNbHistonePlacedInGeo() {return fTotalNbHistonePlacedInGeo;}
0094     double GetNucleusVolume() {return fNucleusVolume;} 
0095     double GetNucleusMassDensity() {return fNucleusMassDensity;}
0096     double GetNucleusMass() {return fNucleusMass;}
0097     std::map<int,ullint> GetChromosomeBpSizesMap() {return fChromosomeBpMap;}
0098     void SkipScanningIndirectDamage() {fSkipScanningIndirectDamage = true;}
0099     bool SkippedScanningIndirectDamage() {return fSkipScanningIndirectDamage;}
0100 private:
0101     void ScanDamageFromPhys();
0102     void ScanDamageFromChem();
0103     void RetrieveVoxelBp();
0104     void FillVoxelData();
0105     void AnaPhysRootFile(const std::string fileName);
0106     void AnaChemRootFile(fs::directory_entry entry);
0107     void AnaPhysRootTree1(TFile*);
0108     void AnaPhysRootTree2(TFile*);
0109     void SortPhysTableWithSelection();
0110     void SortChemTableWithSelection();
0111     void ReadCellandVoxelDefFilePaths();
0112     void MergeDamageFromPhysChem();
0113     std::tuple<unsigned int, unsigned int> GetEventNberAndVoxelNberFromChemRoot(const std::string fileNam);
0114     double fThresholdEnergy{17.5};//eV
0115     std::string fCellDefFilePath{""};
0116     std::set<std::string> fVoxelDefFilesList;
0117     std::map<std::string, int> fBpPerVoxel;
0118     std::vector<VoxelData> fVoxels;
0119     std::map<int, Table> fphysTables, fphysSlectedTables, fchemTables, fchemSlectedTables,fMergedTables;
0120     std::map<unsigned int,std::map<unsigned int,std::vector<Damage> > > fDamage;
0121     double fEdepSumInNucleus{0}; //eV
0122     int corruptedFiles = 0;
0123     double fTotalNbBpPlacedInGeo{0};
0124     double fTotalNbHistonePlacedInGeo{0};
0125     double fNucleusVolume{0};
0126     double fNucleusMassDensity{0};
0127     double fNucleusMass{0};
0128     double fProbabilityForIndirectSB{0.4};
0129     std::map<int,ullint> fChromosomeBpMap; //Store number of Bp in each Chomosomes;
0130     bool fSkipScanningIndirectDamage{false};
0131 };
0132 
0133 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
0134 
0135 #endif
0136 
0137