/data3/calcul/jacquem/working_dir/Micromegas/micromegasFrameWork/src/root/MTChannel.cpp

Go to the documentation of this file.
00001 /* @version $Revision: 1831 $ * @modifiedby $Author: lcdet $ * @lastmodified $Date: 2012-08-20 11:48:00 +0200 (Mon, 20 Aug 2012) $ */
00002 #include "TDirectory.h"
00003 #include "TProcessID.h"
00004 
00005 
00006 #include "root/MTChannel.hh"
00007 #include "root/MTEvent.hh"
00008 
00009 #include "event/Event.hh"
00010 #include "event/ChannelHit.hh"
00011 #include "event/Run.hh"
00012 #include "geometry/Chamber.hh"
00013 #include "geometry/Chip.hh"
00014 #include "geometry/Board.hh"
00015 #include "geometry/Dif.hh"
00016 #include "geometry/Detector.hh"
00017 #include "tools/MicroException.hh"
00018 #include "tools/Log.hh"
00019 
00020 
00021 #include <iostream>
00022 #include <sstream>
00023 
00024 class MTEvent; 
00025 
00026 using namespace std;
00027 
00028 ClassImp(MTChannel);
00029 //------------------------------------------
00030 
00031 Int_t MTChannel::Compare(const TObject *obj) const
00032 {
00033 /*
00034  if (bcIdHit == ((MTChannel *)obj)->GetBcIdHit()) return 0;
00035  else if (bcIdHit < ((MTChannel *)obj)->GetBcIdHit()) return -1;
00036  else return 1;
00037 */
00038 
00039  UInt_t absTime =  this->GetAbsTime();
00040  if ( absTime == ((MTChannel *)obj)->GetAbsTime()) return 0;
00041  else if (absTime < ((MTChannel *)obj)->GetAbsTime()) return -1;
00042  else return 1;
00043 }
00044 /*------------------------------------------------------------------------------
00045  *
00046  *    MTChannel implementation
00047  *
00048  *-----------------------------------------------------------------------------*/
00049 
00050 //______________________________________________________________________________
00051 MTChannel::MTChannel() 
00052 {
00053    // Copy a channel object
00054 
00055   fAnalogValue   =  0;
00056   fDigitalValue  =  0;
00057   fEnergy   =  0.;
00058   fHardId  = 0;
00059   fX       = 0;
00060   fY       = 0;
00061   fZ       = 0;
00062   rowInChamber = 0;
00063   colInChamber = 0;
00064   fOrder   = 0;
00065   timestamp = 0;
00066   bcIdAbs =  0;
00067   bcIdDif = 0; 
00068   bcIdHit = 0; 
00069   bcIdHitFine = 0; 
00070   memoryOrder = 0; 
00071   rejected = false;
00072 }
00073 //______________________________________________________________________________
00074 MTChannel::MTChannel(const MTChannel &orig)// : TObject(orig)
00075 {
00076    // Copy a channel object
00077 
00078   fAnalogValue   = orig.fAnalogValue;
00079   fDigitalValue  = orig.fDigitalValue;
00080   fEnergy   = orig.fEnergy;
00081   fSoftId  = orig.fSoftId;
00082   fHardId  = orig.fHardId;
00083   fX       = orig.fX;
00084   fY       = orig.fY;
00085   fZ       = orig.fZ;
00086   rowInChamber = orig.rowInChamber;
00087   colInChamber = orig.colInChamber;
00088   fOrder   = orig.fOrder;
00089   timestamp = orig.timestamp;
00090   bcIdAbs = orig.bcIdAbs;
00091   bcIdDif = orig.bcIdDif;
00092   bcIdHit = orig.bcIdHit;
00093   bcIdHitFine = orig.bcIdHitFine;
00094   memoryOrder = orig.memoryOrder;
00095 ;
00096 
00097   rejected = orig.rejected;
00098 }
00099 
00100 
00101 //______________________________________________________________________________
00102 MTChannel::MTChannel(const ChannelHit& hit, UInt_t order) {
00103   const Channel& ch = hit.getChannel();
00104 
00105   fAnalogValue   = hit.getAnalogValue();
00106   fEnergy   = 0;
00107   fDigitalValue  = hit.getDigitalValue();
00108         const Chip&  chip = ch.getChip() ;
00109         const Board& board = chip.getBoard() ;
00110         const Dif* dif = board.getDif();
00111         unsigned int difId = 0;
00112         if ( dif != NULL) difId = dif->getId();
00113         const Chamber& cham = ch.getChamber();
00114 
00115         fSoftId.SetValue(cham.getId(), difId, board.getId(), board.getRow(), board.getColumn(), board.getNbRows(), board.getNbColumns(), 
00116                   chip.getId(),chip.getRow(), chip.getColumn(),chip.getNbRows(), chip.getNbColumns(),  chip.getSerialNumber(),
00117                   ch.getHardId(),ch.getRow(),ch.getColumn());
00118         fHardId =ch.getHardId() ;
00119 
00120 
00121   fHardId = ch.getHardId();
00122   fX = ch.getX(); fY = ch.getY(); fZ = ch.getZ();
00123   rowInChamber = ch.getRowInChamber(); 
00124   colInChamber = ch.getColInChamber();
00125   fOrder = order;
00126   timestamp = hit.getTimestamp();
00127   bcIdAbs = hit.getBcIdAbs();
00128   bcIdDif = hit.getBcIdDif();
00129   bcIdHit = hit.getBcIdHit();
00130   bcIdHitFine = hit.getBcIdHitFine();
00131   memoryOrder = hit.getMemoryOrder();
00132 
00133 
00134   rejected = 0;
00135 
00136 
00137 }
00138 
00139 //______________________________________________________________________________
00140 UInt_t MTChannel::GetChamberId(void) const
00141 {
00142                 return fSoftId.GetChamberId();
00143 }
00144 //______________________________________________________________________________
00145 UInt_t MTChannel::GetBoardId(void) const
00146 {
00147                 return fSoftId.GetBoardId();
00148 }
00149 //______________________________________________________________________________
00150 UInt_t MTChannel::GetDifId(void) const
00151 {
00152                 return fSoftId.GetDifId();
00153 }
00154 //______________________________________________________________________________
00155 UInt_t MTChannel::GetChipId(void) const
00156 {
00157                 return fSoftId.GetChipId();
00158 }
00159 //______________________________________________________________________________
00160 UInt_t MTChannel::GetRowInChip(void) const
00161 {
00162                 return fSoftId.GetRowInChip();
00163 }
00164 //______________________________________________________________________________
00165 UInt_t MTChannel::GetColInChip(void) const
00166 {
00167                 return fSoftId.GetColInChip();
00168 }
00169 //______________________________________________________________________________
00170 UInt_t MTChannel::GetAbsTime(void ) const
00171 {
00172   Int_t deltaT = this->GetBcIdDif() - this->GetBcIdHit();
00173   UInt_t time = 0;
00174   if ( deltaT > 0 )
00175   {
00176     // temps absolu = BCID_Abs + ( BCID_Dif - BCID_Hit )
00177     time = this->GetBcIdAbs()  + deltaT;
00178   }
00179   else
00180   {
00181     // temps absolu = BCID_Abs + ( BCID_Dif + 2e24-1 - BCID_Hit )
00182     time = this->GetBcIdAbs() + ( this->GetBcIdDif() + 16777215 - this->GetBcIdHit() );
00183     //cout << "abs[" << this->GetBcIdAbs() << "] bcid_dif[" << this->GetBcIdDif() << "] bcIdHit[" << this->GetBcIdHit() << "] time[" << time << "]" << endl;
00184   }
00185 
00186   return time;
00187 
00188 }
00189 

Generated on Mon Jan 7 13:15:22 2013 for MicromegasFramework by  doxygen 1.4.7