/data3/calcul/jacquem/working_dir/Micromegas/micromegasFrameWork/src/analyse/root/spark.cpp

Go to the documentation of this file.
00001 /* @version $Revision: 1566 $ * @modifiedby $Author: jacquem $ * @lastmodified $Date: 2012-03-08 14:00:10 +0100 (Thu, 08 Mar 2012) $ */
00002 #include <TROOT.h>
00003 #include <TPaveLabel.h>
00004 #include <TRint.h>
00005 #include <TCanvas.h>
00006 #include <TTree.h>
00007 #include <TFile.h>
00008 #include <TSystem.h>
00009 #include <TGeoManager.h>
00010 #include <TGeoMatrix.h>
00011 #include <TCanvas.h>
00012 #include <iostream>
00013 #include <sstream>
00014 
00015 
00016 #include "event/Run.hh"
00017 #include "event/Event.hh"
00018 
00019 #include "geometry/Board.hh"
00020 #include "geometry/Chip.hh"
00021 #include "geometry/Dif.hh"
00022 #include "geometry/Chamber.hh"
00023 #include "geometry/Detector.hh"
00024 #include "geometry/GassiplexChamber1.hh"
00025 #include "geometry/GassiplexChamber4.hh"
00026 #include "geometry/Hardroc1Chamber.hh"
00027 
00028 #include "xml/XMLTool.hh"
00029 
00030 #include "tools/MicroException.hh"
00031 #include "tools/Log.hh"
00032 
00033 
00034 #include <TApplication.h>
00035 #include <TGClient.h>
00036 #include <TGListBox.h>
00037 #include <TList.h>
00038 
00039 
00040 
00041 using namespace std;
00042 
00043 
00044 //______________________________________________________________________________
00045 int main(int argc, char **argv)
00046 
00047 {  //un-named script to be run in ROOT framework
00048 
00049   FILELog::ReportingLevel() = FILELog::FromString(INFO);
00050 
00051   //----- Control usage and option
00052   if ( argc != 3 ) {
00053    FILE_LOG(logERROR)  << "usage: channelDisplay streeFile chamberId " << endl;
00054    exit(1);
00055   }
00056 
00057   string steerName;
00058   steerName.assign(argv[1]);
00059 
00060   string chamberId;
00061   chamberId.assign(argv[2]);
00062   ui32 chamId = atoi(chamberId.c_str());
00063 
00064   TApplication *theApp;
00065 
00066   argc = 1;
00067   theApp = new TRint("App", &argc, argv);
00068 
00069 
00070   /******************************************/
00071   /******************************************/
00072   /******************************************/
00073 
00074 // test if sterr file exist
00075   FILE *file = fopen(steerName.c_str(), "r");
00076   if(file == NULL){
00077     FILE_LOG(logERROR)  << "Steer file ["<< steerName.c_str() << "] does not exist" << endl;
00078     exit(0);
00079     fclose(file);
00080   }
00081 // create Run, set detector and steerDesc from steer XML file
00082     SteerDesc steerDesc;
00083     XMLTool xml;
00084     xml.parse(steerDesc, steerName);
00085 
00086     Detector detector;
00087     detector.build(steerDesc);
00088 
00089     Run run(detector);
00090 
00091     steerDesc.setRun(run);
00092 
00093     fclose(file);
00094 
00095 
00096   /******************************************/
00097   /******************************************/
00098   /******************************************/
00099   /******************************************/
00100   /******************************************/
00101   /******************************************/
00102 
00103 
00104    string txt = "";
00105 
00106    float 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     int nbChannel = 0;
00114     const BoardMap_t &boards = chamber.getBoards();
00115     for (BoardMap_t::const_iterator boardIt = boards.begin(); boardIt != boards.end(); ++boardIt)
00116     {
00117       Board& board = *(boardIt->second);
00118       const ChipMap_t &chips = board.getChips();
00119       for (ChipMap_t::const_iterator chipIt = chips.begin(); chipIt != chips.end(); ++chipIt)
00120       {
00121          Chip& chip = *(chipIt->second);
00122      
00123          float x=chip.getX() - chamber.getX() ;
00124          float y=chip.getY() - chamber.getY();
00125          float z=chamber.getZ() ;
00126 
00127          float x2 = x+chip.getXLength();
00128          float y2 = y+chip.getYLength();
00129 
00130 
00131          cout << "-----hardid[" << chip.getId()<< "] "  << "\t";
00132          cout << "x[" << x << "], x2[" << x2 << "]    " << "\t" ; 
00133          cout << "y[" << y << "], y2[" << y2 << "]" << endl;
00134       }
00135     }
00136 
00137     string result = (chamber.getXrotation() == false) ? "No rotation over X" : "There is a rotation over X";
00138     FILE_LOG(logINFO) << result    << endl;
00139     result = (chamber.getYrotation() == false) ? "No rotation over Y" : "There is a rotation over Y";
00140     FILE_LOG(logINFO) << result    << endl;
00141     FILE_LOG(logINFO) << "" << endl;
00142     FILE_LOG(logINFO) << "                                            X" << endl;
00143     FILE_LOG(logINFO) << "                                             " << endl;
00144     FILE_LOG(logINFO) << "                                            /\\" << endl;
00145     FILE_LOG(logINFO) << "                                             |" << endl;
00146     FILE_LOG(logINFO) << "                                             |" << endl;
00147     FILE_LOG(logINFO) << "                                             |" << endl;
00148     FILE_LOG(logINFO) << "SYSTEM de COORDONNEES: (0,0) en bas a gauche X--->  Y    " << endl;
00149     FILE_LOG(logINFO) << "  Z sortant." << endl;
00150     FILE_LOG(logINFO) << "  Cote PAD Dif a gauche." << endl;
00151 
00152 
00153    } //end try
00154     catch ( MicroException e )
00155    {
00156    FILE_LOG(logERROR) << e.getMessage() << endl;
00157    }
00158 
00159    return 0;
00160 }

Generated on Mon Jan 7 13:15:21 2013 for MicromegasFramework by  doxygen 1.4.7