Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ChipEvent.cxx

Go to the documentation of this file.
00001 
00002 // $Id: ChipEvent.cxx,v 1.5 2005/02/22 21:44:43 bspeak Exp $
00003 //
00004 // ChipEvent is the base class stored in a TClonesArray by the
00005 // BlockEvent class
00006 //
00007 // Author: B. Speakman 2004.09.03
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 // The ChipEvent class stores the Location of the chip (and potentially
00021 // channel) in a one two byte short variable as such
00022 //
00023 // CRATE     : 0-15 : 4 bits : Stored in 1:4 through 1:7
00024 // VARC      : 0-3  : 2 bits : Stored in 1:2 through 1:3
00025 // VMM       : 0-5  : 3 bits : Stored in 0:7 through 1:1
00026 // VADC      : 0-1  : 1 bit  : Stored in 0:6
00027 // VACHIP    : 0-2  : 2 bits : Stored in 0:4 through 0:5
00028 // VACHANNEL : 0-15 : 4 bits : Stored in 0:0 through 0:3
00029 //
00030 //      Byte:           1              0
00031 //       Bit: 7654  32 107 6   54   3210
00032 //              |    |  |  |    |     |
00033 //            Crate  | Vmm |  Vachip  |
00034 //                 Varc   Vadc      Vachannel
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 }

Generated on Mon Feb 15 11:06:31 2010 for loon by  doxygen 1.3.9.1