4 ///////////////////////////////////////////////////////////////////
6 // WrapIncrHist.hh - Sara Vanini
8 // Wrapper for updating secondary particles history counter.
9 // If counter=0 the history is deleted.
12 // modified 24.10.01: by I. Hrivnacova
13 // functions declarations separated from implementation
14 // (moved to Wrappers.hh);
16 //////////////////////////////////////////////////////////////////
19 #include "Wrappers.hh"
20 #include "FGeometryInit.hh"
21 #include "NavHistWithCount.hh"
25 void conhwr(G4int& intHist, G4int* incrCount)
28 #ifdef G4GEOMETRY_DEBUG
29 G4cout << "============= CONHWR ==============" << G4endl;
30 G4cout << "Ptr History = " << intHist << G4endl;
33 //get NavHistWithCount pointer
35 NavHistWithCount* ptrNavHistCount=
36 reinterpret_cast<NavHistWithCount*>(intHist);
39 #ifdef G4GEOMETRY_DEBUG
40 G4cout << "Secondary counter=" << ptrNavHistCount->GetCount();
42 G4cout << "+" << *incrCount << G4endl;
44 G4cout<< *incrCount << G4endl;
49 //update secondary particles counter
50 ptrNavHistCount->UpdateCount(*incrCount);
52 //delete history if counter=0 or if counter=-1
53 G4int counter = ptrNavHistCount->GetCount();
54 #ifdef G4GEOMETRY_DEBUG
55 G4cout << "Counter = " << counter << G4endl;
57 if(!counter || counter==-1) {
58 #ifdef G4GEOMETRY_DEBUG
59 G4cout << "Deleting Nav Hist object..." << G4endl;
62 //for history checking....
63 G4int index = ptrNavHistCount->GetCheckInd();
64 static FGeometryInit * ptrGeoInit = FGeometryInit::GetInstance();
65 G4int * ptrArray = ptrGeoInit->GetHistArray();
69 delete ptrNavHistCount;
70 #ifdef G4GEOMETRY_DEBUG
71 G4cout << "end delete" << G4endl;
76 #ifdef G4GEOMETRY_DEBUG
77 G4cout << "============= Out of CONHWR ==============" << G4endl;