9 #define UC(val,category) UnitConverter(val,category).ucstring()
73 static std::vector< OpticalObject* >::const_iterator ite;
74 for(ite = optolist.begin(); ite != optolist.end(); ite++ ){
75 if( (*ite)->type() ==
"system" )
continue;
92 static std::vector< OpticalObject* >::const_iterator ite,ite2;
93 for(ite = optolist.begin(); ite != optolist.end(); ite++ ){
94 bool alreadyWritten =
false;
95 for(ite2 = optolist.begin(); ite2 != ite; ite2++ ){
96 if( (*ite)->shortName() == (*ite2)->shortName() ) {
97 alreadyWritten =
true;
100 std::cout <<
" CocoaToDDLMgr::writeSolids() " << alreadyWritten << *ite;
101 std::cout << (*ite)->name() << std::endl;
102 if( !alreadyWritten )
so( *ite );
115 static std::vector< OpticalObject* >::const_iterator ite,ite2;
116 for(ite = optolist.begin(); ite != optolist.end(); ite++ ){
117 bool alreadyWritten =
false;
118 for(ite2 = optolist.begin(); ite2 != ite; ite2++ ){
119 if( (*ite)->shortName() == (*ite2)->shortName() ) {
120 alreadyWritten =
true;
123 if( !alreadyWritten )
lv( *ite );
136 static std::vector< OpticalObject* >::const_iterator ite;
137 for(ite = optolist.begin(); ite != optolist.end(); ite++ ){
138 if( (*ite)->type() ==
"system" )
continue;
151 std::vector<CLHEP::HepRotation>::const_iterator ite;
168 static std::vector< OpticalObject* >::const_iterator ite;
169 for(ite = optolist.begin(); ite != optolist.end(); ite++ ){
170 if( (*ite)->type() ==
"system" )
continue;
194 file_ <<
"<?xml version=\"1.0\"?>" << std::endl;
197 file_ <<
"<DDDefinition xmlns=\"http://www.cern.ch/cms/DDL\""
198 <<
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
199 <<
" xsi:schemaLocation=\"http://www.cern.ch/cms/DDL ../../DDLSchema/DDLSchema.xsd\">"
200 << std::endl << std::endl;
203 cout <<
"part-pre:" << name << std::endl;
210 file_ << std::endl <<
"</DDDefinition>" << std::endl;
220 std::cout <<
" sect-mat-pre:" << name <<
'-' << std::endl;
237 file_ <<
" <ElementaryMaterial";
245 file_ <<
" density=\"" <<
UC(density,
"Volumic Mass") <<
"\"";
250 file_ <<
" atomicWeight=\"" << (ma->
getA()) <<
"*g/mole\""
251 <<
" atomicNumber=\"" << ma->
getZ() <<
"\""
252 <<
"/>" << std::endl;
260 cout <<
" sect-mat-post:" << name <<
'-' << std::endl;
271 cout <<
" sect-so-pre:" << name <<
'-' << std::endl;
279 std::cout <<
" CocoaToDDLMgr::so( " << opto;
280 std::cout <<
" " << opto->shortName() << std::endl;
282 std::string
name = opto->shortName();
284 if( opto->type() ==
"system" ){
286 file_ <<
" <Box name=\"" << opto->
name() <<
"\"";
287 file_ <<
" dx=\"10.*m"
290 <<
"\"/>" << std::endl;
296 std::cout <<
" CocoaToDDLMgr::so( so " << so << std::endl;
297 std::string solidType = so->
getType();
299 if (solidType ==
"Box")
301 file_ <<
" <" << solidType <<
" name=\"" << name <<
"\"";
306 <<
"\"/>" << std::endl;
308 else if (solidType ==
"Tubs")
311 file_ <<
" <" << solidType
312 <<
" name=\"" << name <<
"\""
318 <<
"/>" << std::endl;
442 std::cerr <<
" <!-- NOT HANDLED: " << solidType <<
" name=\"" << name<<
"\""
444 <<
" </" << solidType <<
"> -->" << std::endl;
454 cout <<
" sect-so-post:" << name <<
'-' << std::endl;
465 cout <<
" sect-lv-pre:" << name <<
'-' << std::endl;
475 std::string sensitive =
"unspecified";
477 if( opto->
type() ==
"system" ){
478 file_ <<
" <LogicalPart name=\""
479 << name <<
"\" category=\"" << sensitive <<
"\">" << std::endl
480 <<
" <rSolid name=\"" << rSolid <<
"\"/>" << std::endl
481 <<
" <rMaterial name=\"Hydrogen\""
483 <<
" </LogicalPart>" << std::endl;
488 cout <<
"xml:lv " << opto->
name() << std::endl;
490 file_ <<
" <LogicalPart name=\""
491 << name <<
"\" category=\"" << sensitive <<
"\">" << std::endl
492 <<
" <rSolid name=\"" << rSolid <<
"\"/>" << std::endl
495 <<
" </LogicalPart>" << std::endl;
502 cout <<
" sect-lv-post:" << name <<
'-'<< std::endl;
513 cout <<
" sect-pv-pre:" << name <<
'-' << std::endl;
523 <<
':' << opto->
parent()->
name() << std::endl;
527 file_ <<
" <PosPart copyNumber=\"" <<
"1" <<
"\">" << std::endl;
528 file_ <<
" <rParent name=\"";
534 file_ <<
" <rChild name=\"";
537 file_ <<
"\"/>" << std::endl;
542 if( rotNumber != -1 )
file_ <<
" <rRotation name=\"R" << rotNumber <<
"\"/>" << std::endl;
545 if(t != CLHEP::Hep3Vector()) {
548 file_ <<
" <Translation x=\"" <<
UC(t[0],
"Length") <<
"\""
549 <<
" y=\"" <<
UC(t[1],
"Length") <<
"\""
550 <<
" z=\"" <<
UC(t[2],
"Length")<<
"\" />"
554 file_ <<
" </PosPart>" << std::endl;
562 cout <<
" sect-pv-post:" << name <<
'-' << std::endl;
580 CLHEP::HepRotation roinv = inverseOf(ro);
584 bool identity =
false;
586 identity=roinv.isIdentity();
590 file_ << tag << n <<
"\"";
591 file_ <<
" phiX=\"" <<
UC(roinv.phiX(),
"Angle") <<
"\""
592 <<
" thetaX=\"" <<
UC(roinv.thetaX(),
"Angle") <<
"\""
593 <<
" phiY=\"" <<
UC(roinv.phiY(),
"Angle") <<
"\""
594 <<
" thetaY=\"" <<
UC(roinv.thetaY(),
"Angle") <<
"\""
595 <<
" phiZ=\"" <<
UC(roinv.phiZ(),
"Angle") <<
"\""
596 <<
" thetaZ=\"" <<
UC(roinv.thetaZ(),
"Angle") <<
"\""
598 <<
" />" << std::endl;
614 cout <<
" sect-lv-pre:" << name <<
'-' << std::endl;
617 file_ <<
"<SpecParSection label=\"" <<
filename_ <<
"\" eval=\"true\">" << std::endl;
625 file_ <<
" <SpecPar name=\"" << opto->
name() <<
"_PARAMS\">" << std::endl;
626 file_ <<
" <PartSelector path=\"/" << opto->
name() <<
"\"/> " << std::endl;
627 file_ <<
" <Parameter name=\"cocoa_type\"" <<
" value=\"" << opto->
type() <<
"\" eval=\"false\" /> " << std::endl;
628 file_ <<
" <Parameter name=\"cmssw_ID\"" <<
" value=\"" << opto->
getCmsswID() <<
"\" /> " << std::endl;
631 for(
int ii=3; ii<6; ii++ ){
632 Entry* ent = coord[ii];
633 file_ <<
" <Parameter name=\"" << ent->
name()+std::string(
"_value") <<
"\" value=\"";
635 file_ <<
"\" /> " << std::endl;
637 for(
int ii=0; ii<6; ii++ ){
638 Entry* ent = coord[ii];
639 file_ <<
" <Parameter name=\"" << ent->
name()+std::string(
"_sigma") <<
"\" value=\"";
645 file_ <<
"\" /> " << std::endl;
646 file_ <<
" <Parameter name=\"" << ent->
name()+std::string(
"_quality") <<
"\" value=\"" << ent->
quality() <<
"\" /> " << std::endl;
650 for(
ALIuint ii=0; ii<extraEnt.size(); ii++ ){
651 Entry* ent = extraEnt[ii];
652 file_ <<
" <Parameter name=\"extra_entry\" value=\"" << ent->
name() <<
"\" eval=\"false\" /> " << std::endl;
653 file_ <<
" <Parameter name=\"dimType\" value=\"" << ent->
type() <<
"\" eval=\"false\" /> " << std::endl;
654 file_ <<
" <Parameter name=\"value\" value=\"";
655 if( ent->
type() ==
"nodim" ) {
657 }
else if( ent->
type() ==
"length" ) {
659 }
else if( ent->
type() ==
"angle" ) {
662 file_ <<
"\" eval=\"true\" /> " << std::endl;
664 file_ <<
" <Parameter name=\"sigma\" value=\"";
665 if( ent->
type() ==
"nodim" ) {
667 }
else if( ent->
type() ==
"length" ) {
669 }
else if( ent->
type() ==
"angle" ) {
672 file_ <<
"\" eval=\"true\" /> " << std::endl;
674 file_ <<
" <Parameter name=\"quality\" value=\"" << ent->
quality() <<
"\" eval=\"true\" /> " << std::endl;
677 file_ <<
" </SpecPar>" << std::endl;
686 std::vector< Measurement* >::iterator mite;
687 std::vector<ALIstring>::iterator site;
688 std::multimap<OpticalObject*,Measurement*> optoMeasMap;
689 for( mite = measlist.begin(); mite != measlist.end(); mite++ ) {
690 std::vector<OpticalObject*> optolist = (*mite)->OptOList();
695 typedef std::multimap<OpticalObject*,Measurement*>::const_iterator itemom;
697 std::pair<itemom, itemom > omitep;
698 itemom omite2, omite3;
700 for( omite = optoMeasMap.begin(); omite != optoMeasMap.end(); omite++ ){
701 omitep = optoMeasMap.equal_range( (*omite).first );
702 if( omite != optoMeasMap.begin() && (*omite).first == (*omite3).first )
continue;
704 for( omite2 = omitep.first; omite2 != omitep.second; omite2++ ){
708 if( omite2 == omitep.first ){
709 file_ <<
" <SpecPar name=\"" << meas->
name() <<
"_MEASUREMENT\">" << std::endl;
710 file_ <<
" <PartSelector path=\"/" << opto->
name() <<
"\"/> " << std::endl;
713 file_ <<
" <Parameter name=\"" << std::string(
"meas_name") <<
"\" value=\"" << meas->
name() <<
"\" eval=\"false\" /> " << std::endl;
714 file_ <<
" <Parameter name=\"" << std::string(
"meas_type") <<
"\" value=\"" << meas->
type() <<
"\" eval=\"false\" /> " << std::endl;
715 for( site = namelist.begin(); site != namelist.end(); site++ ){
716 file_ <<
" <Parameter name=\"" << std::string(
"meas_object_name_")+meas->
name() <<
"\" value=\"" << (*site) <<
"\" eval=\"false\" /> " << std::endl;
718 for(
ALIuint ii = 0; ii < meas->
dim(); ii++ ){
719 file_ <<
" <Parameter name=\"" << std::string(
"meas_value_name_")+meas->
name() <<
"\" value=\"" << meas->
valueType(ii) <<
"\" eval=\"false\" /> " << std::endl;
720 file_ <<
" <Parameter name=\"" << std::string(
"meas_value_")+meas->
name() <<
"\" value=\"" << meas->
value(ii) <<
"\" eval=\"true\" /> " << std::endl;
721 file_ <<
" <Parameter name=\"" << std::string(
"meas_sigma_")+meas->
name() <<
"\" value=\"" << meas->
sigma(ii) <<
"\" eval=\"true\" /> " << std::endl;
722 file_ <<
" <Parameter name=\"" << std::string(
"meas_is_simulated_value_")+meas->
name() <<
"\" value=\"" << meas->
valueIsSimulated(ii) <<
"\" eval=\"true\" /> " << std::endl;
726 file_ <<
" </SpecPar>" << std::endl;
734 file_ <<
"<!-- Define volumes as COCOA objects --> " << std::endl
735 <<
" <SpecPar name=\"COCOA\"> " << std::endl;
738 static std::vector< OpticalObject* >::const_iterator ite;
739 for(ite = optolist.begin(); ite != optolist.end(); ite++ ){
740 if( (*ite)->type() ==
"system" )
continue;
741 file_ <<
" <PartSelector path=\"/" << (*ite)->
name() <<
"\"/> " << std::endl;
744 file_ <<
" <String name=\"COCOA\" value=\"COCOA\"/> " << std::endl
745 <<
" </SpecPar> " << std::endl;
761 file_ <<
"<" << type <<
" label=\"" << name <<
"\">" << std::endl;
768 file_ <<
"</" << name <<
">" << std::endl << std::endl;
777 std::vector<CocoaMaterialElementary*>::const_iterator ite;
780 if( *(*ite) == *
ma ){
792 std::string::const_iterator ampat;
793 static const std::string amp =
"_";
794 std::string
ret =
"";
795 for (ampat = s.begin(); ampat != s.end(); ampat++)
799 else if (*ampat ==
'/')
801 else if (*ampat ==
':')
825 if(opto->
rmLocal().isIdentity() )
return rotnum;
827 std::vector<CLHEP::HepRotation>::const_iterator ite;
831 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
const std::vector< Entry * > & ExtraEntryList() const
const ALIstring valueType(ALIuint ii) const
const CLHEP::HepRotation rmLocal() const
ALIbool materialIsRepeated(CocoaMaterialElementary *ma)
void writeHeader(ALIstring filename)
ALIstring getSymbol() const
const std::vector< Entry * > & CoordinateEntryList() 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
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()
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
Container::value_type value_type
static CocoaToDDLMgr * getInstance()
std::string scrubString(const std::string &s)
std::vector< CLHEP::HepRotation > theRotationList
ALIfloat getXHalfLength() const
static std::vector< OpticalObject * > & OptOList()
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)
void newSectPost(std::string name)
void newSectPre_ro(std::string name)
static std::vector< Measurement * > & MeasurementList()
ALIfloat getZHalfLength() const
void newSectPost_lv(std::string name)
const ALIstring & type() const