Trigger board name according to PRR
[u/mrichter/AliRoot.git] / Flugg / WrapIniHist.cxx
1
2 // Flugg tag 
3
4 ///////////////////////////////////////////////////////////////////
5 //
6 // WrapIniHist.hh - Sara Vanini
7 //
8 // Wrapper for reinitialization of FluggNavigator history.
9 //
10 // modified 14/I/99
11 // modified 24.10.01: by I. Hrivnacova
12 //   functions declarations separated from implementation
13 //   (moved to Wrappers.hh);
14 //
15 ///////////////////////////////////////////////////////////////////
16
17
18 #include "Wrappers.hh"
19 #include "FGeometryInit.hh"
20 #include "NavHistWithCount.hh"
21 #include "G4NavigationHistory.hh"
22 #include "FluggNavigator.hh"
23 #include "globals.hh"
24
25 void inihwr(G4int& intHist)
26 {
27 //flag
28 #ifdef G4GEOMETRY_DEBUG
29   G4cout << "============= INIHWR ==============" << G4endl;    
30   G4cout << "Ptr History=" <<intHist<< G4endl;
31 #endif 
32   if(intHist==-1) {
33     G4cout << "ERROR! This history has been deleted!" << G4endl;
34     return;
35   }
36   else {
37     //get NavHistWithCount,G4NavigationHistory,FGeometryInit,
38     //FluggNavigator pointers
39     NavHistWithCount* ptrNavHistCount=
40       reinterpret_cast<NavHistWithCount*>(intHist);
41     G4NavigationHistory* ptrNavHist=ptrNavHistCount->GetNavHistPtr();
42     static FGeometryInit * ptrGeoInit = FGeometryInit::GetInstance();
43     FluggNavigator* ptrNavig = ptrGeoInit->getNavigatorForTracking();
44     
45     //reinitialize navigator history 
46     ptrNavig->UpdateNavigatorHistory(ptrNavHist);
47     
48     //update utility histories: touch,temp, and reset old history
49     ptrGeoInit->UpdateHistories(ptrNavHist,0);
50     
51     //save new history in jrLtGeant if not present
52     G4int LttcFlagGeant = ptrGeoInit->GetLttcFlagGeant();
53     G4int * jrLtGeant = ptrGeoInit->GetJrLtGeantArray();
54     
55     G4bool intHistInJrLtGeant = false;
56     for(G4int h=0; h<=LttcFlagGeant; h++)
57       if(jrLtGeant[h]==intHist) 
58         intHistInJrLtGeant = true;
59     
60     if(!intHistInJrLtGeant) {  
61       LttcFlagGeant += 1; 
62       ptrGeoInit->SetLttcFlagGeant(LttcFlagGeant);
63       
64       jrLtGeant[LttcFlagGeant]=intHist;
65       
66 #ifdef G4GEOMETRY_DEBUG
67       G4cout << "* CONHWR call to increment counter" << G4endl;
68 #endif 
69       G4int incrCount=1;
70       conhwr(jrLtGeant[LttcFlagGeant],&incrCount);
71     }    
72     
73     //print history....
74 #ifdef G4GEOMETRY_DEBUG
75     G4cout << "History reinitialized in:" << G4endl;
76     G4cout << *ptrNavHist << G4endl;
77     ptrGeoInit->PrintJrLtGeant();
78 #endif
79   }
80 }
81
82
83
84
85