Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /DD4hep/examples/DDCMS/src/plugins/DDTrackerZPosAlgo.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   int            startCopyNo = args.find("StartCopyNo") ? args.value<int>("StartCopyNo") : 1;
0034   int            incrCopyNo  = args.find("IncrCopyNo")  ? args.value<int>("IncrCopyNo")  : 1;
0035   Volume         mother      = ns.volume(args.parentName());
0036   Volume         child       = ns.volume(args.value<string>("ChildName"));
0037   vector<double> zvec        = args.value<vector<double> >("ZPositions");    // Z positions
0038   vector<string> rotMat      = args.value<vector<string> >("Rotations");   // Names of rotation matrices
0039 
0040   LogDebug("TrackerGeom") << "debug: Parent " << mother.name() 
0041                           << "\tChild " << child.name() << " NameSpace " 
0042                           << ns.name << "\tCopyNo (Start/Increment) " 
0043                           << startCopyNo << ", " << incrCopyNo << "\tNumber " << zvec.size();
0044   for (int i = 0; i < (int)(zvec.size()); i++)
0045     LogDebug("TrackerGeom") << "\t[" << i << "]\tZ = " << zvec[i]
0046                             << ", Rot.Matrix = " << rotMat[i];
0047 
0048   for (int i=0, copy = startCopyNo; i<(int)(zvec.size()); i++, copy += incrCopyNo) {
0049     Position tran(0, 0, zvec[i]);
0050     Rotation3D rot;
0051     /* PlacedVolume pv = */ rotMat[i] != "NULL"
0052       ? mother.placeVolume(child,copy,Transform3D(ns.rotation(rotMat[i]),tran))
0053       : mother.placeVolume(child,copy,tran);
0054     LogDebug("TrackerGeom") << "test: " << child.name() 
0055                             <<" number " << copy << " positioned in " 
0056                             << mother.name() << " at " << tran << " with " << rot;
0057   }
0058   return 1;
0059 }
0060 
0061 // first argument is the type from the xml file
0062 DECLARE_DDCMS_DETELEMENT(DDCMS_track_DDTrackerZPosAlgo,algorithm)
0063