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

Last change on this file since 1247 was 1244, checked in by blanch, 23 years ago
Changes needed to put the actual size of the trigger zone. Actually, now information about all pixels are saved, just that the ones out of the trigger zone will be alway off.
File size: 2.6 KB
Line 
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
14
15ClassImp(MMcTrig);
16
17
18
19MMcTrig::MMcTrig(const char *name, const char *title) {
20 //
21 // default constructor
22 // set all values to zero
23
24
25 fName = name ? name : "MMcTrig";
26 fTitle = title ? title : "Trigger info from Monte Carlo";
27
28
29 Int_t i,j;
30
31 fNumFirstLevel = 0 ;
32
33 for(i=0;i<TOTAL_TRIGGER_TIME/LEVEL1_DEAD_TIME+1;i++){
34 fTimeFirst[i] = -99.9;
35 for(j=0;j<CAMERA_PIXELS/8+1;j++){
36 fPixelsFirst[j][i] = 0;
37 }
38 }
39
40 fNumSecondLevel = 0 ;
41 for(i=0;i<TOTAL_TRIGGER_TIME/LEVEL2_DEAD_TIME+1;i++){
42 fFirstToSecond[i]=0;
43 }
44}
45
46MMcTrig::~MMcTrig() {
47 //
48 // default destructor
49 //
50}
51
52void MMcTrig::SetTime(Float_t t, Int_t i)
53{
54 if (i>TOTAL_TRIGGER_TIME/LEVEL1_DEAD_TIME+1 || i<1)
55 {
56 cout << "fNumFirstLevel out of range. Time will be -99" << endl;
57 return;
58 }
59
60 fTimeFirst[i-1]=t;
61}
62
63void MMcTrig::Clear(Option_t *opt) {
64 //
65 //
66 // reset all values to zero
67 Int_t i,j;
68
69 fNumFirstLevel = 0 ;
70 for(i=0;i<TOTAL_TRIGGER_TIME/LEVEL1_DEAD_TIME+1;i++){
71 fTimeFirst[i] = -99.9;
72 for(j=0;j<CAMERA_PIXELS/8+1;j++){
73 fPixelsFirst[j][i] = 0;
74 }
75 }
76
77 fNumSecondLevel = 0 ;
78 for(i=0;i<TOTAL_TRIGGER_TIME/LEVEL2_DEAD_TIME+1;i++){
79 fFirstToSecond[i]=0;
80 }
81
82 // cout << "MMcTrig::Clear() " << endl ;
83}
84
85void MMcTrig::Print(Option_t *Option) const {
86 //
87 // print out the data member on screen
88 //
89 Int_t i,j;
90
91 cout <<endl << "Monte Carlo Trigger output:" <<endl;
92 cout << " First Level Trigger in this Event: "<<fNumFirstLevel<<endl;
93 cout << " Times of first Level Trigger in this Event: ";
94 for (i=0;i<fNumFirstLevel;i++){
95 cout<< fTimeFirst[i]<<"-";
96 }
97 cout<<endl;
98 cout << " Pixels of first Level Trigger in this Event : ";
99 for (i=0;i<fNumFirstLevel;i++){
100 for(j=0;j<CAMERA_PIXELS/8+1;j++){
101 cout<<fPixelsFirst[j][i]<<"-";
102 }
103 }
104 cout<<endl;
105 cout << " Second Level Trigger in this Event: " << fNumSecondLevel << endl;
106 cout << endl ;
107}
108
109Byte_t MMcTrig::IsPixelFired(Int_t npix, Int_t nfirstlevel){
110 //======================================================================
111 //
112 // It returns >1 if the pixel npix was fired when the nfirstlevel
113 // first level trigger happened, 0 if not.
114 //
115
116 Byte_t ret=0;
117 Byte_t reminder;
118 Int_t body;
119
120 body=npix/8;
121 reminder=(Byte_t)(pow(2,npix%8));
122
123 ret=reminder&fPixelsFirst[body][nfirstlevel];
124 return(ret);
125
126}
Note: See TracBrowser for help on using the repository browser.