Ignore:
Timestamp:
Sep 10, 2008, 5:40:37 PM (16 years ago)
Author:
garnier
Message:

geant4.8.2 beta

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

Legend:

Unmodified
Added
Removed
  • trunk/source/digits_hits/utils/src/G4DefaultLinearColorMap.cc

    r814 r850  
    2525//
    2626//
    27 // $Id: G4DefaultLinearColorMap.cc,v 1.2 2007/11/06 17:17:14 asaim Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: G4DefaultLinearColorMap.cc,v 1.3 2008/08/29 02:50:05 akimura Exp $
     28// GEANT4 tag $Name: HEAD $
    2929//
    3030
     
    4040void G4DefaultLinearColorMap::GetMapColor(G4double val, G4double color[4])
    4141{
    42   G4double value = (val-fMinVal)/(fMaxVal-fMinVal);
     42  G4double value;
     43  if(fMaxVal == fMinVal)
     44    value = 0.;
     45  else
     46    value = (val-fMinVal)/(fMaxVal-fMinVal);
    4347
    4448  if(value > 1.) {value=1.;}
  • trunk/source/digits_hits/utils/src/G4ScoreQuantityMessenger.cc

    r814 r850  
    2626//
    2727// $Id: G4ScoreQuantityMessenger.cc,v 1.8 2007/11/07 04:12:07 akimura Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: HEAD $
    2929//
    3030// ---------------------------------------------------------------------
  • trunk/source/digits_hits/utils/src/G4ScoreQuantityMessengerQCmd.cc

    r814 r850  
    2626//
    2727// $Id: G4ScoreQuantityMessengerQCmd.cc,v 1.6 2007/11/07 04:12:07 akimura Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: HEAD $
    2929//
    3030// ---------------------------------------------------------------------
  • trunk/source/digits_hits/utils/src/G4ScoringBox.cc

    r814 r850  
    2525//
    2626//
    27 // $Id: G4ScoringBox.cc,v 1.48 2007/11/14 20:41:17 asaim Exp $
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     27// $Id: G4ScoringBox.cc,v 1.54 2008/08/29 02:50:05 akimura Exp $
     28// GEANT4 tag $Name: HEAD $
    2929//
    3030
     
    106106  G4LogicalVolume * layerLogical[2];
    107107
    108   // fisrt nested layer (replicated to x direction)
     108  //-- fisrt nested layer (replicated to x direction)
    109109  if(verboseLevel > 9) G4cout << "layer 1 :" << G4endl;
    110110  layerSolid[0] = new G4Box(layerName[0],
     
    123123    {
    124124      new G4PVDivision(layerName[0], layerLogical[0], boxLogical, kXAxis,
    125                     fNSegment[0], fSize[0]/fNSegment[0]*2.);
     125                    fNSegment[0], 0.);
    126126    }
    127127  } else if(fNSegment[0] == 1) {
     
    159159    {
    160160      new G4PVDivision(layerName[1], layerLogical[1], layerLogical[0], kYAxis,
    161                     fNSegment[1], fSize[1]/fNSegment[1]*2.);
     161                    fNSegment[1], 0.);
    162162    }
    163163  } else if(fNSegment[1] == 1) {
     
    222222      {
    223223        new G4PVDivision(elementName, fMeshElementLogical, layerLogical[1], kZAxis,
    224                       fNSegment[2], 2.*fSize[2]/fNSegment[2]);
     224                      fNSegment[2], 0.);
    225225      }
    226226    }
     
    259259void G4ScoringBox::List() const {
    260260  G4cout << "G4ScoringBox : " << fWorldName << " --- Shape: Box mesh" << G4endl;
     261  G4cout << " Size (x, y, z): ("
     262         << fSize[0]/cm << ", "
     263         << fSize[1]/cm << ", "
     264         << fSize[2]/cm << ") [cm]"
     265         << G4endl;
    261266
    262267  G4VScoringMesh::List();
     
    287292    for(int x = 0; x < fNSegment[0]; x++) xzcell.push_back(ez);
    288293
     294    G4double xymin = DBL_MAX, yzmin = DBL_MAX, xzmin = DBL_MAX;
    289295    G4double xymax = 0., yzmax = 0., xzmax = 0.;
    290296    G4int q[3];
     
    294300
    295301      xycell[q[0]][q[1]] += *(itr->second);
     302      if(xymin > xycell[q[0]][q[1]]) xymin = xycell[q[0]][q[1]];
    296303      if(xymax < xycell[q[0]][q[1]]) xymax = xycell[q[0]][q[1]];
    297304
    298305      yzcell[q[1]][q[2]] += *(itr->second);
     306      if(yzmin > yzcell[q[1]][q[2]]) yzmin = yzcell[q[1]][q[2]];
    299307      if(yzmax < yzcell[q[1]][q[2]]) yzmax = yzcell[q[1]][q[2]];
    300308
    301309      xzcell[q[0]][q[2]] += *(itr->second);
     310      if(xzmin > xzcell[q[0]][q[2]]) xzmin = xzcell[q[0]][q[2]];
    302311      if(xzmax < xzcell[q[0]][q[2]]) xzmax = xzcell[q[0]][q[2]];
    303312    } 
     
    307316    att.SetForceAuxEdgeVisible(true);
    308317
    309 
    310318    G4Scale3D scale;
    311319    if(axflg/100==1) {
    312320      // xy plane
    313       if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(0.,xymax); }
     321      if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(xymin ,xymax); }
    314322      G4ThreeVector zhalf(0., 0., fSize[2]/fNSegment[2]*0.98);
    315323      G4Box xyplate("xy", fSize[0]/fNSegment[0], fSize[1]/fNSegment[1], fSize[2]/fNSegment[2]*0.01);
     
    340348    if(axflg/10==1) {
    341349      // yz plane
    342       if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(0.,yzmax); }
     350      if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(yzmin, yzmax); }
    343351      G4ThreeVector xhalf(fSize[0]/fNSegment[0]*0.98, 0., 0.);
    344352      G4Box yzplate("yz", fSize[0]/fNSegment[0]*0.01, fSize[1]/fNSegment[1], fSize[2]/fNSegment[2]);
     
    369377    if(axflg==1) {
    370378      // xz plane
    371       if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(0.,xzmax); }
     379      if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(xzmin,xzmax); }
    372380      G4ThreeVector yhalf(0., fSize[1]/fNSegment[1]*0.98, 0.);
    373381      G4Box xzplate("xz", fSize[0]/fNSegment[0], fSize[1]/fNSegment[1]*0.01, fSize[2]/fNSegment[2]);
     
    396404    }
    397405  }
     406  colorMap->DrawColorChart();
    398407}
    399408
     
    542551    }
    543552  }
    544 }
    545 
    546 
     553
     554  colorMap->DrawColorChart();
     555}
     556
     557
  • trunk/source/digits_hits/utils/src/G4ScoringManager.cc

    r814 r850  
    2525//
    2626//
    27 // $Id: G4ScoringManager.cc,v 1.30 2007/11/14 22:08:15 asaim Exp $
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     27// $Id: G4ScoringManager.cc,v 1.31 2008/03/25 02:18:38 akimura Exp $
     28// GEANT4 tag $Name: HEAD $
    2929//
    3030
     
    3636#include "G4VScoreColorMap.hh"
    3737#include "G4DefaultLinearColorMap.hh"
     38#include "G4ScoreLogColorMap.hh"
    3839
    3940G4ScoringManager* G4ScoringManager::fSManager = 0;
     
    6162  fDefaultLinearColorMap = new G4DefaultLinearColorMap("defaultLinearColorMap");
    6263  (*fColorMapDict)[fDefaultLinearColorMap->GetName()] = fDefaultLinearColorMap;
     64  G4VScoreColorMap * logColorMap = new G4ScoreLogColorMap("logColorMap");
     65  (*fColorMapDict)[logColorMap->GetName()] = logColorMap;
    6366  writer = new G4VScoreWriter();
    6467}
  • trunk/source/digits_hits/utils/src/G4ScoringMessenger.cc

    r814 r850  
    2525//
    2626//
    27 // $Id: G4ScoringMessenger.cc,v 1.36 2007/11/12 13:27:31 asaim Exp $
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     27// $Id: G4ScoringMessenger.cc,v 1.38 2008/08/29 02:50:05 akimura Exp $
     28// GEANT4 tag $Name: HEAD $
    2929//
    3030// ---------------------------------------------------------------------
     
    3434#include "G4VScoringMesh.hh"
    3535#include "G4ScoringBox.hh"
     36#include "G4ScoringCylinder.hh"
    3637
    3738#include "G4UIdirectory.hh"
     
    7778  meshBoxCreateCmd->SetParameterName("MeshName",false);
    7879  //
    79 //  meshTubsCreateCmd = new G4UIcmdWithAString("/score/create/tubsMesh",this);
    80 //  meshTubsCreateCmd->SetGuidance("Create scoring mesh.");
    81 //  meshTubsCreateCmd->SetParameterName("MeshName",false);
     80  meshCylinderCreateCmd = new G4UIcmdWithAString("/score/create/cylinderMesh",this);
     81  meshCylinderCreateCmd->SetGuidance("Create scoring mesh.");
     82  meshCylinderCreateCmd->SetParameterName("MeshName",false);
    8283  //
    8384//  meshSphereCreateCmd = new G4UIcmdWithAString("/score/create/sphereMesh",this);
     
    9899  mBoxSizeCmd = new G4UIcmdWith3VectorAndUnit("/score/mesh/boxSize",this);
    99100  mBoxSizeCmd->SetGuidance("Define size of the scoring mesh.");
     101  mBoxSizeCmd->SetGuidance("Dx  Dy  Dz  unit");
    100102  mBoxSizeCmd->SetParameterName("Di","Dj","Dk",false,false);
    101103  mBoxSizeCmd->SetRange("Di>0. && Dj>0. && Dk>0.");
    102104  mBoxSizeCmd->SetDefaultUnit("mm");
     105  //
     106  mCylinderSizeCmd = new G4UIcommand("/score/mesh/cylinderSize",this);
     107  mCylinderSizeCmd->SetGuidance("Define size of the scoring mesh.");
     108  mCylinderSizeCmd->SetGuidance("R   Dz  unit");
     109  param = new G4UIparameter("R",'d',false);
     110  param->SetParameterRange("R>0");
     111  mCylinderSizeCmd->SetParameter(param);
     112  param = new G4UIparameter("Dz",'d',false);
     113  param->SetParameterRange("Dz>0");
     114  mCylinderSizeCmd->SetParameter(param);
     115  param = new G4UIparameter("unit",'s',true);
     116  param->SetDefaultValue("mm");
     117  mCylinderSizeCmd->SetParameter(param);
    103118  //
    104119  //   Division command
     
    106121  mBinCmd->SetGuidance("Define segments of the scoring mesh.");
    107122  mBinCmd->SetGuidance("[usage] /score/mesh/nBin");
    108   mBinCmd->SetGuidance("  Ni  :(int) Number of bins i ");
    109   mBinCmd->SetGuidance("  Nj  :(int) Number of bins j ");
    110   mBinCmd->SetGuidance("  Nk  :(int) Number of bins k ");
     123  mBinCmd->SetGuidance(" In case of boxMesh, parameters are given in");
     124  mBinCmd->SetGuidance("   Ni  :(int) Number of bins i (in x-axis) ");
     125  mBinCmd->SetGuidance("   Nj  :(int) Number of bins j (in y-axis) ");
     126  mBinCmd->SetGuidance("   Nk  :(int) Number of bins k (in z-axis) ");
     127  mBinCmd->SetGuidance(" In case of cylinderMesh, parameters are given in");
     128  mBinCmd->SetGuidance("   Nr  :(int) Number of bins in radial axis ");
     129  mBinCmd->SetGuidance("   Nz  :(int) Number of bins in z axis ");
     130  mBinCmd->SetGuidance("   Nphi:(int) Number of bins in phi axis ");
    111131  //mBinCmd->SetGuidance("  Axis:(int) Axis of division ");
    112132//  mBinCmd->SetGuidance("  P1..Pn-1  :(double) \"paramter from P1 to Pn-1 for division.\"");
     
    214234  param = new G4UIparameter("maxValue",'d',false);
    215235  colorMapMinMaxCmd->SetParameter(param);
     236
     237  chartCmd = new G4UIcommand("/score/drawChart",this);
     238  chartCmd->SetGuidance("Draw color chart on the screen.");
     239  chartCmd->SetGuidance("[usage] /score/drawChart");
     240  chartCmd->SetGuidance("  mesh    :(String) Mesh name.");
     241  chartCmd->SetGuidance("  psname  :(String) PS name.");
     242  chartCmd->SetGuidance("  On/Off  :(boolean) On or Off the color chart.");
     243  chartCmd->SetGuidance("  scale   :(String) default=linear, or log ");
     244  param = new G4UIparameter("meshName",'s',false);
     245  chartCmd->SetParameter(param);
     246  param = new G4UIparameter("psName",'s',false);
     247  chartCmd->SetParameter(param);
     248  param = new G4UIparameter("On",'s',true);
     249  param->SetDefaultValue("true");
     250  chartCmd->SetParameter(param);
     251  param = new G4UIparameter("scale",'s',true);
     252  param->SetDefaultValue("linear");
     253  chartCmd->SetParameter(param);
    216254 
    217255  // Dump a scored quantity
     
    246284    delete           meshCreateDir;
    247285    delete           meshBoxCreateCmd;
    248 //    delete           meshTubsCreateCmd;
     286    delete           meshCylinderCreateCmd;
    249287//    delete           meshSphereCreateCmd;
    250288    //
     
    256294    //
    257295    delete  mBoxSizeCmd;
    258     delete  mTubsSizeCmd;
    259     delete  mSphereSizeCmd;
     296    delete  mCylinderSizeCmd;
     297//    delete  mSphereSizeCmd;
    260298    //
    261299    delete      mBinCmd;
     
    270308    delete   mRotDir;
    271309    //
     310    delete     chartCmd;
    272311    delete     dumpCmd;
    273312    delete     drawCmd;
     
    304343      G4String colorMapName = next();
    305344      fSMan->DrawMesh(meshName,psName,iPlane,iColumn,colorMapName);
     345  } else if(command==chartCmd ){
     346      G4Tokenizer next(newVal);
     347      G4String meshName = next();
     348      G4String psName = next();
     349      //G4bool   onFlag = StoB(next());
     350      G4String scaleOption = next();
     351//      fSMan->DrawChart(meshName,psName,onFlag,scaleOption);
     352
    306353  } else if(command==dumpQtyToFileCmd) {
    307354      G4Tokenizer next(newVal);
     
    323370      if ( currentmesh ){
    324371        G4cerr << "ERROR[" << meshBoxCreateCmd->GetCommandPath()
    325                << "] : Mesh <" << currentmesh->GetWorldName() << "> is still open. Close it first. Command ignored." << G4endl;
     372               << "] : Mesh <" << currentmesh->GetWorldName()
     373               << "> is still open. Close it first. Command ignored." << G4endl;
    326374      } else {
    327375
     
    332380        }else{
    333381          G4cerr << "ERROR[" << meshBoxCreateCmd->GetCommandPath()
     382                 << "] : Scoring mesh <" << newVal
     383                 << "> already exists. Command ignored." << G4endl;
     384        }
     385      }
     386  } else if(command==meshCylinderCreateCmd) {
     387      G4VScoringMesh* currentmesh = fSMan->GetCurrentMesh();
     388      if ( currentmesh ){
     389        G4cerr << "ERROR[" << meshBoxCreateCmd->GetCommandPath()
     390               << "] : Mesh <" << currentmesh->GetWorldName()
     391               << "> is still open. Close it first. Command ignored." << G4endl;
     392      } else {
     393
     394        G4VScoringMesh*  mesh = fSMan->FindMesh(newVal);
     395        if ( !mesh ){
     396          mesh = new G4ScoringCylinder(newVal);
     397          fSMan->RegisterScoringMesh(mesh);
     398        }else{
     399          G4cerr << "ERROR[" << meshCylinderCreateCmd->GetCommandPath()
    334400                 << "] : Scoring mesh <" << newVal
    335401                 << "> already exists. Command ignored." << G4endl;
     
    344410      else
    345411      { G4cerr << "ERROR[" << floatMinMaxCmd->GetCommandPath()
    346                << "] : color map <" << newVal << "> is not defined. Command ignored." << G4endl; }
     412               << "] : color map <" << newVal << "> is not defined. Command ignored."
     413               << G4endl;
     414      }
    347415  } else if(command==colorMapMinMaxCmd) {
    348416      G4Tokenizer next(newVal);
     
    356424      else
    357425      { G4cerr << "ERROR[" << colorMapMinMaxCmd->GetCommandPath()
    358                << "] : color map <" << newVal << "> is not defined. Command ignored." << G4endl; }
     426               << "] : color map <" << newVal << "> is not defined. Command ignored."
     427               << G4endl;
     428      }
    359429  } else if(command==meshOpnCmd) {
    360430      G4VScoringMesh* currentmesh = fSMan->GetCurrentMesh();
     
    403473                        << "] : This mesh is not Box. Command ignored." << G4endl;
    404474              }
     475          }else if(command==mCylinderSizeCmd) {
     476              MeshShape shape = mesh->GetShape();
     477              if ( shape == cylinderMesh ){
     478                  G4double vsize[3];
     479                  vsize[0]     = StoD(token[0]);
     480                  vsize[1]     = StoD(token[1]);
     481                  G4double unt = mCylinderSizeCmd->ValueOf(token[2]);
     482                  vsize[0] *= unt;
     483                  vsize[1] *= unt;
     484                  vsize[3]  = 0.0;
     485                  mesh->SetSize(vsize);
     486              } else {
     487                  G4cerr << "ERROR[" << mBoxSizeCmd->GetCommandPath()
     488                         << "] : This mesh is not Box. Command ignored." << G4endl;
     489              }
    405490          } else if(command==mBinCmd) {
    406491              MeshBinCommand(mesh,token);
  • trunk/source/digits_hits/utils/src/G4VScoreColorMap.cc

    r814 r850  
    2525//
    2626//
    27 // $Id: G4VScoreColorMap.cc,v 1.1 2007/11/04 04:06:09 asaim Exp $
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     27// $Id: G4VScoreColorMap.cc,v 1.3 2008/02/14 10:45:12 akimura Exp $
     28// GEANT4 tag $Name: HEAD $
    2929//
    3030
    3131#include "G4VScoreColorMap.hh"
     32
     33#include "G4VVisManager.hh"
     34#include "G4VisAttributes.hh"
     35#include "G4Text.hh"
     36#include "G4Circle.hh"
     37#include "G4Polyline.hh"
     38#include "G4Colour.hh"
    3239
    3340G4VScoreColorMap::G4VScoreColorMap(G4String mName)
     
    3845{;}
    3946
     47void G4VScoreColorMap::DrawColorChart(G4int _nPoint) {
     48
     49  fVisManager = G4VVisManager::GetConcreteInstance();
     50  if(!fVisManager) {
     51    G4cerr << "G4VScoringMesh::DrawColorChart(): no visualization system" << G4endl;
     52    return;
     53  }
     54
     55  DrawColorChartBar(_nPoint);
     56  DrawColorChartText(_nPoint);
     57}
     58
     59void G4VScoreColorMap::DrawColorChartBar(G4int _nPoint) {
     60
     61  G4double min = this->GetMin();
     62  G4double max = this->GetMax();
     63  G4double smin = -0.89, smax = smin + 0.05*(_nPoint)*0.83, step=0.001;
     64  G4double c[4];
     65  for(G4double y = smin; y < smax; y+=step) {
     66    G4double ra = (y-smin)/(smax-smin), rb = 1.-ra;
     67    G4Polyline line;
     68    line.push_back(G4Point3D(-0.96, y, 0.));
     69    line.push_back(G4Point3D(-0.91, y, 0.));
     70    this->GetMapColor((ra*max+rb*min)/(ra+rb), c);
     71    G4Colour col(c[0], c[1], c[2]);
     72    G4VisAttributes att(col);
     73    line.SetVisAttributes(&att);
     74    fVisManager->Draw2D(line);
     75  }
     76
     77}
     78void G4VScoreColorMap::DrawColorChartText(G4int _nPoint) {
     79  G4double min = this->GetMin();
     80  G4double max = this->GetMax();
     81  G4double c[4];
     82  G4Colour black(0., 0., 0.);
     83  for(int n = 0; n < _nPoint; n++) {
     84    G4double a = n/(_nPoint-1.), b = 1.-a;
     85    G4double v = (a*max + b*min)/(a+b);
     86    // background color
     87    for(int l = 0; l < 21; l++) {
     88      G4Polyline line;
     89      line.push_back(G4Point3D(-0.908, -0.905+0.05*n+0.002*l, 0.));
     90      line.push_back(G4Point3D(-0.705, -0.905+0.05*n+0.002*l, 0.));
     91      G4VisAttributes attblack(black);
     92      line.SetVisAttributes(&attblack);
     93      fVisManager->Draw2D(line);
     94    }
     95    // text
     96    char cstring[80];
     97    std::sprintf(cstring, "%8.2e", v);
     98    G4String value(cstring);
     99    G4Text text(value, G4Point3D(-0.9, -0.9+0.05*n, 0));
     100    G4double size = 12.;
     101    text.SetScreenSize(size);
     102    this->GetMapColor(v, c);
     103    G4Colour color(c[0], c[1], c[2]);
     104    G4VisAttributes att(color);
     105    text.SetVisAttributes(&att);
     106
     107    fVisManager->Draw2D(text);
     108  }
     109}
  • trunk/source/digits_hits/utils/src/G4VScoreWriter.cc

    r814 r850  
    2525//
    2626//
    27 // $Id: G4VScoreWriter.cc,v 1.4 2007/11/11 01:00:44 akimura Exp $
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     27// $Id: G4VScoreWriter.cc,v 1.5 2008/03/04 23:19:09 taso Exp $
     28// GEANT4 tag $Name: HEAD $
    2929//
    3030
     
    207207
    208208G4int G4VScoreWriter::GetIndex(G4int x, G4int y, G4int z) const {
    209   return x + y*fNMeshSegments[0] + z*fNMeshSegments[0]*fNMeshSegments[1];
    210 }
    211 
     209    //return x + y*fNMeshSegments[0] + z*fNMeshSegments[0]*fNMeshSegments[1];
     210    return x*fNMeshSegments[1]*fNMeshSegments[2] +y*fNMeshSegments[2]+z;
     211}
     212
  • trunk/source/digits_hits/utils/src/G4VScoringMesh.cc

    r814 r850  
    2525//
    2626//
    27 // $Id: G4VScoringMesh.cc,v 1.34 2007/11/07 04:12:07 akimura Exp $
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     27// $Id: G4VScoringMesh.cc,v 1.35 2008/03/23 14:32:13 akimura Exp $
     28// GEANT4 tag $Name: HEAD $
    2929//
    3030
     
    158158}
    159159void G4VScoringMesh::List() const {
    160   G4cout << " Size: ("
    161          << fSize[0]/cm << ", "
    162          << fSize[1]/cm << ", "
    163          << fSize[2]/cm << ") [cm]"
    164          << G4endl;
     160
    165161  G4cout << " # of segments: ("
    166162         << fNSegment[0] << ", "
Note: See TracChangeset for help on using the changeset viewer.