#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 "MicroException.hh"
#include <TApplication.h>
#include <TGClient.h>
#include <TGListBox.h>
#include <TList.h>
Include dependency graph for geometryDisplay.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 42 of file geometryDisplay.cpp.
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 != 2 ) { 00050 FILE_LOG(logERROR) << "usage: geometryDispay streeFile" << endl; 00051 exit(1); 00052 } 00053 00054 00055 00056 string steerName; 00057 steerName.assign(argv[1]); 00058 00059 TApplication *theApp; 00060 00061 argc = 1; 00062 theApp = new TRint("App", &argc, argv); 00063 00064 00065 /******************************************/ 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 steerDesc.setRun(run); 00089 00090 fclose(file); 00091 00092 FILE_LOG(logINFO) << run << endl; 00093 00094 00095 00096 /******************************************/ 00097 /******************************************/ 00098 /******************************************/ 00099 /******************************************/ 00100 /******************************************/ 00101 /******************************************/ 00102 00103 00104 TCanvas *c1 = new TCanvas("c1","Analyze.mac",620,790); 00105 c1->Range(-1,0,19,30); 00106 string txt = ""; 00107 00108 00109 TGeoManager *frame =new TGeoManager("Frame","mM event displayer"); 00110 00111 TGeoMaterial *mat = new TGeoMaterial("SomeMaterial",1,1,1); 00112 TGeoMedium *med = new TGeoMedium("SomeMedium",1,mat); 00113 00114 // ----- create World volume who contains all other. 00115 TGeoVolume *world = frame->MakeBox("World", med, 1, 1, 1); // x, y , z size unit cm 00116 frame->SetMaxVisNodes(9216 * detector.getNumberOfChambers()); // 10 chambers de 9216 channel 00117 00118 int nbChannel = 0; 00119 00120 try { 00121 const ChamberMap_t &chambers = detector.getChambers(); 00122 int color = 0; 00123 for (ChamberMap_t::const_iterator chamberIt = chambers.begin(); chamberIt != chambers.end(); ++chamberIt) { 00124 Chamber& chamber = *(chamberIt->second); 00125 00126 cout << "========= Cahmber [" << chamber.getId() << "]" <<endl; 00127 //cout << " getXLength[ "<<chamber.getXLength() <<"]" << endl; 00128 //cout << " getYLength[ "<<chamber.getYLength() <<"]" << endl; 00129 //cout << " getMaxX[ "<<chamber.getMaxX() <<"]" << endl; 00130 //cout << " getMaxY[ "<<chamber.getMaxY() <<"]" << endl; 00131 FILE_LOG(logINFO) << endl << "Chamber ID[" << chamber.getId() << "]" << endl; 00132 string result = (chamber.getXrotation() == false) ? "No rotation over X" : "There is a rotation over X"; 00133 FILE_LOG(logINFO) << result << endl; 00134 result = (chamber.getYrotation() == false) ? "No rotation over Y" : "There is a rotation over Y"; 00135 FILE_LOG(logINFO) << result << endl; 00136 00137 00138 const BoardMap_t &boards = chamber.getBoards(); 00139 00140 int color = 3; 00141 for (BoardMap_t::const_iterator boardIt = boards.begin(); boardIt != boards.end(); ++boardIt) { 00142 Board& board = *(boardIt->second); 00143 const ChipMap_t &chips = board.getChips(); 00144 00145 for (ChipMap_t::const_iterator chipIt = chips.begin(); chipIt != chips.end(); ++chipIt) { 00146 Chip& chip = *(chipIt->second); 00147 const ChannelMap_t &channels = chip.getChannels(); 00148 00149 for (ChannelMap_t::const_iterator channelIt = channels.begin(); channelIt != channels.end(); ++channelIt) 00150 { 00151 00152 Channel& channel = *(channelIt->second); 00153 //the only known way to get the information from the channels number i 00154 //MTChannel* channel = (MTChannel*)evt->GetChannels()->UncheckedAt(i); 00155 00156 float xHalfLength = .098; //cm 00157 float yHalfLength = .098; // cm 00158 float zHalfLength = .12; // cm 00159 00160 xHalfLength = (float) channel.getXLength() / 2 - .1; //cm 00161 yHalfLength = (float) channel.getYLength() / 2 - .1 ; // cm 00162 zHalfLength = .1; // cm 00163 00164 00165 float x=channel.getX() ;//+xOffset; 00166 float y=channel.getY() ;//+yOffset; 00167 float z=channel.getZ() ; 00168 00169 00170 00171 // ChannelPad name 00172 string padID; 00173 //padID = channel.getStringSoftId(); 00174 padID = channel.getSoftId().toString(); 00175 00176 //TGeoVolume *pad = frame->MakeBox(padID.c_str(),med,zHalfLength,xHalfLength,yHalfLength ); 00177 TGeoVolume *pad = frame->MakeBox(padID.c_str(),med,zHalfLength,yHalfLength,xHalfLength ); 00178 //set now the color of the pad 00179 stringstream ch; 00180 //ch<<channel.getSoftId(); 00181 00182 00183 world->AddNode(pad,1,new TGeoTranslation(z,-y,x)); 00184 nbChannel++; 00185 00186 //color = ( channel.getChip().getBoard().getId() + 2 + channel.getChip().getId()) ; 00187 color = ( channel.getChip().getBoard().getId()) + 1 ; 00188 00189 00190 00191 00192 pad->SetLineColor( color); 00193 pad->SetFillStyle(1001); 00194 } 00195 } 00196 } 00197 } 00198 } 00199 catch ( MicroException e ) 00200 { 00201 cout << e.getMessage(); 00202 } 00203 frame->SetTopVolume(world); 00204 frame->CloseGeometry(); 00205 00206 world->Draw(); 00207 00208 00209 FILE_LOG(logINFO) << "" << endl; 00210 FILE_LOG(logINFO) << " X" << endl; 00211 FILE_LOG(logINFO) << " " << endl; 00212 FILE_LOG(logINFO) << " /\\" << endl; 00213 FILE_LOG(logINFO) << " |" << endl; 00214 FILE_LOG(logINFO) << " |" << endl; 00215 FILE_LOG(logINFO) << " |" << endl; 00216 FILE_LOG(logINFO) << "SYSTEM de COORDONNEES: (0,0) en bas a gauche X---> Y " << endl; 00217 FILE_LOG(logINFO) << " Z sortant." << endl; 00218 00219 00220 theApp->Run(); 00221 delete theApp; 00222 // run ROOT application 00223 00224 return 0; 00225 }