Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /DD4hep/examples/DDCMS/src/plugins/DDTECCoolAlgo.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 "DD4hep/Printout.h"
0021 #include "DDCMS/DDCMSPlugins.h"
0022 
0023 // C/C++ include files
0024 #include <sstream>
0025 
0026 using namespace std;
0027 using namespace dd4hep;
0028 using namespace dd4hep::cms;
0029 
0030 static long algorithm(Detector& /* description */,
0031                       ParsingContext& ctxt,
0032                       xml_h e,
0033                       SensitiveDetector& /* sens */)
0034 {
0035   Namespace      ns(ctxt,e,true);
0036   AlgoArguments  args(ctxt, e);
0037   int            startCopyNo = args.find("StartCopyNo") ? args.value<int>("StartCopyNo") : 1;
0038   double         rPosition   = args.value<double>("RPosition");
0039   vector<double> phiPosition = args.value<vector<double> >("PhiPosition");
0040   vector<string> coolInsert  = args.value<vector<string> >("CoolInsert");
0041   Volume         mother      = ns.volume(args.parentName());
0042 
0043   LogDebug("TECGeom") << "debug: Parent " << mother.name() 
0044                       <<" NameSpace " << ns.name << " at radial Position " << rPosition;
0045   if (phiPosition.size() == coolInsert.size()) {
0046     for (int i=0; i<(int)(phiPosition.size()); i++)   {
0047       LogDebug("TECGeom") << "debug: Insert[" << i << "]: "
0048           << coolInsert.at(i) << " at Phi " 
0049           << phiPosition.at(i)/CLHEP::deg;
0050     }
0051   }
0052   else {
0053     LogDebug("TECGeom") << "ERROR: Number of inserts does not match the numer of PhiPositions!";
0054   }
0055 
0056   int copyNo  = startCopyNo;
0057   // loop over the inserts to be placed
0058   for (int i = 0; i < (int)(coolInsert.size()); i++) {
0059     Volume child = ns.volume(ns.real_name(coolInsert.at(i)));
0060     // get positions
0061     double xpos =  rPosition*cos(phiPosition.at(i));
0062     double ypos = -rPosition*sin(phiPosition.at(i));
0063     // place inserts
0064     Position tran(xpos, ypos, 0.0);
0065     mother.placeVolume(child, copyNo, tran);
0066     LogDebug("TECGeom") << "test " << child.name() << "["  
0067                         << copyNo << "] positioned in " << mother.name()
0068                         << " at " << tran
0069                         << " phi " << phiPosition.at(i)/CLHEP::deg << " r " 
0070                         << rPosition;
0071     copyNo++;
0072   }
0073   LogDebug("TECGeom") << "Finished....";
0074   return 1;
0075 }
0076 
0077 // first argument is the type from the xml file
0078 DECLARE_DDCMS_DETELEMENT(DDCMS_track_DDTECCoolAlgo,algorithm)
0079