Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-10 08:06:19

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 #include "DicomBeamCompensator.hh"
0027 
0028 #include "dcmtk/dcmrt/seq/drtcos.h"
0029 
0030 #include "G4UIcommand.hh"
0031 
0032 // DOC at https://www.dabsoft.ch/dicom/3/C.8.8.14/
0033 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0034 DicomBeamCompensator::DicomBeamCompensator(DRTCompensatorSequence::Item bcompItem)
0035 {
0036   OFString fstr;
0037   Sint32 fint;
0038   Float64 ffloat;
0039   OFVector<Float64> fvfloat;
0040   OFCondition cond;
0041   G4cout << " DicomBeamCompensator::DicomBeamCompensator " << G4endl;
0042   cond = bcompItem.getCompensatorNumber(fint);
0043   theCompensatorNumber = fint;
0044   G4cout << " Number " << fint << G4endl;
0045 
0046   cond = bcompItem.getCompensatorColumns(fint);
0047   theCompensatorColumns = fint;
0048   cond = bcompItem.getCompensatorRows(fint);
0049   theCompensatorRows = fint;
0050   //  first value is the spacing between the center of adjacent rows, and the second value
0051   // (column spacing) is the spacing between the center of adjacent columns.
0052   cond = bcompItem.getCompensatorPixelSpacing(fvfloat);
0053   theCompensatorPixelSpacing = fvfloat;
0054 
0055   cond = bcompItem.getCompensatorPosition(fvfloat);
0056   theCompensatorPosition = fvfloat;
0057 
0058   cond = bcompItem.getCompensatorTransmissionData(fvfloat);
0059   if (cond.good()) theCompensatorTransmissionData = fvfloat;
0060   cond = bcompItem.getCompensatorThicknessData(fvfloat);
0061   if (cond.good()) theCompensatorThicknessData = fvfloat;
0062 
0063   cond = bcompItem.getCompensatorTrayID(fstr);
0064   cond = bcompItem.getCompensatorType(fstr);
0065 
0066   cond = bcompItem.getMaterialID(fstr);
0067   if (cond.good()) theMaterialID = fstr;
0068   cond = bcompItem.getSourceToCompensatorDistance(fvfloat);
0069   if (cond.good()) theSourceToCompensatorDistance = fvfloat;
0070   cond = bcompItem.getSourceToCompensatorTrayDistance(ffloat);
0071   theSourceToCompensatorTrayDistance = ffloat;
0072 
0073   cond = bcompItem.getCompensatorDescription(fstr);
0074   cond = bcompItem.getCompensatorDivergence(fstr);
0075   cond = bcompItem.getCompensatorID(fstr);
0076   cond = bcompItem.getCompensatorMountingPosition(fstr);
0077   cond = bcompItem.getAccessoryCode(fstr);
0078 }
0079 
0080 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0081 void DicomBeamCompensator::Print(std::ostream&) {}
0082 
0083 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0084 void DicomBeamCompensator::DumpToFile(std::ofstream& fout)
0085 {
0086   std::string name = ":P COMP_" + G4UIcommand::ConvertToString(theCompensatorNumber) + "_";
0087   fout << name << "PixelSpacing_1 " << theCompensatorPixelSpacing[0] << G4endl;
0088   fout << name << "PixelSpacing_2 " << theCompensatorPixelSpacing[1] << G4endl;
0089 
0090   fout << name << "POSX " << theCompensatorPosition[0] << G4endl;
0091   fout << name << "POSY " << theCompensatorPosition[1] << G4endl;
0092 
0093   fout << name << "SourceToCompensatorTrayDistance " << theSourceToCompensatorTrayDistance
0094        << G4endl;
0095 
0096   for (size_t ii = 0; ii < theSourceToCompensatorDistance.size(); ii++) {
0097     int iCol = ii % theCompensatorColumns;
0098     int iRow = ii / theCompensatorColumns;
0099     fout << name
0100          << "SourceToCompensatorDistance_" + G4UIcommand::ConvertToString(iRow) + "_"
0101               + G4UIcommand::ConvertToString(iCol)
0102          << " " << theSourceToCompensatorDistance[ii] << G4endl;
0103   }
0104 
0105   /*  for( size_t ii = 0; ii < theCompensatorTransmissionData.size(); ii++ ) {
0106     int iCol = ii%theCompensatorColumns;
0107     int iRow = ii/theCompensatorColumns;
0108     fout << name << "Transmission_" +G4UIcommand::ConvertToString(iRow) + "_"
0109        +G4UIcommand::ConvertToString(iCol) << " " << theCompensatorTransmissionData[ii] << G4endl;
0110   }
0111 
0112   for( size_t ii = 0; ii < theCompensatorThicknessData.size(); ii++ ) {
0113     int iCol = ii%theCompensatorColumns;
0114     int iRow = ii/theCompensatorColumns;
0115     fout << name << "Thickness_" +G4UIcommand::ConvertToString(iRow) + "_"
0116   +G4UIcommand::ConvertToString(iCol) << " " << theCompensatorThicknessData[ii] << G4endl;
0117   }
0118   */
0119 }