ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
doiPETRun.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file doiPETRun.cc
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
28 //
29 //
30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 
33 #include "doiPETRun.hh"
36 
37 #include "G4UnitsTable.hh"
38 #include "G4SystemOfUnits.hh"
39 #include "G4Event.hh"
40 #include "doiPETAnalysis.hh"
41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
42 
44  : G4Run()
45 {
46  //
47  totalTime = 0 * s;
48  prev_totalTime = 0 * s;
49  totalEdep = 0*keV;
50 }
51 
52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
53 
55 {}
56 
57 //
59 {
60  //The photon can have many interactions in one block. This stores all the interaction (including multiple copies of the same block.)
61  //Save the interacting block in the associative container including multiple copies. Since there will be multiple interactions in the crystals wthin a single block
62  mapBlockInteraction.insert( std::multimap< G4int, InteractionInformation* >::value_type( step->GetBlockNo(), step) );
63 
64  //The following stores the block number uniquely. Save the interacting block in the associative container without saving multiple copies
65  setBlockInteraction.insert( step->GetBlockNo());
66 }
67 
69 
71 {
72 
73  //G4cout<<"totalTime: "<<totalTime/s<<" "<<InitialActivity/becquerel<<G4endl;
74  std::multimap< G4int, InteractionInformation* >::iterator mitr;
75  std::set<G4int>::iterator sitr;
76  G4int cystalIDTemp;
77 
78  for(sitr=setBlockInteraction.begin(); sitr!=setBlockInteraction.end(); sitr++){
79  blockID = (*sitr);
80  mitr = mapBlockInteraction.find(blockID);
81  numberofInteractions = mapBlockInteraction.count(blockID); //number of interactions in which the interaction deposite energy in a block.
82  totalEdep=edepMax=0.;
83  for(G4int i=0; i<numberofInteractions; i++, mitr++){
84  edep = (*mitr).second->GetEdep();
85  cystalIDTemp = (*mitr).second->GetCrystalNo();
86  //edep_AfterCrystalBlurring = doiPETAnalysis::GetInstance()->QuantumEffifciency(edep);
89  //This is to identify the crystal with the highest energy deposition.
92  crystalID = cystalIDTemp;
93  interactionTime = (*mitr).second->GetGlobalTime();
94  interactionPos = (*mitr).second->GetInteractionPositionInCrystal();
95  }
96  }
98  }
99 }
100 
102  timeOfAnnihil = t;
103 }
104 //
106  //clear the content of the associative containers, the multimap and the set
107  std::multimap< G4int, InteractionInformation* >::iterator mitr2;
108  for( mitr2= mapBlockInteraction.begin(); mitr2!=mapBlockInteraction.end(); mitr2++){
109  delete (*mitr2).second;
110  }
111 
112  mapBlockInteraction.clear();
113  setBlockInteraction.clear();
114  //
115 }
116 //
118  eventID = evt;
119 }
120 //
121 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
122 
123 void doiPETRun::Merge(const G4Run* run)
124 {
125  G4Run::Merge(run);
126 }