#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 <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 dependency graph for channelIdDisplay.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 48 of file channelIdDisplay.cpp.
00050 { //un-named script to be run in ROOT framework 00051 00052 FILELog::ReportingLevel() = FILELog::FromString(INFO); 00053 00054 //----- Control usage and option 00055 if ( argc != 4 ) { 00056 FILE_LOG(logERROR) << "usage: channelDisplay streeFile chamberId boardId" << endl; 00057 exit(1); 00058 } 00059 00060 string steerName; 00061 steerName.assign(argv[1]); 00062 00063 string chamberId; 00064 chamberId.assign(argv[2]); 00065 ui32 chamId = atoi(chamberId.c_str()); 00066 00067 00068 string sboardId; 00069 sboardId.assign(argv[3]); 00070 ui32 boardId = atoi(sboardId.c_str()); 00071 00072 TApplication *theApp; 00073 00074 argc = 1; 00075 theApp = new TRint("App", &argc, argv); 00076 00077 00078 /******************************************/ 00079 /******************************************/ 00080 /******************************************/ 00081 00082 // test if sterr file exist 00083 FILE *file = fopen(steerName.c_str(), "r"); 00084 if(file == NULL){ 00085 FILE_LOG(logERROR) << "Steer file ["<< steerName.c_str() << "] does not exist" << endl; 00086 exit(0); 00087 fclose(file); 00088 } 00089 // create Run, set detector and steerDesc from steer XML file 00090 SteerDesc steerDesc; 00091 XMLTool xml; 00092 xml.parse(steerDesc, steerName); 00093 00094 Detector detector; 00095 if ( detector.build(steerDesc) == steerDesc.chambers.size() ) 00096 { 00097 00098 00099 Run run(detector); 00100 00101 steerDesc.setRun(run); 00102 00103 fclose(file); 00104 00105 00106 /******************************************/ 00107 /******************************************/ 00108 /******************************************/ 00109 /******************************************/ 00110 /******************************************/ 00111 /******************************************/ 00112 00113 00114 string txt = ""; 00115 00116 int xLength, yLength = 0; 00117 00118 try { 00119 const Chamber &chamber = detector.getChamberById(chamId); 00120 const BoardMap_t &boards = chamber.getBoards(); 00121 00122 00123 xLength = int((*(boards.find(boardId)->second)).getXLength()) ;//+ chamber.getX(); 00124 yLength = int((*(boards.find(boardId)->second)).getYLength()) ;//+ chamber.getX(); 00125 00126 00127 if ( chamber.getZrotation() == 90 ) 00128 { 00129 int foo = xLength; 00130 xLength = yLength; 00131 yLength = foo; 00132 } 00133 00134 00135 //xLength = int(chamber.getXLength()) ;//+ chamber.getX(); 00136 //yLength = int(chamber.getYLength()) ;//+ chamber.getY(); 00137 00138 int hMax = 1600; 00139 int vMax = 1600; 00140 int hCanvas,vCanvas; 00141 00142 if ( yLength > xLength) 00143 { 00144 vCanvas = vMax; 00145 float coef = (float) yLength / (float)xLength; 00146 cout << "--yLength["<< yLength << "]" << endl; 00147 cout << "--xLength["<< xLength << "]" << endl; 00148 cout << "--coef["<< coef << "]" << endl; 00149 hCanvas = int(hMax / coef); 00150 } 00151 else 00152 { 00153 hCanvas = hMax; 00154 float coef = (float)xLength / (float)yLength; 00155 cout << "--yLength["<< yLength << "]" << endl; 00156 cout << "--xLength["<< xLength << "]" << endl; 00157 cout << "--coef["<< coef << "]" << endl; 00158 vCanvas = int(vMax / coef); 00159 } 00160 00161 TCanvas *c1 = new TCanvas("c1","Analyze.mac",vCanvas,hCanvas); 00162 00163 00164 FILE_LOG(logINFO) << "Chamber size xLength[" << xLength << "], yLenght[" << yLength << "]" << endl; 00165 00166 c1->Range(0,0,yLength,xLength);// (xmin,ymin,xmax,ymax 00167 int nbChannel = 0; 00168 int color = 0; 00169 for (BoardMap_t::const_iterator boardIt = boards.begin(); boardIt != boards.end(); ++boardIt) 00170 { 00171 Board& board = *(boardIt->second); 00172 if ( board.getId()==boardId) 00173 { 00174 const ChipMap_t &chips = board.getChips(); 00175 for (ChipMap_t::const_iterator chipIt = chips.begin(); chipIt != chips.end(); ++chipIt) 00176 { 00177 Chip& chip = *(chipIt->second); 00178 00179 cout << "board [" << board.getId() << "] chip[" << chip.getId() << "]" << endl; 00180 const ChannelMap_t &channels = chip.getChannels(); 00181 for (ChannelMap_t::const_iterator channelIt = channels.begin(); channelIt != channels.end(); ++channelIt) 00182 { 00183 Channel& channel = *(channelIt->second); 00184 { 00185 00186 00187 cout << "chip[" << chip.getId() << "] channel [" << channel.getHardId() << "] Xpos[" << channel.getX() << "] yPos[" << channel.getY() << "]" << endl; 00188 00189 float x=channel.getLeftBottomX(); 00190 float y=channel.getLeftBottomY(); 00191 float z=channel.getZ() ; 00192 00193 00194 stringstream currentpad; 00195 currentpad<<channel.getHardId(); 00196 00197 float x2=channel.getRightUpperX(); 00198 float y2=channel.getRightUpperY(); 00199 00200 TPaveLabel *pl1= new TPaveLabel(y+yLength/2-board.getY(), x+xLength/2-board.getX(),y2+yLength/2-board.getY(), x2+xLength/2-board.getX() ,currentpad.str().c_str()); // x1 x2 y1 y2 00201 if ( chamber.getType().find("GASSIPLEX") != string::npos) 00202 { 00203 // GASSIPLEX 00204 // pl1->SetFillColor(board.getId() + 3); 00205 cout << "------DEBUG GASSIPLERX" << endl; 00206 } 00207 else { 00208 //HARDROC Or MICROROC 00209 // pl1->SetFillColor(board.getId() - 11); 00210 //pl1->SetFillColor( 3); 00211 } 00212 //pl1->SetFillColor(3); 00213 pl1->Draw(); 00214 } 00215 } 00216 } 00217 } 00218 } 00219 00220 00221 Toolbox::printRepere(chamber.getXrotation(),chamber.getYrotation(),chamber.getZrotation()); 00222 00223 00224 theApp->Run(); 00225 delete theApp; 00226 // run ROOT application 00227 } //end try 00228 catch ( MicroException e ) 00229 { 00230 FILE_LOG(logERROR) << e.getMessage() << endl; 00231 } 00232 00233 } 00234 return 0; 00235 }