Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/examples/advanced/ChargeExchangeMC/src/CexmcASTEval.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/advanced/ChargeExchangeMC/src/CexmcASTEval.cc (Version 11.3.0) and /examples/advanced/ChargeExchangeMC/src/CexmcASTEval.cc (Version 10.3.p1)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 /*                                                 26 /*
 27  * ===========================================     27  * =============================================================================
 28  *                                                 28  *
 29  *       Filename:  CexmcASTEval.cc                29  *       Filename:  CexmcASTEval.cc
 30  *                                                 30  *
 31  *    Description:  abstract syntax tree for c     31  *    Description:  abstract syntax tree for custom filter eval
 32  *                                                 32  *
 33  *        Version:  1.0                            33  *        Version:  1.0
 34  *        Created:  17.07.2010 15:46:01            34  *        Created:  17.07.2010 15:46:01
 35  *       Revision:  none                           35  *       Revision:  none
 36  *       Compiler:  gcc                            36  *       Compiler:  gcc
 37  *                                                 37  *
 38  *         Author:  Alexey Radkov (),              38  *         Author:  Alexey Radkov (), 
 39  *        Company:  PNPI                           39  *        Company:  PNPI
 40  *                                                 40  *
 41  * ===========================================     41  * =============================================================================
 42  */                                                42  */
 43                                                    43 
 44 #ifdef CEXMC_USE_CUSTOM_FILTER                     44 #ifdef CEXMC_USE_CUSTOM_FILTER
 45                                                    45 
 46 #include <numeric>                                 46 #include <numeric>
 47 #include <boost/variant/get.hpp>                   47 #include <boost/variant/get.hpp>
 48 #include <G4SystemOfUnits.hh>                      48 #include <G4SystemOfUnits.hh>
 49 #include "CexmcASTEval.hh"                         49 #include "CexmcASTEval.hh"
 50                                                    50 
 51                                                    51 
 52 namespace                                          52 namespace
 53 {                                                  53 {
 54     const std::string  CexmcCFVarEvent( "event     54     const std::string  CexmcCFVarEvent( "event" );
 55     const std::string  CexmcCFVarOpCosThetaSCM     55     const std::string  CexmcCFVarOpCosThetaSCM( "op_cosTh_SCM" );
 56     const std::string  CexmcCFVarEDT( "edt" );     56     const std::string  CexmcCFVarEDT( "edt" );
 57     const std::string  CexmcCFVarTPT( "tpt" );     57     const std::string  CexmcCFVarTPT( "tpt" );
 58     const std::string  CexmcCFVarMon( "mon" );     58     const std::string  CexmcCFVarMon( "mon" );
 59     const std::string  CexmcCFVarMonED( "monED     59     const std::string  CexmcCFVarMonED( "monED" );
 60     const std::string  CexmcCFVarVclED( "vclED     60     const std::string  CexmcCFVarVclED( "vclED" );
 61     const std::string  CexmcCFVarVcrED( "vcrED     61     const std::string  CexmcCFVarVcrED( "vcrED" );
 62     const std::string  CexmcCFVarClED( "clED"      62     const std::string  CexmcCFVarClED( "clED" );
 63     const std::string  CexmcCFVarCrED( "crED"      63     const std::string  CexmcCFVarCrED( "crED" );
 64     const std::string  CexmcCFVarClEDCol( "clE     64     const std::string  CexmcCFVarClEDCol( "clEDcol" );
 65     const std::string  CexmcCFVarCrEDCol( "crE     65     const std::string  CexmcCFVarCrEDCol( "crEDcol" );
 66     const std::string  CexmcCFVarBpMonPosL( "b     66     const std::string  CexmcCFVarBpMonPosL( "bp_mon_posl" );
 67     const std::string  CexmcCFVarBpMonPosW( "b     67     const std::string  CexmcCFVarBpMonPosW( "bp_mon_posw" );
 68     const std::string  CexmcCFVarBpMonDirL( "b     68     const std::string  CexmcCFVarBpMonDirL( "bp_mon_dirl" );
 69     const std::string  CexmcCFVarBpMonDirW( "b     69     const std::string  CexmcCFVarBpMonDirW( "bp_mon_dirw" );
 70     const std::string  CexmcCFVarBpMonMom( "bp     70     const std::string  CexmcCFVarBpMonMom( "bp_mon_mom" );
 71     const std::string  CexmcCFVarBpMonTid( "bp     71     const std::string  CexmcCFVarBpMonTid( "bp_mon_tid" );
 72     const std::string  CexmcCFVarBpTgtPosL( "b     72     const std::string  CexmcCFVarBpTgtPosL( "bp_tgt_posl" );
 73     const std::string  CexmcCFVarBpTgtPosW( "b     73     const std::string  CexmcCFVarBpTgtPosW( "bp_tgt_posw" );
 74     const std::string  CexmcCFVarBpTgtDirL( "b     74     const std::string  CexmcCFVarBpTgtDirL( "bp_tgt_dirl" );
 75     const std::string  CexmcCFVarBpTgtDirW( "b     75     const std::string  CexmcCFVarBpTgtDirW( "bp_tgt_dirw" );
 76     const std::string  CexmcCFVarBpTgtMom( "bp     76     const std::string  CexmcCFVarBpTgtMom( "bp_tgt_mom" );
 77     const std::string  CexmcCFVarBpTgtTid( "bp     77     const std::string  CexmcCFVarBpTgtTid( "bp_tgt_tid" );
 78     const std::string  CexmcCFVarOpTgtPosL( "o     78     const std::string  CexmcCFVarOpTgtPosL( "op_tgt_posl" );
 79     const std::string  CexmcCFVarOpTgtPosW( "o     79     const std::string  CexmcCFVarOpTgtPosW( "op_tgt_posw" );
 80     const std::string  CexmcCFVarOpTgtDirL( "o     80     const std::string  CexmcCFVarOpTgtDirL( "op_tgt_dirl" );
 81     const std::string  CexmcCFVarOpTgtDirW( "o     81     const std::string  CexmcCFVarOpTgtDirW( "op_tgt_dirw" );
 82     const std::string  CexmcCFVarOpTgtMom( "op     82     const std::string  CexmcCFVarOpTgtMom( "op_tgt_mom" );
 83     const std::string  CexmcCFVarOpTgtTid( "op     83     const std::string  CexmcCFVarOpTgtTid( "op_tgt_tid" );
 84     const std::string  CexmcCFVarNpTgtPosL( "n     84     const std::string  CexmcCFVarNpTgtPosL( "np_tgt_posl" );
 85     const std::string  CexmcCFVarNpTgtPosW( "n     85     const std::string  CexmcCFVarNpTgtPosW( "np_tgt_posw" );
 86     const std::string  CexmcCFVarNpTgtDirL( "n     86     const std::string  CexmcCFVarNpTgtDirL( "np_tgt_dirl" );
 87     const std::string  CexmcCFVarNpTgtDirW( "n     87     const std::string  CexmcCFVarNpTgtDirW( "np_tgt_dirw" );
 88     const std::string  CexmcCFVarNpTgtMom( "np     88     const std::string  CexmcCFVarNpTgtMom( "np_tgt_mom" );
 89     const std::string  CexmcCFVarNpTgtTid( "np     89     const std::string  CexmcCFVarNpTgtTid( "np_tgt_tid" );
 90     const std::string  CexmcCFVarOpdp1TgtPosL(     90     const std::string  CexmcCFVarOpdp1TgtPosL( "opdp1_tgt_posl" );
 91     const std::string  CexmcCFVarOpdp1TgtPosW(     91     const std::string  CexmcCFVarOpdp1TgtPosW( "opdp1_tgt_posw" );
 92     const std::string  CexmcCFVarOpdp1TgtDirL(     92     const std::string  CexmcCFVarOpdp1TgtDirL( "opdp1_tgt_dirl" );
 93     const std::string  CexmcCFVarOpdp1TgtDirW(     93     const std::string  CexmcCFVarOpdp1TgtDirW( "opdp1_tgt_dirw" );
 94     const std::string  CexmcCFVarOpdp1TgtMom(      94     const std::string  CexmcCFVarOpdp1TgtMom( "opdp1_tgt_mom" );
 95     const std::string  CexmcCFVarOpdp1TgtTid(      95     const std::string  CexmcCFVarOpdp1TgtTid( "opdp1_tgt_tid" );
 96     const std::string  CexmcCFVarOpdp2TgtPosL(     96     const std::string  CexmcCFVarOpdp2TgtPosL( "opdp2_tgt_posl" );
 97     const std::string  CexmcCFVarOpdp2TgtPosW(     97     const std::string  CexmcCFVarOpdp2TgtPosW( "opdp2_tgt_posw" );
 98     const std::string  CexmcCFVarOpdp2TgtDirL(     98     const std::string  CexmcCFVarOpdp2TgtDirL( "opdp2_tgt_dirl" );
 99     const std::string  CexmcCFVarOpdp2TgtDirW(     99     const std::string  CexmcCFVarOpdp2TgtDirW( "opdp2_tgt_dirw" );
100     const std::string  CexmcCFVarOpdp2TgtMom(     100     const std::string  CexmcCFVarOpdp2TgtMom( "opdp2_tgt_mom" );
101     const std::string  CexmcCFVarOpdp2TgtTid(     101     const std::string  CexmcCFVarOpdp2TgtTid( "opdp2_tgt_tid" );
102     const std::string  CexmcCFVarOpdpVclPosL(     102     const std::string  CexmcCFVarOpdpVclPosL( "opdp_vcl_posl" );
103     const std::string  CexmcCFVarOpdpVclPosW(     103     const std::string  CexmcCFVarOpdpVclPosW( "opdp_vcl_posw" );
104     const std::string  CexmcCFVarOpdpVclDirL(     104     const std::string  CexmcCFVarOpdpVclDirL( "opdp_vcl_dirl" );
105     const std::string  CexmcCFVarOpdpVclDirW(     105     const std::string  CexmcCFVarOpdpVclDirW( "opdp_vcl_dirw" );
106     const std::string  CexmcCFVarOpdpVclMom( "    106     const std::string  CexmcCFVarOpdpVclMom( "opdp_vcl_mom" );
107     const std::string  CexmcCFVarOpdpVclTid( "    107     const std::string  CexmcCFVarOpdpVclTid( "opdp_vcl_tid" );
108     const std::string  CexmcCFVarOpdpVcrPosL(     108     const std::string  CexmcCFVarOpdpVcrPosL( "opdp_vcr_posl" );
109     const std::string  CexmcCFVarOpdpVcrPosW(     109     const std::string  CexmcCFVarOpdpVcrPosW( "opdp_vcr_posw" );
110     const std::string  CexmcCFVarOpdpVcrDirL(     110     const std::string  CexmcCFVarOpdpVcrDirL( "opdp_vcr_dirl" );
111     const std::string  CexmcCFVarOpdpVcrDirW(     111     const std::string  CexmcCFVarOpdpVcrDirW( "opdp_vcr_dirw" );
112     const std::string  CexmcCFVarOpdpVcrMom( "    112     const std::string  CexmcCFVarOpdpVcrMom( "opdp_vcr_mom" );
113     const std::string  CexmcCFVarOpdpVcrTid( "    113     const std::string  CexmcCFVarOpdpVcrTid( "opdp_vcr_tid" );
114     const std::string  CexmcCFVarOpdpClPosL( "    114     const std::string  CexmcCFVarOpdpClPosL( "opdp_cl_posl" );
115     const std::string  CexmcCFVarOpdpClPosW( "    115     const std::string  CexmcCFVarOpdpClPosW( "opdp_cl_posw" );
116     const std::string  CexmcCFVarOpdpClDirL( "    116     const std::string  CexmcCFVarOpdpClDirL( "opdp_cl_dirl" );
117     const std::string  CexmcCFVarOpdpClDirW( "    117     const std::string  CexmcCFVarOpdpClDirW( "opdp_cl_dirw" );
118     const std::string  CexmcCFVarOpdpClMom( "o    118     const std::string  CexmcCFVarOpdpClMom( "opdp_cl_mom" );
119     const std::string  CexmcCFVarOpdpClTid( "o    119     const std::string  CexmcCFVarOpdpClTid( "opdp_cl_tid" );
120     const std::string  CexmcCFVarOpdpCrPosL( "    120     const std::string  CexmcCFVarOpdpCrPosL( "opdp_cr_posl" );
121     const std::string  CexmcCFVarOpdpCrPosW( "    121     const std::string  CexmcCFVarOpdpCrPosW( "opdp_cr_posw" );
122     const std::string  CexmcCFVarOpdpCrDirL( "    122     const std::string  CexmcCFVarOpdpCrDirL( "opdp_cr_dirl" );
123     const std::string  CexmcCFVarOpdpCrDirW( "    123     const std::string  CexmcCFVarOpdpCrDirW( "opdp_cr_dirw" );
124     const std::string  CexmcCFVarOpdpCrMom( "o    124     const std::string  CexmcCFVarOpdpCrMom( "opdp_cr_mom" );
125     const std::string  CexmcCFVarOpdpCrTid( "o    125     const std::string  CexmcCFVarOpdpCrTid( "opdp_cr_tid" );
126     const std::string  CexmcCFVarIpSCM( "ipSCM    126     const std::string  CexmcCFVarIpSCM( "ipSCM" );
127     const std::string  CexmcCFVarIpLAB( "ipLAB    127     const std::string  CexmcCFVarIpLAB( "ipLAB" );
128     const std::string  CexmcCFVarNpSCM( "npSCM    128     const std::string  CexmcCFVarNpSCM( "npSCM" );
129     const std::string  CexmcCFVarNpLAB( "npLAB    129     const std::string  CexmcCFVarNpLAB( "npLAB" );
130     const std::string  CexmcCFVarOpSCM( "opSCM    130     const std::string  CexmcCFVarOpSCM( "opSCM" );
131     const std::string  CexmcCFVarOpLAB( "opLAB    131     const std::string  CexmcCFVarOpLAB( "opLAB" );
132     const std::string  CexmcCFVarNopSCM( "nopS    132     const std::string  CexmcCFVarNopSCM( "nopSCM" );
133     const std::string  CexmcCFVarNopLAB( "nopL    133     const std::string  CexmcCFVarNopLAB( "nopLAB" );
134     const std::string  CexmcCFVarIpId( "ipId"     134     const std::string  CexmcCFVarIpId( "ipId" );
135     const std::string  CexmcCFVarNpId( "npId"     135     const std::string  CexmcCFVarNpId( "npId" );
136     const std::string  CexmcCFVarOpId( "opId"     136     const std::string  CexmcCFVarOpId( "opId" );
137     const std::string  CexmcCFVarNopId( "nopId    137     const std::string  CexmcCFVarNopId( "nopId" );
138     const std::string  CexmcCFVarConst_eV( "eV    138     const std::string  CexmcCFVarConst_eV( "eV" );
139     const std::string  CexmcCFVarConst_keV( "k    139     const std::string  CexmcCFVarConst_keV( "keV" );
140     const std::string  CexmcCFVarConst_MeV( "M    140     const std::string  CexmcCFVarConst_MeV( "MeV" );
141     const std::string  CexmcCFVarConst_GeV( "G    141     const std::string  CexmcCFVarConst_GeV( "GeV" );
142     const std::string  CexmcCFVarConst_mm( "mm    142     const std::string  CexmcCFVarConst_mm( "mm" );
143     const std::string  CexmcCFVarConst_cm( "cm    143     const std::string  CexmcCFVarConst_cm( "cm" );
144     const std::string  CexmcCFVarConst_m( "m"     144     const std::string  CexmcCFVarConst_m( "m" );
145 }                                                 145 }
146                                                   146 
147                                                   147 
148 const G4double  CexmcASTEval::constants[] = {     148 const G4double  CexmcASTEval::constants[] = { eV, keV, MeV, GeV, mm, cm, m };
149                                                   149 
150                                                   150 
151 CexmcASTEval::CexmcASTEval( const CexmcEventFa << 151 CexmcASTEval::CexmcASTEval( const CexmcEventFastSObject *  evFastSObject,
152                             const CexmcEventSO << 152                             const CexmcEventSObject *  evSObject ) :
153     evFastSObject( evFastSObject_ ), evSObject << 153     evFastSObject( evFastSObject ), evSObject( evSObject )
154 {                                                 154 {
155 }                                                 155 }
156                                                   156 
157                                                   157 
158 CexmcAST::BasicEval::ScalarValueType  CexmcAST    158 CexmcAST::BasicEval::ScalarValueType  CexmcASTEval::GetFunScalarValue(
159                                         const     159                                         const CexmcAST::Subtree &  ast ) const
160 {                                                 160 {
161     const CexmcAST::Function &  fun( boost::ge    161     const CexmcAST::Function &  fun( boost::get< CexmcAST::Function >(
162                                                   162                                                                 ast.type ) );
163                                                   163 
164     if ( fun == "Sum" )                           164     if ( fun == "Sum" )
165     {                                             165     {
166         CexmcEnergyDepositCalorimeterCollectio    166         CexmcEnergyDepositCalorimeterCollection  edCol;
167         GetEDCollectionValue( ast.children[ 0     167         GetEDCollectionValue( ast.children[ 0 ], edCol );
168                                                   168 
169         G4double  result( 0. );                   169         G4double  result( 0. );
170                                                   170 
171         for ( CexmcEnergyDepositCalorimeterCol    171         for ( CexmcEnergyDepositCalorimeterCollection::iterator
172                                     k( edCol.b    172                                     k( edCol.begin() ); k != edCol.end(); ++k )
173         {                                         173         {
174             result += std::accumulate( k->begi    174             result += std::accumulate( k->begin(), k->end(), G4double( 0. ) );
175         }                                         175         }
176                                                   176 
177         return result;                            177         return result;
178     }                                             178     }
179                                                   179 
180     bool             evalResult( false );         180     bool             evalResult( false );
181     ScalarValueType  result( GetBasicFunScalar    181     ScalarValueType  result( GetBasicFunScalarValue( ast, evalResult ) );
182                                                   182 
183     if ( evalResult )                             183     if ( evalResult )
184         return result;                            184         return result;
185                                                   185 
186     throw CexmcException( CexmcCFUnexpectedFun    186     throw CexmcException( CexmcCFUnexpectedFunction );
187                                                   187 
188     return 0;                                     188     return 0;
189 }                                                 189 }
190                                                   190 
191                                                   191 
192 CexmcAST::BasicEval::ScalarValueType  CexmcAST    192 CexmcAST::BasicEval::ScalarValueType  CexmcASTEval::GetVarScalarValue(
193                                         const     193                                         const CexmcAST::Variable &  var ) const
194 {                                                 194 {
195     if ( evFastSObject == NULL || evSObject ==    195     if ( evFastSObject == NULL || evSObject == NULL )
196         throw CexmcException( CexmcCFUninitial    196         throw CexmcException( CexmcCFUninitialized );
197                                                   197 
198     /* Variables with initialized address */      198     /* Variables with initialized address */
199                                                   199 
200     /* bound to CexmcAST::Variable:addr */        200     /* bound to CexmcAST::Variable:addr */
201                                                   201 
202     const double * const *  addr( boost::get<     202     const double * const *  addr( boost::get< const double * >( &var.addr ) );
203                                                   203 
204     if ( addr )                                   204     if ( addr )
205     {                                             205     {
206         if ( *addr )                              206         if ( *addr )
207             return **addr;                        207             return **addr;
208     }                                             208     }
209     else                                          209     else
210     {                                             210     {
211         const int * const &  addr_( boost::get << 211         const int * const &  addr( boost::get< const int * >( var.addr ) );
212                                                   212 
213         if ( addr_ )                           << 213         if ( addr )
214             return *addr_;                     << 214             return *addr;
215     }                                             215     }
216                                                   216 
217     /* found in varAddrMap */                     217     /* found in varAddrMap */
218                                                   218 
219     VarAddrMap::const_iterator  found( varAddr    219     VarAddrMap::const_iterator  found( varAddrMap.find( var.name ) );
220                                                   220 
221     if ( found != varAddrMap.end() )              221     if ( found != varAddrMap.end() )
222     {                                             222     {
223         const CexmcEnergyDepositCalorimeterCol << 223         const CexmcEnergyDepositCalorimeterCollection * const *  addr(
224                 boost::get< const CexmcEnergyD    224                 boost::get< const CexmcEnergyDepositCalorimeterCollection * >(
225                                                   225                                                             &found->second ) );
226         if ( addr_ )                           << 226         if ( addr )
227         {                                         227         {
228             if ( *addr_ )                      << 228             if ( *addr )
229             {                                     229             {
230                 if ( ( *addr_ )->size() == 0 ) << 230                 if ( ( *addr )->size() == 0 )
231                     throw CexmcException( Cexm    231                     throw CexmcException( CexmcCFUninitializedVector );
232                 if ( var.index1 == 0 || var.in    232                 if ( var.index1 == 0 || var.index2 == 0 )
233                     throw CexmcException( Cexm    233                     throw CexmcException( CexmcCFUnexpectedVectorIndex );
234                 return ( *addr_ )->at( var.ind << 234                 return ( *addr )->at( var.index1 - 1 ).at( var.index2 - 1 );
235             }                                     235             }
236         }                                         236         }
237         else                                      237         else
238         {                                         238         {
239             const bool * const &  addr__( boos << 239             const bool * const &  addr( boost::get< const bool * >(
240                                                   240                                                             found->second ) );
241             if ( addr__ )                      << 241             if ( addr )
242                 return int( *addr__ );         << 242                 return int( *addr );
243         }                                         243         }
244     }                                             244     }
245                                                   245 
246     /* Variables without address */               246     /* Variables without address */
247                                                   247 
248     if ( var.name == CexmcCFVarTPT )              248     if ( var.name == CexmcCFVarTPT )
249     {                                             249     {
250         return int( evSObject->targetTPOutputP    250         return int( evSObject->targetTPOutputParticle.trackId !=
251                     CexmcInvalidTrackId );        251                     CexmcInvalidTrackId );
252     }                                             252     } 
253                                                   253 
254     throw CexmcException( CexmcCFUnexpectedVar    254     throw CexmcException( CexmcCFUnexpectedVariable );
255                                                   255 
256     return 0;                                     256     return 0;
257 }                                                 257 }
258                                                   258 
259                                                   259 
260 void  CexmcASTEval::GetEDCollectionValue( cons    260 void  CexmcASTEval::GetEDCollectionValue( const CexmcAST::Node &  node,
261                         CexmcEnergyDepositCalo    261                         CexmcEnergyDepositCalorimeterCollection &  edCol ) const
262 {                                                 262 {
263     if ( evSObject == NULL )                      263     if ( evSObject == NULL )
264         throw CexmcException( CexmcCFUninitial    264         throw CexmcException( CexmcCFUninitialized );
265                                                   265 
266     const CexmcAST::Subtree *  ast( boost::get    266     const CexmcAST::Subtree *  ast( boost::get< CexmcAST::Subtree >( &node ) );
267                                                   267 
268     if ( ast )                                    268     if ( ast )
269     {                                             269     {
270         const CexmcAST::Function &  fun( boost    270         const CexmcAST::Function &  fun( boost::get< CexmcAST::Function >(
271                                                   271                                                                 ast->type ) );
272                                                   272 
273         if ( fun == "Inner" )                     273         if ( fun == "Inner" )
274         {                                         274         {
275             GetEDCollectionValue( ast->childre    275             GetEDCollectionValue( ast->children[ 0 ], edCol );
276             edCol.pop_back();                     276             edCol.pop_back();
277             edCol.erase( edCol.begin() );         277             edCol.erase( edCol.begin() );
278             for ( CexmcEnergyDepositCalorimete    278             for ( CexmcEnergyDepositCalorimeterCollection::iterator
279                             k( edCol.begin() )    279                             k( edCol.begin() ); k != edCol.end(); ++k )
280             {                                     280             {
281                 k->pop_back();                    281                 k->pop_back();
282                 k->erase( k->begin() );           282                 k->erase( k->begin() );
283             }                                     283             }
284             return;                               284             return;
285         }                                         285         }
286         if ( fun == "Outer" )                     286         if ( fun == "Outer" )
287         {                                         287         {
288             GetEDCollectionValue( ast->childre    288             GetEDCollectionValue( ast->children[ 0 ], edCol );
289             if ( edCol.size() < 3 )               289             if ( edCol.size() < 3 )
290                 return;                           290                 return;
291             for ( CexmcEnergyDepositCalorimete    291             for ( CexmcEnergyDepositCalorimeterCollection::iterator
292                             k( edCol.begin() +    292                             k( edCol.begin() + 1 ); k != edCol.end() - 1; ++k )
293             {                                     293             {
294                 if ( k->size() < 3 )              294                 if ( k->size() < 3 )
295                     continue;                     295                     continue;
296                 k->erase( k->begin() + 1, k->e    296                 k->erase( k->begin() + 1, k->end() - 1 );
297             }                                     297             }
298             return;                               298             return;
299         }                                         299         }
300     }                                             300     }
301     else                                          301     else
302     {                                             302     {
303         const CexmcAST::Leaf &      leaf( boos    303         const CexmcAST::Leaf &      leaf( boost::get< CexmcAST::Leaf >(
304                                                   304                                                                     node ) );
305         const CexmcAST::Variable &  var( boost    305         const CexmcAST::Variable &  var( boost::get< CexmcAST::Variable >(
306                                                   306                                                                     leaf ) );
307                                                   307 
308         if ( var.index1 != 0 || var.index2 !=     308         if ( var.index1 != 0 || var.index2 != 0 )
309             throw CexmcException( CexmcCFUnexp    309             throw CexmcException( CexmcCFUnexpectedVariableUsage );
310                                                   310 
311         VarAddrMap::const_iterator  found( var    311         VarAddrMap::const_iterator  found( varAddrMap.find( var.name ) );
312                                                   312 
313         if ( found == varAddrMap.end() )          313         if ( found == varAddrMap.end() )
314             throw CexmcException( CexmcCFUnexp    314             throw CexmcException( CexmcCFUnexpectedVariable );
315                                                   315 
316         const CexmcEnergyDepositCalorimeterCol    316         const CexmcEnergyDepositCalorimeterCollection * const *  addr(
317                 boost::get< const CexmcEnergyD    317                 boost::get< const CexmcEnergyDepositCalorimeterCollection * >(
318                                                   318                                                             &found->second ) );
319         if ( ! addr )                             319         if ( ! addr )
320         {                                         320         {
321             throw CexmcException( CexmcCFUnexp    321             throw CexmcException( CexmcCFUnexpectedVariableUsage );
322         }                                         322         }
323         else                                      323         else
324         {                                         324         {
325             if ( *addr )                          325             if ( *addr )
326                 edCol = **addr;                   326                 edCol = **addr;
327             return;                               327             return;
328         }                                         328         }
329     }                                             329     }
330 }                                                 330 }
331                                                   331 
332                                                   332 
333 void  CexmcASTEval::BindAddresses( CexmcAST::S    333 void  CexmcASTEval::BindAddresses( CexmcAST::Subtree &  ast )
334 {                                                 334 {
335     if ( evFastSObject == NULL || evSObject ==    335     if ( evFastSObject == NULL || evSObject == NULL )
336         return;                                   336         return;
337                                                   337 
338     for ( std::vector< CexmcAST::Node >::itera    338     for ( std::vector< CexmcAST::Node >::iterator  k( ast.children.begin() );
339                                                   339                                                   k != ast.children.end(); ++k )
340     {                                             340     {
341         CexmcAST::Subtree *  subtree( boost::g    341         CexmcAST::Subtree *  subtree( boost::get< CexmcAST::Subtree >( &*k ) );
342                                                   342 
343         if ( subtree )                            343         if ( subtree )
344         {                                         344         {
345             BindAddresses( *subtree );            345             BindAddresses( *subtree );
346         }                                         346         }
347         else                                      347         else
348         {                                         348         {
349             CexmcAST::Leaf &      leaf( boost:    349             CexmcAST::Leaf &      leaf( boost::get< CexmcAST::Leaf >( *k ) );
350             CexmcAST::Variable *  var( boost::    350             CexmcAST::Variable *  var( boost::get< CexmcAST::Variable >(
351                                                   351                                                                     &leaf ) );
352             if ( ! var )                          352             if ( ! var )
353                 continue;                         353                 continue;
354                                                   354 
355             const int * const *   intVarAddr(     355             const int * const *   intVarAddr(
356                                     boost::get    356                                     boost::get< const int * >( &var->addr ) );
357             if ( intVarAddr )                     357             if ( intVarAddr )
358             {                                     358             {
359                 if ( *intVarAddr )                359                 if ( *intVarAddr )
360                     continue;                     360                     continue;
361             }                                     361             }
362             else                                  362             else
363             {                                     363             {
364                 const double * const &  double    364                 const double * const &  doubleVarAddr(
365                                     boost::get    365                                     boost::get< const double * >( var->addr ) );
366                 if ( doubleVarAddr )              366                 if ( doubleVarAddr )
367                     continue;                     367                     continue;
368             }                                     368             }
369                                                   369 
370             VarAddrMap::const_iterator  found(    370             VarAddrMap::const_iterator  found( varAddrMap.find( var->name ) );
371                                                   371 
372             if ( found != varAddrMap.end() )      372             if ( found != varAddrMap.end() )
373                 continue;                         373                 continue;
374                                                   374 
375             do                                    375             do
376             {                                     376             {
377                 if ( var->name == CexmcCFVarEv    377                 if ( var->name == CexmcCFVarEvent )
378                 {                                 378                 {
379                     var->addr = &evFastSObject    379                     var->addr = &evFastSObject->eventId;
380                     break;                        380                     break;
381                 }                                 381                 }
382                 if ( var->name == CexmcCFVarOp    382                 if ( var->name == CexmcCFVarOpCosThetaSCM )
383                 {                                 383                 {
384                     var->addr = &evFastSObject    384                     var->addr = &evFastSObject->opCosThetaSCM;
385                     break;                        385                     break;
386                 }                                 386                 }
387                 if ( var->name == CexmcCFVarED    387                 if ( var->name == CexmcCFVarEDT )
388                 {                                 388                 {
389                     varAddrMap.insert( VarAddr    389                     varAddrMap.insert( VarAddrMapData( var->name,
390                                    &evFastSObj    390                                    &evFastSObject->edDigitizerHasTriggered ) );
391                     break;                        391                     break;
392                 }                                 392                 } 
393                 if ( var->name == CexmcCFVarMo    393                 if ( var->name == CexmcCFVarMon )
394                 {                                 394                 {
395                     varAddrMap.insert( VarAddr    395                     varAddrMap.insert( VarAddrMapData( var->name,
396                            &evFastSObject->edD    396                            &evFastSObject->edDigitizerMonitorHasTriggered ) );
397                     break;                        397                     break;
398                 }                                 398                 }
399                 if ( var->name == CexmcCFVarMo    399                 if ( var->name == CexmcCFVarMonED )
400                 {                                 400                 {
401                     var->addr = &evSObject->mo    401                     var->addr = &evSObject->monitorED;
402                     break;                        402                     break;
403                 }                                 403                 }
404                 if ( var->name == CexmcCFVarVc    404                 if ( var->name == CexmcCFVarVclED )
405                 {                                 405                 {
406                     var->addr = &evSObject->ve    406                     var->addr = &evSObject->vetoCounterEDLeft;
407                     break;                        407                     break;
408                 }                                 408                 }
409                 if ( var->name == CexmcCFVarVc    409                 if ( var->name == CexmcCFVarVcrED )
410                 {                                 410                 {
411                     var->addr = &evSObject->ve    411                     var->addr = &evSObject->vetoCounterEDRight;
412                     break;                        412                     break;
413                 }                                 413                 }
414                 if ( var->name == CexmcCFVarCl    414                 if ( var->name == CexmcCFVarClED )
415                 {                                 415                 {
416                     var->addr = &evSObject->ca    416                     var->addr = &evSObject->calorimeterEDLeft;
417                     break;                        417                     break;
418                 }                                 418                 }
419                 if ( var->name == CexmcCFVarCr    419                 if ( var->name == CexmcCFVarCrED )
420                 {                                 420                 {
421                     var->addr = &evSObject->ca    421                     var->addr = &evSObject->calorimeterEDRight;
422                     break;                        422                     break;
423                 }                                 423                 }
424                 if ( var->name == CexmcCFVarCl    424                 if ( var->name == CexmcCFVarClEDCol )
425                 {                                 425                 {
426                     varAddrMap.insert( VarAddr    426                     varAddrMap.insert( VarAddrMapData( var->name,
427                                 &evSObject->ca    427                                 &evSObject->calorimeterEDLeftCollection ) );
428                     break;                        428                     break;
429                 }                                 429                 }
430                 if ( var->name == CexmcCFVarCr    430                 if ( var->name == CexmcCFVarCrEDCol )
431                 {                                 431                 {
432                     varAddrMap.insert( VarAddr    432                     varAddrMap.insert( VarAddrMapData( var->name,
433                                 &evSObject->ca    433                                 &evSObject->calorimeterEDRightCollection ) );
434                     break;                        434                     break;
435                 }                                 435                 }
436                 if ( var->name == CexmcCFVarBp    436                 if ( var->name == CexmcCFVarBpMonPosL )
437                 {                                 437                 {
438                     var->addr = GetThreeVector    438                     var->addr = GetThreeVectorElementAddrByIndex(
439                             evSObject->monitor    439                             evSObject->monitorTP.positionLocal, var->index1 );
440                     break;                        440                     break;
441                 }                                 441                 }
442                 if ( var->name == CexmcCFVarBp    442                 if ( var->name == CexmcCFVarBpMonPosW )
443                 {                                 443                 {
444                     var->addr = GetThreeVector    444                     var->addr = GetThreeVectorElementAddrByIndex(
445                             evSObject->monitor    445                             evSObject->monitorTP.positionWorld, var->index1 );
446                     break;                        446                     break;
447                 }                                 447                 }
448                 if ( var->name == CexmcCFVarBp    448                 if ( var->name == CexmcCFVarBpMonDirL )
449                 {                                 449                 {
450                     var->addr = GetThreeVector    450                     var->addr = GetThreeVectorElementAddrByIndex(
451                             evSObject->monitor    451                             evSObject->monitorTP.directionLocal, var->index1 );
452                     break;                        452                     break;
453                 }                                 453                 }
454                 if ( var->name == CexmcCFVarBp    454                 if ( var->name == CexmcCFVarBpMonDirW )
455                 {                                 455                 {
456                     var->addr = GetThreeVector    456                     var->addr = GetThreeVectorElementAddrByIndex(
457                             evSObject->monitor    457                             evSObject->monitorTP.directionWorld, var->index1 );
458                     break;                        458                     break;
459                 }                                 459                 }
460                 if ( var->name == CexmcCFVarBp    460                 if ( var->name == CexmcCFVarBpMonMom )
461                 {                                 461                 {
462                     var->addr = &evSObject->mo    462                     var->addr = &evSObject->monitorTP.momentumAmp;
463                     break;                        463                     break;
464                 }                                 464                 }
465                 if ( var->name == CexmcCFVarBp    465                 if ( var->name == CexmcCFVarBpMonTid )
466                 {                                 466                 {
467                     var->addr = &evSObject->mo    467                     var->addr = &evSObject->monitorTP.trackId;
468                     break;                        468                     break;
469                 }                                 469                 }
470                 if ( var->name == CexmcCFVarBp    470                 if ( var->name == CexmcCFVarBpTgtPosL )
471                 {                                 471                 {
472                     var->addr = GetThreeVector    472                     var->addr = GetThreeVectorElementAddrByIndex(
473                             evSObject->targetT    473                             evSObject->targetTPBeamParticle.positionLocal,
474                             var->index1 );        474                             var->index1 );
475                     break;                        475                     break;
476                 }                                 476                 }
477                 if ( var->name == CexmcCFVarBp    477                 if ( var->name == CexmcCFVarBpTgtPosW )
478                 {                                 478                 {
479                     var->addr = GetThreeVector    479                     var->addr = GetThreeVectorElementAddrByIndex(
480                             evSObject->targetT    480                             evSObject->targetTPBeamParticle.positionWorld,
481                             var->index1 );        481                             var->index1 );
482                     break;                        482                     break;
483                 }                                 483                 }
484                 if ( var->name == CexmcCFVarBp    484                 if ( var->name == CexmcCFVarBpTgtDirL )
485                 {                                 485                 {
486                     var->addr = GetThreeVector    486                     var->addr = GetThreeVectorElementAddrByIndex(
487                             evSObject->targetT    487                             evSObject->targetTPBeamParticle.directionLocal,
488                             var->index1 );        488                             var->index1 );
489                     break;                        489                     break;
490                 }                                 490                 }
491                 if ( var->name == CexmcCFVarBp    491                 if ( var->name == CexmcCFVarBpTgtDirW )
492                 {                                 492                 {
493                     var->addr = GetThreeVector    493                     var->addr = GetThreeVectorElementAddrByIndex(
494                             evSObject->targetT    494                             evSObject->targetTPBeamParticle.directionWorld,
495                             var->index1 );        495                             var->index1 );
496                     break;                        496                     break;
497                 }                                 497                 }
498                 if ( var->name == CexmcCFVarBp    498                 if ( var->name == CexmcCFVarBpTgtMom )
499                 {                                 499                 {
500                     var->addr = &evSObject->ta    500                     var->addr = &evSObject->targetTPBeamParticle.momentumAmp;
501                     break;                        501                     break;
502                 }                                 502                 }
503                 if ( var->name == CexmcCFVarBp    503                 if ( var->name == CexmcCFVarBpTgtTid )
504                 {                                 504                 {
505                     var->addr = &evSObject->ta    505                     var->addr = &evSObject->targetTPBeamParticle.trackId;
506                     break;                        506                     break;
507                 }                                 507                 }
508                 if ( var->name == CexmcCFVarOp    508                 if ( var->name == CexmcCFVarOpTgtPosL )
509                 {                                 509                 {
510                     var->addr = GetThreeVector    510                     var->addr = GetThreeVectorElementAddrByIndex(
511                             evSObject->targetT    511                             evSObject->targetTPOutputParticle.positionLocal,
512                             var->index1 );        512                             var->index1 );
513                     break;                        513                     break;
514                 }                                 514                 }
515                 if ( var->name == CexmcCFVarOp    515                 if ( var->name == CexmcCFVarOpTgtPosW )
516                 {                                 516                 {
517                     var->addr = GetThreeVector    517                     var->addr = GetThreeVectorElementAddrByIndex(
518                             evSObject->targetT    518                             evSObject->targetTPOutputParticle.positionWorld,
519                             var->index1 );        519                             var->index1 );
520                     break;                        520                     break;
521                 }                                 521                 }
522                 if ( var->name == CexmcCFVarOp    522                 if ( var->name == CexmcCFVarOpTgtDirL )
523                 {                                 523                 {
524                     var->addr = GetThreeVector    524                     var->addr = GetThreeVectorElementAddrByIndex(
525                             evSObject->targetT    525                             evSObject->targetTPOutputParticle.directionLocal,
526                             var->index1 );        526                             var->index1 );
527                     break;                        527                     break;
528                 }                                 528                 }
529                 if ( var->name == CexmcCFVarOp    529                 if ( var->name == CexmcCFVarOpTgtDirW )
530                 {                                 530                 {
531                     var->addr = GetThreeVector    531                     var->addr = GetThreeVectorElementAddrByIndex(
532                             evSObject->targetT    532                             evSObject->targetTPOutputParticle.directionWorld,
533                             var->index1 );        533                             var->index1 );
534                     break;                        534                     break;
535                 }                                 535                 }
536                 if ( var->name == CexmcCFVarOp    536                 if ( var->name == CexmcCFVarOpTgtMom )
537                 {                                 537                 {
538                     var->addr = &evSObject->ta    538                     var->addr = &evSObject->targetTPOutputParticle.momentumAmp;
539                     break;                        539                     break;
540                 }                                 540                 }
541                 if ( var->name == CexmcCFVarOp    541                 if ( var->name == CexmcCFVarOpTgtTid )
542                 {                                 542                 {
543                     var->addr = &evSObject->ta    543                     var->addr = &evSObject->targetTPOutputParticle.trackId;
544                     break;                        544                     break;
545                 }                                 545                 }
546                 if ( var->name == CexmcCFVarNp    546                 if ( var->name == CexmcCFVarNpTgtPosL )
547                 {                                 547                 {
548                     var->addr = GetThreeVector    548                     var->addr = GetThreeVectorElementAddrByIndex(
549                             evSObject->targetT    549                             evSObject->targetTPNucleusParticle.positionLocal,
550                             var->index1 );        550                             var->index1 );
551                     break;                        551                     break;
552                 }                                 552                 }
553                 if ( var->name == CexmcCFVarNp    553                 if ( var->name == CexmcCFVarNpTgtPosW )
554                 {                                 554                 {
555                     var->addr = GetThreeVector    555                     var->addr = GetThreeVectorElementAddrByIndex(
556                             evSObject->targetT    556                             evSObject->targetTPNucleusParticle.positionWorld,
557                             var->index1 );        557                             var->index1 );
558                     break;                        558                     break;
559                 }                                 559                 }
560                 if ( var->name == CexmcCFVarNp    560                 if ( var->name == CexmcCFVarNpTgtDirL )
561                 {                                 561                 {
562                     var->addr = GetThreeVector    562                     var->addr = GetThreeVectorElementAddrByIndex(
563                             evSObject->targetT    563                             evSObject->targetTPNucleusParticle.directionLocal,
564                             var->index1 );        564                             var->index1 );
565                     break;                        565                     break;
566                 }                                 566                 }
567                 if ( var->name == CexmcCFVarNp    567                 if ( var->name == CexmcCFVarNpTgtDirW )
568                 {                                 568                 {
569                     var->addr = GetThreeVector    569                     var->addr = GetThreeVectorElementAddrByIndex(
570                             evSObject->targetT    570                             evSObject->targetTPNucleusParticle.directionWorld,
571                             var->index1 );        571                             var->index1 );
572                     break;                        572                     break;
573                 }                                 573                 }
574                 if ( var->name == CexmcCFVarNp    574                 if ( var->name == CexmcCFVarNpTgtMom )
575                 {                                 575                 {
576                     var->addr = &evSObject->ta    576                     var->addr = &evSObject->targetTPNucleusParticle.momentumAmp;
577                     break;                        577                     break;
578                 }                                 578                 }
579                 if ( var->name == CexmcCFVarNp    579                 if ( var->name == CexmcCFVarNpTgtTid )
580                 {                                 580                 {
581                     var->addr = &evSObject->ta    581                     var->addr = &evSObject->targetTPNucleusParticle.trackId;
582                     break;                        582                     break;
583                 }                                 583                 }
584                 if ( var->name == CexmcCFVarOp    584                 if ( var->name == CexmcCFVarOpdp1TgtPosL )
585                 {                                 585                 {
586                     var->addr = GetThreeVector    586                     var->addr = GetThreeVectorElementAddrByIndex(
587                         evSObject->targetTPOut    587                         evSObject->targetTPOutputParticleDecayProductParticle1.
588                                                   588                                                                 positionLocal,
589                         var->index1 );            589                         var->index1 );
590                     break;                        590                     break;
591                 }                                 591                 }
592                 if ( var->name == CexmcCFVarOp    592                 if ( var->name == CexmcCFVarOpdp1TgtPosW )
593                 {                                 593                 {
594                     var->addr = GetThreeVector    594                     var->addr = GetThreeVectorElementAddrByIndex(
595                         evSObject->targetTPOut    595                         evSObject->targetTPOutputParticleDecayProductParticle1.
596                                                   596                                                                 positionWorld,
597                         var->index1 );            597                         var->index1 );
598                     break;                        598                     break;
599                 }                                 599                 }
600                 if ( var->name == CexmcCFVarOp    600                 if ( var->name == CexmcCFVarOpdp1TgtDirL )
601                 {                                 601                 {
602                     var->addr = GetThreeVector    602                     var->addr = GetThreeVectorElementAddrByIndex(
603                         evSObject->targetTPOut    603                         evSObject->targetTPOutputParticleDecayProductParticle1.
604                                                   604                                                                 directionLocal,
605                         var->index1 );            605                         var->index1 );
606                     break;                        606                     break;
607                 }                                 607                 }
608                 if ( var->name == CexmcCFVarOp    608                 if ( var->name == CexmcCFVarOpdp1TgtDirW )
609                 {                                 609                 {
610                     var->addr = GetThreeVector    610                     var->addr = GetThreeVectorElementAddrByIndex(
611                         evSObject->targetTPOut    611                         evSObject->targetTPOutputParticleDecayProductParticle1.
612                                                   612                                                                 directionWorld,
613                         var->index1 );            613                         var->index1 );
614                     break;                        614                     break;
615                 }                                 615                 }
616                 if ( var->name == CexmcCFVarOp    616                 if ( var->name == CexmcCFVarOpdp1TgtMom )
617                 {                                 617                 {
618                     var->addr = &evSObject->      618                     var->addr = &evSObject->
619                         targetTPOutputParticle    619                         targetTPOutputParticleDecayProductParticle1.momentumAmp;
620                     break;                        620                     break;
621                 }                                 621                 }
622                 if ( var->name == CexmcCFVarOp    622                 if ( var->name == CexmcCFVarOpdp1TgtTid )
623                 {                                 623                 {
624                     var->addr = &evSObject->      624                     var->addr = &evSObject->
625                         targetTPOutputParticle    625                         targetTPOutputParticleDecayProductParticle1.trackId;
626                     break;                        626                     break;
627                 }                                 627                 }
628                 if ( var->name == CexmcCFVarOp    628                 if ( var->name == CexmcCFVarOpdp2TgtPosL )
629                 {                                 629                 {
630                     var->addr = GetThreeVector    630                     var->addr = GetThreeVectorElementAddrByIndex(
631                         evSObject->targetTPOut    631                         evSObject->targetTPOutputParticleDecayProductParticle2.
632                                                   632                                                                 positionLocal,
633                         var->index1 );            633                         var->index1 );
634                     break;                        634                     break;
635                 }                                 635                 }
636                 if ( var->name == CexmcCFVarOp    636                 if ( var->name == CexmcCFVarOpdp2TgtPosW )
637                 {                                 637                 {
638                     var->addr = GetThreeVector    638                     var->addr = GetThreeVectorElementAddrByIndex(
639                         evSObject->targetTPOut    639                         evSObject->targetTPOutputParticleDecayProductParticle2.
640                                                   640                                                                 positionWorld,
641                         var->index1 );            641                         var->index1 );
642                     break;                        642                     break;
643                 }                                 643                 }
644                 if ( var->name == CexmcCFVarOp    644                 if ( var->name == CexmcCFVarOpdp2TgtDirL )
645                 {                                 645                 {
646                     var->addr = GetThreeVector    646                     var->addr = GetThreeVectorElementAddrByIndex(
647                         evSObject->targetTPOut    647                         evSObject->targetTPOutputParticleDecayProductParticle2.
648                                                   648                                                                 directionLocal,
649                         var->index1 );            649                         var->index1 );
650                     break;                        650                     break;
651                 }                                 651                 }
652                 if ( var->name == CexmcCFVarOp    652                 if ( var->name == CexmcCFVarOpdp2TgtDirW )
653                 {                                 653                 {
654                     var->addr = GetThreeVector    654                     var->addr = GetThreeVectorElementAddrByIndex(
655                         evSObject->targetTPOut    655                         evSObject->targetTPOutputParticleDecayProductParticle2.
656                                                   656                                                                 directionWorld,
657                         var->index1 );            657                         var->index1 );
658                     break;                        658                     break;
659                 }                                 659                 }
660                 if ( var->name == CexmcCFVarOp    660                 if ( var->name == CexmcCFVarOpdp2TgtMom )
661                 {                                 661                 {
662                     var->addr = &evSObject->      662                     var->addr = &evSObject->
663                         targetTPOutputParticle    663                         targetTPOutputParticleDecayProductParticle2.momentumAmp;
664                     break;                        664                     break;
665                 }                                 665                 }
666                 if ( var->name == CexmcCFVarOp    666                 if ( var->name == CexmcCFVarOpdp2TgtTid )
667                 {                                 667                 {
668                     var->addr = &evSObject->      668                     var->addr = &evSObject->
669                         targetTPOutputParticle    669                         targetTPOutputParticleDecayProductParticle2.trackId;
670                     break;                        670                     break;
671                 }                                 671                 }
672                 if ( var->name == CexmcCFVarOp    672                 if ( var->name == CexmcCFVarOpdpVclPosL )
673                 {                                 673                 {
674                     var->addr = GetThreeVector    674                     var->addr = GetThreeVectorElementAddrByIndex(
675                             evSObject->vetoCou    675                             evSObject->vetoCounterTPLeft.positionLocal,
676                             var->index1 );        676                             var->index1 );
677                     break;                        677                     break;
678                 }                                 678                 }
679                 if ( var->name == CexmcCFVarOp    679                 if ( var->name == CexmcCFVarOpdpVclPosW )
680                 {                                 680                 {
681                     var->addr = GetThreeVector    681                     var->addr = GetThreeVectorElementAddrByIndex(
682                             evSObject->vetoCou    682                             evSObject->vetoCounterTPLeft.positionWorld,
683                             var->index1 );        683                             var->index1 );
684                     break;                        684                     break;
685                 }                                 685                 }
686                 if ( var->name == CexmcCFVarOp    686                 if ( var->name == CexmcCFVarOpdpVclDirL )
687                 {                                 687                 {
688                     var->addr = GetThreeVector    688                     var->addr = GetThreeVectorElementAddrByIndex(
689                             evSObject->vetoCou    689                             evSObject->vetoCounterTPLeft.directionLocal,
690                             var->index1 );        690                             var->index1 );
691                     break;                        691                     break;
692                 }                                 692                 }
693                 if ( var->name == CexmcCFVarOp    693                 if ( var->name == CexmcCFVarOpdpVclDirW )
694                 {                                 694                 {
695                     var->addr = GetThreeVector    695                     var->addr = GetThreeVectorElementAddrByIndex(
696                             evSObject->vetoCou    696                             evSObject->vetoCounterTPLeft.directionWorld,
697                             var->index1 );        697                             var->index1 );
698                     break;                        698                     break;
699                 }                                 699                 }
700                 if ( var->name == CexmcCFVarOp    700                 if ( var->name == CexmcCFVarOpdpVclMom )
701                 {                                 701                 {
702                     var->addr = &evSObject->ve    702                     var->addr = &evSObject->vetoCounterTPLeft.momentumAmp;
703                     break;                        703                     break;
704                 }                                 704                 }
705                 if ( var->name == CexmcCFVarOp    705                 if ( var->name == CexmcCFVarOpdpVclTid )
706                 {                                 706                 {
707                     var->addr = &evSObject->ve    707                     var->addr = &evSObject->vetoCounterTPLeft.trackId;
708                     break;                        708                     break;
709                 }                                 709                 }
710                 if ( var->name == CexmcCFVarOp    710                 if ( var->name == CexmcCFVarOpdpVcrPosL )
711                 {                                 711                 {
712                     var->addr = GetThreeVector    712                     var->addr = GetThreeVectorElementAddrByIndex(
713                             evSObject->vetoCou    713                             evSObject->vetoCounterTPRight.positionLocal,
714                             var->index1 );        714                             var->index1 );
715                     break;                        715                     break;
716                 }                                 716                 }
717                 if ( var->name == CexmcCFVarOp    717                 if ( var->name == CexmcCFVarOpdpVcrPosW )
718                 {                                 718                 {
719                     var->addr = GetThreeVector    719                     var->addr = GetThreeVectorElementAddrByIndex(
720                             evSObject->vetoCou    720                             evSObject->vetoCounterTPRight.positionWorld,
721                             var->index1 );        721                             var->index1 );
722                     break;                        722                     break;
723                 }                                 723                 }
724                 if ( var->name == CexmcCFVarOp    724                 if ( var->name == CexmcCFVarOpdpVcrDirL )
725                 {                                 725                 {
726                     var->addr = GetThreeVector    726                     var->addr = GetThreeVectorElementAddrByIndex(
727                             evSObject->vetoCou    727                             evSObject->vetoCounterTPRight.directionLocal,
728                             var->index1 );        728                             var->index1 );
729                     break;                        729                     break;
730                 }                                 730                 }
731                 if ( var->name == CexmcCFVarOp    731                 if ( var->name == CexmcCFVarOpdpVcrDirW )
732                 {                                 732                 {
733                     var->addr = GetThreeVector    733                     var->addr = GetThreeVectorElementAddrByIndex(
734                             evSObject->vetoCou    734                             evSObject->vetoCounterTPRight.directionWorld,
735                             var->index1 );        735                             var->index1 );
736                     break;                        736                     break;
737                 }                                 737                 }
738                 if ( var->name == CexmcCFVarOp    738                 if ( var->name == CexmcCFVarOpdpVcrMom )
739                 {                                 739                 {
740                     var->addr = &evSObject->ve    740                     var->addr = &evSObject->vetoCounterTPRight.momentumAmp;
741                     break;                        741                     break;
742                 }                                 742                 }
743                 if ( var->name == CexmcCFVarOp    743                 if ( var->name == CexmcCFVarOpdpVcrTid )
744                 {                                 744                 {
745                     var->addr = &evSObject->ve    745                     var->addr = &evSObject->vetoCounterTPRight.trackId;
746                     break;                        746                     break;
747                 }                                 747                 }
748                 if ( var->name == CexmcCFVarOp    748                 if ( var->name == CexmcCFVarOpdpClPosL )
749                 {                                 749                 {
750                     var->addr = GetThreeVector    750                     var->addr = GetThreeVectorElementAddrByIndex(
751                             evSObject->calorim    751                             evSObject->calorimeterTPLeft.positionLocal,
752                             var->index1 );        752                             var->index1 );
753                     break;                        753                     break;
754                 }                                 754                 }
755                 if ( var->name == CexmcCFVarOp    755                 if ( var->name == CexmcCFVarOpdpClPosW )
756                 {                                 756                 {
757                     var->addr = GetThreeVector    757                     var->addr = GetThreeVectorElementAddrByIndex(
758                             evSObject->calorim    758                             evSObject->calorimeterTPLeft.positionWorld,
759                             var->index1 );        759                             var->index1 );
760                     break;                        760                     break;
761                 }                                 761                 }
762                 if ( var->name == CexmcCFVarOp    762                 if ( var->name == CexmcCFVarOpdpClDirL )
763                 {                                 763                 {
764                     var->addr = GetThreeVector    764                     var->addr = GetThreeVectorElementAddrByIndex(
765                             evSObject->calorim    765                             evSObject->calorimeterTPLeft.directionLocal,
766                             var->index1 );        766                             var->index1 );
767                     break;                        767                     break;
768                 }                                 768                 }
769                 if ( var->name == CexmcCFVarOp    769                 if ( var->name == CexmcCFVarOpdpClDirW )
770                 {                                 770                 {
771                     var->addr = GetThreeVector    771                     var->addr = GetThreeVectorElementAddrByIndex(
772                             evSObject->calorim    772                             evSObject->calorimeterTPLeft.directionWorld,
773                             var->index1 );        773                             var->index1 );
774                     break;                        774                     break;
775                 }                                 775                 }
776                 if ( var->name == CexmcCFVarOp    776                 if ( var->name == CexmcCFVarOpdpClMom )
777                 {                                 777                 {
778                     var->addr = &evSObject->ca    778                     var->addr = &evSObject->calorimeterTPLeft.momentumAmp;
779                     break;                        779                     break;
780                 }                                 780                 }
781                 if ( var->name == CexmcCFVarOp    781                 if ( var->name == CexmcCFVarOpdpClTid )
782                 {                                 782                 {
783                     var->addr = &evSObject->ca    783                     var->addr = &evSObject->calorimeterTPLeft.trackId;
784                     break;                        784                     break;
785                 }                                 785                 }
786                 if ( var->name == CexmcCFVarOp    786                 if ( var->name == CexmcCFVarOpdpCrPosL )
787                 {                                 787                 {
788                     var->addr = GetThreeVector    788                     var->addr = GetThreeVectorElementAddrByIndex(
789                             evSObject->calorim    789                             evSObject->calorimeterTPRight.positionLocal,
790                             var->index1 );        790                             var->index1 );
791                     break;                        791                     break;
792                 }                                 792                 }
793                 if ( var->name == CexmcCFVarOp    793                 if ( var->name == CexmcCFVarOpdpCrPosW )
794                 {                                 794                 {
795                     var->addr = GetThreeVector    795                     var->addr = GetThreeVectorElementAddrByIndex(
796                             evSObject->calorim    796                             evSObject->calorimeterTPRight.positionWorld,
797                             var->index1 );        797                             var->index1 );
798                     break;                        798                     break;
799                 }                                 799                 }
800                 if ( var->name == CexmcCFVarOp    800                 if ( var->name == CexmcCFVarOpdpCrDirL )
801                 {                                 801                 {
802                     var->addr = GetThreeVector    802                     var->addr = GetThreeVectorElementAddrByIndex(
803                             evSObject->calorim    803                             evSObject->calorimeterTPRight.directionLocal,
804                             var->index1 );        804                             var->index1 );
805                     break;                        805                     break;
806                 }                                 806                 }
807                 if ( var->name == CexmcCFVarOp    807                 if ( var->name == CexmcCFVarOpdpCrDirW )
808                 {                                 808                 {
809                     var->addr = GetThreeVector    809                     var->addr = GetThreeVectorElementAddrByIndex(
810                             evSObject->calorim    810                             evSObject->calorimeterTPRight.directionWorld,
811                             var->index1 );        811                             var->index1 );
812                     break;                        812                     break;
813                 }                                 813                 }
814                 if ( var->name == CexmcCFVarOp    814                 if ( var->name == CexmcCFVarOpdpCrMom )
815                 {                                 815                 {
816                     var->addr = &evSObject->ca    816                     var->addr = &evSObject->calorimeterTPRight.momentumAmp;
817                     break;                        817                     break;
818                 }                                 818                 }
819                 if ( var->name == CexmcCFVarOp    819                 if ( var->name == CexmcCFVarOpdpCrTid )
820                 {                                 820                 {
821                     var->addr = &evSObject->ca    821                     var->addr = &evSObject->calorimeterTPRight.trackId;
822                     break;                        822                     break;
823                 }                                 823                 }
824                 if ( var->name == CexmcCFVarIp    824                 if ( var->name == CexmcCFVarIpSCM )
825                 {                                 825                 {
826                     var->addr = GetLorentzVect    826                     var->addr = GetLorentzVectorElementAddrByIndex(
827                         evSObject->productionM    827                         evSObject->productionModelData.incidentParticleSCM,
828                         var->index1 );            828                         var->index1 );
829                     break;                        829                     break;
830                 }                                 830                 }
831                 if ( var->name == CexmcCFVarIp    831                 if ( var->name == CexmcCFVarIpLAB )
832                 {                                 832                 {
833                     var->addr = GetLorentzVect    833                     var->addr = GetLorentzVectorElementAddrByIndex(
834                         evSObject->productionM    834                         evSObject->productionModelData.incidentParticleLAB,
835                         var->index1 );            835                         var->index1 );
836                     break;                        836                     break;
837                 }                                 837                 }
838                 if ( var->name == CexmcCFVarNp    838                 if ( var->name == CexmcCFVarNpSCM )
839                 {                                 839                 {
840                     var->addr = GetLorentzVect    840                     var->addr = GetLorentzVectorElementAddrByIndex(
841                         evSObject->productionM    841                         evSObject->productionModelData.nucleusParticleSCM,
842                         var->index1 );            842                         var->index1 );
843                     break;                        843                     break;
844                 }                                 844                 }
845                 if ( var->name == CexmcCFVarNp    845                 if ( var->name == CexmcCFVarNpLAB )
846                 {                                 846                 {
847                     var->addr = GetLorentzVect    847                     var->addr = GetLorentzVectorElementAddrByIndex(
848                         evSObject->productionM    848                         evSObject->productionModelData.nucleusParticleLAB,
849                         var->index1 );            849                         var->index1 );
850                     break;                        850                     break;
851                 }                                 851                 }
852                 if ( var->name == CexmcCFVarOp    852                 if ( var->name == CexmcCFVarOpSCM )
853                 {                                 853                 {
854                     var->addr = GetLorentzVect    854                     var->addr = GetLorentzVectorElementAddrByIndex(
855                         evSObject->productionM    855                         evSObject->productionModelData.outputParticleSCM,
856                         var->index1 );            856                         var->index1 );
857                     break;                        857                     break;
858                 }                                 858                 }
859                 if ( var->name == CexmcCFVarOp    859                 if ( var->name == CexmcCFVarOpLAB )
860                 {                                 860                 {
861                     var->addr = GetLorentzVect    861                     var->addr = GetLorentzVectorElementAddrByIndex(
862                         evSObject->productionM    862                         evSObject->productionModelData.outputParticleLAB,
863                         var->index1 );            863                         var->index1 );
864                     break;                        864                     break;
865                 }                                 865                 }
866                 if ( var->name == CexmcCFVarNo    866                 if ( var->name == CexmcCFVarNopSCM )
867                 {                                 867                 {
868                     var->addr = GetLorentzVect    868                     var->addr = GetLorentzVectorElementAddrByIndex(
869                         evSObject->productionM    869                         evSObject->productionModelData.nucleusOutputParticleSCM,
870                         var->index1 );            870                         var->index1 );
871                     break;                        871                     break;
872                 }                                 872                 }
873                 if ( var->name == CexmcCFVarNo    873                 if ( var->name == CexmcCFVarNopLAB )
874                 {                                 874                 {
875                     var->addr = GetLorentzVect    875                     var->addr = GetLorentzVectorElementAddrByIndex(
876                         evSObject->productionM    876                         evSObject->productionModelData.nucleusOutputParticleLAB,
877                         var->index1 );            877                         var->index1 );
878                     break;                        878                     break;
879                 }                                 879                 }
880                 if ( var->name == CexmcCFVarIp    880                 if ( var->name == CexmcCFVarIpId )
881                 {                                 881                 {
882                     var->addr =                   882                     var->addr =
883                         &evSObject->production    883                         &evSObject->productionModelData.incidentParticle;
884                     break;                        884                     break;
885                 }                                 885                 }
886                 if ( var->name == CexmcCFVarNp    886                 if ( var->name == CexmcCFVarNpId )
887                 {                                 887                 {
888                     var->addr = &evSObject->pr    888                     var->addr = &evSObject->productionModelData.nucleusParticle;
889                     break;                        889                     break;
890                 }                                 890                 }
891                 if ( var->name == CexmcCFVarOp    891                 if ( var->name == CexmcCFVarOpId )
892                 {                                 892                 {
893                     var->addr = &evSObject->pr    893                     var->addr = &evSObject->productionModelData.outputParticle;
894                     break;                        894                     break;
895                 }                                 895                 }
896                 if ( var->name == CexmcCFVarNo    896                 if ( var->name == CexmcCFVarNopId )
897                 {                                 897                 {
898                     var->addr =                   898                     var->addr =
899                         &evSObject->production    899                         &evSObject->productionModelData.nucleusOutputParticle;
900                     break;                        900                     break;
901                 }                                 901                 }
902                 if ( var->name == CexmcCFVarCo    902                 if ( var->name == CexmcCFVarConst_eV )
903                 {                                 903                 {
904                     var->addr = &constants[ 0     904                     var->addr = &constants[ 0 ];
905                     break;                        905                     break;
906                 }                                 906                 }
907                 if ( var->name == CexmcCFVarCo    907                 if ( var->name == CexmcCFVarConst_keV )
908                 {                                 908                 {
909                     var->addr = &constants[ 1     909                     var->addr = &constants[ 1 ];
910                     break;                        910                     break;
911                 }                                 911                 }
912                 if ( var->name == CexmcCFVarCo    912                 if ( var->name == CexmcCFVarConst_MeV )
913                 {                                 913                 {
914                     var->addr = &constants[ 2     914                     var->addr = &constants[ 2 ];
915                     break;                        915                     break;
916                 }                                 916                 }
917                 if ( var->name == CexmcCFVarCo    917                 if ( var->name == CexmcCFVarConst_GeV )
918                 {                                 918                 {
919                     var->addr = &constants[ 3     919                     var->addr = &constants[ 3 ];
920                     break;                        920                     break;
921                 }                                 921                 }
922                 if ( var->name == CexmcCFVarCo    922                 if ( var->name == CexmcCFVarConst_mm )
923                 {                                 923                 {
924                     var->addr = &constants[ 4     924                     var->addr = &constants[ 4 ];
925                     break;                        925                     break;
926                 }                                 926                 }
927                 if ( var->name == CexmcCFVarCo    927                 if ( var->name == CexmcCFVarConst_cm )
928                 {                                 928                 {
929                     var->addr = &constants[ 5     929                     var->addr = &constants[ 5 ];
930                     break;                        930                     break;
931                 }                                 931                 }
932                 if ( var->name == CexmcCFVarCo    932                 if ( var->name == CexmcCFVarConst_m )
933                 {                                 933                 {
934                     var->addr = &constants[ 6     934                     var->addr = &constants[ 6 ];
935                     break;                        935                     break;
936                 }                                 936                 }
937             } while ( false );                    937             } while ( false );
938         }                                         938         }
939     }                                             939     }
940 }                                                 940 }
941                                                   941 
942                                                   942 
943 void  CexmcASTEval::ResetAddressBinding( Cexmc    943 void  CexmcASTEval::ResetAddressBinding( CexmcAST::Subtree &  ast )
944 {                                                 944 {
945     for ( std::vector< CexmcAST::Node >::itera    945     for ( std::vector< CexmcAST::Node >::iterator  k( ast.children.begin() );
946                                                   946                                                   k != ast.children.end(); ++k )
947     {                                             947     {
948         CexmcAST::Subtree *  subtree( boost::g    948         CexmcAST::Subtree *  subtree( boost::get< CexmcAST::Subtree >( &*k ) );
949                                                   949 
950         if ( subtree )                            950         if ( subtree )
951         {                                         951         {
952             ResetAddressBinding( *subtree );      952             ResetAddressBinding( *subtree );
953         }                                         953         }
954         else                                      954         else
955         {                                         955         {
956             CexmcAST::Leaf &      leaf( boost:    956             CexmcAST::Leaf &      leaf( boost::get< CexmcAST::Leaf >( *k ) );
957             CexmcAST::Variable *  var( boost::    957             CexmcAST::Variable *  var( boost::get< CexmcAST::Variable >(
958                                                   958                                                                     &leaf ) );
959             if ( var )                            959             if ( var )
960                 var->addr = ( const int * ) NU    960                 var->addr = ( const int * ) NULL;
961         }                                         961         }
962     }                                             962     }
963 }                                                 963 }
964                                                   964 
965 #endif                                            965 #endif
966                                                   966 
967                                                   967