1 |
|
/** |
2 |
|
* \file src/AcLevel2.cpp |
3 |
|
* \author Petter Hofverberg |
4 |
|
**/ |
5 |
#include <TObject.h> |
#include <TObject.h> |
6 |
#include <AcLevel2.h> |
#include <AcLevel2.h> |
7 |
|
|
8 |
ClassImp(AcLevel2); |
ClassImp(AcLevel2); |
9 |
|
|
10 |
|
/** |
11 |
|
* AcLevel2 constructor |
12 |
|
**/ |
13 |
AcLevel2::AcLevel2() { |
AcLevel2::AcLevel2() { |
14 |
status[0]=0; |
this->Clear(); |
|
hitmap[0]=0; |
|
|
hitstatus[0]=0; |
|
|
trigger[0]=0; |
|
|
//OBT=0ULL; |
|
|
//pro_num=0; |
|
|
//pkt_num=0ULL; |
|
|
status[1]=0; |
|
|
hitmap[1]=0; |
|
|
hitstatus[1]=0; |
|
|
trigger[1]=0; |
|
15 |
} |
} |
16 |
|
|
17 |
void AcLevel2::Clear(){ |
/** |
18 |
|
* Clear variables |
19 |
|
**/ |
20 |
|
void AcLevel2::Clear(Option_t *t){ |
21 |
status[0]=0; |
status[0]=0; |
22 |
hitmap[0]=0; |
hitmap[0]=0; |
23 |
hitstatus[0]=0; |
hitstatus[0]=0; |
26 |
hitmap[1]=0; |
hitmap[1]=0; |
27 |
hitstatus[1]=0; |
hitstatus[1]=0; |
28 |
trigger[1]=0; |
trigger[1]=0; |
29 |
|
unpackError=0; |
30 |
} |
} |
31 |
|
|
32 |
/** |
/** |
33 |
|
* checks if detector what is hit |
34 |
|
**/ |
35 |
|
bool AcLevel2::IsHit(TString what){ |
36 |
|
|
37 |
|
char* cabl[] = {"CARD4","CAT2","CAS1","ND","CARD2","CAT4","CAS4","ND", |
38 |
|
"CARD3","CAT3","CAS3","ND","CARD1","CAT1","CAS2","ND"}; |
39 |
|
|
40 |
|
bool answer = false; |
41 |
|
for(Int_t ibit=0; ibit<16; ibit++){ |
42 |
|
if( what.Contains( cabl[ibit], TString::kIgnoreCase ) ){ |
43 |
|
if( what.Contains( "M" , TString::kIgnoreCase ) ) |
44 |
|
answer = (Bool_t)((hitmap[0]>>ibit)&1) & (Bool_t)((hitstatus[0]>>ibit)&1); |
45 |
|
else if( what.Contains( "E" , TString::kIgnoreCase ) ) |
46 |
|
answer = (Bool_t)((hitmap[1]>>ibit)&1) & (Bool_t)((hitstatus[1]>>ibit)&1); |
47 |
|
return answer; |
48 |
|
}; |
49 |
|
}; |
50 |
|
return answer; |
51 |
|
|
52 |
|
} |
53 |
|
/** |
54 |
|
* is CAS hit? |
55 |
|
**/ |
56 |
|
bool AcLevel2::CAShit(TString card) |
57 |
|
{ |
58 |
|
if(card.Contains("main") || card.CompareTo("")==0 ) |
59 |
|
{ |
60 |
|
if( this->IsHit("CAS1-M") )return true; |
61 |
|
if( this->IsHit("CAS2-M") )return true; |
62 |
|
if( this->IsHit("CAS3-M") )return true; |
63 |
|
if( this->IsHit("CAS4-M") )return true; |
64 |
|
} |
65 |
|
if(card.Contains("extra") || card.CompareTo("")==0) |
66 |
|
{ |
67 |
|
if( this->IsHit("CAS1-E") ) return true; |
68 |
|
if( this->IsHit("CAS2-E") ) return true; |
69 |
|
if( this->IsHit("CAS3-E") ) return true; |
70 |
|
if( this->IsHit("CAS4-E") ) return true; |
71 |
|
} |
72 |
|
|
73 |
|
return false; |
74 |
|
} |
75 |
|
/** |
76 |
|
* is CAT hit? |
77 |
|
**/ |
78 |
|
bool AcLevel2::CAThit(TString card) |
79 |
|
{ |
80 |
|
if(card.Contains("main") || card.CompareTo("")==0 ) |
81 |
|
{ |
82 |
|
if( this->IsHit("CAT1-M") )return true; |
83 |
|
if( this->IsHit("CAT2-M") )return true; |
84 |
|
if( this->IsHit("CAT3-M") )return true; |
85 |
|
if( this->IsHit("CAT4-M") )return true; |
86 |
|
} |
87 |
|
if(card.Contains("extra") || card.CompareTo("")==0) |
88 |
|
{ |
89 |
|
if( this->IsHit("CAT1-E") ) return true; |
90 |
|
if( this->IsHit("CAT2-E") ) return true; |
91 |
|
if( this->IsHit("CAT3-E") ) return true; |
92 |
|
if( this->IsHit("CAT4-E") ) return true; |
93 |
|
} |
94 |
|
|
95 |
|
return false; |
96 |
|
} |
97 |
|
/** |
98 |
|
* is CARD hit? |
99 |
|
**/ |
100 |
|
bool AcLevel2::CARDhit(TString card) |
101 |
|
{ |
102 |
|
if(card.Contains("main") || card.CompareTo("")==0 ) |
103 |
|
{ |
104 |
|
if( this->IsHit("CARD1-M") )return true; |
105 |
|
if( this->IsHit("CARD2-M") )return true; |
106 |
|
if( this->IsHit("CARD3-M") )return true; |
107 |
|
if( this->IsHit("CARD4-M") )return true; |
108 |
|
} |
109 |
|
if(card.Contains("extra") || card.CompareTo("")==0) |
110 |
|
{ |
111 |
|
if( this->IsHit("CARD1-E") ) return true; |
112 |
|
if( this->IsHit("CARD2-E") ) return true; |
113 |
|
if( this->IsHit("CARD3-E") ) return true; |
114 |
|
if( this->IsHit("CARD4-E") ) return true; |
115 |
|
} |
116 |
|
|
117 |
|
return false; |
118 |
|
} |
119 |
|
/** |
120 |
|
* is AC hit? |
121 |
|
**/ |
122 |
|
bool AcLevel2::AChit(TString card) |
123 |
|
{ |
124 |
|
if(this->CAThit(card) || this->CARDhit(card) || this->CAShit(card)) return true; |
125 |
|
|
126 |
|
return false; |
127 |
|
} |
128 |
|
|
129 |
|
|
130 |
|
/** |
131 |
* Fills a struct cAcLevel2 with values from a AcLevel2 object (to put data into a F77 common). |
* Fills a struct cAcLevel2 with values from a AcLevel2 object (to put data into a F77 common). |
132 |
*/ |
*/ |
133 |
void AcLevel2::GetLevel2Struct(cAcLevel2 *l2) const{ |
void AcLevel2::GetLevel2Struct(cAcLevel2 *l2) const{ |
147 |
trigger[i] = l2->trigger[i]; |
trigger[i] = l2->trigger[i]; |
148 |
} |
} |
149 |
} |
} |
150 |
|
|