Changeset 718 for trunk/MagicSoft
- Timestamp:
- 04/04/01 10:48:02 (24 years ago)
- Location:
- trunk/MagicSoft/Mars/mraw
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mraw/MRawEvtData.cc
r658 r718 81 81 } 82 82 83 Byte_t MRawEvtData::GetNumPixels() const83 UShort_t MRawEvtData::GetNumPixels() const 84 84 { 85 85 return fHiGainPixId->GetSize(); … … 149 149 void MRawEvtData::Draw(Option_t *opt) 150 150 { 151 // ----- AppendPad(opt); 152 153 TString str(opt); 154 155 UInt_t num = 0; 156 157 if (str.BeginsWith("GRAPH", TString::kIgnoreCase)) 158 { 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; 185 } 186 187 if (str.BeginsWith("HIST", TString::kIgnoreCase)) 188 { 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; 213 } 214 215 *fLog << "MRawEvtData::Draw: Warning: You must specify either 'GRAPH' or 'HIST'" << endl; 151 // ----- AppendPad(opt); 152 153 // 154 // FIXME: BIG MEMORY LEAK! 155 // 156 157 TString str(opt); 158 159 UInt_t num = 0; 160 161 if (str.BeginsWith("GRAPH", TString::kIgnoreCase)) 162 { 163 if (str.Length()>5) 164 sscanf(&str[5], "%d", &num); 165 166 if (num>=GetNumPixels()) 167 num= GetNumPixels(); 168 169 *fLog << "Drawing Graph: Pixel #" << num << " of " << (int)GetNumPixels() << endl; 170 171 const Int_t n = GetNumHiGainSamples(); 172 173 Float_t *x = new Float_t[n]; 174 Float_t *y = new Float_t[n]; 175 176 for (int i=0; i<n; i++) 177 { 178 x[i] = i; 179 y[i] = (*fHiGainFadcSamples)[i + num*GetNumHiGainSamples()]; 180 } 181 182 TGraph *graph = new TGraph(n, x, y); 183 graph->SetMaximum (256) ; 184 graph->SetMinimum (0) ; 185 186 graph->Draw("AC*"); 187 188 return; 189 } 190 191 if (str.BeginsWith("HIST", TString::kIgnoreCase)) 192 { 193 *fLog << "Length: " << str.Length() << endl; 194 195 if (str.Length()>4) 196 sscanf(&str[4], "%d", &num); 197 198 if (num>=GetNumPixels()) 199 num= GetNumPixels(); 200 201 *fLog << "Drawing Histogram of Pixel " << num << endl; 202 203 const Int_t n = GetNumHiGainSamples(); 204 205 char *name = new char[16]; 206 207 sprintf(name, "Pixel No.%d", (*fHiGainPixId)[num]); 208 209 TH1F *hist = new TH1F(name, "Hi Gain Samples FADC", n, 0, n); 210 211 for (int i=0; i<n; i++) 212 hist->Fill(0.5+i, (*fHiGainFadcSamples)[i + num*GetNumHiGainSamples()]); 213 214 hist->Draw(); 215 216 return; 217 } 218 219 *fLog << "MRawEvtData::Draw: Warning: You must specify either 'GRAPH' or 'HIST'" << endl; 216 220 } 217 221 -
trunk/MagicSoft/Mars/mraw/MRawEvtData.h
r654 r718 50 50 void AddPixel(UShort_t nOfPixel, TArrayC *data, Bool_t lflag=kFALSE); 51 51 52 Byte_t GetNumHiGainSamples() const;53 Byte_t GetNumLoGainSamples() const;54 Byte_t GetNumPixels() const;52 Byte_t GetNumHiGainSamples() const; 53 Byte_t GetNumLoGainSamples() const; 54 UShort_t GetNumPixels() const; 55 55 56 56 void ReadEvt(istream &fin);
Note:
See TracChangeset
for help on using the changeset viewer.