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 |
|
---|
14 | ClassImp(MMcTrig)
|
---|
15 |
|
---|
16 |
|
---|
17 |
|
---|
18 | MMcTrig::MMcTrig() {
|
---|
19 | //
|
---|
20 | // default constructor
|
---|
21 | // set all values to zero
|
---|
22 |
|
---|
23 | Int_t i,j;
|
---|
24 |
|
---|
25 | fNumFirstLevel = 0 ;
|
---|
26 |
|
---|
27 | for(i=0;i<TOTAL_TRIGGER_TIME/LEVEL1_DEAD_TIME+1;i++){
|
---|
28 | fTimeFirst[i] = -99.9;
|
---|
29 | for(j=0;j<TRIGGER_PIXELS/8+1;j++){
|
---|
30 | fPixelsFirst[j][i] = 0;
|
---|
31 | }
|
---|
32 | }
|
---|
33 |
|
---|
34 | fNumSecondLevel = 0 ;
|
---|
35 | for(i=0;i<TOTAL_TRIGGER_TIME/LEVEL2_DEAD_TIME+1;i++){
|
---|
36 | fFirstToSecond[i]=0;
|
---|
37 | }
|
---|
38 | }
|
---|
39 |
|
---|
40 | MMcTrig::~MMcTrig() {
|
---|
41 | //
|
---|
42 | // default destructor
|
---|
43 | //
|
---|
44 | }
|
---|
45 |
|
---|
46 | void MMcTrig::Clear() {
|
---|
47 | //
|
---|
48 | //
|
---|
49 | // reset all values to zero
|
---|
50 | Int_t i,j;
|
---|
51 |
|
---|
52 | fNumFirstLevel = 0 ;
|
---|
53 | for(i=0;i<TOTAL_TRIGGER_TIME/LEVEL1_DEAD_TIME+1;i++){
|
---|
54 | fTimeFirst[i] = -99.9;
|
---|
55 | for(j=0;j<TRIGGER_PIXELS/8+1;j++){
|
---|
56 | fPixelsFirst[j][i] = 0;
|
---|
57 | }
|
---|
58 | }
|
---|
59 |
|
---|
60 | fNumSecondLevel = 0 ;
|
---|
61 | for(i=0;i<TOTAL_TRIGGER_TIME/LEVEL2_DEAD_TIME+1;i++){
|
---|
62 | fFirstToSecond[i]=0;
|
---|
63 | }
|
---|
64 |
|
---|
65 | // cout << "MMcTrig::Clear() " << endl ;
|
---|
66 | }
|
---|
67 |
|
---|
68 | void MMcTrig::Print(Option_t *Option) {
|
---|
69 | //
|
---|
70 | // print out the data member on screen
|
---|
71 | //
|
---|
72 | Int_t i,j;
|
---|
73 |
|
---|
74 | cout <<endl << "Monte Carlo Trigger output:" <<endl;
|
---|
75 | cout << " First Level Trigger in this Event : "<<fNumFirstLevel<<endl;
|
---|
76 | cout << " Times of first Level Trigger in this Event : ";
|
---|
77 | for (i=0;i<fNumFirstLevel;i++){
|
---|
78 | cout<< fTimeFirst[i]<<"-";
|
---|
79 | }
|
---|
80 | cout<<endl;
|
---|
81 | cout << " Pixels of first Level Trigger in this Event : ";
|
---|
82 | for (i=0;i<fNumFirstLevel;i++){
|
---|
83 | for(j=0;j<TRIGGER_PIXELS/8+1;j++){
|
---|
84 | cout<<fPixelsFirst[j][i]<<"-";
|
---|
85 | }
|
---|
86 | }
|
---|
87 | cout<<endl;
|
---|
88 | cout << " Second Level Trigger in this Event : " << fNumSecondLevel << endl;
|
---|
89 | cout << endl ;
|
---|
90 | }
|
---|
91 |
|
---|
92 | Byte_t MMcTrig::IsPixelFired(Int_t npix, Int_t nfirstlevel){
|
---|
93 | //======================================================================
|
---|
94 | //
|
---|
95 | // It returns >1 if the pixel npix was fired when the nfirstlevel
|
---|
96 | // first level trigger happened, 0 if not.
|
---|
97 | //
|
---|
98 |
|
---|
99 | Byte_t ret=0;
|
---|
100 | Byte_t reminder;
|
---|
101 | Int_t body;
|
---|
102 |
|
---|
103 | body=npix/8;
|
---|
104 | reminder=(Byte_t)(pow(2,npix%8));
|
---|
105 |
|
---|
106 | ret=reminder&fPixelsFirst[body][nfirstlevel];
|
---|
107 | return(ret);
|
---|
108 |
|
---|
109 | }
|
---|