CMS 3D CMS Logo

Public Member Functions | Private Attributes

DDHCalFibreBundle Class Reference

#include <DDHCalFibreBundle.h>

List of all members.

Public Member Functions

 DDHCalFibreBundle ()
void execute (DDCompactView &cpv)
void initialize (const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs)
virtual ~DDHCalFibreBundle ()

Private Attributes

std::vector< double > areaSection
std::vector< int > bundle
std::string childPrefix
double deltaPhi
double deltaZ
std::string idNameSpace
std::string material
int numberPhi
std::vector< double > rEnd
std::vector< double > rStart
double tilt

Detailed Description

Definition at line 10 of file DDHCalFibreBundle.h.


Constructor & Destructor Documentation

DDHCalFibreBundle::DDHCalFibreBundle ( )

Definition at line 19 of file DDHCalFibreBundle.cc.

References LogDebug.

                                     {
  LogDebug("HCalGeom") <<"DDHCalFibreBundle info: Creating an instance";
}
DDHCalFibreBundle::~DDHCalFibreBundle ( ) [virtual]

Definition at line 23 of file DDHCalFibreBundle.cc.

{}

Member Function Documentation

void DDHCalFibreBundle::execute ( DDCompactView cpv)

Definition at line 64 of file DDHCalFibreBundle.cc.

References areaSection, bundle, childPrefix, DDSolidFactory::cons(), filterCSVwithJSON::copy, funct::cos(), dbl_to_string(), DDrot(), DDSplit(), deltaPhi, deltaZ, dPhi(), first, i, idNameSpace, funct::log(), material, mergeVDriftHistosByStation::name, numberPhi, dbtoconf::parent, phi, DDCompactView::position(), rEnd, rStart, edm::second(), and tilt.

                                                  {

  DDName mother = parent().name();
  DDName matname(DDSplit(material).first, DDSplit(material).second);
  DDMaterial matter(matname);

  // Create the rotation matrices
  double dPhi = deltaPhi/numberPhi;
  std::vector<DDRotation> rotation;
  for (int i=0; i<numberPhi; ++i) {
    double phi    = -0.5*deltaPhi+(i+0.5)*dPhi;
    double phideg = phi/CLHEP::deg;
    std::string rotstr = "R0"+ dbl_to_string(phideg);
    DDRotation  rot = DDRotation(DDName(rotstr, idNameSpace));
    if (!rot) {
      edm::LogInfo("HCalGeom") << "DDHCalFibreBundle test: Creating a new "
                           << "rotation " << rotstr << "\t" << 90 << ","
                           << phideg << ","  << 90 << "," << (phideg+90)
                           << ", 0, 0";
      rot = DDrot(DDName(rotstr, idNameSpace), 90*CLHEP::deg, phi, 
                  90*CLHEP::deg, (90*CLHEP::deg+phi), 0,  0);
    }
    rotation.push_back(rot);
  }

  // Create the solids and logical parts
  std::vector<DDLogicalPart> logs;
  for (unsigned int i=0; i<areaSection.size(); ++i) {
    double r0     = rEnd[i]/std::cos(tilt);
    double dStart = areaSection[i]/(2*dPhi*rStart[i]);
    double dEnd   = areaSection[i]/(2*dPhi*r0);
    std::string name = childPrefix + dbl_to_string(i);
    DDSolid solid = DDSolidFactory::cons(DDName(name, idNameSpace), 0.5*deltaZ,
                                         rStart[i]-dStart, rStart[i]+dStart,
                                         r0-dEnd, r0+dEnd, -0.5*dPhi, dPhi);
    edm::LogInfo("HCalGeom") << "DDHCalFibreBundle test: Creating a new solid "
                         << name << " a cons with dZ " << deltaZ << " rStart "
                         << rStart[i]-dStart << ":"  << rStart[i]+dStart
                         << " rEnd " << r0-dEnd << ":" << r0+dEnd << " Phi " 
                         << -0.5*dPhi/CLHEP::deg << ":" << 0.5*dPhi/CLHEP::deg;
    DDLogicalPart log(DDName(name, idNameSpace), matter, solid);
    logs.push_back(log);
  }

  // Now posiiton them
  int    copy = 0;
  int    nY   = (int)(bundle.size())/numberPhi;
  for (unsigned int i=0; i<bundle.size(); i++) {
    DDTranslation tran(0,0,0);
    int ir = (int)(i)/nY;
    if (ir >= numberPhi) ir = numberPhi-1;
    int ib = bundle[i];
    copy++;
    if (ib>=0 && ib<(int)(logs.size())) {
      cpv.position(logs[ib], mother, copy, tran, rotation[ir]);
      edm::LogInfo("HCalGeom") << "DDHCalFibreBundle test: " << logs[ib].name() 
                           << " number " << copy << " positioned in "
                           << mother << " at " << tran << " with " 
                           << rotation[ir];
    }
  }
}
void DDHCalFibreBundle::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)

Definition at line 25 of file DDHCalFibreBundle.cc.

References areaSection, bundle, childPrefix, dbl_to_int(), deltaPhi, deltaZ, i, idNameSpace, material, DDCurrentNamespace::ns(), numberPhi, dbtoconf::parent, rEnd, rStart, and tilt.

                                                                     {

  deltaPhi    = nArgs["DeltaPhi"];
  deltaZ      = nArgs["DeltaZ"];
  numberPhi   = int(nArgs["NumberPhi"]);
  material    = sArgs["Material"];
  areaSection = vArgs["AreaSection"];
  rStart      = vArgs["RadiusStart"];
  rEnd        = vArgs["RadiusEnd"];
  bundle      = dbl_to_int(vArgs["Bundles"]);
  tilt        = nArgs["TiltAngle"];
  
  idNameSpace = DDCurrentNamespace::ns();
  childPrefix = sArgs["Child"]; 
  DDName parentName = parent().name();
  edm::LogInfo("HCalGeom") << "DDHCalFibreBundle debug: Parent " << parentName
                       << " with " << bundle.size() << " children with prefix "
                       << childPrefix << ", material " << material << " with "
                       << numberPhi << " bundles along phi; width of mother "
                       << deltaZ << " along Z, " << deltaPhi/CLHEP::deg 
                       << " along phi and with " << rStart.size()
                       << " different bundle types";
  for (unsigned int i=0; i<areaSection.size(); ++i) 
    edm::LogInfo("HCalGeom") << "DDHCalFibreBundle debug: Child[" << i << "] Area "
                         << areaSection[i] << " R at Start " << rStart[i]
                         << " R at End " << rEnd[i];
  edm::LogInfo("HCalGeom") << "DDHCalFibreBundle debug: NameSpace " 
                           << idNameSpace << " Tilt Angle " << tilt/CLHEP::deg
                           << " Bundle type at different positions";
  for (unsigned int i=0; i<bundle.size(); ++i) {
    edm::LogInfo("HCalGeom") << "DDHCalFibreBundle debug: Position[" << i << "] "
                         << " with Type " << bundle[i];
  }
}

Member Data Documentation

std::vector<double> DDHCalFibreBundle::areaSection [private]

Definition at line 34 of file DDHCalFibreBundle.h.

Referenced by execute(), and initialize().

std::vector<int> DDHCalFibreBundle::bundle [private]

Definition at line 37 of file DDHCalFibreBundle.h.

Referenced by execute(), and initialize().

std::string DDHCalFibreBundle::childPrefix [private]

Definition at line 28 of file DDHCalFibreBundle.h.

Referenced by execute(), and initialize().

double DDHCalFibreBundle::deltaPhi [private]

Definition at line 31 of file DDHCalFibreBundle.h.

Referenced by execute(), and initialize().

double DDHCalFibreBundle::deltaZ [private]

Definition at line 30 of file DDHCalFibreBundle.h.

Referenced by execute(), and initialize().

std::string DDHCalFibreBundle::idNameSpace [private]

Definition at line 27 of file DDHCalFibreBundle.h.

Referenced by execute(), and initialize().

std::string DDHCalFibreBundle::material [private]

Definition at line 29 of file DDHCalFibreBundle.h.

Referenced by execute(), and initialize().

Definition at line 32 of file DDHCalFibreBundle.h.

Referenced by execute(), and initialize().

std::vector<double> DDHCalFibreBundle::rEnd [private]

Definition at line 36 of file DDHCalFibreBundle.h.

Referenced by execute(), and initialize().

std::vector<double> DDHCalFibreBundle::rStart [private]

Definition at line 35 of file DDHCalFibreBundle.h.

Referenced by execute(), and initialize().

double DDHCalFibreBundle::tilt [private]

Definition at line 33 of file DDHCalFibreBundle.h.

Referenced by execute(), and initialize().