Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phase2 shk21 #3912

Merged
merged 1 commit into from May 19, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion Geometry/HGCalCommonData/data/NoTaper/shashlikmodule.xml
Expand Up @@ -41,10 +41,12 @@
</LogicalPart>
</LogicalPartSection>

<Algorithm name="shashlik:DDShashlikModule">
<Algorithm name="shashlik:DDShashlikTaperModule">
<rParent name="shashlikmodule:ShashlikModule"/>
<String name="ActiveMaterial" value="shashlikmodule:LYSO"/>
<String name="ActiveName" value="shashlikmodule:ShashlikActive"/>
<String name="AbsorberMaterial" value="materials:Tungsten"/>
<String name="AbsorberName" value="shashlikmodule:ShashlikAbsorber"/>
<Numeric name="ActiveLayers" value="29"/>
<Numeric name="ActiveThickness" value="1.5*mm"/>
<Numeric name="AbsorberThickness" value="2.5*mm"/>
Expand Down
4 changes: 3 additions & 1 deletion Geometry/HGCalCommonData/data/shashlikmodule.xml
Expand Up @@ -41,10 +41,12 @@
</LogicalPart>
</LogicalPartSection>

<Algorithm name="shashlik:DDShashlikModule">
<Algorithm name="shashlik:DDShashlikTaperModule">
<rParent name="shashlikmodule:ShashlikModule"/>
<String name="ActiveMaterial" value="shashlikmodule:LYSO"/>
<String name="ActiveName" value="shashlikmodule:ShashlikActive"/>
<String name="AbsorberMaterial" value="materials:Tungsten"/>
<String name="AbsorberName" value="shashlikmodule:ShashlikAbsorber"/>
<Numeric name="ActiveLayers" value="29"/>
<Numeric name="ActiveThickness" value="1.5*mm"/>
<Numeric name="AbsorberThickness" value="2.5*mm"/>
Expand Down
30 changes: 16 additions & 14 deletions Geometry/HGCalCommonData/plugins/DDShashlikModule.cc
Expand Up @@ -25,20 +25,21 @@ DDShashlikModule::DDShashlikModule() {
DDShashlikModule::~DDShashlikModule() {}

void DDShashlikModule::initialize(const DDNumericArguments & nArgs,
const DDVectorArguments & vArgs,
const DDMapArguments & ,
const DDStringArguments & sArgs,
const DDStringVectorArguments & ) {
const DDVectorArguments & vArgs,
const DDMapArguments & ,
const DDStringArguments & sArgs,
const DDStringVectorArguments & ) {

activeMat = sArgs["ActiveMaterial"];
activeName = sArgs["ActiveName"];
activeLayers = int (nArgs["ActiveLayers"]);
activeThick = nArgs["ActiveThickness"];
absorbMat = sArgs["AbsorberMaterial"];
absorbName = sArgs["AbsorberName"];
absorbThick = nArgs["AbsorberThickness"];
widthFront = nArgs["WidthFront"];
widthBack = nArgs["WidthBack"];
moduleThick = nArgs["ModuleThickness"];
moduleTaperAngle = nArgs["ModuleTaperAngle"];
holeR = nArgs["HoleRadius"];
fibreMat = sArgs["FibreMaterial"];
fibreName = sArgs["FibreName"];
Expand All @@ -48,15 +49,16 @@ void DDShashlikModule::initialize(const DDNumericArguments & nArgs,
calibFibrePars = vArgs["CalibFibreParameters"];
edm::LogInfo("HGCalGeom") << "DDShashlikModule:: Active: " << activeLayers
<< " of " << activeName << " with " << activeMat
<< " thickness " << activeThick <<"|"<< absorbThick
<< " width " << widthFront << "|" << widthBack
<< " module size " << moduleThick
<< " module taper angle " << moduleTaperAngle/CLHEP::deg << "deg "
<< holeX.size() << " holes of radius " << holeR
<< " for fibres "<<fibreName <<" with "<< fibreMat
<< " Calibration fibre " << calibFibreName
<< " with parameters " << calibFibrePars[0] << ":"
<< calibFibrePars[1] << ":" << calibFibrePars[2];
<< " thickness " << activeThick << " Absorber: "
<< absorbName << " with " << absorbMat
<< " thickness " << absorbThick << " width "
<< widthFront << "|" << widthBack <<" module size "
<< moduleThick << holeX.size()<<" holes of radius "
<< holeR << " for fibres "<<fibreName << " with "
<< fibreMat << " Calibration fibre "
<< calibFibreName << " with parameters "
<< calibFibrePars[0] << ":" << calibFibrePars[1]
<< ":" << calibFibrePars[2];
for (unsigned int i=0; i<holeX.size(); ++i) {
edm::LogInfo("HGCalGeom") << "DDShashlikModule: Hole[" << i << "] at ("
<< holeX[i] << ", " << holeY[i] << ")";
Expand Down
3 changes: 2 additions & 1 deletion Geometry/HGCalCommonData/plugins/DDShashlikModule.h
Expand Up @@ -28,10 +28,11 @@ class DDShashlikModule : public DDAlgorithm {
int activeLayers; //Number of active layers
double activeThick; //Thickness of active layer
double absorbThick; //Thickness of absorber layer
std::string absorbMat; //Name of the absorber material
std::string absorbName; //Base name for absorber layers
double widthFront; //Width of the module in the front
double widthBack; //Width of the module in the back
double moduleThick; //Offset in z
double moduleTaperAngle; //Taper angle of individual module
double holeR; //Radius of the hole
std::string fibreMat; //Fibre Material
std::string fibreName; //Fibre Name
Expand Down
176 changes: 176 additions & 0 deletions Geometry/HGCalCommonData/plugins/DDShashlikNoTaperModule.cc
@@ -0,0 +1,176 @@
///////////////////////////////////////////////////////////////////////////////
// File: DDShashlikNoTaperModule.cc
// Description: Create a Shashlik module (using box)
///////////////////////////////////////////////////////////////////////////////

#include <cmath>
#include <algorithm>
#include <iostream>

#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "DetectorDescription/Base/interface/DDutils.h"
#include "DetectorDescription/Core/interface/DDSolid.h"
#include "DetectorDescription/Core/interface/DDMaterial.h"
#include "DetectorDescription/Core/interface/DDCurrentNamespace.h"
#include "DetectorDescription/Core/interface/DDSplit.h"
#include "DetectorDescription/Core/interface/DDLogicalPart.h"
#include "Geometry/HGCalCommonData/plugins/DDShashlikNoTaperModule.h"
#include "CLHEP/Units/GlobalPhysicalConstants.h"
#include "CLHEP/Units/GlobalSystemOfUnits.h"

DDShashlikNoTaperModule::DDShashlikNoTaperModule() {
edm::LogInfo("HGCalGeom") << "DDShashlikNoTaperModule test: Creating an instance";
}

DDShashlikNoTaperModule::~DDShashlikNoTaperModule() {}

void DDShashlikNoTaperModule::initialize(const DDNumericArguments & nArgs,
const DDVectorArguments & vArgs,
const DDMapArguments & ,
const DDStringArguments & sArgs,
const DDStringVectorArguments & ) {

activeMat = sArgs["ActiveMaterial"];
activeName = sArgs["ActiveName"];
activeLayers = int (nArgs["ActiveLayers"]);
activeThick = nArgs["ActiveThickness"];
absorbMat = sArgs["AbsorberMaterial"];
absorbName = sArgs["AbsorberName"];
absorbThick = nArgs["AbsorberThickness"];
widthFront = nArgs["WidthFront"];
widthBack = nArgs["WidthBack"];
moduleThick = nArgs["ModuleThickness"];
holeR = nArgs["HoleRadius"];
fibreMat = sArgs["FibreMaterial"];
fibreName = sArgs["FibreName"];
holeX = vArgs["HoleX"];
holeY = vArgs["HoleY"];
calibFibreName = sArgs["CalibFibreName"];
calibFibrePars = vArgs["CalibFibreParameters"];
edm::LogInfo("HGCalGeom") << "DDShashlikNoTaperModule:: Active: "
<< activeLayers << " of " << activeName << " with "
<< activeMat << " thickness " << activeThick
<< " Absorber: " << absorbName << " with "
<< absorbMat << " thickness " << absorbThick
<< " width " << widthFront << "|" << widthBack
<< " module size " << moduleThick << holeX.size()
<< " holes of radius " << holeR << " for fibres "
<< fibreName << " with " << fibreMat
<< " Calibration fibre " << calibFibreName
<< " with parameters " << calibFibrePars[0] << ":"
<< calibFibrePars[1] << ":" << calibFibrePars[2];
for (unsigned int i=0; i<holeX.size(); ++i) {
edm::LogInfo("HGCalGeom") << "DDShashlikNoTaperModule: Hole[" << i
<< "] at (" << holeX[i] << ", " << holeY[i]
<< ")";
}
idNameSpace = DDCurrentNamespace::ns();
edm::LogInfo("HGCalGeom") << "DDShashlikNoTaperModule: NameSpace "
<< idNameSpace << "\tParent " << parent().name();
}

void DDShashlikNoTaperModule::execute(DDCompactView& cpv) {

std::string baseName1 = DDSplit(activeName).first;
std::string baseName2 = DDSplit(absorbName).first;
double dx1 = 0.5*widthFront;
DDName name = DDName(baseName1, DDSplit(activeName).second);
DDSolid solid = DDSolidFactory::box(name, dx1,dx1, 0.5*activeThick);
DDMaterial matter = DDMaterial(DDName(DDSplit(activeMat).first,
DDSplit(activeMat).second));
DDLogicalPart active(solid.ddname(), matter, solid);
edm::LogInfo("HGCalGeom") << "DDShashlikNoTaperModule:: "<< name
<< " box made of " << matter.name() << " dim: "
<< dx1 << ":" << dx1 << ":" << 0.5*activeThick;
name = DDName(baseName2, DDSplit(absorbName).second);
solid = DDSolidFactory::box(name, dx1,dx1, 0.5*absorbThick);
matter = DDMaterial(DDName(DDSplit(absorbMat).first,
DDSplit(absorbMat).second));
DDLogicalPart absorb(solid.ddname(), matter, solid);
edm::LogInfo("HGCalGeom") << "DDShashlikNoTaperModule:: "<< name
<< " box made of " << matter.name() << " dim: "
<< dx1 << ":" << dx1 << ":" << 0.5*absorbThick;
matter = DDMaterial(DDName(DDSplit(fibreMat).first,
DDSplit(fibreMat).second));
DDRotation rot;
if (holeX.size() > 0) {
name = DDName(baseName1+DDSplit(fibreName).first,
DDSplit(activeName).second);
solid = DDSolidFactory::tubs(name, 0.5*activeThick, 0, holeR,
0, CLHEP::twopi);
DDLogicalPart fibre1(solid.ddname(), matter, solid);
edm::LogInfo("HGCalGeom") << "DDShashlikNoTaperModule:: " << name
<< " tube made of " << matter.name() << " dim: "
<< 0.5*activeThick << ":0:" << holeR << ":0:"
<< CLHEP::twopi;
name = DDName(baseName2+DDSplit(fibreName).first,
DDSplit(absorbName).second);
solid = DDSolidFactory::tubs(name, 0.5*absorbThick, 0, holeR,
0, CLHEP::twopi);
DDLogicalPart fibre2(solid.ddname(), matter, solid);
edm::LogInfo("HGCalGeom") << "DDShashlikNoTaperModule:: " << name
<< " tube made of " << matter.name() << " dim: "
<< 0.5*absorbThick << ":0:" << holeR << ":0:"
<< CLHEP::twopi;
for (unsigned int k=0; k<holeX.size(); ++k) {
DDTranslation tran(holeX[k],holeY[k],0);
cpv.position(fibre1, active, k+1, tran, rot);
edm::LogInfo("HGCalGeom") << "DDShashlikNoTaperModule:" << fibre1.name()
<< " no " << k+1 << " positioned in "
<< active.name() << " at " << tran
<< " with no rotation";
cpv.position(fibre2, absorb, k+1, tran, rot);
edm::LogInfo("HGCalGeom") << "DDShashlikNoTaperModule:" << fibre2.name()
<< " no " << k+1 << " positioned in "
<< absorb.name() << " at " << tran
<< " with no rotation";
}
}
name = DDName(baseName1+DDSplit(calibFibreName).first,
DDSplit(activeName).second);
solid = DDSolidFactory::tubs(name, 0.5*activeThick, 0,
calibFibrePars[0], 0, CLHEP::twopi);
DDLogicalPart fibre1(solid.ddname(), matter, solid);
edm::LogInfo("HGCalGeom") << "DDShashlikNoTaperModule:: " << name
<< " tube made of " << matter.name() << " dim: "
<< 0.5*activeThick << ":0:" << calibFibrePars[0]
<< ":0:" << CLHEP::twopi;
name = DDName(baseName2+DDSplit(calibFibreName).first,
DDSplit(absorbName).second);
solid = DDSolidFactory::tubs(name, 0.5*absorbThick, 0,
calibFibrePars[0], 0, CLHEP::twopi);
DDLogicalPart fibre2(solid.ddname(), matter, solid);
edm::LogInfo("HGCalGeom") << "DDShashlikNoTaperModule:: " << name
<< " tube made of " << matter.name() << " dim: "
<< 0.5*absorbThick << ":0:" << calibFibrePars[0]
<< ":0:" << CLHEP::twopi;
DDTranslation tranc(calibFibrePars[1],calibFibrePars[2],0);
cpv.position(fibre1, active, 1, tranc, rot);
edm::LogInfo("HGCalGeom") << "DDShashlikNoTaperModule:" << fibre1.name()
<< " no 1 positioned in " << active.name()
<< " at " << tranc << " with no rotation";
cpv.position(fibre2, absorb, 1, tranc, rot);
edm::LogInfo("HGCalGeom") << "DDShashlikNoTaperModule:" << fibre2.name()
<< " no 1 positioned in " << absorb.name()
<< " at " << tranc << " with no rotation";

for (int ii=0; ii<activeLayers; ii++) {
double z = -0.5*(moduleThick-activeThick)+ii*(activeThick+absorbThick);
DDTranslation tran(0,0,z);
cpv.position(active, parent(), ii+1, tran, rot);
edm::LogInfo("HGCalGeom") << "DDShashlikNoTaperModule:" << active.name()
<< " no " << ii+1 << " positioned in "
<< parent().name() << " at " << tran
<< " with no rotation";
if (ii < activeLayers-1) {
z += 0.5*(activeThick+absorbThick);
DDTranslation tran(0,0,z);
cpv.position(absorb, parent(), ii+1, tran, rot);
edm::LogInfo("HGCalGeom") << "DDShashlikNoTaperModule:" << absorb.name()
<< " no " << ii+1 << " positioned in "
<< parent().name() << " at " << tran
<< " with no rotation";
}
}
}

47 changes: 47 additions & 0 deletions Geometry/HGCalCommonData/plugins/DDShashlikNoTaperModule.h
@@ -0,0 +1,47 @@
#ifndef HGCalCommonData_DDShashlikNoTaperModule_h
#define HGCalCommonData_DDShashlikNoTaperModule_h

#include <map>
#include <string>
#include <vector>
#include "DetectorDescription/Base/interface/DDTypes.h"
#include "DetectorDescription/Algorithm/interface/DDAlgorithm.h"

class DDShashlikNoTaperModule : public DDAlgorithm {
public:
//Constructor and Destructor
DDShashlikNoTaperModule();
virtual ~DDShashlikNoTaperModule();

void initialize(const DDNumericArguments & nArgs,
const DDVectorArguments & vArgs,
const DDMapArguments & mArgs,
const DDStringArguments & sArgs,
const DDStringVectorArguments & vsArgs);

void execute(DDCompactView& cpv);

private:

std::string activeMat; //Name of the active material
std::string activeName; //Base name for active layers
int activeLayers; //Number of active layers
double activeThick; //Thickness of active layer
std::string absorbMat; //Name of the absorber material
std::string absorbName; //Base name for absorber layers
double absorbThick; //Thickness of absorber layer
double widthFront; //Width of the module in the front
double widthBack; //Width of the module in the back
double moduleThick; //Offset in z
double holeR; //Radius of the hole
std::string fibreMat; //Fibre Material
std::string fibreName; //Fibre Name
std::vector<double> holeX; //x-position of the holes
std::vector<double> holeY; //y-position of the holes
std::string calibFibreName; //Calibration Fibre Name
std::vector<double> calibFibrePars; //Parameters for calibration fibre

std::string idNameSpace; //Namespace of this and ALL sub-parts
};

#endif