--- DarthVader/AnticounterLevel2/src/AcLevel2.cpp 2006/11/09 17:05:43 1.5 +++ DarthVader/AnticounterLevel2/src/AcLevel2.cpp 2007/02/12 08:17:21 1.6 @@ -1,5 +1,6 @@ #include #include + ClassImp(AcLevel2); AcLevel2::AcLevel2() { @@ -18,6 +19,93 @@ unpackError=0; } +bool AcLevel2::IsHit(TString what){ + + char* cabl[] = {"CARD4","CAT2","CAS1","ND","CARD2","CAT4","CAS4","ND", + "CARD3","CAT3","CAS3","ND","CARD1","CAT1","CAS2","ND"}; + + bool answer = false; + for(Int_t ibit=0; ibit<16; ibit++){ + if( what.Contains( cabl[ibit], TString::kIgnoreCase ) ){ + if( what.Contains( "M" , TString::kIgnoreCase ) ) + answer = (Bool_t)((hitmap[0]>>ibit)&1) & (Bool_t)((hitstatus[0]>>ibit)&1); + else if( what.Contains( "E" , TString::kIgnoreCase ) ) + answer = (Bool_t)((hitmap[1]>>ibit)&1) & (Bool_t)((hitstatus[1]>>ibit)&1); + return answer; + }; + }; + return answer; + +} + +bool AcLevel2::CAShit(TString card) +{ + if(card.Contains("main") || card.CompareTo("")==0 ) + { + if( this->IsHit("CAS1-M") )return true; + if( this->IsHit("CAS2-M") )return true; + if( this->IsHit("CAS3-M") )return true; + if( this->IsHit("CAS4-M") )return true; + } + if(card.Contains("extra") || card.CompareTo("")==0) + { + if( this->IsHit("CAS1-E") ) return true; + if( this->IsHit("CAS2-E") ) return true; + if( this->IsHit("CAS3-E") ) return true; + if( this->IsHit("CAS4-E") ) return true; + } + + return false; +} + +bool AcLevel2::CAThit(TString card) +{ + if(card.Contains("main") || card.CompareTo("")==0 ) + { + if( this->IsHit("CAT1-M") )return true; + if( this->IsHit("CAT2-M") )return true; + if( this->IsHit("CAT3-M") )return true; + if( this->IsHit("CAT4-M") )return true; + } + if(card.Contains("extra") || card.CompareTo("")==0) + { + if( this->IsHit("CAT1-E") ) return true; + if( this->IsHit("CAT2-E") ) return true; + if( this->IsHit("CAT3-E") ) return true; + if( this->IsHit("CAT4-E") ) return true; + } + + return false; +} + +bool AcLevel2::CARDhit(TString card) +{ + if(card.Contains("main") || card.CompareTo("")==0 ) + { + if( this->IsHit("CARD1-M") )return true; + if( this->IsHit("CARD2-M") )return true; + if( this->IsHit("CARD3-M") )return true; + if( this->IsHit("CARD4-M") )return true; + } + if(card.Contains("extra") || card.CompareTo("")==0) + { + if( this->IsHit("CARD1-E") ) return true; + if( this->IsHit("CARD2-E") ) return true; + if( this->IsHit("CARD3-E") ) return true; + if( this->IsHit("CARD4-E") ) return true; + } + + return false; +} + +bool AcLevel2::AChit(TString card) +{ + if(this->CAThit(card) || this->CARDhit(card) || this->CAShit(card)) return true; + + return false; +} + + /** * Fills a struct cAcLevel2 with values from a AcLevel2 object (to put data into a F77 common). */ @@ -38,3 +126,4 @@ trigger[i] = l2->trigger[i]; } } +