00001 #include <TROOT.h>
00002 #include <TPaveLabel.h>
00003 #include <TRint.h>
00004 #include <TCanvas.h>
00005 #include <TTree.h>
00006 #include <TFile.h>
00007 #include <TSystem.h>
00008 #include <TGeoManager.h>
00009 #include <TGeoMatrix.h>
00010 #include <TCanvas.h>
00011 #include <iostream>
00012 #include <TreeClass.hh>
00013 #include <sstream>
00014 #include "Log.hh"
00015
00016 #include "Run.hh"
00017 #include "Board.hh"
00018 #include "Chip.hh"
00019 #include "Dif.hh"
00020 #include "Chamber.hh"
00021 #include "Event.hh"
00022 #include "Detector.hh"
00023 #include "Centaure.hh"
00024 #include "GassiplexChamber1.hh"
00025 #include "GassiplexChamber4.hh"
00026 #include "HardRockChamber6.hh"
00027 #include "XMLTool.hh"
00028 #include "MicroException.hh"
00029
00030
00031 #include <TApplication.h>
00032 #include <TGClient.h>
00033 #include <TGListBox.h>
00034 #include <TList.h>
00035
00036
00037
00038 using namespace std;
00039
00040
00041
00042 int main(int argc, char **argv)
00043
00044 {
00045
00046 FILELog::ReportingLevel() = FILELog::FromString(INFO);
00047
00048
00049 if ( argc != 3 ) {
00050 FILE_LOG(logERROR) << "usage: channelDisplay streeFile chamberId " << endl;
00051 exit(1);
00052 }
00053
00054 string steerName;
00055 steerName.assign(argv[1]);
00056
00057 string chamberId;
00058 chamberId.assign(argv[2]);
00059 ui32 chamId = atoi(chamberId.c_str());
00060
00061 TApplication *theApp;
00062
00063 argc = 1;
00064 theApp = new TRint("App", &argc, argv);
00065
00066
00067
00068
00069
00070
00071
00072 FILE *file = fopen(steerName.c_str(), "r");
00073 if(file == NULL){
00074 FILE_LOG(logERROR) << "Steer file ["<< steerName.c_str() << "] does not exist" << endl;
00075 exit(0);
00076 fclose(file);
00077 }
00078
00079 SteerDesc steerDesc;
00080 XMLTool xml;
00081 xml.parse(steerDesc, steerName);
00082
00083 Detector detector;
00084 detector.build(steerDesc);
00085
00086 Run run(detector);
00087
00088 steerDesc.setRun(run);
00089
00090 fclose(file);
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101 TCanvas *c1 = new TCanvas("c1","Analyze.mac",620,790);
00102
00103
00104 string txt = "";
00105
00106 int xLength, yLength = 0;
00107
00108 try {
00109 const Chamber &chamber = detector.getChamberById(chamId);
00110 xLength = chamber.getXLength() + chamber.getX();
00111 yLength = chamber.getYLength() + chamber.getY();
00112
00113 FILE_LOG(logINFO) << "Chamber size xLength[" << xLength << "], yLenght[" << yLength << "]" << endl;
00114
00115 c1->Range(0,0,xLength,yLength);
00116 int nbChannel = 0;
00117 int color = 0;
00118 const BoardMap_t &boards = chamber.getBoards();
00119 for (BoardMap_t::const_iterator boardIt = boards.begin(); boardIt != boards.end(); ++boardIt)
00120 {
00121 Board& board = *(boardIt->second);
00122 const ChipMap_t &chips = board.getChips();
00123 for (ChipMap_t::const_iterator chipIt = chips.begin(); chipIt != chips.end(); ++chipIt)
00124 {
00125 Chip& chip = *(chipIt->second);
00126 const ChannelMap_t &channels = chip.getChannels();
00127 for (ChannelMap_t::const_iterator channelIt = channels.begin(); channelIt != channels.end(); ++channelIt)
00128 {
00129 Channel& channel = *(channelIt->second);
00130
00131 float x=channel.getX() ;
00132 float y=channel.getY() ;
00133 float z=channel.getZ() ;
00134
00135 stringstream currentpad;
00136 currentpad<<channel.getHardId();
00137
00138 float x2 = x+.9;
00139 float y2 = y+.9;
00140
00141
00142 TPaveLabel *pl1= new TPaveLabel(x, yLength - y,x2, yLength - y2,currentpad.str().c_str());
00143 if ( chamber.getType().find("GASSIPLEX") != string::npos)
00144 {
00145
00146 pl1->SetFillColor(board.getId() + 3);
00147 }
00148 else {
00149
00150 pl1->SetFillColor(board.getId() + chip.getId() + 1);
00151 }
00152
00153 pl1->Draw();
00154 }
00155 }
00156 }
00157
00158
00159 FILE_LOG(logINFO) << "SYSTEM de COORDONNEES: (0,0) en haut a gauche ----> X " << endl;
00160
00161 theApp->Run();
00162 delete theApp;
00163
00164 }
00165 catch ( MicroException e )
00166 {
00167 FILE_LOG(logERROR) << e.getMessage() << endl;
00168 }
00169
00170 return 0;
00171 }