Changeset 609 for trunk/MagicSoft/Mars/mraw
- Timestamp:
- 02/22/01 14:30:10 (24 years ago)
- Location:
- trunk/MagicSoft/Mars/mraw
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.