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[ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/advanced/lAr_calorimeter/src/FCALEMModule.cc (Version 11.3.0) and /examples/advanced/lAr_calorimeter/src/FCALEMModule.cc (Version 9.5.p2)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 //   Author:             Rachid Mazini             26 //   Author:             Rachid Mazini
 27 //                       Rachid.Mazini@cern.ch     27 //                       Rachid.Mazini@cern.ch
 28 //   Language:           C++                       28 //   Language:           C++
 29 //   Tested on :         g++ (egcs.2.1.1, RH6.     29 //   Tested on :         g++ (egcs.2.1.1, RH6.1)
 30 //   Prerequisites:      None                      30 //   Prerequisites:      None
 31 //   Purpose:            Source file defining      31 //   Purpose:            Source file defining the geometry of EMModule 0 of the
 32 //                       FCAL.                     32 //                       FCAL.
 33 //   Developped:         10-March-2000   R.M.      33 //   Developped:         10-March-2000   R.M.
 34 //                                                 34 //   
 35 //                                                 35 //
 36 //--------------------------------------------     36 //-----------------------------------------------------------------------------
 37                                                    37 
 38 #include <fstream>                             << 
 39 #include <cstdlib>                             << 
 40                                                << 
 41 #include "FCALEMModule.hh"                         38 #include "FCALEMModule.hh"
 42                                                    39 
 43 #include "FCALMaterialConsultant.hh"               40 #include "FCALMaterialConsultant.hh"
 44                                                    41 
 45 #include "G4SDManager.hh"                          42 #include "G4SDManager.hh"
 46 #include "FCALEMModuleSD.hh"                       43 #include "FCALEMModuleSD.hh"
 47                                                    44 
 48 #include "G4PhysicalConstants.hh"              << 
 49 #include "G4SystemOfUnits.hh"                  << 
 50 #include "G4Box.hh"                                45 #include "G4Box.hh"
 51 #include "G4Tubs.hh"                               46 #include "G4Tubs.hh"
 52 #include "G4LogicalVolume.hh"                      47 #include "G4LogicalVolume.hh"
 53 #include "G4VPhysicalVolume.hh"                    48 #include "G4VPhysicalVolume.hh"
 54 #include "G4PVPlacement.hh"                        49 #include "G4PVPlacement.hh"
 55 #include "G4SubtractionSolid.hh"                   50 #include "G4SubtractionSolid.hh"
 56                                                    51 
 57 #include "G4ThreeVector.hh"                        52 #include "G4ThreeVector.hh"
 58 #include "G4VisAttributes.hh"                      53 #include "G4VisAttributes.hh"
 59 #include "G4Colour.hh"                             54 #include "G4Colour.hh"
 60                                                    55 
                                                   >>  56 #include <fstream>
                                                   >>  57 #include <cstdlib>
                                                   >>  58 
 61 FCALEMModule::FCALEMModule() :                     59 FCALEMModule::FCALEMModule() : 
 62   FcalEmModuleSD(0)                                60   FcalEmModuleSD(0)
 63  {                                                 61  {
 64   F1LArGapID   = new G4int[2400];                  62   F1LArGapID   = new G4int[2400];
 65   F1LArIX      = new G4int[2400];                  63   F1LArIX      = new G4int[2400];
 66   F1LArJY      = new G4int[2400];                  64   F1LArJY      = new G4int[2400];
 67   F1LArITile   = new G4int[2400];                  65   F1LArITile   = new G4int[2400];
 68   F1LArGapPosX = new G4double[2400];               66   F1LArGapPosX = new G4double[2400];
 69   F1LArGapPosY = new G4double[2400];               67   F1LArGapPosY = new G4double[2400];
 70 }                                                  68 }
 71                                                    69 
 72                                                    70 
 73 FCALEMModule::~FCALEMModule(){                     71 FCALEMModule::~FCALEMModule(){
 74   delete [] F1LArGapID;                            72   delete [] F1LArGapID;
 75   delete [] F1LArGapPosX;                          73   delete [] F1LArGapPosX;
 76   delete [] F1LArGapPosY;                          74   delete [] F1LArGapPosY;
 77   delete [] F1LArIX;                               75   delete [] F1LArIX;
 78   delete [] F1LArJY;                               76   delete [] F1LArJY;
 79   delete [] F1LArITile;                            77   delete [] F1LArITile;
 80 }                                                  78 }
 81                                                    79 
 82                                                    80 
 83 void FCALEMModule::InitializeGeometry() {          81 void FCALEMModule::InitializeGeometry() {
 84 #include "FCALEMModuleParameters.input"            82 #include "FCALEMModuleParameters.input"  
 85   std::ifstream File                               83   std::ifstream File
 86     ("geom_data/FCal1Electrodes.dat");             84     ("geom_data/FCal1Electrodes.dat");
 87                                                    85   
 88   if(!File)  G4cerr << "Failed to open file FC     86   if(!File)  G4cerr << "Failed to open file FCal1Electrodes data file  " << G4endl;
 89   File.seekg(0);                                   87   File.seekg(0);
 90                                                    88   
 91   NF1LarGap = 0;                                   89   NF1LarGap = 0;
 92   while(!(File.eof())) {                           90   while(!(File.eof())) {
 93     NF1LarGap++;                                   91     NF1LarGap++;
 94     File >> F1LArGapID[NF1LarGap] >> F1LArGapP     92     File >> F1LArGapID[NF1LarGap] >> F1LArGapPosX[NF1LarGap] >> F1LArGapPosY[NF1LarGap]
 95    >> F1LArIX[NF1LarGap] >>  F1LArJY[NF1LarGap     93    >> F1LArIX[NF1LarGap] >>  F1LArJY[NF1LarGap] >> F1LArITile[NF1LarGap];
 96   };                                               94   };   
 97   G4cout << "********" << " Number of Rods in      95   G4cout << "********" << " Number of Rods in FCAL1 : " << NF1LarGap-1 << G4endl;;
 98 }                                                  96 }
 99                                                    97 
100                                                    98 
101                                                    99 
102 G4LogicalVolume * FCALEMModule::Construct()       100 G4LogicalVolume * FCALEMModule::Construct()
103 {                                                 101 {
104   //-----------------------------                 102   //-----------------------------
105   // construction of materials                    103   // construction of materials
106   //-----------------------------                 104   //----------------------------- 
107   FCALMaterialConsultant *FCALMaterials =      << 105   FCALMaterialConsultant * FCALMaterials = new FCALMaterialConsultant();
108     FCALMaterialConsultant::GetInstance();     << 106   FCALMaterials->construct();
109                                                   107 
110   G4VisAttributes * ColorOfEMModule = new G4Vi    108   G4VisAttributes * ColorOfEMModule = new G4VisAttributes(G4Colour(1.,0.,0.5));
111 //  G4VisAttributes * ColorOfLArg = new G4VisA    109 //  G4VisAttributes * ColorOfLArg = new G4VisAttributes(G4Colour(0.,0.,1.));
112                                                   110 
113   //----------------------------                  111   //----------------------------
114   //      Read Parameters                         112   //      Read Parameters
115   //----------------------------                  113   //----------------------------
116   InitializeGeometry();                           114   InitializeGeometry();
117                                                   115 
118 //-----------------------------------------       116 //-----------------------------------------
119 // Logical to be returned (FCAL EM module)        117 // Logical to be returned (FCAL EM module)
120 //-----------------------------------------       118 //-----------------------------------------
121   G4Tubs * SolidEmModule =                        119   G4Tubs * SolidEmModule =
122     new G4Tubs("EmModuleSold", EmModuleRMin, E    120     new G4Tubs("EmModuleSold", EmModuleRMin, EmModuleRMax, EmModuleLenght,
123          EmModuleStartPhi,EmModuleDPhi);          121          EmModuleStartPhi,EmModuleDPhi);
124   G4LogicalVolume * LogicalEmModule =             122   G4LogicalVolume * LogicalEmModule = 
125     new G4LogicalVolume(SolidEmModule, FCALMat    123     new G4LogicalVolume(SolidEmModule, FCALMaterials->Material("Copper"),
126       "EmModuleLogical");                         124       "EmModuleLogical");
127                                                   125  
128   LogicalEmModule->SetSmartless(FCALEmSmart);     126   LogicalEmModule->SetSmartless(FCALEmSmart);
129                                                   127 
130    LogicalEmModule->SetVisAttributes(ColorOfEM    128    LogicalEmModule->SetVisAttributes(ColorOfEMModule);
131   //  LogicalEmModule->SetVisAttributes(G4VisA << 129   //  LogicalEmModule->SetVisAttributes(G4VisAttributes::Invisible);
132                                                   130 
133                                                   131 
134 //---------------------                           132 //---------------------
135 //  FCAL Cable Troff                              133 //  FCAL Cable Troff  
136 //---------------------                           134 //---------------------
137   G4Tubs * SolidF1CableTroff =                    135   G4Tubs * SolidF1CableTroff =
138     new G4Tubs("F1CableTroffSolid", F1CableTro    136     new G4Tubs("F1CableTroffSolid", F1CableTroffRMin, F1CableTroffRMax,
139          F1CableTroffLenght, F1CableTroffStart    137          F1CableTroffLenght, F1CableTroffStartPhi, F1CableTroffDPhi);
140   G4LogicalVolume * LogicalF1CableTroff =         138   G4LogicalVolume * LogicalF1CableTroff =
141     new G4LogicalVolume(SolidF1CableTroff, FCA    139     new G4LogicalVolume(SolidF1CableTroff, FCALMaterials->Material("FCAL1CuArKap"),
142       "F1CableTroffLogical");                     140       "F1CableTroffLogical");
143                                                   141 
144   G4ThreeVector F1CableTroffTrans(0.,0.,0.);      142   G4ThreeVector F1CableTroffTrans(0.,0.,0.);
145   G4RotationMatrix F1CableTroffRot;               143   G4RotationMatrix F1CableTroffRot;
146                                                   144 
147   G4int i=0;                                      145   G4int i=0;
148   for(i=0 ; i < NCableTroff ; i++)                146   for(i=0 ; i < NCableTroff ; i++)
149     {                                             147     {
150 //      G4VPhysicalVolume * PhysicalF1CableTro    148 //      G4VPhysicalVolume * PhysicalF1CableTroff =
151   new G4PVPlacement(G4Transform3D(F1CableTroff    149   new G4PVPlacement(G4Transform3D(F1CableTroffRot,F1CableTroffTrans),
152         LogicalF1CableTroff,"F1CableTroffPhysi    150         LogicalF1CableTroff,"F1CableTroffPhysical",
153         LogicalEmModule,0,i+1);                   151         LogicalEmModule,0,i+1);
154                                                   152 
155       F1CableTroffRot.rotateZ(F1CableTroffRotZ    153       F1CableTroffRot.rotateZ(F1CableTroffRotZ);
156     }                                             154     }
157                                                   155 
158   LogicalF1CableTroff->SetVisAttributes(ColorO    156   LogicalF1CableTroff->SetVisAttributes(ColorOfEMModule);
159   // LogicalF1CableTroff->SetVisAttributes(G4V << 157   // LogicalF1CableTroff->SetVisAttributes(G4VisAttributes::Invisible);
160                                                   158 
161                                                   159 
162    //----------------------                       160    //----------------------
163    //    LArg gaps                                161    //    LArg gaps
164    //----------------------                       162    //----------------------
165                                                   163 
166   G4Tubs * SolidF1LArGap =                        164   G4Tubs * SolidF1LArGap = 
167     new G4Tubs("F1LArGapSolid",F1LArGapRmin, F    165     new G4Tubs("F1LArGapSolid",F1LArGapRmin, F1LArGapRmax, F1LArGapLenght, 
168          F1LArGapStartPhi,F1LArGapDPhi);          166          F1LArGapStartPhi,F1LArGapDPhi);
169                                                   167   
170    G4LogicalVolume * LogicalF1LArGap =            168    G4LogicalVolume * LogicalF1LArGap = 
171      new G4LogicalVolume(SolidF1LArGap, FCALMa    169      new G4LogicalVolume(SolidF1LArGap, FCALMaterials->Material("LiquidArgon"),
172        "LArg Gap");                               170        "LArg Gap");
173                                                   171   
174    for(i=1; i < NF1LarGap; i++){                  172    for(i=1; i < NF1LarGap; i++){
175 //     G4VPhysicalVolume * PhysicalF1LArGap =     173 //     G4VPhysicalVolume * PhysicalF1LArGap =
176        new G4PVPlacement(0,G4ThreeVector(F1LAr    174        new G4PVPlacement(0,G4ThreeVector(F1LArGapPosX[i]*cm,F1LArGapPosY[i]*cm,0.*cm),
177         LogicalF1LArGap,"F1LArGapPhysical", Lo    175         LogicalF1LArGap,"F1LArGapPhysical", LogicalEmModule, 0, i); 
178    };                                             176    };
179                                                   177 
180    // LogicalF1LArGap->SetVisAttributes(ColorO    178    // LogicalF1LArGap->SetVisAttributes(ColorOfLArg);
181    LogicalF1LArGap->SetVisAttributes(G4VisAttr << 179    LogicalF1LArGap->SetVisAttributes(G4VisAttributes::Invisible);
182                                                   180    
183                                                   181 
184     // Sensitive Volumes                          182     // Sensitive Volumes
185    G4SDManager* SDman = G4SDManager::GetSDMpoi    183    G4SDManager* SDman = G4SDManager::GetSDMpointer();
186                                                   184   
187    if(!FcalEmModuleSD)                            185    if(!FcalEmModuleSD)
188      {                                            186      {
189        FcalEmModuleSD = new FCALEMModuleSD("FC    187        FcalEmModuleSD = new FCALEMModuleSD("FCALTB/EmModuleSD");
190        SDman->AddNewDetector(FcalEmModuleSD);     188        SDman->AddNewDetector(FcalEmModuleSD);
191      }                                            189      }
192    LogicalF1LArGap->SetSensitiveDetector(FcalE    190    LogicalF1LArGap->SetSensitiveDetector(FcalEmModuleSD);
193                                                   191 
194                                                   192    
195                                                   193 
196    return LogicalEmModule;                        194    return LogicalEmModule;
197                                                   195 
198 }                                                 196 }
199                                                   197 
200                                                   198 
201 G4int FCALEMModule::GetF1TileID(G4int GapID)      199 G4int FCALEMModule::GetF1TileID(G4int GapID) 
202 { return F1LArITile[GapID]; }                     200 { return F1LArITile[GapID]; }
203                                                   201 
204 G4double FCALEMModule::GetF1LArGapPosX(G4int G    202 G4double FCALEMModule::GetF1LArGapPosX(G4int GapID)
205 { return F1LArGapPosX[GapID]; }                   203 { return F1LArGapPosX[GapID]; }
206                                                   204 
207                                                   205 
208                                                   206