]> git.uio.no Git - u/mrichter/AliRoot.git/blame - Flugg/WrapIncrHist.cxx
Initialization moved to FGeometryInit::Init().
[u/mrichter/AliRoot.git] / Flugg / WrapIncrHist.cxx
CommitLineData
26911512 1
2// Flugg tag
3
4///////////////////////////////////////////////////////////////////
5//
6// WrapIncrHist.hh - Sara Vanini
7//
8// Wrapper for updating secondary particles history counter.
9// If counter=0 the history is deleted.
10//
11// modified 14/I/9999
12// modified 24.10.01: by I. Hrivnacova
13// functions declarations separated from implementation
14// (moved to Wrappers.hh);
15//
16//////////////////////////////////////////////////////////////////
17
18
19#include "Wrappers.hh"
20#include "FGeometryInit.hh"
21#include "NavHistWithCount.hh"
22#include "globals.hh"
23
24
25void conhwr(G4int& intHist, G4int* incrCount)
26{
27//flag
28#ifdef G4GEOMETRY_DEBUG
29 G4cout << "============= CONHWR ==============" << G4endl;
30 G4cout << "Ptr History = " << intHist << G4endl;
31#endif
32
33 //get NavHistWithCount pointer
34 if(intHist!=-1) {
35 NavHistWithCount* ptrNavHistCount=
36 reinterpret_cast<NavHistWithCount*>(intHist);
37
38 //for debugging...
39#ifdef G4GEOMETRY_DEBUG
40 G4cout << "Secondary counter=" << ptrNavHistCount->GetCount();
41 if(*incrCount>0)
42 G4cout << "+" << *incrCount << G4endl;
43 if(*incrCount<0)
44 G4cout<< *incrCount << G4endl;
45 if(*incrCount==0)
46 G4cout << G4endl;
47#endif
48
49 //update secondary particles counter
50 ptrNavHistCount->UpdateCount(*incrCount);
51
52 //delete history if counter=0 or if counter=-1
53 G4int counter = ptrNavHistCount->GetCount();
54#ifdef G4GEOMETRY_DEBUG
55 G4cout << "Counter = " << counter << G4endl;
56#endif
57 if(!counter || counter==-1) {
58#ifdef G4GEOMETRY_DEBUG
59 G4cout << "Deleting Nav Hist object..." << G4endl;
60#endif
61 /*
62 //for history checking....
63 G4int index = ptrNavHistCount->GetCheckInd();
64 static FGeometryInit * ptrGeoInit = FGeometryInit::GetInstance();
65 G4int * ptrArray = ptrGeoInit->GetHistArray();
66 ptrArray[index]=0;
67 */
68
69 delete ptrNavHistCount;
70#ifdef G4GEOMETRY_DEBUG
71 G4cout << "end delete" << G4endl;
72#endif
73 intHist=-1;
74 }
75 }
76#ifdef G4GEOMETRY_DEBUG
77 G4cout << "============= Out of CONHWR ==============" << G4endl;
78#endif
79 }
80
81
82
83
84
85
86
87
88
89