#include <TROOT.h>
#include <TPaveLabel.h>
#include <TRint.h>
#include <TCanvas.h>
#include <TTree.h>
#include <TFile.h>
#include <TSystem.h>
#include <TGeoManager.h>
#include <TGeoMatrix.h>
#include <iostream>
#include <sstream>
#include "Log.hh"
#include "Run.hh"
#include "Board.hh"
#include "Chip.hh"
#include "Dif.hh"
#include "Chamber.hh"
#include "Event.hh"
#include "Detector.hh"
#include "Centaure.hh"
#include "GassiplexChamber1.hh"
#include "GassiplexChamber4.hh"
#include "Hardroc1Chamber.hh"
#include "XMLTool.hh"
#include "Toolbox.hh"
#include "MicroException.hh"
#include <TApplication.h>
#include <TGClient.h>
#include <TGListBox.h>
#include <TList.h>
Include dependency graph for boardDisplay.cpp:
Go to the source code of this file.
Functions | |
int | main (int argc, char **argv) |
int main | ( | int | argc, | |
char ** | argv | |||
) |
Definition at line 43 of file boardDisplay.cpp.
00045 { //un-named script to be run in ROOT framework 00046 00047 FILELog::ReportingLevel() = FILELog::FromString(INFO); 00048 00049 //----- Control usage and option 00050 if ( argc != 3 ) { 00051 FILE_LOG(logERROR) << "usage: channelDisplay streeFile chamberId " << endl; 00052 exit(1); 00053 } 00054 00055 string steerName; 00056 steerName.assign(argv[1]); 00057 00058 string chamberId; 00059 chamberId.assign(argv[2]); 00060 ui32 chamId = atoi(chamberId.c_str()); 00061 00062 TApplication *theApp; 00063 00064 argc = 1; 00065 theApp = new TRint("App", &argc, argv); 00066 00067 00068 /******************************************/ 00069 /******************************************/ 00070 /******************************************/ 00071 00072 // test if sterr file exist 00073 FILE *file = fopen(steerName.c_str(), "r"); 00074 if(file == NULL){ 00075 FILE_LOG(logERROR) << "Steer file ["<< steerName.c_str() << "] does not exist" << endl; 00076 exit(0); 00077 fclose(file); 00078 } 00079 // create Run, set detector and steerDesc from steer XML file 00080 SteerDesc steerDesc; 00081 XMLTool xml; 00082 xml.parse(steerDesc, steerName); 00083 00084 Detector detector; 00085 detector.build(steerDesc); 00086 00087 Run run(detector); 00088 00089 steerDesc.setRun(run); 00090 00091 fclose(file); 00092 00093 00094 /******************************************/ 00095 /******************************************/ 00096 /******************************************/ 00097 /******************************************/ 00098 /******************************************/ 00099 /******************************************/ 00100 00101 00102 string txt = ""; 00103 00104 float xLength, yLength = 0.; 00105 00106 try { 00107 const Chamber &chamber = detector.getChamberById(chamId); 00108 xLength = chamber.getXLength() + chamber.getX(); 00109 yLength = chamber.getYLength() + chamber.getY() ; 00110 cout << "chamber xPos[" << chamber.getX() << "]" << endl; 00111 cout << "chamber yPos[" << chamber.getY() << "]" << endl; 00112 00113 //TCanvas *c1 = new TCanvas("c1","Analyze.mac",yLength*20,xLength*20); 00114 int hMax = 800; 00115 int vMax = 800; 00116 int hMin = 100; 00117 int vMin = 100; 00118 int hCanvas,vCanvas=0; 00119 00120 if ( yLength > xLength) 00121 { 00122 vCanvas = vMax; 00123 float coef = (float) yLength / (float)xLength; 00124 hCanvas = int(hMax / coef); 00125 if ( hCanvas < hMin ) { hCanvas = hMin; } 00126 } 00127 else 00128 { 00129 hCanvas = hMax; 00130 float coef = (float) xLength / (float)yLength; 00131 vCanvas = int(vMax / coef); 00132 if ( vCanvas < vMin ) { vCanvas = vMin; } 00133 } 00134 FILE_LOG(logINFO) << "Canvas size [" << hCanvas << "], [" << vCanvas << "]" << endl; 00135 TCanvas *c1 = new TCanvas("c1","Analyze.mac",vCanvas,hCanvas); 00136 00137 00138 00139 c1->Range(0,0,yLength ,xLength);// (xmin,ymin,xmax,ymax 00140 int nbChannel = 0; 00141 int color = 0; 00142 const BoardMap_t &boards = chamber.getBoards(); 00143 for (BoardMap_t::const_iterator boardIt = boards.begin(); boardIt != boards.end(); ++boardIt) 00144 { 00145 Board& board = *(boardIt->second); 00146 { 00147 //float x=board.getX() - (board.getXLength() /2);;//- chamber.getX(); 00148 //float y=board.getY() - (board.getYLength() /2); 00149 float x=board.getLeftBottomX(); 00150 float y=board.getLeftBottomY(); 00151 float z=chamber.getZ() ; 00152 00153 stringstream currentpad; 00154 currentpad<<board.getId(); 00155 00156 //float x2 = x+board.getXLength(); 00157 //float y2 = y+board.getYLength(); 00158 float x2 = board.getRightUpperX(); 00159 float y2 = board.getRightUpperY(); 00160 00161 00162 cout << "board.getXLength()[" << board.getXLength() <<"]" <<endl; 00163 cout << "board.getYLength()[" << board.getYLength() <<"]" <<endl; 00164 00165 00166 cout << "----- draw board id[" << board.getId() << "] posx[" << board.getX() << "] y[" << board.getY() <<"] " << endl; 00167 // On inverse x et y pour repere micromegas et on ajoute un offset pour decaler l origine ROOT au centre et non plus en bas a gauche 00168 // ROOT 00169 // Origine (0,0) au centre de la fenetre 00170 // 00171 // y 00172 // ˆ 00173 // | 00174 // | 00175 // -----X-----> x 00176 // | 00177 // | 00178 // | 00179 TPaveLabel *pl1= new TPaveLabel(y+yLength/2, x +xLength/2, y2+yLength/2, x2+xLength/2,currentpad.str().c_str()); //(Double_t x1, Double_t y1, Double_t x2, Double_t y2,... 00180 pl1->SetFillColor(board.getId() + 3); 00181 pl1->Draw(); 00182 if ( chamber.getType().find("GASSIPLEX") == string::npos) 00183 { // Not a Gassiplex 00184 FILE_LOG(logINFO) << "Board id:"<< board.getId() << " use Dif id: " << board.getDif()->getId() << endl; 00185 } 00186 } 00187 00188 } 00189 00190 Toolbox::printRepere(chamber.getXrotation(),chamber.getYrotation(),chamber.getZrotation()); 00191 00192 theApp->Run(); 00193 delete theApp; 00194 // run ROOT application 00195 } //end try 00196 catch ( MicroException e ) 00197 { 00198 FILE_LOG(logERROR) << e.getMessage() << endl; 00199 } 00200 00201 return 0; 00202 }