Changeset 2910 for trunk/MagicSoft/Mars
- Timestamp:
- 01/26/04 11:30:37 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r2909 r2910 9 9 * mraw/MRawEvtPixelIter.[h,cc]: 10 10 - removed member function GetNumPixels. For more details see mantis. 11 12 * manalysis/MArrivalTime.[h,cc]: 13 - reorganized includes 14 - fixed InitSize and ClearArray (now Reset) to fit MParContainer 15 definition 16 - for the moment removed usage of fPixelChecked - THIS WILL CRASH YOUR 17 PROGRAM 18 19 * manalysis/MArrivalTimeCalc.[h,cc]: 20 - reorganized includes 21 - removed many obsolete code, exspecially copy&paste relicts! 22 - fixed usage of InitSize 23 - removed CleanArray. Reset() is called automatically before Process() 11 24 12 25 -
trunk/MagicSoft/Mars/manalysis/MArrivalTime.cc
r2903 r2910 18 18 ! Author(s): Sebastian Raducci, 12/2003 <mailto:raducci@fisica.uniud.it> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 320 ! Copyright: MAGIC Software Development, 2000-2004 21 21 ! 22 22 ! … … 32 32 #include "MArrivalTime.h" 33 33 34 #include <TSpline.h> 35 34 36 #include "MGeomCam.h" 35 37 #include "MGeomPix.h" … … 45 47 using namespace std; 46 48 49 #warning Commented out all usage of fPixelCehcked - THIS WILL CRASH YOUR PROGRAM! 50 47 51 // -------------------------------------------------------------------------- 48 52 // … … 55 59 } 56 60 61 // ------------------------------------------------------------------------- 62 // 57 63 // Sets every pixel arrival time to -1 58 void MArrivalTime::CleanArray(const MGeomCam &geom) 59 { 60 fData.Set(geom.GetNumPixels()); 61 fData.Reset(-1.0); 64 // 65 void MArrivalTime::Reset() 66 { 67 // Do not use 'TArray::Reset()' or memset. It sets all single 68 // bytes to -1 (in other words, it fills the array with 0xff) 69 for (int i=0; i<fData.GetSize(); i++) 70 fData[i] = -1; 62 71 } 63 72 64 73 void MArrivalTime::InitSize(Int_t i) 65 74 { 66 67 if (fData.GetSize() >= i)68 return;69 else70 75 fData.Set(i); 71 76 } 72 77 78 // ------------------------------------------------------------------------- 73 79 // 74 80 // Set the arrival time in one pixel … … 76 82 void MArrivalTime::SetTime(Int_t i, Float_t t) 77 83 { 78 79 if (i >= fData.GetSize()) 80 fData.Set(i+1); 81 82 fData.AddAt(t,i); 83 } 84 84 fData[i] = t; 85 } 86 87 // ------------------------------------------------------------------------- 85 88 // 86 89 // Calculates the arrival time for each pixel … … 89 92 // 90 93 // 91 92 94 void MArrivalTime::Calc(const Byte_t *fadcSamples, const Short_t nSlice, 93 const Short_t idx, const MGeomCam &geom)95 const Short_t idx) 94 96 { 95 97 … … 130 132 // it becomes stable 131 133 // 132 133 134 void MArrivalTime::EvalClusters(const MRawEvtData &evt, const MGeomCam &geom) 134 135 { … … 148 149 // Array that says if a pixel has been already checked or not 149 150 150 for (Int_t i = 0; i < n; i++)151 fPixelChecked[i] = kFALSE;151 // for (Int_t i = 0; i < n; i++) 152 // fPixelChecked[i] = kFALSE; 152 153 153 154 // This fakeData array will be subsituted with the fData Array. … … 166 167 while ( pixel.Next() ) 167 168 { 169 /* 168 170 if (!fPixelChecked[pixel.GetPixelId()]) 169 171 { … … 197 199 fData2[fCluster[i]]=fakeData[fCluster[i]]; 198 200 } 199 } 201 } */ 200 202 } 201 203 … … 206 208 // Function to check the nearest neighbour pixels arrivaltime 207 209 // 208 209 210 void MArrivalTime::CheckNeighbours(const MRawEvtData &evt, const MGeomCam &geom, 210 211 Short_t idx, Short_t *dimCluster) 211 212 { 212 213 Byte_t numNeighbors=geom[idx].GetNumNeighbors(); 213 fPixelChecked[idx] = kTRUE;214 //fPixelChecked[idx] = kTRUE; 214 215 215 216 for (Byte_t i=0x00; i < numNeighbors; i++) 216 217 { 217 218 219 /* 218 220 if (!fPixelChecked[geom[idx].GetNeighbor(i)] && 219 221 fakeData[idx] == fakeData[geom[idx].GetNeighbor(i)]) … … 223 225 CheckNeighbours(evt, geom, 224 226 geom[idx].GetNeighbor(i), dimCluster); 225 } 227 } 228 */ 226 229 } 227 230 } … … 230 233 // Returns the arrival time value 231 234 // 232 233 235 Bool_t MArrivalTime::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const 234 236 { -
trunk/MagicSoft/Mars/manalysis/MArrivalTime.h
r2902 r2910 1 1 #ifndef MARS_MArrivalTime 2 2 #define MARS_MArrivalTime 3 4 #ifndef MARS_MCamEvent 5 #include "MCamEvent.h" 6 #endif 3 7 4 8 #ifndef ROOT_TArrayF … … 8 12 #include <TArrayS.h> 9 13 #endif 10 #ifndef ROOT_TSpline11 #include <TSpline.h>12 #endif13 #ifndef MARS_MCamEvent14 #include "MCamEvent.h"15 #endif16 14 17 class MGeomPix;18 15 class MRawEvtData; 19 class MRawEvtPixelIter;20 16 21 17 class MArrivalTime : public MCamEvent 22 18 { 23 24 19 private: 25 20 TArrayF fData; // Stores the arrival times … … 30 25 TArrayF fData5; // Clusters with at most 5 pix 31 26 32 Bool_t *fPixelChecked; // For each pixel says if it's already been checked27 //Bool_t *fPixelChecked; // For each pixel says if it's already been checked 33 28 TArrayS fCluster; // Idxs of the pixels in the current cluster 34 29 TArrayS fakeData; //Test purpose … … 39 34 ~MArrivalTime() { } 40 35 36 void Reset(); 37 void InitSize(Int_t i); 41 38 UInt_t GetNumPixels() const { return fData.GetSize(); } 42 39 43 void CleanArray(const MGeomCam &geom); //Sets every arr time to -1 40 void SetTime(Int_t i, Float_t time); 41 const TArrayF &GetData() const { return fData; } 42 Double_t operator[](int i) { return fData[i]; } 44 43 45 void Calc(const Byte_t *fadcSamples, const Short_t nSlice, 46 const Short_t idx, const MGeomCam &geom); // Calculates arrival times 47 44 void Calc(const Byte_t *fadcSamples, const Short_t nSlice, const Short_t idx); 48 45 void EvalClusters(const MRawEvtData &evt, const MGeomCam &geom); 49 50 46 void CheckNeighbours(const MRawEvtData &evt, const MGeomCam &geom, 51 Short_t idx, Short_t *dimCluster); 52 53 void SetTime(Int_t i, Float_t time); 54 void InitSize(Int_t i); 55 56 const TArrayF &GetData() const { return fData; } 57 58 Double_t operator[](int i) { return fData[i]; } 47 Short_t idx, Short_t *dimCluster); 59 48 60 49 Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const; -
trunk/MagicSoft/Mars/manalysis/MArrivalTimeCalc.cc
r2785 r2910 18 18 ! Author(s): Sebastian Raducci 12/2003 <mailto:raducci@fisica.uniud.it> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2002-200 320 ! Copyright: MAGIC Software Development, 2002-2004 21 21 ! 22 22 ! … … 37 37 // MArrivalTime 38 38 // MRawEvtData 39 // 39 40 ////////////////////////////////////////////////////////////////////////////// 40 41 #include "MArrivalTime.h"42 41 #include "MArrivalTimeCalc.h" 43 44 #include "MParList.h"45 42 46 43 #include "MLog.h" 47 44 #include "MLogManip.h" 48 45 46 #include "MParList.h" 47 49 48 #include "MGeomCam.h" 50 #include "MMcRunHeader.hxx" 51 52 #include "MRawRunHeader.h" 53 #include "MRawEvtData.h" // MRawEvtData::GetNumPixels 54 #include "MCameraData.h" 49 #include "MArrivalTime.h" 50 #include "MRawEvtData.h" 55 51 #include "MRawEvtPixelIter.h" 56 52 … … 63 59 // Default constructor. 64 60 // 65 66 61 MArrivalTimeCalc::MArrivalTimeCalc(const char *name, const char *title) 67 62 { 68 63 fName = name ? name : "MArrivalTimeCalc"; 69 64 fTitle = title ? title : "Calculate photons arrival time"; 70 71 // AddToBranchList("MRawEvtData.fHiGainPixId");72 // AddToBranchList("MRawEvtData.fLoGainPixId");73 // AddToBranchList("MRawEvtData.fHiGainFadcSamples");74 // AddToBranchList("MRawEvtData.fLoGainFadcSamples");75 65 76 66 } … … 79 69 // 80 70 // The PreProcess searches for the following input containers: 81 // - MRawRunHeader82 71 // - MRawEvtData 83 72 // - MArrivalTime 84 // - MGeomCam85 73 // 86 74 // The following output containers are also searched and created if 87 75 // they were not found: 88 76 // - MArrivalTime 89 // - MRawEvtData90 77 // 91 92 78 Int_t MArrivalTimeCalc::PreProcess(MParList *pList) 93 79 { 94 fRunHeader = (MRawRunHeader*)pList->FindObject("MRawRunHeader");95 if (!fRunHeader)96 {97 *fLog << err << "MRawRunHeader not found... aborting." << endl;98 return kFALSE;99 }100 101 80 fRawEvt = (MRawEvtData*)pList->FindObject(AddSerialNumber("MRawEvtData")); 102 81 if (!fRawEvt) 103 82 { 104 83 *fLog << err << "MRawEvtData not found... aborting." << endl; 105 return kFALSE;106 }107 108 fGeom = (MGeomCam*)pList->FindObject("MGeomCam");109 if (!fGeom)110 {111 *fLog << err << "MGeomCam not found... aborting." << endl;112 84 return kFALSE; 113 85 } … … 120 92 } 121 93 94 // -------------------------------------------------------------------------- 95 // 96 // The ReInit searches for the following input containers: 97 // - MGeomCam 98 // 99 Bool_t MArrivalTimeCalc::ReInit(MParList *pList) 100 { 101 MGeomCam *cam = (MGeomCam*)pList->FindObject(AddSerialNumber("MGeomCam")); 102 if (!cam) 103 { 104 *fLog << err << GetDescriptor() << ": No MGeomCam found... aborting." << endl; 105 return kFALSE; 106 } 107 108 fArrTime->InitSize(cam->GetNumPixels()); 109 110 return kTRUE; 111 } 112 122 113 123 114 // -------------------------------------------------------------------------- 115 // 124 116 // Evaluation of the mean arrival times (spline interpolation) 125 117 // per pixel and store them in the MArrivalTime container. … … 129 121 MRawEvtPixelIter pixel(fRawEvt); 130 122 131 // Every pixel is set to -1132 fArrTime->CleanArray((const MGeomCam&) *fGeom);133 134 123 while (pixel.Next()) 135 124 { 136 125 const UInt_t idx = pixel.GetPixelId(); 137 // If pixel is saturated we use LoGains 126 127 // If pixel is saturated we use LoGains 138 128 if (pixel.GetMaxHiGainSample() == 0xff && pixel.HasLoGain()) 139 129 { 140 130 const Byte_t *ptr = pixel.GetLoGainSamples(); 141 131 const Short_t nSlice = fRawEvt->GetNumLoGainSamples(); 142 fArrTime->Calc(ptr, nSlice, idx , (const MGeomCam&) *fGeom);132 fArrTime->Calc(ptr, nSlice, idx); 143 133 } 144 // Use HiGains134 // Use HiGains 145 135 else 146 136 { 147 137 const Byte_t *ptr = pixel.GetHiGainSamples(); 148 138 const Short_t nSlice = fRawEvt->GetNumHiGainSamples(); 149 fArrTime->Calc(ptr, nSlice, idx , (const MGeomCam&) *fGeom);139 fArrTime->Calc(ptr, nSlice, idx); 150 140 } 151 // If pixel is saturated and hasn't lo gains we do nothing, it's value remains -1141 // If pixel is saturated and hasn't lo gains we do nothing, it's value remains -1 152 142 } 153 143 -
trunk/MagicSoft/Mars/manalysis/MArrivalTimeCalc.h
r2752 r2910 1 1 #ifndef MARS_MArrivalTimeCalc 2 2 #define MARS_MArrivalTimeCalc 3 4 /////////////////////////////////////////////////////////////////////////////5 // //6 // MArrivalTimeCalc //7 // //8 // Evaluates the Arrival Times //9 // //10 // //11 /////////////////////////////////////////////////////////////////////////////12 3 13 4 #ifndef MARS_MTask … … 16 7 17 8 class MRawEvtData; 18 class MCameraData;19 class MRawRunHeader;20 class MGeomCam;21 9 class MArrivalTime; 22 10 23 11 class MArrivalTimeCalc : public MTask 24 12 { 25 MRawEvtData *fRawEvt; // raw event data (time slices) 26 MCameraData *fCamData; // Cerenkov Photon Event used for calculation 27 MRawRunHeader *fRunHeader; // RunHeader information 28 MGeomCam *fGeom; // Geometry information 29 MArrivalTime *fArrTime; // Container with the photons arrival times 13 private: 14 MRawEvtData *fRawEvt; // raw event data (time slices) 15 MArrivalTime *fArrTime; // Container with the photons arrival times 30 16 31 Bool_t fEnableFix; // fix for a bug in files from older camera versions (<=40) 32 Bool_t fIsMcFile; 33 34 Int_t PreProcess(MParList *pList); 35 Int_t Process(); 36 Int_t PostProcess() {return kTRUE;} 37 Bool_t ReInit(MParList *pList) { 38 return kTRUE; 39 } 17 Bool_t ReInit(MParList *pList); 18 Int_t PreProcess(MParList *pList); 19 Int_t Process(); 20 Int_t PostProcess() {return kTRUE;} 40 21 41 22 public: 42 23 MArrivalTimeCalc(const char *name=NULL, const char *title=NULL); 43 44 24 ~MArrivalTimeCalc(){} 45 25 … … 47 27 }; 48 28 49 50 29 #endif
Note:
See TracChangeset
for help on using the changeset viewer.