|
| 1 | +// Copyright CERN and copyright holders of ALICE O2. This software is |
| 2 | +// distributed under the terms of the GNU General Public License v3 (GPL |
| 3 | +// Version 3), copied verbatim in the file "COPYING". |
| 4 | +// |
| 5 | +// See https://alice-o2.web.cern.ch/ for full licensing information. |
| 6 | +// |
| 7 | +// In applying this license CERN does not waive the privileges and immunities |
| 8 | +// granted to it by virtue of its status as an Intergovernmental Organization |
| 9 | +// or submit itself to any jurisdiction. |
| 10 | + |
| 11 | +/// \author R+Preghenella - August 2017 |
| 12 | + |
| 13 | +#ifndef ALICEO2_EVENTGEN_GENERATOR_H_ |
| 14 | +#define ALICEO2_EVENTGEN_GENERATOR_H_ |
| 15 | + |
| 16 | +#include "FairGenerator.h" |
| 17 | +#include <vector> |
| 18 | +#include <array> |
| 19 | + |
| 20 | +namespace o2 |
| 21 | +{ |
| 22 | +namespace eventgen |
| 23 | +{ |
| 24 | +// this class implements a generic FairGenerator extension |
| 25 | +// that provides a base class for the ALICEo2 simulation needs |
| 26 | +// such that different interfaces to the event generators |
| 27 | +// (i.e. TGenerator, HEPdata reader) can be implemented |
| 28 | +// according to a common protocol |
| 29 | +class Generator : public FairGenerator |
| 30 | +{ |
| 31 | + |
| 32 | + public: |
| 33 | + /** default constructor **/ |
| 34 | + Generator(); |
| 35 | + /** constructor **/ |
| 36 | + Generator(const Char_t* name, const Char_t* title = "ALICEo2 Generator"); |
| 37 | + /** destructor **/ |
| 38 | + virtual ~Generator() = default; |
| 39 | + |
| 40 | + /** Abstract method ReadEvent must be implemented by any derived class. |
| 41 | + It has to handle the generation of input tracks (reading from input |
| 42 | + file) and the handing of the tracks to the FairPrimaryGenerator. I |
| 43 | + t is called from FairMCApplication. |
| 44 | + *@param pStack The stack |
| 45 | + *@return kTRUE if successful, kFALSE if not |
| 46 | + **/ |
| 47 | + Bool_t ReadEvent(FairPrimaryGenerator* primGen) override; |
| 48 | + |
| 49 | + /** setters **/ |
| 50 | + void setMomentumUnit(double val) { mMomentumUnit = val; }; |
| 51 | + void setEnergyUnit(double val) { mEnergyUnit = val; }; |
| 52 | + void setPositionUnit(double val) { mPositionUnit = val; }; |
| 53 | + void setTimeUnit(double val) { mTimeUnit = val; }; |
| 54 | + void setBoost(Double_t val) { mBoost = val; }; |
| 55 | + |
| 56 | + protected: |
| 57 | + /** copy constructor **/ |
| 58 | + Generator(const Generator&); |
| 59 | + /** operator= **/ |
| 60 | + Generator& operator=(const Generator&); |
| 61 | + |
| 62 | + /** methods to override **/ |
| 63 | + virtual Bool_t generateEvent() = 0; |
| 64 | + virtual Bool_t boostEvent(Double_t boost) = 0; |
| 65 | + virtual Bool_t addTracks(FairPrimaryGenerator* primGen) const = 0; |
| 66 | + |
| 67 | + /** conversion data members **/ |
| 68 | + double mMomentumUnit = 1.; // [GeV/c] |
| 69 | + double mEnergyUnit = 1.; // [GeV/c] |
| 70 | + double mPositionUnit = 0.1; // [cm] |
| 71 | + double mTimeUnit = 3.3356410e-12; // [s] |
| 72 | + |
| 73 | + /** lorentz boost data members **/ |
| 74 | + Double_t mBoost; |
| 75 | + |
| 76 | + ClassDefOverride(Generator, 1); |
| 77 | + |
| 78 | +}; /** class Generator **/ |
| 79 | + |
| 80 | +/*****************************************************************/ |
| 81 | +/*****************************************************************/ |
| 82 | + |
| 83 | +} // namespace eventgen |
| 84 | +} // namespace o2 |
| 85 | + |
| 86 | +#endif /* ALICEO2_EVENTGEN_GENERATOR_H_ */ |
0 commit comments