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 1/2003 <mailto:antono.stamerra@pi.infn.it>
|
---|
19 | ! Author(s): Marcos Lopez 1/2003 <mailto:marcos@gae.ucm.es>
|
---|
20 | !
|
---|
21 | ! Copyright: MAGIC Software Development, 2000-2003
|
---|
22 | !
|
---|
23 | !
|
---|
24 | \* ======================================================================== */
|
---|
25 |
|
---|
26 | /////////////////////////////////////////////////////////////////////////////
|
---|
27 | // //
|
---|
28 | // MTrigLvl2FillTask //
|
---|
29 | // This is a task to calculate the 2nd level trigger selection //
|
---|
30 | // parameters //
|
---|
31 | // //
|
---|
32 | // Input containers: //
|
---|
33 | // MTrigLvl2 //
|
---|
34 | // //
|
---|
35 | /////////////////////////////////////////////////////////////////////////////
|
---|
36 |
|
---|
37 | #include "MTrigLvl2FillTask.h"
|
---|
38 | #include "MTrigLvl2.h"
|
---|
39 |
|
---|
40 |
|
---|
41 | #include "MParList.h"
|
---|
42 | #include "MLog.h"
|
---|
43 | #include "MLogManip.h"
|
---|
44 |
|
---|
45 | #include "MMcEvt.hxx"
|
---|
46 | #include "MMcTrig.hxx"
|
---|
47 | #include "MMcRunHeader.hxx"
|
---|
48 |
|
---|
49 | #include <TH1.h>
|
---|
50 |
|
---|
51 | ClassImp(MTrigLvl2FillTask);
|
---|
52 |
|
---|
53 |
|
---|
54 | /////////////////////////////////////////////////////////////////////////////
|
---|
55 | // //
|
---|
56 | // Default constructor
|
---|
57 | //
|
---|
58 | //
|
---|
59 | MTrigLvl2FillTask::MTrigLvl2FillTask(const char *name, const char *title)
|
---|
60 | {
|
---|
61 | fName = name ? name : "MTrigLvl2FillTask";
|
---|
62 | fTitle = title ? title : "Task to Fill the MTrigLvl2 object";
|
---|
63 |
|
---|
64 | AddToBranchList("MMcEvt.fEnergy");
|
---|
65 | AddToBranchList("MMcEvt.fImpact");
|
---|
66 | AddToBranchList(Form("%s.fNumFirstLevel", "MMcTrig"));
|
---|
67 | AddToBranchList(Form("%s.fPixelsFirst[73][4]", "MMcTrig"));
|
---|
68 |
|
---|
69 |
|
---|
70 | h1 = new TH1F("h1","h1",30,0,30);
|
---|
71 | }
|
---|
72 |
|
---|
73 |
|
---|
74 | /////////////////////////////////////////////////////////////////////////////
|
---|
75 | //
|
---|
76 | // PreProcess
|
---|
77 | //
|
---|
78 | //
|
---|
79 | Bool_t MTrigLvl2FillTask::PreProcess (MParList *pList)
|
---|
80 | {
|
---|
81 | // connect the raw data with this task
|
---|
82 |
|
---|
83 | fMcEvt = (MMcEvt*)pList->FindObject("MMcEvt");
|
---|
84 | if (!fMcEvt)
|
---|
85 | {
|
---|
86 | *fLog << err << dbginf << "MMcEvt not found... exit." << endl;
|
---|
87 | return kFALSE;
|
---|
88 | }
|
---|
89 |
|
---|
90 | fMcTrig = (MMcTrig*)pList->FindObject("MMcTrig");
|
---|
91 | if (!fMcTrig)
|
---|
92 | {
|
---|
93 | *fLog << err << dbginf << "MMcTrig not found... exit." << endl;
|
---|
94 | return kFALSE;
|
---|
95 | }
|
---|
96 |
|
---|
97 | fMTrigLvl2 = (MTrigLvl2*)pList->FindObject("MTrigLvl2");
|
---|
98 | if (!fMTrigLvl2)
|
---|
99 | {
|
---|
100 | *fLog << err << dbginf << "MTrigLvl2 not found... exit." << endl;
|
---|
101 | return kFALSE;
|
---|
102 | }
|
---|
103 |
|
---|
104 | return kTRUE;
|
---|
105 | }
|
---|
106 |
|
---|
107 |
|
---|
108 | /////////////////////////////////////////////////////////////////////////////
|
---|
109 | //
|
---|
110 | // Process
|
---|
111 | //
|
---|
112 | //
|
---|
113 | Bool_t MTrigLvl2FillTask::Process()
|
---|
114 | {
|
---|
115 | //const Float_t energy = fMcEvt->GetEnergy();
|
---|
116 |
|
---|
117 | fMTrigLvl2->SetLv1(fMcTrig);
|
---|
118 |
|
---|
119 | //fMTrigLvl2->DrawLv1();
|
---|
120 | //fMTrigLvl2->DrawCell(fMTrigLvl2->GetBiggerFiredCell() );
|
---|
121 | //fMTrigLvl2->PrintStatus();
|
---|
122 |
|
---|
123 | h1->Fill( fMTrigLvl2->GetCellNumberFired(fMTrigLvl2->GetBiggerFiredCell()) );
|
---|
124 |
|
---|
125 |
|
---|
126 | return kTRUE;
|
---|
127 | }
|
---|
128 |
|
---|
129 |
|
---|
130 | /////////////////////////////////////////////////////////////////////////////
|
---|
131 | //
|
---|
132 | // PostProcess : Display the histogram
|
---|
133 | // !to be fixed: create an histogram class!
|
---|
134 | //
|
---|
135 | Bool_t MTrigLvl2FillTask::PostProcess()
|
---|
136 | {
|
---|
137 |
|
---|
138 | *fLog << inf << "Filling..." << endl;
|
---|
139 |
|
---|
140 | h1->Draw();
|
---|
141 |
|
---|
142 | return kTRUE;
|
---|
143 | }
|
---|
144 |
|
---|