Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 10:00:37

0001 /***********************************************************************************\
0002 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
0003 *                                                                                   *
0004 * This software is distributed under the terms of the Apache version 2 licence,     *
0005 * copied verbatim in the file "LICENSE".                                            *
0006 *                                                                                   *
0007 * In applying this licence, CERN does not waive the privileges and immunities       *
0008 * granted to it by virtue of its status as an Intergovernmental Organization        *
0009 * or submit itself to any jurisdiction.                                             *
0010 \***********************************************************************************/
0011 #ifndef GAUDIKERNEL_VCTPARSERS_H
0012 #define GAUDIKERNEL_VCTPARSERS_H 1
0013 // ============================================================================
0014 // Include files
0015 // ============================================================================
0016 // STD & STL
0017 // ============================================================================
0018 #include <map>
0019 #include <string>
0020 #include <vector>
0021 // ============================================================================
0022 #include "GaudiKernel/Point3DTypes.h"
0023 #include "GaudiKernel/Point4DTypes.h"
0024 #include "GaudiKernel/StatusCode.h"
0025 #include "GaudiKernel/Vector3DTypes.h"
0026 #include "GaudiKernel/Vector4DTypes.h"
0027 // ============================================================================
0028 /** @file
0029  *  Declaration of parsing functions for various ROOT::Math objects to allow
0030  *  their usage as properties for Gaudi components
0031  *
0032  *  @attention: this file must be included BEFORE any direct or indirect
0033  *              inclusion of GaudiKernel/ToStream.h
0034  *
0035  *  @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl
0036  *  @date 2009-09-05
0037  */
0038 // ============================================================================
0039 namespace Gaudi {
0040   // ==========================================================================
0041   namespace Parsers {
0042     // ========================================================================
0043     /** parse 3D-point
0044      *
0045      *  Valid representations of 3D-point:
0046      *
0047      *      - a'la python tuple with 3 elements ("canonical")
0048      *      - a'la python list with 3 elements
0049      *      - tuple or list with named ordered fields
0050      *
0051      *  @code
0052      *
0053      *    " (1,2,3) "
0054      *    " [1,2,3] "
0055      *    " [ x : 1, 2, Z:3 ] "
0056      *    " [ pX : 1 , PY : 2, 3] "
0057      *
0058      *  @endcode
0059      *
0060      *  Valid keys for names fields:
0061      *
0062      *  @code
0063      *
0064      *    "x", "X" , "pX" , "Px" , "PX "
0065      *    "y", "Y" , "pY" , "Py" , "PY "
0066      *    "z", "Z" , "pZ" , "Pz" , "PZ "
0067      *
0068      *  @endcode
0069      *
0070      *  @attention Named fields must be ordered <code>(x,y,z)</code>
0071      *
0072      *  @param result (output) the parsed point
0073      *  @param input  (input)  the input string
0074      *  @return status code
0075      *  @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl
0076      *  @date 2009-09-05
0077      */
0078     GAUDI_API StatusCode parse( Gaudi::XYZPoint& result, const std::string& input );
0079     // ========================================================================
0080     /** parse 3D-vector
0081      *
0082      *  Valid representations of 3D-vector:
0083      *
0084      *      - a'la python tuple with 3 elements ("canonical")
0085      *      - a'la python list with 3 elements
0086      *      - tuple or list with named ordered fields
0087      *
0088      *  @code
0089      *
0090      *    " (1,2,3) "
0091      *    " [1,2,3] "
0092      *    " [ x : 1, 2, Z:3 ] "
0093      *    " [ pX : 1 , PY : 2, 3] "
0094      *
0095      *  @endcode
0096      *
0097      *  Valid keys for names fields:
0098      *
0099      *  @code
0100      *
0101      *    "x", "X" , "pX" , "Px" , "PX "
0102      *    "y", "Y" , "pY" , "Py" , "PY "
0103      *    "z", "Z" , "pZ" , "Pz" , "PZ "
0104      *
0105      *  @endcode
0106      *
0107      *  @attention Named fields must be ordered <code>(x,y,z)</code>
0108      *
0109      *  @param result (output) the parsed vector
0110      *  @param input  (input)  the input string
0111      *  @return status code
0112      *  @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl
0113      *  @date 2009-09-05
0114      */
0115     GAUDI_API StatusCode parse( Gaudi::XYZVector& result, const std::string& input );
0116     // ========================================================================
0117     /** parse LorentzVector
0118      *
0119      *  Valid representations of Lorenzt vector
0120      *
0121      *      - a'la python tuple with 4 elements ("canonical")
0122      *      - a'la python list with 4 elements
0123      *      - python/list with inner representation of 3D-point/vector
0124      *      - tuple or list with named ordered fields
0125      *
0126      *  @code
0127      *
0128      *    " (1,2,3,4) "
0129      *    " (1,2,3;4) "
0130      *
0131      *    " [1,2,3,4] "
0132      *    " [1,2,3;4] "
0133      *
0134      *    " [ x:1 ,2,3; e= 4] "
0135      *    " [ pX : 1 , PY : 2, 3 , T= 4] "
0136      *
0137      *    " [ ( pX : 1 , PY : 2, 3 ) , 4] "
0138      *    " [ ( pX : 1 , PY : 2, 3 ) ; 4] "
0139      *
0140      *    " [ 4 , ( pX : 1 , PY : 2, 3 ) ] "
0141      *    " [ 4 ; ( pX : 1 , PY : 2, 3 ) ] "
0142      *
0143      *    " [ [ pX : 1 , PY : 2, 3 ] , 4] "
0144      *    " [ [ pX : 1 , PY : 2, 3 ] ; 4] "
0145      *
0146      *    " [ 4 , [ pX : 1 , PY : 2, 3 ] ] "
0147      *    " [ 4 ; [ pX : 1 , PY : 2, 3 ] ] "
0148      *
0149      *    " ( ( pX : 1 , PY : 2, 3 ) , 4 )"
0150      *    " ( ( pX : 1 , PY : 2, 3 ) ; 4 )"
0151      *
0152      *    " ( 4 , ( pX : 1 , PY : 2, 3 ) )"
0153      *    " ( 4 ; ( pX : 1 , PY : 2, 3 ) )"
0154      *
0155      *    " ( [ pX : 1 , PY : 2, 3 ] , 4 )"
0156      *    " ( [ pX : 1 , PY : 2, 3 ] ; 4 )"
0157      *
0158      *    " ( 4 , [ pX : 1 , PY : 2, 3 ] )"
0159      *    " ( 4 ; [ pX : 1 , PY : 2, 3 ] )"
0160      *
0161      *
0162      *  @endcode
0163      *
0164      *  Note that "eenrgy" element can be separated with semicolumn.
0165      *
0166      *  Valid keys for names fields:
0167      *
0168      *  @code
0169      *
0170      *    "x", "X" , "pX" , "Px" , "PX "
0171      *    "y", "Y" , "pY" , "Py" , "PY "
0172      *    "z", "Z" , "pZ" , "Pz" , "PZ "
0173      *    "t", "T" , "e"  , "E"
0174      *
0175      *  @endcode
0176      *
0177      *  @attention Named fields must be ordered <code>(x,y,z)</code>
0178      *
0179      *  @param result (output) the parsed lorentz vector
0180      *  @param input  (input)  the input string
0181      *  @return status code
0182      *  @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl
0183      *  @date 2009-09-05
0184      */
0185     GAUDI_API StatusCode parse( Gaudi::LorentzVector& result, const std::string& input );
0186     // ========================================================================
0187     /** parse the vector of points
0188      *  @param resut (OUTPUT) the parser vector
0189      *  @param input (INPIUT) the string to be parsed
0190      *  @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl
0191      *  @date 2009-09-05
0192      */
0193     GAUDI_API StatusCode parse( std::vector<Gaudi::XYZPoint>& result, const std::string& input );
0194     // ========================================================================
0195     /** parse the vector of vectors
0196      *  @param resut (OUTPUT) the parser vector
0197      *  @param input (INPIUT) the string to be parsed
0198      *  @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl
0199      *  @date 2009-09-05
0200      */
0201     GAUDI_API StatusCode parse( std::vector<Gaudi::XYZVector>& result, const std::string& input );
0202     // ========================================================================
0203     /** parse the vector of vectors
0204      *  @param resut (OUTPUT) the parser vector
0205      *  @param input (INPIUT) the string to be parsed
0206      *  @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl
0207      *  @date 2009-09-05
0208      */
0209     GAUDI_API StatusCode parse( std::vector<Gaudi::LorentzVector>& result, const std::string& input );
0210     // ========================================================================
0211   } // namespace Parsers
0212   // ==========================================================================
0213 } //                                                     end of namespace Gaudi
0214 // ============================================================================
0215 namespace Gaudi {
0216   // =========================================================================
0217   namespace Utils {
0218     // ========================================================================
0219     /// print XYZ point
0220     GAUDI_API std::ostream& toStream( const Gaudi::XYZPoint& obj, std::ostream& s );
0221     /// print XYZ vector
0222     GAUDI_API std::ostream& toStream( const Gaudi::XYZVector& obj, std::ostream& s );
0223     /// print Lorentz vector
0224     GAUDI_API std::ostream& toStream( const Gaudi::LorentzVector& obj, std::ostream& s );
0225     // ========================================================================
0226   } // namespace Utils
0227   // ==========================================================================
0228 } // end of namespace Gaudi
0229 // ============================================================================
0230 // The END
0231 // ============================================================================
0232 #endif // GAUDIKERNEL_VCTPARSERS_H