Ignore:
Timestamp:
Nov 5, 2010, 3:45:55 PM (14 years ago)
Author:
garnier
Message:

update ti head

Location:
trunk/source/digits_hits/utils/src
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/digits_hits/utils/src/CVS/Entries

    r1337 r1340  
    1 /G4DefaultLinearColorMap.cc/1.3/Wed Sep 29 21:48:27 2010//Tgeant4-09-04-beta-01
    2 /G4ScoreLogColorMap.cc/1.3/Wed Sep 29 21:48:27 2010//Tgeant4-09-04-beta-01
    3 /G4ScoreQuantityMessenger.cc/1.8/Wed Sep 29 21:48:27 2010//Tgeant4-09-04-beta-01
    4 /G4ScoreQuantityMessengerQCmd.cc/1.6/Wed Sep 29 21:48:27 2010//Tgeant4-09-04-beta-01
    5 /G4ScoringBox.cc/1.54/Wed Sep 29 21:48:28 2010//Tgeant4-09-04-beta-01
    6 /G4ScoringBoxParameterisation.cc/1.4/Wed Sep 29 21:48:28 2010//Tgeant4-09-04-beta-01
    7 /G4ScoringCylinder.cc/1.6/Wed Sep 29 21:48:28 2010//Tgeant4-09-04-beta-01
    8 /G4ScoringManager.cc/1.31/Wed Sep 29 21:48:28 2010//Tgeant4-09-04-beta-01
    9 /G4ScoringMessenger.cc/1.39/Wed Sep 29 21:48:28 2010//Tgeant4-09-04-beta-01
    10 /G4VScoreColorMap.cc/1.4/Wed Sep 29 21:48:28 2010//Tgeant4-09-04-beta-01
    11 /G4VScoreWriter.cc/1.5/Wed Sep 29 21:48:29 2010//Tgeant4-09-04-beta-01
    12 /G4VScoringMesh.cc/1.37/Wed Sep 29 21:48:29 2010//Tgeant4-09-04-beta-01
     1/G4DefaultLinearColorMap.cc/1.3/Thu Nov  4 15:58:45 2010//
     2/G4ScoreLogColorMap.cc/1.10/Fri Nov  5 09:56:24 2010//
     3/G4ScoreQuantityMessenger.cc/1.10/Fri Nov  5 09:56:24 2010//
     4/G4ScoreQuantityMessengerQCmd.cc/1.8/Fri Nov  5 09:56:24 2010//
     5/G4ScoringBox.cc/1.61/Fri Nov  5 09:56:25 2010//
     6/G4ScoringCylinder.cc/1.16/Fri Nov  5 09:56:25 2010//
     7/G4ScoringManager.cc/1.33/Fri Nov  5 09:56:25 2010//
     8/G4ScoringMessenger.cc/1.42/Fri Nov  5 09:56:25 2010//
     9/G4VScoreColorMap.cc/1.8/Fri Nov  5 09:56:25 2010//
     10/G4VScoreWriter.cc/1.10/Fri Nov  5 09:56:25 2010//
     11/G4VScoringMesh.cc/1.42/Fri Nov  5 09:56:25 2010//
    1312D
  • trunk/source/digits_hits/utils/src/G4DefaultLinearColorMap.cc

    r1337 r1340  
    2626//
    2727// $Id: G4DefaultLinearColorMap.cc,v 1.3 2008/08/29 02:50:05 akimura Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     28// GEANT4 tag $Name: $
    2929//
    3030
  • trunk/source/digits_hits/utils/src/G4ScoreLogColorMap.cc

    r1337 r1340  
    2525//
    2626//
    27 // $Id: G4ScoreLogColorMap.cc,v 1.3 2009/05/04 15:57:33 akimura Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4ScoreLogColorMap.cc,v 1.10 2010/11/03 19:31:36 asaim Exp $
     28// GEANT4 tag $Name: $
    2929//
    3030
     
    5050{;}
    5151
     52#include "G4UIcommand.hh"
    5253void G4ScoreLogColorMap::GetMapColor(G4double val, G4double color[4])
    5354{
    5455  G4bool lmin = true, lmax = true, lval = true;
    55   if(fMinVal <= 0.) lmin = false;
    56   if(fMaxVal <= 0.) lmax = false;
    57   if(val <= 0.) lval = false;
     56  if(fMinVal < 0.) {
     57    lmin = false;
     58    G4String message = "    The min. value (fMinVal) is negative. : ";
     59    message += G4UIcommand::ConvertToString(fMinVal);
     60    G4Exception("G4ScoreLogColorMap::GetMapColor()",
     61                "DigiHitsUtilsScoreLogColorMap000", JustWarning,
     62                message);
     63  }
     64  if(fMaxVal < 0.) {
     65    lmax = false;
     66    G4String message = "    The max. value (fMaxVal) is negative. : ";
     67    message += G4UIcommand::ConvertToString(fMaxVal);
     68    G4Exception("G4ScoreLogColorMap::GetMapColor()",
     69                "DigiHitsUtilsScoreLogColorMap001", JustWarning,
     70                message);
     71  }
     72  if(!lmin || !lmax) {
     73    color[0] = 0.;
     74    color[1] = 0.;
     75    color[2] = 0.;
     76    color[3] = 0.;
     77    return;
     78  }
     79
     80  if(val < 0.) {
     81    lval = false;
     82    G4String message = "     'val' (first argument) is negative : ";
     83    message += G4UIcommand::ConvertToString(fMaxVal);
     84    G4Exception("G4ScoreLogColorMap::GetMapColor()",
     85                "DigiHitsUtilsScoreLogColorMap002", JustWarning,
     86                message);
     87  }
     88  if(!lval) {
     89    color[0] = 0.;
     90    color[1] = 0.;
     91    color[2] = 0.;
     92    color[3] = -1.;
     93    return;
     94  }
     95
    5896  G4double logmin = 0., logmax = 0., logval = 0.;
    5997  if(lmin) logmin = std::log10(fMinVal);
     
    101139void G4ScoreLogColorMap::DrawColorChartBar(G4int _nPoint) {
    102140
     141  G4cout << "++++++ " << fMinVal << " - " << fMaxVal << G4endl;
    103142  G4bool lmin = true, lmax = true;
    104143  if(fMinVal <= 0.) lmin = false;
     
    118157    G4double val = std::pow(10., (ra*max+rb*min)/(ra+rb));
    119158    this->GetMapColor(val, c);
     159    if(c[0] == 0 && c[1] == 0 && c[2] == 0 && c[3] == 0) return;
     160    if(c[0] == 0 && c[1] == 0 && c[2] == 0 && c[3] == -1.) continue;
    120161    G4Colour col(c[0], c[1], c[2]);
    121162    G4VisAttributes att(col);
     
    132173  G4double min = 0.;
    133174  if(lmin) min = std::log10(fMinVal);
    134   if(min > 0.) min = std::floor(min);
    135   else min = std::ceil(min);
     175  //if(min > 0.) min = std::floor(min);
     176  //else min = std::ceil(min);
    136177
    137178  G4double max = 0.;
    138179  if(lmax) max = std::log10(fMaxVal);
    139   if(max > 0.) max = std::floor(max);
    140   else max = std::ceil(max);
     180  //if(max > 0.) max = std::ceil(max);
     181  //else max = std::floor(max);
    141182
    142183  G4double c[4];
     
    145186    G4double a = n/(_nPoint-1.), b = 1.-a;
    146187    G4double v = (a*max + b*min)/(a+b);
     188
     189    this->GetMapColor(std::pow(10., v), c);
     190    if(c[0] == 0 && c[1] == 0 && c[2] == 0 && c[3] == 0) return;
     191    if(c[0] == 0 && c[1] == 0 && c[2] == 0 && c[3] == -1.) continue;
     192
    147193    // background color
    148194    for(int l = 0; l < 21; l++) {
     
    165211    G4double size = 12.;
    166212    text.SetScreenSize(size);
    167     this->GetMapColor(std::pow(10., v), c);
     213    //this->GetMapColor(std::pow(10., v), c);
    168214    G4Colour color(c[0], c[1], c[2]);
    169215    G4VisAttributes att(color);
     
    172218    fVisManager->Draw2D(text);
    173219  }
     220
     221
     222  // draw ps name
     223  // background
     224  G4int lpsname = 20;// fPSName.size();
     225  if(lpsname > 0) {
     226    for(int l = 0; l < 22; l++) {
     227      G4Polyline line;
     228      line.push_back(G4Point3D(-0.9, -0.965+0.002*l, 0.));
     229      line.push_back(G4Point3D(-0.9+0.025*lpsname, -0.965+0.002*l, 0.));
     230      G4VisAttributes attblack(black);
     231      //G4VisAttributes attblack(G4Colour(.0, .5, .0));
     232      line.SetVisAttributes(&attblack);
     233      fVisManager->Draw2D(line);
     234    }
     235    // ps name
     236    G4Text txtpsname(fPSName, G4Point3D(-0.9, -0.96, 0.));
     237    G4double size = 12.;
     238    txtpsname.SetScreenSize(size);
     239    G4Colour color(1., 1., 1.);
     240    G4VisAttributes att(color);
     241    txtpsname.SetVisAttributes(&att);
     242    fVisManager->Draw2D(txtpsname);
     243  }
     244
     245
     246
     247  // draw unit
     248  // background
     249  G4int len = fPSUnit.size();
     250  if(len > 0) {
     251    for(int l = 0; l < 21; l++) {
     252      G4Polyline line;
     253      line.push_back(G4Point3D(-0.7, -0.9+0.002*l, 0.));
     254      line.push_back(G4Point3D(-0.7+0.3, -0.9+0.002*l, 0.));
     255      G4VisAttributes attblack(black);
     256      //G4VisAttributes attblack(G4Colour(.5, .0, .0));
     257      line.SetVisAttributes(&attblack);
     258      fVisManager->Draw2D(line);
     259    }
     260    // unit
     261    G4String psunit = "[" + fPSUnit + "]";
     262    G4Text txtunit(psunit, G4Point3D(-0.69, -0.9, 0.));
     263    G4double size = 12.;
     264    txtunit.SetScreenSize(size);
     265    G4Colour color(1., 1., 1.);
     266    G4VisAttributes att(color);
     267    txtunit.SetVisAttributes(&att);
     268    fVisManager->Draw2D(txtunit);
     269  }
     270
    174271}
  • trunk/source/digits_hits/utils/src/G4ScoreQuantityMessenger.cc

    r1337 r1340  
    2525//
    2626//
    27 // $Id: G4ScoreQuantityMessenger.cc,v 1.8 2007/11/07 04:12:07 akimura Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4ScoreQuantityMessenger.cc,v 1.10 2010/11/03 08:28:42 taso Exp $
     28// GEANT4 tag $Name: $
    2929//
     30// ---------------------------------------------------------------------
     31// Modifications
     32// 08-Oct-2010 T.Aso remove unit of G4PSPassageCellCurrent.
    3033// ---------------------------------------------------------------------
    3134
     
    5558#include "G4PSTrackCounter3D.hh"
    5659#include "G4PSTermination3D.hh"
     60#include "G4PSMinKinEAtGeneration3D.hh"
    5761
    5862#include "G4SDChargedFilter.hh"
     
    160164    delete         quantityDir;
    161165    delete         qTouchCmd;
     166    delete         qGetUnitCmd;
     167    delete         qSetUnitCmd;
     168
    162169    //
    163170    delete    qCellChgCmd;
     
    182189    delete          qTrackCountCmd;
    183190    delete          qTerminationCmd;
     191    delete          qMinKinEAtGeneCmd;
    184192    //
    185193    delete   filterDir;
     
    209217      if(command==qTouchCmd) {
    210218              mesh->SetCurrentPrimitiveScorer(newVal);
     219      } else if(command == qGetUnitCmd ){
     220          G4cout << "Unit:  "<< mesh->GetCurrentPSUnit() <<G4endl;
     221      } else if(command == qSetUnitCmd ){
     222          mesh->SetCurrentPSUnit(newVal);
    211223      } else if(command== qCellChgCmd) {
    212             if(!mesh->FindPrimitiveScorer(newVal)) {
    213               mesh->SetPrimitiveScorer(new G4PSCellCharge3D(newVal));
    214             } else {
    215               G4cout << "WARNING[" << qTouchCmd->GetCommandPath()
    216                      << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
    217               mesh->SetNullToCurrentPrimitiveScorer();
    218             }
     224          if ( CheckMeshPS(mesh,token[0]) ){
     225              G4PSCellCharge3D* ps = new G4PSCellCharge3D(token[0]);
     226              ps->SetUnit(token[1]);
     227              mesh->SetPrimitiveScorer(ps);
     228          }
    219229      } else if(command== qCellFluxCmd) {
    220             if(!mesh->FindPrimitiveScorer(newVal)) {
    221               mesh->SetPrimitiveScorer(new G4PSCellFlux3D(newVal));
    222             } else {
    223               G4cout << "WARNING[" << qCellFluxCmd->GetCommandPath()
    224                      << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
    225               mesh->SetNullToCurrentPrimitiveScorer();
    226             }
     230          if ( CheckMeshPS(mesh,token[0]) ){
     231              G4PSCellFlux3D* ps = new G4PSCellFlux3D(token[0]);
     232              ps->SetUnit(token[1]);
     233              mesh->SetPrimitiveScorer(ps);
     234          }
    227235      } else if(command== qPassCellFluxCmd) {
    228             if(!mesh->FindPrimitiveScorer(newVal))  {
    229               mesh->SetPrimitiveScorer(new G4PSPassageCellFlux3D(newVal));
    230             } else {
    231               G4cout << "WARNING[" << qPassCellFluxCmd->GetCommandPath()
    232                      << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
    233               mesh->SetNullToCurrentPrimitiveScorer();
    234             }
     236          if ( CheckMeshPS(mesh,token[0]) ){
     237              G4PSPassageCellFlux3D* ps = new G4PSPassageCellFlux3D(token[0]);
     238              ps->SetUnit(token[1]);
     239              mesh->SetPrimitiveScorer(ps);
     240          }
    235241      } else if(command==qeDepCmd) {
    236             if(!mesh->FindPrimitiveScorer(newVal))  {
    237               mesh->SetPrimitiveScorer(new G4PSEnergyDeposit3D(newVal));
    238             } else {
    239               G4cout << "WARNING[" << qeDepCmd->GetCommandPath()
    240                      << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
    241               mesh->SetNullToCurrentPrimitiveScorer();
    242             }
     242          if ( CheckMeshPS(mesh,token[0]) ){
     243              G4PSEnergyDeposit3D* ps =new G4PSEnergyDeposit3D(token[0]);
     244              ps->SetUnit(token[1]);
     245              mesh->SetPrimitiveScorer(ps);
     246          }
    243247      } else if(command== qdoseDepCmd) {
    244             if(!mesh->FindPrimitiveScorer(newVal))  {
    245               mesh->SetPrimitiveScorer(new G4PSDoseDeposit3D(newVal));
    246             } else {
    247               G4cout << "WARNING[" << qdoseDepCmd->GetCommandPath()
    248                      << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
    249               mesh->SetNullToCurrentPrimitiveScorer();
    250             }
     248          if ( CheckMeshPS(mesh,token[0]) ){
     249              G4PSDoseDeposit3D* ps = new G4PSDoseDeposit3D(token[0]);
     250              ps->SetUnit(token[1]);
     251              mesh->SetPrimitiveScorer(ps);
     252          }
    251253      } else if(command== qnOfStepCmd) {
    252             if(!mesh->FindPrimitiveScorer(newVal))  {
    253               mesh->SetPrimitiveScorer(new G4PSNofStep3D(newVal));
    254             } else {
    255               G4cout << "WARNING[" << qnOfStepCmd->GetCommandPath()
    256                      << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
    257               mesh->SetNullToCurrentPrimitiveScorer();
    258             }
     254          if ( CheckMeshPS(mesh,token[0]) ){
     255              G4PSNofStep3D* ps = new G4PSNofStep3D(token[0]);
     256              mesh->SetPrimitiveScorer(ps);
     257          }
    259258      } else if(command== qnOfSecondaryCmd) {
    260             if(!mesh->FindPrimitiveScorer(newVal))  {
    261               mesh->SetPrimitiveScorer(new G4PSNofSecondary3D(newVal));
    262             } else {
    263               G4cout << "WARNING[" << qnOfSecondaryCmd->GetCommandPath()
    264                      << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
    265               mesh->SetNullToCurrentPrimitiveScorer();
    266             }
     259          if ( CheckMeshPS(mesh,token[0]) ){
     260              G4PSNofSecondary3D* ps =new G4PSNofSecondary3D(token[0]);
     261              mesh->SetPrimitiveScorer(ps);
     262          }
    267263      } else if(command== qTrackLengthCmd) {
    268             if(!mesh->FindPrimitiveScorer(newVal)) {
     264          if ( CheckMeshPS(mesh,token[0]) ){
    269265              G4PSTrackLength3D* ps = new G4PSTrackLength3D(token[0]);
    270266              ps->Weighted(StoB(token[1]));
    271267              ps->MultiplyKineticEnergy(StoB(token[2]));
    272268              ps->DivideByVelocity(StoB(token[3]));
    273               mesh->SetPrimitiveScorer(ps);
    274             } else {
    275               G4cout << "WARNING[" << qTrackLengthCmd->GetCommandPath()
    276                      << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
    277               mesh->SetNullToCurrentPrimitiveScorer();
    278             }
     269              ps->SetUnit(token[4]);
     270              mesh->SetPrimitiveScorer(ps);
     271          }
    279272      } else if(command== qPassCellCurrCmd){
    280             if(!mesh->FindPrimitiveScorer(newVal)) {
     273          if( CheckMeshPS(mesh,token[0]) ) {
    281274              G4PSPassageCellCurrent* ps = new G4PSPassageCellCurrent3D(token[0]);
    282275              ps->Weighted(StoB(token[1]));
    283               mesh->SetPrimitiveScorer(ps);
    284             } else {
    285               G4cout << "WARNING[" << qPassCellCurrCmd->GetCommandPath()
    286                      << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
    287               mesh->SetNullToCurrentPrimitiveScorer();
    288             }
     276              //ps->SetUnit(token[2]);
     277              mesh->SetPrimitiveScorer(ps);
     278          }
    289279      } else if(command== qPassTrackLengthCmd){
    290             if(!mesh->FindPrimitiveScorer(newVal)) {
     280          if( CheckMeshPS(mesh,token[0]) ) {
    291281              G4PSPassageTrackLength* ps = new G4PSPassageTrackLength3D(token[0]);
    292282              ps->Weighted(StoB(token[1]));
    293283              mesh->SetPrimitiveScorer(ps);
    294             } else {
    295               G4cout << "WARNING[" << qPassTrackLengthCmd->GetCommandPath()
    296                      << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
    297               mesh->SetNullToCurrentPrimitiveScorer();
    298             }
     284          }
    299285      } else if(command== qFlatSurfCurrCmd){
    300             if(!mesh->FindPrimitiveScorer(newVal)) {
     286          if( CheckMeshPS(mesh,token[0])) {
    301287              G4PSFlatSurfaceCurrent3D* ps =
    302288                new G4PSFlatSurfaceCurrent3D(token[0],StoI(token[1]));
    303289              ps->Weighted(StoB(token[2]));
    304290              ps->DivideByArea(StoB(token[3]));
    305               mesh->SetPrimitiveScorer(ps);
    306             } else {
    307               G4cout << "WARNING[" << qFlatSurfCurrCmd->GetCommandPath()
    308                      << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
    309               mesh->SetNullToCurrentPrimitiveScorer();
    310             }
     291              ps->SetUnit(token[4]);
     292              mesh->SetPrimitiveScorer(ps);
     293          }
    311294      } else if(command== qFlatSurfFluxCmd){
    312             if(!mesh->FindPrimitiveScorer(newVal)) {
    313               mesh->SetPrimitiveScorer(
    314                                        new G4PSFlatSurfaceFlux3D(token[0],StoI(token[1])));
    315             } else {
    316               G4cout << "WARNING[" << qFlatSurfFluxCmd->GetCommandPath()
    317                      << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
    318               mesh->SetNullToCurrentPrimitiveScorer();
    319             }
    320 //        } else if(command== qSphereSurfCurrCmd){
    321 //          if(!mesh->FindPrimitiveScorer(newVal)) {
     295          if( CheckMeshPS(mesh, token[0] )) {
     296              G4PSFlatSurfaceFlux3D* ps = new G4PSFlatSurfaceFlux3D(token[0],StoI(token[1]));
     297              ps->SetUnit(token[2]);
     298              mesh->SetPrimitiveScorer(ps);
     299          }
     300//    } else if(command== qSphereSurfCurrCmd){
     301//        if( CheckMeshPS(mesh, token[0] )) {
    322302//            G4PSSphereSurfaceCurrent3D* ps =
    323303//              new G4PSSphereSurfaceCurrent3D(token[0],StoI(token[1]));
    324304//            ps->Weighted(StoB(token[2]));
    325305//            ps->DivideByArea(StoB(token[3]));
     306//            ps->SetUnit(token[4]);
    326307//            mesh->SetPrimitiveScorer(ps);
    327 //          } else {
    328 //            G4cout << "WARNING[" << qSphereSurfCurrCmd->GetCommandPath()
    329 //                   << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
    330 //            mesh->SetNullToCurrentPrimitiveScorer();
    331 //          }
    332 //        } else if(command== qSphereSurfFluxCmd){
    333 //          if(!mesh->FindPrimitiveScorer(newVal)) {
    334 //            mesh->SetPrimitiveScorer(
    335 //                                     new G4PSSphereSurfaceFlux3D(token[0], StoI(token[1])));
    336 //          } else {
    337 //            G4cout << "WARNING[" << qSphereSurfFluxCmd->GetCommandPath()
    338 //                   << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
    339 //            mesh->SetNullToCurrentPrimitiveScorer();
    340 //          }
    341 //        } else if(command== qCylSurfCurrCmd){
    342 //          if(!mesh->FindPrimitiveScorer(newVal)) {
     308//        }
     309//   } else if(command== qSphereSurfFluxCmd){
     310//        if( CheckMeshPS(mesh,token[0])) {
     311//            G4PSSphereSurfaceFlux3D* ps = new G4PSSphereSurfaceFlux3D(token[0], StoI(token[1]));
     312//            ps->SetUnit(token[2]);       
     313//            mesh->SetPrimitiveScorer(ps);
     314//        }
     315//   } else if(command== qCylSurfCurrCmd){
     316//        if( CheckMeshPS(mesh, token[0] ) ) {
    343317//            G4PSCylinderSurfaceCurrent3D* ps =
    344318//              new G4PSCylinderSurfaceCurrent3D(token[0],StoI(token[1]));
    345319//            ps->Weighted(StoB(token[2]));
    346320//            ps->DivideByArea(StoB(token[3]));
     321//            ps->SetUnit(token[4]);
    347322//            mesh->SetPrimitiveScorer(ps);
    348 //          } else {
    349 //            G4cout << "WARNING[" << qCylSurfCurrCmd->GetCommandPath()
    350 //                   << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
    351 //            mesh->SetNullToCurrentPrimitiveScorer();
    352 //          }
    353 //        } else if(command== qCylSurfFluxCmd){
    354 //          if(!mesh->FindPrimitiveScorer(newVal)) {
    355 //            mesh->SetPrimitiveScorer(
    356 //                                     new G4PSCylinderSurfaceFlux3D(token[0], StoI(token[1])));
    357 //          } else {
    358 //            G4cout << "WARNING[" << qCylSurfFluxCmd->GetCommandPath()
    359 //                   << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
    360 //            mesh->SetNullToCurrentPrimitiveScorer();
    361 //          }
     323//        }
     324//   } else if(command== qCylSurfFluxCmd){
     325//        if( CheckMeshPS(mesh, token[0] ) {
     326//            G4PSCylinerSurfaceFlux3D* ps =new G4PSCylinderSurfaceFlux3D(token[0], StoI(token[1]));
     327//            ps->SetUnit(token[2]);
     328//            mesh->SetPrimitiveScorer(ps);
     329//        }
    362330      } else if(command== qNofCollisionCmd){
    363             if(!mesh->FindPrimitiveScorer(newVal)) {
     331          if( CheckMeshPS(mesh,token[0])) {
    364332              G4PSNofCollision3D* ps =new G4PSNofCollision3D(token[0]);
    365333              ps->Weighted(StoB(token[1]));
    366334              mesh->SetPrimitiveScorer(ps);
    367             } else {
    368               G4cout << "WARNING[" << qNofCollisionCmd->GetCommandPath()
    369                      << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
    370               mesh->SetNullToCurrentPrimitiveScorer();
    371             }
     335          }
    372336      } else if(command== qPopulationCmd){
    373             if(!mesh->FindPrimitiveScorer(newVal)) {
     337          if( CheckMeshPS(mesh,token[0]) ) {
    374338              G4PSPopulation3D* ps =new G4PSPopulation3D(token[0]);
    375339              ps->Weighted(StoB(token[1]));
    376340              mesh->SetPrimitiveScorer(ps);
    377             } else {
    378               G4cout << "WARNING[" << qPopulationCmd->GetCommandPath()
    379                      << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
    380               mesh->SetNullToCurrentPrimitiveScorer();
    381             }
     341          }
    382342      } else if(command== qTrackCountCmd){
    383             if(!mesh->FindPrimitiveScorer(newVal)) {
     343          if( CheckMeshPS(mesh,token[0])) {
    384344              G4PSTrackCounter3D* ps =new G4PSTrackCounter3D(token[0],StoI(token[1]));
    385345              mesh->SetPrimitiveScorer(ps);
    386             } else {
    387               G4cout << "WARNING[" << qTrackCountCmd->GetCommandPath()
    388                      << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
    389               mesh->SetNullToCurrentPrimitiveScorer();
    390             }
     346          }
    391347      } else if(command== qTerminationCmd){
    392             if(!mesh->FindPrimitiveScorer(newVal)) {
     348          if( CheckMeshPS(mesh,token[0])) {
    393349              G4PSTermination3D* ps =new G4PSTermination3D(token[0]);
    394350              ps->Weighted(StoB(token[1]));
    395351              mesh->SetPrimitiveScorer(ps);
    396             } else {
    397               G4cout << "WARNING[" << qTerminationCmd->GetCommandPath()
    398                      << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
    399               mesh->SetNullToCurrentPrimitiveScorer();
    400             }
     352          }
     353
     354      } else if(command== qMinKinEAtGeneCmd){
     355          if( CheckMeshPS(mesh,token[0]) ){
     356              G4PSMinKinEAtGeneration3D* ps =new G4PSMinKinEAtGeneration3D(token[0]);
     357              ps->SetUnit(token[1]);
     358              mesh->SetPrimitiveScorer(ps);
     359          }
    401360
    402361            //
     
    488447    mesh->SetFilter(filter);
    489448}
    490  
     449
     450G4bool G4ScoreQuantityMessenger::CheckMeshPS(G4VScoringMesh* mesh, G4String& psname){
     451    if(!mesh->FindPrimitiveScorer(psname)) {
     452        return true;
     453    } else {
     454        G4cout << "WARNING[" << qTouchCmd->GetCommandPath()
     455               << "] : Quantity name, \"" << psname << "\", is already existing." << G4endl;
     456        mesh->SetNullToCurrentPrimitiveScorer();
     457        return false;
     458    }
     459}
  • trunk/source/digits_hits/utils/src/G4ScoreQuantityMessengerQCmd.cc

    r1337 r1340  
    2525//
    2626//
    27 // $Id: G4ScoreQuantityMessengerQCmd.cc,v 1.6 2007/11/07 04:12:07 akimura Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
    29 //
     27// $Id: G4ScoreQuantityMessengerQCmd.cc,v 1.8 2010/11/03 08:29:02 taso Exp $
     28// GEANT4 tag $Name:  $
     29//
     30// ---------------------------------------------------------------------
     31// Modifications
     32// 08-Oct-2010 T.Aso remove unit of G4PSPassageCellCurrent.
    3033// ---------------------------------------------------------------------
    3134
     
    8689  qTouchCmd->SetParameterName("qname",false);
    8790  //
    88   qeDepCmd = new G4UIcmdWithAString("/score/quantity/energyDeposit",this);
     91  qGetUnitCmd = new G4UIcmdWithoutParameter("/score/quantity/get/unit",this);
     92  qGetUnitCmd->SetGuidance("Print output unit of the current quantity.");
     93  //
     94  qSetUnitCmd = new G4UIcmdWithAString("/score/quantity/set/unit",this);
     95  qSetUnitCmd->SetGuidance("Set output unit of the current quantity.");
     96  qSetUnitCmd->SetParameterName("unit",false);
     97
     98  // Primitive Scorers
     99  qeDepCmd = new G4UIcommand("/score/quantity/energyDeposit",this);
    89100  qeDepCmd->SetGuidance("Energy deposit scorer.");
    90   qeDepCmd->SetParameterName("qname",false);
    91   //
    92   qCellChgCmd  = new G4UIcmdWithAString("/score/quantity/cellCharge",this);
     101  qeDepCmd->
     102  SetGuidance("[usage] /score/quantiy/energyDeposit qname unit");
     103  qeDepCmd->SetGuidance("  qname  :(String) scorer name");
     104  qeDepCmd->SetGuidance("  unit   :(String) unit");
     105  param = new G4UIparameter("qname",'s',false);
     106  qeDepCmd->SetParameter(param);
     107  param = new G4UIparameter("unit",'s',true);
     108  param->SetDefaultValue("MeV");
     109  qeDepCmd->SetParameter(param);
     110  //
     111  qCellChgCmd  = new G4UIcommand("/score/quantity/cellCharge",this);
    93112  qCellChgCmd->SetGuidance("Cell charge scorer.");
    94   qCellChgCmd->SetParameterName("qname",false);
    95   //
    96   qCellFluxCmd = new G4UIcmdWithAString("/score/quantity/cellFlux",this);
     113  qCellChgCmd->
     114  SetGuidance("[usage] /score/quantiy/cellCharge qname unit");
     115  qCellChgCmd->SetGuidance("  qname  :(String) scorer name");
     116  qCellChgCmd->SetGuidance("  unit   :(String) unit");
     117  param = new G4UIparameter("qname",'s',false);
     118  qCellChgCmd->SetParameter(param);
     119  param = new G4UIparameter("unit",'s',true);
     120  param->SetDefaultValue("e+");
     121  qCellChgCmd->SetParameter(param);
     122  //
     123  qCellFluxCmd = new G4UIcommand("/score/quantity/cellFlux",this);
    97124  qCellFluxCmd->SetGuidance("Cell flux scorer.");
    98   qCellFluxCmd->SetParameterName("qname",false);
    99   //
    100   qPassCellFluxCmd = new G4UIcmdWithAString("/score/quantity/passageCellFlux",this);
     125  qCellFluxCmd->
     126  SetGuidance("[usage] /score/quantiy/cellFlux qname unit");
     127  qCellFluxCmd->SetGuidance("  qname  :(String) scorer name");
     128  qCellFluxCmd->SetGuidance("  unit   :(String) unit");
     129  param = new G4UIparameter("qname",'s',false);
     130  qCellFluxCmd->SetParameter(param);
     131  param = new G4UIparameter("unit",'s',true);
     132  param->SetDefaultValue("percm2");
     133  qCellFluxCmd->SetParameter(param);
     134  //
     135  qPassCellFluxCmd = new G4UIcommand("/score/quantity/passageCellFlux",this);
    101136  qPassCellFluxCmd->SetGuidance("Passage cell flux scorer");
    102   qPassCellFluxCmd->SetParameterName("qname",false);
    103   //
    104   qdoseDepCmd = new G4UIcmdWithAString("/score/quantity/doseDeposit",this);
     137  qPassCellFluxCmd->
     138  SetGuidance("[usage] /score/quantiy/passageCellFlux qname unit");
     139  qPassCellFluxCmd->SetGuidance("  qname  :(String) scorer name");
     140  qPassCellFluxCmd->SetGuidance("  unit   :(String) unit");
     141  param = new G4UIparameter("qname",'s',false);
     142  qPassCellFluxCmd->SetParameter(param);
     143  param = new G4UIparameter("unit",'s',true);
     144  param->SetDefaultValue("percm2");
     145  qPassCellFluxCmd->SetParameter(param);
     146  //
     147  qdoseDepCmd = new G4UIcommand("/score/quantity/doseDeposit",this);
    105148  qdoseDepCmd->SetGuidance("Dose deposit scorer.");
    106   qdoseDepCmd->SetParameterName("qname",false);
    107   //
    108   qnOfStepCmd = new G4UIcmdWithAString("/score/quantity/nOfStep",this);
     149  qdoseDepCmd->
     150  SetGuidance("[usage] /score/quantiy/doseDeposit qname unit");
     151  qdoseDepCmd->SetGuidance("  qname  :(String) scorer name");
     152  qdoseDepCmd->SetGuidance("  unit   :(String) unit");
     153  param = new G4UIparameter("qname",'s',false);
     154  qdoseDepCmd->SetParameter(param);
     155  param = new G4UIparameter("unit",'s',true);
     156  param->SetDefaultValue("Gy");
     157  qdoseDepCmd->SetParameter(param);
     158  //
     159  qnOfStepCmd = new G4UIcommand("/score/quantity/nOfStep",this);
    109160  qnOfStepCmd->SetGuidance("Number of step scorer.");
    110   qnOfStepCmd->SetParameterName("qname",false);
    111   //
    112   qnOfSecondaryCmd = new G4UIcmdWithAString("/score/quantity/nOfSecondary",this);
     161  qnOfStepCmd->
     162  SetGuidance("[usage] /score/quantiy/nOfStep qname");
     163  qnOfStepCmd->SetGuidance("  qname  :(String) scorer name");
     164  param = new G4UIparameter("qname",'s',false);
     165  qnOfStepCmd->SetParameter(param);
     166  //
     167  qnOfSecondaryCmd = new G4UIcommand("/score/quantity/nOfSecondary",this);
    113168  qnOfSecondaryCmd->SetGuidance("Number of secondary scorer.");
    114   qnOfSecondaryCmd->SetParameterName("qname",false);
     169  qnOfSecondaryCmd->
     170  SetGuidance("[usage] /score/quantiy/nOfSecondary qname");
     171  qnOfSecondaryCmd->SetGuidance("  qname  :(String) scorer name");
     172  param = new G4UIparameter("qname",'s',false);
     173  qnOfSecondaryCmd->SetParameter(param);
    115174  //
    116175  qTrackLengthCmd = new G4UIcommand("/score/quantity/trackLength",this);
    117176  qTrackLengthCmd->SetGuidance("Track length scorer.");
    118177  qTrackLengthCmd->
    119       SetGuidance("[usage] /score/quantiy/trackLength qname wflag kflag vflag ");
     178  SetGuidance("[usage] /score/quantiy/trackLength qname wflag kflag vflag unit");
    120179  qTrackLengthCmd->SetGuidance("  qname  :(String) scorer name");
    121180  qTrackLengthCmd->SetGuidance("  wflag  :(Bool) weighted");
    122181  qTrackLengthCmd->SetGuidance("  kflag  :(Bool) multiply kinetic energy");
    123182  qTrackLengthCmd->SetGuidance("  vflag  :(Bool) divide by velocity");
     183  qTrackLengthCmd->SetGuidance("  unit   :(String) unit");
    124184  param = new G4UIparameter("qname",'s',false);
    125185  qTrackLengthCmd->SetParameter(param);
     
    132192  param = new G4UIparameter("vflag",'b',true);
    133193  param->SetDefaultValue("false");
     194  qTrackLengthCmd->SetParameter(param);
     195  param = new G4UIparameter("unit",'s',true);
     196  param->SetDefaultValue("mm");
    134197  qTrackLengthCmd->SetParameter(param);
    135198  //
     
    137200  qPassCellCurrCmd->SetGuidance("Passage cell current scorer.");
    138201  qPassCellCurrCmd->
    139       SetGuidance("[usage] /score/quantiy/passageCellCurrent qname wflag");
     202    SetGuidance("[usage] /score/quantiy/passageCellCurrent qname wflag");
     203    //SetGuidance("[usage] /score/quantiy/passageCellCurrent qname wflag unit");
    140204  qPassCellCurrCmd->SetGuidance("  qname  :(String) scorer name");
    141205  qPassCellCurrCmd->SetGuidance("  wflag  :(Bool) weighted");
     206  //qPassCellCurrCmd->SetGuidance("  unit  :(Bool) unit");
    142207  param = new G4UIparameter("qname",'s',false);
    143208  qPassCellCurrCmd->SetParameter(param);
     
    145210  param->SetDefaultValue("true");
    146211  qPassCellCurrCmd->SetParameter(param);
     212  //param = new G4UIparameter("unit",'s',true);
     213  //param->SetDefaultValue("parcm2");
     214  //qPassCellCurrCmd->SetParameter(param);
    147215  //
    148216  qPassTrackLengthCmd = new G4UIcommand("/score/quantity/passageTrackLength",this);
    149217  qPassTrackLengthCmd->SetGuidance("Passage track length scorer.");
    150218  qPassTrackLengthCmd->
    151       SetGuidance("[usage] /score/quantiy/passageTrackLength qname wflag");
     219  SetGuidance("[usage] /score/quantiy/passageTrackLength qname wflag unit");
    152220  qPassTrackLengthCmd->SetGuidance("  qname  :(String) scorer name");
    153221  qPassTrackLengthCmd->SetGuidance("  wflag  :(Bool) weighted");
     222  qPassTrackLengthCmd->SetGuidance("  unit   :(Bool) unit");
    154223  param = new G4UIparameter("qname",'s',false);
    155224  qPassTrackLengthCmd->SetParameter(param);
    156225  param = new G4UIparameter("wflag",'b',true);
    157226  param->SetDefaultValue("true");
     227  qPassTrackLengthCmd->SetParameter(param);
     228  param = new G4UIparameter("unit",'s',true);
     229  param->SetDefaultValue("mm");
    158230  qPassTrackLengthCmd->SetParameter(param);
    159231  //
     
    161233  qFlatSurfCurrCmd->SetGuidance("Flat surface current Scorer.");
    162234  qFlatSurfCurrCmd->
    163       SetGuidance("[usage] /score/quantiy/flatSurfaceCurrent qname dflag wflag aflag");
     235  SetGuidance("[usage] /score/quantiy/flatSurfaceCurrent qname dflag wflag aflag unit");
    164236  qFlatSurfCurrCmd->SetGuidance("  qname  :(String) scorer name");
    165237  qFlatSurfCurrCmd->SetGuidance("  dflag  :(Int) direction flag");
     
    169241  qFlatSurfCurrCmd->SetGuidance("  wflag  :(Bool) weighted");
    170242  qFlatSurfCurrCmd->SetGuidance("  aflag  :(Bool) divide by area");
     243  qFlatSurfCurrCmd->SetGuidance("  unit   :(Bool) unit");
    171244  param = new G4UIparameter("qname",'s',false);
    172245  qFlatSurfCurrCmd->SetParameter(param);
     
    180253  param->SetDefaultValue("true");
    181254  qFlatSurfCurrCmd->SetParameter(param);
     255  param = new G4UIparameter("unit",'s',true);
     256  param->SetDefaultValue("percm2");
     257  qFlatSurfCurrCmd->SetParameter(param);
    182258  //
    183259  qFlatSurfFluxCmd = new G4UIcommand("/score/quantity/flatSurfaceFlux",this);
    184260  qFlatSurfFluxCmd->SetGuidance("Flat surface flux scorer.");
    185261  qFlatSurfFluxCmd->
    186       SetGuidance("[usage] /score/quantiy/flatSurfaceFlux qname dflag");
     262  SetGuidance("[usage] /score/quantiy/flatSurfaceFlux qname dflag unit");
    187263  qFlatSurfFluxCmd->SetGuidance("  qname  :(String) scorer name");
    188264  qFlatSurfFluxCmd->SetGuidance("  dflag  :(Int) direction flag");
     
    190266  qFlatSurfFluxCmd->SetGuidance("         : 1 = In only");
    191267  qFlatSurfFluxCmd->SetGuidance("         : 2 = Out only");
     268  qFlatSurfFluxCmd->SetGuidance("  unit   :(String) unit");
    192269  param = new G4UIparameter("qname",'s',false);
    193270  qFlatSurfFluxCmd->SetParameter(param);
     
    195272  param->SetDefaultValue("0");
    196273  qFlatSurfFluxCmd->SetParameter(param);
     274  param = new G4UIparameter("unit",'s',true);
     275  param->SetDefaultValue("percm2");
     276  qFlatSurfFluxCmd->SetParameter(param);
    197277  //
    198278//  qSphereSurfCurrCmd = new G4UIcommand("/score/quantity/sphereSurfaceCurrent",this);
    199279//  qSphereSurfCurrCmd->SetGuidance("Sphere surface current Scorer.");
    200280//  qSphereSurfCurrCmd->
    201 //      SetGuidance("[usage] /score/quantiy/sphereSurfaceCurrent qname dflag wflag aflag");
     281//      SetGuidance("[usage] /score/quantiy/sphereSurfaceCurrent qname dflag wflag aflag unit");
    202282//  qSphereSurfCurrCmd->SetGuidance("  qname  :(String) scorer name");
    203283//  qSphereSurfCurrCmd->SetGuidance("  dflag  :(Int) direction flag");
     
    207287//  qSphereSurfCurrCmd->SetGuidance("  wflag  :(Bool) Weighted");
    208288//  qSphereSurfCurrCmd->SetGuidance("  aflag  :(Bool) DivideByArea");
     289//  qSphereSurfCurrCmd->SetGuidance("  unit   :(String) unit");
    209290//  param = new G4UIparameter("qname",'s',false);
    210291//  qSphereSurfCurrCmd->SetParameter(param);
     
    218299//  param->SetDefaultValue("true");
    219300//  qSphereSurfCurrCmd->SetParameter(param);
     301//  param = new G4UIparameter("unit",'s',true);
     302//  param->SetDefaultValue("percm2");
     303//  qSphereSurfCurrCmd->SetParameter(param);
    220304
    221305  //
     
    223307//  qSphereSurfFluxCmd->SetGuidance("Sphere surface Flux Scorer.");
    224308//  qSphereSurfFluxCmd->
    225 //      SetGuidance("[usage] /score/quantiy/sphereSurfaceFlux qname dflag");
     309//  SetGuidance("[usage] /score/quantiy/sphereSurfaceFlux qname dflag unit");
    226310//  qSphereSurfFluxCmd->SetGuidance("  qname  :(String) scorer name");
    227311//  qSphereSurfFluxCmd->SetGuidance("  dflag  :(Int) direction flag");
     
    229313//  qSphereSurfFluxCmd->SetGuidance("         : 1 = In only");
    230314//  qSphereSurfFluxCmd->SetGuidance("         : 2 = Out only");
     315//  qSphereSurfFluxCmd->SetGuidance("  unit   :(String) unit");
    231316//  param = new G4UIparameter("qname",'s',false);
    232317//  qSphereSurfFluxCmd->SetParameter(param);
     
    234319//  param->SetDefaultValue("0");
    235320//  qSphereSurfFluxCmd->SetParameter(param);
     321//  param = new G4UIparameter("unit",'s',true);
     322//  param->SetDefaultValue("percm2");
     323//  qSphereSurfFluxCmd->SetParameter(param);
    236324
    237325  //
     
    239327//  qCylSurfCurrCmd->SetGuidance("Cylinder surface current Scorer.");
    240328//  qCylSurfCurrCmd->
    241 //      SetGuidance("[usage] /score/quantiy/cylinderSurfaceCurrent qname dflag wflag aflag");
     329//  SetGuidance("[usage] /score/quantiy/cylinderSurfaceCurrent qname dflag wflag aflag unit");
    242330//  qCylSurfCurrCmd->SetGuidance("  qname  :(String) scorer name");
    243331//  qCylSurfCurrCmd->SetGuidance("  dflag  :(Int) direction flag");
     
    247335//  qCylSurfCurrCmd->SetGuidance("  wflag  :(Bool) Weighted");
    248336//  qCylSurfCurrCmd->SetGuidance("  aflag  :(Bool) DivideByArea");
     337//  qCylSurfCurrCmd->SetGuidance("  unit   :(String) unit");
    249338//  param = new G4UIparameter("qname",'s',false);
    250339//  qCylSurfCurrCmd->SetParameter(param);
     
    258347//  param->SetDefaultValue("true");
    259348//  qCylSurfCurrCmd->SetParameter(param);
     349//  param = new G4UIparameter("unit",'s',true);
     350//  param->SetDefaultValue("percm2");
     351//  qCylSurfCurrCmd->SetParameter(param);
    260352  //
    261353//  qCylSurfFluxCmd = new G4UIcommand("/score/quantity/cylinderSurfaceFlux",this);
    262354//  qCylSurfFluxCmd->SetGuidance("Cylinder surface Flux Scorer.");
    263355//  qCylSurfFluxCmd->
    264 //      SetGuidance("[usage] /score/quantiy/cylinderSurfaceFlux qname dflag");
     356//  SetGuidance("[usage] /score/quantiy/cylinderSurfaceFlux qname dflag unit");
    265357//  qCylSurfFluxCmd->SetGuidance("  qname  :(String) scorer name");
    266358//  qCylSurfFluxCmd->SetGuidance("  dflag  :(Int) direction flag");
     
    268360//  qCylSurfFluxCmd->SetGuidance("         : 1 = In only");
    269361//  qCylSurfFluxCmd->SetGuidance("         : 2 = Out only");
     362//  qCylSurfFluxCmd->SetGuidance("  unit   :(String) unit");
    270363//  param = new G4UIparameter("qname",'s',false);
    271364//  qCylSurfFluxCmd->SetParameter(param);
     
    273366//  param->SetDefaultValue("0");
    274367//  qCylSurfFluxCmd->SetParameter(param);
     368//  param = new G4UIparameter("unit",'s',true);
     369//  param->SetDefaultValue("percm2");
     370//  qCylSurfFluxCmd->SetParameter(param);
     371//
    275372  //
    276373  qNofCollisionCmd = new G4UIcommand("/score/quantity/nOfCollision",this);
    277374  qNofCollisionCmd->SetGuidance("Number of collision scorer.");
    278375  qNofCollisionCmd->
    279       SetGuidance("[usage] /score/quantiy/nOfCollision qname wflag");
     376  SetGuidance("[usage] /score/quantiy/nOfCollision qname wflag");
    280377  qNofCollisionCmd->SetGuidance("  qname  :(String) scorer name");
    281   qNofCollisionCmd->SetGuidance("  wflag  :(Bool) weighted");
    282378  param = new G4UIparameter("qname",'s',false);
    283379  qNofCollisionCmd->SetParameter(param);
     
    289385  qPopulationCmd->SetGuidance("Population scorer.");
    290386  qPopulationCmd->
    291       SetGuidance("[usage] /score/quantiy/population qname wflag");
     387   SetGuidance("[usage] /score/quantiy/population qname wflag");
    292388  qPopulationCmd->SetGuidance("  qname  :(String) scorer name");
    293389  qPopulationCmd->SetGuidance("  wflag  :(Bool) weighted");
     
    302398  qTrackCountCmd->SetGuidance("Number of track scorer.");
    303399  qTrackCountCmd->
    304       SetGuidance("[usage] /score/quantiy/nOfTrack qname dflag wflag");
     400  SetGuidance("[usage] /score/quantiy/nOfTrack qname dflag wflag");
    305401  qTrackCountCmd->SetGuidance("  qname  :(String) scorer name");
    306402  qTrackCountCmd->SetGuidance("  dflag  :(Int) direction");
     
    330426  param->SetDefaultValue("false");
    331427  qTerminationCmd->SetParameter(param);
     428
     429  //
     430  qMinKinEAtGeneCmd = new G4UIcommand("/score/quantity/minKinEAtGeneration",this);
     431  qMinKinEAtGeneCmd->SetGuidance("Min Kinetic Energy at Generation");
     432  qMinKinEAtGeneCmd->
     433  SetGuidance("[usage] /score/quantiy/minKinEAtGeneration qname");
     434  qMinKinEAtGeneCmd->SetGuidance("  qname  :(String) scorer name");
     435  param = new G4UIparameter("qname",'s',false);
     436  qMinKinEAtGeneCmd->SetParameter(param);
    332437}
    333438
  • trunk/source/digits_hits/utils/src/G4ScoringBox.cc

    r1337 r1340  
    2525//
    2626//
    27 // $Id: G4ScoringBox.cc,v 1.54 2008/08/29 02:50:05 akimura Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4ScoringBox.cc,v 1.61 2010/07/27 01:44:54 akimura Exp $
     28// GEANT4 tag $Name: $
    2929//
    3030
     
    3737#include "G4PVReplica.hh"
    3838#include "G4PVDivision.hh"
    39 #include "G4PVParameterised.hh"
    4039#include "G4VisAttributes.hh"
    41 #include "G4ScoringBoxParameterisation.hh"
    4240#include "G4VVisManager.hh"
    4341#include "G4VScoreColorMap.hh"
     
    5755{
    5856  fShape = boxMesh;
     57  fDivisionAxisNames[0] = "X";
     58  fDivisionAxisNames[1] = "Y";
     59  fDivisionAxisNames[2] = "Z";
    5960}
    6061
     
    186187                                      fSize[2]/fNSegment[2]);
    187188  fMeshElementLogical = new G4LogicalVolume(elementSolid, 0, elementName);
    188   if(fNSegment[2] > 1)
    189     if(fSegmentPositions.size() > 0) {
    190       if(verboseLevel > 9) G4cout << "G4ScoringBox::Construct() : Parameterise to z direction" << G4endl;
    191       G4double motherDims[3] ={fSize[0]/fNSegment[0],
    192                                fSize[1]/fNSegment[1],
    193                                fSize[2]/fNSegment[2]};
    194       G4int nelement = fNSegment[2];
    195       fSegmentPositions.push_back(fSize[2]*2.);
    196       //G4ScoringBoxParameterisation * param =
    197       G4VPVParameterisation * param =
    198         new G4ScoringBoxParameterisation(kZAxis, motherDims, fSegmentPositions);
    199       new G4PVParameterised(elementName,
    200                             fMeshElementLogical,
    201                             layerLogical[1],
    202                             kZAxis,
    203                             nelement,
    204                             param);
    205 
    206       if(verboseLevel > 9) {
    207         G4cout << motherDims[0] << ", " << motherDims[1] << ", " << motherDims[2] << G4endl;
    208         for(int i = 0; i < (int)fSegmentPositions.size(); i++)
    209           G4cout << fSegmentPositions[i] << ", ";
    210         G4cout << G4endl;
    211       }
    212 
    213     } else {
    214       if(verboseLevel > 9) G4cout << "G4ScoringBox::Construct() : Replicate to z direction" << G4endl;
    215 
    216       if(G4ScoringManager::GetReplicaLevel()>2)
    217       {
    218         new G4PVReplica(elementName, fMeshElementLogical, layerLogical[1], kZAxis,
     189  if(fNSegment[2] > 1) {
     190    if(verboseLevel > 9) G4cout << "G4ScoringBox::Construct() : Replicate to z direction" << G4endl;
     191
     192    if(G4ScoringManager::GetReplicaLevel()>2)
     193    {
     194      new G4PVReplica(elementName, fMeshElementLogical, layerLogical[1], kZAxis,
    219195                      fNSegment[2], 2.*fSize[2]/fNSegment[2]);
    220       }
    221       else
    222       {
    223         new G4PVDivision(elementName, fMeshElementLogical, layerLogical[1], kZAxis,
    224                       fNSegment[2], 0.);
    225       }
    226     }
    227   else if(fNSegment[2] == 1) {
     196    }
     197    else
     198    {
     199      new G4PVDivision(elementName, fMeshElementLogical, layerLogical[1], kZAxis,
     200                       fNSegment[2], 0.);
     201    }
     202  } else if(fNSegment[2] == 1) {
    228203    if(verboseLevel > 9) G4cout << "G4ScoringBox::Construct() : Placement" << G4endl;
    229204    new G4PVPlacement(0, G4ThreeVector(0.,0.,0.), fMeshElementLogical, elementName, layerLogical[1], false, 0);
     
    292267    for(int x = 0; x < fNSegment[0]; x++) xzcell.push_back(ez);
    293268
     269    // search max. & min. values in each slice
    294270    G4double xymin = DBL_MAX, yzmin = DBL_MAX, xzmin = DBL_MAX;
    295271    G4double xymax = 0., yzmax = 0., xzmax = 0.;
     
    299275      GetXYZ(itr->first, q);
    300276
    301       xycell[q[0]][q[1]] += *(itr->second);
     277      xycell[q[0]][q[1]] += *(itr->second)/fDrawUnitValue;
    302278      if(xymin > xycell[q[0]][q[1]]) xymin = xycell[q[0]][q[1]];
    303279      if(xymax < xycell[q[0]][q[1]]) xymax = xycell[q[0]][q[1]];
    304280
    305       yzcell[q[1]][q[2]] += *(itr->second);
     281      yzcell[q[1]][q[2]] += *(itr->second)/fDrawUnitValue;
    306282      if(yzmin > yzcell[q[1]][q[2]]) yzmin = yzcell[q[1]][q[2]];
    307283      if(yzmax < yzcell[q[1]][q[2]]) yzmax = yzcell[q[1]][q[2]];
    308284
    309       xzcell[q[0]][q[2]] += *(itr->second);
     285      xzcell[q[0]][q[2]] += *(itr->second)/fDrawUnitValue;
    310286      if(xzmin > xzcell[q[0]][q[2]]) xzmin = xzcell[q[0]][q[2]];
    311287      if(xzmax < xzcell[q[0]][q[2]]) xzmax = xzcell[q[0]][q[2]];
     
    404380    }
    405381  }
     382  colorMap->SetPSUnit(fDrawUnit);
     383  colorMap->SetPSName(fDrawPSName);
    406384  colorMap->DrawColorChart();
    407385}
     
    429407}
    430408
    431 void G4ScoringBox::DrawColumn(std::map<G4int, G4double*> * map, G4VScoreColorMap* colorMap, 
    432                           G4int idxProj, G4int idxColumn)
     409void G4ScoringBox::DrawColumn(std::map<G4int, G4double*> * map, G4VScoreColorMap* colorMap,
     410                              G4int idxProj, G4int idxColumn)
    433411{
    434412  if(idxColumn<0 || idxColumn>=fNSegment[idxProj])
     
    460438    for(int x = 0; x < fNSegment[0]; x++) xzcell.push_back(ez);
    461439
     440    // search max. & min. values in each slice
    462441    G4double xymax = 0., yzmax = 0., xzmax = 0.;
    463442    G4int q[3];
     
    467446
    468447      if(idxProj == 0 && q[2] == idxColumn) { // xy plane
    469         xycell[q[0]][q[1]] += *(itr->second);
     448        xycell[q[0]][q[1]] += *(itr->second)/fDrawUnitValue;
    470449        if(xymax < xycell[q[0]][q[1]]) xymax = xycell[q[0]][q[1]];
    471450      }
    472451      if(idxProj == 1 && q[0] == idxColumn) { // yz plane
    473         yzcell[q[1]][q[2]] += *(itr->second);
     452        yzcell[q[1]][q[2]] += *(itr->second)/fDrawUnitValue;
    474453        if(yzmax < yzcell[q[1]][q[2]]) yzmax = yzcell[q[1]][q[2]];
    475454      }
    476455      if(idxProj == 2 && q[1] == idxColumn) { // zx plane
    477         xzcell[q[0]][q[2]] += *(itr->second);
     456        xzcell[q[0]][q[2]] += *(itr->second)/fDrawUnitValue;
    478457        if(xzmax < xzcell[q[0]][q[2]]) xzmax = xzcell[q[0]][q[2]];
    479458      }
     
    552531  }
    553532
     533  colorMap->SetPSUnit(fDrawUnit);
     534  colorMap->SetPSName(fDrawPSName);
    554535  colorMap->DrawColorChart();
    555536}
  • trunk/source/digits_hits/utils/src/G4ScoringCylinder.cc

    r1337 r1340  
    2525//
    2626//
    27 // $Id: G4ScoringCylinder.cc,v 1.6 2008/08/29 02:50:05 akimura Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4ScoringCylinder.cc,v 1.16 2010/08/30 08:15:20 akimura Exp $
     28// GEANT4 tag $Name: $
    2929//
    3030
     
    3838#include "G4PVReplica.hh"
    3939#include "G4PVDivision.hh"
    40 #include "G4PVParameterised.hh"
    4140#include "G4VisAttributes.hh"
    42 //#include "G4ScoringCylinderParameterisation.hh"
    4341#include "G4VVisManager.hh"
    4442#include "G4VScoreColorMap.hh"
     
    5553
    5654G4ScoringCylinder::G4ScoringCylinder(G4String wName)
    57   :G4VScoringMesh(wName), fSegmentDirection(-1),
    58    fMeshElementLogical(0)
     55  :G4VScoringMesh(wName), fMeshElementLogical(0)
    5956{
    6057  fShape = cylinderMesh;
     58
     59  fDivisionAxisNames[0] = "Z";
     60  fDivisionAxisNames[1] = "PHI";
     61  fDivisionAxisNames[2] = "R";
    6162}
    6263
    6364G4ScoringCylinder::~G4ScoringCylinder()
    64 {
    65 }
     65{;}
    6666
    6767void G4ScoringCylinder::Construct(G4VPhysicalVolume* fWorldPhys)
     
    9191  // Scoring Mesh
    9292  if(verboseLevel > 9) G4cout << fWorldName << G4endl;
    93   G4String tubsName = fWorldName;
    94 
    95   if(verboseLevel > 9) G4cout << fSize[0] << ", " << fSize[1] << G4endl;
     93  G4String tubsName = fWorldName+"_mesh";
     94
     95  if(verboseLevel > 9) G4cout << "R max., Dz =: " << fSize[0] << ", " << fSize[1] << G4endl;
    9696  G4VSolid * tubsSolid = new G4Tubs(tubsName+"0", // name
    9797                                    0.,           // R min
    9898                                    fSize[0],     // R max
    99                                     fSize[1],     // dZ
     99                                    fSize[1],     // Dz
    100100                                    0.,           // starting phi
    101                                     twopi*rad);   // segment phi
     101                                    twopi*rad);   // segment phi
    102102  G4LogicalVolume *  tubsLogical = new G4LogicalVolume(tubsSolid, 0, tubsName);
    103103  new G4PVPlacement(fRotationMatrix, fCenterPosition,
    104104                    tubsLogical, tubsName+"0", worldLogical, false, 0);
    105105
     106  if(verboseLevel > 9) G4cout << " # of segments : r, phi, z =: "
     107         << fNSegment[IR] << ", " << fNSegment[IPHI] << ", " << fNSegment[IZ] << G4endl;
    106108
    107109  G4String layerName[2] = {tubsName + "1",  tubsName + "2"};
     
    109111  G4LogicalVolume * layerLogical[2];
    110112
    111   //-- fisrt nested layer (replicated along r direction)
     113  //-- fisrt nested layer (replicated along z direction)
    112114  if(verboseLevel > 9) G4cout << "layer 1 :" << G4endl;
    113   layerSolid[0] = new G4Tubs(layerName[0],
    114                              0.,
    115                              fSize[0]/fNSegment[0],
    116                              fSize[1],
    117                              0., twopi*rad);
     115  layerSolid[0] = new G4Tubs(layerName[0],           // name
     116                             0.,                     // inner radius
     117                             fSize[0],               // outer radius
     118                             fSize[1]/fNSegment[IZ], // half len. in z
     119                             0.,                     // starting phi angle
     120                             twopi*rad);             // delta angle of the segment
    118121  layerLogical[0] = new G4LogicalVolume(layerSolid[0], 0, layerName[0]);
    119   if(fNSegment[0] > 1) {
    120     if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Replicate along r direction" << G4endl;
    121     G4double r = fSize[0]/fNSegment[0];
    122     //if(G4ScoringManager::GetReplicaLevel()>0) {
    123     if(false) { // always use G4PVDivision
     122  if(fNSegment[IZ] > 1) {
     123    if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Replicate along z direction" << G4endl;
     124    if(G4ScoringManager::GetReplicaLevel()>0) {
    124125      if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Replica" << G4endl;
    125       new G4PVReplica(layerName[0], layerLogical[0], tubsLogical, kRho,
    126                       fNSegment[0], r, 0.);
     126      new G4PVReplica(layerName[0], layerLogical[0], tubsLogical, kZAxis, fNSegment[IZ], 2.*fSize[1]/fNSegment[IZ]);
    127127    } else {
    128128      if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Division" << G4endl;
    129       new G4PVDivision(layerName[0], layerLogical[0], tubsLogical, kRho,
    130                        fNSegment[0], 0.);
    131     }
    132   } else if(fNSegment[0] == 1) {
     129      new G4PVDivision(layerName[0], layerLogical[0], tubsLogical, kZAxis, fNSegment[IZ], 0.);
     130    }
     131  } else if(fNSegment[IZ] == 1) {
    133132    if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Placement" << G4endl;
    134133    new G4PVPlacement(0, G4ThreeVector(0.,0.,0.), layerLogical[0], layerName[0], tubsLogical, false, 0);
    135134  } else {
    136135    G4cerr << "G4ScoringCylinder::SetupGeometry() : invalid parameter ("
    137            << fNSegment[0] << ") "
     136           << fNSegment[IZ] << ") "
    138137           << "in placement of the first nested layer." << G4endl;
    139138  }
    140139
    141   if(verboseLevel > 9) {
    142     G4cout << fSize[0] << ", "
    143            << fSize[1]
    144            << G4endl;
    145     G4cout << layerName[0] << ": kRho, "
    146            << fNSegment[0] << ", "
    147            << fSize[0]/fNSegment[0] << G4endl;
    148   }
    149 
    150   // second nested layer (replicated along z direction)
     140  // second nested layer (replicated along phi direction)
    151141  if(verboseLevel > 9) G4cout << "layer 2 :" << G4endl;
    152142  layerSolid[1] = new G4Tubs(layerName[1],
    153143                             0.,
    154                              fSize[0],///fNSegment[0],
    155                              fSize[1]/fNSegment[1],
    156                              0., twopi*rad);
     144                             fSize[0],
     145                             fSize[1]/fNSegment[IZ],
     146                             0.,
     147                             twopi*rad/fNSegment[IPHI]);
    157148  layerLogical[1] = new G4LogicalVolume(layerSolid[1], 0, layerName[1]);
    158   if(fNSegment[1] > 1)  {
    159     if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Replicate along z direction" << G4endl;
    160     G4double width = fSize[1]/fNSegment[1]*2.;
    161     //if(G4ScoringManager::GetReplicaLevel()>1) {
    162     if(false) { // always use G4PVDivision
     149  if(fNSegment[IPHI] > 1)  {
     150    if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Replicate along phi direction" << G4endl;
     151    if(G4ScoringManager::GetReplicaLevel()>1) {
    163152      if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Replica" << G4endl;
    164       new G4PVReplica(layerName[1], layerLogical[1], layerLogical[0], kZAxis,
    165                       fNSegment[1], width);
     153      new G4PVReplica(layerName[1], layerLogical[1], layerLogical[0], kPhi,
     154                      fNSegment[IPHI], twopi*rad/fNSegment[IPHI]);
    166155    } else {
    167156      if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Division" << G4endl;
    168       new G4PVDivision(layerName[1], layerLogical[1], layerLogical[0], kZAxis,
    169                        fNSegment[1], 0.);
    170     }
    171   } else if(fNSegment[1] == 1) {
     157      new G4PVDivision(layerName[1], layerLogical[1], layerLogical[0], kPhi, fNSegment[IPHI], 0.);
     158    }
     159  } else if(fNSegment[IPHI] == 1) {
    172160    if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Placement" << G4endl;
    173161    new G4PVPlacement(0, G4ThreeVector(0.,0.,0.), layerLogical[1], layerName[1], layerLogical[0], false, 0);
    174162  } else
    175163    G4cerr << "ERROR : G4ScoringCylinder::SetupGeometry() : invalid parameter ("
    176            << fNSegment[1] << ") "
     164           << fNSegment[IPHI] << ") "
    177165           << "in placement of the second nested layer." << G4endl;
    178 
    179   if(verboseLevel > 9) {
    180     G4cout << fSize[0]/fNSegment[0] << ", "
    181            << fSize[1]/fNSegment[1] << G4endl;
    182     G4cout << layerName[1] << ": kZAxis, "
    183            << fNSegment[1] << ", "
    184            << fSize[1]/fNSegment[1] << G4endl;
    185   }
    186 
    187166
    188167  // mesh elements
     
    191170  G4VSolid * elementSolid = new G4Tubs(elementName,
    192171                                       0.,
    193                                        fSize[0],//fNSegment[0],
    194                                        fSize[1]/fNSegment[1],
    195                                        0., twopi*rad/fNSegment[2]);
     172                                       fSize[0]/fNSegment[IR],
     173                                       fSize[1]/fNSegment[IZ],
     174                                       0.,
     175                                       twopi*rad/fNSegment[IPHI]);
    196176  fMeshElementLogical = new G4LogicalVolume(elementSolid, 0, elementName);
    197   if(fNSegment[2] > 1) {
    198 
    199     /*
    200     if(fSegmentPositions.size() > 0) {
    201       G4double motherDims[3] ={fSize[0]/fsegParam[2][0],
    202                                fSize[1]/fsegParam[2][1],
    203                                fSize[2]/fsegParam[2][2]};
    204       G4int nelement = fSegmentPositions.size() + 1;
    205       //G4ScoringCylinderParameterisation * param =
    206       G4VPVParameterisation * param =
    207         new G4ScoringCylinderParameterisation(axis[2], motherDims, fSegmentPositions);
    208       new G4PVParameterised(elementName,
    209                             fMeshElementLogical,
    210                             layerLogical[1],
    211                             axis[2],
    212                             nelement,
    213                             param);
    214     } else {
    215     */
    216     if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Replicate along phi direction" << G4endl;
    217 
    218     G4double angle = twopi*rad/fNSegment[2];
    219     //if(G4ScoringManager::GetReplicaLevel()>2) {
    220     if(false) { // always use G4PVDivision
     177  if(fNSegment[IR] > 1) {
     178
     179    if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Replicate along r direction" << G4endl;
     180
     181    if(G4ScoringManager::GetReplicaLevel()>2) {
    221182      if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Replica" << G4endl;
    222       new G4PVReplica(elementName, fMeshElementLogical, layerLogical[1], kPhi,
    223                         fNSegment[2], angle, 0.);
     183      new G4PVReplica(elementName, fMeshElementLogical, layerLogical[1], kRho,
     184                        fNSegment[IR], fSize[0]/fNSegment[IR]);
    224185    } else {
    225186      if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Division" << G4endl;
    226       new G4PVDivision(elementName, fMeshElementLogical, layerLogical[1], kPhi,
    227                        fNSegment[2], 0.);
    228     }
    229     //}
    230   } else if(fNSegment[2] == 1) {
     187      new G4PVDivision(elementName, fMeshElementLogical, layerLogical[1], kRho, fNSegment[IR], 0.);
     188    }
     189  } else if(fNSegment[IR] == 1) {
    231190    if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Placement" << G4endl;
    232191    new G4PVPlacement(0, G4ThreeVector(0.,0.,0.), fMeshElementLogical, elementName, layerLogical[1], false, 0);
    233192  } else {
    234193    G4cerr << "G4ScoringCylinder::SetupGeometry() : "
    235            << "invalid parameter (" << fNSegment[2] << ") "
     194           << "invalid parameter (" << fNSegment[IR] << ") "
    236195           << "in mesh element placement." << G4endl;
    237   }
    238 
    239   if(verboseLevel > 9) {
    240     G4cout << fSize[0]/fNSegment[0] << ", "
    241            << fSize[1]/fNSegment[1] << G4endl;
    242     G4cout << elementName << ": kPhi, "
    243            << fNSegment[2] << G4endl;
    244196  }
    245197
     
    249201
    250202  // vis. attributes
    251   G4VisAttributes * visatt = new G4VisAttributes(G4Colour(.5,.5,.5,0.1));
     203  G4VisAttributes * visatt = new G4VisAttributes(G4Colour(.5,.5,.5));
    252204  visatt->SetVisibility(true);
    253   //layerLogical[0]->SetVisAttributes(visatt);
    254   //layerLogical[1]->SetVisAttributes(visatt);
     205  layerLogical[0]->SetVisAttributes(visatt);
     206  layerLogical[1]->SetVisAttributes(visatt);
    255207  visatt = new G4VisAttributes(G4Colour(.5,.5,.5,0.01));
    256208  //visatt->SetForceSolid(true);
     
    272224void G4ScoringCylinder::Draw(std::map<G4int, G4double*> * map, G4VScoreColorMap* colorMap, G4int axflg) {
    273225
    274 
    275226  G4VVisManager * pVisManager = G4VVisManager::GetConcreteInstance();
    276227  if(pVisManager) {
    277228   
    278229    // cell vectors
    279     std::vector<std::vector<std::vector<double> > > cell; // cell[R][Z][PHI]
    280230    std::vector<double> ephi;
    281     for(int phi = 0; phi < fNSegment[2]; phi++) ephi.push_back(0.);
    282     std::vector<std::vector<double> > ezphi;
    283     for(int z = 0; z < fNSegment[1]; z++) ezphi.push_back(ephi);
    284     for(int r = 0; r < fNSegment[0]; r++) cell.push_back(ezphi);
    285 
    286     std::vector<std::vector<double> > rzcell; // rzcell[R][Z]
    287     std::vector<double> ez;
    288     for(int z = 0; z < fNSegment[1]; z++) ez.push_back(0.);
    289     for(int r = 0; r < fNSegment[0]; r++) rzcell.push_back(ez);
    290 
     231    for(int phi = 0; phi < fNSegment[IPHI]; phi++) ephi.push_back(0.);
     232    //-
    291233    std::vector<std::vector<double> > zphicell; // zphicell[Z][PHI]
    292     for(int z = 0; z < fNSegment[1]; z++) zphicell.push_back(ephi);
    293 
     234    for(int z = 0; z < fNSegment[IZ]; z++) zphicell.push_back(ephi);
     235    //-
    294236    std::vector<std::vector<double> > rphicell; // rphicell[R][PHI]
    295     for(int r = 0; r < fNSegment[0]; r++) rphicell.push_back(ephi);
     237    for(int r = 0; r < fNSegment[IR]; r++) rphicell.push_back(ephi);
    296238
    297239    // search max. values
    298     G4double rzmin = DBL_MAX, zphimin = DBL_MAX, rphimin = DBL_MAX;
    299     G4double rzmax = 0., zphimax = 0., rphimax = 0.;
     240    G4double zphimin = DBL_MAX, rphimin = DBL_MAX;
     241    G4double zphimax = 0., rphimax = 0.;
    300242    G4int q[3];
    301243    std::map<G4int, G4double*>::iterator itr = map->begin();
    302244    for(; itr != map->end(); itr++) {
     245      if(itr->first < 0) {
     246        G4cout << itr->first << G4endl;
     247        continue;
     248      }
    303249      GetRZPhi(itr->first, q);
    304250
    305       rzcell[q[0]][q[1]] += *(itr->second);
    306       if(rzmin > rzcell[q[0]][q[1]]) rzmin = rzcell[q[0]][q[1]];
    307       if(rzmax < rzcell[q[0]][q[1]]) rzmax = rzcell[q[0]][q[1]];
    308 
    309       zphicell[q[1]][q[2]] += *(itr->second);
    310       if(zphimin > zphicell[q[1]][q[2]]) zphimin = zphicell[q[1]][q[2]];
    311       if(zphimax < zphicell[q[1]][q[2]]) zphimax = zphicell[q[1]][q[2]];
    312 
    313       rphicell[q[0]][q[2]] += *(itr->second);
    314       if(rphimin > rphicell[q[0]][q[2]]) rphimin = rphicell[q[0]][q[2]];
    315       if(rphimax < rphicell[q[0]][q[2]]) rphimax = rphicell[q[0]][q[2]];
     251      // projections
     252      zphicell[q[IZ]][q[IPHI]] += *(itr->second)/fDrawUnitValue;
     253      if(zphimin > zphicell[q[IZ]][q[IPHI]]) zphimin = zphicell[q[IZ]][q[IPHI]];
     254      if(zphimax < zphicell[q[IZ]][q[IPHI]]) zphimax = zphicell[q[IZ]][q[IPHI]];
     255      //-
     256      rphicell[q[IR]][q[IPHI]] += *(itr->second)/fDrawUnitValue;
     257      if(rphimin > rphicell[q[IR]][q[IPHI]]) rphimin = rphicell[q[IR]][q[IPHI]];
     258      if(rphimax < rphicell[q[IR]][q[IPHI]]) rphimax = rphicell[q[IR]][q[IPHI]];
    316259    } 
    317260   
     
    330273      if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(zphimin, zphimax); }
    331274
    332       G4double zhalf = fSize[1]/fNSegment[1];
    333       for(int phi = 0; phi < fNSegment[2]; phi++) {
    334         for(int z = 0; z < fNSegment[1]; z++) {
    335 
    336           G4double angle = twopi/fNSegment[2]*phi;
    337           G4double dphi = twopi/fNSegment[2];
    338           G4Tubs cylinder("z-phi", fSize[0]*0.99, fSize[0], zhalf,
    339                           angle, dphi*0.99999);
    340           /*
    341           G4cout << ">>>> "
    342                  << fSize[1]/fNSegment[1]/2. << " : "
    343                  << angle << " - " << angle + dphi
    344                  << G4endl;
    345           */
    346 
    347           G4ThreeVector zpos(0., 0., -fSize[1] + fSize[1]/fNSegment[1]*(1 + 2.*z));
     275      G4double zhalf = fSize[1]/fNSegment[IZ];
     276      for(int phi = 0; phi < fNSegment[IPHI]; phi++) {
     277        for(int z = 0; z < fNSegment[IZ]; z++) {
     278          //-
     279          G4double angle = twopi/fNSegment[IPHI]*phi;
     280          G4double dphi = twopi/fNSegment[IPHI];
     281          G4Tubs cylinder("z-phi",                    // name
     282                          fSize[0]*0.99, fSize[0],  // inner radius, outer radius
     283                          zhalf,                      // half length in z
     284                          angle, dphi*0.99999);       // starting phi angle, delta angle
     285          //-
     286          G4ThreeVector zpos(0., 0., -fSize[1] + fSize[1]/fNSegment[IZ]*(1 + 2.*z));
    348287          G4Transform3D trans;
    349288          if(fRotationMatrix) {
     
    356295          colorMap->GetMapColor(zphicell[z][phi], c);
    357296          att.SetColour(c[0], c[1], c[2]);//, c[3]);
    358           /*
    359           G4cout << "   " << c[0] << ", "
    360                  << c[1] << ", " << c[2] << G4endl;
    361           */
     297          //-
    362298          pVisManager->Draw(cylinder, att, trans);
    363299        }
     
    369305      if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(rphimin, rphimax); }
    370306
    371       G4double rsize = fSize[0]/fNSegment[0];
    372       for(int phi = 0; phi < fNSegment[2]; phi++) {
    373         for(int r = 0; r < fNSegment[0]; r++) {
     307      G4double rsize = fSize[0]/fNSegment[IR];
     308      for(int phi = 0; phi < fNSegment[IPHI]; phi++) {
     309        for(int r = 0; r < fNSegment[IR]; r++) {
    374310
    375311          G4double rs[2] = {rsize*r, rsize*(r+1)};
    376           G4double angle = twopi/fNSegment[2]*phi;
    377           G4double dphi = twopi/fNSegment[2];
     312          G4double angle = twopi/fNSegment[IPHI]*phi;
     313          G4double dphi = twopi/fNSegment[IPHI];
    378314          G4Tubs cylinder("z-phi", rs[0], rs[1], 0.001,
    379315                          angle, dphi*0.99999);
     
    409345      }
    410346    }
     347
     348    colorMap->SetPSUnit(fDrawUnit);
     349    colorMap->SetPSName(fDrawPSName);
    411350    colorMap->DrawColorChart();
     351
    412352  }
    413353}
     
    416356                                   G4int idxProj, G4int idxColumn)
    417357{
    418 
    419   if(idxColumn<0 || idxColumn>=fNSegment[idxProj])
     358  G4int projAxis = 0;
     359  switch(idxProj) {
     360  case 0:
     361    projAxis = IR;
     362    break;
     363  case 1:
     364    projAxis = IZ;
     365    break;
     366  case 2:
     367    projAxis = IPHI;
     368    break;
     369  }
     370
     371  if(idxColumn<0 || idxColumn>=fNSegment[projAxis])
    420372  {
    421     G4cerr << "ERROR : Column number " << idxColumn << " is out of scoring mesh [0," << fNSegment[idxProj]-1 <<
     373    G4cerr << "Warning : Column number " << idxColumn << " is out of scoring mesh [0," << fNSegment[projAxis]-1 <<
    422374    "]. Method ignored." << G4endl;
    423375    return;
     
    425377  G4VVisManager * pVisManager = G4VVisManager::GetConcreteInstance();
    426378  if(pVisManager) {
    427    
     379
    428380    // cell vectors
    429381    std::vector<std::vector<std::vector<double> > > cell; // cell[R][Z][PHI]
    430382    std::vector<double> ephi;
    431     for(int phi = 0; phi < fNSegment[2]; phi++) ephi.push_back(0.);
     383    for(int phi = 0; phi < fNSegment[IPHI]; phi++) ephi.push_back(0.);
    432384    std::vector<std::vector<double> > ezphi;
    433     for(int z = 0; z < fNSegment[1]; z++) ezphi.push_back(ephi);
    434     for(int r = 0; r < fNSegment[0]; r++) cell.push_back(ezphi);
     385    for(int z = 0; z < fNSegment[IZ]; z++) ezphi.push_back(ephi);
     386    for(int r = 0; r < fNSegment[IR]; r++) cell.push_back(ezphi);
    435387
    436388    std::vector<std::vector<double> > rzcell; // rzcell[R][Z]
    437389    std::vector<double> ez;
    438     for(int z = 0; z < fNSegment[1]; z++) ez.push_back(0.);
    439     for(int r = 0; r < fNSegment[0]; r++) rzcell.push_back(ez);
     390    for(int z = 0; z < fNSegment[IZ]; z++) ez.push_back(0.);
     391    for(int r = 0; r < fNSegment[IR]; r++) rzcell.push_back(ez);
    440392
    441393    std::vector<std::vector<double> > zphicell; // zphicell[Z][PHI]
    442     for(int z = 0; z < fNSegment[1]; z++) zphicell.push_back(ephi);
     394    for(int z = 0; z < fNSegment[IZ]; z++) zphicell.push_back(ephi);
    443395
    444396    std::vector<std::vector<double> > rphicell; // rphicell[R][PHI]
    445     for(int r = 0; r < fNSegment[0]; r++) rphicell.push_back(ephi);
     397    for(int r = 0; r < fNSegment[IR]; r++) rphicell.push_back(ephi);
    446398
    447399    // search max. values
     
    450402    std::map<G4int, G4double*>::iterator itr = map->begin();
    451403    for(; itr != map->end(); itr++) {
     404      if(itr->first < 0) {
     405        G4cout << itr->first << G4endl;
     406        continue;
     407      }
    452408      GetRZPhi(itr->first, q);
    453409
    454       if(idxProj == 0 && q[0] == idxColumn) { // zphi plane
    455         zphicell[q[1]][q[2]] += *(itr->second);
    456         if(zphimax < zphicell[q[1]][q[2]]) zphimax = zphicell[q[1]][q[2]];
    457       }
    458       if(idxProj == 1 && q[1] == idxColumn) { // rphi plane
    459         rphicell[q[0]][q[2]] += *(itr->second);
    460         if(rphimax < rphicell[q[0]][q[2]]) rphimax = rphicell[q[0]][q[2]];
    461       }
    462       if(idxProj == 2 && q[2] == idxColumn) { // rz plane
    463         rzcell[q[0]][q[1]] += *(itr->second);
    464         if(rzmax < rzcell[q[0]][q[1]]) rzmax = rzcell[q[0]][q[1]];
     410      if(projAxis == IR && q[IR] == idxColumn) { // zphi plane
     411        zphicell[q[IZ]][q[IPHI]] += *(itr->second)/fDrawUnitValue;
     412        if(zphimax < zphicell[q[IZ]][q[IPHI]]) zphimax = zphicell[q[IZ]][q[IPHI]];
     413      }
     414      if(projAxis == IZ && q[IZ] == idxColumn) { // rphi plane
     415        rphicell[q[IR]][q[IPHI]] += *(itr->second)/fDrawUnitValue;
     416        if(rphimax < rphicell[q[IR]][q[IPHI]]) rphimax = rphicell[q[IR]][q[IPHI]];
     417      }
     418      if(projAxis == IPHI && q[IPHI] == idxColumn) { // rz plane
     419        rzcell[q[IR]][q[IZ]] += *(itr->second)/fDrawUnitValue;
     420        if(rzmax < rzcell[q[IR]][q[IZ]]) rzmax = rzcell[q[IR]][q[IZ]];
    465421      }
    466422    } 
     
    472428
    473429    G4Scale3D scale;
    474     // r-phi plane
    475     if(idxProj == 0) {
     430    // z-phi plane
     431    if(projAxis == IR) {
    476432      if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(0.,zphimax); }
    477433
    478       G4double zhalf = fSize[1]/fNSegment[1];
    479       G4double rsize[2] = {fSize[0]/fNSegment[0]*idxColumn,
    480                            fSize[0]/fNSegment[0]*(idxColumn+1)};
    481       for(int phi = 0; phi < fNSegment[2]; phi++) {
    482         for(int z = 0; z < fNSegment[1]; z++) {
    483 
    484           G4double angle = twopi/fNSegment[2]*phi*radian;
    485           G4double dphi = twopi/fNSegment[2]*radian;
     434      G4double zhalf = fSize[1]/fNSegment[IZ];
     435      G4double rsize[2] = {fSize[0]/fNSegment[IR]*idxColumn,
     436                            fSize[0]/fNSegment[IR]*(idxColumn+1)};
     437      for(int phi = 0; phi < fNSegment[IPHI]; phi++) {
     438        for(int z = 0; z < fNSegment[IZ]; z++) {
     439
     440          G4double angle = twopi/fNSegment[IPHI]*phi*radian;
     441          G4double dphi = twopi/fNSegment[IPHI]*radian;
    486442          G4Tubs cylinder("z-phi", rsize[0], rsize[1], zhalf,
    487443                          angle, dphi*0.99999);
    488444
    489           G4ThreeVector zpos(0., 0., -fSize[1] + fSize[1]/fNSegment[1]*(1 + 2.*z));
     445          G4ThreeVector zpos(0., 0., -fSize[1] + fSize[1]/fNSegment[IZ]*(1 + 2.*z));
    490446          G4Transform3D trans;
    491447          if(fRotationMatrix) {
     
    503459
    504460      // r-phi plane
    505     } else if(idxProj == 1) {
     461    } else if(projAxis == IZ) {
    506462      if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(0.,rphimax); }
    507463
    508       G4double rsize = fSize[0]/fNSegment[0];
    509       for(int phi = 0; phi < fNSegment[2]; phi++) {
    510         for(int r = 0; r < fNSegment[0]; r++) {
     464      G4double rsize = fSize[0]/fNSegment[IR];
     465      for(int phi = 0; phi < fNSegment[IPHI]; phi++) {
     466        for(int r = 0; r < fNSegment[IR]; r++) {
    511467
    512468          G4double rs[2] = {rsize*r, rsize*(r+1)};
    513           G4double angle = twopi/fNSegment[2]*phi*radian;
    514           G4double dz = fSize[1]/fNSegment[1];
    515           G4double dphi = twopi/fNSegment[2]*radian;
     469          G4double angle = twopi/fNSegment[IPHI]*phi*radian;
     470          G4double dz = fSize[1]/fNSegment[IZ];
     471          G4double dphi = twopi/fNSegment[IPHI]*radian;
    516472          G4Tubs cylinder("r-phi", rs[0], rs[1], dz,
    517473                          angle, dphi*0.99999);
    518474          G4ThreeVector zpos(0., 0.,
    519                              -fSize[1]+fSize[1]/fNSegment[1]*(idxColumn*2+1));
     475                             -fSize[1]+fSize[1]/fNSegment[IZ]*(idxColumn*2+1));
    520476          G4Transform3D trans;
    521477          if(fRotationMatrix) {
     
    533489
    534490      // r-z plane
    535     } else if(idxProj == 2) {
     491    } else if(projAxis == IPHI) {
    536492      if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(0.,rzmax); }
    537493
    538       G4double rsize = fSize[0]/fNSegment[0];
    539       G4double zhalf = fSize[1]/fNSegment[1];
    540       G4double angle = twopi/fNSegment[2]*idxColumn*radian;
    541       G4double dphi = twopi/fNSegment[2]*radian;
    542       for(int z = 0; z < fNSegment[1]; z++) {
    543         for(int r = 0; r < fNSegment[0]; r++) {
     494      G4double rsize = fSize[0]/fNSegment[IR];
     495      G4double zhalf = fSize[1]/fNSegment[IZ];
     496      G4double angle = twopi/fNSegment[IPHI]*idxColumn*radian;
     497      G4double dphi = twopi/fNSegment[IPHI]*radian;
     498      for(int z = 0; z < fNSegment[IZ]; z++) {
     499        for(int r = 0; r < fNSegment[IR]; r++) {
    544500
    545501          G4double rs[2] = {rsize*r, rsize*(r+1)};
     
    548504
    549505          G4ThreeVector zpos(0., 0.,
    550                              -fSize[1]+fSize[1]/fNSegment[1]*(2.*z+1));
     506                             -fSize[1]+fSize[1]/fNSegment[IZ]*(2.*z+1));
    551507          G4Transform3D trans;
    552508          if(fRotationMatrix) {
     
    565521  }
    566522
     523  colorMap->SetPSUnit(fDrawUnit);
     524  colorMap->SetPSName(fDrawPSName);
    567525  colorMap->DrawColorChart();
    568526
     
    570528
    571529void G4ScoringCylinder::GetRZPhi(G4int index, G4int q[3]) const {
    572 
    573   q[0] = index/(fNSegment[2]*fNSegment[1]);
    574   q[1] = (index - q[0]*fNSegment[2]*fNSegment[1])/fNSegment[2];
    575   q[2] = index - q[1]*fNSegment[2] - q[0]*fNSegment[2]*fNSegment[1];
    576 
    577 }
     530  // index = k + j * k-size + i * jk-plane-size
     531
     532  // nested : z -> phi -> r
     533  G4int i = IZ;
     534  G4int j = IPHI;
     535  G4int k = IR;
     536  G4int jk = fNSegment[j]*fNSegment[k];
     537  q[i] = index/jk;
     538  q[j] = (index - q[i]*jk)/fNSegment[k];
     539  q[k] = index - q[j]*fNSegment[k] - q[i]*jk;
     540}
  • trunk/source/digits_hits/utils/src/G4ScoringManager.cc

    r1337 r1340  
    2525//
    2626//
    27 // $Id: G4ScoringManager.cc,v 1.31 2008/03/25 02:18:38 akimura Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4ScoringManager.cc,v 1.33 2010/09/24 05:51:27 asaim Exp $
     28// GEANT4 tag $Name: $
    2929//
    3030
     
    4040G4ScoringManager* G4ScoringManager::fSManager = 0;
    4141
    42 G4int G4ScoringManager::replicaLevel = 2;
     42G4int G4ScoringManager::replicaLevel = 3;
    4343
    4444G4ScoringManager* G4ScoringManager::GetScoringManager()
  • trunk/source/digits_hits/utils/src/G4ScoringMessenger.cc

    r1337 r1340  
    2525//
    2626//
    27 // $Id: G4ScoringMessenger.cc,v 1.39 2008/11/26 21:27:35 asaim Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4ScoringMessenger.cc,v 1.42 2010/07/26 03:52:33 akimura Exp $
     28// GEANT4 tag $Name: $
    2929//
    3030// ---------------------------------------------------------------------
     
    185185  drawCmd->SetGuidance("Draw projection(s) of scored quantities.");
    186186  drawCmd->SetGuidance("Parameter <proj> specified which projection(s) to be drawn.");
    187   drawCmd->SetGuidance("  100 : xy-plane, 010 : yz-place, 001 : zx-plane -- default 111");
     187  drawCmd->SetGuidance("  100 : xy-plane, 010 : yz-plane,    001 : zx-plane -- default 111");
     188  drawCmd->SetGuidance("  100 : N/A,      010 : z_phi-plane, 001 : r_phi-plane -- default 111");
    188189  param = new G4UIparameter("meshName",'s',false);
    189190  drawCmd->SetParameter(param);
     
    200201  drawColumnCmd = new G4UIcommand("/score/drawColumn",this);
    201202  drawColumnCmd->SetGuidance("Draw a cell column.");
    202   drawColumnCmd->SetGuidance(" plane = 0 : xy, 1: yz, 2: zx");
     203  drawColumnCmd->SetGuidance(" plane = 0 : x-y, 1: y-z, 2: z-x  for box mesh");
     204  drawColumnCmd->SetGuidance("         0 : z-phi, 1: r-phi, 2: r-z  for cylinder mesh");
    203205  param = new G4UIparameter("meshName",'s',false);
    204206  drawColumnCmd->SetParameter(param);
     
    235237  colorMapMinMaxCmd->SetParameter(param);
    236238
     239  /*
    237240  chartCmd = new G4UIcommand("/score/drawChart",this);
    238241  chartCmd->SetGuidance("Draw color chart on the screen.");
     
    252255  param->SetDefaultValue("linear");
    253256  chartCmd->SetParameter(param);
    254  
     257  */
     258
    255259  // Dump a scored quantity
    256260  dumpQtyToFileCmd = new G4UIcommand("/score/dumpQuantityToFile", this);
     
    541545    G4int Nk = StoI(token[2]);
    542546    G4int nSegment[3];
    543     nSegment[0] = Ni;
    544     nSegment[1] = Nj;
    545     nSegment[2] = Nk;
     547
     548    if(dynamic_cast<G4ScoringBox*>(mesh)) {
     549      G4cout << ".... G4ScoringMessenger::MeshBinCommand - G4ScoringBox" << G4endl;
     550      nSegment[0] = Ni;
     551      nSegment[1] = Nj;
     552      nSegment[2] = Nk;
     553    } else if(dynamic_cast<G4ScoringCylinder*>(mesh)) {
     554      G4cout << ".... G4ScoringMessenger::MeshBinCommand - G4ScoringCylinder" << G4endl;
     555      nSegment[0] = Nj;
     556      nSegment[1] = Nk;
     557      nSegment[2] = Ni;
     558    } else {
     559      G4Exception("G4ScoringMessenger::MeshBinCommand()", "001", FatalException, "invalid mesh type");
     560    }
    546561    //
    547562    mesh->SetNumberOfSegments(nSegment);
  • trunk/source/digits_hits/utils/src/G4VScoreColorMap.cc

    r1337 r1340  
    2525//
    2626//
    27 // $Id: G4VScoreColorMap.cc,v 1.4 2009/05/04 15:57:33 akimura Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4VScoreColorMap.cc,v 1.8 2010/07/26 03:52:33 akimura Exp $
     28// GEANT4 tag $Name: $
    2929//
    3030
     
    8080}
    8181void G4VScoreColorMap::DrawColorChartText(G4int _nPoint) {
     82
    8283  G4double min = this->GetMin();
    8384  G4double max = this->GetMax();
     
    115116    fVisManager->Draw2D(text);
    116117  }
     118
     119  // draw ps name
     120  // background
     121  G4int lpsname = 20;//fPSName.size();
     122  if(lpsname > 0) {
     123    for(int l = 0; l < 22; l++) {
     124      G4Polyline line;
     125      line.push_back(G4Point3D(-0.9, -0.965+0.002*l, 0.));
     126      line.push_back(G4Point3D(-0.9+0.025*lpsname, -0.965+0.002*l, 0.));
     127      G4VisAttributes attblack(black);
     128      //G4VisAttributes attblack(G4Colour(.5, .5, 1.));
     129      line.SetVisAttributes(&attblack);
     130      fVisManager->Draw2D(line);
     131    }
     132    // ps name
     133    G4Text txtpsname(fPSName, G4Point3D(-0.9, -0.96, 0.));
     134    G4double size = 12.;
     135    txtpsname.SetScreenSize(size);
     136    G4Colour color(1., 1., 1.);
     137    G4VisAttributes att(color);
     138    txtpsname.SetVisAttributes(&att);
     139    fVisManager->Draw2D(txtpsname);
     140  }
     141
     142  // draw unit
     143  // background
     144  G4int len = fPSUnit.size();
     145  if(len > 0) {
     146    for(int l = 0; l < 21; l++) {
     147      G4Polyline line;
     148      line.push_back(G4Point3D(-0.7, -0.9+0.002*l, 0.));
     149      line.push_back(G4Point3D(-0.7+0.3, -0.9+0.002*l, 0.));
     150      G4VisAttributes attblack(black);
     151      //G4VisAttributes attblack(G4Colour(.5, .5, .5));
     152      line.SetVisAttributes(&attblack);
     153      fVisManager->Draw2D(line);
     154    }
     155    // unit
     156    G4String psunit = "[" + fPSUnit + "]";
     157    G4Text txtunit(psunit, G4Point3D(-0.69, -0.9, 0.));
     158    G4double size = 12.;
     159    txtunit.SetScreenSize(size);
     160    G4Colour color(1., 1., 1.);
     161    G4VisAttributes att(color);
     162    txtunit.SetVisAttributes(&att);
     163    fVisManager->Draw2D(txtunit);
     164  }
     165
    117166}
  • trunk/source/digits_hits/utils/src/G4VScoreWriter.cc

    r1337 r1340  
    2525//
    2626//
    27 // $Id: G4VScoreWriter.cc,v 1.5 2008/03/04 23:19:09 taso Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4VScoreWriter.cc,v 1.10 2010/07/27 01:44:54 akimura Exp $
     28// GEANT4 tag $Name: $
    2929//
    3030
     
    8787    return;
    8888  }
     89
     90
    8991  std::map<G4int, G4double*> * score = msMapItr->second->GetMap();
    90   ofile << "# primitive scorer name: " << msMapItr->first << G4endl;
     92  ofile << "# primitive scorer name: " << msMapItr->first << std::endl;
     93
     94
     95  G4double unitValue = fScoringMesh->GetPSUnitValue(psName);
     96  G4String unit = fScoringMesh->GetPSUnit(psName);
     97  G4String divisionAxisNames[3];
     98  fScoringMesh->GetDivisionAxisNames(divisionAxisNames);
     99  // index order
     100  ofile << "# i" << divisionAxisNames[0]
     101        << ", i" << divisionAxisNames[1]
     102        << ", i" << divisionAxisNames[2];
     103  // unit of scored value
     104  ofile << ", value ";
     105  if(unit.size() > 0) ofile << "[" << unit << "]";
     106  ofile << G4endl;
    91107
    92108  // "sequence" option: write header info
     
    111127          ofile << 0.;
    112128        } else {
    113           ofile << *(value->second);
     129          ofile << *(value->second)/unitValue;
    114130        }
    115131
     
    160176  std::map<G4int, G4double*> * score;
    161177  for(; msMapItr != fSMap.end(); msMapItr++) {
     178
     179    G4String psname = msMapItr->first;
     180
    162181    score = msMapItr->second->GetMap();
    163     ofile << "# primitive scorer name: " << msMapItr->first << G4endl;
     182    ofile << "# primitive scorer name: " << msMapItr->first << std::endl;
     183
     184    G4double unitValue = fScoringMesh->GetPSUnitValue(psname);
     185    G4String unit = fScoringMesh->GetPSUnit(psname);
     186    G4String divisionAxisNames[3];
     187    fScoringMesh->GetDivisionAxisNames(divisionAxisNames);
     188    // index order
     189    ofile << "# i" << divisionAxisNames[0]
     190          << ", i" << divisionAxisNames[1]
     191          << ", i" << divisionAxisNames[2];
     192    // unit of scored value
     193    ofile << ", value ";
     194    if(unit.size() > 0) ofile << "[" << unit << "]";
     195    ofile << G4endl;
     196
    164197
    165198    // "sequence" option: write header info
     
    184217            ofile << 0.;
    185218          } else {
    186             ofile << *(value->second);
     219            ofile << *(value->second)/unitValue;
    187220          }
    188221
  • trunk/source/digits_hits/utils/src/G4VScoringMesh.cc

    r1337 r1340  
    2525//
    2626//
    27 // $Id: G4VScoringMesh.cc,v 1.37 2009/10/12 04:11:25 akimura Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4VScoringMesh.cc,v 1.42 2010/07/27 01:44:54 akimura Exp $
     28// GEANT4 tag $Name: $
    2929//
    3030
     
    3939  : fWorldName(wName),fConstructed(false),fActive(true),
    4040    fRotationMatrix(NULL), fMFD(new G4MultiFunctionalDetector(wName)),
    41     verboseLevel(0),sizeIsSet(false),nMeshIsSet(false)
     41    verboseLevel(0),sizeIsSet(false),nMeshIsSet(false),
     42    fDrawUnit(""), fDrawUnitValue(1.)
    4243{
    4344  G4SDManager::GetSDMpointer()->AddNewDetector(fMFD);
     
    4546  fSize[0] = fSize[1] = fSize[2] = 0.;
    4647  fNSegment[0] = fNSegment[1] = fNSegment[2] = 1;
     48  fDivisionAxisNames[0] = fDivisionAxisNames[1] = fDivisionAxisNames[2] = "";
    4749}
    4850
     
    150152  if(itr == fMap.end()) return false;
    151153  return true;
     154}
     155
     156G4String G4VScoringMesh::GetPSUnit(G4String & psname) {
     157  std::map<G4String, G4THitsMap<G4double>* >::iterator itr = fMap.find(psname);;
     158  if(itr == fMap.end()) {
     159    return G4String("");
     160  } else {
     161    return GetPrimitiveScorer(psname)->GetUnit();
     162  }
     163}
     164
     165G4String G4VScoringMesh::GetCurrentPSUnit(){
     166    G4String unit = "";
     167  if(fCurrentPS == NULL) {
     168      G4String msg = "ERROR : G4VScoringMesh::GetCurrentPSUnit() : ";
     169      msg += " Current primitive scorer is null.";
     170      G4cerr << msg << G4endl;
     171  }else{
     172     unit =  fCurrentPS->GetUnit();
     173  }
     174  return unit;
     175}
     176
     177void  G4VScoringMesh::SetCurrentPSUnit(const G4String& unit){
     178  if(fCurrentPS == NULL) {
     179      G4String msg = "ERROR : G4VScoringMesh::GetCurrentPSUnit() : ";
     180      msg += " Current primitive scorer is null.";
     181      G4cerr << msg << G4endl;
     182  }else{
     183      fCurrentPS->SetUnit(unit);
     184  }
     185}
     186
     187G4double G4VScoringMesh::GetPSUnitValue(G4String & psname) {
     188  std::map<G4String, G4THitsMap<G4double>* >::iterator itr = fMap.find(psname);;
     189  if(itr == fMap.end()) {
     190    return 1.;
     191  } else {
     192    return GetPrimitiveScorer(psname)->GetUnitValue();
     193  }
     194}
     195
     196void G4VScoringMesh::GetDivisionAxisNames(G4String divisionAxisNames[3]) {
     197  for(int i = 0; i < 3; i++) divisionAxisNames[i] = fDivisionAxisNames[i];
    152198}
    153199
Note: See TracChangeset for help on using the changeset viewer.