Changeset 5683


Ignore:
Timestamp:
12/22/04 21:45:54 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/macros/calibration.C

    r5532 r5683  
    5959#include "MJPedestal.h"
    6060#include "MJCalibration.h"
    61 #include "MJExtractSignal.h"
    6261#include "MJExtractCalibTest.h"
     62#include "MJCalibrateSignalFromOutside.h"
    6363#include "MRunIter.h"
    6464#include "MStatusDisplay.h"
     
    6969#include "MArray.h"
    7070#include "MParContainer.h"
     71#include "MGeomCamMagic.h"
    7172
    7273#include "TStyle.h"
     
    9899static  const Int_t calrun2 = 0;
    99100//
     101// the default start data run
     102//
     103static const Int_t   datrun1 = 39900;
     104//
     105// the default last calibration run (if 0, only one run is taken, otherwise consecutive runs
     106// between calrun1 and calrun2)
     107//
     108static  const Int_t datrun2 = 0;
     109//
    100110// A switch to output debugging information about Objects use
    101111//
     
    120130// Tell if you want to test the intensity calibration
    121131//
    122 static Bool_t useIntensity = kFALSE;
     132static Bool_t useIntensity  = kFALSE;
    123133//
    124134// Tell if you want to store and read the F0 and F1- files
    125135//
    126 static Bool_t usestorage   = kFALSE;
     136static Bool_t usestorage   = kTRUE;
    127137//
    128138// Tell which extractor you want to use. The flags are counted according
    129139// to the extractor-TDAS
    130140//
    131 static Int_t extractorflag = 1;
     141static Int_t extractorflag = 33;
    132142//
    133143Int_t calibration(const UInt_t extflag=extractorflag, const Int_t prun=pedrun,
    134                   const Int_t crun1=calrun1, const Int_t crun2=calrun2)
     144                  const Int_t crun1=calrun1, const Int_t crun2=calrun2,
     145                  const Int_t drun1=datrun1, const Int_t drun2=datrun2)
    135146{
    136147
    137   MExtractor *extractor = getExtractor(extflag);
     148  MExtractor *extractor = getExtractor(extflag==33 ? 32 : extflag);
    138149
    139150  if (!extractor)
     
    164175    cruns.AddRuns(crun1,crun2,inpath);
    165176
     177 
    166178  MStatusDisplay *display = NULL;
    167179
     
    179191  // Hand over to the jobs a QE Cam with Cornings initialized
    180192  //
     193  MGeomCamMagic          geomcam;
    181194  MCalibrationQECamMagic qecam;
    182195  MBadPixelsCam          badcam;
     196  badcam.InitSize(geomcam.GetNumPixels());
    183197  //
    184198  // If you want to exclude pixels from the beginning, read
     
    193207
    194208  MJPedestal pedloop1;
    195   pedloop1.SetNoStorage(!usestorage);
     209  pedloop1.SetNoStorage();
    196210  pedloop1.SetEnvDebug(debug);
    197211  pedloop1.SetExtractor(extractor);
     
    218232    {
    219233      /***********************************************************/
    220       /* NEEDE FOR SECOND LOOP: EXTRACTOR RESOLUTION COMPUTATION */
     234      /* NEEDED FOR SECOND LOOP: EXTRACTOR RESOLUTION COMPUTATION */
    221235      /***********************************************************/
    222236     
    223237      pedloop2.SetUseData();
    224       pedloop2.SetNoStorage(!usestorage);
     238      pedloop2.SetNoStorage();
    225239      pedloop2.SetEnvDebug(debug);
    226240      pedloop2.SetExtractor(extractor);
     
    239253        return 1;
    240254     
    241       extractor->SetNoiseCalculation(kFALSE);
    242255      calloop.SetExtractorCam(pedloop2.GetPedestalCam());
    243256    }
     
    252265  //  calloop.SetHistsStorage();
    253266  calloop.SetNoStorage(!usestorage);
     267  calloop.SetRelTimeCalibration(kTRUE);
    254268  //
    255269  // If you want to set a colour explicitely from outside (not recommanded!)
     
    277291  calloop.SetUsePINDiode(pindiode);
    278292  calloop.SetQECam(qecam);
    279   calloop.SetBadPixels(pedloop1.GetBadPixels());
     293  calloop.SetBadPixels(badcam);
    280294
    281295  if (!calloop.Process(pedcam))
    282296    return 2;
    283297
     298  //  return 0;
     299
    284300  //
    285301  // The next lines are the use the Print() function and have
     
    288304  if (debug)
    289305    {
    290       MCalibrationChargeCam &chargecam   = calloop.GetCalibrationCam();
    291306      MCalibrationQECam     &nqecam      = calloop.GetQECam();
    292307      MBadPixelsCam         &badbad      = calloop.GetBadPixels();
     308      MCalibrationChargeCam &chargecam   = calloop.GetCalibrationCam();
    293309      chargecam.Print();
    294310      nqecam.Print();
     
    318334        return 3;
    319335     
    320       return 4;
    321      
    322     }
     336   }
     337
     338  if (drun1 == 0)
     339    return 4;
     340
     341  MRunIter druns;
     342
     343  if (drun2==0)
     344    druns.AddRun(drun1,inpath);
     345  else
     346    druns.AddRuns(drun1,drun2,inpath);
     347
    323348
    324349  /********************************************************************/
     
    326351  /********************************************************************/
    327352
    328   MJExtractSignal pedphotloop;
    329 
    330   pedphotloop.SetExtractor(extractor);
    331   pedphotloop.SetInput(&pruns);
    332   pedphotloop.SetOutputPath(outpath);
     353  if (extflag == 33)
     354    {
     355      delete extractor;
     356      extractor = getExtractor(28);
     357    }
     358 
     359  MJCalibrateSignalFromOutside calibloop;
     360
     361  calibloop.SetExtractor(extractor);
     362  calibloop.SetInput(&druns);
     363  //  calibloop.SetOutputPath(outpath);
    333364  if (useDisplay)
    334     pedphotloop.SetDisplay(display);
    335   pedphotloop.SetBadPixels(calloop.GetBadPixels());
    336  
    337   if (!pedphotloop.ProcessP(pedloop1.GetPedestalCam(),calloop.GetCalibrationCam(),calloop.GetQECam()))
     365    calibloop.SetDisplay(display);
     366  calibloop.SetBadPixels(calloop.GetBadPixels());
     367  calibloop.SetNoStorage(!usestorage);
     368 
     369  if (!calibloop.ProcessFile(pedloop1.GetPedestalCam(),timeandcharge ? pedloop2.GetPedestalCam() : pedloop1.GetPedestalCam(), calloop.GetCalibrationCam(),calloop.GetQECam(), calloop.GetRelTimeCam()))
    338370    return 5;
    339371
     
    347379    gObjectTable->Print();
    348380
     381
    349382  return 0;
    350383}
     
    355388    gLog << "Usage:" << endl;
    356389    gLog << endl;
    357     gLog << "   calibration [ped.run nr.] [first cal.run nr.] [last cal.run nr.]" << endl ;
     390    gLog << "   calibration [ped.run nr.] [first cal.run nr.] [last cal.run nr.] [first dat.run nr.] [last dat.run nr.]" << endl ;
    358391    gLog << endl;
    359392    gLog << "   ped.run.nr:        Run number of the pedestal file." << endl;
    360393    gLog << "   first cal.run nr.: Run number of the first calibration file." << endl;
    361394    gLog << "   last  cal.run nr.: Run number of the last  calibration file." << endl;
    362     gLog << endl;
    363     gLog << "All calibration runs between (first cal.run nr.) and (last  cal.run nr.) will be used" << endl;
     395    gLog << "   first dat.run nr.: Run number of the first data file to be calibrated." << endl;
     396    gLog << "   last  dat.run nr.: Run number of the last  data file to be calibrated." << endl;
     397    gLog << endl;
     398    gLog << "All calibration runs between (first cal.run nr.) and (last cal.run nr.) will be used" << endl;
    364399    gLog << "If last.cal.run.nr is 0 (default), only one calibration run is taken"                  << endl;
     400    gLog << endl;
     401    gLog << "All data runs between (first dat.run nr.) and (last dat.run nr.) will be used" << endl;
     402    gLog << "If last.dat.run.nr is 0 (default), only one data run is taken"                  << endl;
    365403    gLog << endl;
    366404    gLog << "Additional Options: " << endl;
    367405    gLog << "     --extractor=#    Choose one of the following possible extractors (integer)" << endl;
     406    gLog << "                      (default: Nr. 33)                                        " << endl;
    368407    gLog << endl;
    369408    gLog << "    Nr.    Extractor   Parameters " << endl;
     
    372411    gLog << "           with the following parameters, if 'maxbin' defines the mean position" << endl;
    373412    gLog << "           of the High-Gain FADC slice carrying the pulse maximum: " << endl;
    374     gLog << "     1:           SetRange('maxbin}}-1,'maxbin}}+2,'maxbin}}+0.5,'maxbin}}+3.5) " << endl;
     413    gLog << "     1:           SetRange('maxbin'-1,'maxbin'+2,'maxbin'+0.5,'maxbin'+3.5) " << endl;
    375414    gLog << "     2:           SetRange('maxbin'-1,'maxbin'+2,'maxbin'-0.5,'maxbin'+4.5)" << endl;
    376415    gLog << "     3:           SetRange('maxbin'-2,'maxbin'+3,'maxbin'-0.5,'maxbin'+4.5)" << endl;
     
    415454    gLog << "     31:          SetNameWeightsFile('msignal/cosmics_weights_logain4.dat')" << endl;
    416455    gLog << "     32:          SetNameWeightsFile('msignal/calibration_weights_UV.dat')" << endl;
    417     gLog << "     33:          SetNameWeightsFile('msignal/calibration_weights_UV4.dat')" << endl;
    418     gLog << "     34:          SetNameWeightsFile('msignal/calibration_weights_UV_logain6.dat')" << endl;
    419     gLog << "     35:          SetNameWeightsFile('msignal/calibration_weights_UV_logain4.dat')" << endl;
    420     gLog << "     36:  Real Fit: (not yet implemented)" << endl;
     456    gLog << "     33:          Use calibration weights for calibration events and cosmics weights for data events" << endl;
    421457    gLog << endl;
    422458    gLog << "     --inpath=#          Find the data in inpath"                      << endl;
  • trunk/MagicSoft/Mars/mjobs/JobsLinkDef.h

    r4758 r5683  
    1212#pragma link C++ class MJCalibration+;
    1313#pragma link C++ class MJCalibrateSignal+;
     14#pragma link C++ class MJCalibrateSignalFromOutside+;
    1415#pragma link C++ class MJExtractSignal+;
    1516#pragma link C++ class MJExtractCalibTest+;
  • trunk/MagicSoft/Mars/mjobs/Makefile

    r4932 r5683  
    3030           MJCalibration.cc \
    3131           MJCalibrateSignal.cc \
     32           MJCalibrateSignalFromOutside.cc \
    3233           MJExtractSignal.cc \
    3334           MJExtractCalibTest.cc
Note: See TracChangeset for help on using the changeset viewer.