Changeset 9330 for trunk/MagicSoft/Mars/mpedestal/MMcPedestalCopy.cc
- Timestamp:
- 02/12/09 21:04:43 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mpedestal/MMcPedestalCopy.cc
r8274 r9330 73 73 // -------------------------------------------------------------------------- 74 74 // 75 // Check for the run type. Return kTRUE if it is a MC run or if there76 // is no MC run header (old camera files) kFALSE in case of a different77 // run type78 //79 Bool_t MMcPedestalCopy::CheckRunType(MParList *pList) const80 {81 const MRawRunHeader *run = (MRawRunHeader*)pList->FindObject(AddSerialNumber("MRawRunHeader"));82 if (!run)83 {84 *fLog << warn << dbginf << "Warning - cannot check file type, "85 << AddSerialNumber("MRawRunHeader") << " not found." << endl;86 return kTRUE;87 }88 89 return run->IsMonteCarloRun();90 }91 92 // --------------------------------------------------------------------------93 //94 75 // Make sure that there is a MPedestalCam object in the parameter list. 95 76 // … … 106 87 Bool_t MMcPedestalCopy::ReInit(MParList *pList) 107 88 { 89 const MRawRunHeader *run = (MRawRunHeader*)pList->FindObject(AddSerialNumber("MRawRunHeader")); 90 if (!run) 91 { 92 *fLog << warn << dbginf << "Warning - cannot check file type, " << AddSerialNumber("MRawRunHeader") << " not found." << endl; 93 return kTRUE; 94 } 95 108 96 // 109 97 // If it is no MC file skip this function... 110 98 // 111 if (! CheckRunType(pList))112 113 99 if (!run->IsMonteCarloRun()) 100 { 101 *fLog << inf << "This is no MC file... skipping." << endl; 114 102 return kTRUE; 115 } 103 } 104 105 MPedestalCam *pedcam = (MPedestalCam*)pList->FindObject(AddSerialNumber("MPedestalCam")); 106 if (!pedcam) 107 { 108 *fLog << err << "MPedestalCam not found... aborting." << endl; 109 return kFALSE; 110 } 111 112 // Get MMcRunHeader to check camera version 113 MMcRunHeader *mcrun = (MMcRunHeader*)pList->FindObject(AddSerialNumber("MMcRunHeader")); 114 115 // Check if it is a ceres file 116 if (mcrun && mcrun->GetCamVersion()==UShort_t(-1)) 117 { 118 *fLog << inf << "This is a ceres file... subtracting Baseline from ElectronicNoise [MPedestalCam]." << endl; 119 120 MPedestalCam *noise = (MPedestalCam*)pList->FindObject(AddSerialNumber("ElectronicNoise"), "MPedestalCam"); 121 if (!noise) 122 { 123 *fLog << err << "ElectronicNoise [MPedestalCam] not found... aborting." << endl; 124 return kFALSE; 125 } 126 127 const int num = pedcam->GetSize(); 128 for (int i=0; i<num; i++) 129 { 130 const MPedestalPix &n = (*noise)[i]; 131 132 (*pedcam)[i].Set(n.GetPedestal()/run->GetScale(), 133 n.GetPedestalRms()/run->GetScale()); 134 } 135 136 pedcam->SetReadyToSave(); 137 138 return kTRUE; 139 } 116 140 117 141 // … … 126 150 } 127 151 128 MPedestalCam *pedcam = (MPedestalCam*)pList->FindObject(AddSerialNumber("MPedestalCam"));129 if (!pedcam)130 {131 *fLog << err << "MPedestalCam not found... aborting." << endl;132 return kFALSE;133 }134 135 MMcRunHeader *mcrun = (MMcRunHeader*)pList->FindObject(AddSerialNumber("MMcRunHeader"));136 152 if (!mcrun) 137 *fLog << warn << dbginf << AddSerialNumber("MMcRunHeader") 138 << " not found... assuming camera<0.7" << endl; 139 140 const int num = pedcam->GetSize(); 153 *fLog << warn << dbginf << AddSerialNumber("MMcRunHeader") << " not found... assuming camera<0.7" << endl; 141 154 142 155 const Bool_t camver70 = mcrun && mcrun->GetCamVersion()>=70; 143 156 157 const int num = pedcam->GetSize(); 144 158 for (int i=0; i<num; i++) 145 159 { 146 MPedestalPix &pix = (*pedcam)[i];147 148 160 // Here one should compute the Pedestal taking into account how 149 161 // the MC makes the transformation analogic-digital for the FADC. 150 162 // This is done only once per file -> not time critical. 151 152 163 const Float_t pedest = fadc->GetPedestal(i); 153 164 const Float_t sigma = camver70 ? fadc->GetPedestalRmsHigh(i) : fadc->GetElecNoise(i); 154 165 155 pix.Set(pedest, sigma); 156 166 (*pedcam)[i].Set(pedest/run->GetScale(), sigma/run->GetScale()); 157 167 } 158 168
Note:
See TracChangeset
for help on using the changeset viewer.