Changeset 7115 for trunk/MagicSoft/Mars
- Timestamp:
- 05/31/05 11:53:09 (19 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r7112 r7115 21 21 22 22 -*-*- END OF LINE -*-*- 23 2005/05/31 Thomas Bretz 24 25 * mfileio/MReadReports.[h,cc]: 26 - changed such that it can force prereading of the first event of 27 a sequence after PreProcess 28 29 * mfileio/MReadTree.h: 30 - added some comment about the new bits used in MReadReports 31 32 * mhflux/MHDisp.cc: 33 - changed fit limit from 1.1 to 1.0 34 - fixed access to wrong axis 35 36 * mhflux/MHEffectiveOnTime.cc: 37 - fixed a bug which caused the first bin of the histograms 38 vs time to disapear in PostProcess, which gave wrong results 39 on the screen. The output and all following programs not 40 directly accessing the histograms haven't been affected 41 42 * mjobs/MJCalib.cc: 43 - HasEnv for boolean type resources is obsolete and has been 44 removed 45 46 * mjobs/MJCalibrateSignal.cc: 47 - removed MPointingPosInterpolate 48 - adapted usage of MReadReports to changes 49 50 * mjobs/MJCut.cc, mjobs/MJStar.cc: 51 - adapted usage of MReadReports to changes 52 - made Drive-tree a 'required' tree 53 54 * mjobs/MJStar.cc: 55 - removed "Events" from setting up rate and effective on time 56 tasks to tlist2. It is obsolete because calibration events 57 don't enter star at all. 58 59 * mpointing/MPointingPosCalc.[h,cc]: 60 - assume that the run-type is real-data if Process is called before 61 ReInit 62 23 63 24 64 -
trunk/MagicSoft/Mars/NEWS
r7100 r7115 5 5 - general: MMcEvt now derived from MMcEvtBasic which should 6 6 have no influence on compatibility with older camera files 7 8 - general: Implemented a new option to MReadReports which allows 9 to force reading of the first event of some trees (eg. Drive-tree) 10 before any other tree. 11 12 - general: Made a fix to MPointingPosCalc which assumes that the 13 run-type is real-data if Process is called before ReInit, such 14 that also the very first Drive-events in a run are treated 15 correctly. 7 16 8 17 - callisto: changed default of fgFallTimeHiGain in … … 18 27 Wrongly the calibration_UV weights were used instead 19 28 of the cosmics weights set in callisto.rc. 29 30 - star: fixed a bug which caused the first bin of the histograms 31 vs time to disapear in PostProcess. This gave wrong results 32 on the screen. The output and all following programs not 33 directly accessing the histograms haven't been affected 34 35 - star, ganymed: Made sure that always the first Drive-tree event 36 is read and Processed before the first data event was read. 37 38 - ganymed: implemented the possibility to replace the standard 39 false source plot with a different one. For example: If 40 you want to use a Disp based FS plot use the resource: 41 NameHistFS: MHDisp 42 For details about the requirements of these plots look 43 at the corresponding classes 20 44 21 45 - sponde: The input MC spectrum can now be weighted to fake a … … 31 55 32 56 33 *** Version 0.9.2 57 *** Version 0.9.2 (2005/05/20) 34 58 35 59 - general: Changed the default paths for calibrated data and image -
trunk/MagicSoft/Mars/mfileio/MReadReports.cc
r6499 r7115 165 165 // To be done: A flag(?) telling whether the headers can be skipped. 166 166 // 167 void MReadReports::AddTree(const char *tree, const char *time, Bool_t master)167 void MReadReports::AddTree(const char *tree, const char *time, Type_t master) 168 168 { 169 169 /* … … 176 176 */ 177 177 178 if (master && TestBit(kHasMaster))178 if (master==kMaster && TestBit(kHasMaster)) 179 179 { 180 180 *fLog << warn << GetDescriptor() << " already has a master tree... ignored." << endl; 181 master = k FALSE;182 } 183 184 MReadTree *t = master ? new MReadMarsFile(tree) : new MReadTree(tree);181 master = kStandard; 182 } 183 184 MReadTree *t = master==kMaster ? new MReadMarsFile(tree) : new MReadTree(tree); 185 185 t->SetName(tree); 186 186 t->SetTitle(time?time:""); 187 if (master )187 if (master==kMaster) 188 188 SetBit(kHasMaster); 189 if (master==kRequired) 190 t->SetBit(kIsRequired); 189 191 190 192 if (!fEnableAutoScheme) … … 219 221 220 222 return n; 223 } 224 225 // -------------------------------------------------------------------------- 226 // 227 // Count the number of required trees and store the number if fNumRequired. 228 // Reset the kIsProcessed bit. 229 // 230 void MReadReports::ForceRequired() 231 { 232 fNumRequired = 0; 233 234 TIter Next(fTrees->GetList()); 235 TObject *o=0; 236 while ((o=Next())) 237 if (o->TestBit(kIsRequired)) 238 { 239 o->ResetBit(kIsProcessed); 240 fNumRequired++; 241 } 242 243 *fLog << dbg << "Number of required trees: " << fNumRequired << endl; 221 244 } 222 245 … … 297 320 fPosEntry.Set(i); 298 321 322 // Force that with the next call to Process the required events are read 323 ForceRequired(); 324 //fFirstReInit=kTRUE; 325 326 // Preprocess all tasks in fTrees 299 327 return fTrees->CallPreProcess(plist); 328 } 329 330 // -------------------------------------------------------------------------- 331 // 332 // If this is not the first ReInit after PreProcess force the required 333 // trees to be read first (call FirstRequired()) 334 // 335 /* 336 Bool_t MReadReports::ReInit(MParList *plist) 337 { 338 if (!fFirstReInit) 339 ForceRequired(); 340 fFirstReInit=kFALSE; 341 return kTRUE; 342 } 343 */ 344 345 // -------------------------------------------------------------------------- 346 // 347 // Return the number of the tree which is the next one to be read. 348 // The condition for this decision is the time-stamp. 349 // 350 Int_t MReadReports::FindNextTime() 351 { 352 TIter NextC(fChains); 353 TChain *c=0; 354 355 Int_t nmin=0; 356 MTime tmin(**GetTime((TChain*)NextC())); 357 358 Int_t i=0; 359 360 while ((c=(TChain*)NextC())) 361 { 362 MTime &t = **GetTime(c); 363 i++; 364 365 if (t >= tmin) 366 continue; 367 368 tmin = t; 369 nmin = i; 370 } 371 return nmin; 372 } 373 374 // -------------------------------------------------------------------------- 375 // 376 // Return the number of the tree which is the next one to be read. 377 // The condition for this decision kIsRequired but not kIsProcessed is set. 378 // 379 Int_t MReadReports::FindNextRequired() 380 { 381 Int_t n = 0; 382 383 TIter Next(fTrees->GetList()); 384 TObject *o=0; 385 while ((o=Next())) 386 { 387 if (o->TestBit(kIsRequired) && !o->TestBit(kIsProcessed)) 388 { 389 o->SetBit(kIsProcessed); 390 fNumRequired--; 391 *fLog << dbg << "Reading from tree " << n << " " << o->GetName() << endl; 392 return n; 393 } 394 n++; 395 } 396 397 return -1; 300 398 } 301 399 … … 312 410 // -------------------------------------------------------------------------- 313 411 // 314 // Do not use if fChains->GetSize()==0 !!!315 //316 Int_t MReadReports::FindNextTime()317 {318 Int_t i=0;319 320 TIter NextC(fChains);321 TChain *c=0;322 323 Int_t nmin=0;324 MTime tmin(**GetTime((TChain*)NextC()));325 326 while ((c=(TChain*)NextC()))327 {328 MTime &t = **GetTime(c);329 i++;330 331 if (t >= tmin)332 continue;333 334 tmin = t;335 nmin = i;336 }337 return nmin;338 }339 340 /*341 Bool_t MReadReports::Notify()342 {343 Bool_t same = kTRUE;344 for (int i=1; i<fPosTree.GetSize(); i++)345 if (fPosTree[i]!=fPosTree[0])346 {347 same = kFALSE;348 break;349 }350 351 Int_t tn = chain->GetTreeNumber();352 353 Bool_t read=kFALSE;354 if (fPosTree[nmin] != tn)355 {356 fPosTree[nmin] = tn;357 read = kTRUE;358 }359 360 if (!same || !read)361 return kTRUE;362 363 364 *fLog << dbg << "Read Run Headers!" << endl;365 366 return kTRUE;367 }368 */369 370 // --------------------------------------------------------------------------371 //372 412 // Check which is the next tree to read from. Read an event from this tree. 373 413 // Sets the StreamId accordingly. … … 377 417 while (fChains->GetSize()) 378 418 { 379 const Int_t nmin=FindNextTime(); 419 const Int_t nmin=FindNext(); 420 if (nmin<0) 421 { 422 *fLog << err << "MReadReports::Process: ERROR - Determination of next tree failed... abort." << endl; 423 return kERROR; 424 } 380 425 381 426 TChain *chain = (TChain*)fChains->At(nmin); -
trunk/MagicSoft/Mars/mfileio/MReadReports.h
r6499 r7115 17 17 class MReadReports : public MRead 18 18 { 19 public: 20 enum Type_t { 21 kStandard, 22 kMaster, 23 kRequired 24 }; 25 19 26 private: 20 27 MTaskList *fTrees; // Hold the trees which are scheduled for reading … … 25 32 26 33 Bool_t fEnableAutoScheme; 34 Int_t fNumRequired; 35 //Bool_t fFirstReInit; 27 36 37 void ForceRequired(); 28 38 MTime** GetTime(TChain *c) const; 29 39 Int_t FindNextTime(); 40 Int_t FindNextRequired(); 41 Int_t FindNext() { return fNumRequired==0 ? FindNextTime() : FindNextRequired(); } 30 42 31 43 UInt_t GetEntries(); 32 44 TString GetFullFileName() const; 33 45 46 //Bool_t ReInit(MParList *plist); 34 47 Int_t PreProcess(MParList *plist); 35 48 Int_t Process(); … … 37 50 38 51 enum { 39 kHasMaster = BIT(14) 52 kHasMaster = BIT(14), 53 kIsRequired = BIT(22), 54 kIsProcessed = BIT(23) 40 55 }; 41 56 … … 44 59 ~MReadReports(); 45 60 46 void AddTree(const char *tree, const char *time=NULL, Bool_t master=kFALSE);47 void AddTree(const char *tree, Bool_t master)61 void AddTree(const char *tree, const char *time=NULL, Type_t master=kStandard); 62 void AddTree(const char *tree, Type_t master) 48 63 { 49 64 AddTree(tree, NULL, master); -
trunk/MagicSoft/Mars/mfileio/MReadTree.h
r6499 r7115 31 31 32 32 enum { kChainWasChanged = BIT(14) }; 33 // MReadReports::kIsRequired = BIT(22) 34 // MReadReports::kIsProcessed = BIT(23) 33 35 34 36 private: … … 47 49 48 50 enum { kIsOwner = BIT(14) }; 51 // MReadReports::kIsRequired = BIT(22) 52 // MReadReports::kIsProcessed = BIT(23) 49 53 50 54 public: -
trunk/MagicSoft/Mars/mhflux/MHDisp.cc
r7114 r7115 278 278 { 279 279 const Double_t r = TMath::Hypot(h1->GetXaxis()->GetBinCenter(x+1)-x0, 280 h1->Get Xaxis()->GetBinCenter(y+1)-y0);280 h1->GetYaxis()->GetBinCenter(y+1)-y0); 281 281 h2->Fill(r, h1->GetBinContent(x+1, y+1)); 282 282 } … … 286 286 func.SetLineColor(kBlue); 287 287 288 func.SetParLimits(2, h2->GetBinWidth(1), 1. 1);288 func.SetParLimits(2, h2->GetBinWidth(1), 1.0); 289 289 290 290 func.SetParameter(0, h2->GetBinContent(1)); … … 292 292 func.SetParameter(2, 0.15); 293 293 func.SetParameter(4, h2->GetBinContent(10)); 294 h2->Fit(&func, "IMQ", "", 0, 1. 1);294 h2->Fit(&func, "IMQ", "", 0, 1.0); 295 295 296 296 const Double_t r0 = 2*func.GetParameter(2); -
trunk/MagicSoft/Mars/mhflux/MHEffectiveOnTime.cc
r7091 r7115 749 749 FitThetaBins(); 750 750 FitTimeBin(); 751 MH::RemoveFirstBin(fHTimeEffOn);752 MH::RemoveFirstBin(fHTimeProb);753 MH::RemoveFirstBin(fHTimeLambda);754 //MH::RemoveFirstBin(fHTimeNDF);755 751 756 752 fIsFinalized = kTRUE; -
trunk/MagicSoft/Mars/mjobs/MJCalib.cc
r6985 r7115 60 60 Bool_t MJCalib::CheckEnvLocal() 61 61 { 62 if (HasEnv("PixelCheck")) 63 SetPixelCheck(GetEnv("PixelCheck", fIsPixelCheck)); 64 65 if (HasEnv("PulsePosCheck")) 66 SetPulsePosCheck(GetEnv("PulsePosCheck", fIsPulsePosCheck)); 67 68 if (HasEnv("CheckedPixId")) 69 SetCheckedPixId(GetEnv("CheckedPixId",fCheckedPixId)); 70 71 if (HasEnv("HiLoCalibration")) 72 SetHiLoCalibration(GetEnv("HiLoCalibration", fIsHiLoCalibration)); 62 SetPixelCheck(GetEnv("PixelCheck", fIsPixelCheck)); 63 SetPulsePosCheck(GetEnv("PulsePosCheck", fIsPulsePosCheck)); 64 SetCheckedPixId(GetEnv("CheckedPixId",fCheckedPixId)); 65 SetHiLoCalibration(GetEnv("HiLoCalibration", fIsHiLoCalibration)); 73 66 74 67 if (HasEnv("StorageType")) -
trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc
r7073 r7115 95 95 //#include "MMcPedestalCopy.h" 96 96 #include "MPointingPosCalc.h" 97 #include "MPointingPosInterpolate.h"98 97 #include "MPedCalcFromLoGain.h" 99 98 #include "MExtractor.h" … … 378 377 379 378 MReadReports readreal; 380 readreal.AddTree("Events", "MTime.", kTRUE);379 readreal.AddTree("Events", "MTime.", MReadReports::kMaster); 381 380 readreal.AddTree("Trigger"); 382 381 readreal.AddTree("Camera"); … … 407 406 MContinue contmc("MRawEvtData.GetNumPixels<0.5", "ContEmptyMC"); 408 407 409 MPointingPosInterpolate pextr;410 pextr.AddFiles(&iter);408 //MPointingPosInterpolate pextr; 409 //pextr.AddFiles(&iter); 411 410 412 411 MGeomApply apply; // Only necessary to create geometry … … 725 724 // Now setup main tasklist 726 725 tlist.AddToList(read); 726 727 727 if (IsUseMC()) 728 728 { … … 731 731 } 732 732 733 if (IsUseRootData())734 tlist2.AddToList(&pextr);733 //if (IsUseRootData()) 734 // tlist2.AddToList(&pextr); 735 735 tlist.AddToList(&tlist2, IsUseRootData() ? "Events" : "All"); 736 736 -
trunk/MagicSoft/Mars/mjobs/MJCut.cc
r7113 r7115 494 494 // ------------- Loop Off Data -------------------- 495 495 MReadReports readoffdata; 496 readoffdata.AddTree("Events", "MTime.", kTRUE);497 readoffdata.AddTree("Drive" );496 readoffdata.AddTree("Events", "MTime.", MReadReports::kMaster); 497 readoffdata.AddTree("Drive", MReadReports::kRequired); 498 498 readoffdata.AddTree("EffectiveOnTime"); 499 499 … … 637 637 // ------------- Loop On Data -------------------- 638 638 MReadReports readondata; 639 readondata.AddTree("Events", "MTime.", kTRUE);640 readondata.AddTree("Drive" );639 readondata.AddTree("Events", "MTime.", MReadReports::kMaster); 640 readondata.AddTree("Drive", MReadReports::kRequired); 641 641 readondata.AddTree("EffectiveOnTime"); 642 642 -
trunk/MagicSoft/Mars/mjobs/MJStar.cc
r7091 r7115 191 191 192 192 MReadReports readreal; 193 readreal.AddTree("Events", "MTime.", kTRUE);194 readreal.AddTree("Drive" );193 readreal.AddTree("Events", "MTime.", MReadReports::kMaster); 194 readreal.AddTree("Drive", MReadReports::kRequired); 195 195 readreal.AddTree("CC"); 196 196 //read.AddTree("Trigger"); … … 368 368 if (!ismc) 369 369 { 370 tlist2.AddToList(&rate, "Events"); 371 tlist2.AddToList(&fillvs, "Events"); 372 tlist2.AddToList(&fill8, "Events"); 373 tlist2.AddToList(&fill9, "Events"); 370 // Calibration events don't enter star at all. 371 tlist2.AddToList(&rate); 372 tlist2.AddToList(&fillvs); 373 tlist2.AddToList(&fill8); 374 tlist2.AddToList(&fill9); 374 375 } 375 376 //tlist2.AddToList(&fillb); -
trunk/MagicSoft/Mars/mpointing/MPointingPosCalc.cc
r5583 r7115 34 34 // * Real Data: Copy the nominal poiting position (Nominal Zd, Nominal Az 35 35 // in MReportDrive) to MPointingPosition 36 // 37 // We do a trick: Because it is not guranteed, that MReadReports calls 38 // ReInit before the first event from the drive-tree is read (because 39 // the first data event may have a time-stamp later than the first 40 // drive event) we always assume that the current run is a data run. 41 // If the assumption is true fReport should be initialized correctly. 42 // For MC runs this should never happen, Because they are read though 43 // MReadMarsFile which gurantees, that ReInit is always called before 44 // Process. If we encounter such a case we stop execution. 36 45 // 37 46 // Future: Interpolate the pointing position for each event between two … … 81 90 { 82 91 case MRawRunHeader::kRTData: 83 fReport = (MReportDrive*)plist->FindObject("MReportDrive");84 92 if (!fReport) 85 93 { … … 121 129 { 122 130 fPosition = (MPointingPos*)plist->FindCreateObj("MPointingPos"); 131 fReport = (MReportDrive*)plist->FindObject("MReportDrive"); 132 133 // We use kRTNone here as a placeholder for data runs. 134 fRunType = MRawRunHeader::kRTNone; 135 123 136 return fPosition ? kTRUE : kFALSE; 124 137 } … … 130 143 Int_t MPointingPosCalc::Process() 131 144 { 132 if (!fReport && fRunType == MRawRunHeader::kRTData)133 {134 *fLog << warn << "WARNING - MPointingPosCalc::Process was called BEFORE the first" << endl;135 *fLog << " data event was read (means ReInit was executed!" << endl;136 return kTRUE;137 }138 139 145 switch (fRunType) 140 146 { 147 case MRawRunHeader::kRTNone: 141 148 case MRawRunHeader::kRTData: 149 if (!fReport) 150 { 151 *fLog << warn; 152 *fLog << "MPointingPosCalc::Process: fReport==NULL && fRunType!=kRTMonteCarlo... abort!" << endl; 153 return kERROR; 154 } 142 155 fPosition->SetLocalPosition(fReport->GetNominalZd(), fReport->GetNominalAz()); 143 156 fPosition->SetSkyPosition(fReport->GetRa(), fReport->GetDec()); … … 145 158 146 159 case MRawRunHeader::kRTMonteCarlo: 160 if (!fMcEvt) 161 { 162 *fLog << warn; 163 *fLog << "MPointingPosCalc::Process: fMcEvt==NULL && fRunType==kRTMonteCarlo... abort!" << endl; 164 return kERROR; 165 } 147 166 fPosition->SetLocalPosition(fMcEvt->GetTelescopeTheta()*TMath::RadToDeg(), fMcEvt->GetTelescopePhi()*TMath::RadToDeg()); 148 167 return kTRUE;
Note:
See TracChangeset
for help on using the changeset viewer.