Changeset 9219
- Timestamp:
- 01/14/09 12:31:37 (16 years ago)
- Location:
- trunk/MagicSoft
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r9218 r9219 18 18 19 19 -*-*- END OF LINE -*-*- 20 21 2009/01/14 Thomas Bretz 22 23 * readraw.cc: 24 - check first whether the file exist before adding the extension 25 26 * mbase/MMath.[h,cc]: 27 - added function to Re-sort an array 28 29 * mfileio/MReadMarsFile.cc, mfileio/MWriteRootFile.cc: 30 - Improved output 31 32 * mfileio/MWriteRootFile.cc: 33 - fixed a problem which prevented to open more than one /dev/null 34 devices independantly 35 36 * mgeom/MGeomCam.cc: 37 - cosmetics 38 39 * mgeom/MGeomCamDwarf.h: 40 - fixed a typo in an ifdef 41 42 * mgeom/MGeomPix.[h,cc]: 43 - added funtion to return positon as TVector2 44 - slightly improved the algorithm to check IsInside 45 - fixed the conditional signs for the orientation of pixels 46 in GetDirection 47 48 * mmain/MEventDisplay.cc: 49 - Give different names to the MPedestalSubtract tasks 50 - fixed buttons 51 - call AddGeometryTags after ReInit to allow reading new geometries in 52 ReInit 53 54 * mmc/MMcEvtBasic.h: 55 - added a new primary type kNightSky 56 57 * mraw/MRawEvtPixelIter.h: 58 - replaced type of the number of bytes by UInt_t 59 60 * mraw/MRawRunHeader.h: 61 - allow to validate the magic-number from outside (for MCs) 62 63 20 64 21 65 2009/01/12 Daniel Hoehne-Moench -
trunk/MagicSoft/Mars/mbase/MMath.cc
r9195 r9219 1 1 /* ======================================================================== *\ 2 ! $Name: not supported by cvs2svn $:$Id: MMath.cc,v 1.4 2 2008-12-21 18:09:49tbretz Exp $2 ! $Name: not supported by cvs2svn $:$Id: MMath.cc,v 1.43 2009-01-14 12:31:36 tbretz Exp $ 3 3 ! -------------------------------------------------------------------------- 4 4 ! … … 324 324 Double_t MMath::MedianDev(Long64_t n, const Long64_t *a) { Double_t med; return MedianDevImp(n, a, med); } 325 325 326 // ------------------------------------------------------------------------ 327 // 328 // Re-sort an array. Intsead of returning an index (like TMath::Sort) 329 // the array contents are sorted. 330 // 331 template <class Size, class Element> void MMath::ReSortImp(Size n, Element *a, Bool_t down) 332 { 333 Element *cpy = new Element[n]; 334 Int_t *pos = new Int_t[n]; 335 336 memcpy(cpy, a, n*sizeof(Element)); 337 338 TMath::Sort(n, a, pos, down); 339 340 Int_t *idx = pos; 341 342 for (Element *ptr=a; ptr<a+n; ptr++) 343 *ptr = cpy[*idx++]; 344 345 delete cpy; 346 delete pos; 347 } 348 349 void MMath::ReSort(Long64_t n, Short_t *a, Bool_t down) { ReSortImp(n, a, down); } 350 void MMath::ReSort(Long64_t n, Int_t *a, Bool_t down) { ReSortImp(n, a, down); } 351 void MMath::ReSort(Long64_t n, Float_t *a, Bool_t down) { ReSortImp(n, a, down); } 352 void MMath::ReSort(Long64_t n, Double_t *a, Bool_t down) { ReSortImp(n, a, down); } 353 326 354 // -------------------------------------------------------------------------- 327 355 // -
trunk/MagicSoft/Mars/mbase/MMath.h
r8989 r9219 17 17 { 18 18 Double_t GaussProb(Double_t x, Double_t sigma=1, Double_t mean=0); 19 20 template <class Size, class Element> void ReSortImp(Size n, Element *a, Bool_t down=kFALSE); 21 void ReSort(Long64_t n, Short_t *a, Bool_t down=kFALSE); 22 void ReSort(Long64_t n, Int_t *a, Bool_t down=kFALSE); 23 void ReSort(Long64_t n, Float_t *a, Bool_t down=kFALSE); 24 void ReSort(Long64_t n, Double_t *a, Bool_t down=kFALSE); 19 25 20 26 template <class Size, class Element> Double_t MedianDevImp(Size n, const Element *a) { Double_t med; return MedianDevImp(n, a, med); } -
trunk/MagicSoft/Mars/mfileio/MReadMarsFile.cc
r8253 r9219 201 201 if (!rawheader->IsValid()) 202 202 { 203 *fLog << warn << "WARNING - The run header read from the file is invalid." << endl;203 *fLog << warn << "WARNING - The run header (MRawRunHeader) read from the file returns not IsValid()." << endl; 204 204 *fLog << " Please check if the file contents are ok." << endl; 205 205 rawheader->Print("header"); -
trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc
r9186 r9219 122 122 } 123 123 124 if (!file )124 if (!file || TString(name)=="/dev/null") 125 125 { 126 126 file = new TFile(name, option, title, comp); … … 760 760 { 761 761 *fLog << err << "ERROR - MWriteRootFile::ChangeFile... something went terribly wrong!" << endl; 762 *fLog << " fname: " << fname << endl; 762 763 *fLog << " Please start debugging!" << endl; 763 764 return kFALSE; -
trunk/MagicSoft/Mars/mgeom/MGeomCam.cc
r8921 r9219 517 517 // search for the neighbor in the given direction 518 518 // 519 int i; 520 for (i=0; i<pix.GetNumNeighbors(); i++) 519 for (int i=0; i<pix.GetNumNeighbors(); i++) 521 520 if (GetDirection(idx, pix.GetNeighbor(i))==dir) 522 521 return pix.GetNeighbor(i); -
trunk/MagicSoft/Mars/mgeom/MGeomCamDwarf.h
r9148 r9219 1 #ifndef MARS_MGeomCamDw qarf1 #ifndef MARS_MGeomCamDwarf 2 2 #define MARS_MGeomCamDwarf 3 3 -
trunk/MagicSoft/Mars/mgeom/MGeomPix.cc
r8923 r9219 55 55 56 56 #include <TMath.h> 57 #include <TVector2.h> 57 58 58 59 #include "MLog.h" … … 77 78 Set(x, y, r, s, a); 78 79 SetNeighbors(); 80 } 81 82 // -------------------------------------------------------------------------- 83 // 84 // Return position as TVector2(fX, fY) 85 // 86 TVector2 MGeomPix::GetP() const 87 { 88 return TVector2(fX, fY); 79 89 } 80 90 … … 186 196 // more, rotated with respect to that one by +- 60 degrees. 187 197 // 188 if (TMath::Abs(dx) *2>fD)198 if (TMath::Abs(dx)>fD/2) 189 199 return kFALSE; 190 200 … … 194 204 const static Double_t sin60 = TMath::Sin(60/kRad2Deg); 195 205 196 const Double_t dx2 = dx*cos60 + dy*sin60; 197 if (TMath::Abs(dx2)*2>fD) 206 const Double_t dxc = dx*cos60; 207 const Double_t dys = dy*sin60; 208 209 if (TMath::Abs(dxc + dys)>fD/2) 198 210 return kFALSE; 199 211 200 const Double_t dx3 = dx*cos60 - dy*sin60; 201 if (TMath::Abs(dx3)*2>fD) 212 if (TMath::Abs(dxc - dys)>fD/2) 202 213 return kFALSE; 203 214 … … 218 229 const Double_t y2 = pix.GetY(); 219 230 220 if (x1>=x2 && y1>y2) return kRightTop; 221 if (x1>=x2 && y1<y2) return kRightBottom; 222 if (x1<=x2 && y1>y2) return kLeftTop; 223 if (x1<=x2 && y1<y2) return kLeftBottom; 224 if (x1>x2) return kRight; 225 if (x1<x2) return kLeft; 231 if (x1<=x2 && y1<y2) return kRightTop; 232 if (x1<=x2 && y1>y2) return kRightBottom; 233 if (x1>=x2 && y1<y2) return kLeftTop; 234 if (x1>=x2 && y1>y2) return kLeftBottom; 235 if (x1<x2) return kRight; 236 if (x1>x2) return kLeft; 237 238 cout << -1 << endl; 226 239 227 240 return -1; -
trunk/MagicSoft/Mars/mgeom/MGeomPix.h
r8923 r9219 7 7 8 8 class MGeomCam; 9 class TVector2; 9 10 10 11 class MGeomPix : public MParContainer … … 77 78 UInt_t GetSector() const { return fSector; } 78 79 80 TVector2 GetP() const; 81 79 82 Float_t GetDist() const; 80 83 Float_t GetDist(const MGeomPix &pix) const; -
trunk/MagicSoft/Mars/mmain/MEventDisplay.cc
r9017 r9219 1 1 /* ======================================================================== *\ 2 ! $Name: not supported by cvs2svn $:$Id: MEventDisplay.cc,v 1.6 5 2008-07-20 14:21:39tbretz Exp $2 ! $Name: not supported by cvs2svn $:$Id: MEventDisplay.cc,v 1.66 2009-01-14 12:31:36 tbretz Exp $ 3 3 ! -------------------------------------------------------------------------- 4 4 ! … … 334 334 MCalibrationPatternDecode *decode = new MCalibrationPatternDecode; 335 335 336 MPedestalSubtract *pedsub1 = new MPedestalSubtract ;337 MPedestalSubtract *pedsub2 = new MPedestalSubtract ;336 MPedestalSubtract *pedsub1 = new MPedestalSubtract("PedSubstract1"); 337 MPedestalSubtract *pedsub2 = new MPedestalSubtract("PedSubstract2"); 338 338 pedsub2->SetNamePedestalCam(); 339 339 … … 678 678 void MEventDisplay::ShowHide() 679 679 { 680 TGCheckButton *but1 = (TGCheckButton*)fList->FindWidget(kShow Muon);681 TGCheckButton *but2 = (TGCheckButton*)fList->FindWidget(kShow ImgPar);680 TGCheckButton *but1 = (TGCheckButton*)fList->FindWidget(kShowImgPar); 681 TGCheckButton *but2 = (TGCheckButton*)fList->FindWidget(kShowMuon); 682 682 683 683 const Bool_t imgpar = but1 && but1->IsDown(); … … 722 722 for (int j=0;j<n; j++) 723 723 if (obj[j]) 724 { 724 725 if (state[j] && !list->FindObject(obj[j])) 725 726 list->Add(obj[j]); 726 else727 if (!state[j] && list->FindObject(obj[j])) 727 728 list->Remove(obj[j]); 729 } 728 730 729 731 gPad->Modified(kTRUE); … … 744 746 745 747 // 746 // Add Geometry tab 748 // Now read event... 749 // 750 // FIXME: Can we safely replace ReadinEvent() by RedinEvent(1)? 751 ReadinEvent(); 752 753 // 754 // After ReInit (MGeomCam might be read from RunHeaders): Add Geometry tab 747 755 // 748 756 AddGeometryTabs(); 749 750 //751 // Now read event...752 //753 // FIXME: Can we safly replace ReadinEvent() by RedinEvent(1)?754 ReadinEvent();755 756 757 757 758 MReadTree *reader = (MReadTree*)fEvtLoop->FindTask("MRead"); -
trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.h
r8571 r9219 30 30 UShort_t fNumEntry; 31 31 32 Byte_t fNumBytesHiGain; //!33 Byte_t fNumBytesLoGain; //!32 UInt_t fNumBytesHiGain; //! 33 UInt_t fNumBytesLoGain; //! 34 34 35 35 UShort_t fNumBytesPerSample; //! … … 79 79 } 80 80 81 Byte_tGetNumBytes() const { return fNumBytesHiGain+fNumBytesLoGain; }81 UInt_t GetNumBytes() const { return fNumBytesHiGain+fNumBytesLoGain; } 82 82 83 83 Bool_t HasLoGain() const { return fNumBytesLoGain>0; } -
trunk/MagicSoft/Mars/mraw/MRawRunHeader.h
r9212 r9219 107 107 void SetObservation(const char mode[60], const char proj[100]); 108 108 void SetNumEvents(UInt_t num); 109 void SetValidMagicNumber() { fMagicNumber=kMagicNumber; } 109 110 110 111 // This is to get the numbers... -
trunk/MagicSoft/Mars/readraw.cc
r9141 r9219 105 105 106 106 // 107 // Initialize Non-GUI (batch) mode 108 // 109 gROOT->SetBatch(); 110 111 // 107 112 // This is to make argv[i] more readable insidethe code 108 113 // 109 114 TString kNamein = arg.GetArgumentStr(0); 110 115 111 if (!kNamein.EndsWith(".root"))112 kNamein += ".root";113 114 //115 // Initialize Non-GUI (batch) mode116 //117 gROOT->SetBatch();118 119 116 // 120 117 // check whether the given files are OK. … … 122 119 if (gSystem->AccessPathName(kNamein, kFileExists)) 123 120 { 124 gLog << err << "Sorry, the input file '" << kNamein << "' doesn't exist." << endl; 125 return 2; 121 if (!kNamein.EndsWith(".root")) 122 kNamein += ".root"; 123 124 if (gSystem->AccessPathName(kNamein, kFileExists)) 125 { 126 gLog << err << "Sorry, the input file '" << kNamein << "' doesn't exist." << endl; 127 return 2; 128 } 126 129 } 127 130 -
trunk/MagicSoft/include-Classes/MMcFormat/MMcEvtBasic.h
r8765 r9219 12 12 enum ParticleId_t 13 13 { 14 kUNDEFINED = -1, 15 kGAMMA = 1, 16 kPOSITRON = 2, 17 kELECTRON = 3, 18 kANTIMUON = 5, 19 kMUON = 6, 20 kPI0 = 7, 21 kNEUTRON = 13, 22 kPROTON = 14, 23 kHELIUM = 402, 24 kOXYGEN = 1608, 25 kIRON = 5626 14 kUNDEFINED = -1, 15 kGAMMA = 1, 16 kPOSITRON = 2, 17 kELECTRON = 3, 18 kANTIMUON = 5, 19 kMUON = 6, 20 kPI0 = 7, 21 kNEUTRON = 13, 22 kPROTON = 14, 23 kHELIUM = 402, 24 kOXYGEN = 1608, 25 kIRON = 5626, 26 kNightSky = 9999 26 27 }; 27 28 … … 65 66 case kOXYGEN: return "Oxygen"; 66 67 case kIRON: return "Iron"; 68 case kNightSky: return "NSB"; 67 69 } 68 70 … … 86 88 case kOXYGEN: return "O"; 87 89 case kIRON: return "Fe"; 90 case kNightSky: return "\\gamma_{NSB}"; 88 91 } 89 92
Note:
See TracChangeset
for help on using the changeset viewer.