- Timestamp:
- 02/22/01 14:30:10 (24 years ago)
- Location:
- trunk/MagicSoft
- Files:
-
- 30 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r604 r609 1 1 -*-*- END -*-*- 2 3 2000/02/22: Thomas Bretz 4 5 * merpp.cc, readraw.cc, mbase/MParContainer.cc, mbase/MParList.cc, 6 mbase/MParList.h, mbase/MReadTree.cc, mbase/MTask.cc, mbase/MTask.h, 7 mbase/MTaskList.cc, mbase/MTime.cc, mdatacheck/MDumpEvtHeader.cc, 8 mdatacheck/MShowSpect.cc, meventdisp/MGFadcDisp.cc, mgui/MGPrototyp.h, 9 mmc/MHeaderTrig.cxx, mraw/MRawCrateArray.cc, mraw/MRawEvtData.cc, 10 mraw/MRawEvtHeader.cc, mraw/MRawFileRead.cc, mraw/MRawFileWrite.cc, 11 mraw/MRawRunHeader.cc: 12 exchanged cout with the new logging style (gLog, *fLog) 13 14 * mraw/MRawEvtData.cc: added 'dec' option to Print 15 16 * mmc/MHeaderTrig.cxx, mmc/MMcEvt.cxx, mmc/MMcTrig.cxx: 17 small changes to the Print funtions 18 2 19 3 20 2000/02/21: Thomas Bretz -
trunk/MagicSoft/Mars/mbase/MAGIC.h
r604 r609 34 34 // default pipes all output to the stdout 35 35 // 36 37 //This will be fixed soon. It doesn't work with Alphas at the moment 36 38 class MLog; 39 #ifndef __CINT__ 37 40 extern MLog gLog; 41 #endif 38 42 39 43 #endif -
trunk/MagicSoft/Mars/mbase/MLog.cc
r604 r609 46 46 } 47 47 48 void MLog::Write ()48 void MLog::WriteBuffer() 49 49 { 50 50 const int len = fPPtr - fBase; … … 76 76 { 77 77 // cout << "*sync*"; 78 Write ();78 WriteBuffer(); 79 79 80 80 if (fDevice&eStdout) … … 100 100 // If the buffer is not really filled i is EOF(-1). 101 101 // 102 if (fOutputLevel < fDebugLevel) 103 { 104 *fPPtr++ = (char)i; 102 if (fOutputLevel >= fDebugLevel) 103 return 0; 105 104 106 if (fPPtr == fEPtr) 107 Write(); 108 } 105 *fPPtr++ = (char)i; 106 107 if (fPPtr == fEPtr) 108 WriteBuffer(); 109 109 110 110 return 0; -
trunk/MagicSoft/Mars/mbase/MLog.h
r604 r609 36 36 void Init(); 37 37 38 void Write ();38 void WriteBuffer(); 39 39 int sync(); 40 40 int overflow(int i); // i=EOF means not a real overflow -
trunk/MagicSoft/Mars/mbase/MParContainer.cc
r458 r609 13 13 #include "MParContainer.h" 14 14 15 #include <iostream.h> // cout16 17 15 #include <TClass.h> // IsA 18 16 #include <TROOT.h> // TROOT::Identlevel 19 17 #include <TVirtualPad.h> // gPad 18 19 #include "MLog.h" 20 20 21 21 ClassImp(MParContainer) … … 78 78 79 79 TROOT::IndentLevel(); 80 cout<<"OBJ: " << IsA()->GetName() << "\t" << GetName() << "\t" << GetTitle() << " : "80 *fLog <<"OBJ: " << IsA()->GetName() << "\t" << GetName() << "\t" << GetTitle() << " : " 81 81 << Int_t(TestBit(kCanDelete)) << endl; 82 82 } … … 87 87 // Print MParContainer name and title. 88 88 89 cout<<"OBJ: " << IsA()->GetName() << "\t" << GetName() << "\t" << GetTitle() << endl;89 *fLog <<"OBJ: " << IsA()->GetName() << "\t" << GetName() << "\t" << GetTitle() << endl; 90 90 } 91 91 -
trunk/MagicSoft/Mars/mbase/MParContainer.h
r604 r609 20 20 #endif 21 21 22 class MLog;23 22 class ofstream; 24 23 class ifstream; -
trunk/MagicSoft/Mars/mbase/MParList.cc
r608 r609 15 15 // // 16 16 ///////////////////////////////////////////////////////////////////////////// 17 18 17 #include "MParList.h" 19 18 20 19 #include <TNamed.h> 21 20 22 #include "M ParContainer.h"21 #include "MLog.h" 23 22 24 23 ClassImp(MParList) … … 57 56 cont->SetLogStream(log); 58 57 59 //SetLogStream(log);58 MParContainer::SetLogStream(log); 60 59 } 61 60 … … 74 73 if (!obj) return kTRUE; 75 74 76 cout<< "Adding " << obj->GetName() << " to " << GetName() << "... " << flush;75 *fLog << "Adding " << obj->GetName() << " to " << GetName() << "... " << flush; 77 76 // 78 77 // check if it is in the list yet … … 80 79 if (fContainer.FindObject(obj)) 81 80 { 82 cout<< "WARNING: MParList::add: Container already added" << endl;81 *fLog << "WARNING: MParList::add: Container already added" << endl; 83 82 return kTRUE; 84 83 } … … 92 91 if (!fContainer.FindObject(where)) 93 92 { 94 cout<< "ERROR: MParList::add: Cannot find parameter container after which the new one should be added!" << endl;93 *fLog << "ERROR: MParList::add: Cannot find parameter container after which the new one should be added!" << endl; 95 94 return kFALSE; 96 95 } … … 98 97 99 98 fContainer.Add(obj); 100 cout<< "Done." << endl;99 *fLog << "Done." << endl; 101 100 102 101 return kTRUE; … … 118 117 // print some information about the current status of MParList 119 118 // 120 cout<< "ParList: " << this->GetName() << " <" << this->GetTitle() << ">" << endl;121 cout<< endl;119 *fLog << "ParList: " << this->GetName() << " <" << this->GetTitle() << ">" << endl; 120 *fLog << endl; 122 121 123 122 } -
trunk/MagicSoft/Mars/mbase/MParList.h
r604 r609 14 14 #endif 15 15 16 #include <iostream.h>17 18 16 #ifndef ROOT_TOrdCollection 19 17 #include "TOrdCollection.h" 20 18 #endif 19 #ifndef MPARCONTAINER_H 20 #include "MParContainer.h" 21 #endif 21 22 22 23 class MLog; 23 class MParContainer;24 24 25 class MParList : public TObject25 class MParList : public MParContainer 26 26 { 27 27 private: -
trunk/MagicSoft/Mars/mbase/MReadTree.cc
r585 r609 15 15 #include "MReadTree.h" 16 16 17 #include <iostream.h>18 17 #include <fstream.h> 19 18 … … 22 21 #include <TObjArray.h> 23 22 23 #include "MLog.h" 24 24 #include "MTime.h" 25 25 #include "MParList.h" … … 49 49 if (!fFile->IsOpen()) 50 50 { 51 cout<< "MReadTree::PreProcess: ERROR: Cannot open file '";52 cout<< fFileName << "'" << endl;51 *fLog << "MReadTree::PreProcess: ERROR: Cannot open file '"; 52 *fLog << fFileName << "'" << endl; 53 53 return kFALSE; 54 54 } … … 58 58 if (!fTree) 59 59 { 60 cout<< "MReadTree::PreProcess: ERROR: Cannot open tree '";61 cout<< fTreeName << "'" << endl;60 *fLog << "MReadTree::PreProcess: ERROR: Cannot open tree '"; 61 *fLog << fTreeName << "'" << endl; 62 62 return kFALSE; 63 63 } … … 66 66 fNumEntry = 0; 67 67 68 cout<< "File: '" << fFileName << "' Tree: '" << fTreeName;69 cout<< "' with " << fNumEntries << " Entries opened." << endl;68 *fLog << "File: '" << fFileName << "' Tree: '" << fTreeName; 69 *fLog << "' with " << fNumEntries << " Entries opened." << endl; 70 70 71 71 // … … 96 96 // if object is not existing in the list try to create one 97 97 // 98 cout<< "MReadTree::PreProcess - WARNING: '" << name << "' not found... creating." << endl;98 *fLog << "MReadTree::PreProcess - WARNING: '" << name << "' not found... creating." << endl; 99 99 100 100 // … … 109 109 // we cannot proceed reading this branch 110 110 // 111 cout<< "MReadTree::PreProcess - Warning: Class '" << name << "' not existing in dictionary. Branch skipped." << endl;111 *fLog << "MReadTree::PreProcess - Warning: Class '" << name << "' not existing in dictionary. Branch skipped." << endl; 112 112 continue; 113 113 } … … 117 117 // 118 118 pcont = (MParContainer*)cls->New(); 119 cout<< pcont << endl;119 *fLog << pcont << endl; 120 120 pList->AddToList(pcont); 121 121 } … … 180 180 if (fNumEntry < dec/*+1*/) 181 181 { 182 cout<< "MReadTree::SetPrevEvent: WARNING: " << fNumEntry/*-1*/ << "-" << dec << " out of Range." << endl;182 *fLog << "MReadTree::SetPrevEvent: WARNING: " << fNumEntry/*-1*/ << "-" << dec << " out of Range." << endl; 183 183 return kFALSE; 184 184 } … … 203 203 if (fNumEntry+inc/*-1*/ >= fNumEntries) 204 204 { 205 cout<< "MReadTree::SkipEvents: WARNING: " << fNumEntry/*-1*/ << "+" << inc << " out of Range." << endl;205 *fLog << "MReadTree::SkipEvents: WARNING: " << fNumEntry/*-1*/ << "+" << inc << " out of Range." << endl; 206 206 return kFALSE; 207 207 } … … 218 218 if (nr>=fNumEntries) 219 219 { 220 cout<< "MReadTree::SetEventNum: WARNING: " << nr << " out of Range." << endl;220 *fLog << "MReadTree::SetEventNum: WARNING: " << nr << " out of Range." << endl; 221 221 return kFALSE; 222 222 } -
trunk/MagicSoft/Mars/mbase/MTask.cc
r458 r609 37 37 #include "MTask.h" 38 38 39 #include <string.h>40 #include <iostream.h>41 42 39 ClassImp(MTask) 43 40 44 41 Bool_t MTask::PreProcess( MParList *pList ) 45 42 { 46 //47 // This is processed before the eventloop starts48 //49 // It is the job of the PreProcess to connect the tasks50 // with the right container in the parameter list.51 //52 // the virtual implementation returns kTRUE53 //54 return kTRUE;43 // 44 // This is processed before the eventloop starts 45 // 46 // It is the job of the PreProcess to connect the tasks 47 // with the right container in the parameter list. 48 // 49 // the virtual implementation returns kTRUE 50 // 51 return kTRUE; 55 52 } 56 57 53 58 54 Bool_t MTask::Process() 59 55 { 60 //61 // This is processed for every event in the eventloop62 //63 // the virtual implementation returns kTRUE64 //65 return kTRUE;56 // 57 // This is processed for every event in the eventloop 58 // 59 // the virtual implementation returns kTRUE 60 // 61 return kTRUE; 66 62 } 67 63 68 64 Bool_t MTask::PostProcess() 69 65 { 70 //71 // This is processed after the eventloop starts72 //73 // the virtual implementation returns kTRUE74 //75 return kTRUE;66 // 67 // This is processed after the eventloop starts 68 // 69 // the virtual implementation returns kTRUE 70 // 71 return kTRUE; 76 72 } 77 73 -
trunk/MagicSoft/Mars/mbase/MTask.h
r604 r609 18 18 class MTask : public MInputStreamID 19 19 { 20 MLog *fLog; //!21 22 20 public: 23 21 ~MTask() -
trunk/MagicSoft/Mars/mbase/MTaskList.cc
r608 r609 9 9 #include "MTaskList.h" 10 10 11 #include <iostream.h> 12 11 #include "MLog.h" 13 12 #include "MParList.h" 14 13 #include "MInputStreamID.h" … … 56 55 task->SetLogStream(log); 57 56 58 //SetLogStream(log);57 MParContainer::SetLogStream(log); 59 58 } 60 59 … … 73 72 if (fTasks.FindObject(task)) 74 73 { 75 cout<< "WARNING: MTaskList::AddToList: Task already existing." << endl;74 *fLog << "WARNING: MTaskList::AddToList: Task already existing." << endl; 76 75 return kTRUE; 77 76 } … … 79 78 if (fTasks.FindObject(name)) 80 79 { 81 cout<< "WARNING: MTaskList::AddToList: '" << name << "' exists in List already." << endl;80 *fLog << "WARNING: MTaskList::AddToList: '" << name << "' exists in List already." << endl; 82 81 return kTRUE; 83 82 } … … 92 91 } 93 92 94 cout<< "Adding " << name << " to " << GetName() << " for " << type << "... " << flush;93 *fLog << "Adding " << name << " to " << GetName() << " for " << type << "... " << flush; 95 94 96 95 task->SetStreamId(type); 97 96 fTasks.Add(task); 98 97 99 cout<< "Done." << endl;98 *fLog << "Done." << endl; 100 99 101 100 return kTRUE; … … 108 107 // do pre processing (before eventloop) of all tasks in the task-list 109 108 // 110 cout<< "Preprocessing... " << flush;109 *fLog << "Preprocessing... " << flush; 111 110 112 111 // … … 122 121 while ( (task=(MTask*)Next()) ) 123 122 { 124 cout<< task->GetName() << "... " << flush;123 *fLog << task->GetName() << "... " << flush; 125 124 126 125 if (!task->PreProcess( pList )) … … 128 127 } 129 128 130 cout<< endl;129 *fLog << endl; 131 130 132 131 return kTRUE; … … 184 183 // 185 184 186 cout<< "Postprocessing... " << flush;185 *fLog << "Postprocessing... " << flush; 187 186 188 187 // … … 198 197 while ( (task=(MTask*)Next()) ) 199 198 { 200 cout<< task->GetName() << "... " << flush;199 *fLog << task->GetName() << "... " << flush; 201 200 202 201 if (!task->PostProcess()) … … 204 203 } 205 204 206 cout<< endl;205 *fLog << endl; 207 206 208 207 return kTRUE; … … 213 212 void MTaskList::Print(Option_t *t) 214 213 { 215 cout<< "TaskList: " << this->GetName() << " <" << this->GetTitle() << ">" << endl;214 *fLog << "TaskList: " << this->GetName() << " <" << this->GetTitle() << ">" << endl; 216 215 217 216 fTasks.Print(); 218 217 219 cout<< endl;220 } 221 218 *fLog << endl; 219 } 220 -
trunk/MagicSoft/Mars/mbase/MTaskList.h
r604 r609 26 26 TOrdCollection fTasks; // Container for the ordered list of different tasks 27 27 28 29 28 public: 30 29 MTaskList(const char *title=NULL); -
trunk/MagicSoft/Mars/mbase/MTime.cc
r458 r609 9 9 #include "MTime.h" 10 10 11 #include <iostream.h>12 11 #include <iomanip.h> 12 13 #include "MLog.h" 13 14 14 15 ClassImp(MTime) 15 16 16 17 void MTime::Print(Option_t *) 17 { 18 cout << "MTime Information: " << hex 19 << " 0x" <<setfill('0') << setw(2) << fTimeStamp[0] 20 << " 0x" <<setfill('0') << setw(2) << fTimeStamp[1] << endl << endl; 18 { 19 fLog->setf(ios::showbase); 20 *fLog << "MTime Information: " << hex 21 << " " <<setfill('0') << setw(2) << fTimeStamp[0] 22 << " " <<setfill('0') << setw(2) << fTimeStamp[1] << endl << endl; 21 23 } 22 /*23 inline Bool_t operator<(MTime &t1, MTime &t2)24 {25 return (t1.GetTimeHi()<=t2.GetTimeHi()) && (t1.GetTimeLo()<t2.GetTimeLo());26 }27 24 28 inline Bool_t operator>(MTime &t1, MTime &t2)29 {30 return (t1.GetTimeHi()>=t2.GetTimeHi()) && (t1.GetTimeLo()>t2.GetTimeLo());31 }32 33 inline Bool_t operator<=(MTime &t1, MTime &t2)34 {35 return (t1.GetTimeHi()<=t2.GetTimeHi()) && (t1.GetTimeLo()<=t2.GetTimeLo());36 }37 38 inline Bool_t operator>=(MTime &t1, MTime &t2)39 {40 return (t1.GetTimeHi()>=t2.GetTimeHi()) && (t1.GetTimeLo()>=t2.GetTimeLo());41 }42 43 inline Bool_t operator==(MTime &t1, MTime &t2)44 {45 return (t1.GetTimeLo()==t2.GetTimeLo()) && (t1.GetTimeHi()==t2.GetTimeHi());46 }47 */ -
trunk/MagicSoft/Mars/mdatacheck/MDumpEvtHeader.cc
r531 r609 1 1 #include "MDumpEvtHeader.h" 2 3 #include <iostream.h> 2 4 3 5 #include "MParList.h" -
trunk/MagicSoft/Mars/mdatacheck/MShowSpect.cc
r531 r609 1 1 #include "MShowSpect.h" 2 3 #include <iostream.h> 2 4 3 5 #include "MParList.h" // MParList … … 35 37 { 36 38 cout << "ERROR: MShowSpect::PreProc(): " << fHistName << " not found!" << endl; 37 return kFALSE ;39 return kFALSE; 38 40 } 39 41 40 return (kTRUE) ;42 return kTRUE; 41 43 } 42 44 … … 48 50 new MGDisplayAdc(fHists, gClient->GetRoot(), gClient->GetRoot(), 600, 600); 49 51 50 return (kTRUE) ;52 return kTRUE; 51 53 } 52 54 -
trunk/MagicSoft/Mars/merpp.cc
r458 r609 1 #include <iostream.h>2 3 1 #include <TSystem.h> 4 2 … … 10 8 #include "MRawFileWrite.h" 11 9 10 #include "MLog.h" 11 #include "MTime.h" 12 #include "MRawEvtData.h" 12 13 #include "MRawRunHeader.h" 13 14 #include "MRawEvtHeader.h" 14 #include "MRawEvtData.h"15 15 #include "MRawCrateArray.h" 16 #include "MTime.h"17 16 #include "MInputStreamID.h" 18 17 … … 34 33 int main(const int argc, const char **argv) 35 34 { 36 cout<< "==================================================" << endl ;37 cout<< " MERPP v0.1" << endl;38 cout<< " MARS Merging and Preprocessing Program" << endl ;39 cout<< " Compiled on <" << __DATE__ << ">" << endl ;40 cout<< "==================================================" << endl ;41 cout<< endl;35 gLog << "==================================================" << endl ; 36 gLog << " MERPP v0.1" << endl; 37 gLog << " MARS Merging and Preprocessing Program" << endl ; 38 gLog << " Compiled on <" << __DATE__ << ">" << endl ; 39 gLog << "==================================================" << endl ; 40 gLog << endl; 42 41 43 42 // … … 46 45 if (argc!=3) 47 46 { 48 cout<< "Sorry the usage is:" << endl;49 cout<< " merpp inputfile outputfile" << endl << endl;47 gLog << "Sorry the usage is:" << endl; 48 gLog << " merpp inputfile outputfile" << endl << endl; 50 49 return -1; 51 50 } … … 61 60 if (gSystem->AccessPathName(argv[1], kFileExists)) 62 61 { 63 cout<< "Sorry, the file '" << argv[1] << "' doesn't exist." << endl;62 gLog << "Sorry, the file '" << argv[1] << "' doesn't exist." << endl; 64 63 return -1; 65 64 } 66 65 67 66 if (!gSystem->AccessPathName(argv[2], kFileExists)) 68 cout<< "Warning: The file '" << argv[2] << "' exists." << endl;67 gLog << "Warning: The file '" << argv[2] << "' exists." << endl; 69 68 else 70 69 if (!gSystem->AccessPathName(argv[2], kWritePermission)) 71 70 { 72 cout<< "Sorry, you don't have write permission for '" << argv[2] << "'." << endl;71 gLog << "Sorry, you don't have write permission for '" << argv[2] << "'." << endl; 73 72 return -1; 74 73 } -
trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.cc
r591 r609 2 2 3 3 #include <stdlib.h> 4 #include <iostream.h> 4 5 5 6 #include <TGButton.h> // TGPictureButton … … 272 273 // window menu item is selected. 273 274 274 delete this ;275 delete this ; 275 276 } 276 277 -
trunk/MagicSoft/Mars/mgui/MGPrototyp.h
r587 r609 9 9 #include <TGFrame.h> 10 10 #endif 11 12 11 13 12 class TGMenuBar; -
trunk/MagicSoft/Mars/mgui/MHexagon.h
r589 r609 1 #ifndef M _HEXAGON2 #define M _HEXAGON1 #ifndef MHEXAGON_H 2 #define MHEXAGON_H 3 3 4 4 ////////////////////////////////////////////////////////////// -
trunk/MagicSoft/Mars/mraw/MRawCrateArray.cc
r454 r609 12 12 #include "MRawCrateArray.h" 13 13 14 #include < iostream.h>14 #include <TClonesArray.h> 15 15 16 #include <TClonesArray.h>16 #include "MLog.h" 17 17 18 18 ClassImp(MRawCrateArray) … … 45 45 void MRawCrateArray::Print(Option_t *opt) 46 46 { 47 cout<< "MRawCrateArray::Print()" << endl;47 *fLog << "MRawCrateArray::Print()" << endl; 48 48 } 49 49 -
trunk/MagicSoft/Mars/mraw/MRawEvtData.cc
r604 r609 26 26 #include "MRawEvtData.h" 27 27 28 #include <iostream.h>29 28 #include <iomanip.h> 30 29 … … 35 34 #include <TArrayC.h> 36 35 36 #include "MLog.h" 37 37 #include "MArrayS.h" 38 38 #include "MArrayB.h" … … 87 87 88 88 89 void MRawEvtData::Print(Option_t * )89 void MRawEvtData::Print(Option_t *opt) 90 90 { 91 91 // 92 92 // print fadc inforation to screen 93 // Possible Options: 94 // - DEC: Print values decimal instead of hexadecimal (default) 93 95 // 94 96 const Byte_t nHiSamp = GetNumHiGainSamples(); … … 98 100 const UShort_t nLoPix = fLoGainPixId->GetSize();; 99 101 100 cout << dec; 101 cout << "HiGain: " << nHiPix << " Pixels with " << (Int_t)nHiSamp << " Samples" << endl; 102 cout << "LoGain: " << nLoPix << " Pixels with " << (Int_t)nLoSamp << " Samples" << endl; 102 fLog->unsetf(ios::showbase); 103 104 *fLog << dec; 105 *fLog << "HiGain: " << nHiPix << " Pixels with " << (Int_t)nHiSamp << " Samples" << endl; 106 *fLog << "LoGain: " << nLoPix << " Pixels with " << (Int_t)nLoSamp << " Samples";; 107 108 TString str(opt); 109 Int_t manip = str.Contains("dec", TString::kIgnoreCase); 103 110 104 111 Int_t l=0; 105 112 for (int i=0; i<nHiPix; i++) 106 113 { 107 cout << " " << setfill(' ') << setw(3) << i << ": " << hex << flush; 108 109 cout << setfill('0'); 114 *fLog << endl; 115 *fLog << " " << setfill(' ') << setw(3) << dec << i << ": "; 116 *fLog << (manip?dec:hex) << flush; 117 118 if (!manip) 119 *fLog << setfill('0'); 110 120 111 121 for (int j=0; j<nHiSamp; j++) 112 cout << setw(2)113 << ((UShort_t)(*fHiGainFadcSamples)[j+i*nHiSamp]&0xff) << flush;114 115 if (l<nLoPix && (*fLoGainPixId)[l]==(*fHiGainPixId)[i])116 122 { 117 for (int j=0; j<nLoSamp; j++) 118 cout << setw(2) 119 <<((UShort_t)(*fLoGainFadcSamples)[j+i*nLoSamp]&0xff) << flush; 120 l++; 123 *fLog << setw(manip?3:2); 124 *fLog << ((UShort_t)(*fHiGainFadcSamples)[j+i*nHiSamp]&0xff); 125 if (manip) 126 *fLog << ' '; 127 *fLog << flush; 121 128 } 122 cout << dec << endl; 129 130 if (!(l<nLoPix && (*fLoGainPixId)[l]==(*fHiGainPixId)[i])) 131 continue; 132 133 if (manip) 134 *fLog << "/ "; 135 136 for (int j=0; j<nLoSamp; j++) 137 { 138 *fLog << setw(manip?3:2); 139 *fLog << ((UShort_t)(*fLoGainFadcSamples)[j+i*nLoSamp]&0xff); 140 if (manip) 141 *fLog << ' '; 142 *fLog << flush; 143 } 144 l++; 123 145 } 124 cout<< endl;146 *fLog << endl; 125 147 } 126 148 … … 135 157 if (str.BeginsWith("GRAPH", TString::kIgnoreCase)) 136 158 { 137 if (str.Length()>5)138 sscanf(&str[5], "%d", &num);139 140 if (num>=GetNumPixels())141 num= GetNumPixels();142 143 cout<< "Drawing Graph of Pixel " << num << endl;144 145 const Int_t n = GetNumHiGainSamples();146 147 Float_t *x = new Float_t[n];148 Float_t *y = new Float_t[n];149 150 for (int i=0; i<n; i++)151 {152 x[i] = i;153 y[i] = (*fHiGainFadcSamples)[i + num*GetNumHiGainSamples()];154 }155 156 TGraph *graph = new TGraph(n, x, y);157 graph->SetMaximum (256) ;158 graph->SetMinimum (0) ;159 160 graph->Draw("AC*");161 162 return;159 if (str.Length()>5) 160 sscanf(&str[5], "%d", &num); 161 162 if (num>=GetNumPixels()) 163 num= GetNumPixels(); 164 165 *fLog << "Drawing Graph of Pixel " << num << endl; 166 167 const Int_t n = GetNumHiGainSamples(); 168 169 Float_t *x = new Float_t[n]; 170 Float_t *y = new Float_t[n]; 171 172 for (int i=0; i<n; i++) 173 { 174 x[i] = i; 175 y[i] = (*fHiGainFadcSamples)[i + num*GetNumHiGainSamples()]; 176 } 177 178 TGraph *graph = new TGraph(n, x, y); 179 graph->SetMaximum (256) ; 180 graph->SetMinimum (0) ; 181 182 graph->Draw("AC*"); 183 184 return; 163 185 } 164 186 165 187 if (str.BeginsWith("HIST", TString::kIgnoreCase)) 166 188 { 167 cout<< "Length: " << str.Length() << endl;168 169 if (str.Length()>4)170 sscanf(&str[4], "%d", &num);171 172 if (num>=GetNumPixels())173 num= GetNumPixels();174 175 cout<< "Drawing Histogram of Pixel " << num << endl;176 177 const Int_t n = GetNumHiGainSamples();178 179 char *name = new char[16];180 181 sprintf(name, "Pixel No.%d", (*fHiGainPixId)[num]);182 183 TH1F *hist = new TH1F(name, "Hi Gain Samples FADC", n, 0, n);184 185 for (int i=0; i<n; i++)186 hist->Fill(0.5+i, (*fHiGainFadcSamples)[i + num*GetNumHiGainSamples()]);187 188 hist->Draw();189 190 return;189 *fLog << "Length: " << str.Length() << endl; 190 191 if (str.Length()>4) 192 sscanf(&str[4], "%d", &num); 193 194 if (num>=GetNumPixels()) 195 num= GetNumPixels(); 196 197 *fLog << "Drawing Histogram of Pixel " << num << endl; 198 199 const Int_t n = GetNumHiGainSamples(); 200 201 char *name = new char[16]; 202 203 sprintf(name, "Pixel No.%d", (*fHiGainPixId)[num]); 204 205 TH1F *hist = new TH1F(name, "Hi Gain Samples FADC", n, 0, n); 206 207 for (int i=0; i<n; i++) 208 hist->Fill(0.5+i, (*fHiGainFadcSamples)[i + num*GetNumHiGainSamples()]); 209 210 hist->Draw(); 211 212 return; 191 213 } 192 193 cout<< "MRawEvtData::Draw: Warning: You must specify either 'GRAPH' or 'HIST'" << endl;214 215 *fLog << "MRawEvtData::Draw: Warning: You must specify either 'GRAPH' or 'HIST'" << endl; 194 216 } 195 217 … … 238 260 if (nSamp && ns!=nSamp) 239 261 { 240 cout<< "RawEvtData::FillPixel: Error, number of samples in ";241 cout<< "TArrayC doesn't match actual number" << endl;262 *fLog << "RawEvtData::FillPixel: Error, number of samples in "; 263 *fLog << "TArrayC doesn't match actual number" << endl; 242 264 return; 243 265 } -
trunk/MagicSoft/Mars/mraw/MRawEvtHeader.cc
r454 r609 71 71 #include "MRawEvtHeader.h" 72 72 73 #include <iostream.h>74 73 #include <iomanip.h> 75 74 #include <fstream.h> 76 75 76 #include "MLog.h" 77 77 #include "MTime.h" 78 78 #include "MArrayB.h" … … 145 145 // This member function prints all Data of one Event on screen. 146 146 // 147 cout<< "DAQEvtNr: " << dec << fDAQEvtNumber << " (";148 cout<< "Trigger: ";149 cout<< "NumLvl1=" << fNumTrigLvl1 << " ";150 cout<< "NumLvl2=" << fNumTrigLvl2 << " ";151 cout<< "Pattern=" << hex << setfill('0');152 cout<< setw(2) << fTrigPattern[0];153 cout<< setw(2) << fTrigPattern[1] << " " << dec;154 155 cout<< "Type=";147 *fLog << "DAQEvtNr: " << dec << fDAQEvtNumber << " ("; 148 *fLog << "Trigger: "; 149 *fLog << "NumLvl1=" << fNumTrigLvl1 << " "; 150 *fLog << "NumLvl2=" << fNumTrigLvl2 << " "; 151 *fLog << "Pattern=" << hex << setfill('0'); 152 *fLog << setw(2) << fTrigPattern[0]; 153 *fLog << setw(2) << fTrigPattern[1] << " " << dec; 154 155 *fLog << "Type="; 156 156 switch (fTrigType) 157 157 { 158 158 case 0: 159 cout<< "Trigger";159 *fLog << "Trigger"; 160 160 break; 161 161 case 1: 162 cout<< "Pedestal";162 *fLog << "Pedestal"; 163 163 break; 164 164 case 2: 165 cout<< "Calibration";165 *fLog << "Calibration"; 166 166 break; 167 167 } 168 cout<< ")" << endl;169 cout<< "Number of Lo Gains On: " << fNumLoGainOn << endl;168 *fLog << ")" << endl; 169 *fLog << "Number of Lo Gains On: " << fNumLoGainOn << endl; 170 170 171 171 for (int i=0; i<fPixLoGainOn->GetSize(); i++) … … 174 174 { 175 175 const UInt_t on = (*fPixLoGainOn)[i]&(1<<j) ? 1 : 0; 176 cout<< on;176 *fLog << on; 177 177 } 178 178 } 179 179 180 cout<< endl;181 182 cout<< endl;180 *fLog << endl; 181 182 *fLog << endl; 183 183 184 184 } -
trunk/MagicSoft/Mars/mraw/MRawFileRead.cc
r454 r609 11 11 #include "MRawFileRead.h" 12 12 13 #include <iostream.h>14 13 #include <fstream.h> 15 14 15 #include "MLog.h" 16 16 #include "MTime.h" 17 17 #include "MParList.h" … … 34 34 fIn = new ifstream(fname); 35 35 36 /* 37 FIXME: How can I test whether the construction of 38 the instance was successfull? 39 if (!fIn->is_open()) 40 cout << "Error: Trying to open file '" << fname << "'" << endl; 41 */ 36 if (!(*fIn)) 37 *fLog << "Error: Trying to open file '" << fname << "'" << endl; 42 38 } 43 39 … … 56 52 if (!fRawRunHeader) 57 53 { 58 cout<< "MRawFileRead::PreProcess - WARNING: MRawRunHeader not found... creating." << endl;54 *fLog << "MRawFileRead::PreProcess - WARNING: MRawRunHeader not found... creating." << endl; 59 55 fRawRunHeader = new MRawRunHeader; 60 56 pList->AddToList(fRawRunHeader); … … 64 60 if (!fRawEvtHeader) 65 61 { 66 cout<< "MRawFileRead::PreProcess - WARNING: MRawEvtHeader not found... creating." << endl;62 *fLog << "MRawFileRead::PreProcess - WARNING: MRawEvtHeader not found... creating." << endl; 67 63 fRawEvtHeader = new MRawEvtHeader; 68 64 pList->AddToList(fRawEvtHeader); … … 72 68 if (!fRawEvtData) 73 69 { 74 cout<< "MRawFileRead::PreProcess - WARNING: MRawEvtData not found... creating." << endl;70 *fLog << "MRawFileRead::PreProcess - WARNING: MRawEvtData not found... creating." << endl; 75 71 fRawEvtData = new MRawEvtData; 76 72 pList->AddToList(fRawEvtData); … … 80 76 if (!fRawCrateArray) 81 77 { 82 cout<< "MRawFileRead::PreProcess - WARNING: MRawCrateArray not found... creating." << endl;78 *fLog << "MRawFileRead::PreProcess - WARNING: MRawCrateArray not found... creating." << endl; 83 79 fRawCrateArray = new MRawCrateArray; 84 80 pList->AddToList(fRawCrateArray); … … 88 84 if (!fRawEvtTime) 89 85 { 90 cout<< "MRawFileRead::PreProcess - WARNING: MRawEvtTime not found... creating." << endl;86 *fLog << "MRawFileRead::PreProcess - WARNING: MRawEvtTime not found... creating." << endl; 91 87 fRawEvtTime = new MTime("MRawEvtTime"); 92 88 pList->AddToList(fRawEvtTime); -
trunk/MagicSoft/Mars/mraw/MRawFileWrite.cc
r532 r609 10 10 #include "MRawFileWrite.h" 11 11 12 #include <iostream.h>13 14 12 #include <TFile.h> 15 13 #include <TTree.h> 16 14 #include <TBranch.h> 17 15 16 #include "MLog.h" 18 17 #include "MParList.h" 19 18 #include "MRawRunHeader.h" … … 43 42 if (!fOut->IsOpen()) 44 43 { 45 cout<< "MRawFileWrite::MRawFileWrite: ERROR: Cannot open file '";46 cout<< fname << "'" << endl;44 *fLog << "MRawFileWrite::MRawFileWrite: ERROR: Cannot open file '"; 45 *fLog << fname << "'" << endl; 47 46 } 48 47 } … … 62 61 if (!fRawEvtHeader) 63 62 { 64 cout<< "MRawFileWrite::PreProcess - ERROR: MRawEvtHeader not found... aborting." << endl;63 *fLog << "MRawFileWrite::PreProcess - ERROR: MRawEvtHeader not found... aborting." << endl; 65 64 return kFALSE; 66 65 } … … 69 68 if (!fRawEvtData) 70 69 { 71 cout<< "MRawFileWrite::PreProcess - ERROR: MRawEvtData not found... aborting." << endl;70 *fLog << "MRawFileWrite::PreProcess - ERROR: MRawEvtData not found... aborting." << endl; 72 71 return kFALSE; 73 72 } … … 76 75 if (!fRawCrateArray) 77 76 { 78 cout<< "MRawFileWrite::PreProcess - ERROR: MRawCrateArray not found... aborting." << endl;77 *fLog << "MRawFileWrite::PreProcess - ERROR: MRawCrateArray not found... aborting." << endl; 79 78 return kFALSE; 80 79 } … … 83 82 if (!fRawEvtTime) 84 83 { 85 cout<< "MRawFileWrite::PreProcess - WARNING: MRawEvtTime not found... aborting." << endl;84 *fLog << "MRawFileWrite::PreProcess - WARNING: MRawEvtTime not found... aborting." << endl; 86 85 return kFALSE; 87 86 } … … 90 89 if (!fRawRunHeader) 91 90 { 92 cout<< "MRawFileWrite::PreProcess - ERROR: MRawRunHeader not found... aborting." << endl;91 *fLog << "MRawFileWrite::PreProcess - ERROR: MRawRunHeader not found... aborting." << endl; 93 92 return kFALSE; 94 93 } -
trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc
r456 r609 12 12 #include <iomanip.h> 13 13 14 //#include <TClass.h> 15 14 #include "MLog.h" 16 15 #include "MArrayS.h" 17 16 … … 46 45 if (fMagicNumber != kMagicNumber) 47 46 { 48 cout<< "Error: Wrong Magic Number: Not a Magic File!" << endl;47 *fLog << "Error: Wrong Magic Number: Not a Magic File!" << endl; 49 48 return; 50 49 } … … 88 87 // print run header information on screen 89 88 // 90 cout<< "MagicNumber: 0x" << hex << fMagicNumber << " - " << (fMagicNumber==0xc0c0?"OK":"Wrong!") << endl;91 cout<< "Version: " << dec << "Format=" << fFormatVersion << " ";92 cout<< "Software=" << fSoftVersion << endl;93 cout<< "RunNumber: " << fRunNumber << " (Type=";89 *fLog << "MagicNumber: 0x" << hex << fMagicNumber << " - " << (fMagicNumber==0xc0c0?"OK":"Wrong!") << endl; 90 *fLog << "Version: " << dec << "Format=" << fFormatVersion << " "; 91 *fLog << "Software=" << fSoftVersion << endl; 92 *fLog << "RunNumber: " << fRunNumber << " (Type="; 94 93 switch (fRunType) 95 94 { 96 95 case 0: 97 cout<< "Data";96 *fLog << "Data"; 98 97 break; 99 98 case 1: 100 cout<< "Pedestal";99 *fLog << "Pedestal"; 101 100 break; 102 101 case 2: 103 cout<< "Calibration";102 *fLog << "Calibration"; 104 103 break; 105 104 } 106 cout<< ")" << endl;107 cout<< "ProjectName: '" << fProjectName << "'" << endl;108 cout<< "Source: '" << fSourceName << "' " << " ";109 cout<< fSourceEpochChar << dec << fSourceEpochDate << endl;110 cout<< "Date: " << setprecision(1) << setiosflags(ios::fixed) << fMJD << " (MJD) " << fDateYear << "/" << fDateMonth << "/" << fDateDay << endl;111 cout<< "Crates: " << fNumCrates << " x " << fNumPixInCrate << " Pixel/Crate = " << fNumCrates*fNumPixInCrate << " Pixel/Evt" << endl;112 cout<< "Samples: " << fNumSamplesLoGain << "/" << fNumSamplesHiGain << " (lo/hi) = " << (fNumSamplesLoGain+fNumSamplesHiGain) * fNumCrates * fNumPixInCrate /1024 << "kB/Evt" << endl;113 cout<< "Evt Counter: " << fNumEvents << endl;105 *fLog << ")" << endl; 106 *fLog << "ProjectName: '" << fProjectName << "'" << endl; 107 *fLog << "Source: '" << fSourceName << "' " << " "; 108 *fLog << fSourceEpochChar << dec << fSourceEpochDate << endl; 109 *fLog << "Date: " << setprecision(1) << setiosflags(ios::fixed) << fMJD << " (MJD) " << fDateYear << "/" << fDateMonth << "/" << fDateDay << endl; 110 *fLog << "Crates: " << fNumCrates << " x " << fNumPixInCrate << " Pixel/Crate = " << fNumCrates*fNumPixInCrate << " Pixel/Evt" << endl; 111 *fLog << "Samples: " << fNumSamplesLoGain << "/" << fNumSamplesHiGain << " (lo/hi) = " << (fNumSamplesLoGain+fNumSamplesHiGain) * fNumCrates * fNumPixInCrate /1024 << "kB/Evt" << endl; 112 *fLog << "Evt Counter: " << fNumEvents << endl; 114 113 115 cout<< hex;114 *fLog << hex; 116 115 for (int i=0; i<GetNumPixel(); i++) 117 cout<< setfill('0') << setw(3) << (*fPixAssignment)[i] << " ";118 cout<< hex << endl;116 *fLog << setfill('0') << setw(3) << (*fPixAssignment)[i] << " "; 117 *fLog << hex << endl; 119 118 120 cout<< endl;119 *fLog << endl; 121 120 } 122 121 -
trunk/MagicSoft/Mars/readraw.cc
r585 r609 1 #include <iostream.h>1 //#include <iostream.h> 2 2 3 3 #include <TSystem.h> … … 11 11 #include "MEvtLoop.h" 12 12 13 #include "MLog.h" 13 14 #include "MTime.h" 14 15 #include "MRawRunHeader.h" … … 31 32 int main(const int argc, const char **argv) 32 33 { 33 cout<< "==================================================" << endl ;34 cout<< " ReadRaw v0.1" << endl;35 cout<< " MARS Merging and Preprocessing Program" << endl ;36 cout<< " Compiled on <" << __DATE__ << ">" << endl ;37 cout<< "==================================================" << endl ;38 cout<< endl;34 gLog << "==================================================" << endl ; 35 gLog << " ReadRaw v0.1" << endl; 36 gLog << " MARS Merging and Preprocessing Program" << endl ; 37 gLog << " Compiled on <" << __DATE__ << ">" << endl ; 38 gLog << "==================================================" << endl ; 39 gLog << endl; 39 40 40 41 // … … 43 44 if (argc!=2) 44 45 { 45 cout<< "Sorry the usage is:" << endl;46 cout<< " readraw inputfile" << endl << endl;46 gLog << "Sorry the usage is:" << endl; 47 gLog << " readraw inputfile" << endl << endl; 47 48 return -1; 48 49 } … … 58 59 if (gSystem->AccessPathName(argv[1], kFileExists)) 59 60 { 60 cout<< "Sorry, the file '" << argv[1] << "' doesn't exist." << endl;61 gLog << "Sorry, the file '" << argv[1] << "' doesn't exist." << endl; 61 62 return -1; 62 63 } … … 74 75 // open the file 75 76 // 76 cout<< " Open the file " << endl ;77 gLog << " Open the file " << endl ; 77 78 TFile input(argv[1], "READ"); 78 79 … … 80 81 // open the Run Header and read in 81 82 // 82 cout<< " Check the RunHeader " << endl ;83 gLog << " Check the RunHeader " << endl ; 83 84 TTree *runtree = (TTree*) input.Get("RunHeaders") ; 84 85 85 86 if (!runtree) 86 87 { 87 cout<< endl88 gLog << endl 88 89 << " WARNING: This file has NO RunHeader " 89 90 << endl << endl ; … … 91 92 else 92 93 { 93 cout<< " Entries in Tree RunHeaders: " << dec << runtree->GetEntries() << endl ;94 gLog << " Entries in Tree RunHeaders: " << dec << runtree->GetEntries() << endl ; 94 95 95 96 runtree->GetBranch("MRawRunHeader")->SetAddress(&runheader); … … 102 103 // open the DataTree and read in 103 104 // 104 cout<< " Check the Event Tree " << endl ;105 gLog << " Check the Event Tree " << endl ; 105 106 TTree *evttree = (TTree*) input.Get("Events") ; 106 cout<< " Check all the Branches in the Tree " << endl ;107 gLog << " Check all the Branches in the Tree " << endl ; 107 108 108 109 // … … 119 120 const char *name = branch->GetName(); 120 121 121 122 if (!strcmp(name, "MRawEvtHeader")) 122 123 evttree->GetBranch("MRawEvtHeader")->SetAddress(&evtheader); 123 124 … … 131 132 evttree->GetBranch("MRawCrateArray")->SetAddress(&evtcrate); 132 133 133 if ( ! strcmp(name, "MMcTrig"))134 135 134 if (!strcmp(name, "MMcTrig")) 135 evttree->GetBranch("MMcTrig")->SetAddress(&trigmc); 136 136 137 if (!strcmp(name, "MMcEvt")) 137 138 evttree->GetBranch("MMcEvt")->SetAddress(&evtmc); 138 139 139 } 140 140 … … 144 144 Int_t nent = (Int_t)evttree->GetEntries(); 145 145 146 cout<< endl << endl;147 cout<< " Entries in Tree Data: " << dec << nent << endl;146 gLog << endl << endl; 147 gLog << " Entries in Tree Data: " << dec << nent << endl; 148 148 149 149 for (Int_t i = 0; i<nent; i++) 150 150 { 151 cout<< "Entry: " << i << endl;151 gLog << "Entry: " << i << endl; 152 152 153 153 // -
trunk/MagicSoft/include-Classes/MMcFormat/MHeaderTrig.cxx
r479 r609 47 47 // 48 48 49 cout <<endl << "Monte Carlo Trigger output:" <<endl; 50 cout << " XSTopology Trigger in this run : "<<topology<<endl; 51 cout << " Multiplicity Trigger in this run : "<<multiplicity<<endl; 52 cout << " Trigger Pattern in this run : "<<TriggerPattern[0]<< 53 TriggerPattern[1]<<endl; 54 cout << endl ; 49 cout << endl; 50 cout << "Monte Carlo Trigger output:" << endl; 51 cout << " XSTopology Trigger in this run: " << topology << endl; 52 cout << " Multiplicity Trigger in this run: " << multiplicity << endl; 53 cout << " Trigger Pattern in this run: "; 54 cout << TriggerPattern[0] << ", " << TriggerPattern[1] << endl; 55 cout << endl; 55 56 } -
trunk/MagicSoft/include-Classes/MMcFormat/MMcEvt.cxx
r574 r609 154 154 // print out the data member on screen 155 155 // 156 cout << endl << "Monte Carlo output:" <<endl;157 cout << " Particle Id : " << usPartId ;158 cout << " Energy (GeV) : " << fEnergy ;159 cout << " Impactpar. (m) : " << fImpact ;160 cout << " Photoelectrons : " << usPhotEl ;156 cout << endl << "Monte Carlo output:" << endl; 157 cout << " Particle Id: " << usPartId << endl; 158 cout << " Energy [GeV]: " << fEnergy << endl; 159 cout << " Impactpar. [m]: " << fImpact << endl; 160 cout << " Photoelectrons: " << usPhotEl << endl; 161 161 cout << endl ; 162 162 } -
trunk/MagicSoft/include-Classes/MMcFormat/MMcTrig.cxx
r483 r609 69 69 70 70 cout <<endl << "Monte Carlo Trigger output:" <<endl; 71 cout << " First Level Trigger in this Event : "<<nFirstLevel<<endl;72 cout << " Times of first Level Trigger in this Event 71 cout << " First Level Trigger in this Event: "<<nFirstLevel<<endl; 72 cout << " Times of first Level Trigger in this Event: "; 73 73 for (i=0;i<nFirstLevel;i++){ 74 74 cout<< timeFirst[i]<<"-"; 75 75 } 76 76 cout<<endl; 77 cout << " Pixels of first Level Trigger in this Event 77 cout << " Pixels of first Level Trigger in this Event: "; 78 78 for (i=0;i<nFirstLevel;i++){ 79 79 cout<<pixelFirst[i]<<"-"; 80 80 } 81 81 cout<<endl; 82 cout << " Second Level Trigger in this Event : " << nSecondLevel << endl ;82 cout << " Second Level Trigger in this Event: " << nSecondLevel << endl ; 83 83 cout << endl ; 84 84 }
Note:
See TracChangeset
for help on using the changeset viewer.