Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:20:36

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 //
0027 /// \file DetParameterisation.cc
0028 /// \brief Implementation of the DetParameterisation class
0029 //
0030 // Authors: P.Dondero (paolo.dondero@cern.ch), R.Stanzani (ronny.stanzani@cern.ch)
0031 //
0032 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0033 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0034 
0035 
0036 #include "XrayTESdetDetParameterisation.hh"
0037 #include "G4VPhysicalVolume.hh"
0038 #include "G4LogicalVolume.hh"
0039 #include "G4ThreeVector.hh"
0040 #include "G4Box.hh"
0041 #include "G4SystemOfUnits.hh"
0042 #include "G4PhysicalConstants.hh"
0043 #include <cstdlib>
0044 #include <cstdio>
0045 #include <cmath>
0046 #include <iostream>
0047 #include <fstream>
0048 #include <iomanip>
0049 #include <string>
0050 #include <vector>
0051 #include <algorithm>
0052 #include <sstream>
0053 
0054 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0055 XrayTESdetDetParameterisation::XrayTESdetDetParameterisation(
0056   G4int NoChambers,
0057   G4double startX,           //  X of center of first
0058   G4double spacingX,         //  X spacing of centers
0059   G4double startY,           //  Y of center of first
0060   G4double spacingY          //  Y spacing of centers
0061 ){
0062   fNoChambers = NoChambers;
0063   fStartX = startX;
0064   fStartY = startY;
0065   fSpacingX = spacingX;
0066   fSpacingY = spacingY;
0067 }
0068 
0069 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0070 
0071 void XrayTESdetDetParameterisation::ComputeTransformation (const G4int copyNo, G4VPhysicalVolume* physVol) const
0072 {
0073   G4double Xposition;
0074   G4double Yposition;
0075   G4int no_daug = physVol->GetLogicalVolume()->GetNoDaughters();
0076 
0077   for (G4int k=0; k<no_daug; k++)
0078   {
0079     physVol->GetLogicalVolume()->GetDaughter(k)->SetCopyNo(-copyNo);
0080   }
0081   std::ifstream input("pixelpos.txt");
0082   if ( !input )
0083   {
0084     G4cout << "Cannot open pixels positions' file\n"; exit( -1 );
0085   }
0086 
0087   std::vector<G4double> xpos; G4double b;
0088   std::vector<G4double> ypos; G4double c;
0089 
0090   while(!input.eof())
0091   {
0092     input >> b >> c;
0093     xpos.push_back(b);
0094     ypos.push_back(c);
0095   }
0096 
0097   input.close();
0098 
0099   Xposition = xpos[copyNo]*mm;
0100   Yposition = ypos[copyNo]*mm;
0101 
0102   G4ThreeVector origin(Xposition, Yposition, 0);
0103   physVol->SetTranslation(origin);
0104   physVol->SetRotation(0);
0105 }
0106 
0107 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......