EmcDynamicData.h

Go to the documentation of this file.
00001 #ifndef __EMCDYNAMICDATA_H__
00002 #define __EMCDYNAMICDATA_H__
00003 
00004 
00005 // EMCDynamicData.h
00006 // ordered by Edouard Kistenev
00007 // created by Sergei Belikov
00008 // last modifications: 04/20/99
00009 // last revision - 06/11/99 - raw data access was added
00010 //##########################################################################
00011 
00012 #ifndef __EMCCONFIGURATIONFILE_H__
00013 #include "emcConfigurationFile.h"
00014 #endif
00015 
00016 //_____________________________________________________________________________
00017 
00019 
00020 struct SuperModule
00021 {
00027 
00028   int absPosition;       
00030   int femPin;            
00032   int packet;             
00034   int nch;               
00036   int startTad;          
00038   int* femCh;            
00040   int nref;              
00042   int* adRef;             
00044   int nrefCh;           
00046   int* refCh;            
00048   int startRad;                    
00050   int tac_pre;           
00052   int post_pre;           
00053 };
00054 
00055 //_____________________________________________________________________________
00056 
00059 struct Reference
00060 {
00062   int absFEM;            
00064   int chan;              
00066   int type;              
00068   int absPosition;       
00070   int nSMch;             
00072   int startSMad;   
00073 };
00074 
00075 //_____________________________________________________________________________
00076 
00079 struct EmcData
00080 {
00082   int size;             
00084   float* hg;            
00086   float* lg;            
00088   float* tac;           
00090   float** rawdata;           
00091 };
00092 
00138 class EmcDynamicData
00139 {
00140 protected:
00141   int line;               // current line in script file
00142   char* fLine;            // current string in script file
00143   EmcData Data;                 // EMCal channels data structure
00144   EmcData Refs;                 // EMCal references data structure
00145   int* DataMap;                 // pointer to array containing channels abs position 
00146   Reference* refMap;      // pointer to array of structures describing each reference
00147   
00148   bool Style;             // style of data formatting in FEM: TRUE means  
00149   // each FEM sends data for 24x6=144 channels,
00150   // FALSE means FEM sends data for 32x6=192 channels,
00151   // where 144 are real and other are disconnected AMUADC inputs
00152   bool outputRaw;         // determins if raw data must be put in output arrays
00153   bool channelMap;        // type of data mapping: channels(false) or towers(true) 
00154   static bool FEMchErr;
00155   int curSM;              // current FEM processed by Parser
00156   
00157   SuperModule* smMap;     // pointer to array of structures describing SM
00158   int nSM;                // number of FEM
00159   
00160   int Position;           // local position of current FEM
00161   int Sector;             // sector where current FEM is located .
00162   // Sector=0-8, 8-th is dummy one, used to 
00163   // describe FEM or references that are not located 
00164   // in any SM
00165   int tacDelay;           // current TAC-Pre delay. Will be default value for all other SM if not specified
00166   int postDelay;           // current Post-Pre delay. Will be default value for all other SM if not specified
00167   
00168   
00169   static int ScriptErrors;
00170   
00171   virtual int FindSector(char *String);
00172   virtual int ParseFEM(char* String);
00173   virtual int ParseCHAN(char* String);
00174   virtual int ParseREF(char* String);
00175   virtual int ParseDELAY(char* String);
00176   virtual int ParseDATA(char* String);
00177   virtual int ParseMAP(char* String);
00178   virtual void setSMad();
00179   virtual void setREFtoSM();
00180   static int cmpSM(const void* s1, const void* s2);
00181   static int cmpRef(const void* r1, const void* r2);
00182   static int cmpCh(const void* c1, const void* c2);
00183   
00184   
00185  public:
00186   static  void MBCleanStr(char* String);
00187   static  int MBControl(char *String, char*& RestString);
00188   static  int MBControl(char *String, char*& RestString, const char ** names, int n);
00190   static char* strupr(char* s);
00204   EmcDynamicData( int& status, char* fileName, 
00205                   bool GetRaw=false, 
00206                   bool Asic24ch=true, 
00207                   bool EmcMapStyle=true);
00208   
00210   EmcDynamicData( int& status,
00211                   emcConfigurationFile& configFile, 
00212                   bool GetRaw=false, 
00213                   bool Asic24ch=true, 
00214                   bool EmcMapStyle=true);
00215   
00217   void ParseConfigurationFile( int& status, 
00218                                emcConfigurationFile& configFile, 
00219                                bool GetRaw=false, 
00220                                bool Asic24ch=true, 
00221                                bool EmcMapStyle=true);
00222   
00224   const SuperModule* getSmMap(){return smMap;}
00226   // false means FEM style (channel numbers).
00227   bool getMapStyle(){return channelMap;}
00231   bool getASICStyle(){return Style;}
00233   int getnSM(){return nSM;}  
00235   const SuperModule* getSMMap(){return smMap;}
00237   int* getEmcMap(){return DataMap;} 
00239   float* getEmcHG(){return Data.hg;} 
00241   float* getEmcLG(){return Data.lg;}  
00243   float* getEmcTAC(){return Data.tac;}     
00245   int getEmcSize(){return Data.size;}       
00247   float** getEmcRaw(){return Data.rawdata;}
00249   EmcData* getEmcData(){return &Data;} 
00250   
00252   const Reference* getRefMap(){return refMap;}
00254   int getRefSize(){return Refs.size;}            
00256   float* getRefHG(){return Refs.hg;}          
00258   float* getRefLG(){return Refs.lg;}          
00260   float* getRefTAC(){return Refs.tac;}
00262   float** getRefRaw(){return Refs.rawdata;}
00264   EmcData* getRefData(){return &Refs;}
00266   virtual       ~EmcDynamicData();
00267 };
00268 #endif
00269 
00270