#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 <TreeClass.hh>
#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 "HardRockChamber6.hh"
#include "XMLTool.hh"
#include "MicroException.hh"
#include <TApplication.h>
#include <TGClient.h>
#include <TGListBox.h>
#include <TList.h>
Go to the source code of this file.
Functions | |
int | main (int argc, char **argv) |
int main | ( | int | argc, | |
char ** | argv | |||
) |
Definition at line 42 of file channelIdDisplay.C.
00044 { //un-named script to be run in ROOT framework 00045 00046 FILELog::ReportingLevel() = FILELog::FromString(INFO); 00047 00048 //----- Control usage and option 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 // test if sterr file exist 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 // create Run, set detector and steerDesc from steer XML file 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 // c1->Range(-1,0,19,30); 00103 //c1->Range(0,-20,20,50);// (xmin,ymin,xmax,ymax 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);// (xmin,ymin,xmax,ymax 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 // Root origine coordonee en bas a gauche. Micromegas origine des coordonees en haut a gauche 00142 TPaveLabel *pl1= new TPaveLabel(x, yLength - y,x2, yLength - y2,currentpad.str().c_str()); // x1 x2 y1 y2 00143 if ( chamber.getType().find("GASSIPLEX") != string::npos) 00144 { 00145 // GASSIPLEX 00146 pl1->SetFillColor(board.getId() + 3); 00147 } 00148 else { 00149 //HARDROC 00150 pl1->SetFillColor(board.getId() + chip.getId() + 1); 00151 } 00152 //pl1->SetFillColor(3); 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 // run ROOT application 00164 } //end try 00165 catch ( MicroException e ) 00166 { 00167 FILE_LOG(logERROR) << e.getMessage() << endl; 00168 } 00169 00170 return 0; 00171 }