source: trunk/MagicSoft/Mars/manalysis/MMcTriggerLvl2Calc.cc@ 3440

Last change on this file since 3440 was 2446, checked in by stamerra, 21 years ago
*** empty log message ***
File size: 5.2 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): Antonio Stamerra 1/2003 <mailto:antono.stamerra@pi.infn.it>
19! Author(s): Marcos Lopez 1/2003 <mailto:marcos@gae.ucm.es>
20!
21! Copyright: MAGIC Software Development, 2000-2003
22!
23!
24\* ======================================================================== */
25
26/////////////////////////////////////////////////////////////////////////////
27// //
28// MTriggerLvl2Calc //
29// This is a task to calculate the 2nd level trigger selection //
30// parameters //
31// //
32// Input containers: //
33// MMcTriggerLvl2 //
34// //
35/////////////////////////////////////////////////////////////////////////////
36
37#include "MMcTriggerLvl2Calc.h"
38#include "MMcTriggerLvl2.h"
39#include "MHMcTriggerLvl2.h"
40
41#include "MParList.h"
42#include "MLog.h"
43#include "MLogManip.h"
44
45#include "MMcEvt.hxx"
46#include "MMcTrig.hxx"
47#include "MMcRunHeader.hxx"
48
49#include "MGeomCam.h"
50
51ClassImp(MMcTriggerLvl2Calc);
52
53using namespace std;
54
55// --------------------------------------------------------------------------
56//
57// Default constructor
58//
59//
60MMcTriggerLvl2Calc::MMcTriggerLvl2Calc(const char *name, const char *title)
61{
62 fName = name ? name : "MMcTriggerLvl2Calc";
63 fTitle = title ? title : "Task to Fill the MMcTriggerLvl2 object";
64
65}
66
67
68// --------------------------------------------------------------------------
69//
70// PreProcess
71//
72//
73Int_t MMcTriggerLvl2Calc::PreProcess (MParList *pList)
74{
75 // connect the raw data with this task
76
77 fMcEvt = (MMcEvt*)pList->FindObject("MMcEvt");
78 if (!fMcEvt)
79 {
80 *fLog << err << dbginf << "MMcEvt not found... exit." << endl;
81 return kFALSE;
82 }
83
84 fMcTrig = (MMcTrig*)pList->FindObject("MMcTrig");
85 if (!fMcTrig)
86 {
87 *fLog << err << dbginf << "MMcTrig not found... exit." << endl;
88 return kFALSE;
89 }
90
91 fCam = (MGeomCam*)pList->FindObject("MGeomCam");
92 if (!fCam)
93 {
94 *fLog << dbginf << "MGeomCam not found (no geometry information available)... aborting." << endl;
95 return kFALSE;
96 }
97 // Check if fCam is a Magic geometry: only MGeomCamMagic geometry and
98 // geometries with 577 pixels are now accepted by MMcTriggerLvl2
99 if (fCam->GetNumPixels()!= 577)
100 {
101 *fLog << dbginf << "MGeomCam has a wrong geometry; only MAGIC geometry (577 pixels) is accepted by now... aborting" <<endl;
102 return kFALSE;
103 }
104 fMMcTriggerLvl2 = (MMcTriggerLvl2*)pList->FindObject("MMcTriggerLvl2");
105 if (!fMMcTriggerLvl2)
106 {
107 *fLog << err << dbginf << "MMcTriggerLvl2 not found... exit." << endl;
108 return kFALSE;
109 }
110
111 fMHMcTriggerLvl2 = (MHMcTriggerLvl2*)pList->FindCreateObj("MHMcTriggerLvl2");
112 if (!fMHMcTriggerLvl2)
113 {
114 *fLog << err << dbginf << "MHMcTriggerLvl2 not found... exit." << endl;
115 return kFALSE;
116 }
117
118 // Check if the variable fCompactNN has been correctly set;
119 // accepted values for fCompactNN are (up to now) 2 and 3.
120 if (fMMcTriggerLvl2->GetCompactNN()<2 || fMMcTriggerLvl2->GetCompactNN()>3)
121 {
122 *fLog << err << dbginf << "fCompactNN is not correctly set ("<<fMMcTriggerLvl2->GetCompactNN() <<") ... exit" <<endl;
123 return kFALSE;
124 }
125 else
126 *fLog << "Compact pixel is set with at least "<<fMMcTriggerLvl2->GetCompactNN() << " NN" <<endl;
127
128
129 return kTRUE;
130}
131
132
133// --------------------------------------------------------------------------
134//
135// Process
136//
137//
138Int_t MMcTriggerLvl2Calc::Process()
139{
140 fMMcTriggerLvl2->GetEnergy(fMcEvt);
141
142 fMMcTriggerLvl2->SetLv1(fMcTrig);
143
144 fMMcTriggerLvl2->CalcCompactPixels(fCam);
145
146 fMMcTriggerLvl2->Calc();
147
148 fMMcTriggerLvl2->CalcTriggerPattern(fCam);
149
150 return kTRUE;
151}
152
153
154// --------------------------------------------------------------------------
155//
156// PostProcess : Display the histogram
157// !to be fixed: create an histogram class!
158//
159Int_t MMcTriggerLvl2Calc::PostProcess()
160{
161
162 return kTRUE;
163}
164
165
166
167
Note: See TracBrowser for help on using the repository browser.