| 1 | /* ======================================================================== *\
|
|---|
| 2 | !
|
|---|
| 3 | ! *
|
|---|
| 4 | ! * This file is part of MARS, the MAGIC Analysis and Reconstruction
|
|---|
| 5 | ! * Software. It is distributed to you in the hope that it can be a useful
|
|---|
| 6 | ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
|
|---|
| 7 | ! * It is distributed WITHOUT ANY WARRANTY.
|
|---|
| 8 | ! *
|
|---|
| 9 | ! * Permission to use, copy, modify and distribute this software and its
|
|---|
| 10 | ! * documentation for any purpose is hereby granted without fee,
|
|---|
| 11 | ! * provided that the above copyright notice appear in all copies and
|
|---|
| 12 | ! * that both that copyright notice and this permission notice appear
|
|---|
| 13 | ! * in supporting documentation. It is provided "as is" without express
|
|---|
| 14 | ! * or implied warranty.
|
|---|
| 15 | ! *
|
|---|
| 16 | !
|
|---|
| 17 | !
|
|---|
| 18 | ! Author(s): Harald Kornmayer 1/2001 (harald@mppmu.mpg.de)
|
|---|
| 19 | ! Author(s): Thomas Bretz 12/2000 (tbretz@uni-sw.gwdg.de)
|
|---|
| 20 | !
|
|---|
| 21 | ! Copyright: MAGIC Software Development, 2000-2001
|
|---|
| 22 | !
|
|---|
| 23 | !
|
|---|
| 24 | \* ======================================================================== */
|
|---|
| 25 |
|
|---|
| 26 | //////////////////////////////////////////////////////////////////////////////
|
|---|
| 27 | // //
|
|---|
| 28 | // //
|
|---|
| 29 | //////////////////////////////////////////////////////////////////////////////
|
|---|
| 30 | #include "MGenPrimaryParticle.h"
|
|---|
| 31 |
|
|---|
| 32 | #include <TMath.h>
|
|---|
| 33 | #include <TF1.h>
|
|---|
| 34 |
|
|---|
| 35 | #include "MParList.h"
|
|---|
| 36 | #include "MParticle.h"
|
|---|
| 37 |
|
|---|
| 38 | ClassImp(MGenPrimaryParticle);
|
|---|
| 39 |
|
|---|
| 40 | Double_t PowerLaw(Double_t *x, Double_t *k)
|
|---|
| 41 | {
|
|---|
| 42 | return 1/x[0];
|
|---|
| 43 | }
|
|---|
| 44 |
|
|---|
| 45 | // --------------------------------------------------------------------------
|
|---|
| 46 | MGenPrimaryParticle::MGenPrimaryParticle(const char *name, const char *title)
|
|---|
| 47 | : fPi2(TMath::Pi()*2)
|
|---|
| 48 | {
|
|---|
| 49 | fName = name ? name : "MGenPrimaryParticle";
|
|---|
| 50 | fTitle = title ? title : "";
|
|---|
| 51 |
|
|---|
| 52 | fSrc = new TF1("Power-Law", PowerLaw, 10, 1e8, 0); // 10GeV-100PeV
|
|---|
| 53 | }
|
|---|
| 54 |
|
|---|
| 55 | MGenPrimaryParticle::~MGenPrimaryParticle()
|
|---|
| 56 | {
|
|---|
| 57 | delete fSrc;
|
|---|
| 58 | }
|
|---|
| 59 |
|
|---|
| 60 | // --------------------------------------------------------------------------
|
|---|
| 61 | Bool_t MGenPrimaryParticle::PreProcess(MParList *pList)
|
|---|
| 62 | {
|
|---|
| 63 | fList = (MParList*)pList->FindCreateObj("MParticleList");
|
|---|
| 64 | if (!fList)
|
|---|
| 65 | return kFALSE;
|
|---|
| 66 |
|
|---|
| 67 | return kTRUE;
|
|---|
| 68 | }
|
|---|
| 69 |
|
|---|
| 70 | // --------------------------------------------------------------------------
|
|---|
| 71 | Bool_t MGenPrimaryParticle::Process()
|
|---|
| 72 | {
|
|---|
| 73 | // MParticle *p = new MParticle(MParticle::kEGamma);
|
|---|
| 74 | // p->SetEnergy(fSrc->GetRandom());
|
|---|
| 75 | return kTRUE;
|
|---|
| 76 | }
|
|---|
| 77 |
|
|---|
| 78 | Bool_t MGenPrimaryParticle::PostProcess()
|
|---|
| 79 | {
|
|---|
| 80 | return kTRUE;
|
|---|
| 81 | }
|
|---|