source: trunk/source/digits_hits/utils/test/test1/src/Tst1Run.cc @ 1316

Last change on this file since 1316 was 1316, checked in by garnier, 14 years ago

update geant4-09-04-beta-cand-01 interfaces-V09-03-09 vis-V09-03-08

File size: 2.8 KB
Line 
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//
26//
27// $Id: Tst1Run.cc,v 1.1 2007/07/13 05:55:34 asaim Exp $
28// GEANT4 tag $Name:  $
29//
30
31#include "Tst1Run.hh"
32#include "G4Event.hh"
33#include "G4HCofThisEvent.hh"
34#include "G4SDManager.hh"
35
36Tst1Run::Tst1Run()
37{
38  G4String detName = "MassWorld";
39  G4String primNameSum[7] = {"eDep","trackLengthGamma","nStepGamma",
40                   "trackLengthElec","nStepElec","trackLengthPosi","nStepPosi"};
41  G4SDManager* SDMan = G4SDManager::GetSDMpointer();
42  G4String fullName;
43  for(G4int i=0;i<7;i++)
44  {
45    fullName = detName+"/"+primNameSum[i];
46    colIDSum[i] = SDMan->GetCollectionID(fullName);
47  }
48}
49
50Tst1Run::~Tst1Run()
51{;}
52
53void Tst1Run::RecordEvent(const G4Event* evt)
54{
55  G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
56  if(!HCE) return;
57  numberOfEvent++;
58  for(G4int i=0;i<7;i++)
59  {
60    G4THitsMap<G4double>* evtMap = (G4THitsMap<G4double>*)(HCE->GetHC(colIDSum[i]));
61    mapSum[i] += *evtMap;
62  }
63}
64
65G4double Tst1Run::GetTotal(const G4THitsMap<G4double> &map) const
66{
67  G4double tot = 0.;
68  std::map<G4int,G4double*>::iterator itr = map.GetMap()->begin();
69  for(; itr != map.GetMap()->end(); itr++) 
70  { tot += *(itr->second); }
71  return tot;
72}
73
74
75 
Note: See TracBrowser for help on using the repository browser.