|
| 1 | +/* |
| 2 | + * include/physics/CORSIKAReaderGenerator.hh |
| 3 | + * |
| 4 | + * Copyright 2018 Brandon Gomes |
| 5 | + * |
| 6 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + * you may not use this file except in compliance with the License. |
| 8 | + * You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, software |
| 13 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + * See the License for the specific language governing permissions and |
| 16 | + * limitations under the License. |
| 17 | + */ |
| 18 | + |
| 19 | +#ifndef MU__PHYSICS_CORSIKA_READER_GENERATOR_HH |
| 20 | +#define MU__PHYSICS_CORSIKA_READER_GENERATOR_HH |
| 21 | +#pragma once |
| 22 | + |
| 23 | +#include "Generator.hh" |
| 24 | + |
| 25 | +namespace MATHUSLA { namespace MU { |
| 26 | + |
| 27 | +namespace Physics { //////////////////////////////////////////////////////////////////////////// |
| 28 | + |
| 29 | +//__CORSIKA Simulation Config Structure_________________________________________________________ |
| 30 | +struct CORSIKAConfig { |
| 31 | + int primary_id; |
| 32 | + double energy_slope, |
| 33 | + energy_min, |
| 34 | + energy_max, |
| 35 | + azimuth_min, |
| 36 | + azimuth_max, |
| 37 | + zenith_min, |
| 38 | + zenith_max; |
| 39 | +}; |
| 40 | +//---------------------------------------------------------------------------------------------- |
| 41 | + |
| 42 | +//__CORSIKA Simulation Event Structure__________________________________________________________ |
| 43 | +struct CORSIKAEvent { |
| 44 | + std::vector<int> id; |
| 45 | + std::vector<double> t, x, y, z, px, py, pz; |
| 46 | + bool empty() const; |
| 47 | + std::size_t size() const; |
| 48 | + void clear(); |
| 49 | + void reserve(std::size_t capacity); |
| 50 | + void push_back(int new_id, |
| 51 | + double new_t, |
| 52 | + double new_x, |
| 53 | + double new_y, |
| 54 | + double new_z, |
| 55 | + double new_px, |
| 56 | + double new_py, |
| 57 | + double new_pz); |
| 58 | + const Particle operator[](const std::size_t index) const; |
| 59 | +}; |
| 60 | +//---------------------------------------------------------------------------------------------- |
| 61 | + |
| 62 | +//__CORSIKA Simulation Event Vector_____________________________________________________________ |
| 63 | +using CORSIKAEventVector = std::vector<CORSIKAEvent>; |
| 64 | +//---------------------------------------------------------------------------------------------- |
| 65 | + |
| 66 | +//__CORSIKA Simulation Generator________________________________________________________________ |
| 67 | +class CORSIKAReaderGenerator : public Generator { |
| 68 | +public: |
| 69 | + CORSIKAReaderGenerator(); |
| 70 | + |
| 71 | + void GeneratePrimaryVertex(G4Event* event); |
| 72 | + void SetNewValue(G4UIcommand* command, |
| 73 | + G4String value); |
| 74 | + void SetFile(const std::string& path); |
| 75 | + |
| 76 | + virtual const Analysis::SimSettingList GetSpecification() const; |
| 77 | + |
| 78 | +private: |
| 79 | + static G4ThreadLocal CORSIKAEventVector* _data; |
| 80 | + static G4ThreadLocal std::size_t _data_index; |
| 81 | + CORSIKAConfig _config; |
| 82 | + std::string _path; |
| 83 | + Command::StringArg* _read_file; |
| 84 | + // TODO: Command::StringArg* _read_directory; |
| 85 | +}; |
| 86 | +//---------------------------------------------------------------------------------------------- |
| 87 | + |
| 88 | +} /* namespace Physics */ ////////////////////////////////////////////////////////////////////// |
| 89 | + |
| 90 | +} } /* namespace MATHUSLA::MU */ |
| 91 | + |
| 92 | +#endif /* MU__PHYSICS_CORSIKA_READER_GENERATOR_HH */ |
0 commit comments