/data3/calcul/jacquem/working_dir/Micromegas/micromegasFrameWork/src/root/MTRun.cpp

Go to the documentation of this file.
00001 /* @version $Revision: 1605 $ * @modifiedby $Author: jacquem $ * @lastmodified $Date: 2012-03-27 17:53:04 +0200 (Tue, 27 Mar 2012) $ */
00002 #include <iostream>
00003 #include <time.h>
00004 
00005 #include "root/MTRun.hh"
00006 #include "root/MTDetector.hh"
00007 #include "root/MTChamber.hh"
00008 #include "root/MTBoard.hh"
00009 
00010 #include "tools/MicroException.hh"
00011 #include "tools/Log.hh"
00012 
00013 #include "event/Run.hh"
00014 
00015 #include "geometry/Detector.hh"
00016 #include "geometry/Chamber.hh"
00017 #include "geometry/Board.hh"
00018 #include "geometry/Dif.hh"
00019 #include "geometry/Chip.hh"
00020 #include "geometry/DiracChip.hh"
00021 #include "geometry/Hardroc1Chip.hh"
00022 #include "geometry/Hardroc2Chip.hh"
00023 #include "geometry/MicrorocChip.hh"
00024 
00025 
00026 using namespace std;
00027 
00028 ClassImp(MTRun)
00029 
00030 MTRun::MTRun()
00031 {
00032         detector                                                = NULL;
00033         reconstructionDate      = time(NULL);
00034         date                                                            = "Not defined" ;
00035         calibrationRun                  = false;
00036         difSynchro                                      = false;
00037         time_t  result                  = 0;
00038         injectedCharge                  = 0;
00039         widthCtest                              = 0;
00040         periodCtest                             = 0;
00041         delayCtest                              = 0;
00042         rawDataFormat                   = 0;
00043         daqSoftVersion                  = 0;
00044         cccFirmwareVersion      = 0;
00045         rawDataFilename                 = "";
00046         svnrev                                                  = "";
00047   processed           = false;
00048 
00049 
00050 }
00051 //______________________________________________________________________________
00052  MTRun::MTRun(const Run& aRun)
00053  {
00054          (*this) = aRun; // appelle operator=
00055  }
00056 //______________________________________________________________________________
00057 MTRun::~MTRun()
00058 {
00059   delete detector;
00060 }
00061 //______________________________________________________________________________
00062 time_t MTRun::GetReconstructionDate(TString &dateToComplete) const
00063 {
00064    dateToComplete = asctime(localtime(&reconstructionDate));
00065    return reconstructionDate;
00066 }
00067 
00068 //______________________________________________________________________________
00069 MTRun& MTRun::operator=(const Run& aRun)
00070 {
00071         try
00072   {
00073                 id                              = aRun.getId();
00074                 name                            = aRun.getName();
00075                 date                            = aRun.getDate() ;
00076     processed           = false;
00077                 calibrationRun                  = aRun.isCalibrationRun();
00078                 difSynchro                              = aRun.isDifSynchro();
00079 
00080                 reconstructionDate      = aRun.getReconstructionDate();
00081                 rawDataFilename         = aRun.getRawDataFilename();
00082                 svnrev                  = aRun.getSvnrev();
00083 
00084                 const Detector& det = aRun.getDetector();
00085                 detector                                                = new MTDetector(det);
00086 
00087                 rawDataFormat = aRun.getDataFormat();
00088                 daqSoftVersion = aRun.getDaqSoftware();
00089                 cccFirmwareVersion = aRun.getCccFirmware();
00090 
00091                 // calibration only    // Infos from calibration raw data file
00092                 injectedCharge = aRun.getSendedCharge();
00093                 widthCtest   = aRun.getWidthCtest();  // 10 bit store in 16 bits
00094                 periodCtest  = aRun.getPeriodCtest(); // 10 bit store in 16 bits
00095                 delayCtest   = aRun.getDelayCtest();  // 10 bit store in 16 bits
00096                 delayTrigger = aRun.getDelayTrigger();  // 10 bit store in 16 bits
00097                 FILE_LOG(logDEBUG1) << "injectedCharge[" <<  injectedCharge << "]"  << endl;
00098                 FILE_LOG(logDEBUG1) << "aRun.getSendedCharge()[" << aRun.getSendedCharge()  << "]"  << endl;
00099         } //try block
00100         catch (MicroException e)
00101         {
00102                 throw MicroException(e.getMessage());
00103         }
00104 // Save all objects in this file
00105 return *this;
00106 }
00107 
00108 //______________________________________________________________________________
00109 const MTChip& MTRun::GetOneChip(void ) const 
00110 {
00111                 MTDetector* det = this->GetDetector();
00112                 if ( det != NULL)
00113                 {
00114                         // Get first detector's chamber 
00115                         const MTChamber& chamber        = *((*det->GetChambers().begin()).second);
00116                         // Get first chamber's board 
00117                         const MTBoard& board            = *((*chamber.GetBoards().begin()).second);
00118                         // Get first board's chip 
00119                         const MTChip&  chip             = *((*board.GetChips().begin()).second);
00120                         return chip;
00121                 }
00122                 throw MicroException("No Chip for this run");
00123 }
00124 
00125 //______________________________________________________________________________
00126 void  MTRun::Info() const
00127 {
00128 
00129   TString recDate;
00130   GetReconstructionDate(recDate);
00131 
00132   TString calib = "production";
00133   if ( calibrationRun)
00134   {
00135       calib = "calibration";
00136   }
00137 
00138   cout << "**** Run informations ****"    << endl << endl ;
00139   cout << "    Id: " << id << "    " << endl ;
00140   cout << "    Name: " << name << "    " << endl ;
00141   cout << "    Date: " << date << "    " << endl ;
00142   cout << "    Type: It is a "<< calib << " run    "       << endl;
00143   cout << "    svn version for used source code:" << svnrev  << endl;
00144 
00145 
00146   cout << endl << "    2/ Acquisition informations       "    <<  endl ;
00147         cout << "       Raw data file name:   "<<rawDataFilename <<  "       "<< endl;
00148         cout << "       data format:          0x" << hex << (unsigned int) rawDataFormat <<  "       "<< endl;
00149         cout << "       daq software version: 0x" << hex  << (unsigned int) daqSoftVersion <<  "       "<< endl;
00150         cout << "       ccc firmware version: 0x"  << hex << (unsigned int) cccFirmwareVersion <<  "       "<< endl;
00151 
00152 
00153   cout << endl << "    3/ Reconstruction informations       "    << endl ;
00154   cout << "       Date:   " << recDate <<"       " <<   endl;
00155   cout << endl << endl;
00156 
00157   if ( calibrationRun )
00158   {
00159     cout << endl << "    4/ Calibration informations       "    <<  endl ;
00160     cout << "       injectedCharge:       "  << dec << injectedCharge  << " fC       " <<  endl;
00161 /* Following omly exist for Dirac callibration
00162     cout << "       widthCtest:           0x"  << hex << widthCtest    << "       " <<  endl;  // 10 bit store in 16 bits
00163     cout << "       periodCtest:          0x"  << hex << periodCtest   << "       " <<  endl; // 10 bit store in 16 bits
00164     cout << "       delayCtest:           0x"  << hex <<        delayCtest    << "       " <<  endl;  // 10 bit store in 16 bits
00165     cout << "       delayTrigger:         0x"  << hex << delayTrigger    << "       " <<  dec <<endl;  // 10 bit store in 16 bits
00166 */
00167   }
00168 
00169 }
00170 

Generated on Mon Jun 11 16:55:46 2012 for MicromegasFramework by  doxygen 1.4.7