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

Last change on this file since 1081 was 1081, checked in by tbretz, 23 years ago
*** empty log message ***
File size: 3.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): Thomas Bretz 07/2001 <mailto: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 Init(type, val);
48}
49
50// --------------------------------------------------------------------------
51//
52MFTriggerLvl1::MFTriggerLvl1(const MMcTrig *mctrig, const char type, const Int_t val) : fMcTrig(mctrig)
53{
54 Init(type, val);
55}
56
57// --------------------------------------------------------------------------
58//
59void MFTriggerLvl1::Init(const char type, const Int_t val)
60{
61 fFilterType = (type=='<' ? kELowerThan : kEGreaterThan);
62
63 if (type!='<' && type!='>')
64 *fLog << warn << dbginf << "Warning: Neither '<' nor '>' specified... using '>'." << endl;
65
66 fValue = val;
67
68 AddToBranchList("fNumFirstLevel");
69}
70
71// --------------------------------------------------------------------------
72//
73Bool_t MFTriggerLvl1::IsExpressionTrue() const
74{
75 return fResult;
76}
77
78// --------------------------------------------------------------------------
79//
80Bool_t MFTriggerLvl1::PreProcess(MParList *pList)
81{
82 if (fMcTrig)
83 return kTRUE;
84
85 fMcTrig = (MMcTrig*)pList->FindObject(fContName);
86 if (fMcTrig)
87 return kTRUE;
88
89 *fLog << err << dbginf << fContName << " [MMcTrig] not found... aborting." << endl;
90 return kFALSE;
91}
92
93// --------------------------------------------------------------------------
94//
95Bool_t MFTriggerLvl1::Process()
96{
97 const Int_t lvl1 = fMcTrig->GetFirstLevel();
98
99 switch (fFilterType)
100 {
101 case kELowerThan:
102 fResult = (lvl1 < fValue);
103 break;
104 case kEGreaterThan:
105 fResult = (lvl1 > fValue);
106 break;
107 }
108
109 return kTRUE;
110}
111
Note: See TracBrowser for help on using the repository browser.