Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-24 09:25:07

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   double        startAngle  = args.value<double>("StartAngle");  //Start angle
0036   double        incrAngle   = args.value<double>("IncrAngle");   //Increment in angle
0037   double        zIn         = args.value<double>("ZIn");         //z position for the even ones
0038   double        zOut        = args.value<double>("ZOut");        //z position for the odd  ones
0039   int           number      = args.value<double>("Number");      //Number of copies
0040   int           startCopyNo = args.find("StartCopyNo") ? args.value<int>("StartCopyNo") : 1; //Start copy number
0041   int           incrCopyNo  = args.find("IncrCopyNo") ? args.value<int>("IncrCopyNo") : 1;  //Increment in copy number
0042 
0043   LogDebug("TECGeom") << "debug: Parameters for "
0044       << "positioning--" << "\tStartAngle " 
0045       << startAngle/CLHEP::deg << "\tIncrAngle " 
0046       << incrAngle/CLHEP::deg << "\tZ in/out " << zIn << ", " 
0047       << zOut         << "\tCopy Numbers " << number 
0048       << " Start/Increment " << startCopyNo << ", " 
0049       << incrCopyNo;
0050   LogDebug("TECGeom") << "debug: Parent " << mother.name() 
0051       << "\tChild " << child.name() << " NameSpace " 
0052       << ns.name;
0053 
0054   if (number > 0) {
0055     double theta  = 90.*CLHEP::deg;
0056     int    copyNo = startCopyNo;
0057     for (int i=0; i<number; i++) {
0058       double phix = startAngle + i*incrAngle;
0059       double phiy = phix + 90.*CLHEP::deg;
0060       Rotation3D rotation = make_rotation3D(theta, phix, theta, phiy, 0, 0);
0061       Position   tran(0., 0., (i%2 == 0) ? zIn : zOut);
0062       /* PlacedVolume pv = */ mother.placeVolume(child, copyNo, Transform3D(rotation,tran));
0063       LogDebug("TECGeom") << "test: " << child.name() <<" number "
0064           << copyNo << " positioned in " << mother.name() <<" at "
0065           << tran << " with " << rotation;
0066       copyNo += incrCopyNo;
0067     }
0068   }
0069   return 1;
0070 }
0071 
0072 // first argument is the type from the xml file
0073 DECLARE_DDCMS_DETELEMENT(DDCMS_track_DDTECPhiAlgo,algorithm)