source: trunk/MagicSoft/Mars/mfilter/MFTriggerLvl1.cc@ 971

Last change on this file since 971 was 856, checked in by tbretz, 23 years ago
*** empty log message ***
File size: 3.0 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 07/2001 (tbretz@uni-sw.gwdg.de)
19!
20! Copyright: MAGIC Software Development, 2000-2001
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26// //
27// MFTriggerLvl1 //
28// //
29/////////////////////////////////////////////////////////////////////////////
30
31#include "MFTriggerLvl1.h"
32
33#include "MParList.h"
34#include "MLog.h"
35#include "MLogManip.h"
36
37#include "MMcTrig.hxx"
38
39ClassImp(MFTriggerLvl1);
40
41
42// --------------------------------------------------------------------------
43//
44MFTriggerLvl1::MFTriggerLvl1(const char *cname, const char type, const Int_t val) : fMcTrig(NULL)
45{
46 fContName = cname;
47}
48
49// --------------------------------------------------------------------------
50//
51MFTriggerLvl1::MFTriggerLvl1(const MMcTrig *mctrig, const char type, const Int_t val) : fMcTrig(mctrig)
52{
53}
54
55// --------------------------------------------------------------------------
56//
57void MFTriggerLvl1::Init(const char type, const Int_t val)
58{
59 fFilterType = (type=='<' ? kELowerThan : kEGreaterThan);
60
61 if (type!='<' && type!='>')
62 *fLog << dbginf << "Warning: Neither '<' nor '>' specified... using '>'." << endl;
63
64 fValue = val;
65}
66
67// --------------------------------------------------------------------------
68//
69Bool_t MFTriggerLvl1::IsExpressionTrue() const
70{
71 return fResult;
72}
73
74// --------------------------------------------------------------------------
75//
76Bool_t MFTriggerLvl1::PreProcess(MParList *pList)
77{
78 if (fMcTrig)
79 return kTRUE;
80
81 fMcTrig = (MMcTrig*)pList->FindObject(fContName);
82 if (fMcTrig)
83 return kTRUE;
84
85 *fLog << dbginf << fContName << " [MMcTrig] not found... aborting." << endl;
86 return kFALSE;
87}
88
89// --------------------------------------------------------------------------
90//
91Bool_t MFTriggerLvl1::Process()
92{
93 const Int_t lvl1 = fMcTrig->GetFirstLevel();
94
95 switch (fFilterType)
96 {
97 case kELowerThan:
98 fResult = (lvl1 < fValue);
99 break;
100 case kEGreaterThan:
101 fResult = (lvl1 > fValue);
102 break;
103 }
104
105 return kTRUE;
106}
107
Note: See TracBrowser for help on using the repository browser.