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

TkrLayer.cxx

Go to the documentation of this file.
00001 
00002 //
00003 // The TkrLayer class provides access to a single layer of Si Strips.
00004 // It contains a list of strips that were above thresh, and TOT and 
00005 // ERRF values.
00006 //
00008 
00009 // --------------------- Modification History ------------------------
00010 // Apr 2000 Daniel Flath - Cleaned up to look like other files in package
00011 // Jan 1999 Daniel Flath - ROOT HTML Documentation added
00012 // Dec 1999 Daniel Flath - Creation
00013 
00014 #include "digiRootData/TkrLayer.h"
00015 
00016 ClassImp(TkrLayer)
00017 
00018 // -------------------------------------------------------------------
00019 TkrLayer::TkrLayer() {
00020   // Default constructor
00021     m_strips = 0;
00022     m_numStrips = -1;
00023 }
00024 // -------------------------------------------------------------------
00025 
00026 TkrLayer::TkrLayer(TObjArray *strips = 0) {
00027   // Creates a new TkrLayer object with the specified TObjArray of Si
00028   // Si strips.  
00029   // (The array pointer defaults to 0 {NULL}, in which case a new
00030   // TObjArray is created.)
00031   m_numStrips = -1;
00032   if (strips)
00033     m_strips = strips;
00034   else
00035     m_strips = new TObjArray();
00036 }
00037 
00038 // -------------------------------------------------------------------
00039 TkrLayer::~TkrLayer() {
00040   // Destructor.  Removes all strips
00041   if (m_strips) {
00042     m_strips->Delete();
00043     delete m_strips;
00044     m_strips = 0;
00045   }
00046 }
00047 // -------------------------------------------------------------------
00048 Int_t TkrLayer::Compare(const TObject *obj) const {
00049     // Ritz numbering convention:  Layer Number 0 is the bottom most layer - closest to the CAL
00050     if (this == obj) return 0;
00051     if (TkrLayer::Class() != obj->IsA()) return -1;
00052 
00053     // Even numbered planes have the layer measuring Y on the bottom - closer to CAL
00054     // Odd numbered planes have the layer measuring X on the bottom - closer to CAL
00055     UInt_t id_this = getLayerNum();
00056     UInt_t id_layer = ((TkrLayer*)obj)->getLayerNum();
00057 
00058     //id_this = (getPlaneNum() << 1) | (getXY() ? 0 : 1);    
00059     //id_layer = (((TkrLayer*)obj)->getPlaneNum() << 1) | (((TkrLayer*)obj)->getXY() ? 0 : 1);
00060     
00061     if (id_this == id_layer)
00062         return 0;
00063     else
00064         return (id_this > id_layer) ? 1 : -1;
00065 }
00066 // -------------------------------------------------------------------
00067 Bool_t TkrLayer::IsSortable() const {
00068   return kTRUE;
00069 }
00070 // -------------------------------------------------------------------
00071 void TkrLayer::setToT(UInt_t right, UInt_t left) {
00072     m_ToT[0] = right;
00073     m_ToT[1] = left;
00074 }
00075 // -------------------------------------------------------------------
00076 void TkrLayer::setErrf(UInt_t right, UInt_t left) {
00077     m_errf[0] = right;
00078     m_errf[1] = left;
00079 }
00080 // -------------------------------------------------------------------
00081 Int_t TkrLayer::getToT(UChar_t ctrlNum) {
00082     if ((ctrlNum == 0) || (ctrlNum ==1))
00083         return m_ToT[ctrlNum];
00084     else
00085         return -1;
00086 }
00087 // -------------------------------------------------------------------
00088 Int_t TkrLayer::getErrf(UChar_t ctrlNum) {
00089     if ((ctrlNum == 0) || (ctrlNum ==1))
00090         return m_errf[ctrlNum];
00091     else
00092         return -1;
00093 }
00094 
00095 UShort_t TkrLayer::getLayerNum() const {
00096     // Even numbered planes have the layer measuring Y on the bottom - closer to CAL
00097     // Odd numbered planes have the layer measuring X on the bottom - closer to CAL
00098     if ( (getPlaneNum() % 2) == 0 ) {   // even plane
00099         // So in this case, we want the layer measuring Y to have the smaller id
00100         return ( (getPlaneNum() << 1) | (getXY() ? 0 : 1) );
00101     } else  {                           // odd plane
00102         // here we want the layer measuring X to have the smaller id
00103         return ( (getPlaneNum() << 1) | (getXY() ? 1 : 0) );
00104     }
00105 }
00106 
00107 void TkrLayer::Clean(Option_t *option) {
00108     m_strips->Delete(option);
00109     m_numStrips = -1;
00110    // delete m_strips;
00111  //   m_strips = 0;
00112 }
00113 

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