Changeset 716
- Timestamp:
- 04/02/01 15:08:48 (24 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r715 r716 2 2 3 3 2000/04/02: Thomas Bretz 4 5 * mraw/MRawEvtHeader.h, mraw/MRawFileWrite.cc: 6 - added constants (kTT*) for trigger type 7 8 * manalysis/MImgCleanStd.[h,cc]: 9 - added changeable cleaning levels 10 11 * manalysis/MHillas.cc: 12 - added some more sanity checks to the calculation 13 14 * manalysis/MCT1ReadAscii.[h,cc]: 15 - added some kind of chain feature (AddFile) to process more than one file 4 16 5 17 * mgui/MGeomPix.[h,c]: -
trunk/MagicSoft/Mars/Makefile.conf.general
r574 r716 3 3 # 4 4 5 ROOTVER = `root-config --version` 5 6 ROOTLIBS = `root-config --libs` 6 7 ROOTGLIBS = `root-config --glibs` … … 11 12 # 12 13 13 DEFINES = -D__MARS__ 14 DEFINES = -D__MARS__ -DROOTVER=\"$(ROOTVER)\" 14 15 15 16 CXXFLAGS = $(ROOTCFLAGS) $(INCLUDES) $(OPTIM) $(DEBUG) $(DEFINES) -
trunk/MagicSoft/Mars/macros/CT1Hillas.C
r710 r716 40 40 // 4) fill the hillas into the histograms 41 41 // 42 MCT1ReadAscii read("CT1_97_on1.dat") ; 42 MCT1ReadAscii read; 43 read.AddFile("CT1_99_off1.dat"); 44 read.AddFile("CT1_99_off2.dat"); 45 43 46 MImgCleanStd clean; 44 47 MHillasCalc hcalc; -
trunk/MagicSoft/Mars/macros/readCT1.C
r710 r716 42 42 43 43 clean.Process(); 44 hcalc.Process(); 44 45 if (hcalc.Process()==kCONTINUE) 46 { 47 cout << "skipped." << endl; 48 continue; 49 } 45 50 46 51 hillas.Print(); -
trunk/MagicSoft/Mars/manalysis/MCT1ReadAscii.cc
r705 r716 9 9 #include <fstream.h> 10 10 11 #include <TArrayC.h> 12 11 13 #include "MLog.h" 12 14 #include "MLogManip.h" … … 28 30 // remember file name for opening the file in the preprocessor 29 31 // 30 fFileName = fname; 32 fFileNames = new TArrayC; 33 if (fname) 34 AddFile(fname); 35 } 36 37 MCT1ReadAscii::~MCT1ReadAscii() 38 { 39 delete fFileNames; 40 if (fIn) 41 delete fIn; 42 } 43 44 void MCT1ReadAscii::AddFile(const char *txt) 45 { 46 // 47 // Add this file as the last entry in the chain 48 // 49 const int sz = fFileNames->GetSize(); 50 const int tsz = strlen(txt)+1; 51 52 fFileNames->Set(sz+tsz); 53 54 memcpy(fFileNames->GetArray()+sz, txt, tsz); 55 } 56 57 Bool_t MCT1ReadAscii::OpenNextFile() 58 { 59 // 60 // open the input stream and check if it is really open (file exists?) 61 // 62 if (fIn) 63 delete fIn; 64 fIn = NULL; 65 66 const int arrsz = fFileNames->GetSize(); 67 68 if (arrsz<1) 69 return kFALSE; 70 71 // 72 // open the file which is the first one in the chain 73 // 74 const char *name = fFileNames->GetArray(); 75 76 fIn = new ifstream(name); 77 if (!(*fIn)) 78 { 79 *fLog << dbginf << "Cannot open file '" << name << "'" << endl; 80 return kFALSE; 81 } 82 83 // 84 // remove the first entry from the chain 85 // 86 *fLog << "Open file: '" << name << "'" << endl; 87 88 // 89 // create the new char array containing the filenames to process 90 // 91 const int sz = strlen(name)+1; 92 93 char *dummy = new char[arrsz-sz]; 94 memcpy(dummy, name+sz, arrsz-sz); 95 96 // 97 // dummy will be deleted by the destructor of fFileNames 98 // 99 fFileNames->Adopt(arrsz-sz, dummy); 100 101 return kTRUE; 102 31 103 } 32 104 … … 38 110 39 111 // 40 // open the input stream and check if it is really open (file exists?) 41 // 42 fIn = new ifstream(fFileName); 43 if (!(*fIn)) 44 { 45 *fLog << dbginf << "Cannot open file." << endl; 46 return kFALSE; 47 } 112 // Try to open at least one (the first) file 113 // 114 if (!OpenNextFile()) 115 return kFALSE; 48 116 49 117 // … … 141 209 142 210 // 143 // check if we are done 211 // check if we are done. Try to open the next file in chain. 212 // If it was possible start reading. If not break the event loop 144 213 // 145 214 if (fIn->eof()) 146 return kFALSE;215 return OpenNextFile() ? kCONTINUE : kFALSE; 147 216 148 217 // … … 163 232 } 164 233 165 Bool_t MCT1ReadAscii::PostProcess()166 {167 //168 // close and delete the input stream169 //170 delete fIn;171 172 return kTRUE;173 }174 -
trunk/MagicSoft/Mars/manalysis/MCT1ReadAscii.h
r705 r716 6 6 #endif 7 7 8 class TArrayC; 8 9 class MCerPhotEvt; 9 10 class MPedestalCam; … … 12 13 { 13 14 private: 14 TString fFileName; //! the file name of the string 15 ifstream *fIn; //! the inputfile 16 MCerPhotEvt *fNphot; //! the data container for all data. 17 MPedestalCam *fPedest; //! ct1 pedestals 15 TString fFileName; // the file name of the string 16 ifstream *fIn; // the inputfile 17 MCerPhotEvt *fNphot; // the data container for all data. 18 MPedestalCam *fPedest; // ct1 pedestals 19 TArrayC *fFileNames; // Array which stores the \0-terminated filenames 20 21 Bool_t OpenNextFile(); 18 22 19 23 void ReadPedestals(); … … 21 25 22 26 public: 23 MCT1ReadAscii(const char *filename ,27 MCT1ReadAscii(const char *filename=NULL, 24 28 const char *name=NULL, 25 29 const char *title=NULL); 26 30 31 ~MCT1ReadAscii(); 32 33 void AddFile(const char *fname); 34 27 35 Bool_t PreProcess(MParList *pList); 28 36 Bool_t Process(); 29 Bool_t PostProcess();30 37 31 38 ClassDef(MCT1ReadAscii, 0) // Reads the CT1 data file -
trunk/MagicSoft/Mars/manalysis/MHillas.cc
r713 r716 99 99 Bool_t MHillas::Calc(MGeomCam &geom, MCerPhotEvt &evt) 100 100 { 101 // 102 // Calculate the Hillas parameters from a cerenkov photon event 103 // (The calcualtion is some kind of two dimentional statistics) 104 // 105 101 106 const UInt_t nevt = evt.GetNumPixels(); 102 107 … … 104 109 // sanity check 105 110 // 106 if (nevt <2)111 if (nevt <= 2) 107 112 return kFALSE; 108 113 … … 115 120 fSize = 0; 116 121 122 // 123 // FIXME! npix should be retrieved from MCerPhotEvt 124 // 125 UShort_t npix=0; 117 126 for (UInt_t i=0; i<nevt; i++) 118 127 { … … 129 138 xmean += nphot * gpix.GetX(); // [mm] 130 139 ymean += nphot * gpix.GetY(); // [mm] 140 141 npix++; 131 142 } 143 144 // 145 // sanity check 146 // 147 if (fSize==0 || npix<=2) 148 return kFALSE; 132 149 133 150 xmean /= fSize; // [mm] -
trunk/MagicSoft/Mars/manalysis/MImgCleanStd.cc
r715 r716 11 11 ClassImp(MImgCleanStd) 12 12 13 MImgCleanStd::MImgCleanStd(const char *name, const char *title) 13 MImgCleanStd::MImgCleanStd(const Float_t lvl1, const Float_t lvl2, 14 const char *name, const char *title) 15 : fCleanLvl1(lvl1), fCleanLvl2(lvl2) 14 16 { 15 17 // … … 18 20 19 21 *fName = name ? name : "MImgCleanStd"; 20 *fTitle = name ? name: "Task which does a standard image cleaning";21 } 22 23 void MImgCleanStd::Clean Level1()22 *fTitle = title ? title : "Task which does a standard image cleaning"; 23 } 24 25 void MImgCleanStd::CleanStep1() 24 26 { 25 27 // 26 28 // This method looks for all pixels with an entry (photons) 27 29 // that is three times bigger than the noise of the pixel 30 // (std: 3 sigma, clean level 1) 28 31 // 29 32 … … 41 44 const Float_t noise = pix.GetErrorPhot(); 42 45 43 if (entry < 3* noise )46 if (entry < fCleanLvl1 * noise ) 44 47 pix.SetPixelUnused(); 45 48 } 46 49 } 47 50 48 void MImgCleanStd::Clean Level2()51 void MImgCleanStd::CleanStep2() 49 52 { 50 53 // … … 113 116 } 114 117 115 void MImgCleanStd::Clean Level3()118 void MImgCleanStd::CleanStep3() 116 119 { 117 120 // 118 121 // Look for the boundary pixels around the core pixels 119 // if a pixel has more than 2.5 sigma, and a core neigbor120 // it is declared as used.122 // if a pixel has more than 2.5 (clean level 2) sigma, and 123 // a core neigbor it is declared as used. 121 124 // 122 125 const Int_t entries = fEvt->GetNumPixels(); … … 141 144 const Float_t noise = pix.GetErrorPhot(); 142 145 143 if (entry <= 2.5* noise )146 if (entry <= fCleanLvl2 * noise ) 144 147 continue; 145 148 … … 198 201 Bool_t MImgCleanStd::Process() 199 202 { 200 Clean Level1();201 Clean Level2();202 Clean Level3();203 CleanStep1(); 204 CleanStep2(); 205 CleanStep3(); 203 206 204 207 return kTRUE; -
trunk/MagicSoft/Mars/manalysis/MImgCleanStd.h
r715 r716 18 18 MCerPhotEvt *fEvt; 19 19 20 Float_t fCleanLvl1; 21 Float_t fCleanLvl2; 22 20 23 public: 21 MImgCleanStd(const char *name=NULL, const char *title=NULL) ; 24 MImgCleanStd(const Float_t lvl1=3.0, const Float_t lvl2=2.5, 25 const char *name=NULL, const char *title=NULL); 22 26 23 void Clean Level1();24 void Clean Level2();25 void Clean Level3();27 void CleanStep1(); 28 void CleanStep2(); 29 void CleanStep3(); 26 30 27 31 Bool_t PreProcess (MParList *pList); -
trunk/MagicSoft/Mars/merpp.cc
r654 r716 37 37 gLog << " MARS Merging and Preprocessing Program" << endl ; 38 38 gLog << " Compiled on <" << __DATE__ << ">" << endl ; 39 gLog << " Using ROOT v" << ROOTVER << endl ; 39 40 gLog << "==================================================" << endl ; 40 41 gLog << endl; -
trunk/MagicSoft/Mars/mraw/MRawEvtHeader.h
r654 r716 10 10 class MArrayB; 11 11 class MRawRunHeader; 12 13 // 14 // Trigger Typed (TT) 15 // 16 enum { 17 kTTEvent = 0, 18 kTTPedestal = 1, 19 kTTCalibration = 2 20 }; 12 21 13 22 class MRawEvtHeader : public MParContainer … … 27 36 28 37 // 29 // Informations only needed to read the raw file 38 // Informations only needed to read the raw file correctly 30 39 // 31 40 UShort_t fTrigType; //! Trigger Type of this event -
trunk/MagicSoft/Mars/mraw/MRawFileWrite.cc
r609 r716 15 15 16 16 #include "MLog.h" 17 #include "MLogManip.h" 18 17 19 #include "MParList.h" 18 20 #include "MRawRunHeader.h" … … 142 144 switch (type) 143 145 { 144 case 0:146 case kTTEvent: 145 147 fTData->Fill(); 146 break; 147 case 1: 148 return kTRUE; 149 150 case kTTPedestal: 148 151 fTPedestal->Fill(); 149 break; 150 case 2: 152 return kTRUE; 153 154 case kTTCalibration: 151 155 fTCalibration->Fill(); 152 break;156 return kTRUE; 153 157 } 154 158 155 return kTRUE; 159 *fLog << dbginf << "Got wrong number for the trigger type: " << type; 160 *fLog << " - skipping" << endl; 161 162 return kCONTINUE; 156 163 } 157 164
Note:
See TracChangeset
for help on using the changeset viewer.