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

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