source: trunk/MagicSoft/Mars/mmontecarlo/MMcTimeGenerate.cc@ 2687

Last change on this file since 2687 was 2604, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 2.5 KB
Line 
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): Thomas Bretz, 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
19! Author(s): Harald Kornmayer 1/2001
20!
21! Copyright: MAGIC Software Development, 2000-2001
22!
23!
24\* ======================================================================== */
25
26#include "MMcTimeGenerate.h"
27
28#include "MLog.h"
29#include "MLogManip.h"
30
31#include "MParList.h"
32#include "MTime.h"
33
34ClassImp(MMcTimeGenerate);
35
36// --------------------------------------------------------------------------
37//
38MMcTimeGenerate::MMcTimeGenerate(const char *name, const char *title)
39{
40 fName = name ? name : "MMcTimeGenerate";
41 fTitle = title ? title : "Task to generate a random event time";
42
43 const Double_t lambda = 100; // [Hz]
44
45 fFunc = new TF1("Poisson", "[0] * exp(-[0]*x)", 0, 1);
46 fFunc->SetParameter(0, lambda);
47
48 fDeadTime = 0.1/lambda;
49}
50
51MMcTimeGenerate::~MMcTimeGenerate()
52{
53 delete fFunc;
54}
55
56
57// --------------------------------------------------------------------------
58//
59// The PreProcess connects the raw data with this task. It checks if the
60// input containers exist, if not a kFalse flag is returned. It also checks
61// if the output contaniers exist, if not they are created.
62// This task can read either Montecarlo files with multiple trigger
63// options, either Montecarlo files with a single trigger option.
64//
65Int_t MMcTimeGenerate::PreProcess (MParList *pList)
66{
67 // connect the raw data with this task
68
69 fTime = (MTime*)pList->FindCreateObj("MTime");
70 if (!fTime)
71 return kFALSE;
72
73 return kTRUE;
74}
75
76// --------------------------------------------------------------------------
77//
78//
79Int_t MMcTimeGenerate::Process()
80{
81 Double_t dt;
82
83 do dt = fFunc->GetRandom();
84 while (dt < fDeadTime);
85
86#warning SetTime not valid anymore!
87// fTime->SetTime(*fTime+dt/1e4); // [0.1ms]
88
89 return kTRUE;
90}
Note: See TracBrowser for help on using the repository browser.