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

update ti head

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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}
Note: See TracChangeset for help on using the changeset viewer.