- Timestamp:
- 10/24/14 15:44:04 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Mars_use_drstimefiles/fact/analysis/produce_drs_time_fits_file.C
r17994 r17996 52 52 loop0.SetParList(&plist0); 53 53 54 factfits drstimeRawFile(drs_time_file);55 const int NumberOfChips = drstimeRawFile.GetInt("NPIX")/9; // --> 16056 const int NumberOfCells = drstimeRawFile.GetInt("NROI"); // --> 102457 drstimeRawFile.close();58 59 54 MRawFitsRead read0(drs_time_file); 60 55 tlist0.AddToList(&read0); … … 75 70 } 76 71 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); 163 73 164 74 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.