1 | #include "MMcTrig.hxx"
|
---|
2 |
|
---|
3 | #include <iostream.h>
|
---|
4 |
|
---|
5 |
|
---|
6 | //==========
|
---|
7 | // MMcTrig
|
---|
8 | //
|
---|
9 | // This class handles and contains the MonteCarlo information
|
---|
10 | // with which the events have been generated
|
---|
11 | // This information exists for each event.
|
---|
12 | //
|
---|
13 | // This the second version of this output class. Old root files, which have
|
---|
14 | // a previous version of this class, are still compatibles and can be used.
|
---|
15 | // But of course, you can no try to get infromatino in these old files about
|
---|
16 | // the new data members.
|
---|
17 | //
|
---|
18 | // The fPixelsFirst array has been increased from 273 (which was the trigger
|
---|
19 | // zone) to 577 (which is the full Camera)
|
---|
20 | //
|
---|
21 | //////////////////////////////////////////////////////////////
|
---|
22 |
|
---|
23 |
|
---|
24 | ClassImp(MMcTrig);
|
---|
25 |
|
---|
26 |
|
---|
27 |
|
---|
28 | MMcTrig::MMcTrig(const char *name, const char *title) {
|
---|
29 | //
|
---|
30 | // default constructor
|
---|
31 | // set all values to zero
|
---|
32 |
|
---|
33 |
|
---|
34 | fName = name ? name : "MMcTrig";
|
---|
35 | fTitle = title ? title : "Trigger info from Monte Carlo";
|
---|
36 |
|
---|
37 |
|
---|
38 | Int_t i,j;
|
---|
39 |
|
---|
40 | fNumFirstLevel = 0 ;
|
---|
41 |
|
---|
42 | for(i=0;i<TOTAL_TRIGGER_TIME/LEVEL1_DEAD_TIME+1;i++){
|
---|
43 | fTimeFirst[i] = -99.9;
|
---|
44 | for(j=0;j<CAMERA_PIXELS/8+1;j++){
|
---|
45 | fPixelsFirst[j][i] = 0;
|
---|
46 | }
|
---|
47 | }
|
---|
48 |
|
---|
49 | fNumSecondLevel = 0 ;
|
---|
50 | for(i=0;i<TOTAL_TRIGGER_TIME/LEVEL2_DEAD_TIME+1;i++){
|
---|
51 | fFirstToSecond[i]=0;
|
---|
52 | }
|
---|
53 | }
|
---|
54 |
|
---|
55 | MMcTrig::~MMcTrig() {
|
---|
56 | //
|
---|
57 | // default destructor
|
---|
58 | //
|
---|
59 | }
|
---|
60 |
|
---|
61 | void MMcTrig::SetTime(Float_t t, Int_t i)
|
---|
62 | {
|
---|
63 | if (i>TOTAL_TRIGGER_TIME/LEVEL1_DEAD_TIME+1 || i<1)
|
---|
64 | {
|
---|
65 | cout << "fNumFirstLevel out of range. Time will be -99" << endl;
|
---|
66 | return;
|
---|
67 | }
|
---|
68 |
|
---|
69 | fTimeFirst[i-1]=t;
|
---|
70 | }
|
---|
71 |
|
---|
72 | void MMcTrig::Clear(Option_t *opt) {
|
---|
73 | //
|
---|
74 | //
|
---|
75 | // reset all values to zero
|
---|
76 | Int_t i,j;
|
---|
77 |
|
---|
78 | fNumFirstLevel = 0 ;
|
---|
79 | for(i=0;i<TOTAL_TRIGGER_TIME/LEVEL1_DEAD_TIME+1;i++){
|
---|
80 | fTimeFirst[i] = -99.9;
|
---|
81 | for(j=0;j<CAMERA_PIXELS/8+1;j++){
|
---|
82 | fPixelsFirst[j][i] = 0;
|
---|
83 | }
|
---|
84 | }
|
---|
85 |
|
---|
86 | fNumSecondLevel = 0 ;
|
---|
87 | for(i=0;i<TOTAL_TRIGGER_TIME/LEVEL2_DEAD_TIME+1;i++){
|
---|
88 | fFirstToSecond[i]=0;
|
---|
89 | }
|
---|
90 |
|
---|
91 | // cout << "MMcTrig::Clear() " << endl ;
|
---|
92 | }
|
---|
93 |
|
---|
94 | void MMcTrig::Print(Option_t *Option) const {
|
---|
95 | //
|
---|
96 | // print out the data member on screen
|
---|
97 | //
|
---|
98 | Int_t i,j;
|
---|
99 |
|
---|
100 | cout <<endl << "Monte Carlo Trigger output:" <<endl;
|
---|
101 | cout << " First Level Trigger in this Event: "<<fNumFirstLevel<<endl;
|
---|
102 | cout << " Times of first Level Trigger in this Event: ";
|
---|
103 | for (i=0;i<fNumFirstLevel;i++){
|
---|
104 | cout<< fTimeFirst[i]<<"-";
|
---|
105 | }
|
---|
106 | cout<<endl;
|
---|
107 | cout << " Pixels of first Level Trigger in this Event : ";
|
---|
108 | for (i=0;i<fNumFirstLevel;i++){
|
---|
109 | for(j=0;j<CAMERA_PIXELS/8+1;j++){
|
---|
110 | cout<<fPixelsFirst[j][i]<<"-";
|
---|
111 | }
|
---|
112 | }
|
---|
113 | cout<<endl;
|
---|
114 | cout << " Second Level Trigger in this Event: " << fNumSecondLevel << endl;
|
---|
115 | cout << endl ;
|
---|
116 | }
|
---|
117 |
|
---|
118 | Byte_t MMcTrig::IsPixelFired(Int_t npix, Int_t nfirstlevel){
|
---|
119 | //======================================================================
|
---|
120 | //
|
---|
121 | // It returns >1 if the pixel npix was fired when the nfirstlevel
|
---|
122 | // first level trigger happened, 0 if not.
|
---|
123 | //
|
---|
124 |
|
---|
125 | Byte_t ret=0;
|
---|
126 | Byte_t reminder;
|
---|
127 | Int_t body;
|
---|
128 |
|
---|
129 | body=npix/8;
|
---|
130 | reminder=(Byte_t)(pow(2,npix%8));
|
---|
131 |
|
---|
132 | ret=reminder&fPixelsFirst[body][nfirstlevel];
|
---|
133 | return(ret);
|
---|
134 |
|
---|
135 | }
|
---|