source: trunk/Mars/mmc/MMcTrig.cxx@ 18595

Last change on this file since 18595 was 4577, checked in by tbretz, 20 years ago
*** empty log message ***
File size: 3.3 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 //
98 // print out the data member on screen
99 //
100 cout << "Monte Carlo Trigger output:" << endl;
101 cout << " First Level Trigger in this Event: " << fNumFirstLevel << endl;
102 if (!TString(option).Contains("short"))
103 {
104 cout << " Times of first Level Trigger in this Event: ";
105 for (int i=0; i<fNumFirstLevel; i++)
106 cout << fTimeFirst[i] << " ";
107 cout << endl;
108
109 cout << " Pixels of first Level Trigger in this Event: ";
110 for (int i=0; i<fNumFirstLevel; i++)
111 for(int j=0; j<CAMERA_PIXELS/8+1; j++)
112 cout << (int)fPixelsFirst[j][i] << " ";
113 cout << endl;
114 }
115
116 cout << " Second Level Trigger in this Event: " << fNumSecondLevel << endl;
117 cout << endl;
118}
119
120Byte_t MMcTrig::IsPixelFired(Int_t npix, Int_t nfirstlevel){
121 //======================================================================
122 //
123 // It returns >1 if the pixel npix was fired when the nfirstlevel
124 // first level trigger happened, 0 if not.
125 //
126
127 const Int_t body=npix/8;
128 const Byte_t reminder= 1<<(npix%8);
129
130 return reminder&fPixelsFirst[body][nfirstlevel];
131 /*
132 Byte_t ret=0;
133 Byte_t reminder;
134 Int_t body;
135
136 body=npix/8;
137 reminder=(Byte_t)(pow(2,npix%8));
138 ret=reminder&fPixelsFirst[body][nfirstlevel];
139 return(ret);
140 */
141}
Note: See TracBrowser for help on using the repository browser.