STEER/TFndRdt.h

00001 // @(#)fROOT/STEER:$Name:  $:$Id: TFndRdt.h,v 1.23 2007/09/05 11:09:42 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>, 2000
00004 
00005 #ifndef FROOT_TFndRdt
00006 #define FROOT_TFndRdt
00007 
00009 //                                                                      //
00010 //                               TFndRdt                                //
00011 //                                                                      //
00012 // This class gives the Description of the Raw Data Tape event.         //
00013 // The private part includes some data members                          //
00014 // (event length, pointers to the whole buffer and the subdetector      //
00015 // buffers) and a set of member functions retrieving some information   //
00016 // needed to build the Hit Data Tape.                                   //
00017 // The public part allows to dump the event and invoke the member       //
00018 // functions which transform the RDT sub-events into HDT sub-events.    //
00019 //                                                                      //
00021 
00022 #include "TObject.h"
00023 #include "TFndHdt.h"
00024 #include "TFndFeeMap.h"
00025 
00026 #include "FROOT.h"
00027 using namespace FROOT;
00028 
00029 typedef struct {
00030   Int_t Layer; // Layer 1 = ISIM 2 = OSIM 
00031   Int_t Module; // Module number ISIM (1-8) OSIM (1-10)
00032   Int_t Side;  // (See FROOT::E_Fnd_Sil_Side)
00033   Int_t Strip; // Strip number
00034   Int_t Spy;   // 1=Spy
00035   Int_t Noise; // Noise level: 0=OK ... 6=dead
00036   Int_t AdcCh; // cram channel number
00037   Int_t AdcVal;// adc value
00038 } SILADCHIT;
00039 
00040 typedef struct {
00041   Int_t    NumStripCl; // Number of Strip of Cluster
00042   Int_t    AdcChCl;  // Center of Mass of Cluster (adc channel) 
00043   Double_t StripChCl; // Center of Mass of Cluster
00044   Double_t NoiseCl;  // Noise level of Cluster
00045   Double_t AdcValCl; // Sum Adc Values of Cluster
00046 } SILCLRAW;
00047 
00048 // Ascending adc val cluster sorting function
00049 struct SAscendingAdcValClSort
00050 {
00051      bool operator()(const SILCLRAW& rpStart,const SILCLRAW& rpEnd)
00052      {
00053           return rpStart.AdcValCl < rpEnd.AdcValCl;
00054      }
00055 };
00056 
00057 // Descending adc val cluster sorting function
00058 struct SDescendingAdcValClSort
00059 {
00060      bool operator()(const SILCLRAW& rpStart,const SILCLRAW& rpEnd)
00061      {
00062           return rpStart.AdcValCl > rpEnd.AdcValCl;
00063      }
00064 };
00065 
00066 
00067 class TFndRdt : public TObject {
00068 
00069  public:
00070   enum E_FIN_RDT_DetID { FIN_RDT_Eqp_Gts = 0,
00071                          FIN_RDT_Eqp_Tof = 1, 
00072                          FIN_RDT_Eqp_Isi = 2, 
00073                          FIN_RDT_Eqp_Osi = 3, 
00074                          FIN_RDT_Eqp_Lmd = 4,
00075                          FIN_RDT_Eqp_Stb = 5 
00076   };
00077 
00078   enum E_FIN_RDT_EqpID { 
00079     FIN_EQ_CORBO =         0,  // corbo (CES RCB8047)
00080     FIN_EQ_CAEN_V513 =     1,  // vme i/o register (CAEN V513)
00081     FIN_EQ_TRIG_SEL =      2,  // vme trigger selector
00082     FIN_EQ_CAEN_V529 =     3,  // vme pattern unit (CAEN V259)
00083     FIN_EQ_CAEN_V560 =     4,  // vme scaler (CAEN V560)
00084     FIN_EQ_CAEN_VN1485 =   5,  // vme adc 9U (CAEN VN1485)
00085     FIN_EQ_CAEN_VN1488 =   6,  // vme tdc 9U (CAEN VN1488)
00086     FIN_EQ_LECROY_1277 =   7,  // vme tdc 9U (LeCroy 1277)
00087     FIN_EQ_ADC_6U =        8,  // vme adc 6U(CAEN xxxxx )
00088     FIN_EQ_CAEN_673A =     9,  // vme tdc 6U64 (CAEN 673A )
00089     FIN_EQ_LECROY_4532 =  20, // malu (LeCroy 4532)
00090     FIN_EQ_CAMAC_IO_REG = 21, // camac i/o register (CAEN )
00091     FIN_EQ_CAMAC_SCALER = 22, // camac scaler (CAEN C285 or LeCroy 2251)
00092     FIN_EQ_LeCroy_2249 =  23, // camac adc (LeCroy 2249)
00093     FIN_EQ_LeCroy_2277 =  24, // camac tdc (LeCroy 2277)
00094     FIN_EQ_LeCroy_2229 =  25 // camac tdc (LeCroy 2229)
00095   };
00096   
00097  private:
00098   
00099   Int_t fDebugLev; // taken from TFndRun
00100   Int_t fCurRunType; // see TFndRun and FROOT.h
00101   TFndFeeMap *fFndFeeMap; // maybe it will be replaced by a (coming soon) global pointer to TFndDB
00102   //  TFndHdt *fCurHdtEv; // current HDT event taken from TFndRun (do not delete it here)
00103 
00104   UInt_t *fRawEvent; // pointer to the (complete) raw event
00105   
00106   std::vector<SILADCHIT> fSilHits;
00107   Bool_t fMustEvalCommonMode;
00108   Bool_t fMustFindSilClusters;
00109 
00110   Int_t fSilAdcVal[(Int_t)E_FIN_OUTER_LAYER+1][(Int_t)K_N_Sil_Modules+1][(Int_t)K_N_Sil_Sides-1][(Int_t)K_N_Sil_Strips+1]; 
00111   Int_t fSilAdcNoi[(Int_t)E_FIN_OUTER_LAYER+1][(Int_t)K_N_Sil_Modules+1][(Int_t)K_N_Sil_Sides-1][(Int_t)K_N_Sil_Strips+1]; 
00112   Int_t fSilAdcCh[(Int_t)E_FIN_OUTER_LAYER+1][(Int_t)K_N_Sil_Modules+1][(Int_t)K_N_Sil_Sides-1][(Int_t)K_N_Sil_Strips+1]; 
00113 
00114   void SetAdc_Val_Noi_Zero() {
00115     for(Int_t nlay = 1; nlay < (Int_t) E_FIN_OUTER_LAYER+1; nlay++)
00116       for(Int_t nmod = 1; nmod < (Int_t) K_N_Sil_Modules+1; nmod++)
00117         for(Int_t nside = 0; nside < (Int_t) K_N_Sil_Sides - 1; nside++)
00118           for(Int_t nstrip = 1; nstrip < (Int_t) K_N_Sil_Strips + 1; nstrip++) {
00119             SetSilAdcVal(nlay,nmod,nside,nstrip,0);
00120             SetSilAdcNoi(nlay,nmod,nside,nstrip,0);
00121             SetSilAdcCh(nlay,nmod,nside,nstrip,0);
00122           }
00123   }
00124   //
00125   void SetSilAdcVal(Int_t Sil_Layer,Int_t Sil_Module,Int_t Sil_Side,Int_t Sil_Nstrip,Int_t val) { fSilAdcVal[Sil_Layer][Sil_Module][Sil_Side][Sil_Nstrip] = val; }
00126   void SetSilAdcNoi(Int_t Sil_Layer,Int_t Sil_Module,Int_t Sil_Side,Int_t Sil_Nstrip,Int_t val) { fSilAdcNoi[Sil_Layer][Sil_Module][Sil_Side][Sil_Nstrip] = val; }
00127   void SetSilAdcCh(Int_t Sil_Layer,Int_t Sil_Module,Int_t Sil_Side,Int_t Sil_Nstrip,Int_t val) { fSilAdcCh[Sil_Layer][Sil_Module][Sil_Side][Sil_Nstrip] = val; }
00128   Int_t GetSilAdcVal(Int_t Sil_Layer,Int_t Sil_Module,Int_t Sil_Side,Int_t Sil_Nstrip) {return fSilAdcVal[Sil_Layer][Sil_Module][Sil_Side][Sil_Nstrip]; }
00129   Int_t GetSilAdcNoi(Int_t Sil_Layer,Int_t Sil_Module,Int_t Sil_Side,Int_t Sil_Nstrip) {return fSilAdcNoi[Sil_Layer][Sil_Module][Sil_Side][Sil_Nstrip]; }
00130   Int_t GetSilAdcCh(Int_t Sil_Layer,Int_t Sil_Module,Int_t Sil_Side,Int_t Sil_Nstrip) {return fSilAdcCh[Sil_Layer][Sil_Module][Sil_Side][Sil_Nstrip]; }
00131   /*   Double_t SilPositionStrip(Int_t side, Double_t barcha); */
00132   //
00133   void FillLmdAdcHits();
00134   void FillLmdTdcHits();
00135   void FillTofAdcHits(UInt_t *det);
00136   void FillTofTdcHits(UInt_t *det);
00137   void EvalCommonModeNoise();
00138   void FindSilClusters();
00139   
00140   UInt_t *GetDetector(E_FIN_RDT_DetID det_id);
00141   UInt_t *GetEquipment(E_FIN_RDT_DetID det_id,Int_t eqp_num);
00142 
00143   Int_t FillGtsHit(); // return 0 in case of normal buffer
00144   void  FillTofHits();
00145   void  FillSilHits(Int_t io);
00146   void  FillLmdHits();
00147   void  FillStbHits();
00148   
00149  public:
00150   
00151   TFndRdt();            // Default constructor
00152   ~TFndRdt();           // Destructor
00153   
00154   void Reset(); // Come back to the just created object
00155   void Reload(); // Reload needed info from current fndrun (Reset method is called here)
00156   
00157   void RdtToHdt(UInt_t *raw,TFndHdt *fev); // Fill the HDT structure for the current event
00158 
00159   void PrintEquipment(Int_t eqp_id, Int_t neqp); // Print the content of Equipment number "neqp"  
00160   ClassDef(TFndRdt,0)  // Raw event decoding (and HDT filling)
00161 
00162 };
00163 
00164 #endif // FROOT_TFndRdt
00165 

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