Changeset 17996


Ignore:
Timestamp:
10/24/14 15:44:04 (10 years ago)
Author:
dneise
Message:
Former vesions violated encapsulation principle, --> using new WriteToFits feature of MDrsCalibrationTime
Now callisto_drstime.C does not have to be compiled anymore.

Location:
branches/Mars_use_drstimefiles/fact/analysis
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/Mars_use_drstimefiles/fact/analysis/callisto_drstime.C

    r17993 r17996  
    1 #include <sstream>
    2 #include <iostream>
    3 
    41#include "MLog.h"
    52#include "MLogManip.h"
    6 
    7 #include "TH1F.h"
    8 #include "TFile.h"
    9 #include "TStyle.h"
    10 #include "TGraph.h"
    11 #include "TLine.h"
    12 
    13 #include "DrsCalib.h"
    14 #include "factfits.h"
    15 #include "MDrsCalibration.h"
    16 #include "MExtralgoSpline.h"
    17 #include "MSequence.h"
    18 #include "MStatusArray.h"
    19 #include "MHCamera.h"
    20 #include "MJob.h"
    21 #include "MWriteRootFile.h"
    22 #include "MHCamera.h"
    23 #include "MBadPixelsCam.h"
    24 #include "MBadPixelsPix.h"
    25 #include "MDirIter.h"
    26 #include "MTaskList.h"
    27 #include "MFDataPhrase.h"
    28 #include "MArrayF.h"
    29 #include "MBadPixelsTreat.h"
    30 #include "MCalibrateDrsTimes.h"
    31 #include "MHSectorVsTime.h"
    32 #include "MHCamEvent.h"
    33 #include "MExtractFACT.h"
    34 #include "MFillH.h"
    35 #include "MDrsCalibApply.h"
    36 #include "MGeomApply.h"
    37 #include "MContinue.h"
    38 #include "MRawFitsRead.h"
    39 #include "MReadMarsFile.h"
    40 #include "MEvtLoop.h"
    41 #include "MParList.h"
    42 #include "MStatusDisplay.h"
    43 #include "MDrsCalibrationTime.h"
    44 #include "MH3.h"
    45 #include "MGeomCamFACT.h"
    46 #include "MCalibrateFact.h"
    47 #include "MParameters.h"
    48 #include "MWriteAsciiFile.h"
    49 #include "MFilterData.h"
    50 #include "MTreatSaturation.h"
    51 
    52 using namespace std;
    533
    544int callisto(
     
    249199    // hrate.DefaultLabelY("ERROR");
    250200
    251     MDrsCalibrationTime timecam;
    252 
    253201    gStyle->SetOptFit(kTRUE);
    254202
     
    257205    gLog << endl;
    258206    gLog.Separator("Reading DRS timing calibration constants");
    259     factfits drs_time_file(timfile.Data());
    260 
    261     const int NumberOfChips = drs_time_file.GetInt("NCHIPS");
    262     const int NumberOfCells = drs_time_file.GetInt("NCELLS");
    263     timecam.fStat.resize(NumberOfChips * NumberOfCells);
    264     double *drs_sampling_time_deviations = new double[NumberOfChips * NumberOfCells];
    265 
    266     drs_time_file.SetPtrAddress("SamplingTimeDeviation", drs_sampling_time_deviations);
    267     drs_time_file.GetNextRow();
    268     for (int i=0; i<NumberOfChips * NumberOfCells; i++){
    269         timecam.fStat[i].first = drs_sampling_time_deviations[i];
    270     }
    271     delete[] drs_sampling_time_deviations;
    272     drs_sampling_time_deviations = NULL;
    273     drs_time_file.close();
     207    MDrsCalibrationTime timecam(timfile.Data());
    274208
    275209    // ======================================================
  • branches/Mars_use_drstimefiles/fact/analysis/produce_drs_time_fits_file.C

    r17994 r17996  
    5252    loop0.SetParList(&plist0);
    5353
    54     factfits drstimeRawFile(drs_time_file);
    55     const int NumberOfChips = drstimeRawFile.GetInt("NPIX")/9;  // --> 160
    56     const int NumberOfCells = drstimeRawFile.GetInt("NROI");    // --> 1024
    57     drstimeRawFile.close();
    58 
    5954    MRawFitsRead read0(drs_time_file);
    6055    tlist0.AddToList(&read0);
     
    7570    }
    7671
    77     ofits drstimeFile(outfile);
    78     drstimeFile.SetDefaultKeys();
    79     drstimeFile.AddColumnDouble( 
    80         NumberOfChips*NumberOfCells,
    81         "SamplingTimeDeviation", "nominal slices",
    82         "see following COMMENT."
    83     );
    84     drstimeFile.SetInt("NCHIPS", NumberOfChips, "number of drs chips");
    85     drstimeFile.SetInt("NCELLS", NumberOfCells, "number of cells of each chip");
    86     drstimeFile.AddComment(
    87 "The SamplingTimeDeviation specifies the deviation of the actual ");
    88     drstimeFile.AddComment(
    89 "sampling time of a certain cell, from its nominal sampling time.");
    90     drstimeFile.AddComment(
    91 "It is measured in nominal slices.");
    92     drstimeFile.AddComment(
    93 "In order to convert the sample index into the actual sampling time");
    94     drstimeFile.AddComment(
    95 "just do: ");
    96     drstimeFile.AddComment(
    97 "     cell_index + td(cell_index) - td(stop_cell_index)");
    98     drstimeFile.AddComment(
    99 "where td(i) refers to the SamplingTimeDeviation of cell i of the ");
    100     drstimeFile.AddComment(
    101 "current DRS4 chip.");
    102     drstimeFile.AddComment(
    103 "This gives you the actual sampling time of the cell measured in ");
    104     drstimeFile.AddComment(
    105 "nominal slices [nsl] with respect to the stop cells sampling time.");
    106     drstimeFile.AddComment(
    107 "Convert it to ns, simply by multiplication ");
    108     drstimeFile.AddComment(
    109 "with 0.5 ns/nsl.");
    110     drstimeFile.AddComment(
    111 "");
    112 
    113     drstimeFile.AddComment(
    114 "In FACT it became common practice to measure un-time-calibrated ");
    115     drstimeFile.AddComment(
    116 " DRS4 data in 'time slices' or simply 'samples', while ");
    117     drstimeFile.AddComment(
    118 " time-calibrated DRS4 data usually measured in ns. Since the method,");
    119     drstimeFile.AddComment(
    120 " that is emplyed to measure the DRS4 time calibration constants has ");
    121     drstimeFile.AddComment(
    122 " no possibility to assert the actual length of a slice is really half");
    123     drstimeFile.AddComment(
    124 " a nanosecond, this practice is not advisable.");
    125     drstimeFile.AddComment(
    126 " I propose instead to call un-time-calibrated data 'samples',");
    127     drstimeFile.AddComment(
    128 " since this is what they are. If one wants to stress the fact,");
    129     drstimeFile.AddComment(
    130 " that no drs time calibration has been applied one should refer to ");
    131     drstimeFile.AddComment(
    132 "'uncalibrated slices'. Since it *should* be common practice to apply");
    133     drstimeFile.AddComment(
    134 " the drs4 time calibration in all cases, I also propose to use the");
    135     drstimeFile.AddComment(
    136 " short term of 'slices' or 'sl'. If one wants to stress, that the");
    137     drstimeFile.AddComment(
    138 " drs4 time calibration has actually been applied to the data,");
    139     drstimeFile.AddComment(
    140 " the term 'calibrated slices' or 'nominal slices' or short 'nsl'.");
    141 
    142     drstimeFile.WriteTableHeader("DRS_CELL_TIMES");
    143 
    144     // By drs_sampling_time_deviations we refer to the deviations (measured in nominal slices) of
    145     // the actual sampling time compared to the nominal sampling time of every cell of every chip.
    146     double *drs_sampling_time_deviations = new double[ NumberOfChips * NumberOfCells ];
    147     for (int chip = 0; chip < NumberOfChips; chip++){
    148         for (int cell = 0; cell < NumberOfCells; cell++){
    149             // Dominik and Sebastian:
    150             // We ended with using DrsCalibrateTime.Sum() in order to retrieve
    151             // the contents DrsCalibrateTime.fStat.
    152             // First we wanted to access the member fStat of class DrsCalibrateTime
    153             // which is declared public but it did not work out of the box.
    154             // drs_sampling_time_deviations[chip*NumberOfCells+cell] =
    155             // timecam.fStat[chip*NumberOfCells+cell].first;
    156             drs_sampling_time_deviations[ chip * NumberOfCells + cell ] =
    157                 timecam.Sum( chip * NumberOfCells + cell );
    158         }
    159     }
    160 
    161     drstimeFile.WriteRow(drs_sampling_time_deviations, sizeof(double) * NumberOfChips * NumberOfCells);
    162     drstimeFile.close();
     72    timecam.WriteToFits(outfile);
    16373
    16474    return 0;
Note: See TracChangeset for help on using the changeset viewer.