--- DarthVader/TriggerLevel2/src/TrigLevel2.cpp 2006/06/17 12:14:34 1.1 +++ DarthVader/TriggerLevel2/src/TrigLevel2.cpp 2006/11/09 17:05:50 1.5 @@ -3,27 +3,74 @@ ClassImp(TrigLevel2); TrigLevel2::TrigLevel2() { + this->Clear(); +} +void TrigLevel2::Clear(){ evcount = 0; - for (Int_t kk=0; kk<3;kk++){ - pmtpl[kk] = 0; - patternbusy[kk] = 0; - } - - for (Int_t kk=0; kk<6;kk++){ - trigrate[kk] = 0; - patterntrig[kk] = 0; - } - - for (Int_t kk=0; kk<2;kk++){ - dltime[kk] = 0; - s4calcount[kk] = 0; - } - - for (Int_t kk=0; kk<24;kk++){ - pmtcount1[kk] = 0; - pmtcount2[kk] = 0; + memset(pmtpl, 0, 3*sizeof(Int_t)); + memset(patternbusy, 0, 3*sizeof(Int_t)); + memset(trigrate, 0, 6*sizeof(Int_t)); + memset(patterntrig, 0, 6*sizeof(Int_t)); + memset(dltime, 0, 2*sizeof(Int_t)); + memset(s4calcount, 0, 2*sizeof(Int_t)); + memset(pmtcount1, 0, 24*sizeof(Int_t)); + memset(pmtcount2, 0, 24*sizeof(Int_t)); + trigconf = 0; + unpackError = 0; +} + +/** + * Fills a struct cTrigLevel2 with values from a TrigLevel2 object (to put data into a F77 common). + */ +void TrigLevel2::GetLevel2Struct(cTrigLevel2 *l2) const{ + + l2->evcount = evcount; + l2->trigconf = trigconf; + + for(int i=0;i<2;i++){ + l2->s4calcount[i] = s4calcount[i]; + l2->dltime[i] = dltime[i]; } - trigconf = 0; + for(int i=0;i<3;i++){ + l2->pmtpl[i] = pmtpl[i]; + l2->patternbusy[i] = patternbusy[i]; + } + + for(int i=0;i<6;i++){ + l2->trigrate[i] = trigrate[i]; + l2->patterntrig[i] = patterntrig[i]; + } + + for(int i=0;i<24;i++){ + l2->pmtcount1[i] = pmtcount1[i]; + l2->pmtcount2[i] = pmtcount2[i]; + } +} + +void TrigLevel2::SetFromLevel2Struct(cTrigLevel2 *l2){ + + evcount = l2->evcount; + trigconf = l2->trigconf; + + for(int i=0;i<2;i++){ + s4calcount[i] = l2->s4calcount[i]; + dltime[i] = l2->dltime[i]; + } + + for(int i=0;i<3;i++){ + pmtpl[i] = l2->pmtpl[i]; + patternbusy[i] = l2->patternbusy[i]; + } + + for(int i=0;i<6;i++){ + trigrate[i] = l2->trigrate[i]; + patterntrig[i] = l2->patterntrig[i]; + } + + for(int i=0;i<24;i++){ + pmtcount1[i] = l2->pmtcount1[i]; + pmtcount2[i] = l2->pmtcount2[i]; + } }