Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

AcdTile.cxx

Go to the documentation of this file.
00001 
00002 //                                                                       
00003 // The AcdTile class contains the information about a single ACD tile.
00004 // This includes the PHA value, and above thresh information.  
00005 //                                                                       
00007 
00008 #include "digiRootData/AcdTile.h"
00009 
00010 ClassImp(AcdTile)
00011 
00012 AcdTile::AcdTile() : m_tag(0){
00013     // Default constructor
00014     m_tileId.setId(0, 1, 2);
00015 }
00016 
00017 AcdTile::AcdTile(UInt_t i, short base, short used) : m_tag(0){
00018     m_tileId.setId(i, used, base);
00019 }
00020 
00021 AcdTile::AcdTile(AcdId &id) : m_tag(0) {
00022     m_tileId = id;
00023 }
00024 
00025 AcdTile::~AcdTile(){
00026     // Destructor 
00027 }
00028 
00029 Int_t AcdTile::Compare(const TObject *obj) const {
00030     const short base = 2;
00031     if (this == obj) return 0;
00032     if (AcdTile::Class() != obj->IsA()) return -1;
00033     UInt_t id_this = m_tileId.getId(base);
00034     UInt_t id_tile = ((AcdTile*)obj)->getId()->getId(base);
00035     if (id_this == id_tile)
00036         return 0;
00037     else
00038         return (id_this > id_tile) ? 1 : -1; 
00039 }
00040 
00041 Bool_t AcdTile::IsSortable() const {
00042   return kTRUE;
00043 }
00044 
00045 UChar_t AcdTile::getCNO() {
00046 
00047     return ((m_tag >> ACD_V_HIGH) & ACD_M_HIGH);
00048 }
00049 
00050 UChar_t AcdTile::getVeto() {
00051     // Returns 1 if tile above thresh, 0 otherwise
00052     return ((m_tag >> ACD_V_VETO) & ACD_M_VETO);
00053 }
00054 
00055 UShort_t AcdTile::getPulseHeight() {
00056     // Returns the PMT value for this tile
00057     return ((m_tag >> ACD_V_PMT) & ACD_M_PMT);
00058 }
00059 
00060 Bool_t AcdTile::setPulseHeight(UShort_t pmtVal)
00061 {
00062     // Set the PMT/PHA value for this tile
00063     // Valid PMT/PHA values are in the range of [0,2047]
00064     if (pmtVal & ~ACD_M_PMT)
00065         return kFALSE;
00066     else {
00067         m_tag &= ~(ACD_M_PMT << ACD_V_PMT);
00068         m_tag |= pmtVal;
00069         return kTRUE;
00070     }
00071 }
00072 
00073 Bool_t AcdTile::setVeto(UChar_t hitVal)
00074 {
00075     // Set the 'hit' status of this tile
00076     // 1 == above thresh, 0 == below
00077     if (hitVal & ~ACD_M_VETO) 
00078         return kFALSE;
00079     else {
00080         m_tag &= ~(ACD_M_VETO << ACD_V_VETO);
00081         m_tag |= (hitVal << ACD_V_VETO);
00082         return kTRUE;
00083     }
00084 }
00085 
00086 
00087 Bool_t AcdTile::setCNO(UChar_t hitVal) {
00088 
00089     if (hitVal & ~ACD_M_HIGH) 
00090         return kFALSE;
00091     else {
00092         m_tag &= ~(ACD_M_HIGH << ACD_V_HIGH);
00093         m_tag |= (hitVal << ACD_V_HIGH);
00094         return kTRUE;
00095     }
00096 
00097 }

Generated at Wed Nov 21 12:22:44 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000