Changeset 1132
- Timestamp:
- 12/19/01 15:44:07 (23 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 1 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r1130 r1132 1 1 -*-*- END -*-*- 2 2001/12/19: Thomas Bretz 3 4 * mbase/MEvtLoop.cc: 5 - added #ifdef directive to make it work on older root also 6 7 * mbase/MReadTree.cc: 8 - added #ifdef directive to get rid of the memory leak in prior 9 root 3.02/* versions 10 11 * macros/MagicHillas.C, macros/readMagic.C, meventdisp/MGCamDisplay.cc, 12 mmain/MAnalysis.cc: 13 - changes MMcPedestalNSB to MMcPedestalNSBAdd 14 15 * manalysis/MMcPedestalCopy.[h,cc], manalysis/MMcPedestalNSBAdd.[h,cc]: 16 - reorganized ReInit, PreProcess. 17 - moved some code from ReInit to PreProcess to make the code 18 simpler. At the moment we don't intend to change the 19 objects in the parlist while runtime. 20 21 * manalysis/MMcPedestalNSB.[h,cc]: 22 - removed 23 24 * mbase/MReadMarsFile.cc: 25 - read the first run header twice. To make it available in the 26 PreProcess of all tasks 27 28 * mbase/MTaskList.cc: 29 - fixed a bug in the ReInit function. The ReInits where calles with 30 a NULL-pointer 31 32 33 2 34 2001/12/18: Oscar Blanch 3 35 … … 26 58 - remove fNumLoGainFadcSlices and fNumHiGainFadcSlices members 27 59 - fix bug of Pedestal and Pedestal fluctuaions correspondence. 28 29 2001/12/19: Thomas Bretz30 31 * mbase/MEvtLoop.cc:32 - added #ifdef directive to make it work on older root also33 34 * mbase/MReadTree.cc:35 - added #ifdef directive to get rid of the memory leak in prior36 root 3.02/* versions37 60 38 61 -
trunk/MagicSoft/Mars/manalysis/MMcPedestalCopy.h
r1124 r1132 23 23 class MMcPedestalCopy : public MTask 24 24 { 25 private: 26 const MMcFadcHeader *fMcPed; 27 MPedestalCam *fPedCam; 28 29 Bool_t CheckRunType(MParList *pList) const; 30 25 31 public: 26 32 MMcPedestalCopy(const char *name=NULL, const char *title=NULL); -
trunk/MagicSoft/Mars/manalysis/MMcPedestalNSB.h
r1098 r1132 27 27 const char *name=NULL, const char *title=NULL); 28 28 29 Bool_t PreProcess(MParList *pList);29 Bool_t ReInit(MParList *pList); 30 30 31 31 ClassDef(MMcPedestalNSB, 0) // Task which adds the NSB fluctuations to the pedestals rms -
trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.cc
r1130 r1132 71 71 // 72 72 MMcPedestalNSBAdd::MMcPedestalNSBAdd(const Float_t difnsb, 73 const char *name, const char *title) 73 const char *name, const char *title) 74 : fDnsbPixel(difnsb) 74 75 { 75 76 fName = name ? name : "MMcPedestalNSBAdd"; … … 82 83 AddToBranchList("fPedesMean"); 83 84 AddToBranchList("fElecNoise"); 84 85 fDnsbPixel=difnsb; 85 } 86 87 Bool_t MMcPedestalNSBAdd::CheckRunType(MParList *pList) const 88 { 89 MRawRunHeader *runheader = (MRawRunHeader*)pList->FindObject("MRawRunHeader"); 90 if (!runheader) 91 { 92 *fLog << warn << dbginf << "Warning - cannot check file type, MRawRunHeader not found." << endl; 93 return kTRUE; 94 } 95 96 return runheader->GetRunType() == kRTMonteCarlo; 86 97 } 87 98 … … 97 108 // implemented then this line should be removed. 98 109 99 ReInit(pList); 110 if (!CheckRunType(pList)) 111 { 112 *fLog << warn << dbginf << "Warning - MMcPedestalNSB is for Monte Carlo files only... removing this task from list." << endl; 113 return kSKIP; 114 } 115 116 fFadc = (MMcFadcHeader*)pList->FindObject("MMcFadcHeader"); 117 if (!fFadc) 118 { 119 *fLog << err << dbginf << "MMcFadcHeader not found... aborting." << endl; 120 return kFALSE; 121 } 122 123 fGeom = (MGeomCam*)pList->FindObject("MGeomCam"); 124 if (!fGeom) 125 { 126 *fLog << err << dbginf << "MGeomCam not found... aborting." << endl; 127 return kFALSE; 128 } 129 130 fPedCam = (MPedestalCam*)pList->FindCreateObj("MPedestalCam"); 131 if (!fPedCam) 132 return kFALSE; 133 134 MMcRunHeader *mcrunheader = (MMcRunHeader*)pList->FindObject("MMcRunHeader"); 135 if (!mcrunheader && fDnsbPixel < 0 ) 136 { 137 *fLog << err << dbginf << "Using the default argument of MMcPedestalNSB::MMcPedestalNSB() "; 138 *fLog << "only allowed if MMcRunHeader is available... aborting." << endl; 139 return kFALSE; 140 } 100 141 101 142 return kTRUE; … … 117 158 // - MPedestalCam 118 159 // 119 Bool_t MMcPedestalNSBAdd::ReInit(MParList *pList) 120 { 121 122 MRawRunHeader *runheader = (MRawRunHeader*)pList->FindObject("MRawRunHeader"); 123 if (runheader) 124 { 125 if (runheader->GetRunType() != kRTMonteCarlo) 126 { 127 *fLog << warn << dbginf << "Warning - MMcPedestalNSB is for Monte Carlo files only... removing this task from list." << endl; 128 return kSKIP; 129 } 130 } 131 else 132 *fLog << warn << dbginf << "Warning - cannot check file type, MRawRunHeader not found." << endl; 133 134 135 MMcFadcHeader *fadc = (MMcFadcHeader*)pList->FindObject("MMcFadcHeader"); 136 if (!fadc) 137 { 138 *fLog << err << dbginf << "MMcFadcHeader not found... aborting." << endl; 139 return kFALSE; 140 } 141 142 160 Float_t MMcPedestalNSBAdd::GetDnsb(MParList *pList) const 161 { 143 162 MMcRunHeader *mcrunheader = (MMcRunHeader*)pList->FindObject("MMcRunHeader"); 144 163 if (!mcrunheader && fDnsbPixel < 0 ) … … 146 165 *fLog << err << dbginf << "Using the default argument of MMcPedestalNSB::MMcPedestalNSB() "; 147 166 *fLog << "only allowed if MMcRunHeader is available... aborting." << endl; 167 return -1; 168 } 169 170 if (!mcrunheader) 171 return fDnsbPixel; 172 173 if (fDnsbPixel >= 0 && fDnsbPixel != mcrunheader->GetNumPheFromDNSB()) 174 { 175 *fLog << warn << dbginf << "The MC file has been generated with diffuse nsb " << mcrunheader->GetNumPheFromDNSB(); 176 *fLog <<" but you set up the diffuse NSB to " << fDnsbPixel << endl; 177 178 return fDnsbPixel; 179 } 180 181 return mcrunheader->GetNumPheFromDNSB(); 182 } 183 184 Bool_t MMcPedestalNSBAdd::ReInit(MParList *pList) 185 { 186 if (!CheckRunType(pList)) 148 187 return kFALSE; 149 } 150 151 if (mcrunheader) 152 { 153 if (fDnsbPixel >= 0 && fDnsbPixel != mcrunheader->GetNumPheFromDNSB()) 154 { 155 *fLog << warn << dbginf << "The MC file has been generated with diffuse nsb " << mcrunheader->GetNumPheFromDNSB(); 156 *fLog <<" but you set up the diffuse NSB to " << fDnsbPixel << endl; 157 } 158 else 159 fDnsbPixel = mcrunheader->GetNumPheFromDNSB(); 160 } 161 162 fDnsbPixel *= 50.0/15.0; 163 164 165 MGeomCam *geometry = (MGeomCam*)pList->FindObject("MGeomCam"); 166 if (!geometry) 167 { 168 *fLog << err << dbginf << "MGeomCam not found... aborting." << endl; 169 return kFALSE; 170 } 171 172 173 MPedestalCam *pedestals = (MPedestalCam*)pList->FindCreateObj("MPedestalCam"); 174 if (!pedestals) 175 return kFALSE; 176 177 178 const int num = fadc->GetNumPixel(); 188 189 Float_t dnsbpix = GetDnsb(pList) * 50.0/15.0; 190 191 if (dnsbpix < 0) 192 return kFALSE; 193 194 const int num = fFadc->GetNumPixel(); 179 195 180 pedestals->InitSize(num);181 182 const Float_t size0 = (* geometry)[0].GetR()*(*geometry)[0].GetR();196 fPedCam->InitSize(num); 197 198 const Float_t size0 = (*fGeom)[0].GetR() * (*fGeom)[0].GetR(); 183 199 184 200 for (int i=0; i<num; i++) 185 201 { 186 MPedestalPix &pix = (* pedestals)[i];187 MGeomPix &pixgeom = (* geometry)[i];202 MPedestalPix &pix = (*fPedCam)[i]; 203 MGeomPix &pixgeom = (*fGeom)[i]; 188 204 189 205 const Float_t pedrms = pix.GetSigma(); 190 206 const Float_t size = pixgeom.GetR()*pixgeom.GetR()/size0; 191 207 192 const Float_t ampl = f adc->GetAmplitud();193 194 pix.SetSigma(sqrt(pedrms*pedrms + fDnsbPixel*ampl*ampl*size));208 const Float_t ampl = fFadc->GetAmplitud(); 209 210 pix.SetSigma(sqrt(pedrms*pedrms + dnsbpix*ampl*ampl*size)); 195 211 } 196 212 -
trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.h
r1126 r1132 16 16 17 17 class MMcFadcHeader; 18 class MGeomCam; 18 19 class MPedestalCam; 19 class MRawRunHeader;20 class MMcRunHeader;21 20 22 21 class MMcPedestalNSBAdd : public MTask 23 22 { 23 private: 24 MMcFadcHeader *fFadc; 25 const MGeomCam *fGeom; 26 MPedestalCam *fPedCam; 24 27 25 28 Float_t fDnsbPixel; 26 29 30 Bool_t CheckRunType(MParList *pList) const; 31 Float_t GetDnsb(MParList *pList) const; 32 27 33 public: 28 34 MMcPedestalNSBAdd(const Float_t difnsb = -1.0, 29 35 const char *name=NULL, const char *title=NULL); 30 36 31 37 Bool_t PreProcess(MParList *pList); -
trunk/MagicSoft/Mars/mbase/MReadMarsFile.cc
r1114 r1132 138 138 return kFALSE; 139 139 140 if (!fRun->Process()) 141 return kFALSE; 142 143 fRun->SetEventNum(0); 144 140 145 return MReadTree::PreProcess(pList); 141 146 } -
trunk/MagicSoft/Mars/mbase/MTaskList.cc
r1118 r1132 234 234 *fLog << all << task->GetName() << "... " << flush; 235 235 236 if (!task->ReInit(pList? fParList:pList))236 if (!task->ReInit(pList?pList:fParList)) 237 237 return kFALSE; 238 238 } -
trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.cc
r1102 r1132 25 25 #include "MGCamDisplay.h" 26 26 27 #include <TList.h> // TList::Add28 #include <TCanvas.h> // TCanvas::cd29 #include <TGButton.h> // TGPictureButton30 #include <TGButtonGroup.h> // TGVButtonGroup31 32 #include "MGTask.h" // MGTask::CreateGui33 #include "MClone.h" // MClone34 #include "MHillas.h" // MHillas35 #include "MParList.h" // MParList::AddToList36 #include "MEvtLoop.h" // MEvtLoop::GetParList37 #include "MTaskList.h" // MTaskList::AddToList38 #include "MCamDisplay.h" // MCamDisplay39 #include "MHillasCalc.h" // MHillasCalc40 #include "MPedestalCam.h" // MPedestalCam41 #include "MCerPhotCalc.h" // MCerPhotCalc42 #include "MMcPedestalCopy.h" // MMcPedestalCopy43 #include "MMcPedestalNSB .h" // MMcPedestalNSB44 #include "MImgCleanStd.h" // MImgCleanStd45 #include "MGeomCamMagic.h" // MGeomMagicCam27 #include <TList.h> // TList::Add 28 #include <TCanvas.h> // TCanvas::cd 29 #include <TGButton.h> // TGPictureButton 30 #include <TGButtonGroup.h> // TGVButtonGroup 31 32 #include "MGTask.h" // MGTask::CreateGui 33 #include "MClone.h" // MClone 34 #include "MHillas.h" // MHillas 35 #include "MParList.h" // MParList::AddToList 36 #include "MEvtLoop.h" // MEvtLoop::GetParList 37 #include "MTaskList.h" // MTaskList::AddToList 38 #include "MCamDisplay.h" // MCamDisplay 39 #include "MHillasCalc.h" // MHillasCalc 40 #include "MPedestalCam.h" // MPedestalCam 41 #include "MCerPhotCalc.h" // MCerPhotCalc 42 #include "MMcPedestalCopy.h" // MMcPedestalCopy 43 #include "MMcPedestalNSBAdd.h" // MMcPedestalNSBAdd 44 #include "MImgCleanStd.h" // MImgCleanStd 45 #include "MGeomCamMagic.h" // MGeomMagicCam 46 46 47 47 ClassImp(MGCamDisplay); … … 115 115 MParList *plist = GetParList(); 116 116 117 MMcPedestalCopy *pcopy = new MMcPedestalCopy;118 MMcPedestalNSB *pdnsb = new MMcPedestalNSB;119 MCerPhotCalc *ncalc = new MCerPhotCalc;120 MClone *clone = new MClone("MCerPhotEvt");121 MImgCleanStd *clean = new MImgCleanStd;122 MHillasCalc *hcalc = new MHillasCalc;117 MMcPedestalCopy *pcopy = new MMcPedestalCopy; 118 MMcPedestalNSBAdd *pdnsb = new MMcPedestalNSBAdd; 119 MCerPhotCalc *ncalc = new MCerPhotCalc; 120 MClone *clone = new MClone("MCerPhotEvt"); 121 MImgCleanStd *clean = new MImgCleanStd; 122 MHillasCalc *hcalc = new MHillasCalc; 123 123 124 124 tlist->AddToList(pcopy); -
trunk/MagicSoft/Mars/mmain/MAnalysis.cc
r1103 r1132 126 126 #include "MHStarMap.h" 127 127 #include "MReadMarsFile.h" 128 #include "MMcPedestalCopy.h" // MMcPedestalCopy129 #include "MMcPedestalNSB .h" // MMcPedestalNSB128 #include "MMcPedestalCopy.h" // MMcPedestalCopy 129 #include "MMcPedestalNSBAdd.h" // MMcPedestalNSB 130 130 #include "MCerPhotCalc.h" 131 131 #include "MImgCleanStd.h" … … 181 181 MReadMarsFile read("Events", fInputFile); 182 182 183 MMcPedestalCopy pcopy;184 MMcPedestalNSB pdnsb;185 MCerPhotCalc ncalc;186 MHillasCalc hcalc;183 MMcPedestalCopy pcopy; 184 MMcPedestalNSBAdd pdnsb; 185 MCerPhotCalc ncalc; 186 MHillasCalc hcalc; 187 187 188 188 tlist.AddToList(&read);
Note:
See TracChangeset
for help on using the changeset viewer.