9 #define UC(val, category) UnitConverter(val, category).ucstring() 63 for (
auto ite = optolist.begin(); ite != optolist.end(); ite++) {
64 if ((*ite)->type() ==
"system")
82 for (
auto ite = optolist.begin(); ite != optolist.end(); ite++) {
83 bool alreadyWritten =
false;
84 for (
auto ite2 = optolist.begin(); ite2 != ite; ite2++) {
85 if ((*ite)->shortName() == (*ite2)->shortName()) {
86 alreadyWritten =
true;
89 std::cout <<
" CocoaToDDLMgr::writeSolids() " << alreadyWritten << *ite;
103 for (
auto ite = optolist.begin(); ite != optolist.end(); ite++) {
104 bool alreadyWritten =
false;
105 for (
auto ite2 = optolist.begin(); ite2 != ite; ite2++) {
106 if ((*ite)->shortName() == (*ite2)->shortName()) {
107 alreadyWritten =
true;
122 for (
auto ite = optolist.begin(); ite != optolist.end(); ite++) {
123 if ((*ite)->type() ==
"system")
134 std::vector<CLHEP::HepRotation>::const_iterator ite;
149 for (
auto ite = optolist.begin(); ite != optolist.end(); ite++) {
150 if ((*ite)->type() ==
"system")
169 file_ <<
"<?xml version=\"1.0\"?>" << std::endl;
172 file_ <<
"<DDDefinition xmlns=\"http://www.cern.ch/cms/DDL\"" 173 <<
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" 174 <<
" xsi:schemaLocation=\"http://www.cern.ch/cms/DDL ../../DDLSchema/DDLSchema.xsd\">" << std::endl
178 cout <<
"part-pre:" << name << std::endl;
184 file_ << std::endl <<
"</DDDefinition>" << std::endl;
192 std::cout <<
" sect-mat-pre:" << name <<
'-' << std::endl;
208 file_ <<
" <ElementaryMaterial";
216 file_ <<
" density=\"" <<
UC(density,
"Volumic Mass") <<
"\"";
220 file_ <<
" atomicWeight=\"" << (ma->
getA()) <<
"*g/mole\"" 221 <<
" atomicNumber=\"" << ma->
getZ() <<
"\"" 222 <<
"/>" << std::endl;
228 cout <<
" sect-mat-post:" << name <<
'-' << std::endl;
237 cout <<
" sect-so-pre:" << name <<
'-' << std::endl;
244 std::cout <<
" CocoaToDDLMgr::so( " << opto;
245 std::cout <<
" " << opto->shortName() << std::endl;
249 if (opto->type() ==
"system") {
251 file_ <<
" <Box name=\"" << opto->
name() <<
"\"";
252 file_ <<
" dx=\"10.*m" 255 <<
"\"/>" << std::endl;
261 std::cout <<
" CocoaToDDLMgr::so( so " << so << std::endl;
264 if (solidType ==
"Box") {
265 file_ <<
" <" << solidType <<
" name=\"" << name <<
"\"";
269 }
else if (solidType ==
"Tubs") {
271 file_ <<
" <" << solidType <<
" name=\"" << name <<
"\"" 277 <<
"/>" << std::endl;
400 std::cerr <<
" <!-- NOT HANDLED: " << solidType <<
" name=\"" << name <<
"\"" 402 <<
" </" << solidType <<
"> -->" << std::endl;
410 cout <<
" sect-so-post:" << name <<
'-' << std::endl;
419 cout <<
" sect-lv-pre:" << name <<
'-' << std::endl;
430 if (opto->
type() ==
"system") {
431 file_ <<
" <LogicalPart name=\"" << name <<
"\" category=\"" << sensitive <<
"\">" << std::endl
432 <<
" <rSolid name=\"" << rSolid <<
"\"/>" << std::endl
433 <<
" <rMaterial name=\"Hydrogen\"" 435 <<
" </LogicalPart>" << std::endl;
440 cout <<
"xml:lv " << opto->
name() << std::endl;
442 file_ <<
" <LogicalPart name=\"" << name <<
"\" category=\"" << sensitive <<
"\">" << std::endl
443 <<
" <rSolid name=\"" << rSolid <<
"\"/>" << std::endl
446 <<
" </LogicalPart>" << std::endl;
452 cout <<
" sect-lv-post:" << name <<
'-' << std::endl;
461 cout <<
" sect-pv-pre:" << name <<
'-' << std::endl;
473 file_ <<
" <PosPart copyNumber=\"" 475 <<
"\">" << std::endl;
476 file_ <<
" <rParent name=\"";
482 file_ <<
" <rChild name=\"";
485 file_ <<
"\"/>" << std::endl;
491 file_ <<
" <rRotation name=\"R" << rotNumber <<
"\"/>" << std::endl;
494 if (t != CLHEP::Hep3Vector()) {
497 file_ <<
" <Translation x=\"" <<
UC(t[0],
"Length") <<
"\"" 498 <<
" y=\"" <<
UC(t[1],
"Length") <<
"\"" 499 <<
" z=\"" <<
UC(t[2],
"Length") <<
"\" />" << std::endl;
502 file_ <<
" </PosPart>" << std::endl;
508 cout <<
" sect-pv-post:" << name <<
'-' << std::endl;
520 CLHEP::HepRotation roinv = inverseOf(ro);
526 identity = roinv.isIdentity();
530 file_ << tag << n <<
"\"";
531 file_ <<
" phiX=\"" <<
UC(roinv.phiX(),
"Angle") <<
"\"" 532 <<
" thetaX=\"" <<
UC(roinv.thetaX(),
"Angle") <<
"\"" 533 <<
" phiY=\"" <<
UC(roinv.phiY(),
"Angle") <<
"\"" 534 <<
" thetaY=\"" <<
UC(roinv.thetaY(),
"Angle") <<
"\"" 535 <<
" phiZ=\"" <<
UC(roinv.phiZ(),
"Angle") <<
"\"" 536 <<
" thetaZ=\"" <<
UC(roinv.thetaZ(),
"Angle")
539 <<
" />" << std::endl;
550 cout <<
" sect-lv-pre:" << name <<
'-' << std::endl;
553 file_ <<
"<SpecParSection label=\"" <<
filename_ <<
"\" eval=\"true\">" << std::endl;
558 file_ <<
" <SpecPar name=\"" << opto->
name() <<
"_PARAMS\">" << std::endl;
559 file_ <<
" <PartSelector path=\"/" << opto->
name() <<
"\"/> " << std::endl;
560 file_ <<
" <Parameter name=\"cocoa_type\"" 561 <<
" value=\"" << opto->
type() <<
"\" eval=\"false\" /> " << std::endl;
562 file_ <<
" <Parameter name=\"cmssw_ID\"" 563 <<
" value=\"" << opto->
getCmsswID() <<
"\" /> " << std::endl;
566 for (
int ii = 3;
ii < 6;
ii++) {
570 file_ <<
"\" /> " << std::endl;
572 for (
int ii = 0;
ii < 6;
ii++) {
580 file_ <<
"\" /> " << std::endl;
582 <<
"\" /> " << std::endl;
588 file_ <<
" <Parameter name=\"extra_entry\" value=\"" << ent->
name() <<
"\" eval=\"false\" /> " << std::endl;
589 file_ <<
" <Parameter name=\"dimType\" value=\"" << ent->
type() <<
"\" eval=\"false\" /> " << std::endl;
590 file_ <<
" <Parameter name=\"value\" value=\"";
591 if (ent->
type() ==
"nodim") {
593 }
else if (ent->
type() ==
"length") {
595 }
else if (ent->
type() ==
"angle") {
598 file_ <<
"\" eval=\"true\" /> " << std::endl;
600 file_ <<
" <Parameter name=\"sigma\" value=\"";
601 if (ent->
type() ==
"nodim") {
603 }
else if (ent->
type() ==
"length") {
605 }
else if (ent->
type() ==
"angle") {
608 file_ <<
"\" eval=\"true\" /> " << std::endl;
610 file_ <<
" <Parameter name=\"quality\" value=\"" << ent->
quality() <<
"\" eval=\"true\" /> " << std::endl;
613 file_ <<
" </SpecPar>" << std::endl;
619 std::vector<Measurement*>::iterator mite;
620 std::vector<ALIstring>::iterator site;
621 std::multimap<OpticalObject*, Measurement*> optoMeasMap;
622 for (mite = measlist.begin(); mite != measlist.end(); ++mite) {
623 auto& optolist = (*mite)->OptOList();
628 typedef std::multimap<OpticalObject*, Measurement*>::const_iterator itemom;
630 std::pair<itemom, itemom> omitep;
631 itemom omite2, omite3;
633 for (omite = optoMeasMap.begin(); omite != optoMeasMap.end(); ++omite) {
634 omitep = optoMeasMap.equal_range((*omite).first);
635 if (omite != optoMeasMap.begin() && (*omite).first == (*omite3).first)
638 for (omite2 = omitep.first; omite2 != omitep.second; ++omite2) {
642 if (omite2 == omitep.first) {
643 file_ <<
" <SpecPar name=\"" << meas->
name() <<
"_MEASUREMENT\">" << std::endl;
644 file_ <<
" <PartSelector path=\"/" << opto->
name() <<
"\"/> " << std::endl;
648 <<
"\" eval=\"false\" /> " << std::endl;
650 <<
"\" eval=\"false\" /> " << std::endl;
651 for (site = namelist.begin(); site != namelist.end(); ++site) {
652 file_ <<
" <Parameter name=\"" <<
std::string(
"meas_object_name_") + meas->
name() <<
"\" value=\"" << (*site)
653 <<
"\" eval=\"false\" /> " << std::endl;
656 file_ <<
" <Parameter name=\"" <<
std::string(
"meas_value_name_") + meas->
name() <<
"\" value=\"" 657 << meas->
valueType(
ii) <<
"\" eval=\"false\" /> " << std::endl;
659 << meas->
value(
ii) <<
"\" eval=\"true\" /> " << std::endl;
661 << meas->
sigma(
ii) <<
"\" eval=\"true\" /> " << std::endl;
662 file_ <<
" <Parameter name=\"" <<
std::string(
"meas_is_simulated_value_") + meas->
name() <<
"\" value=\"" 666 file_ <<
" </SpecPar>" << std::endl;
672 file_ <<
"<!-- Define volumes as COCOA objects --> " << std::endl <<
" <SpecPar name=\"COCOA\"> " << std::endl;
675 for (
auto ite = optolist.begin(); ite != optolist.end(); ite++) {
676 if ((*ite)->type() ==
"system")
678 file_ <<
" <PartSelector path=\"/" << (*ite)->
name() <<
"\"/> " << std::endl;
681 file_ <<
" <String name=\"COCOA\" value=\"COCOA\"/> " << std::endl <<
" </SpecPar> " << std::endl;
691 file_ <<
"<" << type <<
" label=\"" << name <<
"\">" << std::endl;
700 std::vector<CocoaMaterialElementary*>::const_iterator ite;
703 if (*(*ite) == *
ma) {
714 std::string::const_iterator ampat;
717 for (ampat = s.begin(); ampat != s.end(); ++ampat) {
720 else if (*ampat ==
'/')
722 else if (*ampat ==
':')
744 if (opto->
rmLocal().isIdentity())
747 std::vector<CLHEP::HepRotation>::const_iterator ite;
751 if ((*ite) == opto->
rmLocal()) {
ALIfloat getOuterRadius() const
void specPar(OpticalObject *opto)
const ALIuint getCmsswID() const
void newSectPost_pv(std::string name)
void newSectPre_so(std::string name)
void pv(OpticalObject *opto)
void newSectPost_ro(std::string name)
CocoaMaterialElementary * getMaterial() const
const ALIstring & type() const
void newSectPost_so(std::string name)
void newSectPre_lv(std::string name)
void writeLogicalVolumes()
bool valueIsSimulated(ALIint coor)
const ALIuint dim() const
ret
prodAgent to be discontinued
const ALIstring valueType(ALIuint ii) const
const CLHEP::HepRotation rmLocal() const
ALIbool materialIsRepeated(CocoaMaterialElementary *ma)
void writeHeader(ALIstring filename)
static std::vector< OpticalObject * > & OptOList()
ALIstring getSymbol() const
void newSectPre(std::string name, std::string type)
void newPartPost(std::string name, std::string extension)
void newPartPre(std::string name)
ALIfloat getStartPhiAngle() const
void writeSpecParsCocoa()
ALIstring getType() const
const std::vector< Entry * > & CoordinateEntryList() const
ALIstring getName() const
void newSectPre_ma(std::string name)
ALIfloat getZHalfLength() const
void writeDDDFile(ALIstring filename)
void lv(OpticalObject *opto)
void writePhysicalVolumes()
static CocoaToDDLMgr * instance
void measurementsAsSpecPars()
Container::value_type value_type
const CLHEP::Hep3Vector centreLocal() const
ALIfloat getDeltaPhiAngle() const
const ALIdouble * sigma() const
#define UC(val, category)
const OpticalObject * parent() const
const std::vector< ALIstring > & OptONameList() const
std::vector< CocoaMaterialElementary * > theMaterialList
ALIfloat getYHalfLength() const
void newSectPre_pv(std::string name)
ALIfloat getInnerRadius() const
static CocoaToDDLMgr * getInstance()
std::string scrubString(const std::string &s)
std::vector< CLHEP::HepRotation > theRotationList
ALIfloat getXHalfLength() const
void newSectPost_specPar(std::string name)
const ALIstring & name() const
void ma(CocoaMaterialElementary *ma)
void ro(const CLHEP::HepRotation &ro, int n)
void so(OpticalObject *opto)
const ALIdouble * value() const
const ALIstring shortName() const
const ALIstring & type() const
ALIint buildRotationNumber(OpticalObject *opto)
void newSectPre_specPar(std::string name)
const ALIstring & name() const
const ALIstring & name() const
void newSectPost_ma(std::string name)
static std::vector< Measurement * > & MeasurementList()
void newSectPost(std::string name)
void newSectPre_ro(std::string name)
const std::vector< Entry * > & ExtraEntryList() const
ALIfloat getZHalfLength() const
void newSectPost_lv(std::string name)
const ALIstring & type() const