Main Page | Class List | File List | Class Members | File Members | Related Pages

CSCEvent.h

Go to the documentation of this file.
00001 
00034 #include "CSCChamber.h"
00035 #include "CSCReadException.h"
00036 
00037 #define TRUE 1
00038 #define FALSE 0;
00039 
00040 #define MAX_STATUS 10 // max number of status elements before ROD trailer
00041 
00046 typedef struct AtlasHeader{
00048   unsigned int marker;
00049 
00051   unsigned int size;
00052 
00055   unsigned int version;
00056 
00057   /* The source ID is 0x690000 or 0x6A0000 for the CSC.
00058      The lest significant byte is the ROD crate slot number. */
00059   unsigned int sourceID;
00060 
00062   unsigned int runNumber;
00063 
00065   unsigned int level1ID;
00066 
00068   unsigned int BCID;
00069 
00070 
00072    unsigned int triggerType;
00073 
00076   unsigned int eventType;
00077 } TAtlasHeader;
00078 
00083 typedef struct AtlasTrailer {
00085   unsigned int numStatus;
00086 
00088   unsigned int numData;
00089 
00091   unsigned int StatusPosition;
00092 }TAtlasTrailer;
00093 
00095 const double pitchXbig = 5308; 
00096 
00098 const double pitchYbig = 21004; 
00099 
00101 const double pitchXsmall = 5556.6; 
00102 
00104 const double pitchYsmall = 12922; 
00124 class CSCEvent{ 
00125 
00126   private:
00127   TAtlasHeader atlasHeader[16];
00128   TAtlasTrailer atlasTrailer[16];
00129   int numChamber;                // number of ROD headers * 2
00130   CSCChamber* chamber[32];       // chamber object stores hits
00131   unsigned int statusElement[16][MAX_STATUS];    // Status element
00132   int numSample;                 // number of samples in run
00133   int numStatus[16];             // number of status words
00134   
00135   
00136   int Cread(unsigned int *in, int num, FILE* infile); //modified fread function
00137   
00138  public:
00139   CSCEvent(); //constructor for intialization
00140   ~CSCEvent(); //destructor
00141   
00142 
00143   int ReadATLAS (FILE* infile, unsigned int * buf, int maxSize);
00144   int ReadCSC(unsigned int * source, int size);   // read one event from buffer
00145 
00147   unsigned int GetRunNumber(int rod=0) {return atlasHeader[rod].runNumber;};
00148 
00151   unsigned int GetLevel1ID(int rod=0) {return atlasHeader[rod].level1ID;};
00152 
00158   unsigned int GetStatusElement(int rod=0, int i=0) {
00159      return statusElement[rod][i];
00160   };
00161 
00162 
00166   unsigned int GetNumStatus(int rod=0) {
00167     return numStatus[rod];
00168   };
00169 
00170 
00173   unsigned int GetBCID(int rod=0) {return atlasHeader[rod].BCID;};
00174 
00177   int GetNumChamber () {return numChamber;};
00178 
00185   CSCChamber* GetChamber(int i) {return chamber[i];};
00186 
00188   int GetNumSample() {return numSample;};
00189   
00192   int GetAttenuation(int rod=0) {return (atlasHeader[rod].eventType>>24)&0x3f;};
00193   
00194 
00196   int GetLatency(int rod=0) {return (atlasHeader[rod].eventType>>8)&0xff;};
00197   
00201   int GetCalLayer(int rod=0) {return (atlasHeader[rod].eventType>>16)&0x3f;};
00202   
00204   int GetSparsification(int rod=0) {return (atlasHeader[rod].eventType>>22)&1;};
00205   
00207   int GetNeutron(int rod=0) {return (atlasHeader[rod].eventType>>23)&1;};
00208   
00210   int GetCalEnable(int rod=0) {return (atlasHeader[rod].eventType>>30)&1;};
00211   
00213   int GetSampling(int rod=0) {return ((atlasHeader[rod].eventType>>31)&1)?40:20;};
00214 
00216   void Print(); 
00217 }; 
00218 

Generated on Wed Oct 29 10:35:18 2008 for CSCRead by  doxygen 1.3.9.1