1 | /* ======================================================================== *\
|
---|
2 | !
|
---|
3 | ! *
|
---|
4 | ! * This file is part of CheObs, the Modular 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 appears 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, 1/2009 <mailto:tbretz@astro.uni-wuerzburg.de>
|
---|
19 | !
|
---|
20 | ! Copyright: CheObs Software Development, 2000-2009
|
---|
21 | !
|
---|
22 | !
|
---|
23 | \* ======================================================================== */
|
---|
24 |
|
---|
25 | //////////////////////////////////////////////////////////////////////////////
|
---|
26 | //
|
---|
27 | // MSimPointingPos
|
---|
28 | //
|
---|
29 | // This task is meant to simulate the pointing position (mirror orientation).
|
---|
30 | // This depends on the direction from which the shower is coming but also
|
---|
31 | // on the user request (e.g. Wobble mode).
|
---|
32 | //
|
---|
33 | // WARNING: Currently the telescope orientation is just fixed to the
|
---|
34 | // direction in the run-header (if a view cone was given) or
|
---|
35 | // the direction in the evt-header (if no view cone given)
|
---|
36 | //
|
---|
37 | // Input Containers:
|
---|
38 | // MCorsikaRunHeader
|
---|
39 | // MCorsikaEvtHeader
|
---|
40 | //
|
---|
41 | // Output Containers:
|
---|
42 | // MPointingPos
|
---|
43 | //
|
---|
44 | //////////////////////////////////////////////////////////////////////////////
|
---|
45 | #include "MSimPointingPos.h"
|
---|
46 |
|
---|
47 | #include "MLog.h"
|
---|
48 | #include "MLogManip.h"
|
---|
49 |
|
---|
50 | #include "MParList.h"
|
---|
51 |
|
---|
52 | #include "MCorsikaEvtHeader.h"
|
---|
53 | #include "MCorsikaRunHeader.h"
|
---|
54 |
|
---|
55 | #include "MPointingPos.h"
|
---|
56 |
|
---|
57 | ClassImp(MSimPointingPos);
|
---|
58 |
|
---|
59 | using namespace std;
|
---|
60 |
|
---|
61 | // --------------------------------------------------------------------------
|
---|
62 | //
|
---|
63 | // Default Constructor.
|
---|
64 | //
|
---|
65 | MSimPointingPos::MSimPointingPos(const char* name, const char *title)
|
---|
66 | : fRunHeader(0), fEvtHeader(0), fPointing(0)
|
---|
67 | {
|
---|
68 | fName = name ? name : "MSimPointingPos";
|
---|
69 | fTitle = title ? title : "Task to simulate the pointing position (mirror orientation)";
|
---|
70 | }
|
---|
71 |
|
---|
72 |
|
---|
73 | // --------------------------------------------------------------------------
|
---|
74 | //
|
---|
75 | // Search for all necessary containers
|
---|
76 | //
|
---|
77 | Int_t MSimPointingPos::PreProcess(MParList *pList)
|
---|
78 | {
|
---|
79 | fPointing = (MPointingPos*)pList->FindCreateObj("MPointingPos");
|
---|
80 | if (!fPointing)
|
---|
81 | return kFALSE;
|
---|
82 |
|
---|
83 | fRunHeader = (MCorsikaRunHeader*)pList->FindObject("MCorsikaRunHeader");
|
---|
84 | if (!fRunHeader)
|
---|
85 | {
|
---|
86 | *fLog << err << "MCorsikaRunHeader not found... aborting." << endl;
|
---|
87 | return kFALSE;
|
---|
88 | }
|
---|
89 |
|
---|
90 | fEvtHeader = (MCorsikaEvtHeader*)pList->FindObject("MCorsikaEvtHeader");
|
---|
91 | if (!fEvtHeader)
|
---|
92 | {
|
---|
93 | *fLog << err << "MCorsikaEvtHeader not found... aborting." << endl;
|
---|
94 | return kFALSE;
|
---|
95 | }
|
---|
96 |
|
---|
97 | return kTRUE;
|
---|
98 | }
|
---|
99 |
|
---|
100 | // --------------------------------------------------------------------------
|
---|
101 | //
|
---|
102 | Int_t MSimPointingPos::Process()
|
---|
103 | {
|
---|
104 | // If a view cone is given use the fixed telescope orientation
|
---|
105 | const Bool_t fixed = fRunHeader->HasViewCone();
|
---|
106 |
|
---|
107 | // Local sky coordinates (direction of telescope axis)
|
---|
108 | const Double_t zd = fixed ? fRunHeader->GetZdMin() : fEvtHeader->GetZd()*TMath::RadToDeg(); // x==north
|
---|
109 | const Double_t az = fixed ? fRunHeader->GetAzMin() : fEvtHeader->GetAz()*TMath::RadToDeg(); // y==west
|
---|
110 |
|
---|
111 | // Setup the pointing position
|
---|
112 | fPointing->SetLocalPosition(zd, az);
|
---|
113 |
|
---|
114 | return kTRUE;
|
---|
115 | }
|
---|
116 |
|
---|
117 | /*
|
---|
118 | Int_t MSimPointingPos::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
|
---|
119 | {
|
---|
120 | Bool_t rc = kFALSE;
|
---|
121 | if (IsEnvDefined(env, prefix, "FileName", print))
|
---|
122 | {
|
---|
123 | rc = kTRUE;
|
---|
124 | SetFileName(GetEnvValue(env, prefix, "FileName", fFileName));
|
---|
125 | }
|
---|
126 |
|
---|
127 | if (IsEnvDefined(env, prefix, "UseTheta", print))
|
---|
128 | {
|
---|
129 | rc = kTRUE;
|
---|
130 | SetUseTheta(GetEnvValue(env, prefix, "UseTheta", fUseTheta));
|
---|
131 | }
|
---|
132 |
|
---|
133 | return rc;
|
---|
134 | }
|
---|
135 | */
|
---|