00001 /* @version $Revision: 1850 $ * @modifiedby $Author: jacquem $ * @lastmodified $Date: 2012-08-22 09:59:31 +0200 (Wed, 22 Aug 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 sdccFirmwareVersion = 0; 00046 difFirmwareVersion = 0; 00047 rawDataFilename = ""; 00048 svnrev = ""; 00049 processed = false; 00050 00051 00052 } 00053 //______________________________________________________________________________ 00054 MTRun::MTRun(const Run& aRun) 00055 { 00056 (*this) = aRun; // appelle operator= 00057 } 00058 //______________________________________________________________________________ 00059 MTRun::~MTRun() 00060 { 00061 delete detector; 00062 } 00063 //______________________________________________________________________________ 00064 time_t MTRun::GetReconstructionDate(TString &dateToComplete) const 00065 { 00066 dateToComplete = asctime(localtime(&reconstructionDate)); 00067 return reconstructionDate; 00068 } 00069 00070 //______________________________________________________________________________ 00071 MTRun& MTRun::operator=(const Run& aRun) 00072 { 00073 try 00074 { 00075 id = aRun.getId(); 00076 name = aRun.getName(); 00077 date = aRun.getDate() ; 00078 processed = false; 00079 calibrationRun = aRun.isCalibrationRun(); 00080 difSynchro = aRun.isDifSynchro(); 00081 00082 reconstructionDate = aRun.getReconstructionDate(); 00083 rawDataFilename = aRun.getRawDataFilename(); 00084 svnrev = aRun.getSvnrev(); 00085 00086 const Detector& det = aRun.getDetector(); 00087 detector = new MTDetector(det); 00088 00089 rawDataFormat = aRun.getDataFormat(); 00090 daqSoftVersion = aRun.getDaqSoftware(); 00091 cccFirmwareVersion = aRun.getCccFirmware(); 00092 sdccFirmwareVersion = aRun.getSDccFirmware(); 00093 difFirmwareVersion = aRun.getDifFirmware(); 00094 00095 // calibration only // Infos from calibration raw data file 00096 injectedCharge = aRun.getSendedCharge(); 00097 widthCtest = aRun.getWidthCtest(); // 10 bit store in 16 bits 00098 periodCtest = aRun.getPeriodCtest(); // 10 bit store in 16 bits 00099 delayCtest = aRun.getDelayCtest(); // 10 bit store in 16 bits 00100 delayTrigger = aRun.getDelayTrigger(); // 10 bit store in 16 bits 00101 FILE_LOG(logDEBUG1) << "injectedCharge[" << injectedCharge << "]" << endl; 00102 FILE_LOG(logDEBUG1) << "aRun.getSendedCharge()[" << aRun.getSendedCharge() << "]" << endl; 00103 } //try block 00104 catch (MicroException e) 00105 { 00106 throw MicroException(e.getMessage()); 00107 } 00108 // Save all objects in this file 00109 return *this; 00110 } 00111 00112 //______________________________________________________________________________ 00113 const MTChip& MTRun::GetOneChip(void ) const 00114 { 00115 MTDetector* det = this->GetDetector(); 00116 if ( det != NULL) 00117 { 00118 // Get first detector's chamber 00119 const MTChamber& chamber = *((*det->GetChambers().begin()).second); 00120 // Get first chamber's board 00121 const MTBoard& board = *((*chamber.GetBoards().begin()).second); 00122 // Get first board's chip 00123 const MTChip& chip = *((*board.GetChips().begin()).second); 00124 return chip; 00125 } 00126 throw MicroException("No Chip for this run"); 00127 } 00128 00129 //______________________________________________________________________________ 00130 void MTRun::Info() const 00131 { 00132 00133 TString recDate; 00134 GetReconstructionDate(recDate); 00135 00136 TString calib = "production"; 00137 if ( calibrationRun) 00138 { 00139 calib = "calibration"; 00140 } 00141 00142 cout << "**** Run informations ****" << endl << endl ; 00143 cout << " Id: " << id << " " << endl ; 00144 cout << " Name: " << name << " " << endl ; 00145 cout << " Date: " << date << " " << endl ; 00146 cout << " Type: It is a "<< calib << " run " << endl; 00147 cout << " svn version for used source code:" << svnrev << endl; 00148 00149 00150 cout << endl << " 2/ Acquisition informations " << endl ; 00151 cout << " Raw data file name: "<<rawDataFilename << " "<< endl; 00152 cout << " data format: 0x" << hex << (unsigned int) rawDataFormat << " "<< endl; 00153 cout << " daq software version: 0x" << hex << (unsigned int) daqSoftVersion << " "<< endl; 00154 cout << " ccc firmware version: 0x" << hex << (unsigned int) cccFirmwareVersion << " "<< endl; 00155 cout << " sdcc firmware version: 0x" << hex << (unsigned int) sdccFirmwareVersion << " "<< endl; 00156 cout << " dif firmware version: 0x" << hex << (unsigned int) difFirmwareVersion << " "<< endl; 00157 00158 00159 cout << endl << " 3/ Reconstruction informations " << endl ; 00160 cout << " Date: " << recDate <<" " << endl; 00161 cout << endl << endl; 00162 00163 if ( calibrationRun ) 00164 { 00165 cout << endl << " 4/ Calibration informations " << endl ; 00166 cout << " injectedCharge: " << dec << injectedCharge << " fC " << endl; 00167 /* Following omly exist for Dirac callibration 00168 cout << " widthCtest: 0x" << hex << widthCtest << " " << endl; // 10 bit store in 16 bits 00169 cout << " periodCtest: 0x" << hex << periodCtest << " " << endl; // 10 bit store in 16 bits 00170 cout << " delayCtest: 0x" << hex << delayCtest << " " << endl; // 10 bit store in 16 bits 00171 cout << " delayTrigger: 0x" << hex << delayTrigger << " " << dec <<endl; // 10 bit store in 16 bits 00172 */ 00173 } 00174 00175 } 00176