source: trunk/MagicSoft/Mars/mfilter/MFTriggerLvl2.cc@ 1885

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