Changeset 4991 for trunk/MagicSoft
- Timestamp:
- 09/14/04 12:13:07 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 2 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r4990 r4991 19 19 20 20 -*-*- END OF LINE -*-*- 21 21 2004/09/14: Thomas Bretz 22 23 * mbase/MFilter.[h,cc]: 24 - added PrintSkipped 25 26 * mbase/MTask.[h,cc]: 27 - added PrintSkipped 28 29 * mfilter/FilterLinkDef.h, mfilter/Makefile: 30 - added MFDeltaT 31 32 * mhbase/MFillH.[h,cc]: 33 - added forwarding of number of executions 34 - removed obsolete ->cd() around filling 35 36 * mhbase/MH.[h,cc]: 37 - simplified the new Projecttion functions 38 - added PrintSkipped 39 - increased ClassDef version number to 2 40 41 * mhcalib/HCalibLinkDef.h: 42 - removed second + from MHGausEvents 43 44 * mjobs/MJCalibration.cc: 45 - fixed a comment 46 47 * mjobs/MJStar.cc: 48 - added MFDeltaT 49 50 * mpedestal/MPedCalcFromLoGain.cc: 51 - fixed a typo in a comment 52 53 54 22 55 2004/09/13: Antonio Stamerra 23 56 … … 76 109 * mhcalib/MHCalibrationChargeCam.[h,cc] 77 110 - wrote a ReadEnv function 111 112 * mbase/MFilter.[h,cc]: 113 - added PrintSkipped 114 115 * mbase/MTask.[h,cc]: 116 - added PrintSkipped 117 118 * mfilter/FilterLinkDef.h, mfilter/Makefile: 119 - added MFDeltaT 120 121 * mhbase/MFillH.[h,cc]: 122 - added forwarding of number of executions 123 124 * mhbase/MH.[h,cc]: 125 - simplified the new Projecttion functions 126 - added PrintSkipped 127 - increased ClassDef version number to 2 128 129 * mhcalib/HCalibLinkDef.h: 130 - removed second + from MHGausEvents 131 132 * mjobs/MJCalibration.cc: 133 - fixed a comment 134 135 * mjobs/MJStar.cc: 136 - added MFDeltaT 137 138 * mpedestal/MPedCalcFromLoGain.cc: 139 - fixed a typo in a comment 78 140 79 141 -
trunk/MagicSoft/Mars/mbase/MFilter.cc
r2386 r4991 18 18 ! Author(s): Thomas Bretz, 07/2001 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 320 ! Copyright: MAGIC Software Development, 2000-2004 21 21 ! 22 22 ! … … 24 24 25 25 ///////////////////////////////////////////////////////////////////////////// 26 // //27 // MFilter //28 // //29 // This is a base class which defines an interface to create your own //30 // filters. To do it derive a class from MFilter. //31 // //32 // You can invert the meaning of a filter (logical NOT '!') by calling //33 // SetInverted(). //34 // //35 // You can create two types of Filters: //36 // - static Filters and //37 // - dynamic Filters //38 // //39 // Static Filters: //40 // A static filter is a filter which value doesn't change dynamically, //41 // which mean only once while running through your tasklist. To create //42 // a static filter override the Process-function of MFilter (this is //43 // the function in which the filer-value should be updated). If //44 // necessary you can also overwrite Pre-/PostProcess. The process //45 // function should calculate the return value of IsExpressionTrue. //46 // IsExpressionTrue should simply return this value. This kind of //47 // filter must be added to the tasklist at a point which is forseen to //48 // update the value of the filter (eg. after the reading task). //49 // //50 // Dynamic Filters: //51 // A dynamic filter is a filter which returns a value which must be //52 // calculated at the time the filter is called. To create such a //53 // filter you have to overwrite IsExpressionTrue only. If there is //54 // no need for a 'one-point' update this filter must not be added to //55 // the tasklist. //56 // //57 // Usage: //58 // A Filter is connected to a task by calling MTask::SetFilter. The //59 // task is now executed when IsExpressionTrue returns a value //60 // (different from kFALSE) only. //61 // //62 // Remarks: //63 // - Make sure, that all tasks which depends on this filter are either //64 // collected in a MTaskList-object or are conected to the same //65 // filter. //66 // - If you want to use different filters (combined logically) for one //67 // task please look for the MFilterList class. //68 // - Be careful, the return value of IsExpressionTrue is NOT a real //69 // boolean. You can return other values, too. //70 // //26 // 27 // MFilter 28 // 29 // This is a base class which defines an interface to create your own 30 // filters. To do it derive a class from MFilter. 31 // 32 // You can invert the meaning of a filter (logical NOT '!') by calling 33 // SetInverted(). 34 // 35 // You can create two types of Filters: 36 // - static Filters and 37 // - dynamic Filters 38 // 39 // Static Filters: 40 // A static filter is a filter which value doesn't change dynamically, 41 // which mean only once while running through your tasklist. To create 42 // a static filter override the Process-function of MFilter (this is 43 // the function in which the filer-value should be updated). If 44 // necessary you can also overwrite Pre-/PostProcess. The process 45 // function should calculate the return value of IsExpressionTrue. 46 // IsExpressionTrue should simply return this value. This kind of 47 // filter must be added to the tasklist at a point which is forseen to 48 // update the value of the filter (eg. after the reading task). 49 // 50 // Dynamic Filters: 51 // A dynamic filter is a filter which returns a value which must be 52 // calculated at the time the filter is called. To create such a 53 // filter you have to overwrite IsExpressionTrue only. If there is 54 // no need for a 'one-point' update this filter must not be added to 55 // the tasklist. 56 // 57 // Usage: 58 // A Filter is connected to a task by calling MTask::SetFilter. The 59 // task is now executed when IsExpressionTrue returns a value 60 // (different from kFALSE) only. 61 // 62 // Remarks: 63 // - Make sure, that all tasks which depends on this filter are either 64 // collected in a MTaskList-object or are conected to the same 65 // filter. 66 // - If you want to use different filters (combined logically) for one 67 // task please look for the MFilterList class. 68 // - Be careful, the return value of IsExpressionTrue is NOT a real 69 // boolean. You can return other values, too. 70 // 71 71 ///////////////////////////////////////////////////////////////////////////// 72 #include "MFilter.h" 72 73 73 #include "MFilter.h" 74 #include "MLog.h" 75 #include "MLogManip.h" 74 76 75 77 ClassImp(MFilter); 76 78 79 using namespace std; 80 81 // -------------------------------------------------------------------------- 82 // 83 // Default constructor for a filter. Initializes fInverted with kFALSE 84 // 77 85 MFilter::MFilter(const char *name, const char *title) : fInverted(kFALSE) 78 86 { … … 81 89 } 82 90 91 // -------------------------------------------------------------------------- 92 // 93 // return the Rule corresponding to this filter (see MF and MDataChain) 94 // 83 95 TString MFilter::GetRule() const 84 96 { 85 97 return "<GetRule n/a for " + fName + ">"; 86 98 } 99 100 // -------------------------------------------------------------------------- 101 // 102 // This is used to print the output in the PostProcess/Finalize. 103 // Or everywhere else in a nice fashioned and unified way. 104 // 105 void MFilter::PrintSkipped(UInt_t n, const char *str) 106 { 107 *fLog << " " << setw(7) << n << " ("; 108 *fLog << setw(3) << TMath::Nint(100.*n/GetNumExecutions()); 109 *fLog << "%) Evts fullfilled: " << str << endl; 110 } -
trunk/MagicSoft/Mars/mbase/MFilter.h
r1948 r4991 25 25 Bool_t IsInverted() const { return fInverted; } 26 26 27 void PrintSkipped(UInt_t n, const char *str); 28 27 29 ClassDef(MFilter, 1) // Abstract base class for the filters 28 30 }; -
trunk/MagicSoft/Mars/mbase/MTask.cc
r3895 r4991 483 483 MParContainer::SetDisplay(d); 484 484 } 485 486 // -------------------------------------------------------------------------- 487 // 488 // This is used to print the output in the PostProcess/Finalize. 489 // Or everywhere else in a nice fashioned and unified way. 490 // 491 void MTask::PrintSkipped(UInt_t n, const char *str) 492 { 493 *fLog << " " << setw(7) << n << " ("; 494 *fLog << setw(3) << TMath::Nint(100.*n/GetNumExecutions()); 495 *fLog << "%) Evts skipped: " << str << endl; 496 } -
trunk/MagicSoft/Mars/mbase/MTask.h
r3666 r4991 95 95 Double_t GetRealTime() const; 96 96 virtual void PrintStatistics(const Int_t lvl=0, Bool_t title=kFALSE, Double_t time=0) const; 97 virtual void PrintSkipped(UInt_t n, const char *str); 97 98 98 99 // Task overwrite functions -
trunk/MagicSoft/Mars/mfilter/FilterLinkDef.h
r3331 r4991 9 9 #pragma link C++ class MFTriggerLvl2+; 10 10 #pragma link C++ class MFGeomag+; 11 #pragma link C++ class MFDeltaT+; 11 12 #pragma link C++ class MFParticleId+; 12 13 -
trunk/MagicSoft/Mars/mfilter/Makefile
r4584 r4991 21 21 MFTriggerLvl2.cc \ 22 22 MFGeomag.cc \ 23 MFDeltaT.cc \ 23 24 MFParticleId.cc \ 24 25 MFAlpha.cc \ -
trunk/MagicSoft/Mars/mhbase/MFillH.cc
r4058 r4991 18 18 ! Author(s): Thomas Bretz, 07/2001 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 320 ! Copyright: MAGIC Software Development, 2000-2004 21 21 ! 22 22 ! … … 24 24 25 25 ////////////////////////////////////////////////////////////////////////////// 26 // // 27 // MFillH // 28 // // 29 // This is a common interface (task) to fill mars histograms. Every mars // 30 // histogram which is derived from MH can be filled with this task. // 31 // // 32 // There are two options to use: // 33 // // 34 // 1) You specifiy the parameter container with which data the // 35 // histogram container should be filled, and the histogram container // 36 // which has to be filled. This can be done by either specifing the // 37 // name of the objects in the parameter list or by specifiing a pointer // 38 // to the object. (s. Constructor) // 39 // // 40 // 2) You specify the name and/or type of the histogram to become filled. // 41 // Any other action imust be taken by the histogram class. // 42 // // 43 // PreProcess: In the preprocessing of this task we setup all pointers // 44 // to instances which are needed and call FillSetup of the // 45 // histogram class with the parameter list as an argument. // 46 // // 47 // Process: The process function calls the Fill member function of the // 48 // histogram class instance (inheriting from MH) with either // 49 // a NULL pointer or a pointer to the corresponding container // 50 // as an argument. // 51 // // 52 // To use a weight for each event filled in a histogram call // 53 // SetWeight(). You can eithe use the name of a MWeight container stored // 54 // in the parameter list or a pointer to it as an argument. // 55 // // 56 // // 57 // WARNING: // 58 // Because MFillH is a generalized task to fill histograms it doesn't // 59 // know about which branches from a file are necessary to fill the // 60 // histograms. If you are reading data from a file which is directly // 61 // filled into a histogram via MFillH, please call either // 62 // MReadTree::DisableAutoScheme() or enable the necessary branches by // 63 // yourself, using MReadTree::EnableBranch() // 64 // // 65 // Checkout the Warning in MTaskList. // 66 // // 67 // Input Containers: // 68 // A parameter container // 69 // // 70 // Output Containers: // 71 // A histogram container // 72 // // 26 // 27 // MFillH 28 // 29 // This is a common interface (task) to fill mars histograms. Every mars 30 // histogram which is derived from MH can be filled with this task. 31 // 32 // There are two options to use: 33 // 34 // 1) You specifiy the parameter container with which data the 35 // histogram container should be filled, and the histogram container 36 // which has to be filled. This can be done by either specifing the 37 // name of the objects in the parameter list or by specifiing a pointer 38 // to the object. (s. Constructor) 39 // 40 // 2) You specify the name and/or type of the histogram to become filled. 41 // Any other action imust be taken by the histogram class. 42 // 43 // PreProcess: In the preprocessing of this task we setup all pointers 44 // to instances which are needed and call FillSetup of the 45 // histogram class with the parameter list as an argument. 46 // 47 // Process: The process function calls the Fill member function of the 48 // histogram class instance (inheriting from MH) with either 49 // a NULL pointer or a pointer to the corresponding container 50 // as an argument. 51 // 52 // To use a weight for each event filled in a histogram call 53 // SetWeight(). You can eithe use the name of a MWeight container stored 54 // in the parameter list or a pointer to it as an argument. 55 // 56 // 57 // WARNING: 58 // Because MFillH is a generalized task to fill histograms it doesn't 59 // know about which branches from a file are necessary to fill the 60 // histograms. If you are reading data from a file which is directly 61 // filled into a histogram via MFillH, please call either 62 // MReadTree::DisableAutoScheme() or enable the necessary branches by 63 // yourself, using MReadTree::EnableBranch() 64 // 65 // Checkout the Warning in MTaskList. 66 // 67 // Version 2: 68 // ---------- 69 // - added fNumExcutions 70 // 71 // 72 // Input Containers: 73 // A parameter container 74 // 75 // Output Containers: 76 // A histogram container 77 // 73 78 ////////////////////////////////////////////////////////////////////////////// 74 79 #include "MFillH.h" … … 457 462 // 458 463 fH->SetSerialNumber(GetSerialNumber()); 464 fH->SetNumExecutions(0); 459 465 if (!fH->SetupFill(pList)) 460 466 { … … 519 525 ((MHArray*)fH)->SetIndex(idx); 520 526 */ 521 527 /* 522 528 TVirtualPad *save = gPad; 523 529 if (fCanvas) 524 530 fCanvas->cd(); 525 531 */ 526 532 const Bool_t rc = fH->Fill(fParContainer, fWeight?fWeight->GetWeight():1); 527 533 fH->SetNumExecutions(GetNumExecutions()+1); 534 /* 528 535 if (save && fCanvas) 529 536 save->cd(); 530 537 */ 531 538 return rc; 532 539 } -
trunk/MagicSoft/Mars/mhbase/MH.cc
r4966 r4991 1271 1271 const char* name, const char* title) 1272 1272 { 1273 const Int_t size = array.GetSize(); 1274 1275 TH1I *h1=0; 1276 1277 //check if histogram with identical name exist 1278 TObject *h1obj = gROOT->FindObject(name); 1279 if (h1obj && h1obj->InheritsFrom("TH1I")) 1280 { 1281 h1 = (TH1I*)h1obj; 1282 h1->Reset(); 1283 } 1284 1285 Double_t min = size>0 ? array[0] : 0; 1286 Double_t max = size>0 ? array[0] : 1; 1287 1288 // first loop over array to find the min and max 1289 for (Int_t i=1; i<size;i++) 1290 { 1291 max = TMath::Max((Double_t)array[i], max); 1292 min = TMath::Min((Double_t)array[i], min); 1293 } 1294 1295 Int_t newbins = 0; 1296 FindGoodLimits(nbins, newbins, min, max, kFALSE); 1297 1298 if (!h1) 1299 { 1300 h1 = new TH1I(name, title, nbins, min, max); 1301 h1->SetXTitle(""); 1302 h1->SetYTitle("Counts"); 1303 h1->SetDirectory(gROOT); 1304 } 1305 1306 // Second loop to fill the histogram 1307 for (Int_t i=0;i<size;i++) 1308 h1->Fill(array[i]); 1309 1310 return h1; 1273 const TArrayF arr(array.GetSize(), array.GetArray()); 1274 return ProjectArray(array, nbins, name, title); 1311 1275 } 1312 1276 … … 1317 1281 TH1I* MH::ProjectArray(const MArrayD &array, Int_t nbins, const char* name, const char* title) 1318 1282 { 1319 const Int_t size = array.GetSize(); 1320 TH1I *h1=0; 1321 1322 //check if histogram with identical name exist 1323 TObject *h1obj = gROOT->FindObject(name); 1324 if (h1obj && h1obj->InheritsFrom("TH1I")) 1325 { 1326 h1 = (TH1I*)h1obj; 1327 h1->Reset(); 1328 } 1329 1330 Double_t min = size>0 ? array[0] : 0; 1331 Double_t max = size>0 ? array[0] : 1; 1332 1333 // first loop over array to find the min and max 1334 for (Int_t i=1; i<size;i++) 1335 { 1336 max = TMath::Max(array[i], max); 1337 min = TMath::Min(array[i], min); 1338 } 1339 1340 Int_t newbins = 0; 1341 FindGoodLimits(nbins, newbins, min, max, kFALSE); 1342 1343 if (!h1) 1344 { 1345 h1 = new TH1I(name, title, newbins, min, max); 1346 h1->SetXTitle(""); 1347 h1->SetYTitle("Counts"); 1348 h1->SetDirectory(gROOT); 1349 } 1350 1351 // Second loop to fill the histogram 1352 for (Int_t i=0;i<size;i++) 1353 h1->Fill(array[i]); 1354 1355 return h1; 1356 } 1357 1283 const TArrayD arr(array.GetSize(), array.GetArray()); 1284 return ProjectArray(array, nbins, name, title); 1285 } 1286 1287 // -------------------------------------------------------------------------- 1288 // 1289 // See MTask::PrintSkipped 1290 // 1291 void MH::PrintSkipped(UInt_t n, const char *str) 1292 { 1293 *fLog << " " << setw(7) << n << " ("; 1294 *fLog << setw(3) << (int)(100.*n/GetNumExecutions()); 1295 *fLog << "%) Evts skipped: " << str << endl; 1296 } -
trunk/MagicSoft/Mars/mhbase/MH.h
r4966 r4991 24 24 { 25 25 private: 26 Byte_t fSerialNumber; 26 Byte_t fSerialNumber; // Serial number (eg of telecope) 27 UInt_t fNumExecutions; // Number of calls to Fill function 27 28 28 29 public: 29 30 MH(const char *name=NULL, const char *title=NULL); 30 31 31 32 32 virtual void SetSerialNumber(Byte_t num) { fSerialNumber = num; } … … 34 34 TString AddSerialNumber(const char *str) const { TString s(str); if (fSerialNumber==0) return s; s += ";"; s += fSerialNumber; return s; } 35 35 TString AddSerialNumber(const TString &str) const { return AddSerialNumber((const char*)str); } 36 37 UInt_t GetNumExecutions() const { return fNumExecutions; } 38 void SetNumExecutions(UInt_t n) { fNumExecutions=n; } 39 40 void PrintSkipped(UInt_t n, const char *str); 36 41 37 42 Bool_t OverwritesDraw(TClass *cls=NULL) const; … … 110 115 static TObject *FindObjectInPad(const char *name, TVirtualPad *pad=NULL); 111 116 112 ClassDef(MH, 1) //A base class for Mars histograms117 ClassDef(MH, 2) //A base class for Mars histograms 113 118 }; 114 119 -
trunk/MagicSoft/Mars/mhcalib/HCalibLinkDef.h
r4940 r4991 16 16 #pragma link C++ class MHCalibrationTestTimeCam+; 17 17 18 #pragma link C++ class MHGausEvents+ +;18 #pragma link C++ class MHGausEvents+; 19 19 20 20 #endif -
trunk/MagicSoft/Mars/mjobs/MJCalibration.cc
r4987 r4991 1369 1369 // MJCalibration.Datacheck: yes,no 1370 1370 // MJCalibration.Debug: yes,no 1371 // MJCalibration.Intensity: yes,no 1371 1372 // MJCalibration.UseBlindPixel: yes,no 1372 1373 // MJCalibration.UsePINDiode: yes,no -
trunk/MagicSoft/Mars/mjobs/MJStar.cc
r4966 r4991 50 50 #include "MReadReports.h" 51 51 #include "MReadMarsFile.h" 52 #include "MFDeltaT.h" 53 #include "MContinue.h" 52 54 #include "MGeomApply.h" 53 55 #include "MEventRateCalc.h" … … 160 162 161 163 // ------------------ Setup general tasks ---------------- 164 165 MFDeltaT fdeltat; 166 MContinue cont(&fdeltat, "FilterDeltaT", "Filter events with wrong timing"); 167 cont.SetInverted(); 162 168 163 169 MGeomApply apply; // Only necessary to craete geometry … … 218 224 if (ismc) 219 225 { 220 write.AddContainer("MPointingPos", "Events");226 write.AddContainer("MPointingPos", "Events"); 221 227 // Monte Carlo 222 228 write.AddContainer("MMcEvt", "Events"); … … 229 235 else 230 236 { 231 write.AddContainer("MTime", "Events");237 write.AddContainer("MTime", "Events"); 232 238 // Run Header 233 239 write.AddContainer("MRawRunHeader", "RunHeaders"); … … 237 243 // Drive 238 244 //write.AddContainer("MSrcPosCam", "Drive"); 239 write.AddContainer("MPointingPos", "Drive");240 write.AddContainer("MReportDrive", "Drive");241 write.AddContainer("MTimeDrive", "Drive");245 write.AddContainer("MPointingPos", "Drive"); 246 write.AddContainer("MReportDrive", "Drive"); 247 write.AddContainer("MTimeDrive", "Drive"); 242 248 // Effective On Time 243 249 write.AddContainer("MEffectiveOnTime", "EffectiveOnTime"); … … 249 255 if (!ismc) 250 256 { 257 tlist2.AddToList(&cont); 251 258 tlist2.AddToList(&rate); 252 259 //tlist2.AddToList(&rate10000); -
trunk/MagicSoft/Mars/mpedestal/MPedCalcFromLoGain.cc
r4682 r4991 33 33 // 34 34 // 35 // This task is de vide form MPedCalcPedRun, described below. However, It35 // This task is derived form MPedCalcPedRun, described below. However, It 36 36 // calculates the pedstals using the low gain slices, whenever the difference 37 37 // between the highest and the lowest slice in the high gain
Note:
See TracChangeset
for help on using the changeset viewer.