Changeset 456
- Timestamp:
- 12/22/00 16:25:50 (24 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/macros/dohtml.C
r454 r456 16 16 17 17 html.SetSourceDir("macros"); 18 html.Convert("merpp.C", "MARS - Merging and Preprocessing Macro");19 html.Convert("readraw.C", "MARS - Read a raw file macro");18 html.Convert("merpp.C", "MARS - Merging and Preprocessing"); 19 html.Convert("readraw.C", "MARS - How To Read A Raw"); 20 20 html.Convert("rootlogon.C", "MARS - rootlogon.C"); 21 21 } -
trunk/MagicSoft/Mars/mraw/MRawEvtData.cc
r454 r456 127 127 void MRawEvtData::Draw(Option_t *opt) 128 128 { 129 TString str(opt); 130 131 UInt_t num = 0; 132 133 if (str.BeginsWith("GRAPH", TString::kIgnoreCase)) 129 // ----- AppendPad(opt); 130 131 TString str(opt); 132 133 UInt_t num = 0; 134 135 if (str.BeginsWith("GRAPH", TString::kIgnoreCase)) 136 { 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++) 134 151 { 135 if (str.Length()>5) 136 sscanf(&str[5], "%d", &num); 137 138 if (num>=GetNumPixels()) 139 num= GetNumPixels(); 140 141 cout << "Drawing Graph of Pixel " << num << endl; 142 143 const Int_t n = GetNumHiGainSamples(); 144 145 Float_t *x = new Float_t[n]; 146 Float_t *y = new Float_t[n]; 147 148 for (int i=0; i<n; i++) 149 { 150 x[i] = i; 151 y[i] = (*fHiGainFadcSamples)[i + num*GetNumHiGainSamples()]; 152 } 153 154 TGraph *graph = new TGraph(n, x, y); 155 graph->Draw("AC*"); 156 157 return; 152 x[i] = i; 153 y[i] = (*fHiGainFadcSamples)[i + num*GetNumHiGainSamples()]; 158 154 } 159 160 if (str.BeginsWith("HIST", TString::kIgnoreCase)) 161 { 162 cout << "Length: " << str.Length() << endl; 163 164 if (str.Length()>4) 165 sscanf(&str[4], "%d", &num); 166 167 if (num>=GetNumPixels()) 168 num= GetNumPixels(); 169 170 cout << "Drawing Histogram of Pixel " << num << endl; 171 172 const Int_t n = GetNumHiGainSamples(); 173 174 char *name = new char[16]; 175 176 sprintf(name, "Pixel No.%d", (*fHiGainPixId)[num]); 177 178 TH1F *hist = new TH1F(name, "Hi Gain Samples FADC", n, 0, n); 179 180 for (int i=0; i<n; i++) 181 hist->Fill(0.5+i, (*fHiGainFadcSamples)[i + num*GetNumHiGainSamples()]); 182 183 hist->Draw(); 184 185 return; 186 } 187 188 cout << "MRawEvtData::Draw: Warning: You must specify either 'GRAPH' or 'HIST'" << endl; 155 156 TGraph *graph = new TGraph(n, x, y); 157 graph->Draw("AC*"); 158 159 return; 160 } 161 162 if (str.BeginsWith("HIST", TString::kIgnoreCase)) 163 { 164 cout << "Length: " << str.Length() << endl; 165 166 if (str.Length()>4) 167 sscanf(&str[4], "%d", &num); 168 169 if (num>=GetNumPixels()) 170 num= GetNumPixels(); 171 172 cout << "Drawing Histogram of Pixel " << num << endl; 173 174 const Int_t n = GetNumHiGainSamples(); 175 176 char *name = new char[16]; 177 178 sprintf(name, "Pixel No.%d", (*fHiGainPixId)[num]); 179 180 TH1F *hist = new TH1F(name, "Hi Gain Samples FADC", n, 0, n); 181 182 for (int i=0; i<n; i++) 183 hist->Fill(0.5+i, (*fHiGainFadcSamples)[i + num*GetNumHiGainSamples()]); 184 185 hist->Draw(); 186 187 return; 188 } 189 190 cout << "MRawEvtData::Draw: Warning: You must specify either 'GRAPH' or 'HIST'" << endl; 189 191 } 190 192 -
trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.cc
r454 r456 1 /////////////////////////////////////////////////////////////////////////////// 2 // 3 // MRawEvtPixelIter 4 // 5 // class to iterate over all pixels of one event. 6 // The calling is similar to a root iterator: 7 // 8 // MRawEvtData *evtdata; // must be filled with data from somewhere 9 // MRawEvtPixelIter pixel(evtdata); // evtdata: ptr to event you want to iterate 10 // 11 // while (pixel.Next()) 12 // { 13 // // here you can access the actual time slices by using 14 // // pixel.GetPixelId(); 15 // // pixel.GetHiGainFadcSamples()[i]; // i is the number of the slice 16 // // pixel.IsLoGain(); // check if pixel has 17 // // pixel.GetLoGainFadcSamples()[i]; // i is the number of the slice 18 // 19 // // WARNING: Don't acces more time slices than available. 20 // // Get the numbers by calling: evtdata->GetNum[Lo,Hi]GainSamples() 21 // // This number is constant for one event 22 // } 23 // 24 /////////////////////////////////////////////////////////////////////////////// 1 25 #include "MRawEvtPixelIter.h" 2 26 … … 8 32 ClassImp(MRawEvtPixelIter) 9 33 10 TObject*MRawEvtPixelIter::Next()34 MRawEvtData *MRawEvtPixelIter::Next() 11 35 { 12 36 // 13 37 // if we are already at the last entry there is no 'next' entry anymore 14 38 // 15 if (fNumHiGainEntry==fData->fHiGainPixId->GetSize() -1)39 if (fNumHiGainEntry==fData->fHiGainPixId->GetSize()) 16 40 return NULL; 17 41 … … 19 43 // if we are already at the last entry there is no 'next' entry anymore 20 44 // 21 if (fNumLoGainEntry != fData->fLoGainPixId->GetSize() -1)45 if (fNumLoGainEntry != fData->fLoGainPixId->GetSize()) 22 46 if (*fHiGainId == *fLoGainId) 23 47 { … … 56 80 // set pointer to first entry of arrays 57 81 // 58 fHiGainId = (UShort_t*)fData->fHiGainPixId->GetArray();59 fLoGainId = (UShort_t*)fData->fLoGainPixId->GetArray();60 fHiGainPos = (Byte_t*)fData->fHiGainFadcSamples->GetArray();61 fLoGainPos = (Byte_t*)fData->fLoGainFadcSamples->GetArray();82 fHiGainId = fData->fHiGainPixId->GetArray()-1; 83 fLoGainId = fData->fLoGainPixId->GetArray()-1; 84 fHiGainPos = fData->fHiGainFadcSamples->GetArray()-fData->GetNumHiGainSamples(); 85 fLoGainPos = fData->fLoGainFadcSamples->GetArray()-fData->GetNumLoGainSamples(); 62 86 } 87 88 void MRawEvtPixelIter::Draw(Option_t *t) 89 { 90 // 91 // Draw the actual pixel (for options see: MRawEvtData::Draw) 92 // 93 char *txt = new char[6+strlen(t)]; 94 sprintf(txt, "%s%d", t, *fHiGainId); 95 fData->Draw(txt); 96 delete txt; 97 } 98 99 100 101 102 103 -
trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.h
r454 r456 1 1 #ifndef MRAWEVTPIXELITER_H 2 2 #define MRAWEVTPIXELITER_H 3 3 /////////////////////////////////////////////////////////////////////////////// 4 // 5 // MRawEvtPixelIter 6 // 7 // class to iterate over all pixels of one event. 8 // 9 /////////////////////////////////////////////////////////////////////////////// 4 10 #ifndef MAGIC_H 5 11 #include "MAGIC.h" 6 #endif7 #ifndef ROOT_TIterator8 #include <TIterator.h>9 12 #endif 10 13 11 14 class MRawEvtData; 12 15 13 class MRawEvtPixelIter : public TIterator16 class MRawEvtPixelIter 14 17 { 15 18 private: … … 28 31 MRawEvtPixelIter(MRawEvtData *dat) : fData(dat) 29 32 { 30 //31 // WARNING: The Iterator now points to the FIRST entry.32 // This means that you have to use a do...while loop33 // NOT a while() loop.34 //35 33 Reset(); 36 34 } 37 35 38 TObject*Next();36 MRawEvtData *Next(); 39 37 40 38 UShort_t GetPixelId() const … … 76 74 void Reset(); 77 75 78 ClassDef(MRawEvtPixelIter, 1) 76 void Draw(Option_t *t="GRAPH"); 77 78 ClassDef(MRawEvtPixelIter, 1) // iterates over all pixels of one MRawEvtData object 79 79 }; 80 80 -
trunk/MagicSoft/Mars/mraw/MRawRunHeader.cc
r454 r456 12 12 #include <iomanip.h> 13 13 14 //#include <TClass.h> 15 14 16 #include "MArrayS.h" 15 17 … … 22 24 23 25 fPixAssignment = new MArrayS(0); 26 27 // This is only valid for root > 3.0 28 // IsA()->CanIgnoreTObjectStreamer(); 24 29 } 25 30 -
trunk/MagicSoft/Mars/readraw.cc
r454 r456 11 11 #include "MEvtLoop.h" 12 12 13 #include "MTime.h" 13 14 #include "MRawRunHeader.h" 14 15 #include "MRawEvtHeader.h" 15 16 #include "MRawEvtData.h" 16 17 #include "MRawCrateArray.h" 17 #include "MTime.h"18 18 #include "MInputStreamID.h" 19 19 20 20 ///////////////////////////////////////////////////////////////////////////// 21 21 // 22 // This is an easy implementation of the Merging process (as compilable prog) 23 // 24 // at the moment it reads a binary file ("rawtest.bin") which was written 25 // in the DAQ raw format. 26 // 27 // The data are stored in root container objects (classes derived from 28 // TObject like MRawRunHeader) 29 // 30 // This containers are written to a root file ("rawtest.root") 22 // This is an demonstration how to read in a merpped root file 31 23 // 32 24 ///////////////////////////////////////////////////////////////////////////// … … 35 27 { 36 28 cout << "==================================================" << endl ; 37 cout << " MERPPv0.1" << endl;29 cout << " ReadRaw v0.1" << endl; 38 30 cout << " MARS Merging and Preprocessing Program" << endl ; 39 31 cout << " Compiled on <" << __DATE__ << ">" << endl ; … … 44 36 // check for the right usage of the program 45 37 // 38 if (argc!=2) 39 { 40 cout << "Sorry the usage is:" << endl; 41 cout << " readraw inputfile" << endl << endl; 42 return -1; 43 } 46 44 47 45 // 48 46 // initialize ROOT (this is obligatory here) 49 47 // 50 TROOT simple("Merpp","Mars - Merging and Preprocessing Program"); 48 TROOT simple("Readraw","Mars - Merging and Preprocessing Program"); 49 50 // 51 // check whether the given files are OK. 52 // 53 if (gSystem->AccessPathName(argv[1], kFileExists)) 54 { 55 cout << "Sorry, the file '" << argv[1] << "' doesn't exist." << endl; 56 return -1; 57 } 51 58 52 59 MRawRunHeader *runheader = new MRawRunHeader(); … … 88 95 evttree->GetBranch("MRawCrateArray")->SetAddress(&evtcrate); 89 96 90 Int_t iEnt = (Int_t)evttree->GetEntries();91 cout << " Entries in Tree Data: " << dec << iEnt << endl;97 Int_t nent = (Int_t)evttree->GetEntries(); 98 cout << " Entries in Tree Data: " << dec << nent << endl; 92 99 93 for (Int_t i = 0; i< iEnt; i++)100 for (Int_t i = 0; i<nent; i++) 94 101 { 95 102 cout << "Entry: " << i << endl;
Note:
See TracChangeset
for help on using the changeset viewer.