Skip to content
Snippets Groups Projects
Commit 1e17fc77 authored by Riccardo Longo's avatar Riccardo Longo
Browse files

Merge branch 'master' into 'master'

Trigger Merge

See merge request !2
parents 81b8544b b04bdc0a
No related branches found
No related tags found
1 merge request!2Trigger Merge
/Detector/Optical true
/Detector/Overlaps false
/Detector/PI0 false
/Detector/RunNumber 347
/Detector/PrintDebugStatement TEST LINE
/Detector/ForcePosition true
#/Detector/ConfigFile Alignment_2018.xml
/Detector/SetWorldDimensions 2. 2. 260. m
#EMCAL
/Detector/ZDC/Add
/Detector/ZDC/Position 0. 0. 100. mm
/Detector/ZDC/FiberDiameters 1.5 0. 0. mm
/Detector/ZDC/AbsorberDimensions 90. 180. 10.2 mm #run3
/Detector/ZDC/nAbsorbers 11
/Detector/ZDC/HousingThickness 5. mm
/Detector/ZDC/GapThickness 2. mm
/Detector/ZDC/SteelAbsorberHeight 290. mm
/Detector/ZDC/Optical false
/Detector/ZDC/CheckOverlaps false
/Detector/ZDC/ReducedTree true
/Detector/ZDC/HousingMaterial aluminum
/Detector/ZDC/AbsorberMaterial pure
/Detector/ZDC/Duplicate 1
/Detector/ZDC/Position 0. 0. 271. mm
/Detector/ZDC/Duplicate 2
/Detector/ZDC/Position 0. 0. 423. mm
/Detector/ZDC/Duplicate 3
/Detector/ZDC/Position 0. 0. 575. mm
/Detector/RPD/Add
/Detector/RPD/Position 0. 0. 185. mm
/Detector/RPD/FiberDiameters .60 .66 .71 mm
/Detector/RPD/HousingThickness 2. mm
/Detector/RPD/FiberPitchX 1.2 mm
/Detector/RPD/FiberPitchZ 2.0 mm
/Detector/RPD/TileSize 9.6 mm
/Detector/RPD/MinWallThickness 0.01 mm
/Detector/RPD/FiberReadoutDistance 360 mm
/Detector/RPD/RPDtype panflute
/Detector/RPD/Optical true
/Detector/RPD/CheckOverlaps false
/Detector/RPD/ReducedTree true
/Detector/Optical true
/Detector/Overlaps false
/Detector/PI0 false
/Detector/RunNumber 347
/Detector/PrintDebugStatement TEST LINE
/Detector/ForcePosition true
#/Detector/ConfigFile Alignment_2018.xml
/Detector/SetWorldDimensions 2. 2. 260. m
#EMCAL
/Detector/ZDC/Add
/Detector/ZDC/Position 0. 0. 100. mm
/Detector/ZDC/FiberDiameters 1.5 0. 0. mm
/Detector/ZDC/AbsorberDimensions 90. 180. 10.2 mm #run3
/Detector/ZDC/nAbsorbers 11
/Detector/ZDC/HousingThickness 5. mm
/Detector/ZDC/GapThickness 2. mm
/Detector/ZDC/SteelAbsorberHeight 290. mm
/Detector/ZDC/Optical false
/Detector/ZDC/CheckOverlaps false
/Detector/ZDC/ReducedTree true
/Detector/ZDC/HousingMaterial aluminum
/Detector/ZDC/AbsorberMaterial pure
/Detector/ZDC/Duplicate 1
/Detector/ZDC/Position 0. 0. 271. mm
/Detector/ZDC/Duplicate 2
/Detector/ZDC/Position 0. 0. 423. mm
/Detector/ZDC/Duplicate 3
/Detector/ZDC/Position 0. 0. 575. mm
/Detector/RPD/Add
/Detector/RPD/Position 0. 0. 185. mm
/Detector/RPD/FiberDiameters .60 .66 .71 mm
/Detector/RPD/HousingThickness 2. mm
/Detector/RPD/FiberPitchX 1.2 mm
/Detector/RPD/FiberPitchZ 2.0 mm
/Detector/RPD/TileSize 9.6 mm
/Detector/RPD/MinWallThickness 0.01 mm
/Detector/RPD/FiberReadoutDistance 360 mm
/Detector/RPD/RPDtype panflute
/Detector/RPD/Optical true
/Detector/RPD/CheckOverlaps false
/Detector/RPD/ReducedTree true
#Trigger
#/Detector/TRI/Add
#/Detector/TRI/Position 0. 0. -3183. mm
......@@ -33,6 +33,7 @@
#include "ModTypeZDC.hh"
#include "ModTypeRPD.hh"
#include "ModTypeTRI.hh"
#include "XMLSettingsReader.hh"
#include "Materials.hh"
......@@ -124,6 +125,7 @@ public:
virtual void LoadAlignmentFile ( G4String _inFile = "" );
virtual void AddZDC ( G4ThreeVector* position = NULL );
virtual void AddRPD ( G4ThreeVector* position = NULL );
virtual void AddTRI ( G4ThreeVector* position = NULL );
virtual void SetConfigFileName ( G4String _name ){ m_configFileName = _name; }
virtual void SetRunNumber ( G4int _run ){ m_runNumber = _run; }
inline void SetOverlapsFlag ( G4bool arg ){CHECK_OVERLAPS = arg;}
......@@ -137,6 +139,7 @@ public:
inline G4bool GetPI0Flag ( ){ return PI0; }
inline std::vector< ModTypeZDC* >* GetZDCvec ( ){ return &m_ZDCvec; }
inline std::vector< ModTypeRPD* >* GetRPDvec ( ){ return &m_RPDvec; }
inline ModTypeTRI* GetTRI ( ){ return m_TRI; }
//Manual World Volume
inline void SetWorldDimensions ( G4ThreeVector* vec ){ ConstructWorldVolume( vec->x(), vec->y(), vec->z() ); }
......@@ -174,6 +177,8 @@ public:
inline void SetCurrentRPD ( G4int arg ){ currentRPD = arg; }
virtual void DuplicateRPD ( G4int module );
//For manual TRI
inline void SetTRIPosition ( G4ThreeVector* vec ){ m_TRI->SetPosition(vec); }
protected:
G4ThreeVector* m_WorldDimensions;
......@@ -199,8 +204,10 @@ protected:
/* Number of each detector */
std::vector< ModTypeZDC* > m_ZDCvec;
std::vector< ModTypeRPD* > m_RPDvec;
ModTypeTRI* m_TRI;
G4int currentZDC;
G4int currentRPD;
G4bool isTrigger=false;
private:
......
......@@ -60,6 +60,7 @@ class DetectorMessenger: public G4UImessenger{
G4UIdirectory* fDetDir;
G4UIdirectory* fRPDDir;
G4UIdirectory* fZDCDir;
G4UIdirectory* fTRIDir;
G4UIcmdWithABool* fOpticalCmd;
G4UIcmdWithABool* fOverlapsCmd;
......@@ -106,6 +107,11 @@ class DetectorMessenger: public G4UImessenger{
G4UIcmdWithAnInteger* fRPDSetCurrentCmd;
G4UIcmdWithAnInteger* fRPDDuplicateCmd;
//TRI commands
G4UIcmdWithoutParameter* fTRIAddCmd;
G4UIcmdWith3VectorAndUnit* fTRIPositionCmd;
};
#endif
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// Author: Matthew Hoppesch
#ifndef ModTypeTRI_h
#define ModTypeTRI_h 1
#include "globals.hh"
#include "G4PVPlacement.hh"
#include "Materials.hh"
#include <vector>
class G4VPhysicalVolume;
class G4LogicalVolume;
class G4VSolid;
class G4Material;
/// Detector construction class to define materials and geometry.
class ModTypeTRI
{
public:
ModTypeTRI(ModTypeTRI*);
ModTypeTRI(G4LogicalVolume*, G4ThreeVector* );
~ModTypeTRI();
virtual void Construct();
virtual void ConstructSDandField();
virtual void ConstructDetector();
inline void SetPosition ( G4ThreeVector* vec ){ delete m_pos; m_pos = vec; }
inline G4LogicalVolume* GetFHLogicalVolume( ){ return m_FrontPaddleHLogical; }
inline G4LogicalVolume* GetFVLogicalVolume( ){ return m_FrontPaddleVLogical; }
inline G4LogicalVolume* GetBHLogicalVolume( ){ return m_BackPaddleHLogical; }
inline G4LogicalVolume* GetBVLogicalVolume( ){ return m_BackPaddleVLogical; }
inline G4ThreeVector* GetPosition ( ){ return m_pos; }
protected:
G4ThreeVector* m_pos;
G4Material* m_matPaddle;
Materials* m_materials;
G4LogicalVolume* m_logicMother;
G4bool CHECK_OVERLAPS;
G4VSolid* m_ModuleBox;
G4LogicalVolume* m_ModuleLogical;
G4VPhysicalVolume* m_ModulePhysical;
G4VSolid* m_FrontPaddleH;
G4LogicalVolume* m_FrontPaddleHLogical;
G4VPhysicalVolume* m_FrontPaddleHPhysical;
G4VSolid* m_FrontPaddleV;
G4LogicalVolume* m_FrontPaddleVLogical;
G4VPhysicalVolume* m_FrontPaddleVPhysical;
G4VSolid* m_BackPaddleH;
G4LogicalVolume* m_BackPaddleHLogical;
G4VPhysicalVolume* m_BackPaddleHPhysical;
G4VSolid* m_BackPaddleV;
G4LogicalVolume* m_BackPaddleVLogical;
G4VPhysicalVolume* m_BackPaddleVPhysical;
// Vertical quartz strips (these strips are full -- no partial segments)
};
#endif
......@@ -329,7 +329,11 @@ G4VPhysicalVolume* DetectorConstruction::ManualConstruction(){
printf( "RPD%d center = (%f,%f,%f)\n", rpd->GetModNum(), pos->x(), pos->y(), pos->z() );
rpd->Construct();
}
if(isTrigger){
pos = m_TRI->GetPosition();
printf( "Trigger%d center = (%f,%f,%f)\n", 1, pos->x(), pos->y(), pos->z() );
m_TRI ->Construct();
}
return m_physWorld;
}
......@@ -533,7 +537,9 @@ void DetectorConstruction::ConstructSDandField( ){
}
}
if(isTrigger){
m_TRI->ConstructSDandField();
}
//***********************************************************************************
// READ Survey_2018.xml and Alignment_2018.xml
//***********************************************************************************
......@@ -700,3 +706,9 @@ void DetectorConstruction::DuplicateRPD( G4int module ){
currentRPD = newModNum;
printf("Duplicate RPD%d built from RPD%d\n", newModNum, module);
}
//Add a Trigger
void DetectorConstruction::AddTRI(G4ThreeVector* position){
m_TRI = new ModTypeTRI( m_logicWorld, position );
printf("Added Trigger%d\n", 1);
isTrigger = true;
}
......@@ -59,6 +59,9 @@ DetectorMessenger::DetectorMessenger(DetectorConstruction * Det)
fZDCDir = new G4UIdirectory("/Detector/RPD/");
fZDCDir->SetGuidance("RPD creation and modification");
fTRIDir = new G4UIdirectory("/Detector/TRI/");
fTRIDir->SetGuidance("Trigger creation and positioning");
fOpticalCmd = new G4UIcmdWithABool("/Detector/Optical", this);
fOpticalCmd->SetGuidance("Set optical flag");
fOpticalCmd->AvailableForStates(G4State_PreInit, G4State_Init, G4State_Idle);
......@@ -303,6 +306,19 @@ DetectorMessenger::DetectorMessenger(DetectorConstruction * Det)
fRPDDuplicateCmd->SetDefaultValue(0);
fRPDDuplicateCmd->SetToBeBroadcasted(false);
//TRI commands
fTRIAddCmd = new G4UIcmdWithoutParameter("/Detector/TRI/Add", this);
fTRIAddCmd->SetGuidance("Add a TRI to the world");
fTRIAddCmd->AvailableForStates(G4State_PreInit, G4State_Init, G4State_Idle);
fTRIAddCmd->SetToBeBroadcasted(false);
fTRIPositionCmd = new G4UIcmdWith3VectorAndUnit("/Detector/TRI/Position", this);
fTRIPositionCmd->SetGuidance("Set current TRI position");
fTRIPositionCmd->AvailableForStates(G4State_PreInit, G4State_Init, G4State_Idle);
fTRIPositionCmd->SetToBeBroadcasted(false);
fTRIPositionCmd->SetParameterName("X","Y","Z",true);
fTRIPositionCmd->SetDefaultValue(G4ThreeVector(0.,0.,0.));
fTRIPositionCmd->SetDefaultUnit("mm");
}
/*
......@@ -355,6 +371,10 @@ DetectorMessenger::~DetectorMessenger(){
delete fRPDSetCurrentCmd;
delete fRPDDuplicateCmd;
//TRI Commands
delete fTRIAddCmd;
delete fTRIPositionCmd;
}
......@@ -484,4 +504,12 @@ void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
else if(command == fRPDDuplicateCmd){
fDetector->DuplicateRPD( fRPDDuplicateCmd->GetNewIntValue(newValue) );
}
//TRI Commands
else if(command == fTRIAddCmd){
fDetector->AddTRI();
}
else if(command == fTRIPositionCmd){
fDetector->SetTRIPosition( new G4ThreeVector( fTRIPositionCmd->GetNew3VectorValue(newValue) ) );
}
}
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \ingroup mc
/// \file ModTypeTRU.cc
/// \author Matthew Hoppesch
/// \brief Trigger detector construction
#include "ModTypeTRI.hh"
#include "FiberSD.hh"
#include "G4GeometryManager.hh"
#include "G4SolidStore.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4MaterialTable.hh"
#include "G4SDManager.hh"
#include "G4Box.hh"
#include "G4Para.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4SystemOfUnits.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include <stdio.h>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ModTypeTRI::ModTypeTRI(G4LogicalVolume* mother, G4ThreeVector* pos)
: m_pos( pos ),
CHECK_OVERLAPS(false),
m_logicMother( mother )
{
m_materials = Materials::getInstance();
m_materials->UseOpticalMaterials(true);
m_materials->DefineOpticalProperties();
m_matPaddle = m_materials->PMMA;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ModTypeTRI::~ModTypeTRI()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ModTypeTRI::Construct(){
ConstructDetector();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ModTypeTRI::ConstructDetector()
{
//----------------------------------------------
// Paddle Dimensions
//----------------------------------------------
float frontPad_dim_z = 20*mm;
float frontPad_dim_y = 250*mm;
float frontPad_dim_x = 4*mm;
float backPad_dim_z = 25*mm;
float backPad_dim_y = 200*mm;
float backPad_dim_x = 7*mm;
float separation_dist_z = 52.885*mm;
float box_dim = 300*mm;
//----------------------------------------------
// Housing
//----------------------------------------------
m_ModuleBox = new G4Box("ModuleCasing", box_dim*mm/2.0,box_dim*mm/2.0, box_dim*mm/2.0);
m_ModuleLogical = new G4LogicalVolume(m_ModuleBox ,m_materials->Air, "Module_Logical");
G4RotationMatrix* nullRotation = new G4RotationMatrix();
m_ModulePhysical = new G4PVPlacement(nullRotation,G4ThreeVector( m_pos->x(), m_pos->y(), m_pos->z() ) ,m_ModuleLogical,"Trigger_Body_Physical",m_logicMother,false,1,CHECK_OVERLAPS);
G4VisAttributes* moduleColor = new G4VisAttributes( );
moduleColor->SetColor(0.,0.,0.,.0);
m_ModuleLogical->SetVisAttributes( moduleColor );
//----------------------------------------------
// Trigger
//----------------------------------------------
m_FrontPaddleH = new G4Box("FrontPaddleH",
frontPad_dim_x*mm/2.0 ,
frontPad_dim_y*mm/2.0,
frontPad_dim_z*mm/2.0);
m_FrontPaddleHLogical =
new G4LogicalVolume(m_FrontPaddleH,
m_matPaddle,
"m_FrontPaddleHLogical");
m_FrontPaddleV = new G4Box("FrontPaddleV",
frontPad_dim_x*mm/2.0 ,
frontPad_dim_y*mm/2.0,
frontPad_dim_z*mm/2.0);
m_FrontPaddleVLogical =
new G4LogicalVolume(m_FrontPaddleV,
m_matPaddle,
"m_FrontPaddleVLogical");
m_BackPaddleH = new G4Box("BackPaddleH",
backPad_dim_x*mm/2.0 ,
backPad_dim_y*mm/2.0,
backPad_dim_z*mm/2.0);
m_BackPaddleHLogical =
new G4LogicalVolume(m_BackPaddleH,
m_matPaddle,
"m_BackPaddleHLogical");
m_BackPaddleV = new G4Box("BackPaddleV",
backPad_dim_x*mm/2.0 ,
backPad_dim_y*mm/2.0,
backPad_dim_z*mm/2.0);
m_BackPaddleVLogical =
new G4LogicalVolume(m_BackPaddleV,
m_matPaddle,
"m_BackPaddleVLogical");
G4VisAttributes* PadColor = new G4VisAttributes();
PadColor->SetColor(0.,1.,1.,1.);
m_FrontPaddleHLogical->SetVisAttributes(PadColor);
m_FrontPaddleVLogical->SetVisAttributes(PadColor);
m_BackPaddleHLogical->SetVisAttributes(PadColor);
m_BackPaddleVLogical->SetVisAttributes(PadColor);
//----------------------------------------------
// Placement
//----------------------------------------------
G4RotationMatrix* Rotation = new G4RotationMatrix();
Rotation->rotateZ(90.*deg);
m_FrontPaddleHPhysical = new G4PVPlacement(Rotation,
G4ThreeVector(0.*mm,0.*mm,separation_dist_z*mm/2.+frontPad_dim_z*1.501*mm),
m_FrontPaddleHLogical,
"FrontPaddleH_Phys",
m_ModuleLogical,
false,
1,
CHECK_OVERLAPS);
m_FrontPaddleVPhysical = new G4PVPlacement(nullRotation,
G4ThreeVector(0.*mm,0.*mm,separation_dist_z*mm/2.+frontPad_dim_z*mm/2.),
m_FrontPaddleVLogical,
"FrontPaddleV_Phys",
m_ModuleLogical,
false,
1,
CHECK_OVERLAPS);
m_BackPaddleHPhysical = new G4PVPlacement(Rotation,
G4ThreeVector(0.*mm,0.*mm,-separation_dist_z*mm/2.-backPad_dim_z*1.501*mm),
m_BackPaddleHLogical,
"BackPaddleH_Phys",
m_ModuleLogical,
false,
1,
CHECK_OVERLAPS);
m_BackPaddleVPhysical = new G4PVPlacement(nullRotation,
G4ThreeVector(0.*mm,0.*mm,-separation_dist_z*mm/2.-backPad_dim_z*mm/2.),
m_BackPaddleVLogical,
"BackPaddleV_Phys",
m_ModuleLogical,
false,
1,
CHECK_OVERLAPS);
std::cout << "Trigger construction finished" << std::endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ModTypeTRI::ConstructSDandField(){
//G4SDManager* SDman = G4SDManager::GetSDMpointer();
//m_FiberCoreLogical->SetSensitiveDetector( aFiberSD );
std::cout << "Trigger SD construction finished" << std::endl;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment