source: trunk/MagicSoft/Mars/macros/getThreshold.C@ 903

Last change on this file since 903 was 892, checked in by tbretz, 23 years ago
*** empty log message ***
File size: 2.0 KB
Line 
1void getThreshold(char* filename="data/CrabNebula_dnsb_09_loop.root")
2{
3 //
4 // This macro fill the container MHMcEnergies using the task
5 // MMcThresholdCalc and shows the results.
6 //
7 MParList parlist;
8
9 MTaskList tasklist;
10 parlist.AddToList(&tasklist);
11
12 //
13 // Setup the parameter list
14 // - You need create the container MHMcEnergies.
15 // + You need to put the number of trigger conditions when
16 // you declarete the MHMcEnergies
17 // + If you don't put any dimension to MHMcEnergies it works
18 // taking only the trigger information from MMcTrig
19 //
20 const UInt_t numtriggerconditions = 4;
21
22 //
23 // Create numtriggerconditions histograms of type MHMcEnergy
24 // and store the histograms in an TObjArray
25 //
26 TObjArray *hists = new TObjArray(MParList::CreateObjList("MHMcEnergy", numtriggerconditions));
27
28 //
29 // Check if the list really contains the right number of histograms
30 //
31 if (hists->GetEntriesFast() != numtriggerconditions)
32 return;
33
34 //
35 // Add the histograms to the paramater list.
36 //
37 parlist.AddToList(hists);
38
39 //
40 // Setup the task list
41 // - You need the read and the MMcThresholdCalc tasks
42 // - You have to fill the histograms for the Energy threshold
43 // + You need to put the number of trigger conditions when
44 // you declarete the MMcThresholdCalc
45 // + If you don't put any dimension to MMcThresholdCalc it works
46 // like one dimension MMcThresholdCalc
47 //
48 MReadTree read("Events;7", filename);
49 MMcThresholdCalc calc(numtriggerconditions);
50
51 tasklist.AddToList(&read);
52 tasklist.AddToList(&calc);
53
54 MEvtLoop evtloop;
55 evtloop.SetParList(&parlist);
56
57 //
58 // Begin the loop (if the loop wasn't succesfull
59 // don't try to draw the results
60 //
61 if (!evtloop.Eventloop())
62 return;
63
64 //
65 // Now you can display the results
66 //
67 for (UInt_t i=0; i<numtriggerconditions; i++)
68 ((*hists)[i])->Draw();
69}
Note: See TracBrowser for help on using the repository browser.