| 1 | #include <stdlib.h>
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 | #include "MOctTest.h"
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 | MOctTest::MOctTest()
|
|---|
| 8 | {
|
|---|
| 9 | // default constructor
|
|---|
| 10 | }
|
|---|
| 11 |
|
|---|
| 12 | MOctTest::~MOctTest()
|
|---|
| 13 | {
|
|---|
| 14 | // default destructor
|
|---|
| 15 | }
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 | // ================================================================================
|
|---|
| 19 | // ================================================================================
|
|---|
| 20 | // ================================================================================
|
|---|
| 21 | // ================================================================================
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 | Bool_t MOctTest::PedAdcSpectra ( Char_t *inputfile )
|
|---|
| 25 | {
|
|---|
| 26 | //
|
|---|
| 27 | //
|
|---|
| 28 |
|
|---|
| 29 | printf ("PedAdcSpectra:: Analyse the file %s \n", inputfile ) ;
|
|---|
| 30 |
|
|---|
| 31 | // create a loop for this specific job.
|
|---|
| 32 |
|
|---|
| 33 | MEvtLoop loop ;
|
|---|
| 34 |
|
|---|
| 35 | // open input file
|
|---|
| 36 |
|
|---|
| 37 | MRootFile *fileIn = new MRootFile( inputfile );
|
|---|
| 38 |
|
|---|
| 39 | // set up the ParameterList,
|
|---|
| 40 | // connect it to the loop
|
|---|
| 41 |
|
|---|
| 42 | MParList *plist = new MParList;
|
|---|
| 43 | loop.SetParList(plist);
|
|---|
| 44 |
|
|---|
| 45 | // set up the TaskList for this program
|
|---|
| 46 | // and connect it to the loop
|
|---|
| 47 |
|
|---|
| 48 | MTaskList *tasks = new MTaskList;
|
|---|
| 49 | tasks->SetEventType("PedTree") ;
|
|---|
| 50 |
|
|---|
| 51 | loop.SetTaskList(tasks);
|
|---|
| 52 |
|
|---|
| 53 | // now set up all parameter(data) containers and put them
|
|---|
| 54 | // in the parameter list
|
|---|
| 55 |
|
|---|
| 56 | // the buffer for the RawEvts, here for the Pedestals
|
|---|
| 57 |
|
|---|
| 58 | MObjBuffer *pedbuf = new MObjBuffer(new MRawEvt("PedTree")); /* this buffer contains
|
|---|
| 59 | * only one entry
|
|---|
| 60 | */
|
|---|
| 61 | pedbuf->SetAsInput(fileIn);
|
|---|
| 62 | plist->AddToList(pedbuf);
|
|---|
| 63 |
|
|---|
| 64 | // now it is neccessary to define the input stream, that means
|
|---|
| 65 | // we set the input only to PedTree
|
|---|
| 66 |
|
|---|
| 67 | MInputStreamID *inputStream = new MInputStreamID() ;
|
|---|
| 68 | inputStream->SetEvtType("PedTree") ;
|
|---|
| 69 | plist->AddToList(inputStream);
|
|---|
| 70 |
|
|---|
| 71 | //
|
|---|
| 72 | // the data container for the histograms
|
|---|
| 73 |
|
|---|
| 74 | MHistosAdc *his = new MHistosAdc;
|
|---|
| 75 |
|
|---|
| 76 | plist->AddToList(his);
|
|---|
| 77 | // his->SetAsOutput();
|
|---|
| 78 | // This tells the writer that this is an Output Container, which should
|
|---|
| 79 | // be written to a file ( not working yet)
|
|---|
| 80 |
|
|---|
| 81 |
|
|---|
| 82 | // set up the tasks and add them to the list
|
|---|
| 83 |
|
|---|
| 84 | MParRead *readin = new MParRead;
|
|---|
| 85 | tasks->AddToList(readin, "PedTree");
|
|---|
| 86 |
|
|---|
| 87 | MAdcSpect *fillAdc = new MAdcSpect ("PedTree" ) ;
|
|---|
| 88 | tasks->AddToList(fillAdc, "PedTree");
|
|---|
| 89 |
|
|---|
| 90 | MShowSpect *showAdc = new MShowSpect () ;
|
|---|
| 91 | tasks->AddToList(showAdc, "PedTree");
|
|---|
| 92 |
|
|---|
| 93 | // MParWrite *write = new MParWrite;
|
|---|
| 94 | // tasks->AddToList(write);
|
|---|
| 95 |
|
|---|
| 96 | cout << endl;
|
|---|
| 97 |
|
|---|
| 98 | //
|
|---|
| 99 | // Print the structure of the parameter list plist
|
|---|
| 100 | //
|
|---|
| 101 | tasks->Print();
|
|---|
| 102 |
|
|---|
| 103 | cout << endl;
|
|---|
| 104 |
|
|---|
| 105 | //////////////////////////////////////////////////////////////
|
|---|
| 106 | //
|
|---|
| 107 | // call the event loop for 5000 Events
|
|---|
| 108 | //
|
|---|
| 109 |
|
|---|
| 110 | loop.Eventloop (50);
|
|---|
| 111 |
|
|---|
| 112 | cout << endl << "THE END." << endl ;
|
|---|
| 113 |
|
|---|
| 114 |
|
|---|
| 115 |
|
|---|
| 116 | return ( kTRUE ) ;
|
|---|
| 117 | }
|
|---|
| 118 |
|
|---|
| 119 | // ================================================================================
|
|---|
| 120 | // ================================================================================
|
|---|
| 121 | // ================================================================================
|
|---|
| 122 | // ================================================================================
|
|---|
| 123 |
|
|---|
| 124 |
|
|---|
| 125 | Bool_t MOctTest::CrAdcSpectra ( Char_t *inputfile )
|
|---|
| 126 | {
|
|---|
| 127 | //
|
|---|
| 128 | //
|
|---|
| 129 |
|
|---|
| 130 | printf ("MOctTest::CrAdcSpectra -- Analyse the file %s \n", inputfile ) ;
|
|---|
| 131 | // create a loop for this specific job.
|
|---|
| 132 |
|
|---|
| 133 | MEvtLoop loop ;
|
|---|
| 134 |
|
|---|
| 135 | // open input file
|
|---|
| 136 |
|
|---|
| 137 | MRootFile *fileIn = new MRootFile( inputfile );
|
|---|
| 138 |
|
|---|
| 139 | // set up the ParameterList,
|
|---|
| 140 | // connect it to the loop
|
|---|
| 141 |
|
|---|
| 142 | MParList *plist = new MParList;
|
|---|
| 143 | loop.SetParList(plist);
|
|---|
| 144 |
|
|---|
| 145 | // set up the TaskList for this program
|
|---|
| 146 | // and connect it to the loop
|
|---|
| 147 |
|
|---|
| 148 | MTaskList *tasks = new MTaskList;
|
|---|
| 149 | loop.SetTaskList(tasks);
|
|---|
| 150 |
|
|---|
| 151 | // now set up all parameter(data) containers and put them
|
|---|
| 152 | // in the parameter list
|
|---|
| 153 |
|
|---|
| 154 | // the buffer for the RawEvts, here for the Pedestals
|
|---|
| 155 |
|
|---|
| 156 | MObjBuffer *pedbuf = new MObjBuffer(new MRawEvt("EvtTree")); /* this buffer contains
|
|---|
| 157 | * only one entry
|
|---|
| 158 | */
|
|---|
| 159 | pedbuf->SetAsInput(fileIn);
|
|---|
| 160 | plist->AddToList(pedbuf);
|
|---|
| 161 |
|
|---|
| 162 | // now it is neccessary to define the input stream, that means
|
|---|
| 163 | // we set the input only to EvtTree
|
|---|
| 164 |
|
|---|
| 165 | MInputStreamID *inputStream = new MInputStreamID() ;
|
|---|
| 166 | inputStream->SetEvtType("EvtTree") ;
|
|---|
| 167 | plist->AddToList(inputStream);
|
|---|
| 168 |
|
|---|
| 169 | // the data container for the histograms
|
|---|
| 170 |
|
|---|
| 171 | MHistosAdc *his = new MHistosAdc;
|
|---|
| 172 |
|
|---|
| 173 | plist->AddToList(his);
|
|---|
| 174 | // his->SetAsOutput();
|
|---|
| 175 | // This tells the writer that this is an Output Container, which should
|
|---|
| 176 | // be written to a file ( not working yet)
|
|---|
| 177 |
|
|---|
| 178 |
|
|---|
| 179 | // set up the tasks and add them to the list
|
|---|
| 180 |
|
|---|
| 181 | MParRead *readin = new MParRead;
|
|---|
| 182 | tasks->AddToList(readin, "EvtTree");
|
|---|
| 183 |
|
|---|
| 184 | MAdcSpect *fillAdc = new MAdcSpect ("EvtTree" ) ;
|
|---|
| 185 | tasks->AddToList(fillAdc, "EvtTree");
|
|---|
| 186 |
|
|---|
| 187 | MShowSpect *showAdc = new MShowSpect () ;
|
|---|
| 188 | tasks->AddToList(showAdc, "PedTree");
|
|---|
| 189 |
|
|---|
| 190 | // MParWrite *write = new MParWrite;
|
|---|
| 191 | // tasks->AddToList(write);
|
|---|
| 192 |
|
|---|
| 193 | cout << endl;
|
|---|
| 194 |
|
|---|
| 195 | //
|
|---|
| 196 | // Print the structure of the parameter list plist
|
|---|
| 197 | //
|
|---|
| 198 | tasks->Print();
|
|---|
| 199 |
|
|---|
| 200 | cout << endl;
|
|---|
| 201 |
|
|---|
| 202 | //////////////////////////////////////////////////////////////
|
|---|
| 203 | //
|
|---|
| 204 | // call the event loop for 5000 Events
|
|---|
| 205 | //
|
|---|
| 206 |
|
|---|
| 207 | loop.Eventloop (5000);
|
|---|
| 208 |
|
|---|
| 209 | cout << endl << "THE END." << endl ;
|
|---|
| 210 |
|
|---|
| 211 |
|
|---|
| 212 |
|
|---|
| 213 | return ( kTRUE ) ;
|
|---|
| 214 | }
|
|---|