00001 /* @version $Revision: 1703 $ * @modifiedby $Author: jacquem $ * @lastmodified $Date: 2012-05-03 10:11:12 +0200 (Thu, 03 May 2012) $ */ 00002 #ifndef RUNDESC_HH 00003 #define RUNDESC_HH 00004 00005 ////////////////////////////////////////////////////////////////////////// 00006 // // 00007 // SteerDesc for MICROMEGAS READOUT // 00008 // // 00009 ////////////////////////////////////////////////////////////////////////// 00010 00011 //#include <string> 00012 #include <vector> 00013 #include <string> 00014 #include <iostream> 00015 #include "event/Run.hh" 00016 #include "geometry/Detector.hh" 00017 00018 00019 00020 typedef struct 00021 { 00022 int id; 00023 unsigned int serial; 00024 int boardId; 00025 int difId; 00026 int chamberId; 00027 } ChipInfo_t; 00028 00029 typedef struct 00030 { 00031 int id; 00032 int difId; 00033 int chamberId; 00034 } BoardInfo_t; 00035 00036 typedef struct 00037 { 00038 int id; 00039 int chamberId; 00040 } DifInfo_t; 00041 00042 typedef struct 00043 { 00044 std::string type; 00045 float xPos; 00046 float yPos; 00047 float zPos; 00048 bool xRotation ; 00049 bool yRotation ; 00050 int zRotation ; 00051 bool stripHorizontal ; 00052 std::string unit ; 00053 int id; 00054 } chamber_info_t; 00055 00056 typedef struct 00057 { 00058 std::string path; 00059 std::string type; 00060 int runId; 00061 } input_info_t; 00062 00063 typedef struct SlowControl_t 00064 { 00065 unsigned int scId; 00066 std::string type; 00067 unsigned int chamberId; 00068 unsigned int difId; 00069 unsigned int boardId; 00070 unsigned int pmId; 00071 std::string name; 00072 SlowControl_t(){ 00073 scId = chamberId = difId = boardId = pmId = 0;; 00074 type = name = ""; 00075 } 00076 } ; 00077 00078 ////////////////////////////////////////////////////////////////////////// 00079 /// CLASS EVENT // 00080 ////////////////////////////////////////////////////////////////////////// 00081 class SteerDesc { 00082 00083 public: 00084 SteerDesc(); 00085 ~SteerDesc(); 00086 bool setRun(Run &cible); 00087 bool isValid(void) const; 00088 std::string getSlowControlPath(); 00089 void print(void)const; 00090 00091 size_t fillDifByChamberId(std::vector<DifInfo_t>& result,i32 chamberId) const; 00092 size_t fillBoardByChamberId(std::vector<BoardInfo_t>& result, i32 chamberId) const; 00093 size_t fillChipByChamberId(std::vector<ChipInfo_t>& result, i32 chamberId) const; 00094 00095 00096 public: 00097 // input and output files for reconstruction 00098 input_info_t *inputInfo; // only use by XMLTool as a temporary structure 00099 std::vector<input_info_t> inputFiles; 00100 std::string outputFile; 00101 00102 // detector description 00103 std::string detectorName; 00104 std::string date; 00105 std::string detectorDescription; 00106 int lastChamberId; 00107 int lastDifId; 00108 int lastBoardId; 00109 chamber_info_t *chamberInfo; 00110 std::vector<chamber_info_t> chambers; 00111 BoardInfo_t *boardInfo; 00112 std::vector<BoardInfo_t> boards; 00113 DifInfo_t *difInfo; 00114 std::vector<DifInfo_t> difs; 00115 ChipInfo_t *chipInfo; 00116 std::vector<ChipInfo_t> chips; 00117 00118 ui16 monitoringDif; 00119 00120 // slow control 00121 std::string slowControl; // slow control input file 00122 SlowControl_t *slowControlInfo; // temporary structure 00123 std::vector<SlowControl_t>slowControls; // list of slow control structures 00124 }; 00125 00126 // structure to be used with remove_copy_if template algoritm to copy filter vector element on chamberId 00127 template <typename T> struct filterByChamberId: public std::binary_function<T,int,bool> { 00128 bool operator() (const T& s, int id) const{ 00129 //std::cout << " s.id[" << s.id <<"], s.chamberId[" << s.chamberId << "], chaberId recherche[" << id << " ]" << std::endl; 00130 return ( s.chamberId != id ); 00131 00132 } 00133 }; 00134 00135 #endif