CMS 3D CMS Logo

Functions

/data/refman/pasoursint/CMSSW_4_2_9_HLT1_bphpatch4/src/DetectorDescription/RegressionTest/src/build.h File Reference

#include <string>
#include <DetectorDescription/Core/interface/DDCompactView.h>

Go to the source code of this file.

Functions

void output (std::string filename)
void regressionTest_first ()
void regressionTest_forth ()
void regressionTest_second ()
void regressionTest_setup ()
void regressionTest_third ()
void testParser ()
void testrot ()

Function Documentation

void output ( std::string  filename)
void regressionTest_first ( )

load the new cpv

Definition at line 112 of file build.cc.

References AlgoInit(), DDSolidFactory::box(), gather_cfg::cout, DDrot(), ExprEvalInterface::eval(), DDI::Singleton< I >::instance(), DDCompactView::position(), submit::rm, and csvLumiCalc::unit.

                             {
  AlgoInit();
  DDCompactView cpv;
  cout << "main::initialize DDL parser" << endl;
  DDLParser myP(cpv);// = DDLParser::instance();
  
  cout << "main::about to set configuration" << endl;
  
  ExprEvalInterface & eval = ExprEval::instance();
  string ns("first");
  DDSolid support = DDSolidFactory::box(DDName("support",ns),
                                        eval.eval(ns,"[setup:corner]/4."),
                                        eval.eval(ns,"[setup:corner]/8."),
                                        eval.eval(ns,"[setup:corner]/4.")
                                        );
  DDSolid sensor = DDSolidFactory::box(DDName("sensor",ns),                        
                                       eval.eval(ns,"[setup:corner]/16."),
                                       eval.eval(ns,"[setup:corner]/16."),
                                       eval.eval(ns,"[setup:corner]/16.")
                                       );
  
  DDLogicalPart supportLP(DDName("support",ns),     // name
                          DDName("Oxygen","elements"), // material
                          DDName("support",ns));    // solid
  
  DDLogicalPart sensorLP(DDName("sensor",ns),
                         DDName("Nitrogen","elements"),
                         DDName("sensor",ns));  
  
  DDLogicalPart part(DDName("group",ns),
                     DDName("Air","setup"),
                     DDName("group","setup")    
                      );
  
  DDRotation r30(DDName("R30","setup"));
  DDRotation r60(DDName("R60","setup"));
  DDRotation r90(DDName("R90","setup"));
  DDRotation unit(DDName("Unit","setup"));
  DDTranslation t0;
  DDTranslation t1(eval.eval(ns,"[setup:corner]/8."),
                   eval.eval(ns,"[setup:corner]/16."),
                   eval.eval(ns,"[setup:corner]/8.")
                   );
  DDTranslation t2(eval.eval(ns,"[setup:corner]*1.25*cos(0.)"),
                   eval.eval(ns,"[setup:corner]*1.25*sin(0.)"),
                   eval.eval(ns,"0."));
  DDTranslation t3(eval.eval(ns,"[setup:corner]*1.25*cos(30.*deg)"),
                   eval.eval(ns,"[setup:corner]*1.25*sin(30.*deg)"),
                    eval.eval(ns,"0."));
  DDTranslation t4(eval.eval(ns,"[setup:corner]*1.25*cos(60.*deg)"),
                   eval.eval(ns,"[setup:corner]*1.25*sin(60.*deg)"),
                   eval.eval(ns,"0."));
  DDTranslation t5(eval.eval(ns,"[setup:corner]*1.25*cos(90.*deg)"),
                   eval.eval(ns,"[setup:corner]*1.25*sin(90.*deg)"),
                   eval.eval(ns,"0."));
  
  cpv.position(sensorLP, supportLP, std::string("1"), t1, unit);
  cpv.position(supportLP, part, std::string("1"), t2, unit);
  cpv.position(supportLP, part, std::string("2"), t3, r30);
  cpv.position(supportLP, part, std::string("3"), t4, r60);
  cpv.position(supportLP, part, std::string("4"), t5, r90);
   
  DDRotationMatrix * rm = new DDRotationMatrix(ROOT::Math::AxisAngle(DD3Vector(1.,1.,1.),20.*deg));
  DDRotation rw= DDrot(DDName("group", ns), rm);
  DDLogicalPart ws(DDName("world","setup"));
  cpv.position(part, ws, std::string("1"), t0, rw);
}
void regressionTest_forth ( )
void regressionTest_second ( )
void regressionTest_setup ( )

Definition at line 38 of file build.cc.

References DDMaterial::addMaterial(), DDSolidFactory::box(), gather_cfg::cout, DDrot(), ExprEvalInterface::eval(), DDI::Singleton< I >::instance(), ExprEvalInterface::set(), and DDSolidFactory::shapeless().

                            {
   ExprEvalInterface & eval = ExprEval::instance();
   
   string ns = "setup"; // current namespace faking the filename 'setup.xml'
   
   // length of a side of  world cube
   eval.set(ns,"length","20.*m"); 
   
   // center of a corner in the cube
   eval.set(ns,"corner","[length]/4.");
   
   // world-solid
   DDName worldName("world",ns);
   DDName airName("Air",ns);
   DDName nitrogenName("Nitrogen","elements");
   DDName oxygenName("Oxygen","elements");
   
   DDSolidFactory::box(worldName, eval.eval(ns,"[length]/2."),
                    eval.eval(ns,"[length]/2."),
                    eval.eval(ns,"[length]/2."));
   
   DDLogicalPart(worldName, // name
                 airName,   // material
                 worldName  // solid
                );

   DDMaterial air(airName,eval.eval(ns,"1.214*mg/cm3")); // mixture for Air
   air.addMaterial(DDMaterial(nitrogenName),eval.eval(ns,"0.75"));
   air.addMaterial(DDMaterial(oxygenName),eval.eval(ns,"0.25"));
   
   cout << air << endl;
   
   DDMaterial(nitrogenName,      // name
              eval.eval(ns,"7"), // Z
              eval.eval(ns,"14.007*g/mole"), // A
              eval.eval(ns,"0.808*g/cm3") ); // density
              
   DDMaterial(oxygenName,      // name
              eval.eval(ns,"8"), // Z
              eval.eval(ns,"15.999*g/mole"), // A
              eval.eval(ns,"1.43*g/cm3") ); // density

   cout << air << endl;   

   // Some rotations in the x-y plane (Unit, 30,60,90 degs)
   DDRotationMatrix * r0  = new DDRotationMatrix();
   DDRotationMatrix * r30 = new DDRotationMatrix(ROOT::Math::RotationZ(30.*deg));   
   DDRotationMatrix * r60 = new DDRotationMatrix(ROOT::Math::RotationZ(60.*deg));   
   DDRotationMatrix * r90 = new DDRotationMatrix(ROOT::Math::RotationZ(90.*deg));   
   
   DDrot(DDName("Unit",ns),r0);
   DDrot(DDName("R30",ns),r30);
   DDrot(DDName("R60",ns),r60);
   DDrot(DDName("R90",ns),r90);
   
   DDSolid collectorSolid = DDSolidFactory::shapeless(DDName("group",ns));
   
   DDRootDef::instance().set(worldName);              
}
void regressionTest_third ( )
void testParser ( )

Definition at line 226 of file build.cc.

References AlgoInit(), gather_cfg::cout, DDLParser::parse(), and FIPConfiguration::readConfig().

{
  try {
    cout << "main:: initialize" << endl;
    AlgoInit();
    DDCompactView cpv;
    cout << "main::initialize DDL parser" << endl;
    DDLParser myP(cpv);// = DDLParser::instance();

    cout << "main::about to set configuration" << endl;
    //    myP->SetConfig("configuration.xml");
    FIPConfiguration cf(cpv);
    cf.readConfig("DetectorDescription/RegressionTest/test/configuration.xml");

    cout << "main::about to start parsing" << endl;
 
    myP.parse(cf);

    cout << "main::completed Parser" << endl;
  
    cout << endl << endl << "main::Start checking!" << endl << endl;
  
  }
  catch (DDException& e)
    {
      cout << "main::PROBLEM:" << endl 
           << "         " << e << endl;
    }  
}
void testrot ( )

Definition at line 282 of file build.cc.

References gather_cfg::cout, printRot(), and submit::rm.

{
  //  ExprEvalInterface & eval = ExprEval::instance();
  {
    ROOT::Math::AxisAngle aa(DD3Vector(1.,1.,1.), 20.*deg);
    DDRotationMatrix rm(aa); 
    cout << "DD3Vector was " << DD3Vector(1.,1.,1.) << " and the rotation was 20*deg around that axis." << endl;
    printRot(rm);
  }
  {
    DDRotationMatrix rm(1,0,0, 0,-1,0, 0,0,1); 
    cout << "(1,0,0, 0,-1,0, 0,0,1)" << endl;
    printRot(rm);
  }
}