code/include/NewWave/RasterisedEvent.hh
Go to the documentation of this file.
00001 #ifndef NEWWAVE_RASTERISED_EVENT_HH 00002 #define NEWWAVE_RASTERISED_EVENT_HH 00003 00004 #include "NewWave/PixelDefinition.hh" 00005 #include "NewWave/MomentumHelpers.hh" 00006 00007 namespace HepMC{ 00008 class GenEvent; 00009 } 00010 00011 namespace NewWave { 00012 00013 using std::size_t; 00014 00016 template<typename T> 00017 class RasterisedEvent{ 00018 00019 public: 00021 00028 RasterisedEvent(const T &inputParticles, 00029 const PixelDefinition &pixelDefn): 00030 _pixelDefn(pixelDefn), 00031 _pixels(pixelDefn.makeEmptyPixelArray()), 00032 _input(T()){ 00033 00034 for(auto p: inputParticles){ 00035 if(_pixelDefn.covers(rapidity(p), phi(p) ) ){ 00036 addParticle(p); 00037 } 00038 } 00039 } 00040 00042 00046 RasterisedEvent(const PixelArray &pixelArray, 00047 const PixelDefinition &pixelDefn): 00048 _pixelDefn(pixelDefn), 00049 _pixels(pixelArray){} 00050 00051 const T &inputParticles()const{return _input;} 00052 00053 00055 00058 const PixelArray &pixels()const{return _pixels;} 00059 00061 00064 const PixelDefinition &pixelDefinition()const{return _pixelDefn;} 00065 00066 private: 00067 00068 PixelDefinition _pixelDefn; 00069 PixelArray _pixels; 00070 00071 T _input; 00072 00073 // void fillFromHepMC(const HepMC::GenEvent *event); 00074 00075 void addParticle(double rapidity, double phi, double pT){ 00076 size_t ybin = _pixelDefn.yPixelIndex(rapidity); 00077 size_t phiBin = _pixelDefn.phiPixelIndex(phi); 00078 _pixels[ybin][phiBin] += pT; 00079 } 00080 00081 template<typename P> 00082 void addParticle(const P &particle){ 00083 _input.push_back(particle); 00084 addParticle(rapidity(particle), 00085 phi(particle), 00086 pT(particle)); 00087 } 00088 00089 }; 00090 00092 00098 template<> 00099 RasterisedEvent<HepMC::GenEvent*>::RasterisedEvent(HepMC::GenEvent* const &event, 00100 const PixelDefinition &pixelDefn); 00101 00102 } 00103 00104 #endif Generated on Wed Aug 23 2017 12:59:15 for New Wave - Noise Elimination With Wavelets At Vast Energies by 1.7.6.1 |