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 |
|
---|
39 | ClassImp(MFTriggerLvl1);
|
---|
40 |
|
---|
41 |
|
---|
42 | // --------------------------------------------------------------------------
|
---|
43 | //
|
---|
44 | MFTriggerLvl1::MFTriggerLvl1(const char *cname, const char type, const Int_t val,
|
---|
45 | const char *name, const char *title) : fMcTrig(NULL)
|
---|
46 | {
|
---|
47 | fContName = cname;
|
---|
48 | Init(type, val, name, title);
|
---|
49 | }
|
---|
50 |
|
---|
51 | // --------------------------------------------------------------------------
|
---|
52 | //
|
---|
53 | MFTriggerLvl1::MFTriggerLvl1(const MMcTrig *mctrig, const char type, const Int_t val,
|
---|
54 | const char *name, const char *title) : fMcTrig(mctrig)
|
---|
55 | {
|
---|
56 | Init(type, val, name, title);
|
---|
57 | }
|
---|
58 |
|
---|
59 | // --------------------------------------------------------------------------
|
---|
60 | //
|
---|
61 | void MFTriggerLvl1::Init(const char type, const Int_t val,
|
---|
62 | const char *name, const char *title)
|
---|
63 | {
|
---|
64 | fName = name ? name : "MFTriggerLvl1";
|
---|
65 | fTitle = title ? title : "Filter using number of 1st level triggers";
|
---|
66 |
|
---|
67 | fFilterType = (type=='<' ? kELowerThan : kEGreaterThan);
|
---|
68 |
|
---|
69 | if (type!='<' && type!='>')
|
---|
70 | *fLog << warn << dbginf << "Warning: Neither '<' nor '>' specified... using '>'." << endl;
|
---|
71 |
|
---|
72 | fValue = val;
|
---|
73 |
|
---|
74 | AddToBranchList(Form("%s.fNumFirstLevel", (const char*)fContName));
|
---|
75 | }
|
---|
76 |
|
---|
77 | // --------------------------------------------------------------------------
|
---|
78 | //
|
---|
79 | Bool_t MFTriggerLvl1::IsExpressionTrue() const
|
---|
80 | {
|
---|
81 | return fResult;
|
---|
82 | }
|
---|
83 |
|
---|
84 | // --------------------------------------------------------------------------
|
---|
85 | //
|
---|
86 | Bool_t MFTriggerLvl1::PreProcess(MParList *pList)
|
---|
87 | {
|
---|
88 | if (fMcTrig)
|
---|
89 | return kTRUE;
|
---|
90 |
|
---|
91 | fMcTrig = (MMcTrig*)pList->FindObject(fContName);
|
---|
92 | if (fMcTrig)
|
---|
93 | return kTRUE;
|
---|
94 |
|
---|
95 | *fLog << err << dbginf << fContName << " [MMcTrig] not found... aborting." << endl;
|
---|
96 | return kFALSE;
|
---|
97 | }
|
---|
98 |
|
---|
99 | // --------------------------------------------------------------------------
|
---|
100 | //
|
---|
101 | Bool_t MFTriggerLvl1::Process()
|
---|
102 | {
|
---|
103 | const Int_t lvl1 = fMcTrig->GetFirstLevel();
|
---|
104 |
|
---|
105 | switch (fFilterType)
|
---|
106 | {
|
---|
107 | case kELowerThan:
|
---|
108 | fResult = (lvl1 < fValue);
|
---|
109 | break;
|
---|
110 | case kEGreaterThan:
|
---|
111 | fResult = (lvl1 > fValue);
|
---|
112 | break;
|
---|
113 | }
|
---|
114 |
|
---|
115 | return kTRUE;
|
---|
116 | }
|
---|
117 |
|
---|