source: trunk/MagicSoft/include-Classes/MMcFormat/MMcTrig.cxx@ 770

Last change on this file since 770 was 686, checked in by harald, 24 years ago
Added the first implementation of macro to calculate the trigger collection area. the macro is called getCollArea.C
File size: 2.3 KB
Line 
1#include <iostream.h>
2#include "MMcTrig.hxx"
3
4
5//==========
6// MMcTrig
7//
8// This class handles and contains the MonteCarlo information
9// with which the events have been generated
10// This information exists for each event.
11
12
13
14ClassImp(MMcTrig)
15
16
17
18MMcTrig::MMcTrig() {
19 //
20 // default constructor
21 // set all values to zero
22
23
24 *fName = "MMcTrig";
25 *fTitle = "Trigger info from Monte Carlo";
26
27
28 Int_t i,j;
29
30 fNumFirstLevel = 0 ;
31
32 for(i=0;i<TOTAL_TRIGGER_TIME/LEVEL1_DEAD_TIME+1;i++){
33 fTimeFirst[i] = -99.9;
34 for(j=0;j<TRIGGER_PIXELS/8+1;j++){
35 fPixelsFirst[j][i] = 0;
36 }
37 }
38
39 fNumSecondLevel = 0 ;
40 for(i=0;i<TOTAL_TRIGGER_TIME/LEVEL2_DEAD_TIME+1;i++){
41 fFirstToSecond[i]=0;
42 }
43}
44
45MMcTrig::~MMcTrig() {
46 //
47 // default destructor
48 //
49}
50
51void MMcTrig::Clear(Option_t *opt) {
52 //
53 //
54 // reset all values to zero
55 Int_t i,j;
56
57 fNumFirstLevel = 0 ;
58 for(i=0;i<TOTAL_TRIGGER_TIME/LEVEL1_DEAD_TIME+1;i++){
59 fTimeFirst[i] = -99.9;
60 for(j=0;j<TRIGGER_PIXELS/8+1;j++){
61 fPixelsFirst[j][i] = 0;
62 }
63 }
64
65 fNumSecondLevel = 0 ;
66 for(i=0;i<TOTAL_TRIGGER_TIME/LEVEL2_DEAD_TIME+1;i++){
67 fFirstToSecond[i]=0;
68 }
69
70 // cout << "MMcTrig::Clear() " << endl ;
71}
72
73void MMcTrig::Print(Option_t *Option) {
74 //
75 // print out the data member on screen
76 //
77 Int_t i,j;
78
79 cout <<endl << "Monte Carlo Trigger output:" <<endl;
80 cout << " First Level Trigger in this Event : "<<fNumFirstLevel<<endl;
81 cout << " Times of first Level Trigger in this Event : ";
82 for (i=0;i<fNumFirstLevel;i++){
83 cout<< fTimeFirst[i]<<"-";
84 }
85 cout<<endl;
86 cout << " Pixels of first Level Trigger in this Event : ";
87 for (i=0;i<fNumFirstLevel;i++){
88 for(j=0;j<TRIGGER_PIXELS/8+1;j++){
89 cout<<fPixelsFirst[j][i]<<"-";
90 }
91 }
92 cout<<endl;
93 cout << " Second Level Trigger in this Event : " << fNumSecondLevel << endl;
94 cout << endl ;
95}
96
97Byte_t MMcTrig::IsPixelFired(Int_t npix, Int_t nfirstlevel){
98 //======================================================================
99 //
100 // It returns >1 if the pixel npix was fired when the nfirstlevel
101 // first level trigger happened, 0 if not.
102 //
103
104 Byte_t ret=0;
105 Byte_t reminder;
106 Int_t body;
107
108 body=npix/8;
109 reminder=(Byte_t)(pow(2,npix%8));
110
111 ret=reminder&fPixelsFirst[body][nfirstlevel];
112 return(ret);
113
114}
Note: See TracBrowser for help on using the repository browser.