Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /DD4hep/examples/DDCMS/src/plugins/DDTrackerPhiAlgo.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 //==========================================================================
0002 //  AIDA Detector description implementation 
0003 //--------------------------------------------------------------------------
0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 // All rights reserved.
0006 //
0007 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 //
0010 // Author     : M.Frank
0011 //
0012 //==========================================================================
0013 //
0014 // Specialized generic detector constructor
0015 // 
0016 //==========================================================================
0017 
0018 // Framework include files
0019 #include "DD4hep/DetFactoryHelper.h"
0020 #include "DDCMS/DDCMSPlugins.h"
0021 
0022 using namespace std;
0023 using namespace dd4hep;
0024 using namespace dd4hep::cms;
0025 
0026 static long algorithm(Detector& /* description */,
0027                       ParsingContext& ctxt,
0028                       xml_h e,
0029                       SensitiveDetector& /* sens */)
0030 {
0031   Namespace      ns(ctxt, e, true);
0032   AlgoArguments  args(ctxt, e);
0033   Volume         mother      = ns.volume(args.parentName());
0034   Volume         child       = ns.volume(args.childName());
0035   int            startcn     = args.find("StartCopyNo") ? args.value<int>("StartCopyNo") : 1;
0036   int            incrcn      = args.find("IncrCopyNo")  ? args.value<int>("IncrCopyNo")  : 1;
0037   vector<double> phi         = args.value<vector<double> >("Phi");         // Phi values
0038   vector<double> zpos        = args.value<vector<double> >("ZPos");        // Z positions
0039   int            numcopies   = args.find("NumCopies") ? args.value<int>("NumCopies") : int(phi.size());
0040   double         radius      = args.value<double>("Radius");
0041   double         tilt        = args.value<double>("Tilt");
0042 
0043   if ( numcopies != int(phi.size()) )  {
0044     LogDebug("TrackerGeom") << "error: Parameter "
0045         << "NumCopies does not agree with the size "
0046         << "of the Phi vector. It was adjusted to "
0047         << "be the size of the Phi vector and may "
0048         << "lead to crashes or errors.";
0049   }
0050   LogDebug("TrackerGeom") << "debug: Parameters for position"
0051                           << "ing:: " << " Radius " << radius << " Tilt " 
0052                           << tilt/CLHEP::deg << " Copies " << phi.size() 
0053                           << " at";
0054   for (int i=0; i<(int)(phi.size()); i++)
0055     LogDebug("TrackerGeom") << "\t[" << i << "] phi = " << phi[i]/CLHEP::deg 
0056         << " z = " << zpos[i];
0057   LogDebug("TrackerGeom") <<  "debug: Parent " << mother.name()
0058       <<"\tChild " << child.name() << " NameSpace " << ns.name;
0059 
0060   double theta  = 90.*CLHEP::deg;
0061   int ci = startcn;
0062   for (int i  = 0; i < numcopies; ++i) {
0063     double phix   = phi[i] + tilt;
0064     double phiy   = phix + 90.*CLHEP::deg;
0065     double xpos   = radius*cos(phi[i]);
0066     double ypos   = radius*sin(phi[i]);
0067     Rotation3D rot = make_rotation3D(theta, phix, theta, phiy, 0., 0.);
0068     Position   tran(xpos, ypos, zpos[i]);
0069     /* PlacedVolume pv = */ mother.placeVolume(child,ci,Transform3D(rot,tran));
0070     LogDebug("TrackerGeom") << "test: " << child.name() << " number "
0071         << ci << " positioned in " << mother.name() << " at "
0072         << tran  << " with " << rot;
0073     ci = ci+incrcn;
0074   }
0075   return 1;
0076 }
0077 
0078 // first argument is the type from the xml file
0079 DECLARE_DDCMS_DETELEMENT(DDCMS_track_DDTrackerPhiAlgo,algorithm)
0080