Changeset 2692
- Timestamp:
- 12/17/03 16:48:25 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mtools/MTFillMatrix.cc
r2690 r2692 25 25 ///////////////////////////////////////////////////////////////////////////// 26 26 // 27 // MTFillMatrix 27 // MTFillMatrix 28 // 29 // Use this tool to fill eg trainings and test-matrices, while the matrix 30 // to be filled can be a real matrix (MHMatrix) or a file (MWriteRootFile) 31 // or both. 32 // 33 // First create a reference histogram (MH3). For more details see 34 // MFEventSelector2 which is used to select events according to the 35 // reference histogram. 36 // 37 // 38 // Here is an example of how to choose 1000 events somehow distributed in 39 // size from a file. 40 // ----------------------------------------------------------------------- 41 // 42 // MH3 ref("MHillas.fSize"); // choose a predefined size distribution 43 // // Now setup the distribution 44 // 45 // MHMatrix matrix1; // create matrix to fill 46 // matrix.AddColumn("MHillas.fWidth"); // setup columns of your matrix 47 // 48 // MReadMarsFile read("myfile.root"); // Setup your 'reader' 49 // read.DisableAutoScheme(); // make sure everything is read 50 // 51 // MTFillMatrix fill(ref); // setup MTFillMatrix 52 // fill.SetNumDestEvents1(1000); // setup number of events to select 53 // fill.SetDestMatrix1(&matrix1); // setup destination matrix 54 // if (!fill.Process()) // check if everything worked 55 // return; 56 // fill.WriteMatrix1("myoutput.root"); // write matrix to file 57 // 58 // 59 // To get two matrices instead of one (splitted randomly) you can add 60 // the following before calling Process(): 61 // ------------------------------------------------------------------------ 62 // 63 // MHMatrix matrix2; 64 // fill.SetNumDestEvents2(500); // setup number of events to select 65 // fill.SetDestMatrix2(&matrix2); // setup destination matrix 66 // [...] 67 // fill.WriteMatrix2("myoutput2.root"); 68 // 69 // 70 // To write both matrices into a single file use: 71 // ---------------------------------------------- 72 // 73 // fill.WriteMatrices("myfile.root"); 28 74 // 29 75 ///////////////////////////////////////////////////////////////////////////// … … 52 98 using namespace std; 53 99 100 // -------------------------------------------------------------------------- 101 // 102 // Print Size and contained columns. 103 // Check whether the number of generated events is compatible with 104 // the number of requested events. 105 // 54 106 Bool_t MTFillMatrix::CheckResult(MHMatrix *m, Int_t num) const 55 107 { … … 70 122 } 71 123 124 // -------------------------------------------------------------------------- 125 // 126 // Write the given MHMatrix with its name as default name to a 127 // file fname. 128 // 72 129 Bool_t MTFillMatrix::WriteMatrix(MHMatrix *m, const TString &fname, Int_t i) const 73 130 { … … 83 140 } 84 141 142 // -------------------------------------------------------------------------- 143 // 144 // Constructor. Takes an MH3 as argument. This MH3 is the reference 145 // distribution to fill the matrix. More information can be found 146 // at MFEventSelector2 which is used to select the events. 147 // 85 148 MTFillMatrix::MTFillMatrix(const MH3 &ref) 86 149 : fReference(ref), fReader(0), fDestMatrix1(0), … … 92 155 } 93 156 157 // -------------------------------------------------------------------------- 158 // 159 // Fill the matrix (FIXME: Flow diagram missing) 160 // 94 161 Bool_t MTFillMatrix::Process() 95 162 { … … 186 253 } 187 254 255 // Print execution statistics of the tasklist 188 256 tlist.PrintStatistics(); 189 257 258 // Check the result of filling... 190 259 CheckResult(fDestMatrix1, fNumDestEvents1); 191 260 CheckResult(fDestMatrix2, fNumDestEvents2); … … 195 264 } 196 265 266 // -------------------------------------------------------------------------- 267 // 268 // Write both matrices to a file. Return kFALSE if writing one of them 269 // failed or both have the same name. 270 // 197 271 Bool_t MTFillMatrix::WriteMatrices(const TString &fname) const 198 272 {
Note:
See TracChangeset
for help on using the changeset viewer.