Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/digits_hits/scorer/src/G4PSCylinderSurfaceFlux.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /digits_hits/scorer/src/G4PSCylinderSurfaceFlux.cc (Version 11.3.0) and /digits_hits/scorer/src/G4PSCylinderSurfaceFlux.cc (Version 10.5)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 //                                                 26 //
 27 //                                                 27 //
 28 // // G4PSCylinderSurfaceFlux                      28 // // G4PSCylinderSurfaceFlux
 29 #include "G4PSCylinderSurfaceFlux.hh"              29 #include "G4PSCylinderSurfaceFlux.hh"
 30                                                    30 
 31 #include "G4SystemOfUnits.hh"                      31 #include "G4SystemOfUnits.hh"
 32 #include "G4StepStatus.hh"                         32 #include "G4StepStatus.hh"
 33 #include "G4Track.hh"                              33 #include "G4Track.hh"
 34 #include "G4VSolid.hh"                             34 #include "G4VSolid.hh"
 35 #include "G4VPhysicalVolume.hh"                    35 #include "G4VPhysicalVolume.hh"
 36 #include "G4VPVParameterisation.hh"                36 #include "G4VPVParameterisation.hh"
 37 #include "G4UnitsTable.hh"                         37 #include "G4UnitsTable.hh"
 38 #include "G4GeometryTolerance.hh"                  38 #include "G4GeometryTolerance.hh"
 39 #include "G4VScoreHistFiller.hh"               << 
 40                                                << 
 41 // ///////////////////////////////////////////     39 // ////////////////////////////////////////////////////////////////////////////////
 42 // (Description)                                   40 // (Description)
 43 //   This is a primitive scorer class for scor     41 //   This is a primitive scorer class for scoring Surface Flux.
 44 //  Current version assumes only for G4Tubs sh     42 //  Current version assumes only for G4Tubs shape, and the surface
 45 //  is fixed on inner plane of the tube.           43 //  is fixed on inner plane of the tube.
 46 //                                                 44 //
 47 // Surface is defined at the innner surface of     45 // Surface is defined at the innner surface of the tube.
 48 // Direction                   R    R+dR           46 // Direction                   R    R+dR
 49 //   0  IN || OUT            ->|<-  |              47 //   0  IN || OUT            ->|<-  |
 50 //   1  IN                   ->|    |              48 //   1  IN                   ->|    |
 51 //   2  OUT                    |<-  |              49 //   2  OUT                    |<-  |
 52 //                                                 50 //
 53 // Created: 2007-03-29  Tsukasa ASO                51 // Created: 2007-03-29  Tsukasa ASO
 54 // 2010-07-22   Introduce Unit specification.      52 // 2010-07-22   Introduce Unit specification.
 55 // 2010-07-22   Add weighted and divideByArea      53 // 2010-07-22   Add weighted and divideByArea options
 56 // 2011-02-21   Get correct momentum direction     54 // 2011-02-21   Get correct momentum direction in Flux_Out.
 57 // 2020-10-06   Use G4VPrimitivePlotter and fi << 
 58 //              vs. surface flux * track weigh << 
 59 //                                             << 
 60 //////////////////////////////////////////////     55 ///////////////////////////////////////////////////////////////////////////////
 61                                                    56 
 62 G4PSCylinderSurfaceFlux::G4PSCylinderSurfaceFl <<  57 G4PSCylinderSurfaceFlux::G4PSCylinderSurfaceFlux(G4String name, 
 63                                                <<  58              G4int direction, G4int depth)
 64   : G4PSCylinderSurfaceFlux(name, direction, " <<  59     : G4VPrimitiveScorer(name,depth),HCID(-1),fDirection(direction),EvtMap(0),
 65 {}                                             <<  60       weighted(true),divideByArea(true)
 66                                                << 
 67 G4PSCylinderSurfaceFlux::G4PSCylinderSurfaceFl << 
 68                                                << 
 69                                                << 
 70   : G4VPrimitivePlotter(name, depth)           << 
 71   , HCID(-1)                                   << 
 72   , fDirection(direction)                      << 
 73   , EvtMap(nullptr)                            << 
 74   , weighted(true)                             << 
 75   , divideByArea(true)                         << 
 76 {                                                  61 {
 77   DefineUnitAndCategory();                     <<  62     DefineUnitAndCategory();
 78   SetUnit(unit);                               <<  63     SetUnit("percm2");
 79 }                                                  64 }
 80                                                    65 
 81 G4bool G4PSCylinderSurfaceFlux::ProcessHits(G4 <<  66 G4PSCylinderSurfaceFlux::G4PSCylinderSurfaceFlux(G4String name, 
                                                   >>  67              G4int direction, 
                                                   >>  68              const G4String& unit, 
                                                   >>  69              G4int depth)
                                                   >>  70     : G4VPrimitiveScorer(name,depth),HCID(-1),fDirection(direction),EvtMap(0),
                                                   >>  71       weighted(true),divideByArea(true)
                                                   >>  72 {
                                                   >>  73     DefineUnitAndCategory();
                                                   >>  74     SetUnit(unit);
                                                   >>  75 }
                                                   >>  76 
                                                   >>  77 G4PSCylinderSurfaceFlux::~G4PSCylinderSurfaceFlux()
                                                   >>  78 {;}
                                                   >>  79 
                                                   >>  80 G4bool G4PSCylinderSurfaceFlux::ProcessHits(G4Step* aStep,G4TouchableHistory*)
 82 {                                                  81 {
 83   G4StepPoint* preStep = aStep->GetPreStepPoin     82   G4StepPoint* preStep = aStep->GetPreStepPoint();
 84   G4VSolid* solid      = ComputeCurrentSolid(a << 
 85   assert(dynamic_cast<G4Tubs*>(solid));        << 
 86                                                    83 
 87   auto  tubsSolid = static_cast<G4Tubs*>(solid <<  84   G4VPhysicalVolume* physVol = preStep->GetPhysicalVolume();
                                                   >>  85   G4VPVParameterisation* physParam = physVol->GetParameterisation();
                                                   >>  86   G4VSolid * solid = 0;
                                                   >>  87   if(physParam)
                                                   >>  88   { // for parameterized volume
                                                   >>  89     G4int idx = ((G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable()))
                                                   >>  90                 ->GetReplicaNumber(indexDepth);
                                                   >>  91     solid = physParam->ComputeSolid(idx, physVol);
                                                   >>  92     solid->ComputeDimensions(physParam,idx,physVol);
                                                   >>  93   }
                                                   >>  94   else
                                                   >>  95   { // for ordinary volume
                                                   >>  96     solid = physVol->GetLogicalVolume()->GetSolid();
                                                   >>  97   }
 88                                                    98 
 89   G4int dirFlag = IsSelectedSurface(aStep, tub <<  99   G4Tubs* tubsSolid = (G4Tubs*)(solid);
                                                   >> 100   
                                                   >> 101   G4int dirFlag =IsSelectedSurface(aStep,tubsSolid);
                                                   >> 102   
                                                   >> 103   if ( dirFlag > 0 ){
                                                   >> 104     if (fDirection == fFlux_InOut || dirFlag == fDirection ){
 90                                                   105 
 91   if(dirFlag > 0)                              << 106       G4StepPoint* thisStep=0;
 92   {                                            << 107       if ( dirFlag == fFlux_In ){
 93     if(fDirection == fFlux_InOut || dirFlag == << 108   thisStep = preStep;
 94     {                                          << 109       }else if ( dirFlag == fFlux_Out ){
 95       G4StepPoint* thisStep = nullptr;         << 110   thisStep = aStep->GetPostStepPoint();
 96       if(dirFlag == fFlux_In)                  << 111       }else{
 97       {                                        << 112   return FALSE;
 98         thisStep = preStep;                    << 
 99       }                                        << 
100       else if(dirFlag == fFlux_Out)            << 
101       {                                        << 
102         thisStep = aStep->GetPostStepPoint();  << 
103       }                                           113       }
104       else                                     << 114   
105       {                                        << 
106         return false;                          << 
107       }                                        << 
108                                                << 
109       G4TouchableHandle theTouchable = thisSte    115       G4TouchableHandle theTouchable = thisStep->GetTouchableHandle();
110       G4ThreeVector pdirection       = thisSte << 116       G4ThreeVector pdirection = thisStep->GetMomentumDirection();
111       G4ThreeVector localdir =                 << 117       G4ThreeVector localdir  = 
112         theTouchable->GetHistory()->GetTopTran << 118   theTouchable->GetHistory()->GetTopTransform().TransformAxis(pdirection);
113       G4ThreeVector position = thisStep->GetPo    119       G4ThreeVector position = thisStep->GetPosition();
114       G4ThreeVector localpos =                 << 120       G4ThreeVector localpos  =
115         theTouchable->GetHistory()->GetTopTran << 121   theTouchable->GetHistory()->GetTopTransform().TransformAxis(position);
116       G4double angleFactor =                   << 122       G4double angleFactor = (localdir.x()*localpos.x()+localdir.y()*localpos.y())
117         (localdir.x() * localpos.x() + localdi << 123   /std::sqrt(localdir.x()*localdir.x()
118         std::sqrt(localdir.x() * localdir.x()  << 124        +localdir.y()*localdir.y()+localdir.z()*localdir.z())
119                   localdir.z() * localdir.z()) << 125   /std::sqrt(localpos.x()*localpos.x()+localpos.y()*localpos.y());
120         std::sqrt(localpos.x() * localpos.x()  << 126     
121                                                << 127       if ( angleFactor < 0 ) angleFactor *= -1.;
122       if(angleFactor < 0)                      << 128       G4double square = 2.*tubsSolid->GetZHalfLength()
123         angleFactor *= -1.;                    << 129   *tubsSolid->GetInnerRadius()* tubsSolid->GetDeltaPhiAngle()/radian;
124       G4double square = 2. * tubsSolid->GetZHa << 130     
125                         tubsSolid->GetInnerRad << 
126                         tubsSolid->GetDeltaPhi << 
127                                                << 
128       G4double flux = 1.0;                        131       G4double flux = 1.0;
129       if(weighted)                             << 132       if ( weighted ) flux *=preStep->GetWeight();  
130         flux *= preStep->GetWeight();          << 
131       // Current (Particle Weight)                133       // Current (Particle Weight)
132                                                   134 
133       flux = flux / angleFactor;               << 135       flux = flux/angleFactor;   
134       if(divideByArea)                         << 136       if ( divideByArea ) flux /= square;
135         flux /= square;                        << 137       //Flux with angle.
136       // Flux with angle.                      << 
137       G4int index = GetIndex(aStep);              138       G4int index = GetIndex(aStep);
138       EvtMap->add(index, flux);                << 139       EvtMap->add(index,flux);
139                                                << 140       return TRUE;
140       if(!hitIDMap.empty() && hitIDMap.find(in << 141     }else{
141       {                                        << 142       return FALSE;
142         auto filler = G4VScoreHistFiller::Inst << 
143         if(filler == nullptr)                  << 
144         {                                      << 
145           G4Exception("G4PSCylinderSurfaceFlux << 
146                       JustWarning,             << 
147                       "G4TScoreHistFiller is n << 
148                       "not filled.");          << 
149         }                                      << 
150         else                                   << 
151         {                                      << 
152           filler->FillH1(hitIDMap[index], this << 
153         }                                      << 
154       }                                        << 
155                                                << 
156       return true;                             << 
157     }                                             143     }
158                                                << 144   }else{
159     return false;                              << 145       return FALSE;
160   }                                               146   }
161                                                << 
162   return false;                                << 
163 }                                                 147 }
164                                                   148 
165 G4int G4PSCylinderSurfaceFlux::IsSelectedSurfa << 149 G4int G4PSCylinderSurfaceFlux::IsSelectedSurface(G4Step* aStep, G4Tubs* tubsSolid){
166                                                << 150 
167 {                                              << 151   G4TouchableHandle theTouchable = 
168   G4TouchableHandle theTouchable =             << 
169     aStep->GetPreStepPoint()->GetTouchableHand    152     aStep->GetPreStepPoint()->GetTouchableHandle();
170   G4double kCarTolerance =                     << 153   G4double kCarTolerance = G4GeometryTolerance::GetInstance()->GetSurfaceTolerance();  
171     G4GeometryTolerance::GetInstance()->GetSur << 
172                                                   154 
173   if(aStep->GetPreStepPoint()->GetStepStatus() << 155   if (aStep->GetPreStepPoint()->GetStepStatus() == fGeomBoundary ){
174   {                                            << 
175     // Entering Geometry                          156     // Entering Geometry
176     G4ThreeVector stppos1 = aStep->GetPreStepP << 157     G4ThreeVector stppos1= aStep->GetPreStepPoint()->GetPosition();
177     G4ThreeVector localpos1 =                  << 158     G4ThreeVector localpos1 = 
178       theTouchable->GetHistory()->GetTopTransf    159       theTouchable->GetHistory()->GetTopTransform().TransformPoint(stppos1);
179     if(std::fabs(localpos1.z()) > tubsSolid->G << 160     if ( std::fabs(localpos1.z()) > tubsSolid->GetZHalfLength() ) return -1;
180       return -1;                               << 161     //if(std::fabs( localpos1.x()*localpos1.x()+localpos1.y()*localpos1.y()  
181     // if(std::fabs( localpos1.x()*localpos1.x << 
182     //   - (tubsSolid->GetInnerRadius()*tubsSo    162     //   - (tubsSolid->GetInnerRadius()*tubsSolid->GetInnerRadius()))
183     //   <kCarTolerance ){                        163     //   <kCarTolerance ){
184     G4double localR2 =                         << 164     G4double localR2 = localpos1.x()*localpos1.x()+localpos1.y()*localpos1.y();
185       localpos1.x() * localpos1.x() + localpos << 
186     G4double InsideRadius = tubsSolid->GetInne    165     G4double InsideRadius = tubsSolid->GetInnerRadius();
187     if(localR2 >                               << 166     if (localR2 > (InsideRadius-kCarTolerance)*(InsideRadius-kCarTolerance)
188          (InsideRadius - kCarTolerance) * (Ins << 167   &&localR2 < (InsideRadius+kCarTolerance)*(InsideRadius+kCarTolerance)){
189        localR2 <                               << 
190          (InsideRadius + kCarTolerance) * (Ins << 
191     {                                          << 
192       return fFlux_In;                            168       return fFlux_In;
193     }                                             169     }
194   }                                               170   }
195                                                   171 
196   if(aStep->GetPostStepPoint()->GetStepStatus( << 172   if (aStep->GetPostStepPoint()->GetStepStatus() == fGeomBoundary ){
197   {                                            << 
198     // Exiting Geometry                           173     // Exiting Geometry
199     G4ThreeVector stppos2 = aStep->GetPostStep << 174     G4ThreeVector stppos2= aStep->GetPostStepPoint()->GetPosition();
200     G4ThreeVector localpos2 =                  << 175     G4ThreeVector localpos2 = 
201       theTouchable->GetHistory()->GetTopTransf    176       theTouchable->GetHistory()->GetTopTransform().TransformPoint(stppos2);
202     if(std::fabs(localpos2.z()) > tubsSolid->G << 177     if ( std::fabs(localpos2.z()) > tubsSolid->GetZHalfLength() ) return -1;
203       return -1;                               << 178     //if(std::fabs( localpos2.x()*localpos2.x()+localpos2.y()*localpos2.y()  
204     // if(std::fabs( localpos2.x()*localpos2.x << 179     //   - (tubsSolid->GetInnerRadius()*tubsSolid->GetInnerRadius())) 
205     //   - (tubsSolid->GetInnerRadius()*tubsSo << 
206     // <kCarTolerance ){                          180     // <kCarTolerance ){
207     G4double localR2 =                         << 181     G4double localR2 = localpos2.x()*localpos2.x()+localpos2.y()*localpos2.y();
208       localpos2.x() * localpos2.x() + localpos << 
209     G4double InsideRadius = tubsSolid->GetInne    182     G4double InsideRadius = tubsSolid->GetInnerRadius();
210     if(localR2 >                               << 183     if (localR2 > (InsideRadius-kCarTolerance)*(InsideRadius-kCarTolerance)
211          (InsideRadius - kCarTolerance) * (Ins << 184   &&localR2 < (InsideRadius+kCarTolerance)*(InsideRadius+kCarTolerance)){
212        localR2 <                               << 
213          (InsideRadius + kCarTolerance) * (Ins << 
214     {                                          << 
215       return fFlux_Out;                           185       return fFlux_Out;
216     }                                             186     }
217   }                                               187   }
218                                                   188 
219   return -1;                                      189   return -1;
220 }                                                 190 }
221                                                   191 
222 void G4PSCylinderSurfaceFlux::Initialize(G4HCo    192 void G4PSCylinderSurfaceFlux::Initialize(G4HCofThisEvent* HCE)
223 {                                                 193 {
224   EvtMap = new G4THitsMap<G4double>(GetMultiFu    194   EvtMap = new G4THitsMap<G4double>(GetMultiFunctionalDetector()->GetName(),
225                                     GetName()) << 195             GetName());
226   if(HCID < 0)                                 << 196   if ( HCID < 0 ) HCID = GetCollectionID(0);
227     HCID = GetCollectionID(0);                 << 197   HCE->AddHitsCollection(HCID, (G4VHitsCollection*)EvtMap);
228   HCE->AddHitsCollection(HCID, (G4VHitsCollect << 198 }
                                                   >> 199 
                                                   >> 200 void G4PSCylinderSurfaceFlux::EndOfEvent(G4HCofThisEvent*)
                                                   >> 201 {;}
                                                   >> 202 
                                                   >> 203 void G4PSCylinderSurfaceFlux::clear(){
                                                   >> 204   EvtMap->clear();
229 }                                                 205 }
230                                                   206 
231 void G4PSCylinderSurfaceFlux::clear() { EvtMap << 207 void G4PSCylinderSurfaceFlux::DrawAll()
                                                   >> 208 {;}
232                                                   209 
233 void G4PSCylinderSurfaceFlux::PrintAll()          210 void G4PSCylinderSurfaceFlux::PrintAll()
234 {                                                 211 {
235   G4cout << " MultiFunctionalDet  " << detecto    212   G4cout << " MultiFunctionalDet  " << detector->GetName() << G4endl;
236   G4cout << " PrimitiveScorer" << GetName() << << 213   G4cout << " PrimitiveScorer" << GetName() <<G4endl; 
237   G4cout << " Number of entries " << EvtMap->e    214   G4cout << " Number of entries " << EvtMap->entries() << G4endl;
238   for(const auto& [copy, flux] : *(EvtMap->Get << 215   std::map<G4int,G4double*>::iterator itr = EvtMap->GetMap()->begin();
239   {                                            << 216   for(; itr != EvtMap->GetMap()->end(); itr++) {
240     G4cout << "  copy no.: " << copy           << 217     G4cout << "  copy no.: " << itr->first
241            << "  flux  : " << *(flux) / GetUni << 218      << "  flux  : " << *(itr->second)/GetUnitValue()
242            << GetUnit() << "]" << G4endl;      << 219      << " ["<<GetUnit()<<"]"
                                                   >> 220      << G4endl;
243   }                                               221   }
244 }                                                 222 }
245                                                   223 
246 void G4PSCylinderSurfaceFlux::SetUnit(const G4    224 void G4PSCylinderSurfaceFlux::SetUnit(const G4String& unit)
247 {                                                 225 {
248   if(divideByArea)                             << 226     if ( divideByArea ) {
249   {                                            << 227   CheckAndSetUnit(unit,"Per Unit Surface");
250     CheckAndSetUnit(unit, "Per Unit Surface"); << 228     } else {
251   }                                            << 229   if (unit == "" ){
252   else                                         << 230       unitName = unit;
253   {                                            << 231       unitValue = 1.0;
254     if(unit.empty())                           << 232   }else{
255     {                                          << 233       G4String msg = "Invalid unit ["+unit+"] (Current  unit is [" +GetUnit()+"] ) for " + GetName();
256       unitName  = unit;                        << 234       G4Exception("G4PSCylinderSurfaceFlux::SetUnit","DetPS0003",JustWarning,msg);
257       unitValue = 1.0;                         << 235   }
258     }                                          << 
259     else                                       << 
260     {                                          << 
261       G4String msg = "Invalid unit [" + unit + << 
262                      GetUnit() + "] ) for " +  << 
263       G4Exception("G4PSCylinderSurfaceFlux::Se << 
264                   msg);                        << 
265     }                                             236     }
266   }                                            << 
267 }                                                 237 }
268                                                   238 
269 void G4PSCylinderSurfaceFlux::DefineUnitAndCat << 239 void G4PSCylinderSurfaceFlux::DefineUnitAndCategory(){
270 {                                              << 240    // Per Unit Surface
271   // Per Unit Surface                          << 241    new G4UnitDefinition("percentimeter2","percm2","Per Unit Surface",(1./cm2));
272   new G4UnitDefinition("percentimeter2", "perc << 242    new G4UnitDefinition("permillimeter2","permm2","Per Unit Surface",(1./mm2));
273                        (1. / cm2));            << 243    new G4UnitDefinition("permeter2","perm2","Per Unit Surface",(1./m2));
274   new G4UnitDefinition("permillimeter2", "perm << 
275                        (1. / mm2));            << 
276   new G4UnitDefinition("permeter2", "perm2", " << 
277 }                                                 244 }
                                                   >> 245 
                                                   >> 246 
278                                                   247