TauolaParticlePair.h

00001 #ifndef _TauolaParticlePair_h_included_
00002 #define _TauolaParticlePair_h_included_
00003 
00004 /**
00005  * @class TauolaParticlePair
00006  *
00007  * @brief Contains two TauolaParticle that are related by 
00008  * the same mother. Spin correlations are handled here.
00009  *
00010  * An object of TauolaParticlePair contains two TauolaParticle
00011  * that are related by the same mother. Generally this will be
00012  * a tau+ and tau- or a tau and tau neutrino. For the case of
00013  * event records that contain multiple instances of the same 
00014  * particle. eg. tau -> gamma tau or simply tau -> tau. Both
00015  * the tau from the production vertex, and the final tau before
00016  * the decay vertex are stored. This allows better handling
00017  * of spin correlations. The decay is done in the rest frame of 
00018  * the final tau, where as the spin weight is calculated in the
00019  * rest frame of the production tau. All spin weights are done
00020  * in this class. Please refer to the decayTauPairs() method.
00021  *
00022  * @author Nadia Davidson
00023  * @date 17 June 2008
00024  */
00025 
00026 
00027 #include <iostream>
00028 #include <vector>
00029 #include <math.h>
00030 #include "TauolaParticle.h"
00031 
00032 namespace Tauolapp
00033 {
00034 
00035 class TauolaParticlePair{
00036 
00037  public:
00038 
00039   //needed to access m_R matrix and recalculateRij() function.
00040   friend class Plots;
00041 
00042   /** This constructor takes the TauolaParticle and traverse
00043       the event structure to find the mother, partner tau or tau 
00044       neutrino and assosiated final and production versions.
00045       Once a TauolaParticlePair object has been created in this way
00046       it is ready to be decayed via decayTauPairs(). */
00047   TauolaParticlePair(std::vector<TauolaParticle*> &particle_list);
00048 
00049   /** Call the decay method of each 'final' tau. Then calculate
00050       the spin correlation weight from the particles polarimetric 
00051       vectors. Decays are accepted or rejected based on the spin 
00052       weight. Rejected decays are redecayed. */
00053   void decayTauPair();
00054 
00055   /** Does this pair contain the particle "particle". Note: it only
00056    checks the "final" particles. */
00057   bool contains(TauolaParticle * particle);
00058 
00059   /** Return the tau+ particle */
00060   TauolaParticle * getTauPlus(std::vector<TauolaParticle*> particles);
00061 
00062   /** Return the tau- particle */
00063   TauolaParticle * getTauMinus(std::vector<TauolaParticle*> particles);
00064 
00065   /** Return the first grandmother of the tau-
00066       which is an anti-quark or anti-lepton. */
00067   TauolaParticle * getGrandmotherPlus(std::vector<TauolaParticle*> particles);
00068 
00069   /** Return the first grandmother of the tau-
00070       which is a quark or lepton. */
00071   TauolaParticle * getGrandmotherMinus(std::vector<TauolaParticle*> particles);
00072 
00073   /** Print information about the mother and tau pair (at production and final). */
00074   void print();
00075 
00076   /** Check that the 4 momentum in conserved at the verticle of
00077       each decayed tau. */
00078   void checkMomentumConservation();
00079 
00080  private:
00081 
00082   /** Default constructor is private, so that only friend class can use it. */
00083   TauolaParticlePair() {}
00084 
00085   /** Store born variables in Tauola class, so the user can retrieve
00086       them using Tauola::getBornKinematics. */
00087   static void setBornKinematics(int  incoming_pdg_id, int  outgoing_pdg_id, double  invariant_mass_squared, double  cosTheta);
00088 
00089   /** Pointers to taus (or tau and neutrino) as they
00090       are before being decayed. */
00091   std::vector<TauolaParticle*> m_final_particles;
00092   
00093   /** Pointers to taus (or tau and neutrino) as they
00094       are after production. */
00095   std::vector<TauolaParticle*> m_production_particles;
00096   
00097   /** Pointer to mothers of the tau pair. */  
00098   TauolaParticle* m_mother;
00099 
00100   /** Is there an entry in the event record for the tau pair's mother? */  
00101   bool m_mother_exists;
00102   
00103   /** vector of pointers to the taus grandparents */
00104   std::vector<TauolaParticle*> m_grandmothers;
00105 
00106   /** If SANC tables are present, use them to recalculate the matrix Rij. */
00107   void recalculateRij(int incoming_pdg_id, int outgoing_pdg_id, double invariant_mass_squared, double cosTheta);
00108 
00109   /** Rotate the whole system using the given angle theta. */
00110   void rotateSystem(vector<TauolaParticle *> grandmothers,
00111                     vector<TauolaParticle *> taus,
00112                     double theta,
00113                     int axis, 
00114                     int axis2=TauolaParticle::Z_AXIS);
00115 
00116 
00117   /** Boost the outgoing tau and partner and the incoming grandparents of
00118       the tau to the mothers rest frame. The mother is not boosted.
00119       The axis are rotated so that the particle given by "z_axis_particle" is aligned
00120       on the z-axis. If "alignment" is -1 is will be aligned in the negative z direction.
00121       otherwise it is aligned in the positive direction. rotaion_angle(1-3) are
00122       returned to allow reversal of the transformation (through the method 
00123       boostFromMotherToLabFrame).*/
00124   void boostFromLabToTauPairFrame(double * rotation_angle1, 
00125                                   double * rotation_angle2,
00126                                   double * rotation_angle3,
00127                                   TauolaParticle * mother,
00128                                   vector<TauolaParticle *> grandmothers,
00129                                   vector<TauolaParticle *> taus);
00130 
00131   /** Reverses the transformation of boostFromLabToMothersFrame. **/
00132   void boostFromTauPairToLabFrame(double rotation_angle1, 
00133                                   double rotation_angle2,
00134                                   double rotation_angle3,
00135                                   TauolaParticle * mother,
00136                                   vector<TauolaParticle *> grandmothers,
00137                                   vector<TauolaParticle *> taus);
00138     
00139   /** The density matric m_R is filled based on the mothers type and kinematics
00140       of the event in the mothers rest frame. */
00141   void initializeDensityMatrix();
00142 
00143   /** create a particle which m_mother points to. This is based on the
00144       daughters 4-momentum and particle type. A Z or W is assumed if the
00145       configuration of taus and neutrinos is correct. This particle is not
00146       written into the event record, but it used by the fillDenistyMatrix
00147       method for spin correlations */
00148   TauolaParticle * makeTemporaryMother(vector<TauolaParticle *> taus);
00149 
00150   /**Needs to be changed*/
00151   //void ANGULU(int *IDE, int *IDF, double *SVAR, double *COSTHE);
00152   /**Needs to be changed*/
00153   double getZPolarization(int *incoming_pdg_id,
00154                           int *outgoing_pdg_id, 
00155                           double *invMass,
00156                           double *cosTheta);
00157 
00158   /** Private function, calculates virtuality between two particles. */
00159   double getVirtuality(TauolaParticle * p1, TauolaParticle*p2, bool flip);
00160 
00161   /** Add particle to beam. */
00162   void addToBeam(TauolaParticle * pcle,
00163                  std::vector<TauolaParticle*> * candidates_same,
00164                  std::vector<TauolaParticle*> * candidates_opp);
00165     
00166 
00167  /** frames in which it is defined are fixed by the methods 
00168       boostFromLabToMotherFrame and boostFromMotherToLabFrame.
00169       Modification to m_R and boostFrom/ToMotherFrame must be done
00170       coherently. */
00171   double m_R[4][4]; //density matrix
00172 };
00173 
00174 //Temporary
00175 //Pz is still calculated using the FORTRAN routine in tauola_extra.f
00176 //This should be migrated to C++ at some stage.
00177 extern "C" {
00178   extern double plzap0_(int *incoming_pdg_id,
00179                         int *outgoing_pdg_id, 
00180                         double *invMass,
00181                         double *cosTheta);
00182 }
00183 
00184 } // namespace Tauolapp
00185 #endif  
00186 
Generated on Sun Oct 20 20:24:11 2013 for C++InterfacetoTauola by  doxygen 1.6.3