Changeset 1283 for trunk/MagicSoft/Mars
- Timestamp:
- 04/22/02 11:28:38 (23 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 8 added
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r1282 r1283 1 1 -*-*- END -*-*- 2 2002/04/22: Thomas Bretz 3 4 * Makefile: 5 - added a chapter how to compile mars using shared libraries 6 7 * NEWS: 8 - updated 9 10 * mfilter/MF.[h,cc]: 11 - added 12 13 * mfilter/MFDataMember.[h,cc]: 14 - added 15 16 * mhist/MH3.[h,cc]: 17 - added 18 19 * mhist/MHHillasExt.[h,cc]: 20 - added 21 22 * macros/rootlogon.C: 23 - added make() function 24 - splitted rootlogon() 25 26 * mbase/MFilterList.cc: 27 - fixed a bug in the constructor 28 - small changes to the print function 29 30 * mbase/MParContainer.[h,cc]: 31 - Added GetterMethod-Function 32 33 * mbase/MParList.cc: 34 - Added a security check in case no def. constructor of the new class 35 is available 36 - changed print function 37 38 * mbase/MReadTree.cc: 39 - changed so that the class type of the branch is used for creation of 40 a new object instead of its name 41 42 * mbase/MTaskList.[h,cc]: 43 - fixed the check for the Process function. Only base classes 44 of first order have been checked 45 46 * mfilter/FilterLinkDef.h, mfilter/Makefile: 47 - added MF, MFDataMember 48 49 * mhist/HistLinkDef.h, mhist/MFillH.cc: 50 - added MH3, MHHillasExt 51 52 * mhist/MFillH.cc: 53 - small changes 54 55 * mhist/MH.[h,cc]: 56 - changed name handling in MakeDefCanvas to TString 57 58 * mhist/MHHillas.cc: 59 - exchanged Get*axis()->SetTitle with Set*Title() 60 61 * mhist/MHHillas.h: 62 - made SetMm2Deg virtual (for MHHillasExt) 63 64 * mhist/MHStarMap.[h,cc]: 65 - changed layout from mm to deg 66 67 2 68 3 69 2002/04/19: Thomas Bretz … … 52 118 * mmain/MDataCheck.cc: 53 119 - exchanged order in call to MFillH constructor 54 - made eventloop infinit y(only 300 events have been processed)120 - made eventloop infinite (only 300 events have been processed) 55 121 56 122 * mbase/MEvtLoop.h: … … 117 183 of the pixel is saved for all Camera pixels. 118 184 - Old files can still be read but becareful when one looks at the 119 data member fPixelsFirst which is an array of dif erent size for185 data member fPixelsFirst which is an array of different size for 120 186 the new and old files. 121 187 - ClassDef version upgraded to 2. … … 179 245 mhist/MHMcDifRate.[h,cc], mhist/MHMcIntRate.[h,cc]: 180 246 - added 181 247 182 248 * mhist/Makefile, mhist/HistLinkDef.h: 183 249 - added MHMcEfficiencyEnergy and MHMcEfficiencyImpact -
trunk/MagicSoft/Mars/Makefile
r1217 r1283 69 69 # Use $(CXX) -v ... for a more verbose output 70 70 # 71 # 72 #$(MARS_LIB) 73 $(SOLIB): $(LIBRARIES) $(OBJS) $(HEADERS) MCint.o 74 @echo " Linking $(SOLIB) ..." 75 $(CXX) -shared $(CXXFLAGS) $(SUBDIRS:=/*.o) $(ROOTGLIBS) -o $@ 76 mv mars.so lib 77 78 $(PROGRAMS): $(LIBRARIES) $(OBJS) $(HEADERS) MCint.o $(PROGRAMS:=.o) 79 @echo " Linking $@ ..." 80 $(CXX) $(CXXFLAGS) $@.o $(OBJS) $(MARS_LIB) MCint.o $(ROOTGLIBS) -o $@ 81 82 # 71 83 # We could link mars.so instead of all libraries. This would need 72 84 # some MBs less space on the HD. But this means, that the Shared … … 74 86 # 'mars' 75 87 # 76 $(PROGRAMS): $(LIBRARIES) $(OBJS) $(HEADERS) MCint.o $(PROGRAMS:=.o) 77 @echo " Linking $@ ..." 78 $(CXX) $(CXXFLAGS) $@.o $(OBJS) $(MARS_LIB) MCint.o $(ROOTGLIBS) -o $@ 79 80 $(SOLIB): $(LIBRARIES) $(OBJS) $(HEADERS) MCint.o 81 @echo " Linking $(SOLIB) ..." 82 $(CXX) -shared $(CXXFLAGS) $(SUBDIRS:=/*.o) $(ROOTGLIBS) -o $@ 83 mv mars.so lib 88 #$(PROGRAMS): $(LIBRARIES) $(OBJS) $(HEADERS) $(SOLIB) MCint.o $(PROGRAMS:=.o) 89 # @echo " Linking $@ ..." 90 # $(CXX) $(CXXFLAGS) $@.o $(OBJS) lib/$(SOLIB) MCint.o $(ROOTGLIBS) -o $@ 84 91 85 92 $(LIBRARIES): -
trunk/MagicSoft/Mars/NEWS
r1235 r1283 17 17 hillas parameters) 18 18 19 - replaced old MHillas by a new structure which allows you to extend 20 the parameters stored in MHillas very easily. 19 - Replaced old MHillas by a new structure which allows you to extend 20 the parameters stored in MHillas very easily: 21 see MHillas and MHillasExt 21 22 22 - Added classes to handle source dependancy of image parameters. 23 - Added classes to handle source dependancy of image parameters: 24 see MHillasSrc 23 25 24 26 - Added container (MBinning) to have a standard input for the binning … … 30 32 - Added the flexible binning to the hillas histograms 31 33 32 - Added a filter for the alpha parameter (MF ilter)34 - Added a filter for the alpha parameter (MFAlpha) 33 35 34 - it is now possible to write single data members of a class object to36 - It is now possible to write single data members of a class object to 35 37 an output stream instead of the whole container only 38 39 - Added a generalized filter for a data member: 40 MFDataMember filter("MHillas.fWidth", '<', 0.5); 41 42 - Added a generalized Filter parser for more difficult filter rules 43 MF filter("MHillas.fWidth<0.5 && MHillas.fLength>0.5"); 44 45 - Added new Monte Carlo histograms: 46 MHMcEnergyImpact and MHMcEfficiency 47 48 - Added many new histograms needed for the flux calculation. 49 50 - Added a generalized histograms which can fill and show up to three 51 data members in either a one-, two- or three-dimensional histogram, eg: 52 MH3 mh3("MHillas.fWidth", "MHillas.fLength"); 36 53 37 54 -
trunk/MagicSoft/Mars/macros/rootlogon.C
r1058 r1283 23 23 \* ======================================================================== */ 24 24 25 Bool_t isloaded() 26 { 27 TString str = gSystem->GetLibraries("*/mars.so"); 25 28 26 void rootlogon() 29 return !str.IsNull(); 30 } 31 32 void unload() 27 33 { 28 cout << endl; 34 if (!isloaded()) 35 return; 36 37 cout << "Unloading 'mars.so'... " << flush; 38 if (gSystem->Unload("mars.so")) 39 cout << "error." << endl; 40 else 41 cout << "done." << endl << endl; 42 } 43 44 void load() 45 { 46 if (isloaded()) 47 return; 29 48 30 49 cout << "Loading 'mars.so'... " << flush; … … 40 59 41 60 cout << endl; 61 } 62 63 void make() 64 { 65 unload(); 66 67 if (gSystem->Exec("make")) 68 { 69 cout << "Error calling make..." << endl; 70 return; 71 } 72 73 load(); 74 } 75 76 void rootlogon() 77 { 78 cout << endl; 79 80 load(); 42 81 43 82 cout << "Welcome to the Mars Root environment." << endl; … … 45 84 cout << endl; 46 85 } 47 -
trunk/MagicSoft/Mars/mbase/MFilterList.cc
r1218 r1283 59 59 TString str(type); 60 60 61 if ( str.CompareTo("OR", TString::kIgnoreCase) ||str.CompareTo("|"))61 if (!str.CompareTo("OR", TString::kIgnoreCase) || !str.CompareTo("|")) 62 62 fFilterType = kEOr; 63 if ( str.CompareTo("XOR", TString::kIgnoreCase) ||str.CompareTo("^"))63 if (!str.CompareTo("XOR", TString::kIgnoreCase) || !str.CompareTo("^")) 64 64 fFilterType = kEXor; 65 if ( str.CompareTo("LAND", TString::kIgnoreCase) ||str.CompareTo("&&"))65 if (!str.CompareTo("LAND", TString::kIgnoreCase) || !str.CompareTo("&&")) 66 66 fFilterType = kELAnd; 67 if ( str.CompareTo("LOR", TString::kIgnoreCase) ||str.CompareTo("||"))67 if (!str.CompareTo("LOR", TString::kIgnoreCase) || !str.CompareTo("||")) 68 68 fFilterType = kELOr; 69 69 } … … 180 180 while ((filter=(MFilter*)Next())) 181 181 if (!filter->PreProcess(pList)) 182 { 183 *fLog << err << "Error - Preprocessing Filter "; 184 *fLog << filter->GetName() << " in " << fName << endl; 182 185 return kFALSE; 186 } 183 187 184 188 return kTRUE; … … 235 239 const Bool_t verbose = str.Contains("V", TString::kIgnoreCase); 236 240 241 //*fLog << all << "(" << GetName() << "=" << (int)fFilterType << ")"; 242 237 243 *fLog << all << "("; 238 244 … … 250 256 } 251 257 252 do 258 filter->Print(); 259 260 while ((filter=(MFilter*)Next())) 253 261 { 254 262 switch (fFilterType) 255 263 { 256 264 case kEAnd: 257 *fLog << (verbose?" and ":" &");265 *fLog << (verbose?" and ":" & "); 258 266 break; 259 267 260 268 case kEOr: 261 *fLog << (verbose?" or ":" |");269 *fLog << (verbose?" or ":" | "); 262 270 break; 263 271 264 272 case kEXor: 265 *fLog << (verbose?" xor ":" ^");273 *fLog << (verbose?" xor ":" ^ "); 266 274 break; 267 275 268 276 case kELAnd: 269 *fLog << (verbose?" land ":" &&");277 *fLog << (verbose?" land ":" && "); 270 278 break; 271 279 272 280 case kELOr: 273 *fLog << (verbose?" lor ":" ||");281 *fLog << (verbose?" lor ":" || "); 274 282 break; 275 283 } 276 284 277 285 filter->Print(); 278 } while ((filter=(MFilter*)Next()));286 } 279 287 280 288 *fLog << ")" << flush; 281 289 } 290 -
trunk/MagicSoft/Mars/mbase/MParContainer.cc
r1279 r1283 319 319 return rc; 320 320 } 321 322 TMethodCall *MParContainer::GetterMethod(const char *name) const 323 { 324 TClass *cls = IsA()->GetBaseDataMember(name); 325 if (!cls) 326 { 327 *fLog << err << "No (base) class containing '" << name << "'." << endl; 328 return NULL; 329 } 330 331 TDataMember *member = cls->GetDataMember(name); 332 if (!member) 333 { 334 *fLog << err << "Datamember '" << name << "' not in " << GetDescriptor() << endl; 335 return NULL; 336 } 337 338 TMethodCall *call = member->GetterMethod(); 339 if (!call) 340 { 341 *fLog << err << "Sorry, no getter method found for " << name << endl; 342 return NULL; 343 } 344 345 return call; 346 } -
trunk/MagicSoft/Mars/mbase/MParContainer.h
r1235 r1283 24 24 25 25 class TDataMember; 26 class TMethodCall; 26 27 27 28 class MParContainer : public TObject … … 66 67 virtual void SetReadyToSave(Bool_t flag=kTRUE) { fReadyToSave=flag; } 67 68 69 TMethodCall *GetterMethod(const char *name) const; 70 68 71 Bool_t WriteDataMember(ostream &out, const char *member, Double_t scale=1) const; 69 72 Bool_t WriteDataMember(ostream &out, const TDataMember *member, Double_t scale=1) const; -
trunk/MagicSoft/Mars/mbase/MParList.cc
r1211 r1283 380 380 // 381 381 TClass *cls = gROOT->GetClass(cname); 382 383 382 if (!cls) 384 383 { … … 394 393 // 395 394 pcont = (MParContainer*)cls->New(); 395 if (!pcont) 396 { 397 *fLog << err << dbginf << "Cannot create new instance of class '" << cname << "' (Maybe no def. constructor)" << endl; 398 return NULL; 399 } 396 400 397 401 // … … 424 428 void MParList::Print(Option_t *t) const 425 429 { 426 *fLog << all << GetDescriptor() << endl;430 *fLog << all << " " << GetDescriptor() << endl; 427 431 *fLog << setfill('-') << setw(strlen(GetDescriptor())+2) << "" << endl; 428 432 MParContainer *obj = NULL; … … 572 576 // 573 577 TClass *cls = gROOT->GetClass(cname); 574 575 578 if (!cls) 576 579 { … … 602 605 // 603 606 MParContainer *pcont = (MParContainer*)cls->New(); 607 if (pcont) 608 { 609 gLog << err << dbginf << "Cannot create new instance of class '" << cname << "' (Maybe no def. constructor)" << endl; 610 return list; 611 } 604 612 605 613 // -
trunk/MagicSoft/Mars/mbase/MReadTree.cc
r1211 r1283 458 458 // check if object is existing in the list 459 459 // 460 *pcont=pList->FindCreateObj( oname);460 *pcont=pList->FindCreateObj(branch->GetClassName(), oname); 461 461 462 462 if (!*pcont) … … 466 466 // we cannot proceed reading this branch 467 467 // 468 *fLog << warn << dbginf << "Warning: Class '" << oname << "' not existing in dictionary. Branch skipped." << endl; 468 *fLog << warn << dbginf << "Warning: Class '" << branch->GetClassName(); 469 *fLog << "' for " << oname << " not existing in dictionary. Branch skipped." << endl; 469 470 DisableSubBranches(branch); 470 471 continue; … … 484 485 // 485 486 fChain->SetBranchAddress(bname, pcont); 486 *fLog << inf << "Master branch address " << bname << " setup for reading." << endl; 487 488 *fLog << inf << "Master branch address " << bname << " ["; 489 *fLog << branch->GetClassName() << "] setup for reading." << endl; 487 490 488 491 //*fLog << "Branch " << bname << " autodel: " << (int)branch->IsAutoDelete() << endl; … … 568 571 // 569 572 #if ROOT_VERSION_CODE < ROOT_VERSION(3,02,06) 570 //#include "../mraw/MRawEvtData.h"571 573 #include "MRawEvtData.h" 572 574 #endif -
trunk/MagicSoft/Mars/mbase/MTaskList.cc
r1280 r1283 58 58 59 59 #include <TClass.h> 60 #include <TBaseClass.h> 60 61 #include <TOrdCollection.h> 61 62 … … 259 260 // -------------------------------------------------------------------------- 260 261 // 262 // Check whether this task (or one of it's base classes) overloads 263 // MTask::Process. Only if this function is overloaded this task is 264 // added to the fTaskProcess-List. This makes the execution of the 265 // tasklist a little bit (only a little bit) faster, bacause tasks 266 // doing no Processing are not Processed. 267 // 268 Bool_t MTaskList::CheckClassForProcess(TClass *cls) 269 { 270 // 271 // Check whether the class itself overloads the Process function 272 // 273 if (cls->GetName()=="MTask") 274 return kFALSE; 275 276 if (cls->GetMethodAny("Process")) 277 return kTRUE; 278 279 // 280 // If the class itself doesn't overload it check all it's base classes 281 // 282 TBaseClass *base=NULL; 283 TIter NextBase(cls->GetListOfBases()); 284 while ((base=(TBaseClass*)NextBase())) 285 { 286 if (CheckClassForProcess(base->GetClassPointer())) 287 return kTRUE; 288 } 289 290 return kFALSE; 291 } 292 293 // -------------------------------------------------------------------------- 294 // 261 295 // do pre processing (before eventloop) of all tasks in the task-list 262 296 // 263 #include <TMethod.h>264 #include <TBaseClass.h>265 297 Bool_t MTaskList::PreProcess(MParList *pList) 266 298 { … … 283 315 while ((task=(MTask*)Next())) 284 316 { 285 *fLog << all << task->GetName() << "... " << flush; 286 287 // 288 // Check whether this task (or one of it's base classes) overloads 289 // MTask::Process. Only if this function is overloaded this task is 290 // added to the fTaskProcess-List. This makes the execution of the 291 // tasklist a little bit (only a little bit) faster, bacause tasks 292 // doing no Processing are not Processed. 293 // 294 TBaseClass *cls=NULL; 295 TIter NextBase(task->IsA()->GetListOfBases()); 296 while ((cls=(TBaseClass*)NextBase())) 297 { 298 if (cls->GetName()=="MTask") 299 break; 300 301 if (!cls->GetClassPointer()->GetMethodAny("Process")) 302 continue; 303 317 if (CheckClassForProcess(task->IsA())) 304 318 fTasksProcess.Add(task); 305 break;306 }307 319 308 320 // -
trunk/MagicSoft/Mars/mbase/MTaskList.h
r1269 r1283 30 30 enum { kIsOwner = BIT(14) }; 31 31 32 void Remove(MTask *task); 32 void Remove(MTask *task); 33 Bool_t CheckClassForProcess(TClass *cls); 33 34 34 35 public: -
trunk/MagicSoft/Mars/mfilter/FilterLinkDef.h
r1210 r1283 5 5 #pragma link off all functions; 6 6 7 #pragma link C++ class MF+; 7 8 #pragma link C++ class MFAlpha+; 8 9 #pragma link C++ class MFTriggerLvl1+; 10 #pragma link C++ class MFDataMember+; 9 11 10 12 #endif -
trunk/MagicSoft/Mars/mfilter/Makefile
r1210 r1283 32 32 33 33 SRCFILES = MFTriggerLvl1.cc \ 34 MF.cc \ 35 MFDataMember.cc \ 34 36 MFAlpha.cc 35 37 -
trunk/MagicSoft/Mars/mhist/HistLinkDef.h
r1228 r1283 8 8 9 9 #pragma link C++ class MH+; 10 #pragma link C++ class MH3+; 10 11 #pragma link C++ class MHFadcCam+; 11 12 #pragma link C++ class MHFadcPix+; 12 13 #pragma link C++ class MHHillas+; 13 14 #pragma link C++ class MHHillasSrc+; 15 #pragma link C++ class MHHillasExt+; 14 16 #pragma link C++ class MHStarMap+; 15 17 #pragma link C++ class MHEnergyTime+; -
trunk/MagicSoft/Mars/mhist/MFillH.cc
r1211 r1283 238 238 const TString name = ExtractName(fHName); 239 239 240 TObject *obj = pList->FindCreateObj(cls, name); 240 TObject *obj=NULL; 241 if (cls==name) 242 obj = pList->FindObject(fHName); 243 244 if (!obj) 245 obj = pList->FindCreateObj(cls, name); 246 241 247 if (!obj) 242 248 return kFALSE; … … 277 283 // list. If it could not be found we cannot proceed. 278 284 // 285 if (fParContainerName.IsNull()) 286 { 287 fParContainer = pList; 288 return kTRUE; 289 } 290 279 291 fParContainer = (MParContainer*)pList->FindObject(fParContainerName); 280 292 if (fParContainer) 281 293 return kTRUE; 282 294 283 *fLog << err << dbginf << fParContainerName << "[MParContainer] not found... aborting." << endl;295 *fLog << err << dbginf << "'" << fParContainerName << "' [MParContainer] not found... aborting." << endl; 284 296 return kFALSE; 285 297 } -
trunk/MagicSoft/Mars/mhist/MH.cc
r1276 r1283 66 66 // set the name and title of this object 67 67 // 68 fName = name ? name : "MH" 69 fTitle = title ? title : "Base class for Mars histograms" 68 fName = name ? name : "MH"; 69 fTitle = title ? title : "Base class for Mars histograms"; 70 70 } 71 71 … … 83 83 // number of all existing canvases plus one) 84 84 // 85 TCanvas *MH::MakeDefCanvas( const char *name, const char *title,85 TCanvas *MH::MakeDefCanvas(TString name, const char *title, 86 86 const UInt_t w, const UInt_t h) 87 87 { 88 88 const TList *list = (TList*)gROOT->GetListOfCanvases(); 89 89 90 const char *def = name ? name : gROOT->GetDefCanvasName(); 91 92 TCanvas *c; 93 if (list->FindObject(def)) 94 { 95 const char *n = StrDup(Form("%s <%d>", def, list->GetSize()+1)); 96 c = new TCanvas(n, title, w, h); 97 delete [] n; 98 } 99 else 100 c = new TCanvas(def, title, w, h); 101 102 return c; 90 if (name.IsNull()) 91 name = gROOT->GetDefCanvasName(); 92 93 if (list->FindObject(name)) 94 name += Form(" <%d>", list->GetSize()+1); 95 96 return new TCanvas(name, title, w, h); 103 97 } 104 98 -
trunk/MagicSoft/Mars/mhist/MH.h
r1207 r1283 22 22 virtual Bool_t Fill(const MParContainer *par) = 0; 23 23 24 static TCanvas *MakeDefCanvas( const char *name=NULL, const char *title="",24 static TCanvas *MakeDefCanvas(TString name="", const char *title="", 25 25 const UInt_t w=700, const UInt_t h=500); 26 26 static TCanvas *MakeDefCanvas(const TObject *obj, -
trunk/MagicSoft/Mars/mhist/MHHillas.cc
r1277 r1283 53 53 // 54 54 MHHillas::MHHillas(const char *name, const char *title) 55 : fMm2Deg(-1), fUseMmScale(k FALSE)55 : fMm2Deg(-1), fUseMmScale(kTRUE) 56 56 { 57 57 // … … 72 72 fWidth->SetDirectory(NULL); 73 73 74 fLength-> GetXaxis()->SetTitle("Length [mm]");75 fWidth-> GetXaxis()->SetTitle("Width [mm]");76 77 fLength-> GetYaxis()->SetTitle("Counts");78 fWidth-> GetYaxis()->SetTitle("Counts");74 fLength->SetXTitle("Length [mm]"); 75 fWidth->SetXTitle("Width [mm]"); 76 77 fLength->SetYTitle("Counts"); 78 fWidth->SetYTitle("Counts"); 79 79 } 80 80 … … 119 119 } 120 120 121 fLength->GetXaxis()->SetTitle("Length [\\circ]"); 122 fWidth->GetXaxis()->SetTitle("Width [\\circ]"); 123 124 fMm2Deg = geom->GetConvMm2Deg(); 121 fLength->SetXTitle("Length [\\circ]"); 122 fWidth->SetXTitle("Width [\\circ]"); 123 124 fMm2Deg = geom->GetConvMm2Deg(); 125 fUseMmScale = kFALSE; 125 126 126 127 return kTRUE; … … 189 190 if (fUseMmScale) 190 191 { 191 fLength-> GetXaxis()->SetTitle("Length [mm]");192 fWidth-> GetXaxis()->SetTitle("Width [mm]");192 fLength->SetXTitle("Length [mm]"); 193 fWidth->SetXTitle("Width [mm]"); 193 194 194 195 fLength->Scale(1./fMm2Deg); … … 197 198 else 198 199 { 199 fLength-> GetXaxis()->SetTitle("Length [\\circ]");200 fWidth-> GetXaxis()->SetTitle("Width [\\circ]");200 fLength->SetXTitle("Length [\\circ]"); 201 fWidth->SetXTitle("Width [\\circ]"); 201 202 202 203 fLength->Scale(fMm2Deg); -
trunk/MagicSoft/Mars/mhist/MHHillas.h
r1263 r1283 7 7 8 8 class TH1F; 9 class MHillas;10 9 11 10 class MHHillas : public MH … … 15 14 TH1F *fLength; 16 15 16 protected: 17 17 Float_t fMm2Deg; 18 18 … … 24 24 25 25 void SetMmScale(Bool_t mmscale=kTRUE); 26 v oid SetMm2Deg(Float_t mmdeg);26 virtual void SetMm2Deg(Float_t mmdeg); 27 27 28 28 Bool_t SetupFill(const MParList *pList); -
trunk/MagicSoft/Mars/mhist/MHStarMap.cc
r1263 r1283 39 39 #include <TCanvas.h> // TCanvas 40 40 41 #include "MLog.h" 42 #include "MLogManip.h" 43 44 #include "MParList.h" 45 46 #include "MGeomCam.h" 41 47 #include "MHillas.h" 48 #include "MBinning.h" 42 49 43 50 ClassImp(MHStarMap); … … 48 55 // 49 56 MHStarMap::MHStarMap(const char *name, const char *title) 57 : fMm2Deg(-1), fUseMmScale(kTRUE) 50 58 { 51 59 // … … 57 65 // set the name and title of this object 58 66 // 59 60 67 fName = name ? name : "MHStarMap" ; 61 68 fTitle = title ? title : "Container for a Star Map" ; … … 88 95 // -------------------------------------------------------------------------- 89 96 // 97 // Setup the Binning for the histograms automatically if the correct 98 // instances of MBinning (with the names 'BinningWidth' and 'BinningLength') 99 // are found in the parameter list 100 // Use this function if you want to set the conversion factor which 101 // is used to convert the mm-scale in the camera plain into the deg-scale 102 // used for histogram presentations. The conversion factor is part of 103 // the camera geometry. Please create a corresponding MGeomCam container. 104 // 105 Bool_t MHStarMap::SetupFill(const MParList *plist) 106 { 107 const MGeomCam *geom = (MGeomCam*)plist->FindObject("MGeomCam"); 108 if (geom) 109 { 110 fMm2Deg = geom->GetConvMm2Deg(); 111 fUseMmScale = kFALSE; 112 113 fStarMap->SetXTitle("x [\\circ]"); 114 fStarMap->SetYTitle("y [\\circ]"); 115 } 116 117 const MBinning *bins = (MBinning*)plist->FindObject("BinningStarMap"); 118 if (!bins) 119 { 120 float r = geom ? geom->GetMaxRadius() : 600; 121 r *= 2./3; 122 if (!fUseMmScale) 123 r *= fMm2Deg; 124 125 MBinning b; 126 b.SetEdges(100, -r, r); 127 SetBinning(fStarMap, &b, &b); 128 } 129 else 130 SetBinning(fStarMap, bins, bins); 131 132 if (!geom) 133 { 134 *fLog << warn << dbginf << "No Camera Geometry available. Using mm-scale for histograms." << endl; 135 return kTRUE; 136 } 137 138 return kTRUE; 139 } 140 141 // -------------------------------------------------------------------------- 142 // 90 143 // Fill the four histograms with data from a MHillas-Container. 91 144 // Be careful: Only call this with an object of type MHillas … … 98 151 99 152 const float m = tan(delta); 100 const float t = h.GetMeanY() - m*h.GetMeanX(); 153 154 float t = h.GetMeanY() - m*h.GetMeanX(); 155 156 if (!fUseMmScale) 157 t *= fMm2Deg; 101 158 102 159 if (m>-1 && m<1) 103 for (int x=-298; x<298; x+=4) 160 { 161 TAxis &axe = *fStarMap->GetXaxis(); 162 163 const int N = axe.GetXbins()->GetSize(); 164 for (int i=0; i<N; i++) 104 165 { 166 const float x = axe.GetBinCenter(i); 105 167 const float y = m*x+t; 106 168 107 169 fStarMap->Fill(x, y); 108 170 } 171 } 109 172 else 110 for (int y=-298; y<298; y+=4) 173 { 174 TAxis &axe = *fStarMap->GetYaxis(); 175 176 const int N = axe.GetXbins()->GetSize(); 177 for (int i=0; i<N; i++) 111 178 { 179 const float y = axe.GetBinCenter(i); 112 180 const float x = (y-t)/m; 113 181 114 182 fStarMap->Fill(x, y); 115 183 } 184 } 116 185 117 186 return kTRUE; 187 } 188 189 // -------------------------------------------------------------------------- 190 // 191 // Use this function to setup your own conversion factor between degrees 192 // and millimeters. The conversion factor should be the one calculated in 193 // MGeomCam. Use this function with Caution: You could create wrong values 194 // by setting up your own scale factor. 195 // 196 void MHStarMap::SetMm2Deg(Float_t mmdeg) 197 { 198 if (mmdeg<0) 199 { 200 *fLog << warn << dbginf << "Warning - Conversion factor < 0 - nonsense. Ignored." << endl; 201 return; 202 } 203 204 if (fMm2Deg>=0) 205 *fLog << warn << dbginf << "Warning - Conversion factor already set. Overwriting" << endl; 206 207 fMm2Deg = mmdeg; 208 } 209 210 // -------------------------------------------------------------------------- 211 // 212 // With this function you can convert the histogram ('on the fly') between 213 // degrees and millimeters. 214 // 215 void MHStarMap::SetMmScale(Bool_t mmscale) 216 { 217 if (fUseMmScale == mmscale) 218 return; 219 220 if (fMm2Deg<0) 221 { 222 *fLog << warn << dbginf << "Warning - Sorry, no conversion factor for conversion available." << endl; 223 return; 224 } 225 226 if (fUseMmScale) 227 { 228 fStarMap->SetXTitle("x [mm]"); 229 fStarMap->SetYTitle("y [mm]"); 230 231 fStarMap->Scale(1./fMm2Deg); 232 } 233 else 234 { 235 fStarMap->SetXTitle("x [\\circ]"); 236 fStarMap->SetYTitle("y [\\circ]"); 237 238 fStarMap->Scale(1./fMm2Deg); 239 } 240 241 fUseMmScale = mmscale; 118 242 } 119 243 -
trunk/MagicSoft/Mars/mhist/MHStarMap.h
r1207 r1283 17 17 TH2F *fStarMap; 18 18 19 Float_t fMm2Deg; 20 21 Bool_t fUseMmScale; 22 19 23 void PrepareDrawing() const; 20 24 … … 23 27 ~MHStarMap(); 24 28 29 void SetMmScale(Bool_t mmscale=kTRUE); 30 void SetMm2Deg(Float_t mmdeg); 31 32 Bool_t SetupFill(const MParList *pList); 25 33 Bool_t Fill(const MParContainer *par); 26 34 -
trunk/MagicSoft/Mars/mhist/Makefile
r1228 r1283 31 31 MBinning.cc \ 32 32 MH.cc \ 33 MH3.cc \ 33 34 MHFadcPix.cc \ 34 35 MHFadcCam.cc \ 35 36 MHHillas.cc \ 36 37 MHHillasSrc.cc \ 38 MHHillasExt.cc \ 37 39 MHStarMap.cc \ 38 40 MHEnergyTime.cc \
Note:
See TracChangeset
for help on using the changeset viewer.