Changeset 5660 for trunk/MagicSoft/Mars/mcalib
- Timestamp:
- 12/21/04 17:53:27 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mcalib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mcalib/MCalibrationIntensityChargeCam.cc
r5659 r5660 507 507 508 508 509 // -------------------------------------------------------------------- 510 // 511 // Returns the number of camera entries matching the required colour 512 // and the requirement that pixel "pixid" has been correctly calibrated 513 // 509 514 Int_t MCalibrationIntensityChargeCam::CountNumValidEntries(const UInt_t pixid, const MCalibrationCam::PulserColor_t col) const 510 515 { -
trunk/MagicSoft/Mars/mcalib/MCalibrationIntensityRelTimeCam.cc
r5046 r5660 40 40 #include "MCalibrationIntensityRelTimeCam.h" 41 41 #include "MCalibrationRelTimeCam.h" 42 #include "MCalibrationChargeCam.h" 43 #include "MCalibrationRelTimePix.h" 44 #include "MCalibrationChargePix.h" 45 46 #include "MGeomCam.h" 47 #include "MGeomPix.h" 48 49 #include "MLogManip.h" 42 50 43 51 #include <TOrdCollection.h> 52 #include <TGraphErrors.h> 44 53 45 54 ClassImp(MCalibrationIntensityRelTimeCam); … … 70 79 } 71 80 81 TGraphErrors *MCalibrationIntensityRelTimeCam::GetTimeResVsCharge( const UInt_t pixid, const MCalibrationIntensityChargeCam &chargecam, 82 const MCalibrationCam::PulserColor_t col) 83 { 84 85 if (chargecam.GetSize() != GetSize()) 86 { 87 *fLog << err << GetDescriptor() << ": Size mismatch between MCalibrationIntensityRelTimeCam " 88 << "and MCalibrationIntensityChargeCam. " << endl; 89 return NULL; 90 } 91 92 Int_t size = CountNumEntries(col); 93 94 if (size == 0) 95 return NULL; 96 97 if (size != chargecam.CountNumEntries(col)) 98 { 99 *fLog << err << GetDescriptor() << ": Size mismatch in colour between MCalibrationIntensityRelTimeCam " 100 << "and MCalibrationIntensityChargeCam. " << endl; 101 return NULL; 102 } 103 104 const Int_t nvalid = chargecam.CountNumValidEntries(pixid,col); 105 106 if (nvalid == 0) 107 { 108 *fLog << err << GetDescriptor() << ": Only un-calibrated events in pixel: " << pixid << endl; 109 return NULL; 110 } 111 112 TArrayF res(nvalid); 113 TArrayF reserr(nvalid); 114 TArrayF sig(nvalid); 115 TArrayF sigerr(nvalid); 116 117 const Float_t sqrt2 = 1.414; 118 const Float_t fadc2ns = 3.333; 119 120 Int_t cnt = 0; 121 122 for (Int_t i=0;i<GetSize();i++) 123 { 124 // 125 // Get the calibration cam from the intensity cam 126 // 127 MCalibrationChargeCam *cam = (MCalibrationChargeCam*)chargecam.GetCam(i); 128 MCalibrationRelTimeCam *relcam = (MCalibrationRelTimeCam*)GetCam(i); 129 130 if (col != MCalibrationCam::kNONE) 131 if (relcam->GetPulserColor() != col) 132 continue; 133 // 134 // Get the calibration pix from the calibration cam 135 // 136 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*cam)[pixid]; 137 MCalibrationRelTimePix &relpix = (MCalibrationRelTimePix&)(*relcam)[pixid]; 138 // 139 // Don't use bad pixels 140 // 141 if (!pix.IsFFactorMethodValid()) 142 continue; 143 // 144 res[cnt] = relpix.GetTimePrecision() / sqrt2 * fadc2ns; 145 reserr[cnt] = relpix.GetTimePrecisionErr() / sqrt2 * fadc2ns; 146 // 147 sig [cnt] = pix.GetPheFFactorMethod(); 148 sigerr[cnt] = pix.GetPheFFactorMethodErr(); 149 cnt++; 150 } 151 152 TGraphErrors *gr = new TGraphErrors(nvalid, 153 sig.GetArray(),res.GetArray(), 154 sigerr.GetArray(),reserr.GetArray()); 155 gr->SetTitle(Form("%s%3i","Pixel ",pixid)); 156 gr->GetXaxis()->SetTitle("<Photo-electrons> [1]"); 157 gr->GetYaxis()->SetTitle("Time Resolution [ns]"); 158 return gr; 159 } 160 161 162 TGraphErrors *MCalibrationIntensityRelTimeCam::GetTimeResVsChargePerArea( const Int_t aidx,const MCalibrationIntensityChargeCam &chargecam, const MGeomCam &geom, const MCalibrationCam::PulserColor_t col) 163 { 164 165 Int_t size = CountNumEntries(col); 166 167 if (size == 0) 168 return NULL; 169 170 if (size != chargecam.CountNumEntries(col)) 171 { 172 *fLog << err << GetDescriptor() << ": Size mismatch in colour between MCalibrationIntensityRelTimeCam " 173 << "and MCalibrationIntensityChargeCam. " << endl; 174 return NULL; 175 } 176 177 const Float_t sqrt2 = 1.414; 178 const Float_t fadc2ns = 3.333; 179 180 TArrayF res(size); 181 TArrayF reserr(size); 182 TArrayF sig(size); 183 TArrayF sigerr(size); 184 185 Int_t cnt = 0; 186 187 for (Int_t i=0;i<GetSize();i++) 188 { 189 // 190 // Get the calibration cam from the intensity cam 191 // 192 MCalibrationRelTimeCam *relcam = (MCalibrationRelTimeCam*)GetCam(i); 193 MCalibrationChargeCam *cam = (MCalibrationChargeCam*)chargecam.GetCam(i); 194 195 if (col != MCalibrationCam::kNONE) 196 if (relcam->GetPulserColor() != col) 197 continue; 198 199 const MCalibrationChargePix &apix = (MCalibrationChargePix&)cam->GetAverageArea(aidx); 200 const Float_t phe = apix.GetPheFFactorMethod(); 201 const Float_t pheerr = apix.GetPheFFactorMethodErr(); 202 203 sig[cnt] = phe; 204 sigerr[cnt] = pheerr; 205 206 Double_t resol = 0.; 207 Double_t resol2 = 0.; 208 Double_t var = 0.; 209 Int_t num = 0; 210 // 211 // Get the area calibration pix from the calibration cam 212 // 213 for (Int_t i=0; i<cam->GetSize(); i++) 214 { 215 const MCalibrationChargePix &pix = (MCalibrationChargePix&)(*cam)[i]; 216 const MCalibrationRelTimePix &relpix = (MCalibrationRelTimePix&)(*relcam)[i]; 217 // 218 // Don't use bad pixels 219 // 220 if (!pix.IsFFactorMethodValid()) 221 continue; 222 // 223 // 224 if (aidx != geom[i].GetAidx()) 225 continue; 226 227 resol += relpix.GetTimePrecision(); 228 resol2 += relpix.GetTimePrecision()*relpix.GetTimePrecision(); 229 num++; 230 } 231 232 if (num > 1) 233 { 234 resol /= num; 235 var = (resol2 - resol*resol*num) / (num-1); 236 237 res[cnt] = resol * fadc2ns / sqrt2; 238 if (var > 0.) 239 reserr[cnt] = TMath::Sqrt(var)/ sqrt2 * fadc2ns; 240 else 241 reserr[cnt] = 0.; 242 } 243 else 244 { 245 res[cnt] = -1.; 246 reserr[cnt] = 0.; 247 } 248 cnt++; 249 } 250 251 TGraphErrors *gr = new TGraphErrors(size, 252 sig.GetArray(),res.GetArray(), 253 sigerr.GetArray(),reserr.GetArray()); 254 gr->SetTitle(Form("%s%3i","Area Index ",aidx)); 255 gr->GetXaxis()->SetTitle("<phes> [1]"); 256 gr->GetYaxis()->SetTitle("Time Resolution [ns]"); 257 return gr; 258 } -
trunk/MagicSoft/Mars/mcalib/MCalibrationIntensityRelTimeCam.h
r5046 r5660 6 6 #endif 7 7 8 #ifndef MARS_MCalibrationIntensityChargeCam 9 #include "MCalibrationIntensityChargeCam.h" 10 #endif 11 12 class TGraphErrors; 8 13 class MCalibrationIntensityRelTimeCam : public MCalibrationIntensityCam 9 14 { … … 16 21 MCalibrationIntensityRelTimeCam(const char *name=NULL, const char *title=NULL); 17 22 23 TGraphErrors *GetTimeResVsCharge( const UInt_t pixid, const MCalibrationIntensityChargeCam &chargecam, 24 const MCalibrationCam::PulserColor_t col=MCalibrationCam::kNONE); 25 TGraphErrors *GetTimeResVsChargePerArea( const Int_t aidx, const MCalibrationIntensityChargeCam &chargecam, 26 const MGeomCam &geom, 27 const MCalibrationCam::PulserColor_t col=MCalibrationCam::kNONE); 28 18 29 ClassDef(MCalibrationIntensityRelTimeCam, 1) // Container Intensity Rel.Times Calibration Results Camera 19 30 };
Note:
See TracChangeset
for help on using the changeset viewer.