| 1 | /* ======================================================================== *\
|
|---|
| 2 | !
|
|---|
| 3 | ! *
|
|---|
| 4 | ! * This file is part of MARS, the MAGIC Analysis and Reconstruction
|
|---|
| 5 | ! * Software. It is distributed to you in the hope that it can be a useful
|
|---|
| 6 | ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
|
|---|
| 7 | ! * It is distributed WITHOUT ANY WARRANTY.
|
|---|
| 8 | ! *
|
|---|
| 9 | ! * Permission to use, copy, modify and distribute this software and its
|
|---|
| 10 | ! * documentation for any purpose is hereby granted without fee,
|
|---|
| 11 | ! * provided that the above copyright notice appear in all copies and
|
|---|
| 12 | ! * that both that copyright notice and this permission notice appear
|
|---|
| 13 | ! * in supporting documentation. It is provided "as is" without express
|
|---|
| 14 | ! * or implied warranty.
|
|---|
| 15 | ! *
|
|---|
| 16 | !
|
|---|
| 17 | !
|
|---|
| 18 | ! Author(s): Markus Gaug 08/2004 <mailto:markus@ifae.es>
|
|---|
| 19 | !
|
|---|
| 20 | ! Copyright: MAGIC Software Development, 2000-2004
|
|---|
| 21 | !
|
|---|
| 22 | !
|
|---|
| 23 | \* ======================================================================== */
|
|---|
| 24 |
|
|---|
| 25 | //////////////////////////////////////////////////////////////////////////////
|
|---|
| 26 | //
|
|---|
| 27 | // MCalibrationTestCalc
|
|---|
| 28 | //
|
|---|
| 29 | // PreProcess(): Initialize pointers to MHCalibrationTestCam
|
|---|
| 30 | //
|
|---|
| 31 | // ReInit(): MCalibrationCam::InitSize(NumPixels) is called from MGeomApply (which allocates
|
|---|
| 32 | // memory in a TClonesArray of type MCalibrationChargePix)
|
|---|
| 33 | // Initializes pointer to MBadPixelsCam
|
|---|
| 34 | //
|
|---|
| 35 | // Process(): Nothing to be done, histograms getting filled by MHCalibrationTestCam
|
|---|
| 36 | //
|
|---|
| 37 | // PostProcess(): Print out interpolation results to file
|
|---|
| 38 | //
|
|---|
| 39 | // Input Containers:
|
|---|
| 40 | // MHCalibrationTestCam
|
|---|
| 41 | // MBadPixelsCam
|
|---|
| 42 | // MGeomCam
|
|---|
| 43 | //
|
|---|
| 44 | // Output Containers:
|
|---|
| 45 | // none
|
|---|
| 46 | //
|
|---|
| 47 | //////////////////////////////////////////////////////////////////////////////
|
|---|
| 48 | #include "MCalibrationTestCalc.h"
|
|---|
| 49 |
|
|---|
| 50 | #include <TSystem.h>
|
|---|
| 51 | #include <TH1.h>
|
|---|
| 52 | #include <TF1.h>
|
|---|
| 53 |
|
|---|
| 54 | #include "MLog.h"
|
|---|
| 55 | #include "MLogManip.h"
|
|---|
| 56 |
|
|---|
| 57 | #include "MParList.h"
|
|---|
| 58 |
|
|---|
| 59 | #include "MGeomCam.h"
|
|---|
| 60 | #include "MGeomPix.h"
|
|---|
| 61 | #include "MHCamera.h"
|
|---|
| 62 |
|
|---|
| 63 | #include "MHCalibrationTestCam.h"
|
|---|
| 64 | #include "MHCalibrationTestPix.h"
|
|---|
| 65 |
|
|---|
| 66 | #include "MBadPixelsCam.h"
|
|---|
| 67 | #include "MBadPixelsPix.h"
|
|---|
| 68 |
|
|---|
| 69 | ClassImp(MCalibrationTestCalc);
|
|---|
| 70 |
|
|---|
| 71 | using namespace std;
|
|---|
| 72 |
|
|---|
| 73 | const Float_t MCalibrationTestCalc::fgPhotErrLimit = 4.5;
|
|---|
| 74 | // --------------------------------------------------------------------------
|
|---|
| 75 | //
|
|---|
| 76 | // Default constructor.
|
|---|
| 77 | //
|
|---|
| 78 | // Sets the pointer to fTestCam and fGeom to NULL
|
|---|
| 79 | // Sets outputpath to "."
|
|---|
| 80 | // Sets outputfile to "TestCalibStat.txt"
|
|---|
| 81 | // Sets fPhotErrLimit to fgPhotErrLimit
|
|---|
| 82 | //
|
|---|
| 83 | // Calls:
|
|---|
| 84 | // - Clear()
|
|---|
| 85 | //
|
|---|
| 86 | MCalibrationTestCalc::MCalibrationTestCalc(const char *name, const char *title)
|
|---|
| 87 | : fBadPixels(NULL), fTestCam(NULL), fGeom(NULL)
|
|---|
| 88 | {
|
|---|
| 89 |
|
|---|
| 90 | fName = name ? name : "MCalibrationTestCalc";
|
|---|
| 91 | fTitle = title ? title : "Task to output the results of MHCalibrationTestCam ";
|
|---|
| 92 |
|
|---|
| 93 | SetPhotErrLimit();
|
|---|
| 94 |
|
|---|
| 95 | SetOutputPath();
|
|---|
| 96 | SetOutputFile();
|
|---|
| 97 |
|
|---|
| 98 | }
|
|---|
| 99 |
|
|---|
| 100 |
|
|---|
| 101 | // -----------------------------------------------------------------------------------
|
|---|
| 102 | //
|
|---|
| 103 | // The following containers are searched and created if they were not found:
|
|---|
| 104 | //
|
|---|
| 105 | // - MBadPixelsCam
|
|---|
| 106 | //
|
|---|
| 107 | Int_t MCalibrationTestCalc::PreProcess(MParList *pList)
|
|---|
| 108 | {
|
|---|
| 109 |
|
|---|
| 110 | //
|
|---|
| 111 | // Containers that are created in case that they are not there.
|
|---|
| 112 | //
|
|---|
| 113 | fBadPixels = (MBadPixelsCam*)pList->FindCreateObj("MBadPixelsCam");
|
|---|
| 114 | if (!fBadPixels)
|
|---|
| 115 | {
|
|---|
| 116 | *fLog << err << "Could not find or create MBadPixelsCam ... aborting." << endl;
|
|---|
| 117 | return kFALSE;
|
|---|
| 118 | }
|
|---|
| 119 |
|
|---|
| 120 | return kTRUE;
|
|---|
| 121 | }
|
|---|
| 122 |
|
|---|
| 123 |
|
|---|
| 124 | // --------------------------------------------------------------------------
|
|---|
| 125 | //
|
|---|
| 126 | // Search for the following input containers and abort if not existing:
|
|---|
| 127 | // - MGeomCam
|
|---|
| 128 | // - MHCalibrationTestCam
|
|---|
| 129 | //
|
|---|
| 130 | //
|
|---|
| 131 | Bool_t MCalibrationTestCalc::ReInit(MParList *pList )
|
|---|
| 132 | {
|
|---|
| 133 |
|
|---|
| 134 | fGeom = (MGeomCam*)pList->FindObject("MGeomCam");
|
|---|
| 135 | if (!fGeom)
|
|---|
| 136 | {
|
|---|
| 137 | *fLog << err << "No MGeomCam found... aborting." << endl;
|
|---|
| 138 | return kFALSE;
|
|---|
| 139 | }
|
|---|
| 140 |
|
|---|
| 141 | fTestCam = (MHCalibrationTestCam*)pList->FindObject("MHCalibrationTestCam");
|
|---|
| 142 | if (!fTestCam)
|
|---|
| 143 | {
|
|---|
| 144 | *fLog << err << "Cannot find MHCalibrationTestCam... aborting" << endl;
|
|---|
| 145 | *fLog << err << "Maybe you forget to call an MFillH for the MHCalibrationTestCam before..." << endl;
|
|---|
| 146 | return kFALSE;
|
|---|
| 147 | }
|
|---|
| 148 |
|
|---|
| 149 |
|
|---|
| 150 | return kTRUE;
|
|---|
| 151 | }
|
|---|
| 152 |
|
|---|
| 153 | // ----------------------------------------------------------------------------------
|
|---|
| 154 | //
|
|---|
| 155 | // Nothing to be done in Process, but have a look at MHCalibrationTestCam, instead
|
|---|
| 156 | //
|
|---|
| 157 | Int_t MCalibrationTestCalc::Process()
|
|---|
| 158 | {
|
|---|
| 159 | return kTRUE;
|
|---|
| 160 | }
|
|---|
| 161 |
|
|---|
| 162 | // -----------------------------------------------------------------------
|
|---|
| 163 | //
|
|---|
| 164 | // Return if number of executions is null.
|
|---|
| 165 | //
|
|---|
| 166 | // Print out some statistics
|
|---|
| 167 | //
|
|---|
| 168 | Int_t MCalibrationTestCalc::PostProcess()
|
|---|
| 169 | {
|
|---|
| 170 |
|
|---|
| 171 | if (GetNumExecutions()==0)
|
|---|
| 172 | return kFALSE;
|
|---|
| 173 |
|
|---|
| 174 | //
|
|---|
| 175 | // Re-direct the output to an ascii-file from now on:
|
|---|
| 176 | //
|
|---|
| 177 | MLog asciilog;
|
|---|
| 178 | asciilog.SetOutputFile(GetOutputFile(),kTRUE);
|
|---|
| 179 | SetLogStream(&asciilog);
|
|---|
| 180 | //
|
|---|
| 181 | // Finalize calibration statistics
|
|---|
| 182 | //
|
|---|
| 183 | FinalizeCalibratedPhotons();
|
|---|
| 184 |
|
|---|
| 185 | *fLog << inf << endl;
|
|---|
| 186 | *fLog << GetDescriptor() << ": Not interpolated pixels statistics:" << endl;
|
|---|
| 187 |
|
|---|
| 188 | PrintNotInterpolated();
|
|---|
| 189 |
|
|---|
| 190 | SetLogStream(&gLog);
|
|---|
| 191 |
|
|---|
| 192 | return kTRUE;
|
|---|
| 193 | }
|
|---|
| 194 |
|
|---|
| 195 |
|
|---|
| 196 | // ------------------------------------------------------------------------
|
|---|
| 197 | //
|
|---|
| 198 | //
|
|---|
| 199 | // First loop: Calculate a mean and mean RMS of calibrated photons per area index
|
|---|
| 200 | // Include only MHCalibrationTestPix's which are not empty (not interpolated)
|
|---|
| 201 | //
|
|---|
| 202 | // Second loop: Get weighted mean number of calibrated photons and its RMS
|
|---|
| 203 | // excluding those deviating by more than fPhotErrLimit
|
|---|
| 204 | // sigmas from the mean (obtained in first loop). Set
|
|---|
| 205 | // MBadPixelsPix::kDeviatingNumPhots if excluded.
|
|---|
| 206 | //
|
|---|
| 207 | void MCalibrationTestCalc::FinalizeCalibratedPhotons() const
|
|---|
| 208 | {
|
|---|
| 209 |
|
|---|
| 210 | const UInt_t npixels = fGeom->GetNumPixels();
|
|---|
| 211 | const UInt_t nareas = fGeom->GetNumAreas();
|
|---|
| 212 | const UInt_t nsectors = fGeom->GetNumSectors();
|
|---|
| 213 |
|
|---|
| 214 | Double_t lowlim [nareas];
|
|---|
| 215 | Double_t upplim [nareas];
|
|---|
| 216 | Double_t areaphotons [nareas], sectorphotons [nsectors];
|
|---|
| 217 | Double_t areavars [nareas], sectorvars [nsectors];
|
|---|
| 218 | Double_t fittedmean [nareas], fittedsigma [nareas];
|
|---|
| 219 | Int_t numareavalid[nareas], numsectorvalid[nsectors];
|
|---|
| 220 |
|
|---|
| 221 | memset(lowlim ,0, nareas * sizeof(Double_t));
|
|---|
| 222 | memset(upplim ,0, nareas * sizeof(Double_t));
|
|---|
| 223 | memset(fittedmean ,0, nareas * sizeof(Double_t));
|
|---|
| 224 | memset(fittedsigma ,0, nareas * sizeof(Double_t));
|
|---|
| 225 | memset(areaphotons ,0, nareas * sizeof(Double_t));
|
|---|
| 226 | memset(areavars ,0, nareas * sizeof(Double_t));
|
|---|
| 227 | memset(numareavalid ,0, nareas * sizeof(Int_t ));
|
|---|
| 228 | memset(sectorphotons ,0, nsectors * sizeof(Double_t));
|
|---|
| 229 | memset(sectorvars ,0, nsectors * sizeof(Double_t));
|
|---|
| 230 | memset(numsectorvalid,0, nsectors * sizeof(Int_t ));
|
|---|
| 231 |
|
|---|
| 232 | //
|
|---|
| 233 | // First loop: Get mean number of calibrated photons and the RMS
|
|---|
| 234 | // The loop is only to recognize later pixels with very deviating numbers
|
|---|
| 235 | //
|
|---|
| 236 | MHCamera camphotons(*fGeom,"Camphotons","Photons in Camera");
|
|---|
| 237 |
|
|---|
| 238 | for (UInt_t i=0; i<npixels; i++)
|
|---|
| 239 | {
|
|---|
| 240 |
|
|---|
| 241 | MHCalibrationTestPix &pix = (MHCalibrationTestPix&)(*fTestCam)[i];
|
|---|
| 242 | //
|
|---|
| 243 | // We assume that the pixels have been interpolated so far.
|
|---|
| 244 | // The MBadPixelsCam does not give any more information
|
|---|
| 245 | //
|
|---|
| 246 | if (pix.IsEmpty())
|
|---|
| 247 | continue;
|
|---|
| 248 |
|
|---|
| 249 | const Double_t nphot = pix.GetMean();
|
|---|
| 250 | const Int_t aidx = (*fGeom)[i].GetAidx();
|
|---|
| 251 |
|
|---|
| 252 | camphotons.Fill(i,nphot);
|
|---|
| 253 | camphotons.SetUsed(i);
|
|---|
| 254 |
|
|---|
| 255 | areaphotons [aidx] += nphot;
|
|---|
| 256 | areavars [aidx] += nphot*nphot;
|
|---|
| 257 | numareavalid[aidx] ++;
|
|---|
| 258 | }
|
|---|
| 259 |
|
|---|
| 260 | for (UInt_t aidx=0; aidx<nareas; aidx++)
|
|---|
| 261 | {
|
|---|
| 262 | if (numareavalid[aidx] == 0)
|
|---|
| 263 | {
|
|---|
| 264 | *fLog << warn << GetDescriptor() << ": No pixels with valid number of calibrated photons found "
|
|---|
| 265 | << "in area index: " << aidx << endl;
|
|---|
| 266 | continue;
|
|---|
| 267 | }
|
|---|
| 268 |
|
|---|
| 269 | areavars[aidx] = (areavars[aidx] - areaphotons[aidx]*areaphotons[aidx]/numareavalid[aidx]) / (numareavalid[aidx]-1.);
|
|---|
| 270 | areaphotons[aidx] = areaphotons[aidx] / numareavalid[aidx];
|
|---|
| 271 |
|
|---|
| 272 | if (areavars[aidx] < 0.)
|
|---|
| 273 | {
|
|---|
| 274 | *fLog << warn << GetDescriptor() << ": No pixels with valid variance of calibrated photons found "
|
|---|
| 275 | << "in area index: " << aidx << endl;
|
|---|
| 276 | continue;
|
|---|
| 277 | }
|
|---|
| 278 |
|
|---|
| 279 | lowlim [aidx] = areaphotons[aidx] - fPhotErrLimit*TMath::Sqrt(areavars[aidx]);
|
|---|
| 280 | upplim [aidx] = areaphotons[aidx] + fPhotErrLimit*TMath::Sqrt(areavars[aidx]);
|
|---|
| 281 |
|
|---|
| 282 | TArrayI area(1);
|
|---|
| 283 | area[0] = aidx;
|
|---|
| 284 |
|
|---|
| 285 | TH1D *hist = camphotons.ProjectionS(TArrayI(),area,"_py",100);
|
|---|
| 286 | hist->Fit("gaus","Q");
|
|---|
| 287 | const Double_t mean = hist->GetFunction("gaus")->GetParameter(1);
|
|---|
| 288 | const Double_t sigma = hist->GetFunction("gaus")->GetParameter(2);
|
|---|
| 289 | const Int_t ndf = hist->GetFunction("gaus")->GetNDF();
|
|---|
| 290 |
|
|---|
| 291 | if (ndf < 2)
|
|---|
| 292 | {
|
|---|
| 293 | *fLog << warn << GetDescriptor() << ": Cannot use a Gauss fit to the number of calibrated photons "
|
|---|
| 294 | << "in the camera with area index: " << aidx << endl;
|
|---|
| 295 | *fLog << warn << GetDescriptor() << ": Number of dof.: " << ndf << " is smaller than 2 " << endl;
|
|---|
| 296 | *fLog << warn << GetDescriptor() << ": Will use the simple mean and rms " << endl;
|
|---|
| 297 | delete hist;
|
|---|
| 298 | continue;
|
|---|
| 299 | }
|
|---|
| 300 |
|
|---|
| 301 | const Double_t prob = hist->GetFunction("gaus")->GetProb();
|
|---|
| 302 |
|
|---|
| 303 | if (prob < 0.001)
|
|---|
| 304 | {
|
|---|
| 305 | *fLog << warn << GetDescriptor() << ": Cannot use a Gauss fit to the number of calibrated photons "
|
|---|
| 306 | << "in the camera with area index: " << aidx << endl;
|
|---|
| 307 | *fLog << warn << GetDescriptor() << ": Fit probability " << prob
|
|---|
| 308 | << " is smaller than 0.001 " << endl;
|
|---|
| 309 | *fLog << warn << GetDescriptor() << ": Will use the simple mean and rms " << endl;
|
|---|
| 310 | delete hist;
|
|---|
| 311 | continue;
|
|---|
| 312 | }
|
|---|
| 313 |
|
|---|
| 314 | fittedmean [aidx] = mean;
|
|---|
| 315 | fittedsigma[aidx] = sigma;
|
|---|
| 316 |
|
|---|
| 317 | lowlim [aidx] = mean - fPhotErrLimit*sigma;
|
|---|
| 318 | upplim [aidx] = mean + fPhotErrLimit*sigma;
|
|---|
| 319 |
|
|---|
| 320 | *fLog << " Fitted number of photons in area index " << aidx
|
|---|
| 321 | << ": " << Form("%6.2f +- %6.2f",fittedmean[aidx],fittedsigma[aidx]) << endl;
|
|---|
| 322 |
|
|---|
| 323 | delete hist;
|
|---|
| 324 | }
|
|---|
| 325 |
|
|---|
| 326 | memset(numareavalid,0,nareas*sizeof(Int_t));
|
|---|
| 327 | memset(areaphotons ,0,nareas*sizeof(Double_t));
|
|---|
| 328 | memset(areavars ,0,nareas*sizeof(Double_t));
|
|---|
| 329 |
|
|---|
| 330 | //
|
|---|
| 331 | // Second loop: Get mean number of calibrated photons and its RMS excluding
|
|---|
| 332 | // pixels deviating by more than fPhotErrLimit sigma.
|
|---|
| 333 | //
|
|---|
| 334 | for (UInt_t i=0; i<npixels; i++)
|
|---|
| 335 | {
|
|---|
| 336 |
|
|---|
| 337 | MHCalibrationTestPix &pix = (MHCalibrationTestPix&)(*fTestCam)[i];
|
|---|
| 338 | MBadPixelsPix &bad = (*fBadPixels)[i];
|
|---|
| 339 |
|
|---|
| 340 | const Int_t aidx = (*fGeom)[i].GetAidx();
|
|---|
| 341 | const Int_t sector = (*fGeom)[i].GetSector();
|
|---|
| 342 | const Float_t area = (*fGeom)[i].GetA();
|
|---|
| 343 | const Double_t nphot = pix.GetMean();
|
|---|
| 344 |
|
|---|
| 345 | if ( nphot < lowlim[aidx] || nphot > upplim[aidx] )
|
|---|
| 346 | {
|
|---|
| 347 | *fLog << warn << "Deviating number of calibrated photons: "
|
|---|
| 348 | << Form("%4.2f",nphot) << " out of accepted limits: ["
|
|---|
| 349 | << Form("%4.2f%s%4.2f",lowlim[aidx],",",upplim[aidx]) << "] in pixel " << i << endl;
|
|---|
| 350 | bad.SetUncalibrated( MBadPixelsPix::kDeviatingNumPhots );
|
|---|
| 351 | bad.SetUnsuitable ( MBadPixelsPix::kUnsuitableRun );
|
|---|
| 352 | continue;
|
|---|
| 353 | }
|
|---|
| 354 |
|
|---|
| 355 | areavars [aidx] += nphot*nphot/area/area;
|
|---|
| 356 | areaphotons [aidx] += nphot/area;
|
|---|
| 357 | numareavalid [aidx] ++;
|
|---|
| 358 |
|
|---|
| 359 | sectorvars [sector] += nphot*nphot/area/area;
|
|---|
| 360 | sectorphotons [sector] += nphot/area;
|
|---|
| 361 | numsectorvalid[sector] ++;
|
|---|
| 362 | }
|
|---|
| 363 |
|
|---|
| 364 | for (UInt_t aidx=0; aidx<nareas; aidx++)
|
|---|
| 365 | {
|
|---|
| 366 |
|
|---|
| 367 | areavars [aidx] -= areaphotons[aidx]*areaphotons[aidx]/numareavalid[aidx];
|
|---|
| 368 | areaphotons[aidx] /= numareavalid[aidx];
|
|---|
| 369 | areavars [aidx] /= numareavalid[aidx]-1.;
|
|---|
| 370 |
|
|---|
| 371 | if (areavars[aidx] <= 0. || areaphotons[aidx] <= 0.)
|
|---|
| 372 | {
|
|---|
| 373 | *fLog << warn << " Mean number of photons per area in area index "
|
|---|
| 374 | << aidx << " cannot be calculated! Mean: " << areaphotons[aidx]
|
|---|
| 375 | << " Variance: " << areavars[aidx] << endl;
|
|---|
| 376 | continue;
|
|---|
| 377 | }
|
|---|
| 378 |
|
|---|
| 379 | *fLog << " Mean number of photons per area in area index " << aidx
|
|---|
| 380 | << ": " << Form("%5.4f +- %5.4f",areaphotons[aidx],TMath::Sqrt(areavars[aidx])) << endl;
|
|---|
| 381 | }
|
|---|
| 382 |
|
|---|
| 383 | for (UInt_t sector=0; sector<nsectors; sector++)
|
|---|
| 384 | {
|
|---|
| 385 |
|
|---|
| 386 | sectorvars [sector] -= sectorphotons[sector]*sectorphotons[sector]/numsectorvalid[sector];
|
|---|
| 387 | sectorphotons[sector] /= numsectorvalid[sector];
|
|---|
| 388 | sectorvars [sector] /= numsectorvalid[sector]-1.;
|
|---|
| 389 |
|
|---|
| 390 | if (sectorvars[sector] <= 0. || sectorphotons[sector] <= 0.)
|
|---|
| 391 | {
|
|---|
| 392 | *fLog << warn << " Mean number of calibrated photons per area from sector "
|
|---|
| 393 | << sector << " cannot be calculated! " << endl;
|
|---|
| 394 | continue;
|
|---|
| 395 | }
|
|---|
| 396 |
|
|---|
| 397 | *fLog << " Mean number of photons per area in sector " << sector
|
|---|
| 398 | << ": " << Form("%5.4f +- %5.4f",sectorphotons[sector],TMath::Sqrt(sectorvars[sector])) << endl;
|
|---|
| 399 | }
|
|---|
| 400 |
|
|---|
| 401 | return;
|
|---|
| 402 | }
|
|---|
| 403 |
|
|---|
| 404 |
|
|---|
| 405 | // -----------------------------------------------------------------------------------------------
|
|---|
| 406 | //
|
|---|
| 407 | // Print out statistics about not interpolated pixels
|
|---|
| 408 | //
|
|---|
| 409 | void MCalibrationTestCalc::PrintNotInterpolated() const
|
|---|
| 410 | {
|
|---|
| 411 |
|
|---|
| 412 | const TArrayI &arr = fTestCam->GetNotInterpolateablePixels();
|
|---|
| 413 | const Int_t areas = fGeom->GetNumAreas();
|
|---|
| 414 |
|
|---|
| 415 | TArrayI *newarr[areas];
|
|---|
| 416 |
|
|---|
| 417 | for (Int_t aidx=0; aidx<areas; aidx++)
|
|---|
| 418 | newarr[aidx] = new TArrayI(0);
|
|---|
| 419 |
|
|---|
| 420 | TArrayI numtot;
|
|---|
| 421 | numtot.Set(areas);
|
|---|
| 422 |
|
|---|
| 423 | for (Int_t i=0; i<arr.GetSize(); i++)
|
|---|
| 424 | {
|
|---|
| 425 | const Int_t id = arr[i];
|
|---|
| 426 | const Int_t aidx = (*fGeom)[id].GetAidx();
|
|---|
| 427 | const Int_t size = newarr[aidx]->GetSize();
|
|---|
| 428 | newarr[aidx]->Set(size+1);
|
|---|
| 429 | newarr[aidx]->AddAt(id,size);
|
|---|
| 430 | numtot[aidx]++;
|
|---|
| 431 | }
|
|---|
| 432 |
|
|---|
| 433 | Int_t num = 0;
|
|---|
| 434 |
|
|---|
| 435 | for (Int_t aidx = 0; aidx<areas; aidx++)
|
|---|
| 436 | {
|
|---|
| 437 | *fLog << " " << setw(7)
|
|---|
| 438 | << numtot[aidx] << " not interpolateable pixels in area index " << aidx << endl;
|
|---|
| 439 | *fLog << " " << setw(7)
|
|---|
| 440 | << "Pixel software idx: ";
|
|---|
| 441 | for (Int_t i=0; i<newarr[aidx]->GetSize(); i++)
|
|---|
| 442 | {
|
|---|
| 443 | *fLog << newarr[aidx]->At(i) << " ";
|
|---|
| 444 | num++;
|
|---|
| 445 | }
|
|---|
| 446 | *fLog << endl;
|
|---|
| 447 | }
|
|---|
| 448 |
|
|---|
| 449 |
|
|---|
| 450 | *fLog << " " << setw(7) << num << " total not interpolateable pixels " << endl;
|
|---|
| 451 |
|
|---|
| 452 | }
|
|---|
| 453 |
|
|---|
| 454 | // --------------------------------------------------------------------------
|
|---|
| 455 | //
|
|---|
| 456 | // Set the path for output file
|
|---|
| 457 | //
|
|---|
| 458 | void MCalibrationTestCalc::SetOutputPath(TString path)
|
|---|
| 459 | {
|
|---|
| 460 | fOutputPath = path;
|
|---|
| 461 | if (fOutputPath.EndsWith("/"))
|
|---|
| 462 | fOutputPath = fOutputPath(0, fOutputPath.Length()-1);
|
|---|
| 463 | }
|
|---|
| 464 |
|
|---|
| 465 | void MCalibrationTestCalc::SetOutputFile(TString file)
|
|---|
| 466 | {
|
|---|
| 467 | fOutputFile = file;
|
|---|
| 468 | }
|
|---|
| 469 |
|
|---|
| 470 | // --------------------------------------------------------------------------
|
|---|
| 471 | //
|
|---|
| 472 | // Get the output file
|
|---|
| 473 | //
|
|---|
| 474 | const char* MCalibrationTestCalc::GetOutputFile()
|
|---|
| 475 | {
|
|---|
| 476 | return Form("%s/%s", (const char*)fOutputPath, (const char*)fOutputFile);
|
|---|
| 477 | }
|
|---|