Changeset 2454
- Timestamp:
- 11/03/03 15:41:36 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 2 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r2448 r2454 1 1 -*-*- END OF LINE -*-*- 2 2003/11/03: Thomas Bretz 3 4 * manalysis/MMcPedestalCopy.[h,cc], manalysis/MMcPedestalNSBAdd.[h,cc]: 5 - fixed such, that it now works correctly with non-MC files 6 - moved container requests from PreProcess to ReInit 7 - removed some obsolete data members - made them locally 8 9 * manalysis/MMcPedestalRead.[h,cc]: 10 - removed 11 12 * mbase/MEvtLoop.cc: 13 - replaced the gApplication->InheritsFrom(TRint::Class()) 14 workaround for thread safty by the more correct check 15 whether we are running in the main Thread (TThread::Self()) 16 17 * mbase/MTask.h: 18 - added the missing const-qualifier to GetNumExecutions 19 20 * mbase/MTaskList.cc: 21 - fixed a typo in the output 22 23 * mimage/MHillasCalc.[h,cc]: 24 - replaced TArrayC by TArrayL to support huge number of events 25 - added PrintSkipped 26 - added comments to the data members 27 28 29 2 30 2003/10/31: Marcos Lopez 3 31 4 * mhist/MFill .cc:32 * mhist/MFillH.cc: 5 33 - Fixed a bug in function PreProcess(MParList *pList). Inside the 6 34 conditional sentence "if (!fWeight && !fWeightName.IsNull())", 7 35 fWeight never pointed to the object MWeight recoverd from the 8 36 parameter list. 9 10 * mhistmc/MHMcEnergyImpact.cc11 12 13 * mmontecarlo/MMcWeightEnergySpecCalc.[h,cc] 14 15 37 38 * mhistmc/MHMcEnergyImpact.cc: 39 - In the Fill function, pass the weight to the histogram fHist. 40 41 * mmontecarlo/MMcWeightEnergySpecCalc.[h,cc]: 42 - Added new class for changing the energy spectrum of the showers 43 simulated with Corsika to a different one, be using weights 16 44 17 45 * mmontecarlo/Makefile, MonteCarloLinkDef.h -
trunk/MagicSoft/Mars/manalysis/MMcPedestalCopy.cc
r2440 r2454 89 89 // -------------------------------------------------------------------------- 90 90 // 91 // Check for the runtype. 91 92 // Search for MPedestalCam and MMcFadcHeader. 92 93 // 93 Int_t MMcPedestalCopy::PreProcess(MParList *pList)94 Bool_t MMcPedestalCopy::ReInit(MParList *pList) 94 95 { 95 fMcRun = (MMcRunHeader*)pList->FindObject("MMcRunHeader"); 96 if (!fMcRun) 96 // 97 // If it is no MC file skip this function... 98 // 99 if (!CheckRunType(pList)) 100 return kTRUE; 101 102 // 103 // Now check the existance of all necessary containers. This has 104 // to be done only if this is a MC file. 105 // 106 MPedestalCam *pedcam = (MPedestalCam*)pList->FindCreateObj("MPedestalCam"); 107 if (!pedcam) 108 return kFALSE; 109 110 MMcRunHeader *mcrun = (MMcRunHeader*)pList->FindObject("MMcRunHeader"); 111 if (!mcrun) 97 112 *fLog << warn << dbginf << "MMcRunHeader not found... assuming camera<0.7" << endl; 98 113 99 fPedCam = (MPedestalCam*)pList->FindCreateObj("MPedestalCam"); 100 if (!fPedCam) 101 return kFALSE; 102 103 fMcPed = (MMcFadcHeader*)pList->FindObject("MMcFadcHeader"); 104 if (!fMcPed) 114 MMcFadcHeader *fadc = (MMcFadcHeader*)pList->FindObject("MMcFadcHeader"); 115 if (!fadc) 105 116 { 106 117 *fLog << err << dbginf << "MMcFadcHeader not found... aborting." << endl; … … 108 119 } 109 120 110 return kTRUE; 111 } 121 const int num = pedcam->GetSize(); 112 122 113 // -------------------------------------------------------------------------- 114 // 115 // Check for the runtype. 116 // Initialize the size of MPedestalCam to the number of pixels from 117 // MMcFadcHeader. 118 // 119 Bool_t MMcPedestalCopy::ReInit(MParList *pList) 120 { 121 if (!CheckRunType(pList)) 122 return kFALSE; 123 124 const int num = fPedCam->GetSize(); 125 126 const Bool_t camver70 = fMcRun && fMcRun->GetCamVersion()>=70; 123 const Bool_t camver70 = mcrun && mcrun->GetCamVersion()>=70; 127 124 128 125 for (int i=0; i<num; i++) 129 126 { 130 MPedestalPix &pix = (* fPedCam)[i];127 MPedestalPix &pix = (*pedcam)[i]; 131 128 132 129 // Here one should compute the Pedestal taking into account how 133 130 // the MC makes the transformation analogic-digital for the FADC. 131 // This is done only once per file -> not time critical. 134 132 135 const Float_t pedest = f McPed->GetPedestal(i);136 const Float_t sigma = camver70 ? f McPed->GetPedestalRmsHigh(i) : fMcPed->GetElecNoise(i);133 const Float_t pedest = fadc->GetPedestal(i); 134 const Float_t sigma = camver70 ? fadc->GetPedestalRmsHigh(i) : fadc->GetElecNoise(i); 137 135 138 136 pix.Set(pedest, sigma); … … 140 138 141 139 if (camver70) 142 fPedCam->SetReadyToSave();140 pedcam->SetReadyToSave(); 143 141 144 142 return kTRUE; -
trunk/MagicSoft/Mars/manalysis/MMcPedestalCopy.h
r2440 r2454 6 6 #endif 7 7 8 class MMcFadcHeader;9 class MMcRunHeader;10 class MPedestalCam;11 12 8 class MMcPedestalCopy : public MTask 13 9 { 14 10 private: 15 const MMcFadcHeader *fMcPed;16 const MMcRunHeader *fMcRun;17 18 MPedestalCam *fPedCam;19 20 11 Bool_t CheckRunType(MParList *pList) const; 21 22 Int_t PreProcess(MParList *pList);23 12 Bool_t ReInit(MParList *pList); 24 13 -
trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.cc
r2440 r2454 125 125 // -------------------------------------------------------------------------- 126 126 // 127 // - check whether we have a monte carlo file. if not skip this task128 // - try to get MMcFadcHeader, MGeomCam and MPedestalCam from the parameter129 // list130 // - try to find a MMcRunHeader, too131 //132 Int_t MMcPedestalNSBAdd::PreProcess(MParList *pList)133 {134 fFadc = (MMcFadcHeader*)pList->FindObject("MMcFadcHeader");135 if (!fFadc)136 {137 *fLog << err << dbginf << "MMcFadcHeader not found... aborting." << endl;138 return kFALSE;139 }140 141 fGeom = (MGeomCam*)pList->FindObject("MGeomCam");142 if (!fGeom)143 {144 *fLog << err << dbginf << "MGeomCam not found... aborting." << endl;145 return kFALSE;146 }147 148 fPedCam = (MPedestalCam*)pList->FindCreateObj("MPedestalCam");149 if (!fPedCam)150 return kFALSE;151 152 return kTRUE;153 }154 155 // --------------------------------------------------------------------------156 //157 127 // If a MMcRunHeader is available the DNSB MMcRunHeader::GetNumPheFromDNSB 158 128 // is returned. Otherwise the user given number is used. … … 199 169 Bool_t MMcPedestalNSBAdd::ReInit(MParList *pList) 200 170 { 171 // 172 // If it is no MC file skip this function... 173 // 201 174 if (!CheckRunType(pList)) 202 return kFALSE; 203 175 return kTRUE; 176 177 // 178 // If it is the wrong camera version this algorithm is not needed... 179 // 204 180 if (!CheckCamVersion(pList)) 205 181 return kTRUE; 206 182 183 // 184 // Now check the existance of all necessary containers. This has 185 // to be done only if this is a MC file and the camera version 186 // is correct. 187 // 188 MPedestalCam *pedcam = (MPedestalCam*)pList->FindCreateObj("MPedestalCam"); 189 if (!pedcam) 190 return kFALSE; 191 192 MMcFadcHeader *fadc = (MMcFadcHeader*)pList->FindObject("MMcFadcHeader"); 193 if (!fadc) 194 { 195 *fLog << err << dbginf << "MMcFadcHeader not found... aborting." << endl; 196 return kFALSE; 197 } 198 199 MGeomCam *geom = (MGeomCam*)pList->FindObject("MGeomCam"); 200 if (!geom) 201 { 202 *fLog << err << dbginf << "MGeomCam not found... aborting." << endl; 203 return kFALSE; 204 } 205 207 206 const Float_t dnsbpix = GetDnsb(pList) * 50.0/15.0; 208 207 … … 210 209 return kFALSE; 211 210 212 const int num = fPedCam->GetSize();211 const int num = pedcam->GetSize(); 213 212 214 213 for (int i=0; i<num; i++) 215 214 { 216 MPedestalPix &pix = (* fPedCam)[i];215 MPedestalPix &pix = (*pedcam)[i]; 217 216 218 217 const Float_t pedrms = pix.GetPedestalRms(); 219 const Float_t ratio = fGeom->GetPixRatio(i);220 const Float_t ampl = f Fadc->GetAmplitud();218 const Float_t ratio = geom->GetPixRatio(i); 219 const Float_t ampl = fadc->GetAmplitud(); 221 220 222 221 pix.SetPedestalRms(sqrt(pedrms*pedrms + dnsbpix*ampl*ampl/ratio)); 223 222 } 224 223 225 fPedCam->SetReadyToSave();224 pedcam->SetReadyToSave(); 226 225 227 226 return kTRUE; 228 227 } 229 -
trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.h
r2442 r2454 6 6 #endif 7 7 8 class MMcFadcHeader;9 class MGeomCam;10 class MPedestalCam;11 12 8 class MMcPedestalNSBAdd : public MTask 13 9 { 14 10 private: 15 const MGeomCam *fGeom;16 const MMcFadcHeader *fFadc;17 18 MPedestalCam *fPedCam;19 20 11 Float_t fDnsbPixel; 21 12 … … 25 16 Float_t GetDnsb(MParList *pList) const; 26 17 27 Int_t PreProcess(MParList *pList);28 18 Bool_t ReInit(MParList *pList); 29 30 19 31 20 public: -
trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
r2438 r2454 75 75 #include <TTime.h> // TTime 76 76 #include <TFile.h> // gFile 77 #include <TThread.h> // TThread::Self() 77 78 #include <TDatime.h> // TDatime 78 79 #include <TSystem.h> // gSystem … … 372 373 fProgress->SetPosition(num/fNumEvents); 373 374 374 // 375 // Handle GUI events (display changes) 376 // 375 376 // FIXME: This is a workaround, because TApplication::Run is not 377 // thread safe against ProcessEvents. We assume, that if 378 // we are not in the Main-Thread ProcessEvents() is 379 // called by the TApplication Event Loop... 380 if (!TThread::Self()/*gApplication->InheritsFrom(TRint::Class())*/) 381 { 382 // 383 // Handle GUI events (display changes) 384 // 377 385 #if ROOT_VERSION_CODE < ROOT_VERSION(3,02,06) 378 gSystem->ProcessEvents();386 gSystem->ProcessEvents(); 379 387 #else 380 // FIXME: This is a workaround, because TApplication::Run is not thread safe against ProcessEvents381 if (gApplication->InheritsFrom(TRint::Class()))382 {383 388 if (fDisplay) 384 389 gSystem->ProcessEvents(); … … 386 391 if (fProgress) 387 392 gClient->ProcessEventsFor(fProgress); 388 }389 393 #endif 394 } 390 395 391 396 return rc; … … 485 490 //fProgress->SetPosition(maxcnt>0 ? TMath::Min(maxcnt, entries) : entries); 486 491 fProgress->SetPosition(1); 487 // FIXME: This is a workaround, because TApplication::Run is not thread safe against ProcessEvents 488 if (gApplication->InheritsFrom(TRint::Class())) 492 493 // FIXME: This is a workaround, because TApplication::Run is not 494 // thread safe against ProcessEvents. We assume, that if 495 // we are not in the Main-Thread ProcessEvents() is 496 // called by the TApplication Event Loop... 497 if (!TThread::Self()/*gApplication->InheritsFrom(TRint::Class())*/) 489 498 { 490 499 #if ROOT_VERSION_CODE < ROOT_VERSION(3,02,06) -
trunk/MagicSoft/Mars/mbase/MTask.h
r2206 r2454 71 71 virtual void PrintStatistics(const Int_t lvl=0, Bool_t title=kFALSE) const; 72 72 73 UInt_t GetNumExecutions() { return fNumExecutions; }73 UInt_t GetNumExecutions() const { return fNumExecutions; } 74 74 75 75 virtual Bool_t ReInit(MParList *pList); -
trunk/MagicSoft/Mars/mbase/MTaskList.cc
r2206 r2454 308 308 if (!task->ReInit(pList?pList:fParList)) 309 309 { 310 *fLog << err << "ERROR - ReInit if Task " << task->GetDescriptor() << "failed." << endl;310 *fLog << err << "ERROR - ReInit of Task '" << task->GetDescriptor() << "' failed." << endl; 311 311 return kFALSE; 312 312 } -
trunk/MagicSoft/Mars/mimage/MHillasCalc.cc
r2440 r2454 173 173 // -------------------------------------------------------------------------- 174 174 // 175 // This is used to print the output in the PostProcess. Later (having 176 // millions of events) we may want to improve the output. 177 // 178 void MHillasCalc::PrintSkipped(int i, const char *str) const 179 { 180 *fLog << " " << setw(7) << fErrors[i] << " ("; 181 *fLog << setw(3) << (int)(100.*fErrors[i]/GetNumExecutions()); 182 *fLog << "%) Evts skipped due to: " << str << endl; 183 } 184 185 // -------------------------------------------------------------------------- 186 // 175 187 // Prints some statistics about the hillas calculation. The percentage 176 188 // is calculated with respect to the number of executions of this task. … … 184 196 *fLog << GetDescriptor() << " execution statistics:" << endl; 185 197 *fLog << dec << setfill(' '); 186 *fLog << " " << setw(7) << fErrors[1] << " (" << setw(3) << (int)(fErrors[1]*100/GetNumExecutions()) << "%) Evts skipped due to: Event has less than 3 pixels" << endl;187 *fLog << " " << setw(7) << fErrors[2] << " (" << setw(3) << (int)(fErrors[2]*100/GetNumExecutions()) << "%) Evts skipped due to: Calculated Size == 0" << endl;188 *fLog << " " << setw(7) << fErrors[3] << " (" << setw(3) << (int)(fErrors[3]*100/GetNumExecutions()) << "%) Evts skipped due to: Number of used pixels < 3" << endl;189 *fLog << " " << setw(7) << fErrors[4] << " (" << setw(3) << (int)(fErrors[4]*100/GetNumExecutions()) << "%) Evts skipped due to: CorrXY==0" << endl;190 *fLog << " " << fErrors[0] << " (" << (int)(fErrors[0]*100/GetNumExecutions()) << "%) Evts survived Hillas calculation!" << endl;198 PrintSkipped(1, "Event has less than 3 pixels"); 199 PrintSkipped(2, "Calculated Size == 0"); 200 PrintSkipped(3, "Number of used pixels < 3"); 201 PrintSkipped(4, "CorrXY==0"); 202 *fLog << " " << (int)fErrors[0] << " (" << (int)(100.*fErrors[0]/GetNumExecutions()) << "%) Evts survived Hillas calculation!" << endl; 191 203 *fLog << endl; 192 204
Note:
See TracChangeset
for help on using the changeset viewer.