source: trunk/MagicSoft/Mars/mpointing/MSrcPosRndm.cc@ 7687

Last change on this file since 7687 was 7565, checked in by tbretz, 19 years ago
*** empty log message ***
File size: 2.4 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, 3/2006 <mailto:tbretz@astro.uni-wuerzburg.de>
19!
20! Copyright: MAGIC Software Development, 2006
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26//
27// MSrcPosRndm
28//
29// Input Container:
30// MHSrcPosCam
31//
32// Output Container:
33// MSrcPosCam
34//
35/////////////////////////////////////////////////////////////////////////////
36#include "MSrcPosRndm.h"
37
38#include "MLog.h"
39#include "MLogManip.h"
40
41#include "MParList.h"
42
43#include "MGeomCam.h"
44#include "MSrcPosCam.h"
45#include "MHSrcPosCam.h"
46
47ClassImp(MSrcPosRndm);
48
49using namespace std;
50
51// --------------------------------------------------------------------------
52//
53// Search for 'MPointingPos'. Create if not found.
54//
55Int_t MSrcPosRndm::PreProcess(MParList *plist)
56{
57 MGeomCam *geom = (MGeomCam*)plist->FindObject("MGeomCam");
58 if (!geom)
59 {
60 *fLog << err << "ERROR - MGeomCam not found... aborting." << endl;
61 return kFALSE;
62 }
63
64 fSrcPos = (MSrcPosCam*)plist->FindCreateObj("MSrcPosCam");
65 if (!fSrcPos)
66 return kFALSE;
67
68 fHist = (MHSrcPosCam*)plist->FindObject("MHSrcPosCam");
69 if (!fHist)
70 {
71 *fLog << inf << "MHSrcPosCam not found... skipping." << endl;
72 return kSKIP;
73 }
74
75 *fLog << inf << "MHSrcPosCam found... taken to produce a random distribution." << endl;
76
77 fConvMm2Deg = geom->GetConvMm2Deg();
78
79 return kTRUE;
80}
81
82// --------------------------------------------------------------------------
83//
84// See class description.
85//
86Int_t MSrcPosRndm::Process()
87{
88 Axis_t x, y;
89
90 fHist->GetHist().GetRandom2(x, y);
91
92 fSrcPos->SetXY(x/fConvMm2Deg, y/fConvMm2Deg);
93
94 return kTRUE;
95}
Note: See TracBrowser for help on using the repository browser.