source: branches/MarsISDCBranchBasedOn17887/mfilter/MFTriggerLvl2.cc@ 18066

Last change on this file since 18066 was 7804, checked in by tbretz, 18 years ago
*** empty log message ***
File size: 4.1 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 02/2003 <mailto:antonio.stamerra@pi.infn.it>
19!
20! Copyright: MAGIC Software Development, 2000-2003
21!
22\* ======================================================================== */
23
24/////////////////////////////////////////////////////////////////////////////
25// //
26// MFTriggerLvl2 //
27// //
28// A Filter for the 2nd Level trigger, using the MMcTriggerLvl2 Class //
29//
30/////////////////////////////////////////////////////////////////////////////
31#include "MFTriggerLvl2.h"
32
33#include <fstream>
34
35#include "MLog.h"
36#include "MLogManip.h"
37
38#include "MParList.h"
39
40#include "MMcTriggerLvl2.h"
41
42ClassImp(MFTriggerLvl2);
43
44using namespace std;
45
46// --------------------------------------------------------------------------
47//
48// Default constructor
49//
50MFTriggerLvl2::MFTriggerLvl2(const char *cname, const char type, const Int_t val,
51 const char *name, const char *title) : fcell(NULL)
52{
53 fContName = cname;
54 Init(type, val, name, title);
55}
56
57// --------------------------------------------------------------------------
58 //
59MFTriggerLvl2::MFTriggerLvl2(MMcTriggerLvl2 *triglvl2, const char type, const Int_t val,
60 const char *name, const char *title) : fcell(triglvl2)
61{
62 Init(type, val, name, title);
63}
64
65// --------------------------------------------------------------------------
66//
67void MFTriggerLvl2::Init(const char type, const Int_t val,
68 const char *name, const char *title)
69{
70 fName = name ? name : "MFTriggerLvl2";
71 fTitle = title ? title : "Filter using 2nd level trigger selection";
72
73 fFilterType = (type=='<' ? kELowerThan : kEGreaterThan);
74
75 if (type!='<' && type!='>')
76 *fLog << warn << dbginf << "Warning: Neither '<' nor '>' specified... using '>'." << endl;
77
78 fValue = val;
79
80}
81// --------------------------------------------------------------------------
82//
83Bool_t MFTriggerLvl2::IsExpressionTrue() const
84{
85 return fResult;
86}
87
88// --------------------------------------------------------------------------
89//
90Int_t MFTriggerLvl2::PreProcess(MParList *pList)
91{
92 if (fcell)
93 return kTRUE;
94
95 fcell = (MMcTriggerLvl2*)pList->FindObject(fContName);
96 if (fcell)
97 return kTRUE;
98
99 *fLog << err << dbginf << fContName << " [MMcTriggerLvl2] not found... aborting." << endl;
100
101 return kFALSE;
102}
103
104// --------------------------------------------------------------------------
105//
106Int_t MFTriggerLvl2::Process()
107{
108
109 //
110 // The variable fLutPseudoSize of the class MMcTriggerLvl2 is used
111 // for the selection
112 //
113
114 const Int_t lvl2 = fcell->GetLutPseudoSize();
115
116 switch (fFilterType)
117 {
118 case kELowerThan:
119 fResult = (lvl2 < fValue);
120 break;
121 case kEGreaterThan:
122 fResult = (lvl2 > fValue);
123 break;
124 }
125
126 return kTRUE;
127}
128
129void MFTriggerLvl2::StreamPrimitive(ostream &out) const
130{
131 if (fcell)
132 fcell->SavePrimitive(out);
133
134 out << " MFTriggerLvl2 " << GetUniqueName() << "(";
135
136 if (fcell)
137 out << "&" << fcell->GetUniqueName();
138 else
139 out << "\"" << fContName << "\"";
140
141 out << ", '" << (fFilterType==kELowerThan?"<":">") << "', " << fValue << ");" << endl;
142
143}
Note: See TracBrowser for help on using the repository browser.