#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 geometryDisplay.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 != 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 const BoardMap_t &boards = chamber.getBoards(); 00126 00127 int color = 3; 00128 for (BoardMap_t::const_iterator boardIt = boards.begin(); boardIt != boards.end(); ++boardIt) { 00129 Board& board = *(boardIt->second); 00130 const ChipMap_t &chips = board.getChips(); 00131 00132 for (ChipMap_t::const_iterator chipIt = chips.begin(); chipIt != chips.end(); ++chipIt) { 00133 Chip& chip = *(chipIt->second); 00134 const ChannelMap_t &channels = chip.getChannels(); 00135 00136 for (ChannelMap_t::const_iterator channelIt = channels.begin(); channelIt != channels.end(); ++channelIt) 00137 { 00138 Channel& channel = *(channelIt->second); 00139 //the only known way to get the information from the channels number i 00140 //MTChannel* channel = (MTChannel*)evt->GetChannels()->UncheckedAt(i); 00141 00142 float xHalfLength = .098; //cm 00143 float yHalfLength = .098; // cm 00144 float zHalfLength = .12; // cm 00145 00146 xHalfLength = (float) channel.getXLength() / 2 - .1; //cm 00147 yHalfLength = (float) channel.getYLength() / 2 - .1 ; // cm 00148 zHalfLength = .1; // cm 00149 00150 00151 float x=channel.getX() ;//+xOffset; 00152 float y=channel.getY() ;//+yOffset; 00153 float z=channel.getZ() ; 00154 00155 00156 00157 // ChannelPad name 00158 string padID=""; 00159 stringstream currentpad;// (stringstream::in | stringstream::out); 00160 currentpad<<channel.getSoftId(); 00161 padID="pad_"+currentpad.str(); 00162 00163 00164 TGeoVolume *pad = frame->MakeBox(padID.c_str(),med,zHalfLength,xHalfLength,yHalfLength ); 00165 //set now the color of the pad 00166 stringstream ch; 00167 ch<<channel.getSoftId(); 00168 00169 00170 world->AddNode(pad,1,new TGeoTranslation(z,x,y)); 00171 nbChannel++; 00172 00173 color = 2; 00174 00175 if ( channel.getHardId() % 96 == 0 ) 00176 { color = 4; } 00177 00178 color = channel.getHardId() % 96; 00179 cout << color << endl; 00180 00181 00182 pad->SetLineColor( color); 00183 pad->SetFillStyle(1001); 00184 } 00185 } 00186 } 00187 } 00188 } 00189 catch ( MicroException e ) 00190 { 00191 cout << e.getMessage(); 00192 } 00193 frame->SetTopVolume(world); 00194 frame->CloseGeometry(); 00195 00196 world->Draw(); 00197 00198 00199 theApp->Run(); 00200 delete theApp; 00201 // run ROOT application 00202 00203 return 0; 00204 }