Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-06-17 07:07:01

0001 ///////////////////////////////////////////////////////////////////////////
0002 //
0003 //    Copyright 2017
0004 //
0005 //    This file is part of estarlight.
0006 //
0007 //    starlight is free software: you can redistribute it and/or modify
0008 //    it under the terms of the GNU General Public License as published by
0009 //    the Free Software Foundation, either version 3 of the License, or
0010 //    (at your option) any later version.
0011 //
0012 //    starlight is distributed in the hope that it will be useful,
0013 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
0014 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0015 //    GNU General Public License for more details.
0016 //
0017 //    You should have received a copy of the GNU General Public License
0018 //    along with starlight. If not, see <http://www.gnu.org/licenses/>.
0019 //
0020 ///////////////////////////////////////////////////////////////////////////
0021 //
0022 // File and Version Information:
0023 // $Rev:: 263                         $: revision of last commit
0024 // $Author:: mlomnitz                  $: author of last commit
0025 // $Date:: 02/28/2017 #$: date of last commit
0026 //
0027 // Description:
0028 //
0029 // Container for eX eventrs
0030 //
0031 //
0032 ///////////////////////////////////////////////////////////////////////////
0033 
0034 
0035 #include "eXevent.h"
0036 
0037 
0038 eXEvent::eXEvent() :
0039         _particles(0)
0040         ,_vertices(0)
0041 { }
0042 
0043 eXEvent::eXEvent(starlightConstants::event &ev) :
0044         _particles(0)
0045         ,_vertices(0)
0046 {
0047   for(int i = 0; i < ev._numberOfTracks; i++)
0048     {
0049       starlightParticle p(
0050               ev.px[i], 
0051               ev.py[i], 
0052               ev.pz[i], 
0053               starlightConstants::UNKNOWN, 
0054               starlightConstants::UNKNOWN, 
0055               ev._fsParticle[i],
0056               ev._charge[i]
0057               );
0058       addParticle(p);
0059     }
0060 }
0061 
0062 eXEvent::~eXEvent()
0063 { }
0064 
0065 
0066 eXEvent& eXEvent::operator=(const eXEvent& rhs)
0067 {
0068 
0069   if(this != &rhs)
0070   {
0071     this->_particles = rhs._particles;
0072     this->_vertices = rhs._vertices;
0073     this->_gammaEnergies = rhs._gammaEnergies;
0074     this->_sources = rhs._sources;
0075     this->_target = rhs._target;
0076     this->_vertext = rhs._vertext;
0077   }
0078   return *this;
0079 }
0080 
0081 eXEvent& eXEvent::operator+(const eXEvent& ev)
0082 {
0083   for(unsigned int n = 0; n < ev._particles.size(); n++)
0084   {
0085     this->_particles.push_back(ev._particles.at(n));
0086   }
0087   for(unsigned int n = 0; n < ev._vertices.size(); n++)
0088   {
0089     this->_vertices.push_back(ev._vertices.at(n));
0090   }
0091  for(unsigned int n = 0; n < ev._gammaEnergies.size(); n++)
0092   {
0093     this->_gammaEnergies.push_back(ev._gammaEnergies.at(n));
0094   }
0095  for(unsigned int n = 0; n<ev._sources.size(); ++n){
0096    this->_sources.push_back(ev._sources.at(n));
0097  }
0098  for(unsigned int n = 0; n<ev._target.size(); ++n){
0099    this->_target.push_back(ev._target.at(n));
0100  }
0101  for(unsigned int n = 0; n<ev._vertext.size(); ++n){
0102    this->_vertext.push_back(ev._vertext.at(n));
0103  }
0104   return *this;
0105 }
0106 
0107 void eXEvent::boost(double rapidity, double e_rapidity)
0108 {
0109     vector3 boostVector(0, 0, tanh(rapidity));
0110     vector3 electron_boostVector(0, 0, tanh(e_rapidity));
0111     //
0112     std::vector<starlightParticle>::iterator part = _particles.begin();
0113       
0114     for (part = _particles.begin(); part != _particles.end(); part++)
0115     {
0116       (*part).Boost(boostVector);
0117     }
0118     std::vector<lorentzVector>::iterator ele = _sources.begin();
0119     for( ele = _sources.begin(); ele != _sources.end(); ++ele){
0120       (*ele).Boost(electron_boostVector);
0121     }
0122     std::vector<lorentzVector>::iterator target = _target.begin();
0123     for( target = _target.begin(); target != _target.end(); ++target){
0124       (*target).Boost(boostVector);
0125     }
0126 }
0127 
0128 void eXEvent::reflect()
0129 {
0130   //Flip decay leptons
0131   std::vector<starlightParticle>::iterator part = _particles.begin();
0132   
0133   for (part = _particles.begin(); part != _particles.end(); part++)
0134     {
0135       lorentzVector v = (*part).getVertex();
0136       (*part).reflect();
0137     }
0138   
0139   //Flip gamma
0140   _gamma[0].reflect();
0141   
0142   //Flip outgoing electron
0143   _sources[0].reflect();
0144 
0145   //Flip target
0146   _target[0].reflect();
0147     
0148 }