ROOT logo
//*-- Author  : D. Gonzalez-Diaz
//*-- Created : 08/06/2006
//*-- Modified: 24/08/2007 by P.Cabanelas/D.Gonzalez-Diaz

//_HADES_CLASS_DESCRIPTION
/////////////////////////////////////////////////////
//
//  HRpcCal
//
//  Class for the Calibrated RPC data
//
////////////////////////////////////////////////////

#ifndef HRPCCAL_H
#define HRPCCAL_H

#include "hlocateddataobject.h"
#include "hrpcraw.h"
#include "TObject.h"

class HRpcCal : public HLocatedDataObject {
protected:
  Float_t rightTime;     //right leading time     [ns]
  Float_t leftTime;      //left leading time      [ns]
  Float_t rightTime2;    //2nd right leading time [ns]
  Float_t leftTime2;     //2nd left leading time  [ns]
  Float_t rightCharge;   //right charge           [pC]
  Float_t leftCharge;    //left  charge           [pC]
  Float_t rightCharge2;  //2nd right charge       [pC]
  Float_t leftCharge2;   //2nd left  charge       [pC]
  Short_t address;       //Geometrical address (sec, col, cell)
  Short_t logBit;        //Data Info
  			 //See: http://hades-wiki.gsi.de/cgi-bin/view/RPC/SoftwareDocumentation1 

public:
  HRpcCal();
  ~HRpcCal();

  // Functions getVariable  
  Float_t getRightTime()        { return rightTime;    }
  Float_t getLeftTime()         { return leftTime;     }
  Float_t getRightTime2()       { return rightTime2;   }
  Float_t getLeftTime2()        { return leftTime2;    }
  Float_t getRightCharge()      { return rightCharge;  }
  Float_t getLeftCharge()       { return leftCharge;   }
  Float_t getRightCharge2()     { return rightCharge2; }
  Float_t getLeftCharge2()      { return leftCharge2;  }
  Short_t getLogBit()           { return logBit;       }
  Short_t getAddress()          { return address;      }

  Int_t   getNLocationIndex()   { return 3;}

  inline Int_t getLocationIndex(Int_t i);

  Int_t   getSector()          const  { return (address>>10)  & 7;  }
  Int_t   getColumn()          const  { return (address>>7)   & 7;   }
  Int_t   getCell()            const  { return  address       & 127; }

  Int_t   getNLeadings()       { if(logBit<0)  return -1; return logBit>>12;         }
  Int_t   getNTrailings()      { if(logBit<0)  return -1; return (logBit>>8) & 15;   }
  Int_t   getLastChargeFlag()  { if(logBit<0)  return -1; return (logBit>>7) & 1;    }
  Int_t   getDataPairFlag()    { if(logBit<0)  return -1; return (logBit>>6) & 1;    }
  Int_t   getDataVersion()     { if(logBit<0)  return -1; return (logBit>>4) & 3;    }
  Int_t   getDataType()        { if(logBit<0)  return -1; return (logBit>>1) & 7;    }

  // Functions setVariable
  void    setRightTime(Float_t arightTime)             { rightTime=arightTime;       }
  void    setLeftTime(Float_t aleftTime)               { leftTime=aleftTime;         }
  void    setRightTime2(Float_t arightTime2)           { rightTime2=arightTime2;     }
  void    setLeftTime2(Float_t aleftTime2)             { leftTime2=aleftTime2;       }
  void    setRightCharge(Float_t arightCharge)         { rightCharge=arightCharge;   }
  void    setLeftCharge(Float_t aleftCharge)           { leftCharge=aleftCharge;     }
  void    setRightCharge2(Float_t arightCharge2)       { rightCharge2=arightCharge2; }
  void    setLeftCharge2(Float_t aleftCharge2)         { leftCharge2=aleftCharge2;   }
  void    setLogBit(Short_t alogBit)                   { logBit=alogBit;             }
  void    setAddress(Short_t aAddress)                 { address=aAddress;           }

  inline void    setAddress(Int_t sec, Int_t col, Int_t cell);

  
  ClassDef(HRpcCal,3) //RPC cal data class
};

inline void  HRpcCal::setAddress(Int_t sec, Int_t col, Int_t cell) { 
  address = (sec<<10) + (col<<7) + cell; }

inline Int_t HRpcCal::getLocationIndex(Int_t i) {
  switch (i) {
  case 0 : return getSector(); break;
  case 1 : return getColumn(); break;
  case 2 : return getCell(); break;
  }
  return -1;
}


#endif /* !HRPCCAL_H */
 hrpccal.h:1
 hrpccal.h:2
 hrpccal.h:3
 hrpccal.h:4
 hrpccal.h:5
 hrpccal.h:6
 hrpccal.h:7
 hrpccal.h:8
 hrpccal.h:9
 hrpccal.h:10
 hrpccal.h:11
 hrpccal.h:12
 hrpccal.h:13
 hrpccal.h:14
 hrpccal.h:15
 hrpccal.h:16
 hrpccal.h:17
 hrpccal.h:18
 hrpccal.h:19
 hrpccal.h:20
 hrpccal.h:21
 hrpccal.h:22
 hrpccal.h:23
 hrpccal.h:24
 hrpccal.h:25
 hrpccal.h:26
 hrpccal.h:27
 hrpccal.h:28
 hrpccal.h:29
 hrpccal.h:30
 hrpccal.h:31
 hrpccal.h:32
 hrpccal.h:33
 hrpccal.h:34
 hrpccal.h:35
 hrpccal.h:36
 hrpccal.h:37
 hrpccal.h:38
 hrpccal.h:39
 hrpccal.h:40
 hrpccal.h:41
 hrpccal.h:42
 hrpccal.h:43
 hrpccal.h:44
 hrpccal.h:45
 hrpccal.h:46
 hrpccal.h:47
 hrpccal.h:48
 hrpccal.h:49
 hrpccal.h:50
 hrpccal.h:51
 hrpccal.h:52
 hrpccal.h:53
 hrpccal.h:54
 hrpccal.h:55
 hrpccal.h:56
 hrpccal.h:57
 hrpccal.h:58
 hrpccal.h:59
 hrpccal.h:60
 hrpccal.h:61
 hrpccal.h:62
 hrpccal.h:63
 hrpccal.h:64
 hrpccal.h:65
 hrpccal.h:66
 hrpccal.h:67
 hrpccal.h:68
 hrpccal.h:69
 hrpccal.h:70
 hrpccal.h:71
 hrpccal.h:72
 hrpccal.h:73
 hrpccal.h:74
 hrpccal.h:75
 hrpccal.h:76
 hrpccal.h:77
 hrpccal.h:78
 hrpccal.h:79
 hrpccal.h:80
 hrpccal.h:81
 hrpccal.h:82
 hrpccal.h:83
 hrpccal.h:84
 hrpccal.h:85
 hrpccal.h:86
 hrpccal.h:87
 hrpccal.h:88
 hrpccal.h:89
 hrpccal.h:90
 hrpccal.h:91
 hrpccal.h:92
 hrpccal.h:93
 hrpccal.h:94
 hrpccal.h:95
 hrpccal.h:96
 hrpccal.h:97