Changeset 3624 for trunk/MagicSoft
- Timestamp:
- 04/01/04 14:52:32 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r3622 r3624 19 19 -*-*- END OF LINE -*-*- 20 20 21 22 2004/04/01: Markus Gaug 23 24 * mcalib/MHCalibrationChargeCam.[h,cc] 25 * mcalib/MCalibrationChargeCam.[h,cc] 26 * mcalib/MCalibrationChargeCalc.cc 27 * manalysis/MGeomApply.cc 28 - add average pixels per sector 21 29 22 30 2004/03/31: Markus Gaug -
trunk/MagicSoft/Mars/macros/calibration.C
r3606 r3624 27 27 { 28 28 29 const TString inpath = "/home/rootdata/BlindPixel/"; 29 // const TString inpath = "/mnt/Data/rootdata/CrabNebula/2004_01_27/"; 30 const TString inpath = "/mnt/Data/rootdata/Miscellaneous/2004_03_03/"; 31 // const TString inpath = "/home/rootdata/BlindPixel/"; 30 32 31 33 MRunIter pruns; 32 34 MRunIter cruns; 33 35 34 pruns.AddRun(22007,inpath); 35 cruns.AddRun(22006,inpath); 36 pruns.AddRun(20132,inpath); 37 cruns.AddRun(20134,inpath); 38 // cruns.AddRun(16774,inpath); 36 39 37 40 gStyle->SetOptStat(1111); … … 204 207 // 205 208 // histblind.DrawClone("all"); 206 // histcharge[ 555].DrawClone("all");209 // histcharge[400].DrawClone("all"); 207 210 // histcharge(5).DrawClone("all"); 208 211 // histtime[5].DrawClone("fourierevents"); 209 212 for (Int_t aidx=0;aidx<2;aidx++) 213 { 214 histcharge.GetAverageHiGainArea(aidx).DrawClone("all"); 215 histcharge.GetAverageLoGainArea(aidx).DrawClone("all"); 216 } 217 218 for (Int_t sector=1;sector<7;sector++) 219 { 220 histcharge.GetAverageHiGainSector(sector).DrawClone("all"); 221 histcharge.GetAverageLoGainSector(sector).DrawClone("all"); 222 } 223 224 210 225 // Create histograms to display 211 226 MHCamera disp1 (geomcam, "Cal;Charge", "Fitted Mean Charges"); -
trunk/MagicSoft/Mars/manalysis/MGeomApply.cc
r3622 r3624 138 138 { 139 139 cal->InitSize(cam->GetNumPixels()); 140 cal->InitAverageSize(cam->GetNumAreas()); 140 cal->InitAverageAreas(cam->GetNumAreas()); 141 cal->InitAverageSectors(cam->GetNumSectors()); 141 142 } 142 143 -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
r3622 r3624 642 642 { 643 643 644 FinalizeAvPedestals(fCam->GetAveragePix(aidx), avinnerped, avinnerprms,avinnernum); 645 FinalizeCharges(fCam->GetAveragePix(aidx),fCam->GetAverageBadPix(aidx)); 644 FinalizeAvPedestals(fCam->GetAverageArea(aidx), avinnerped, avinnerprms,avinnernum); 645 FinalizeCharges(fCam->GetAverageArea(aidx),fCam->GetAverageBadArea(aidx)); 646 } 647 648 for (UInt_t sector=0; sector<fGeom->GetNumSectors(); sector++) 649 { 650 651 FinalizeAvPedestals(fCam->GetAverageSector(sector), avinnerped, avinnerprms,avinnernum); 652 FinalizeCharges(fCam->GetAverageSector(sector),fCam->GetAverageBadSector(sector)); 646 653 } 647 654 … … 709 716 710 717 fCam->SetReadyToSave(); 718 719 *fLog << err << "Sectors: " << fGeom->GetNumSectors() << endl; 711 720 712 721 *fLog << inf << endl; -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.cc
r3622 r3624 151 151 152 152 fPixels = new TClonesArray("MCalibrationChargePix",1); 153 fAveragePixels = new TClonesArray("MCalibrationChargePix",1); 154 fAverageBadPixels = new TClonesArray("MBadPixelsPix",1); 153 fAverageAreas = new TClonesArray("MCalibrationChargePix",1); 154 fAverageBadAreas = new TClonesArray("MBadPixelsPix",1); 155 fAverageSectors = new TClonesArray("MCalibrationChargePix",1); 156 fAverageBadSectors = new TClonesArray("MBadPixelsPix",1); 155 157 156 158 Clear(); … … 175 177 // 176 178 delete fPixels; 177 delete fAveragePixels; 178 delete fAverageBadPixels; 179 delete fAverageAreas; 180 delete fAverageBadAreas; 181 delete fAverageSectors; 182 delete fAverageBadSectors; 183 179 184 180 185 if (fOffsets) … … 200 205 } 201 206 202 void MCalibrationChargeCam::InitAverageSize(const UInt_t i) 203 { 204 fAveragePixels->ExpandCreate(i); 205 fAverageBadPixels->ExpandCreate(i); 207 void MCalibrationChargeCam::InitAverageAreas(const UInt_t i) 208 { 209 fAverageAreas->ExpandCreate(i); 210 fAverageBadAreas->ExpandCreate(i); 211 } 212 213 void MCalibrationChargeCam::InitAverageSectors(const UInt_t i) 214 { 215 fAverageSectors->ExpandCreate(i); 216 fAverageBadSectors->ExpandCreate(i); 206 217 } 207 218 … … 220 231 } 221 232 222 Int_t MCalibrationChargeCam::GetAverageSize() const 223 { 224 return fAveragePixels->GetEntriesFast(); 233 Int_t MCalibrationChargeCam::GetAverageAreas() const 234 { 235 return fAverageAreas->GetEntriesFast(); 236 } 237 238 Int_t MCalibrationChargeCam::GetAverageSectors() const 239 { 240 return fAverageSectors->GetEntriesFast(); 225 241 } 226 242 … … 248 264 // Get i-th average pixel (area number) 249 265 // 250 MCalibrationChargePix &MCalibrationChargeCam::GetAverage Pix(UInt_t i)251 { 252 return *static_cast<MCalibrationChargePix*>(fAverage Pixels->UncheckedAt(i));266 MCalibrationChargePix &MCalibrationChargeCam::GetAverageArea(UInt_t i) 267 { 268 return *static_cast<MCalibrationChargePix*>(fAverageAreas->UncheckedAt(i)); 253 269 } 254 270 … … 257 273 // Get i-th average pixel (area number) 258 274 // 259 const MCalibrationChargePix &MCalibrationChargeCam::GetAveragePix(UInt_t i) const 260 { 261 return *static_cast<MCalibrationChargePix*>(fAveragePixels->UncheckedAt(i)); 275 const MCalibrationChargePix &MCalibrationChargeCam::GetAverageArea(UInt_t i) const 276 { 277 return *static_cast<MCalibrationChargePix*>(fAverageAreas->UncheckedAt(i)); 278 } 279 280 // -------------------------------------------------------------------------- 281 // 282 // Get i-th average pixel (sector number) 283 // 284 MCalibrationChargePix &MCalibrationChargeCam::GetAverageSector(UInt_t i) 285 { 286 return *static_cast<MCalibrationChargePix*>(fAverageSectors->UncheckedAt(i)); 287 } 288 289 // -------------------------------------------------------------------------- 290 // 291 // Get i-th average pixel (sector number) 292 // 293 const MCalibrationChargePix &MCalibrationChargeCam::GetAverageSector(UInt_t i) const 294 { 295 return *static_cast<MCalibrationChargePix*>(fAverageSectors->UncheckedAt(i)); 262 296 } 263 297 … … 266 300 // Get i-th average pixel (area number) 267 301 // 268 MBadPixelsPix &MCalibrationChargeCam::GetAverageBad Pix(UInt_t i)269 { 270 return *static_cast<MBadPixelsPix*>(fAverageBad Pixels->UncheckedAt(i));302 MBadPixelsPix &MCalibrationChargeCam::GetAverageBadArea(UInt_t i) 303 { 304 return *static_cast<MBadPixelsPix*>(fAverageBadAreas->UncheckedAt(i)); 271 305 } 272 306 … … 275 309 // Get i-th average pixel (area number) 276 310 // 277 const MBadPixelsPix &MCalibrationChargeCam::GetAverageBadPix(UInt_t i) const 278 { 279 return *static_cast<MBadPixelsPix*>(fAverageBadPixels->UncheckedAt(i)); 311 const MBadPixelsPix &MCalibrationChargeCam::GetAverageBadArea(UInt_t i) const 312 { 313 return *static_cast<MBadPixelsPix*>(fAverageBadAreas->UncheckedAt(i)); 314 } 315 316 // -------------------------------------------------------------------------- 317 // 318 // Get i-th average pixel (sector number) 319 // 320 MBadPixelsPix &MCalibrationChargeCam::GetAverageBadSector(UInt_t i) 321 { 322 return *static_cast<MBadPixelsPix*>(fAverageBadSectors->UncheckedAt(i)); 323 } 324 325 // -------------------------------------------------------------------------- 326 // 327 // Get i-th average pixel (sector number) 328 // 329 const MBadPixelsPix &MCalibrationChargeCam::GetAverageBadSector(UInt_t i) const 330 { 331 return *static_cast<MBadPixelsPix*>(fAverageBadSectors->UncheckedAt(i)); 280 332 } 281 333 … … 291 343 // another ForEach does not compile, thus have to do the loop ourselves: 292 344 // 293 for (Int_t i=0;i<GetAverageSize();i++) 294 { 295 fAveragePixels[i].Clear(); 296 fAverageBadPixels[i].Clear(); 345 for (Int_t i=0;i<GetAverageAreas();i++) 346 { 347 fAverageAreas[i].Clear(); 348 fAverageBadAreas[i].Clear(); 349 } 350 351 // 352 // another ForEach does not compile, thus have to do the loop ourselves: 353 // 354 for (Int_t i=0;i<GetAverageSectors();i++) 355 { 356 fAverageSectors[i].Clear(); 357 fAverageBadSectors[i].Clear(); 297 358 } 298 359 … … 418 479 *fLog << endl; 419 480 420 TIter Next5(fAverage Pixels);481 TIter Next5(fAverageAreas); 421 482 while ((pix=(MCalibrationChargePix*)Next5())) 422 483 { 423 *fLog << all << "Average Pix:"484 *fLog << all << "Average Area:" 424 485 << " Ped. Rms: " << pix->GetPedRms() << " +- " << pix->GetPedRmsErr() 425 486 << " Mean signal: " << pix->GetMeanCharge() << " +- " << pix->GetMeanChargeErr() … … 429 490 << endl; 430 491 } 492 493 TIter Next6(fAverageSectors); 494 while ((pix=(MCalibrationChargePix*)Next5())) 495 { 496 *fLog << all << "Average Sector:" 497 << " Ped. Rms: " << pix->GetPedRms() << " +- " << pix->GetPedRmsErr() 498 << " Mean signal: " << pix->GetMeanCharge() << " +- " << pix->GetMeanChargeErr() 499 << " Sigma signal: " << pix->GetSigmaCharge() << " +- "<< pix->GetSigmaChargeErr() 500 << " Reduced Sigma: " << pix->GetRSigmaCharge() 501 << " Nr Phe's: " << pix->GetPheFFactorMethod() 502 << endl; 503 } 504 431 505 } 432 506 -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.h
r3623 r3624 33 33 34 34 TClonesArray *fPixels; //-> Array of MCalibrationChargePix, one per pixel 35 TClonesArray *fAveragePixels; //-> Array of MCalibrationChargePix, one per pixel area 36 TClonesArray *fAverageBadPixels; //-> Array of MBadPixelsPix, one per pixel area 35 TClonesArray *fAverageAreas; //-> Array of MCalibrationChargePix, one per pixel area 36 TClonesArray *fAverageSectors; //-> Array of MCalibrationChargePix, one per camera sector 37 TClonesArray *fAverageBadAreas; //-> Array of MBadPixelsPix, one per pixel area 38 TClonesArray *fAverageBadSectors; //-> Array of MBadPixelsPix, one per camera sector 37 39 38 40 TH1D* fOffsets; //! … … 62 64 void Clear( Option_t *o="" ); 63 65 void InitSize( const UInt_t i ); 64 void InitAverageSize( const UInt_t i ); 66 void InitAverageAreas( const UInt_t i ); 67 void InitAverageSectors( const UInt_t i ); 65 68 66 69 // Setters … … 77 80 // Getters 78 81 Int_t GetSize() const; 79 Int_t GetAverageSize() const; 82 Int_t GetAverageAreas() const; 83 Int_t GetAverageSectors() const; 80 84 81 85 Bool_t GetConversionFactorFFactor( Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma ); … … 101 105 const MCalibrationChargePix &operator[](UInt_t i) const; 102 106 103 MCalibrationChargePix &GetAverage Pix(UInt_t i);104 const MCalibrationChargePix &GetAverage Pix(UInt_t i) const;107 MCalibrationChargePix &GetAverageArea(UInt_t i); 108 const MCalibrationChargePix &GetAverageArea(UInt_t i) const; 105 109 106 MBadPixelsPix &GetAverageBadPix(UInt_t i); 107 const MBadPixelsPix &GetAverageBadPix(UInt_t i) const; 110 MBadPixelsPix &GetAverageBadArea(UInt_t i); 111 const MBadPixelsPix &GetAverageBadArea(UInt_t i) const; 112 113 MCalibrationChargePix &GetAverageSector(UInt_t i); 114 const MCalibrationChargePix &GetAverageSector(UInt_t i) const; 115 116 MBadPixelsPix &GetAverageBadSector(UInt_t i); 117 const MBadPixelsPix &GetAverageBadSector(UInt_t i) const; 108 118 109 119 // Prints -
trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeCam.cc
r3622 r3624 112 112 fLoGainArray->SetOwner(); 113 113 114 fAverageHiGainArray = new TObjArray; 115 fAverageHiGainArray->SetOwner(); 116 117 fAverageLoGainArray = new TObjArray; 118 fAverageLoGainArray->SetOwner(); 114 fAverageHiGainAreas = new TObjArray; 115 fAverageHiGainAreas->SetOwner(); 116 117 fAverageLoGainAreas = new TObjArray; 118 fAverageLoGainAreas->SetOwner(); 119 120 fAverageHiGainSectors = new TObjArray; 121 fAverageHiGainSectors->SetOwner(); 122 123 fAverageLoGainSectors = new TObjArray; 124 fAverageLoGainSectors->SetOwner(); 119 125 120 126 SetNumHiGainSaturationLimit(); … … 133 139 delete fLoGainArray; 134 140 135 delete fAverageHiGainArray; 136 delete fAverageLoGainArray; 141 delete fAverageHiGainAreas; 142 delete fAverageLoGainAreas; 143 144 delete fAverageHiGainSectors; 145 delete fAverageLoGainSectors; 137 146 } 138 147 … … 177 186 // Get i-th pixel (pixel number) 178 187 // 179 MHCalibrationChargeHiGainPix &MHCalibrationChargeCam::GetAverageHiGainPix(UInt_t i) 180 { 181 return *static_cast<MHCalibrationChargeHiGainPix*>(fAverageHiGainArray->UncheckedAt(i)); 182 } 183 184 // -------------------------------------------------------------------------- 185 // 186 // Get i-th pixel (pixel number) 187 // 188 const MHCalibrationChargeHiGainPix &MHCalibrationChargeCam::GetAverageHiGainPix(UInt_t i) const 189 { 190 return *static_cast<MHCalibrationChargeHiGainPix*>(fAverageHiGainArray->UncheckedAt(i)); 191 } 192 193 // -------------------------------------------------------------------------- 194 // 195 // Get i-th pixel (pixel number) 196 // 197 MHCalibrationChargeLoGainPix &MHCalibrationChargeCam::GetAverageLoGainPix(UInt_t i) 198 { 199 return *static_cast<MHCalibrationChargeLoGainPix*>(fAverageLoGainArray->UncheckedAt(i)); 200 } 201 202 // -------------------------------------------------------------------------- 203 // 204 // Get i-th pixel (pixel number) 205 // 206 const MHCalibrationChargeLoGainPix &MHCalibrationChargeCam::GetAverageLoGainPix(UInt_t i) const 207 { 208 return *static_cast<MHCalibrationChargeLoGainPix*>(fAverageLoGainArray->UncheckedAt(i)); 188 MHCalibrationChargeHiGainPix &MHCalibrationChargeCam::GetAverageHiGainArea(UInt_t i) 189 { 190 return *static_cast<MHCalibrationChargeHiGainPix*>(fAverageHiGainAreas->UncheckedAt(i)); 191 } 192 193 // -------------------------------------------------------------------------- 194 // 195 // Get i-th pixel (pixel number) 196 // 197 const MHCalibrationChargeHiGainPix &MHCalibrationChargeCam::GetAverageHiGainArea(UInt_t i) const 198 { 199 return *static_cast<MHCalibrationChargeHiGainPix*>(fAverageHiGainAreas->UncheckedAt(i)); 200 } 201 202 // -------------------------------------------------------------------------- 203 // 204 // Get i-th pixel (pixel number) 205 // 206 MHCalibrationChargeLoGainPix &MHCalibrationChargeCam::GetAverageLoGainArea(UInt_t i) 207 { 208 return *static_cast<MHCalibrationChargeLoGainPix*>(fAverageLoGainAreas->UncheckedAt(i)); 209 } 210 211 // -------------------------------------------------------------------------- 212 // 213 // Get i-th pixel (pixel number) 214 // 215 const MHCalibrationChargeLoGainPix &MHCalibrationChargeCam::GetAverageLoGainArea(UInt_t i) const 216 { 217 return *static_cast<MHCalibrationChargeLoGainPix*>(fAverageLoGainAreas->UncheckedAt(i)); 218 } 219 220 // -------------------------------------------------------------------------- 221 // 222 // Get i-th pixel (pixel number) 223 // 224 MHCalibrationChargeHiGainPix &MHCalibrationChargeCam::GetAverageHiGainSector(UInt_t i) 225 { 226 return *static_cast<MHCalibrationChargeHiGainPix*>(fAverageHiGainSectors->UncheckedAt(i)); 227 } 228 229 // -------------------------------------------------------------------------- 230 // 231 // Get i-th pixel (pixel number) 232 // 233 const MHCalibrationChargeHiGainPix &MHCalibrationChargeCam::GetAverageHiGainSector(UInt_t i) const 234 { 235 return *static_cast<MHCalibrationChargeHiGainPix*>(fAverageHiGainSectors->UncheckedAt(i)); 236 } 237 238 // -------------------------------------------------------------------------- 239 // 240 // Get i-th pixel (pixel number) 241 // 242 MHCalibrationChargeLoGainPix &MHCalibrationChargeCam::GetAverageLoGainSector(UInt_t i) 243 { 244 return *static_cast<MHCalibrationChargeLoGainPix*>(fAverageLoGainSectors->UncheckedAt(i)); 245 } 246 247 // -------------------------------------------------------------------------- 248 // 249 // Get i-th pixel (pixel number) 250 // 251 const MHCalibrationChargeLoGainPix &MHCalibrationChargeCam::GetAverageLoGainSector(UInt_t i) const 252 { 253 return *static_cast<MHCalibrationChargeLoGainPix*>(fAverageLoGainSectors->UncheckedAt(i)); 209 254 } 210 255 … … 219 264 const Int_t nhi = fHiGainArray->GetEntries(); 220 265 const Int_t nlo = fLoGainArray->GetEntries(); 221 const Int_t navhi = fAverageHiGainAr ray->GetEntries();222 const Int_t navlo = fAverageLoGainAr ray->GetEntries();223 224 *fLog << err << nhi << " " << nlo << " " << navhi << " " << navlo << endl;225 266 const Int_t navhi = fAverageHiGainAreas->GetEntries(); 267 const Int_t navlo = fAverageLoGainAreas->GetEntries(); 268 const Int_t nsehi = fAverageHiGainSectors->GetEntries(); 269 const Int_t nselo = fAverageLoGainSectors->GetEntries(); 270 226 271 // 227 272 // FIXME, this might be done faster and more elegant, by direct copy. … … 231 276 cam->fHiGainArray->Expand(nhi); 232 277 cam->fLoGainArray->Expand(nlo); 233 cam->fAverageHiGainArray->Expand(navhi); 234 cam->fAverageLoGainArray->Expand(navlo); 278 cam->fAverageHiGainAreas->Expand(navhi); 279 cam->fAverageLoGainAreas->Expand(navlo); 280 cam->fAverageHiGainSectors->Expand(nsehi); 281 cam->fAverageLoGainSectors->Expand(nselo); 235 282 236 283 for (int i=0; i<nhi; i++) … … 246 293 for (int i=0; i<navhi; i++) 247 294 { 248 delete (*cam->fAverageHiGainAr ray)[i];249 (*cam->fAverageHiGainAr ray)[i] = (MHCalibrationChargeHiGainPix*)(*fAverageHiGainArray)[i]->Clone();295 delete (*cam->fAverageHiGainAreas)[i]; 296 (*cam->fAverageHiGainAreas)[i] = (MHCalibrationChargeHiGainPix*)(*fAverageHiGainAreas)[i]->Clone(); 250 297 } 251 298 for (int i=0; i<navlo; i++) 252 299 { 253 delete (*cam->fAverageLoGainArray)[i]; 254 (*cam->fAverageLoGainArray)[i] = (MHCalibrationChargeLoGainPix*)(*fAverageLoGainArray)[i]->Clone(); 255 } 256 257 cam->fAverageNum = fAverageNum; 258 cam->fAverageSat = fAverageSat; 259 cam->fAveragePixSigma = fAveragePixSigma; 260 cam->fAveragePixSigmaErr = fAveragePixSigmaErr; 261 cam->fAveragePixRelSigma = fAveragePixRelSigma; 262 cam->fAveragePixRelSigmaErr = fAveragePixRelSigmaErr; 300 delete (*cam->fAverageLoGainAreas)[i]; 301 (*cam->fAverageLoGainAreas)[i] = (MHCalibrationChargeLoGainPix*)(*fAverageLoGainAreas)[i]->Clone(); 302 } 303 for (int i=0; i<nsehi; i++) 304 { 305 delete (*cam->fAverageHiGainSectors)[i]; 306 (*cam->fAverageHiGainSectors)[i] = (MHCalibrationChargeHiGainPix*)(*fAverageHiGainSectors)[i]->Clone(); 307 } 308 for (int i=0; i<nselo; i++) 309 { 310 delete (*cam->fAverageLoGainSectors)[i]; 311 (*cam->fAverageLoGainSectors)[i] = (MHCalibrationChargeLoGainPix*)(*fAverageLoGainSectors)[i]->Clone(); 312 } 313 314 cam->fAverageAreaSat = fAverageAreaSat; 315 cam->fAverageAreaSigma = fAverageAreaSigma; 316 cam->fAverageAreaSigmaErr = fAverageAreaSigmaErr; 317 cam->fAverageAreaRelSigma = fAverageAreaRelSigma; 318 cam->fAverageAreaRelSigmaErr = fAverageAreaRelSigmaErr; 263 319 264 320 return cam; … … 290 346 fLoGainArray->Delete(); 291 347 292 fAverageHiGainArray->Delete(); 293 fAverageLoGainArray->Delete(); 348 fAverageHiGainAreas->Delete(); 349 fAverageLoGainAreas->Delete(); 350 351 fAverageHiGainSectors->Delete(); 352 fAverageLoGainSectors->Delete(); 294 353 295 354 return kTRUE; … … 364 423 const Int_t nareas = fGeom->GetNumAreas(); 365 424 366 if (fAverageHiGainAr ray->GetEntries()==0)425 if (fAverageHiGainAreas->GetEntries()==0) 367 426 { 368 fAverageHiGainAr ray->Expand(nareas);427 fAverageHiGainAreas->Expand(nareas); 369 428 370 429 for (Int_t j=0; j<nareas; j++) … … 373 432 // Oscillating pixels 374 433 // 375 (*fAverageHiGainAr ray)[j] =376 new MHCalibrationChargeHiGainPix("AverageHiGain Pix",434 (*fAverageHiGainAreas)[j] = 435 new MHCalibrationChargeHiGainPix("AverageHiGainArea", 377 436 "Average HiGain FADC sums of pixel area idx "); 378 MHCalibrationChargeHiGainPix &hist = GetAverageHiGain Pix(j);437 MHCalibrationChargeHiGainPix &hist = GetAverageHiGainArea(j); 379 438 380 439 hist.GetHGausHist()->SetTitle("Summed FADC slices average Hi Gain pixels Area Idx "); … … 389 448 } 390 449 391 if (fAverageLoGainAr ray->GetEntries()==0)450 if (fAverageLoGainAreas->GetEntries()==0) 392 451 { 393 fAverageLoGainAr ray->Expand(nareas);452 fAverageLoGainAreas->Expand(nareas); 394 453 395 454 for (Int_t j=0; j<nareas; j++) … … 398 457 // Oscillating pixels 399 458 // 400 (*fAverageLoGainAr ray)[j] =401 new MHCalibrationChargeLoGainPix("AverageLoGain Pix",459 (*fAverageLoGainAreas)[j] = 460 new MHCalibrationChargeLoGainPix("AverageLoGainArea", 402 461 "Average LoGain FADC sums of pixel area idx "); 403 MHCalibrationChargeLoGainPix &hist = GetAverageLoGain Pix(j);462 MHCalibrationChargeLoGainPix &hist = GetAverageLoGainArea(j); 404 463 405 464 hist.GetHGausHist()->SetTitle("Summed FADC slices average Lo Gain pixels Area Idx "); … … 414 473 } 415 474 416 fAverage Num.Set(nareas);417 fAverage Sat.Set(nareas);418 fAverage PixSigma. Set(nareas);419 fAverage PixSigmaErr. Set(nareas);420 fAverage PixRelSigma. Set(nareas);421 fAverage PixRelSigmaErr.Set(nareas);475 fAverageAreaNum. Set(nareas); 476 fAverageAreaSat. Set(nareas); 477 fAverageAreaSigma. Set(nareas); 478 fAverageAreaSigmaErr. Set(nareas); 479 fAverageAreaRelSigma. Set(nareas); 480 fAverageAreaRelSigmaErr.Set(nareas); 422 481 423 482 for (Int_t i=0; i<n; i++) … … 427 486 428 487 const Int_t aidx = (*fGeom)[i].GetAidx(); 429 fAverageNum[aidx]++; 430 } 488 fAverageAreaNum[aidx]++; 489 } 490 491 492 const Int_t nsectors = fGeom->GetNumSectors(); 493 494 if (fAverageHiGainSectors->GetEntries()==0) 495 { 496 fAverageHiGainSectors->Expand(nsectors); 497 498 for (Int_t j=0; j<nsectors; j++) 499 { 500 // 501 // Oscillating pixels 502 // 503 (*fAverageHiGainSectors)[j] = 504 new MHCalibrationChargeHiGainPix("AverageHiGainSector", 505 "Average HiGain FADC sums of pixel sector "); 506 MHCalibrationChargeHiGainPix &hist = GetAverageHiGainSector(j); 507 508 hist.GetHGausHist()->SetTitle("Summed FADC slices average Hi Gain pixels Sector "); 509 hist.GetHAbsTime()->SetTitle("Absolute Arrival Time average Hi Gain pixels Sector "); 510 hist.SetChargeFirst(-1000.); 511 hist.SetChargeLast(4000.); 512 hist.SetChargeNbins(4000); 513 hist.Init(); 514 hist.ChangeHistId(j); 515 hist.SetEventFrequency(fPulserFrequency); 516 } 517 } 518 519 if (fAverageLoGainSectors->GetEntries()==0) 520 { 521 fAverageLoGainSectors->Expand(nsectors); 522 523 for (Int_t j=0; j<nsectors; j++) 524 { 525 // 526 // Oscillating pixels 527 // 528 (*fAverageLoGainSectors)[j] = 529 new MHCalibrationChargeLoGainPix("AverageLoGainSector", 530 "Average LoGain FADC sums of pixel sector "); 531 MHCalibrationChargeLoGainPix &hist = GetAverageLoGainSector(j); 532 533 hist.GetHGausHist()->SetTitle("Summed FADC slices average Lo Gain pixels Sector "); 534 hist.GetHAbsTime()->SetTitle("Absolute Arrival Time average Lo Gain pixels Sector "); 535 hist.SetChargeFirst(-1000.); 536 hist.SetChargeLast(4000.); 537 hist.SetChargeNbins(4000); 538 hist.Init(); 539 hist.ChangeHistId(j); 540 hist.SetEventFrequency(fPulserFrequency); 541 } 542 } 543 544 fAverageSectorNum. Set(nsectors); 545 546 for (Int_t i=0; i<n; i++) 547 { 548 if ((*this)[i].IsExcluded()) 549 continue; 550 551 const Int_t sector = (*fGeom)[i].GetSector(); 552 fAverageSectorNum[sector]++; 553 } 554 431 555 432 556 return kTRUE; … … 445 569 } 446 570 447 const Int_t npixels = signal->GetSize(); 448 const Int_t lofirst = signal->GetFirstUsedSliceLoGain(); 449 const Int_t nareas = fGeom->GetNumAreas(); 571 const Int_t npixels = signal->GetSize(); 572 const Int_t lofirst = signal->GetFirstUsedSliceLoGain(); 573 const Int_t nareas = fGeom->GetNumAreas(); 574 const Int_t nsectors = fGeom->GetNumSectors(); 450 575 451 576 if (fHiGainArray->GetEntries() != npixels) … … 461 586 } 462 587 463 if (fAverageHiGainAr ray->GetEntries() != nareas)588 if (fAverageHiGainAreas->GetEntries() != nareas) 464 589 { 465 590 *fLog << err << "ERROR - Size mismatch in number of areas ... abort." << endl; … … 467 592 } 468 593 469 if (fAverageLoGainAr ray->GetEntries() != nareas)594 if (fAverageLoGainAreas->GetEntries() != nareas) 470 595 { 471 596 *fLog << err << "ERROR - Size mismatch in number of areas ... abort." << endl; … … 473 598 } 474 599 475 476 // 477 // First the extracted signal 478 // 479 Float_t sumhitot [nareas]; 480 Float_t sumlotot [nareas]; 481 Int_t sumhisat [nareas]; 482 Int_t sumlosat [nareas]; 483 Float_t timehitot[nareas]; 484 Float_t timelotot[nareas]; 600 if (fAverageHiGainSectors->GetEntries() != nsectors) 601 { 602 *fLog << err << "ERROR - Size mismatch in number of sectors ... abort." << endl; 603 return kFALSE; 604 } 605 606 if (fAverageLoGainSectors->GetEntries() != nsectors) 607 { 608 *fLog << err << "ERROR - Size mismatch in number of sectors ... abort." << endl; 609 return kFALSE; 610 } 611 612 Float_t sumhiarea [nareas], sumloarea [nareas], timehiarea [nareas], timeloarea [nareas]; 613 Float_t sumhisector[nsectors], sumlosector[nsectors], timehisector[nsectors], timelosector[nsectors]; 614 Int_t sathiarea [nareas], satloarea [nareas]; 615 Int_t sathisector[nsectors], satlosector[nsectors]; 485 616 486 617 for (UInt_t j=0; j<nareas; j++) 487 618 { 488 489 sumhi tot[j] = sumlotot[j]= 0.;490 s umhisat[j] = sumlosat[j]= 0;491 timehitot[j] = timelotot[j] = 0.;619 sumhiarea [j] = sumloarea [j] = timehiarea [j] = timeloarea [j] = 0.; 620 sumhisector[j] = sumlosector[j] = timehisector[j] = timelosector[j] = 0.; 621 sathiarea [j] = satloarea [j] = 0; 622 sathisector[j] = satlosector[j] = 0; 492 623 } 493 624 … … 512 643 (*this)(i).SetSaturated(satlo); 513 644 514 const Int_t aidx = (*fGeom)[i].GetAidx(); 515 516 sumhitot[aidx] += sumhi; 517 sumlotot[aidx] += sumlo; 518 sumhisat[aidx] += sathi; 519 sumlosat[aidx] += satlo; 645 const Int_t aidx = (*fGeom)[i].GetAidx(); 646 const Int_t sector = (*fGeom)[i].GetSector(); 647 648 sumhiarea[aidx] += sumhi; 649 sumloarea[aidx] += sumlo; 650 sathiarea[aidx] += sathi; 651 satloarea[aidx] += satlo; 652 653 sumhisector[sector] += sumhi; 654 sumlosector[sector] += sumlo; 655 sathisector[sector] += sathi; 656 satlosector[sector] += satlo; 520 657 } 521 658 … … 534 671 (*this)(pixid).FillAbsTime(timelo); 535 672 536 const Int_t aidx = (*fGeom)[pixid].GetAidx(); 537 538 timehitot[aidx] += timehi; 539 timelotot[aidx] += timelo; 673 const Int_t aidx = (*fGeom)[pixid].GetAidx(); 674 const Int_t sector = (*fGeom)[pixid].GetSector(); 675 676 timehiarea[aidx] += timehi; 677 timeloarea[aidx] += timelo; 678 679 timehisector[sector] += timehi; 680 timelosector[sector] += timelo; 540 681 } 541 682 … … 544 685 { 545 686 546 const Int_t npix = fAverageNum[j]; 547 548 MHCalibrationChargeHiGainPix &hipix = GetAverageHiGainPix(j); 549 MHCalibrationChargeLoGainPix &lopix = GetAverageLoGainPix(j); 550 551 hipix.FillHistAndArray(sumhitot[j]/npix); 552 lopix.FillHistAndArray(sumlotot[j]/npix); 553 554 hipix.SetSaturated((Float_t)sumhisat[j]/npix); 555 lopix.SetSaturated((Float_t)sumlosat[j]/npix); 556 557 hipix.FillAbsTime(timehitot[j]/npix); 558 lopix.FillAbsTime(timelotot[j]/npix); 687 const Int_t npix = fAverageAreaNum[j]; 688 689 MHCalibrationChargeHiGainPix &hipix = GetAverageHiGainArea(j); 690 MHCalibrationChargeLoGainPix &lopix = GetAverageLoGainArea(j); 691 692 hipix.FillHistAndArray(sumhiarea[j]/npix); 693 lopix.FillHistAndArray(sumloarea[j]/npix); 694 695 hipix.SetSaturated((Float_t)sathiarea[j]/npix); 696 lopix.SetSaturated((Float_t)satloarea[j]/npix); 697 698 hipix.FillAbsTime(timehiarea[j]/npix); 699 lopix.FillAbsTime(timeloarea[j]/npix); 700 701 } 702 703 for (UInt_t j=0; j<nsectors; j++) 704 { 705 706 const Int_t npix = fAverageSectorNum[j]; 707 708 MHCalibrationChargeHiGainPix &hipix = GetAverageHiGainSector(j); 709 MHCalibrationChargeLoGainPix &lopix = GetAverageLoGainSector(j); 710 711 hipix.FillHistAndArray(sumhisector[j]/npix); 712 lopix.FillHistAndArray(sumlosector[j]/npix); 713 714 hipix.SetSaturated((Float_t)sathisector[j]/npix); 715 lopix.SetSaturated((Float_t)satlosector[j]/npix); 716 717 hipix.FillAbsTime(timehisector[j]/npix); 718 lopix.FillAbsTime(timelosector[j]/npix); 559 719 560 720 } … … 604 764 } 605 765 606 for (Int_t j=0; j<fAverageHiGainAr ray->GetSize(); j++)607 { 608 609 MHCalibrationChargeHiGainPix &histhi = GetAverageHiGain Pix(j);610 MCalibrationChargePix &pix = fCam->GetAverage Pix(j);611 MBadPixelsPix &bad = fCam->GetAverageBad Pix(j);766 for (Int_t j=0; j<fAverageHiGainAreas->GetSize(); j++) 767 { 768 769 MHCalibrationChargeHiGainPix &histhi = GetAverageHiGainArea(j); 770 MCalibrationChargePix &pix = fCam->GetAverageArea(j); 771 MBadPixelsPix &bad = fCam->GetAverageBadArea(j); 612 772 613 773 FinalizeHiGainHists(histhi,pix,bad); 614 774 } 615 775 616 for (Int_t j=0; j<fAverageLoGainAr ray->GetSize(); j++)617 { 618 619 MHCalibrationChargeLoGainPix &histlo = GetAverageLoGain Pix(j);620 MCalibrationChargePix &pix = fCam->GetAverage Pix(j);621 MBadPixelsPix &bad = fCam->GetAverageBad Pix(j);776 for (Int_t j=0; j<fAverageLoGainAreas->GetSize(); j++) 777 { 778 779 MHCalibrationChargeLoGainPix &histlo = GetAverageLoGainArea(j); 780 MCalibrationChargePix &pix = fCam->GetAverageArea(j); 781 MBadPixelsPix &bad = fCam->GetAverageBadArea(j); 622 782 623 783 FinalizeLoGainHists(histlo,pix,bad); 624 784 } 785 786 for (Int_t j=0; j<fAverageHiGainSectors->GetSize(); j++) 787 { 788 789 MHCalibrationChargeHiGainPix &histhi = GetAverageHiGainSector(j); 790 MCalibrationChargePix &pix = fCam->GetAverageSector(j); 791 MBadPixelsPix &bad = fCam->GetAverageBadSector(j); 792 793 FinalizeHiGainHists(histhi,pix,bad); 794 } 795 796 for (Int_t j=0; j<fAverageLoGainSectors->GetSize(); j++) 797 { 798 799 MHCalibrationChargeLoGainPix &histlo = GetAverageLoGainSector(j); 800 MCalibrationChargePix &pix = fCam->GetAverageSector(j); 801 MBadPixelsPix &bad = fCam->GetAverageBadSector(j); 802 803 FinalizeLoGainHists(histlo,pix,bad); 804 } 625 805 626 806 for (Int_t j=0; j<fGeom->GetNumAreas();j++) 627 807 { 628 808 629 MCalibrationChargePix &pix = fCam->GetAverage Pix(j);809 MCalibrationChargePix &pix = fCam->GetAverageArea(j); 630 810 631 811 if (pix.IsHiGainSaturation()) 632 fAverage Sat[j]++;633 634 fAverage PixSigma[j] = pix.GetSigmaCharge () * TMath::Sqrt((Float_t)fAverageNum[j]);635 fAverage PixSigmaErr[j] = pix.GetSigmaChargeErr () * TMath::Sqrt((Float_t)fAverageNum[j]);636 637 pix.SetSigmaCharge (fAverage PixSigma[j]);638 pix.SetSigmaChargeErr(fAverage PixSigmaErr[j]);639 640 fAverage PixRelSigma[j] = fAveragePixSigma[j] / pix.GetMeanCharge();641 642 Float_t relsigmaerr = fAveragePixSigmaErr[j]*fAveragePixSigmaErr[j]643 / (fAveragePixSigma[j] *fAveragePixSigma[j] );644 relsigmaerr += pix.GetMeanChargeErr()*pix.GetMeanChargeErr()645 / (pix.GetMeanCharge() *pix.GetMeanCharge() );646 relsigmaerr *= fAveragePixRelSigma[j];647 fAverage PixRelSigmaErr[j] = TMath::Sqrt(relsigmaerr);812 fAverageAreaSat[j]++; 813 814 fAverageAreaSigma[j] = pix.GetSigmaCharge () * TMath::Sqrt((Float_t)fAverageAreaNum[j]); 815 fAverageAreaSigmaErr[j] = pix.GetSigmaChargeErr () * TMath::Sqrt((Float_t)fAverageAreaNum[j]); 816 817 pix.SetSigmaCharge (fAverageAreaSigma[j]); 818 pix.SetSigmaChargeErr(fAverageAreaSigmaErr[j]); 819 820 fAverageAreaRelSigma[j] = fAverageAreaSigma[j] / pix.GetMeanCharge(); 821 822 Float_t relsigmaerr = fAverageAreaSigmaErr[j]*fAverageAreaSigmaErr[j] 823 / (fAverageAreaSigma[j] *fAverageAreaSigma[j] ); 824 relsigmaerr += pix.GetMeanChargeErr()*pix.GetMeanChargeErr() 825 / (pix.GetMeanCharge() *pix.GetMeanCharge() ); 826 relsigmaerr *= fAverageAreaRelSigma[j]; 827 fAverageAreaRelSigmaErr[j] = TMath::Sqrt(relsigmaerr); 648 828 649 829 } … … 668 848 *fLog << warn << "Saturated Hi Gain histogram in pixel: " << pix.GetPixId() << endl; 669 849 pix.SetHiGainSaturation(); 670 return;850 // return; 671 851 } 672 852 … … 737 917 bad.SetUncalibrated( MBadPixelsPix::kLoGainSaturation ); 738 918 bad.SetUnsuitable( MBadPixelsPix::kUnsuitableRun ); 739 return;919 // return; 740 920 } 741 921 … … 810 990 { 811 991 812 const Int_t nareas = fAverageHiGainAr ray->GetEntries();992 const Int_t nareas = fAverageHiGainAreas->GetEntries(); 813 993 if (nareas == 0) 814 994 return; … … 822 1002 { 823 1003 pad->cd(2*(i+1)-1); 824 GetAverageHiGain Pix(i).Draw(opt);825 826 if (!fAverage Sat[i])827 DrawAverageSigma(fAverage Sat[i], i,828 fAverage PixSigma[i], fAveragePixSigmaErr[i],829 fAverage PixRelSigma[i], fAveragePixRelSigmaErr[i]);1004 GetAverageHiGainArea(i).Draw(opt); 1005 1006 if (!fAverageAreaSat[i]) 1007 DrawAverageSigma(fAverageAreaSat[i], i, 1008 fAverageAreaSigma[i], fAverageAreaSigmaErr[i], 1009 fAverageAreaRelSigma[i], fAverageAreaRelSigmaErr[i]); 830 1010 831 1011 pad->cd(2*(i+1)); 832 GetAverageLoGain Pix(i).Draw(opt);833 834 if (fAverage Sat[i])835 DrawAverageSigma(fAverage Sat[i], i,836 fAverage PixSigma[i], fAveragePixSigmaErr[i],837 fAverage PixRelSigma[i], fAveragePixRelSigmaErr[i]);1012 GetAverageLoGainArea(i).Draw(opt); 1013 1014 if (fAverageAreaSat[i]) 1015 DrawAverageSigma(fAverageAreaSat[i], i, 1016 fAverageAreaSigma[i], fAverageAreaSigmaErr[i], 1017 fAverageAreaRelSigma[i], fAverageAreaRelSigmaErr[i]); 838 1018 } 839 1019 } -
trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeCam.h
r3622 r3624 47 47 TObjArray *fHiGainArray; //-> Array of MHCalibrationChargeHiGainPix, one per pixel 48 48 TObjArray *fLoGainArray; //-> Array of MHCalibrationChargeLoGainPix, one per pixel 49 TObjArray *fAverageHiGainArray; //-> Array of MHCalibrationChargeHiGainPix, one per pixel area 50 TObjArray *fAverageLoGainArray; //-> Array of MHCalibrationChargeLoGainPix, one per pixel area 51 49 TObjArray *fAverageHiGainAreas; //-> Array of MHCalibrationChargeHiGainPix, one per pixel area 50 TObjArray *fAverageLoGainAreas; //-> Array of MHCalibrationChargeLoGainPix, one per pixel area 51 TObjArray *fAverageHiGainSectors; //-> Array of MHCalibrationChargeHiGainPix, one per camera sector 52 TObjArray *fAverageLoGainSectors; //-> Array of MHCalibrationChargeLoGainPix, one per camera sector 53 52 54 MCalibrationChargeCam *fCam; //! Calibration Cam with the results 53 55 MRawEvtData *fRawEvt; //! Raw event data … … 55 57 MBadPixelsCam *fBadPixels; //! Bad Pixels storage container 56 58 57 TArrayI fAverageNum; // Number of pixels in average pixels 58 TArrayI fAverageSat; // Number of saturated slices in average pixels 59 TArrayF fAveragePixSigma; // Re-normalized sigmas in average pixels 60 TArrayF fAveragePixSigmaErr; // Errors of Re-normalized sigmas in average pixels 61 TArrayF fAveragePixRelSigma; // Re-normalized relative sigmas in average pixels 62 TArrayF fAveragePixRelSigmaErr; // Errors of Re-normalized relative sigmas in average pixels 59 TArrayI fAverageAreaNum; // Number of pixels in average pixels per area 60 TArrayI fAverageAreaSat; // Number of saturated slices in average pixels per area 61 TArrayF fAverageAreaSigma; // Re-normalized sigmas in average pixels per area 62 TArrayF fAverageAreaSigmaErr; // Errors of Re-normalized sigmas in average pixels per area 63 TArrayF fAverageAreaRelSigma; // Re-normalized relative sigmas in average pixels per area 64 TArrayF fAverageAreaRelSigmaErr; // Errors of Re-normalized relative sigmas in average pixels per area 65 66 TArrayI fAverageSectorNum; // Number of pixels in average pixels per sector 63 67 64 68 void FinalizeHiGainHists(MHCalibrationChargeHiGainPix &hist, MCalibrationChargePix &pix, MBadPixelsPix &bad); … … 86 90 const MHCalibrationChargeLoGainPix &operator()(UInt_t i) const; 87 91 88 MHCalibrationChargeHiGainPix &GetAverageHiGain Pix(UInt_t i);89 const MHCalibrationChargeHiGainPix &GetAverageHiGain Pix(UInt_t i) const;92 MHCalibrationChargeHiGainPix &GetAverageHiGainArea(UInt_t i); 93 const MHCalibrationChargeHiGainPix &GetAverageHiGainArea(UInt_t i) const; 90 94 91 MHCalibrationChargeLoGainPix &GetAverageLoGainPix(UInt_t i); 92 const MHCalibrationChargeLoGainPix &GetAverageLoGainPix(UInt_t i) const; 95 MHCalibrationChargeLoGainPix &GetAverageLoGainArea(UInt_t i); 96 const MHCalibrationChargeLoGainPix &GetAverageLoGainArea(UInt_t i) const; 97 98 MHCalibrationChargeHiGainPix &GetAverageHiGainSector(UInt_t i); 99 const MHCalibrationChargeHiGainPix &GetAverageHiGainSector(UInt_t i) const; 100 101 MHCalibrationChargeLoGainPix &GetAverageLoGainSector(UInt_t i); 102 const MHCalibrationChargeLoGainPix &GetAverageLoGainSector(UInt_t i) const; 93 103 94 104 Bool_t SetupFill(const MParList *pList); … … 106 116 void DrawPixelContent( Int_t num ) const; 107 117 108 ClassDef(MHCalibrationChargeCam, 1) // Container for calibration information of the camera118 ClassDef(MHCalibrationChargeCam, 1) // Histogram class for camera calibration 109 119 }; 110 120
Note:
See TracChangeset
for help on using the changeset viewer.