GTS/TFndTrig.cxx

00001 // @(#)fROOT/GTS:$Name:  $:$Id: TFndTrig.cxx,v 1.15 2007/09/24 07:32:41 Diego_Faso Exp $
00002 // Revision Author: Diego Faso <mailto:faso@to.infn.it>, 2005/06/24
00003 // Original author: P. Cerello <mailto:cerello@to.infn.it>, 2001
00004 
00006 //            //
00007 //  TFndTrig  //
00008 //            //
00010 
00011 #include "Riostream.h"
00012 
00013 #include "TFndRun.h"
00014 #include "TFndTrig.h"
00015 
00016 ClassImp(TFndTrig)
00017 
00018 //________________________________
00019 TFndTrig::TFndTrig():
00020   fPU_cont(),fPU_mult(),fMalu(),fTrigSel()
00021 {
00022   Reset();
00023 }
00024 
00025 //________________________________
00026 TFndTrig::~TFndTrig()
00027 { 
00028   // ---
00029   Reset();
00030 }
00031 
00032 //________________________________
00033 void TFndTrig::Reset(){
00034   
00035   bzero(fPU_cont,sizeof(fPU_cont));
00036   bzero(fPU_mult,sizeof(fPU_mult));
00037   bzero(fMalu,sizeof(fPU_mult));
00038   bzero(fTrigSel,sizeof(fTrigSel));
00039   
00040 }
00041 
00042 //________________________________
00043 UShort_t TFndTrig::GetPU_cont_bit(const UInt_t &mod_num,const UInt_t &bit){
00044   //  UInt_t fPU_cont[K_N_GTS_P_UNITS]; // 16 bit words (Pattern Units content)
00045   
00046   if(mod_num<0 || mod_num>=K_N_GTS_P_UNITS){
00047     Error("GetPU_cont_bit","PU number not accepted (%u)",mod_num); return 0;
00048   }
00049   if(bit > 15){
00050     Error("GetPU_cont_bit","requested bit (%u) not available",bit); return 0;
00051   }
00052   
00053   return ExtractBit(fPU_cont[mod_num], bit,16);
00054   
00055 }
00056 
00057 //________________________________
00058 UShort_t TFndTrig::GetPU_mult_bit(const UInt_t &mod_num,const UInt_t &bit){
00059   //  UInt_t fPU_mult[K_N_GTS_P_UNITS]; // 16 bit words (Pattern Units content)
00060   
00061   if(mod_num<0 || mod_num>=K_N_GTS_P_UNITS){
00062     Error("GetPU_mult_bit","PU number not accepted (%u)",mod_num); return 0;
00063   }
00064   
00065   return ExtractBit(fPU_mult[mod_num], bit,16);
00066   
00067 }
00068 
00069 //________________________________
00070 UShort_t TFndTrig::GetMalu_bit(const UInt_t &mod_num,const UInt_t &bit){
00071   // remember that "bit" range is [0-31]
00072   
00073   if(mod_num<0 || mod_num>=K_N_GTS_MALU){
00074     Error("GetPU_mult_bit","PU number not accepted (%u)",mod_num); return 0;
00075   }
00076   
00077   UShort_t result = ExtractBit(fMalu[mod_num], bit,32);
00078   
00079   //  Printf("========> %u, (%x)",fMalu[mod_num],fMalu[mod_num]);
00080   //   Printf("========> bit: %u ---> %u, (%x)",
00081   //              bit,
00082   //              (UInt_t)TMath::Power(2,bit),
00083   //              (UInt_t)TMath::Power(2,bit)
00084   //              );
00085   
00086   return result;
00087   
00088 }
00089 
00090 //________________________________
00091 UShort_t TFndTrig::GetTriggerSelector_bit(const UInt_t &mod_num,const UInt_t &bit){
00092   //  UInt_t fTrigSel[K_N_GTS_SELECTORS];  // (Trigger selector content)
00093   
00094   if(mod_num<0 || mod_num>=K_N_GTS_SELECTORS){
00095     Error("GetTriggerSelector_bit","PU number not accepted (%u)",mod_num); return 0;
00096   }
00097   if(bit > 15){
00098     Error("GetTriggerSelector_bit","requested bit (%u) not available",bit); return 0;
00099   }
00100   
00101   return ExtractBit(fTrigSel[mod_num], bit,16);
00102   
00103 }
00104 
00105 //_______________________________
00106 void TFndTrig::PrintTrigger(Int_t depth) const
00107 {
00108   // to be completed
00109 
00110   // following line could be removed...
00111   // ...keeping it for further developments:
00112   // maybe in the future a selection based on "depth"
00113   // will be required  
00114   if(depth <= 0) return;
00115 
00116   TString msg = "";
00117   TString cline = "";
00118   
00119   cline.Form("\n ---------------------------"); msg+=cline;
00120   cline.Form("Printing trigger content:\n"); msg+=cline;
00121 
00122   cline.Form("--- Pattern Units content/multiplicty:\n"); msg+=cline;
00123   for(UInt_t i=0;i<K_N_GTS_P_UNITS;i++){
00124     cline.Form("PU[%u]: content: 0x%x ; multiplicity: 0x%x\n",
00125                i,
00126                fPU_cont[i],
00127                fPU_mult[i]);
00128     msg+=cline;  
00129   }
00130   
00131   if(depth > 1){
00132     cline.Form("\n --- \nTrigger Selector content:\n"); msg+=cline;
00133     for(UInt_t i=0;i<K_N_GTS_SELECTORS;i++){
00134       cline.Form("Trigger selector[%u]: content: 0x%x\n",
00135                  i,
00136                  fTrigSel[i]);
00137       msg+=cline;
00138     }
00139   }
00140     
00141   if(depth > 2){
00142     cline.Form("\n --- \nMALU content:\n"); msg+=cline;
00143     for(UInt_t i=0;i<K_N_GTS_MALU;i++){
00144       cline.Form("Malu[%u]: content: 0x%x\n",
00145                  i,
00146                  fMalu[i]);  
00147       msg+=cline;
00148     }
00149   }
00150   
00151   cline.Form(" ---------------------------\n"); msg+=cline;
00152 
00153   msg.Resize(msg.Sizeof()-2);
00154   Printf("%s",msg.Data());
00155 }

Generated on Tue Oct 16 15:40:46 2007 by  doxygen 1.5.2