00001
00002
00003
00004
00005
00006
00007
00008
00010 #include "ChipEvent.h"
00011 #include "RSM.h"
00012
00013 #include "MessageService/MsgService.h"
00014
00015 ClassImp(ChipEvent)
00016 CVSID("$Id: ChipEvent.cxx,v 1.5 2005/02/22 21:44:43 bspeak Exp $");
00017
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00037
00038 ChipEvent::ChipEvent() {
00039 RSMVer << "ChipEvent::ChipEvent" << endl;
00040 this->Reset();
00041 }
00042
00043 ChipEvent::~ChipEvent() {
00044 RSMVer << "ChipEvent::~ChipEvent" << endl;
00045 }
00046
00047 void ChipEvent::Reset() {
00048 fChipLoc=0;
00049 this->LocalReset();
00050 }
00051
00052 void ChipEvent::PackLoc(Char_t Crate,
00053 Char_t Varc,
00054 Char_t Vmm,
00055 Char_t Vadc,
00056 Char_t Vachip,
00057 Char_t Vachan) {
00058 fChipLoc= 0;
00059 if(Crate>=0) fChipLoc += Crate << 12;
00060 if(Varc>=0) fChipLoc += Varc << 10;
00061 if(Vmm>=0) fChipLoc += Vmm << 7;
00062 if(Vadc>=0) fChipLoc += Vadc << 6;
00063 if(Vachip>=0) fChipLoc += Vachip << 4;
00064 if(Vachan>=0) fChipLoc += Vachan << 0;
00065 }
00066
00067 bool ChipEvent::IsLoc(Char_t Crate,
00068 Char_t Varc,
00069 Char_t Vmm,
00070 Char_t Vadc,
00071 Char_t Vachip,
00072 Char_t Vachan) {
00073 if(Crate>=0 && Crate!=this->GetCrate()) return(false);
00074 if(Varc>=0 && Varc!=this->GetVarc()) return(false);
00075 if(Vmm>=0 && Vmm!=this->GetVmm()) return(false);
00076 if(Vadc>=0 && Vadc!=this->GetVadc()) return(false);
00077 if(Vachip>=0 && Vachip!=this->GetVachip()) return(false);
00078 if(Vachan>=0 && Vachan!=this->GetVachan()) return(false);
00079
00080 return(true);
00081 }
00082
00083 const char* ChipEvent::AsString() {
00084 static char newstring[80] = " ";
00085
00086 sprintf(newstring,"%d-%d-%d-%d-%d",
00087 GetCrate(),
00088 GetVarc(),
00089 GetVmm(),
00090 GetVadc(),
00091 GetVachip());
00092
00093 return(newstring);
00094 }
00095
00096 Int_t ChipEvent::Compare(const TObject *obj) const {
00097 if(fChipLoc < ((ChipEvent*)obj)->fChipLoc)
00098 return(-1);
00099 if(fChipLoc > ((ChipEvent*)obj)->fChipLoc)
00100 return(1);
00101
00102 return(0);
00103 }