CMS 3D CMS Logo

Typedefs | Functions
DDLinear.cc File Reference
#include "DD4hep/DetFactoryHelper.h"
#include "DetectorDescription/DDCMS/interface/DDPlugins.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include <Math/Cartesian3D.h>
#include <Math/DisplacementVector3D.h>

Go to the source code of this file.

Typedefs

using DD3Vector = ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > >
 

Functions

static long algorithm (Detector &, cms::DDParsingContext &ctxt, xml_h e, SensitiveDetector &)
 
 DD4HEP_OPEN_PLUGIN (dd4hep, ddcms_det_element_DDCMS_global_DDLinear)
 

Typedef Documentation

using DD3Vector = ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<double> >

Definition at line 11 of file DDLinear.cc.

Function Documentation

static long algorithm ( Detector &  ,
cms::DDParsingContext ctxt,
xml_h  e,
SensitiveDetector  
)
static

Definition at line 13 of file DDLinear.cc.

References createfilelist::args, runEdmFileComparison::base, ConvertTo, popcon2dropbox::copy(), funct::cos(), delta, cms::DDAlgoArguments::find(), mps_fire::i, LogDebug, gen::n, cms::DDNamespace::name(), cms::DDAlgoArguments::parentName(), idealTransformation::rotation, funct::sin(), theta(), cms::DDAlgoArguments::value(), cms::DDNamespace::volume(), and g4SimHits_cfi::Volume.

17 {
18  cms::DDNamespace ns( ctxt, e, true );
19  DDAlgoArguments args( ctxt, e );
20 
21  int n = args.value<int>("N");
22  int startCopyNo = args.find("StartCopyNo") ? args.value<int>("StartCopyNo") : 1;
23  int incrCopyNo = args.find("IncrCopyNo") ? args.value<int>("IncrCopyNo") : 1;
24  double theta = args.find("Theta") ? args.value<double>("Theta") : 0.;
25  double phi = args.find("Phi") ? args.value<double>("Phi") : 0.;
26  double delta = args.find("Delta") ? args.value<double>("Delta") : 0.;
27  vector<double> base = args.value<vector<double> >("Base");
28  Volume mother = ns.volume(args.parentName());
29  Volume child = ns.volume(args.value<string>("ChildName"));
30  int copy = startCopyNo;
31 
32  LogDebug("DDAlgorithm") << "DDLinear: Parameters for positioning:: n "
33  << n << " Direction Theta, Phi, Delta "
34  << ConvertTo( theta, deg ) << " "
35  << ConvertTo( phi, deg ) << " " << ConvertTo( delta, deg )
36  << " Base " << base[0]
37  << ", " << base[1] << ", " << base[2];
38 
39  LogDebug("DDAlgorithm") << "DDLinear: Parent " << mother.name()
40  << "\tChild " << child.name() << " NameSpace "
41  << ns.name();
42 
43  Position direction( sin( theta ) * cos( phi ),
44  sin( theta ) * sin( phi ),
45  cos( theta ));
46 
47  Position basetr( base[0], base[1], base[2] );
48 
49  Rotation3D rotation = Rotation3D(); // Identity rotation
50 
51  for( int i = 0; i < n; ++i )
52  {
53  Position tran = basetr + ( double( copy ) * delta ) * direction;
54  mother.placeVolume( child, copy, Transform3D( rotation, tran ));
55  LogDebug( "DDAlgorithm" ) << "DDLinear: " << child.name() << " number "
56  << copy << " positioned in " << mother.name() << " at "
57  << tran << " with " << rotation;
58 
59  copy += incrCopyNo;
60  }
61 
62  return 1;
63 }
#define LogDebug(id)
dbl * delta
Definition: mlp_gen.cc:36
#define ConvertTo(_x, _y)
Definition: DDUnits.h:6
def copy(args, dbName)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
base
Make Sure CMSSW is Setup ##.
DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_global_DDLinear   
)

Definition at line 66 of file DDLinear.cc.