Changeset 5570 for trunk


Ignore:
Timestamp:
12/08/04 18:02:12 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r5567 r5570  
    2929    - added correct decoding of the 200ns information as proposed by
    3030      Florian to DecodeTime
     31
     32   * callisto.cc:
     33     - more fixes to make calibration of signal (Y) work again
     34
     35   * mcalib/MCalibrateData.cc:
     36     - allow calibration of Mean and Rms from different input
     37       containers
     38
     39   * mjobs/MJCalibrateSignal.[h,cc]:
     40     - removed SetNoiseCalculation -- now in its correct location
     41     - added a second MPedCalcFromLoGain
     42     - some more default setup
     43     - added some new tabs with histograms
     44     - ProcessFile now takes too input containers
     45
     46   * mjobs/MJCalibration.cc:
     47     - set rel-time-calibration kTRUE by default
     48     - removed SetNoiseCalculation -- now in its correct location
     49     - enhanced writing extractors
     50
     51   * mjobs/MJPedestal.[h,cc]:
     52     - if cloning extractor - don't use name
     53
     54   * mpedestal/MExtractPedestal.[h,cc]:
     55     - some minor changes to output
     56     - fixed order or arguments of FindObject
     57
     58   * mpedestal/MPedCalcFromLoGain.[h,cc]:
     59     - handle SetNoiseCalculation when calculating noise!
     60
     61   * msignal/MExtractTimeAndCharge.cc:
     62     - some minor changes to output
     63
     64   * msignal/MExtractTimeAndChargeDigitalFilter.[h,cc]:
     65     - some minor changes to output
     66     - do not write fNameWeightsFile
     67     - do not write fWeightsSet
     68     - do not write fRandomIter
    3169
    3270
  • trunk/MagicSoft/Mars/callisto.cc

    r5564 r5570  
    414414        job2.SetOverwrite(kOverwrite);
    415415        job2.SetPathData(kInpathD);
     416        job1.SetPathIn(kInpathY);
    416417        // job1.SetPathOut(kOutpathC); // not yet needed
    417418        // job1.SetPathIn(kInpathC);   // not yet needed
     
    434435            return 1;
    435436        }
    436 /*
     437
    437438        //
    438439        // Extract signal and calibrate it
    439440        //
    440         MJCalibrateSignal job2(Form("MJCalibrateSignal #%d", seq.GetSequence()));
    441         job2.SetSequence(seq);
    442         job2.SetDisplay(d);;
    443         job2.SetEnv(kConfig);
    444         job2.SetEnvDebug(kDebugEnv);
    445         job2.SetOverwrite(kOverwrite);
    446         job2.SetPathIn(kInpathY);
    447         job2.SetPathOut(kOutpathY);
    448         job2.SetPathData(kInpathD);
     441        MJCalibrateSignal job3(Form("MJCalibrateSignal #%d", seq.GetSequence()));
     442        job3.SetSequence(seq);
     443        job3.SetDisplay(d);;
     444        job3.SetEnv(kConfig);
     445        job3.SetEnvDebug(kDebugEnv);
     446        job3.SetOverwrite(kOverwrite);
     447        job3.SetPathIn(kInpathY);
     448        job3.SetPathOut(kOutpathY);
     449        job3.SetPathData(kInpathD);
    449450
    450451        // Where to search for calibration files
    451         if (!job2.ProcessFile(job1.GetPedestalCam()))
    452             return -1;
    453 
    454         if (!job2.GetDisplay())
    455         {
    456             gLog << warn << "Display closed by user... execution aborted." << endl << endl;
    457             return 1;
    458         }*/
     452        if (!job3.ProcessFile(job1.GetPedestalCam(), job2.GetPedestalCam()))
     453            return -1;
     454
     455        if (!job3.GetDisplay())
     456        {
     457            gLog << warn << "Display closed by user... execution aborted." << endl << endl;
     458            return 1;
     459        }
    459460    }
    460461
  • trunk/MagicSoft/Mars/mcalib/MCalibrateData.cc

    r5196 r5570  
    6666//     SetPedestalFlag(MCalibrateData::kEvent)  (calibration is done for each event)
    6767//
    68 //   By calling SetNamePedADCContainer() and/or SetNamePedPhotContainer() you
     68//   By calling SetNamePedestalCam() and/or SetNamePedPhotCam() you
    6969//   can control the name of the MPedestalCam and/or MPedPhotCam container which is used.
    7070//
     
    7676//     MCalibrateData cal2;
    7777//     cal2.SetCalibrationMode(MCalibrateData::kSkip);
    78 //     cal2.SetNamePedADCContainer("MPedestalFromLoGain");
    79 //     cal2.SetNamePedPhotContainer("MPedPhotFromLoGain")
     78//     cal2.SetNamePedestalCam("MPedestalFromLoGain");
     79//     cal2.SetNamePedPhotCam("MPedPhotFromLoGain")
    8080//     cal2.SetPedestalFlag(MCalibrateData::kEvent);
    8181//
     
    133133using namespace std;
    134134
    135 const TString MCalibrateData::fgNamePedADCContainer  = "MPedestalCam";
    136 const TString MCalibrateData::fgNamePedPhotContainer = "MPedPhotCam";
     135const TString MCalibrateData::fgNamePedestalCam  = "MPedestalCam";
     136const TString MCalibrateData::fgNamePedPhotCam = "MPedPhotCam";
     137
    137138// --------------------------------------------------------------------------
    138139//
     
    143144// Initializes:
    144145// - fCalibrationMode to kDefault
    145 // - fPedestalFlag to kRun
     146// - fPedestalFlag to kNo
    146147// - fNamePedADCRunContainer    to "MPedestalCam" 
    147148// - fNamePedPhotRunContainer   to "MPedPhotCam"   
    148149//
    149150MCalibrateData::MCalibrateData(CalibrationMode_t calmode,const char *name, const char *title)
    150     : fGeomCam(NULL),   fPedestal(NULL),
     151    : fGeomCam(NULL),   fPedestalMean(NULL), fPedestalRms(NULL),
    151152      fBadPixels(NULL), fCalibrations(NULL), fQEs(NULL), fSignals(NULL),
    152153      fPedPhot(NULL),   fCerPhotEvt(NULL), fPedestalFlag(kNo)
     
    158159  SetCalibrationMode(calmode);
    159160
    160   SetNamePedADCContainer();
    161   SetNamePedPhotContainer();
     161  SetNamePedestalCam();
     162  SetNamePedPhotCam();
    162163}
    163164
     
    225226    }
    226227
    227     fPedestal = 0;
     228    //fPedestalMean = 0;
     229    //fPedestalRms  = 0;
    228230    fPedPhot  = 0;
    229231    if (fPedestalFlag)
    230232    {
    231         fPedestal = (MPedestalCam*)pList->FindObject(AddSerialNumber(fNamePedADCContainer), "MPedestalCam");
    232         if (!fPedestal)
    233         {
    234             *fLog << err << AddSerialNumber(fNamePedADCContainer) << " [MPedestalCam] not found ... aborting" << endl;
    235             return kFALSE;
    236         }
    237 
    238         fPedPhot = (MPedPhotCam*)pList->FindCreateObj("MPedPhotCam", AddSerialNumber(fNamePedPhotContainer));
     233        if (!fPedestalMean)
     234        {
     235            fPedestalMean = (MPedestalCam*)pList->FindObject(AddSerialNumber(fNamePedestalCam), "MPedestalCam");
     236            if (!fPedestalMean)
     237            {
     238                *fLog << err << AddSerialNumber(fNamePedestalCam) << " [MPedestalCam] not found ... aborting" << endl;
     239                return kFALSE;
     240            }
     241        }
     242
     243        if (!fPedestalRms)
     244        {
     245            fPedestalRms = (MPedestalCam*)pList->FindObject(AddSerialNumber(fNamePedestalCam), "MPedestalCam");
     246            if (!fPedestalRms)
     247            {
     248                *fLog << err << AddSerialNumber(fNamePedestalCam) << " [MPedestalCam] not found ... aborting" << endl;
     249                return kFALSE;
     250            }
     251        }
     252
     253        fPedPhot = (MPedPhotCam*)pList->FindCreateObj("MPedPhotCam", AddSerialNumber(fNamePedPhotCam));
    239254        if (!fPedPhot)
    240255            return kFALSE;
     
    266281
    267282    // Sizes might have changed
    268     if (fPedestalFlag && (Int_t)fPedestal->GetSize() != fSignals->GetSize())
    269     {
    270         *fLog << err << "Size mismatch of MPedestalCam and MCalibrationCam... abort." << endl;
     283    if (fPedestalFlag && (Int_t)fPedestalMean->GetSize() != fSignals->GetSize())
     284    {
     285        *fLog << err << "Size mismatch of MPedestalCam for Mean and MCalibrationCam... abort." << endl;
     286        return kFALSE;
     287    }
     288
     289    if (fPedestalFlag && (Int_t)fPedestalRms->GetSize() != fSignals->GetSize())
     290    {
     291        *fLog << err << "Size mismatch of MPedestalCam for RMS and MCalibrationCam... abort." << endl;
    271292        return kFALSE;
    272293    }
     
    499520                cpix->SetPixelSaturated();
    500521        }
     522
    501523        if (pedestal)
    502524        {
    503             const MPedestalPix &ped = (*fPedestal)[pixidx];
    504 
    505525            // pedestals/(used FADC slices)   in [ADC] counts
    506             const Float_t pedes  = ped.GetPedestal()    * slices;
    507             const Float_t pedrms = ped.GetPedestalRms() * sqrtslices;
     526            const Float_t pedes  = (*fPedestalMean)[pixidx].GetPedestal()   * slices;
     527            const Float_t pedrms = (*fPedestalRms)[pixidx].GetPedestalRms() * sqrtslices;
    508528
    509529            //
     
    590610    }
    591611
    592     if (fNamePedADCContainer != fgNamePedADCContainer)
    593     {
    594         out << "   " << GetUniqueName() << ".SetNamePedADCContainer(";
    595         out << fNamePedADCContainer.Data() << ");" << endl;
    596     }
    597 
    598     if (fNamePedPhotContainer  != fgNamePedPhotContainer)
    599     {
    600         out << "   " << GetUniqueName() << ".SetNamePedPhotContainer(";
    601         out << fNamePedPhotContainer.Data() << ");" << endl;
     612    if (fNamePedestalCam != fgNamePedestalCam)
     613    {
     614        out << "   " << GetUniqueName() << ".SetNamePedestalCam(";
     615        out << fNamePedestalCam << ");" << endl;
     616    }
     617
     618    if (fNamePedPhotCam  != fgNamePedPhotCam)
     619    {
     620        out << "   " << GetUniqueName() << ".SetNamePedPhotCam(";
     621        out << fNamePedPhotCam << ");" << endl;
    602622    }
    603623}
  • trunk/MagicSoft/Mars/mcalib/MCalibrateData.h

    r5030 r5570  
    3434{
    3535private:
    36   static const TString fgNamePedADCContainer;    //! "MPedestalCam"
    37   static const TString fgNamePedPhotContainer;   //! "MPedPhotCam"
     36  static const TString fgNamePedestalCam;    //! "MPedestalCam"
     37  static const TString fgNamePedPhotCam;     //! "MPedPhotCam"
    3838 
    3939  MGeomCam              *fGeomCam;          //! Camera geometry container
    40   MPedestalCam          *fPedestal;         //! Pedestals/slice [ADC counts]
     40  MPedestalCam          *fPedestalMean;     //! Pedestals/slice [ADC counts]
     41  MPedestalCam          *fPedestalRms;      //! Pedestals/slice [ADC counts]
    4142  MBadPixelsCam         *fBadPixels;        //! Bad Pixels information
    4243  MCalibrationChargeCam *fCalibrations;     //! Calibration constants
     
    5051  Byte_t   fPedestalFlag;                   // Flags defining to calibrate the pedestal each event or each run
    5152 
    52   TString  fNamePedADCContainer;            // name of fPedestal
    53   TString  fNamePedPhotContainer;           // name of fPedPhot
     53  TString  fNamePedestalCam;            // name of fPedestal
     54  TString  fNamePedPhotCam;           // name of fPedPhot
    5455
    5556  Int_t Calibrate(Bool_t data, Bool_t pedestal) const;
     
    9596  void   SetCalibrationMode ( CalibrationMode_t calmode=kDefault ) { fCalibrationMode=calmode; }
    9697 
    97   void   SetNamePedADCContainer(const char *name=fgNamePedADCContainer.Data())
     98  void   SetNamePedestalCam(const char *name=fgNamePedestalCam.Data())
    9899  {
    99       fNamePedADCContainer  = name;
     100      fNamePedestalCam  = name;
    100101  }
    101   void   SetNamePedPhotContainer(const char *name=fgNamePedPhotContainer.Data())
     102  void SetPedestalCamMean(MPedestalCam *cam) { fPedestalMean = cam; }
     103  void SetPedestalCamRms(MPedestalCam *cam)  { fPedestalRms  = cam; }
     104
     105  void   SetNamePedPhotCam(const char *name=fgNamePedPhotCam.Data())
    102106  {
    103       fNamePedPhotContainer   = name;
     107      fNamePedPhotCam   = name;
    104108  }
    105109 
  • trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc

    r5562 r5570  
    180180}
    181181
    182 Bool_t MJCalibrateSignal::ProcessFile(MPedestalCam &pedcam)
     182Bool_t MJCalibrateSignal::ProcessFile(MPedestalCam &pedcamab, MPedestalCam &pedcam)
    183183{
    184184    if (!fSequence.IsValid())
     
    269269        *fLog << inf << "No Camera geometry found using default <MGeomCamMagic>" << endl;
    270270
    271     //
    272     // Switch off noise calculation
    273     //
    274     if (extractor1)
    275         extractor1->SetNoiseCalculation(kFALSE);
    276     if (extractor2)
    277         extractor2->SetNoiseCalculation(kFALSE);
    278 
    279271    // This is necessary for the case in which it is not in the files
    280272    MBadPixelsCam badcam;
     
    328320    MBadPixelsMerge        merge(&badpix);
    329321
    330     MPedCalcFromLoGain     pedlo;
    331     pedlo.SetPedestalUpdate(kTRUE);
     322    MPedCalcFromLoGain     pedlo1("MPedCalcFromLoGainAB");
     323    pedlo1.SetPedestalUpdate(kTRUE);
     324    pedlo1.SetPedestalsOut(&pedcamab);
     325
     326    MPedCalcFromLoGain     pedlo2;
     327    pedlo2.SetPedestalUpdate(kTRUE);
     328    pedlo2.SetPedestalsIn(&pedcamab);
    332329
    333330    if (extractor1)
     
    335332        // FIXME: How to get the fixed value 15 automatically?
    336333        const Float_t win = extractor1->GetNumHiGainSamples();
    337         pedlo.SetExtractWindow(15, (UShort_t)TMath::Nint(win));
     334        pedlo1.SetExtractWindow(15, (UShort_t)TMath::Nint(win));
     335        pedlo2.SetExtractWindow(15, (UShort_t)TMath::Nint(win));
     336
     337        if (extractor1->InheritsFrom("MExtractTimeAndCharge"))
     338            pedlo2.SetExtractor((MExtractTimeAndCharge*)extractor1);
    338339    }
    339340
     
    345346    MCalibrateData         calib;
    346347    if (filetype==3)
     348    {
    347349        calib.SetCalibrationMode(MCalibrateData::kFfactor);
     350        calib.SetPedestalFlag(MCalibrateData::kRun);
     351    }
     352    else
     353    {
     354        calib.SetPedestalCamMean(&pedcamab);
     355        calib.SetPedestalFlag(MCalibrateData::kEvent);
     356    }
     357
    348358    MCalibrateRelTimes     caltm;
    349359    MBadPixelsCalc         bpcal;
    350360    MBadPixelsTreat        treat;
    351361
    352     MHCamEvent evt0(0, "PedestalFLG", "Pedestal from Lo Gain;;P [fadc/sl]");
    353     MHCamEvent evt1(0, "Extra'd",     "Extracted Signal;;S [fadc/sl]");
    354     MHCamEvent evt2(0, "PedPhot",     "Calibrated Pedestal;;P [\\gamma]");
    355     MHCamEvent evt3(1, "PedRMS",      "Calibrated Pedestal RMS;;\\sigma_{p} [\\gamma]");
    356     MHCamEvent evt4(0, "Interp'd",    "Interpolated Signal;;S [\\gamma]");
    357     MHCamEvent evt5(2, "Unsuitable",  "Unsuitable event ratio;;%");
    358     MHCamEvent evt6(0, "Times",       "Arrival Time;;T [slice]");
     362    MHCamEvent evt0(0, "PedFLG",      "Pedestal from Lo Gain;;P [fadc/sl]");
     363    MHCamEvent evt1(2, "PedRmsFLG",   "Pedestal RMS from Lo Gain;;\\sigma_{p} [fadc/sl]");
     364    MHCamEvent evt2(0, "Extra'd",     "Extracted Signal;;S [fadc/sl]");
     365    MHCamEvent evt3(0, "PedPhot",     "Calibrated Pedestal;;P [\\gamma]");
     366    MHCamEvent evt4(1, "PedRMS",      "Calibrated Pedestal RMS;;\\sigma_{p} [\\gamma]");
     367    MHCamEvent evt5(0, "Interp'd",    "Interpolated Signal;;S [\\gamma]");
     368    MHCamEvent evt6(2, "Unsuitable",  "Unsuitable event ratio;;%");
     369    MHCamEvent evt7(0, "Times",       "Arrival Time;;T [slice]");
    359370    evt0.EnableVariance();
    360371    evt1.EnableVariance();
     
    362373    evt3.EnableVariance();
    363374    evt4.EnableVariance();
    364     evt6.EnableVariance();
    365 
    366     MFillH fill0(&evt0, "MPedestalCam",        "FillPedestalFLG");
    367     MFillH fill1(&evt1, "MExtractedSignalCam", "FillExtracted");
    368     MFillH fill2(&evt2, "MPedPhotCam",         "FillPedPhot");
    369     MFillH fill3(&evt3, "MPedPhotCam",         "FillPedRMS");
    370     MFillH fill4(&evt4, "MCerPhotEvt",         "FillInterpolated");
    371     MFillH fill5(&evt5, "MBadPixelsCam",       "FillUnsuitable");
    372     MFillH fill6(&evt6, "MArrivalTime",        "FillTimes");
     375    evt5.EnableVariance();
     376    evt7.EnableVariance();
     377
     378    MFillH fill0(&evt0, &pedcamab,             "FillPedFLG");
     379    MFillH fill1(&evt1, "MPedestalCam",        "FillPedRmsFLG");
     380    MFillH fill2(&evt2, "MExtractedSignalCam", "FillExtracted");
     381    MFillH fill3(&evt3, "MPedPhotCam",         "FillPedPhot");
     382    MFillH fill4(&evt4, "MPedPhotCam",         "FillPedRMS");
     383    MFillH fill5(&evt5, "MCerPhotEvt",         "FillInterpolated");
     384    MFillH fill6(&evt6, "MBadPixelsCam",       "FillUnsuitable");
     385    MFillH fill7(&evt7, "MArrivalTime",        "FillTimes");
    373386
    374387    MWriteRootFile write(2, Form("%s{s/_D_/_Y_}", fPathOut.Data()), fOverwrite);
     
    418431    tlist2.AddToList(&apply);
    419432    tlist2.AddToList(&merge);
    420     tlist2.AddToList(filetype==3 ? (MTask*)&pcopy : (MTask*)&pedlo);
     433    if (filetype==3)
     434        tlist2.AddToList(&pcopy);
     435    else
     436    {
     437        tlist2.AddToList(&pedlo1);
     438        tlist2.AddToList(&pedlo2);
     439    }
    421440    tlist2.AddToList(&fill0);
     441    tlist2.AddToList(&fill1);
    422442    if (extractor1)
    423443        tlist2.AddToList(&taskenv1);
    424444    if (extractor2)
    425445        tlist2.AddToList(&taskenv2);
    426     tlist2.AddToList(&fill1);
     446    tlist2.AddToList(&fill2);
    427447    tlist2.AddToList(&calib);
    428448    tlist2.AddToList(&caltm);
    429     tlist2.AddToList(&fill2);
     449    tlist2.AddToList(&fill3);
    430450    tlist2.AddToList(&bpcal);
    431451    tlist2.AddToList(&treat);
    432     tlist2.AddToList(&fill3);
    433452    tlist2.AddToList(&fill4);
    434453    tlist2.AddToList(&fill5);
    435454    tlist2.AddToList(&fill6);
     455    tlist2.AddToList(&fill7);
    436456
    437457    // Setup List for Drive-tree
  • trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.h

    r5562 r5570  
    3434    MJCalibrateSignal(const char *name=NULL, const char *title=NULL);
    3535
    36     Bool_t ProcessFile(MPedestalCam &cam);
     36    Bool_t ProcessFile(MPedestalCam &camab, MPedestalCam &cam);
    3737
    3838    ClassDef(MJCalibrateSignal, 0) // Tool to create a pedestal file (MPedestalCam)
  • trunk/MagicSoft/Mars/mjobs/MJCalibration.cc

    r5562 r5570  
    213213  SetUsePINDiode();
    214214 
    215   SetRelTimeCalibration( kFALSE );
    216   SetDataCheck         ( kFALSE );
    217   SetDebug             ( kFALSE );
    218   SetIntensity         ( kFALSE );
    219 
    220   SetNoStorage         ( kFALSE );
    221   SetHistsStorage      ( kFALSE );
     215  SetRelTimeCalibration();
     216  SetDataCheck(kFALSE);
     217  SetDebug(kFALSE);
     218  SetIntensity(kFALSE);
     219
     220  SetNoStorage(kFALSE);
     221  SetHistsStorage(kFALSE);
    222222}
    223223
     
    16851685
    16861686    //
    1687     // Switch off noise calculation
    1688     //
    1689     fExtractor->SetNoiseCalculation(kFALSE);
    1690     fTimeExtractor->SetNoiseCalculation(kFALSE);
    1691 
    1692     //
    16931687    // Setup more tasks and tasklist
    16941688    //
     
    17181712   
    17191713        if (IsRelTimes())
    1720           tlist.AddToList(&taskenv2);
     1714            tlist.AddToList(&taskenv2);
    17211715    }
    17221716   
     
    17661760
    17671761    if (!WriteTasks(taskenv.GetTask(), taskenv2.GetTask()))
    1768       return kFALSE;
     1762        return kFALSE;
    17691763
    17701764    // Execute first analysis
     
    19081902Bool_t MJCalibration::WriteTasks(MTask *t1, MTask *t2) const
    19091903{
    1910 
    1911   if (IsNoStorage())
     1904    if (IsNoStorage())
     1905        return kTRUE;
     1906
     1907    if (fPathOut.IsNull())
     1908        return kTRUE;
     1909
     1910    const TString oname(GetOutputFile());
     1911
     1912    *fLog << inf << "Writing to file: " << oname << endl;
     1913
     1914    TFile file(oname, fOverwrite?"RECREATE":"NEW", "File created by MJCalibration", 9);
     1915    if (!file.IsOpen())
     1916    {
     1917        *fLog << err << "ERROR - Couldn't open file " << oname << " for writing..." << endl;
     1918        return kFALSE;
     1919    }
     1920
     1921    if (t1)
     1922    {
     1923        *fLog << inf << " - Writing Task " << t1->GetName() << " [" << t1->ClassName() << "]..." << flush;
     1924        if (t1->Write()<=0)
     1925        {
     1926            *fLog << err << "Unable to write " << t1->GetName() << " to " << oname << endl;
     1927            return kFALSE;
     1928        }
     1929        *fLog << "ok." << endl;
     1930    }
     1931
     1932    if (t2)
     1933    {
     1934        *fLog << inf << " - Writing Task " << t2->GetName() << " [" << t2->ClassName() << "]..." << flush;
     1935        if (t2->Write()<=0)
     1936        {
     1937            *fLog << err << "Unable to write " << t2->GetName() << " to " << oname << endl;
     1938            return kFALSE;
     1939        }
     1940        *fLog << "ok." << endl;
     1941    }
     1942
    19121943    return kTRUE;
    1913 
    1914   if (fPathOut.IsNull())
    1915     return kTRUE;
    1916  
    1917   const TString oname(GetOutputFile());
    1918 
    1919   *fLog << inf << "Writing to file: " << oname << endl;
    1920  
    1921   TFile file(oname, fOverwrite?"RECREATE":"NEW", "File created by MJCalibration", 9);
    1922   if (!file.IsOpen())
    1923     {
    1924       *fLog << err << "ERROR - Couldn't open file " << oname << " for writing..." << endl;
    1925       return kFALSE;
    1926     }
    1927  
    1928   if (t1 && t1->Write()<=0)
    1929     {
    1930       *fLog << err << "Unable to write " << t1->GetName() << " to " << oname << endl;
    1931       return kFALSE;
    1932     }
    1933  
    1934   if (t2 && t2->Write()<=0)
    1935     {
    1936       *fLog << err << "Unable to write " << t2->GetName() << " to " << oname << endl;
    1937       return kFALSE;
    1938     }
    1939  
    1940   return kTRUE;
    19411944}
    19421945
  • trunk/MagicSoft/Mars/mjobs/MJPedestal.cc

    r5557 r5570  
    151151Bool_t MJPedestal::ReadPedestalCam()
    152152{
    153     if (IsNoStorage())
    154         return kFALSE;
    155 
    156153    const TString fname = GetOutputFile();
    157154
    158     if (gSystem->AccessPathName(fname, kFileExists))
    159     {
    160         *fLog << warn << "Input file " << fname << " doesn't exist, will create it." << endl;
    161         return kFALSE;
    162     }
    163 
    164     *fLog << inf << "Reading from file: " << fname << endl;
     155    *fLog << inf << "Reading pedestals from file: " << fname << endl;
    165156
    166157    TFile file(fname, "READ");
     
    198189    const TString fname = Form("%s/calib%06d.root",fPathIn.Data(), fSequence.GetSequence());
    199190
    200     *fLog << inf << "Reading from file: " << fname << endl;
     191    *fLog << inf << "Reading extractor from file: " << fname << endl;
    201192
    202193    TFile file(fname, "READ");
     
    213204        return NULL;
    214205    }
    215     return o ? (MExtractor*)o->Clone() : NULL;
     206
     207    return o ? (MExtractor*)o->Clone("ExtractSignal") : NULL;
    216208}
    217209
     
    684676    if (fExtractor)
    685677        delete fExtractor;
    686     fExtractor = ext ? (MExtractor*)ext->Clone() : NULL;
     678    fExtractor = ext ? (MExtractor*)ext->Clone(ext->GetName()) : NULL;
    687679}
    688680
     
    721713    SetNoStorage(GetEnv("DisableOutput", IsNoStorage()));
    722714
    723     MTaskEnv tenv;
     715    MTaskEnv tenv("ExtractSignal");
    724716    tenv.SetDefault(fExtractor);
    725717
     
    737729
    738730    SetExtractor((MExtractor*)tenv.GetTask());
     731
    739732    return kTRUE;
    740733}
     
    816809    }
    817810
    818     //if (!CheckEnv())
    819     //    return kFALSE;
    820 
    821     CheckEnv();
     811    if (!CheckEnv())
     812        return kFALSE;
    822813
    823814    // --------------------------------------------------------------------------------
     
    944935    }
    945936
     937    /*
    946938    if (!fPathIn.IsNull())
    947939    {
     
    949941        fExtractor = 0;
    950942    }
    951 
    952     //
    953     // Check that the extractor has the bit Noise Calculation() set which
    954     // means that the each "sliding" of the sliding window is not applied
    955     //
    956     if (fExtractor)
    957         fExtractor->SetNoiseCalculation(fExtractorResolution);
    958 
     943    */
    959944    //
    960945    // Execute the eventloop
  • trunk/MagicSoft/Mars/mpedestal/MExtractPedestal.cc

    r5558 r5570  
    250250  fRunHeader    = NULL;
    251251  fEvtHeader    = NULL;
    252   fPedestalsOut = NULL;
    253252
    254253  // If the size is yet set, set the size
     
    344343  if (fExtractor && !fPedestalsIn)
    345344  {
    346       fPedestalsIn = (MPedestalCam*)pList->FindObject("MPedestalCam", AddSerialNumber(fNamePedestalCamIn));
     345      fPedestalsIn = (MPedestalCam*)pList->FindObject(AddSerialNumber(fNamePedestalCamIn), "MPedestalCam");
    347346      if (!fPedestalsIn)
    348347      {
     
    352351  }
    353352
    354   fPedestalsOut = (MPedestalCam*)pList->FindCreateObj("MPedestalCam", AddSerialNumber(fNamePedestalCamOut));
    355353  if (!fPedestalsOut)
    356       return kFALSE;
     354  {
     355      fPedestalsOut = (MPedestalCam*)pList->FindCreateObj("MPedestalCam", AddSerialNumber(fNamePedestalCamOut));
     356      if (!fPedestalsOut)
     357          return kFALSE;
     358  }
    357359
    358360  *fLog << inf;
     
    630632    *fLog << "Name of input  MPedestalCam:  " << (fPedestalsIn?fPedestalsIn->GetName():fNamePedestalCamIn.Data()) << " (" << fPedestalsIn << ")" << endl;
    631633    *fLog << "Name of output MPedestalCam:  " << (fPedestalsOut?fPedestalsOut->GetName():fNamePedestalCamOut.Data()) << " (" << fPedestalsOut << ")" << endl;
    632     *fLog << "Num evts for pedestal   calc: " << fNumEventsDump << endl;
    633     *fLog << "Num evts for avg.areas  calc: " << fNumAreasDump << endl;
    634     *fLog << "Num evts for avg.sector calc: " << fNumSectorsDump << endl;
    635634    *fLog << "Pedestal Update is            " << (fPedestalUpdate?"on":"off") << endl;
    636     *fLog << "ExtractWindow from slice " << fExtractWinFirst << " to " << fExtractWinLast << " incl." << endl;
    637 
     635    if (fPedestalUpdate)
     636    {
     637        *fLog << "Num evts for pedestal   calc: " << fNumEventsDump << endl;
     638        *fLog << "Num evts for avg.areas  calc: " << fNumAreasDump << endl;
     639        *fLog << "Num evts for avg.sector calc: " << fNumSectorsDump << endl;
     640    }
    638641    if (fExtractor)
    639642        *fLog << "Extractor used:               " << fExtractor->ClassName() << endl;
    640 }
     643    *fLog << "ExtractWindow from slice " << fExtractWinFirst << " to " << fExtractWinLast << " incl." << endl;
     644}
  • trunk/MagicSoft/Mars/mpedestal/MExtractPedestal.h

    r5558 r5570  
    9494
    9595  void SetPedestalsIn(MPedestalCam *pedcam) { fPedestalsIn = pedcam; }
     96  void SetPedestalsOut(MPedestalCam *pedcam) { fPedestalsOut = pedcam; }
    9697
    9798  void SetExtractor(MExtractTimeAndCharge *e) { fExtractor = e; }
  • trunk/MagicSoft/Mars/mpedestal/MPedCalcFromLoGain.cc

    r5558 r5570  
    320320
    321321        Float_t sum  = 0.;
    322         UInt_t  sumi = 0;
    323322
    324323        //extract pedestal
     
    327326        else
    328327        {
     328            UInt_t  sumi = 0;
    329329            for(Byte_t *slice=slices+fExtractWinFirst; slice<=slices+fExtractWinLast; slice++)
    330330                sumi += *slice;
     
    422422
    423423    Float_t dummy;
     424    fExtractor->SetNoiseCalculation(kTRUE);
    424425    fExtractor->FindTimeAndChargeHiGain(logain,logain,sum,dummy,dummy,dummy,sat,ped,logainabflag);
    425 }
    426 
     426    fExtractor->SetNoiseCalculation(kFALSE);
     427}
    427428
    428429// --------------------------------------------------------------------------
  • trunk/MagicSoft/Mars/mpedestal/MPedCalcPedRun.cc

    r5559 r5570  
    316316
    317317    Float_t dummy;
     318    fExtractor->SetNoiseCalculation(kTRUE);
    318319    fExtractor->FindTimeAndChargeHiGain(first,logain,sum,dummy,dummy,dummy,sat,ped,abflag);
     320    fExtractor->SetNoiseCalculation(kFALSE);
    319321}
    320322
  • trunk/MagicSoft/Mars/msignal/MExtractTimeAndCharge.cc

    r5558 r5570  
    245245void MExtractTimeAndCharge::Print(Option_t *o) const
    246246{
    247   if (IsA()==MExtractTimeAndCharge::Class())
     247  if (IsA()==Class())
    248248    *fLog << GetDescriptor() << ":" << endl;
    249  
    250   *fLog << dec << endl;
    251   *fLog << "Taking " << fNumHiGainSamples
     249
     250  *fLog << dec;
     251  *fLog << " Taking " << fNumHiGainSamples
    252252        << " HiGain samples from slice " << (Int_t)fHiGainFirst
    253253        << " to " << (Int_t)(fHiGainLast+fHiLoLast) << " incl" << endl;
    254   *fLog << inf << "Taking " << fNumLoGainSamples
     254  *fLog << " Taking " << fNumLoGainSamples
    255255        << " LoGain samples from slice " << (Int_t)fLoGainFirst
    256256        << " to " << (Int_t)fLoGainLast << " incl" << endl;
  • trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeDigitalFilter.cc

    r5558 r5570  
    234234  const Float_t pedes  = ped.GetPedestal();
    235235  const Float_t ABoffs = ped.GetPedestalABoffset();
    236        
     236
    237237  Float_t pedmean[2];
    238238  pedmean[0] = pedes + ABoffs;
     
    260260        sat++;
    261261    }
    262  
     262
    263263  if (fHiLoLast != 0)
    264264    {
     
    284284        }
    285285    }
    286  
     286
    287287  //
    288288  // allow one saturated slice
     
    300300        fRandomIter = 0;
    301301      for (Int_t ids=0; ids < fWindowSizeHiGain; ids++)
    302         {
     302      {
    303303          const Int_t   idx = fBinningResolutionHiGain*ids + fRandomIter;
    304304          sum              += fAmpWeightsHiGain [idx]*fHiGainSignal[ids];
     
    364364        }
    365365    }
    366  
     366
    367367  sum = 0.;
    368368  time_sum = 0.;
     
    10121012void MExtractTimeAndChargeDigitalFilter::Print(Option_t *o) const
    10131013{
     1014    if (IsA()==Class())
     1015        *fLog << GetDescriptor() << ":" << endl;
     1016
    10141017    MExtractTimeAndCharge::Print(o);
    10151018    *fLog << " Time Shift  HiGain: " << fTimeShiftHiGain         << "  LoGain: " << fTimeShiftLoGain << endl;
    10161019    *fLog << " Window Size HiGain: " << fWindowSizeHiGain        << "  LoGain: " << fWindowSizeLoGain << endl;
    10171020    *fLog << " Binning Res HiGain: " << fBinningResolutionHiGain << "  LoGain: " << fBinningResolutionHiGain << endl;
    1018     *fLog << " Weights File:       " << fNameWeightsFile.Data() << endl;
     1021    *fLog << " Weights File:       " << fNameWeightsFile << endl;
    10191022
    10201023    TString opt(o);
  • trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeDigitalFilter.h

    r5529 r5570  
    4848  MArrayF fTimeWeightsLoGain;                   //! Time weights Low-Gain (from weights file)
    4949
    50   TString fNameWeightsFile;                     // Name of the weights file
    51   Bool_t  fWeightsSet;                          // Flag if weights have alreayd been set
    52   UInt_t  fRandomIter;                          // Counter used to randomize weights for noise calculation
     50  TString fNameWeightsFile;                     //! Name of the weights file
     51  Bool_t  fWeightsSet;                          //! Flag if weights have alreayd been set
     52  UInt_t  fRandomIter;                          //! Counter used to randomize weights for noise calculation
    5353
    5454  Bool_t  InitArrays();
Note: See TracChangeset for help on using the changeset viewer.