1 |
pamela |
1.7 |
/** |
2 |
|
|
* \file src/AcLevel2.cpp |
3 |
|
|
* \author Petter Hofverberg |
4 |
|
|
**/ |
5 |
mocchiut |
1.1 |
#include <TObject.h> |
6 |
|
|
#include <AcLevel2.h> |
7 |
mocchiut |
1.6 |
|
8 |
mocchiut |
1.1 |
ClassImp(AcLevel2); |
9 |
|
|
|
10 |
pamela |
1.7 |
/** |
11 |
|
|
* AcLevel2 constructor |
12 |
|
|
**/ |
13 |
mocchiut |
1.1 |
AcLevel2::AcLevel2() { |
14 |
mocchiut |
1.5 |
this->Clear(); |
15 |
mocchiut |
1.1 |
} |
16 |
mocchiut |
1.2 |
|
17 |
pamela |
1.7 |
/** |
18 |
|
|
* Clear variables |
19 |
|
|
**/ |
20 |
mocchiut |
1.8 |
void AcLevel2::Clear(Option_t *t){ |
21 |
mocchiut |
1.2 |
status[0]=0; |
22 |
|
|
hitmap[0]=0; |
23 |
|
|
hitstatus[0]=0; |
24 |
|
|
trigger[0]=0; |
25 |
|
|
status[1]=0; |
26 |
|
|
hitmap[1]=0; |
27 |
|
|
hitstatus[1]=0; |
28 |
|
|
trigger[1]=0; |
29 |
mocchiut |
1.5 |
unpackError=0; |
30 |
mocchiut |
1.2 |
} |
31 |
pam-fi |
1.3 |
|
32 |
pamela |
1.7 |
/** |
33 |
|
|
* checks if detector what is hit |
34 |
|
|
**/ |
35 |
mocchiut |
1.6 |
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 |
pamela |
1.7 |
/** |
54 |
|
|
* is CAS hit? |
55 |
|
|
**/ |
56 |
mocchiut |
1.6 |
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 |
pamela |
1.7 |
/** |
76 |
|
|
* is CAT hit? |
77 |
|
|
**/ |
78 |
mocchiut |
1.6 |
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 |
pamela |
1.7 |
/** |
98 |
|
|
* is CARD hit? |
99 |
|
|
**/ |
100 |
mocchiut |
1.6 |
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 |
pamela |
1.7 |
/** |
120 |
|
|
* is AC hit? |
121 |
|
|
**/ |
122 |
mocchiut |
1.6 |
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 |
pam-fi |
1.3 |
/** |
131 |
|
|
* 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{ |
134 |
|
|
for(int i=0;i<2;i++){ |
135 |
|
|
l2->status[i] = status[i]; |
136 |
|
|
l2->hitmap[i] = hitmap[i]; |
137 |
|
|
l2->hitstatus[i] = hitstatus[i]; |
138 |
|
|
l2->trigger[i] = trigger[i]; |
139 |
|
|
} |
140 |
|
|
} |
141 |
|
|
|
142 |
|
|
void AcLevel2::SetFromLevel2Struct(cAcLevel2 *l2){ |
143 |
|
|
for(int i=0;i<2;i++){ |
144 |
|
|
status[i] = l2->status[i]; |
145 |
|
|
hitmap[i] = l2->hitmap[i]; |
146 |
|
|
hitstatus[i] = l2->hitstatus[i]; |
147 |
|
|
trigger[i] = l2->trigger[i]; |
148 |
|
|
} |
149 |
|
|
} |
150 |
mocchiut |
1.6 |
|