Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:13:37

0001 #ifndef PARSERS_DETAIL_CHILDVALUE_H
0002 #define PARSERS_DETAIL_CHILDVALUE_H
0003 
0004 //==========================================================================
0005 //  AIDA Detector description implementation 
0006 //--------------------------------------------------------------------------
0007 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0008 // All rights reserved.
0009 //
0010 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0011 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0012 //
0013 // Author     : M.Frank
0014 //
0015 //==========================================================================
0016 
0017 /** 
0018  *  Note: Do NEVER include this file directly!
0019  *
0020  *  Use the specific include files in the XML or JSON directory!
0021  *  Also NO header guards!
0022  */
0023 
0024 
0025 /// Namespace for the AIDA detector description toolkit
0026 namespace dd4hep {
0027 
0028   // Forward declarations
0029   class NamedObject;
0030 
0031   /// Namespace for the AIDA detector description toolkit supporting JSON utilities
0032   namespace DD4HEP_DIMENSION_NS {
0033 
0034     /// XML Handle_t to xml elements with predefined child access
0035     /**
0036      *  Helper class to access any field in a xml tag in a
0037      *  very easy way.
0038      *  - You may assign any xml handle to a childvalue object
0039      *  - Any child with the name and the value attribute set may then be accessed
0040      *    by its natural way. All possible child names are
0041      *    reflected by the object's member functions.
0042      *
0043      *    IMPORTANT NOTE:
0044      *    to be understood, the child elements MUST have structure like:
0045      *    <inner_r value="76*cm" ....other attributes...../>
0046      *    Other attributes may e.g. be a comment describing the variable.
0047      *    The 'other attributes' are ignored. The 'value' attribute
0048      *    is mandatory.
0049      *
0050      *  - If an child is requested and not present, a exception
0051      *    is thrown.
0052      *  - Functions, which accept a default value do NOT throw
0053      *    an exception if the child is not present. These
0054      *    rather return the default value.
0055      *  - If a often used function is not present - the
0056      *    implementation thereof is simple.
0057      *
0058      *  Such helper classes may be defined locally by any user
0059      *  since XML element handles may easily be transferred.
0060      *  Run-time exceptions occur however, if non-exiting child elements
0061      *  are accessed.
0062      *
0063      *  \author  M.Frank
0064      *  \version 1.0
0065      *  \ingroup DD4HEP_XML
0066      */
0067     struct ChildValue: public Element {
0068       /// Default constructor
0069       ChildValue()
0070         : Element(Handle_t(0)) {
0071       }
0072       /// Constructor from Handle_t
0073       ChildValue(Handle_t e)
0074         : Element(e) {
0075       }
0076       /// Constructor from Element
0077       ChildValue(const Element& e)
0078         : Element(e) {
0079       }
0080 
0081       /// Access parameters: id
0082       int id() const;
0083       /// Access parameters: id, if not present returns default
0084       int id(int default_value) const;
0085 
0086       /// Access parameters: type
0087       int type() const;
0088       /// Access rotation constants: combineHits
0089       bool combineHits() const;
0090 
0091       /// Access rotation constants: angle
0092       double angle() const;
0093       /// Access rotation constants: angle
0094       double alpha() const;
0095       /// Access rotation constants: angle
0096       double beta() const;
0097       /// Access rotation constants: angle
0098       double gamma() const;
0099       /// Access rotation constants: angle
0100       double delta() const;
0101       /// Access rotation constants: angle
0102       double epsilon() const;
0103       /// Access rotation constants: theta
0104       double theta() const;
0105       /// Access rotation constants: thetaBins
0106       int thetaBins() const;
0107 
0108       /// Access rotation constants: phi
0109       double phi() const;
0110       /// Access rotation constants: phiBins
0111       int phiBins() const;
0112       /// Access rotation constants: phi0
0113       double phi0() const;
0114       /// Access parameters: phi0, if not present returns default
0115       double phi0(double default_value) const;
0116       /// Access rotation constants: phi0_offset
0117       double phi0_offset() const;
0118       /// Access parameters: phi0_offset, if not present returns default
0119       double phi0_offset(double default_value) const;
0120       /// Access rotation constants: phi1
0121       double phi1() const;
0122       /// Access parameters: phi1, if not present returns default
0123       double phi1(double default_value) const;
0124       /// Access rotation constants: psi
0125       double psi() const;
0126 
0127       /// Access Tube parameters: zhalf
0128       double zhalf() const;
0129       /// Access Tube parameters: deltaphi
0130       double deltaphi() const;
0131 
0132       /// Access parameters: b
0133       double b() const;
0134       /// Access parameters: B
0135       double B() const;
0136       /// Access parameters: g
0137       double g() const;
0138       /// Access parameters: G
0139       double G() const;
0140 
0141       /// Access parameters: r
0142       double r() const;
0143       /// Access parameters: r, if not present returns default
0144       double r(double default_value) const;
0145       /// Access parameters: R
0146       double R() const;
0147       /// Access parameters: dr
0148       double dr() const;
0149       /// Access parameters: r0
0150       double r0() const;
0151       /// Access parameters: dr, if not present returns default
0152       double dr(double default_value) const;
0153       /// Access min/max parameters: rmin
0154       double rmin() const;
0155       /// Access min/max parameters: rmax
0156       double rmax() const;
0157       /// Access min/max parameters: rmin1
0158       double rmin1() const;
0159       /// Access min/max parameters: rmax1
0160       double rmax1() const;
0161       /// Access min/max parameters: rmin2
0162       double rmin2() const;
0163       /// Access min/max parameters: rmax2
0164       double rmax2() const;
0165       /// Access parameters: radius
0166       double radius() const;
0167       /// Access attribute values: distance
0168       double distance() const;
0169       /// Access attribute values: outer_radius
0170       double outer_radius() const;
0171       /// Access attribute values: outer_r
0172       double outer_r() const;
0173       /// Access attribute values: inner_radius
0174       double inner_radius() const;
0175       /// Access attribute values: inner_r
0176       double inner_r() const;
0177 
0178       /// Access parameters: x
0179       double x() const;
0180       /// Access parameters: x, if not present returns default
0181       double x(double default_val) const;
0182       /// Access parameters: X
0183       double X() const;
0184       /// Access parameters: x0
0185       double x0() const;
0186       /// Access parameters: x1
0187       double x1() const;
0188       /// Access parameters: x2
0189       double x2() const;
0190       /// Access parameters: dx
0191       double dx() const;
0192       /// Access parameters: dx, if not present returns default
0193       double dx(double default_value) const;
0194       /// Access min/max parameters: xmax
0195       double xmin() const;
0196       /// Access min/max parameters: xmax
0197       double xmax() const;
0198       /// Access min/max parameters: x_offset
0199       double x_offset() const;
0200       /// Access min/max parameters: dim_x
0201       double dim_x() const;
0202 
0203       /// Access parameters: y
0204       double y() const;
0205       /// Access parameters: y, if not present returns default
0206       double y(double default_val) const;
0207       /// Access parameters: Y
0208       double Y() const;
0209       /// Access parameters: y0
0210       double y0() const;
0211       /// Access parameters: y1
0212       double y1() const;
0213       /// Access parameters: y2
0214       double y2() const;
0215       /// Access parameters: dy
0216       double dy() const;
0217       /// Access parameters: dz, if not present returns default
0218       double dy(double default_value) const;
0219       /// Access min/max parameters: ymax
0220       double ymin() const;
0221       /// Access min/max parameters: ymax
0222       double ymax() const;
0223       /// Access min/max parameters: y_offset
0224       double y_offset() const;
0225       /// Access min/max parameters: dim_y
0226       double dim_y() const;
0227 
0228       /// Access parameters: z
0229       double z() const;
0230       /// Access parameters: z, if not present returns default
0231       double z(double default_val) const;
0232       /// Access parameters: Z
0233       double Z() const;
0234       /// Access parameters: z0
0235       double z0() const;
0236       /// Access parameters: z1
0237       double z1() const;
0238       /// Access parameters: z2
0239       double z2() const;
0240       /// Access parameters: dz
0241       double dz() const;
0242       /// Access parameters: dz, if not present returns default
0243       double dz(double default_value) const;
0244       /// Access min/max parameters: zmax
0245       double zmin() const;
0246       /// Access min/max parameters: zmax
0247       double zmax() const;
0248       /// Access attribute values: outer_z
0249       double outer_z() const;
0250       /// Access attribute values: inner_z
0251       double inner_z() const;
0252       /// Access min/max parameters: z_offset
0253       double z_offset() const;
0254       /// Access min/max parameters: dim_z
0255       double dim_z() const;
0256 
0257       /// Access attribute values: length
0258       double length() const;
0259       /// Access attribute values: width
0260       double width() const;
0261       /// Access attribute values: height
0262       double height() const;
0263       /// Access attribute values: depth
0264       double depth() const;
0265       /// Access attribute values: thickness
0266       double thickness() const;
0267 
0268       /// Access attribute values: z_length
0269       double z_length() const;
0270       /// Access attribute values: gap
0271       double gap() const;
0272       /// Access attribute values: r_size
0273       double r_size() const;
0274       /// Access attribute values: phi_size_max
0275       double phi_size_max() const;
0276       /// Access attribute values: reflect
0277       bool reflect() const;
0278       /// Access attribute values: reflect
0279       bool reflect(bool default_value) const;
0280       /// Access attribute values: crossing_angle
0281       double crossing_angle() const;
0282       /// Access attribute values: repeat
0283       int repeat() const;
0284 
0285       /// Access attribute values: outgoing_r
0286       double outgoing_r() const;
0287       /// Access attribute values: incoming_r
0288       double incoming_r() const;
0289       /// Access attribute values: offset
0290       double offset() const;
0291       /// Access attribute values: offset
0292       double offset(double default_value) const;
0293       /// Access attribute values: number
0294       int number() const;
0295 
0296       /// Access attribute values: nmodules
0297       int nmodules() const;
0298       /// Access attribute values: nModules
0299       int nModules() const;
0300       /// Access attribute values: RowID
0301       int RowID() const;
0302       /// Access attribute values: moduleHeight
0303       double moduleHeight() const;
0304       /// Access attribute values: moduleWidth
0305       double moduleWidth() const;
0306       /// Access attribute values: modulePitch
0307       double modulePitch() const;
0308       /// Access attribute values: modulePosX
0309       double modulePosX() const;
0310       /// Access attribute values: modulePosY
0311       double modulePosY() const;
0312 
0313       /// Access attribute values: nPads
0314       int nPads() const;
0315       /// Access attribute values: rowPitch
0316       double rowPitch() const;
0317       /// Access attribute values: padPitch
0318       double padPitch() const;
0319       /// Access attribute values: rowHeight
0320       double rowHeight() const;
0321       /// Access attribute values: padType
0322       std::string padType() const;
0323 
0324       /// Access attribute values: numsides
0325       int numsides() const;
0326       /// Access attribute values: nsides
0327       int nsides() const;
0328       /// Access attribute values: nsides_inner
0329       int nsides_inner() const;
0330       /// Access attribute values: nsides_outer
0331       int nsides_outer() const;
0332 
0333       /// Access attribute values: phi_tilt
0334       double phi_tilt() const;
0335       /// Access attribute values: nphi
0336       int nphi() const;
0337       /// Access attribute values: rc
0338       double rc() const;
0339 
0340       /// Access attribute values: zstart
0341       double zstart() const;
0342       /// Access attribute values: nz
0343       int nz() const;
0344 
0345       /// Access attribute values: start
0346       double start() const;
0347       /// Access attribute values: end
0348       double end() const;
0349       /// Access attribute values: inner_field
0350       double inner_field() const;
0351       /// Access attribute values: outer_field
0352       double outer_field() const;
0353 
0354       /// Access attribute values: visible
0355       bool visible() const;
0356       /// Access attribute values: show_daughters
0357       bool show_daughters() const;
0358 
0359       /// Access "name" attribute as STL string
0360       std::string nameStr() const;
0361       /// Access "ref" attribute as a string
0362       std::string refStr() const;
0363       /// Access "type" attribute as STL string
0364       std::string typeStr() const;
0365       /// Access "value" attribute as STL string
0366       std::string valueStr() const;
0367       /// Access "module" attribute as STL string
0368       std::string moduleStr() const;
0369       /// Access "readout" attribute as STL string
0370       std::string readoutStr() const;
0371       /// Access vis attribute as STL string. If not present empty return empty string
0372       std::string visStr() const;
0373       /// Access region attribute as STL string. If not present empty return empty string
0374       std::string regionStr() const;
0375       /// Access limits attribute as STL string. If not present empty return empty string
0376       std::string limitsStr() const;
0377     };
0378 
0379   }       /* End namespace DD4HEP_DIMENSION_NS       */
0380 }         /* End namespace dd4hep                    */
0381 
0382 #endif