| 1 | /************************************************************** | 
|---|
| 2 | --- modif vf pour utilisation cgt du toimanager | 
|---|
| 3 | --- chainage de processeurs elementaires a 3 entrees et 2 sorties | 
|---|
| 4 | --- integration d'une contrainte sur le 1er processeur | 
|---|
| 5 |  | 
|---|
| 6 | >>>>>>>> usage: tstdemo [snum1,snum2] | 
|---|
| 7 | Test et demonstration du Pipe. | 
|---|
| 8 | "demo1.fits": fits table avec sampleNum,boloMuV_10,fg_boloMuV_10,boloMuV_20 | 
|---|
| 9 | samplenum=[100001,105000] | 
|---|
| 10 | "demo2.fits": fits table avec sampleNum,boloMuV_30,fg_boloMuV_30 | 
|---|
| 11 | samplenum=[100101,105100] | 
|---|
| 12 | Operation: sortir un fichier "demo.fits" ou on ecrit: | 
|---|
| 13 | Toutes les donnees des 2 fichiers d'entree ET : | 
|---|
| 14 | boloSum = boloMuV_10 + boloMuV_20 + boloMuV_30 | 
|---|
| 15 | fg_boloSum = fg_boloMuV_10 | fg_boloMuV_20 | fg_boloMuV_30 | 
|---|
| 16 | boloMul = boloMuV_10 * boloMuV_20 * boloMuV_30 | 
|---|
| 17 | fg_boloMul = fg_boloMuV_10 | fg_boloMuV_20 | fg_boloMuV_30 | 
|---|
| 18 |  | 
|---|
| 19 | Structure: | 
|---|
| 20 |  | 
|---|
| 21 | demo1.fits                        demo2.fits | 
|---|
| 22 | |                                  | | 
|---|
| 23 | ----------                         ---------- | 
|---|
| 24 | | Reader |                         | Reader | | 
|---|
| 25 | | rfits1 |                         | rfits2 | | 
|---|
| 26 | ----------                         ---------- | 
|---|
| 27 | "boloMuV_10" "boloMuV_20"                 "boloMuV_30" | 
|---|
| 28 | |            |                            | | 
|---|
| 29 | t|           t|                           t| | 
|---|
| 30 | u|           u|                           u| | 
|---|
| 31 | y|           y|                           y| | 
|---|
| 32 | a|           a|                           a| | 
|---|
| 33 | u|           u|                           u| | 
|---|
| 34 | |            |                            | | 
|---|
| 35 | b|           b|                           b| | 
|---|
| 36 | o|           o|                           o| | 
|---|
| 37 | l|           l|                           l| | 
|---|
| 38 | o|           o|                           o| | 
|---|
| 39 | |            |                            | | 
|---|
| 40 | 1|           2|                           3| | 
|---|
| 41 | 0|           0|                           0| | 
|---|
| 42 | |            |                            | | 
|---|
| 43 | |            |                            | | 
|---|
| 44 | /|           /|                           /| | 
|---|
| 45 | / |          / |                          / | | 
|---|
| 46 | /  |         /  |                         /  | | 
|---|
| 47 | /   |        /   |                        /   | | 
|---|
| 48 | /    |       /    |                       /    | | 
|---|
| 49 | _____/     |      /     |                      /     | | 
|---|
| 50 | |_________ | ____/      |                     /     / | 
|---|
| 51 | |||_______ | __________ | ___________________/     / | 
|---|
| 52 | |||        |            |                         / | 
|---|
| 53 | |||        |            |                        / | 
|---|
| 54 | |||        |            |                       / | 
|---|
| 55 | |||        |            /                      / | 
|---|
| 56 | |||        |           /                      / | 
|---|
| 57 | |||        |   _______/                      / | 
|---|
| 58 | |||        /  /          ___________________/_____ | 
|---|
| 59 | |||       /  /  ________/                        | | 
|---|
| 60 | |||      /  /  /_________________________________|  ________________________ | 
|---|
| 61 | |||     /  /  / | DemoPipe Processor:           ||  | DemoPipe Processor:  | | 
|---|
| 62 | |||    /  /  /  | ===================           ||__| ===================  | | 
|---|
| 63 | |||   /  /  |---| entree_bolo_3                 |   |                      | | 
|---|
| 64 | |||   | |       |               sortie_bolo_sum |___|                      | | 
|---|
| 65 | |||   | |-------| entree_bolo_2                 ||  |                      | | 
|---|
| 66 | |||   |         |               sortie_bolo_mul ||__|                      |--| | 
|---|
| 67 | |||   |---------| entree_bolo_1                 ||| |                      |  | | 
|---|
| 68 | |||             |_______________________________||| |______________________|| | | 
|---|
| 69 | |||                                              ||                         | | | 
|---|
| 70 | |||                                  |-----------||                         | | | 
|---|
| 71 | |||                     --------------------------|                         | | | 
|---|
| 72 | |||                     |             |                                     | | | 
|---|
| 73 | |||--------"boloMuv_30" |   Writter   | "boloMul" --------------------------- | | 
|---|
| 74 | ||---------"boloMuv_20" |   rfitsw    | "boloSum" ----------------------------| | 
|---|
| 75 | |----------"boloMuV_10" |             | | 
|---|
| 76 | --------------- | 
|---|
| 77 | | | 
|---|
| 78 | demo.fits | 
|---|
| 79 |  | 
|---|
| 80 | **************************************************************/ | 
|---|
| 81 |  | 
|---|
| 82 | #include "toi.h" | 
|---|
| 83 | #include "toiprocessor.h" | 
|---|
| 84 | #include "fitstoirdr.h" | 
|---|
| 85 | #include "fitstoiwtr.h" | 
|---|
| 86 | #include "toimanager.h" | 
|---|
| 87 | #include "toisegment.h" | 
|---|
| 88 | #include "sophyainit.h" | 
|---|
| 89 | #include <stdexcept> | 
|---|
| 90 |  | 
|---|
| 91 | void crefits(void);  // Juste pour le test, rien a voir avec TOI | 
|---|
| 92 |  | 
|---|
| 93 | //////////////////////////////////////////////////////////////// | 
|---|
| 94 | // Le INCLUDE de la classe du processeur (peut etre mis a part) | 
|---|
| 95 | class DemoPipe : public TOIProcessor { | 
|---|
| 96 | public: | 
|---|
| 97 | DemoPipe(string n); | 
|---|
| 98 | virtual ~DemoPipe(); | 
|---|
| 99 |  | 
|---|
| 100 | virtual void  init(void); | 
|---|
| 101 | virtual void  run(void); | 
|---|
| 102 |  | 
|---|
| 103 | void PrintStatus(::ostream & os); | 
|---|
| 104 |  | 
|---|
| 105 | inline int_8 ProcessedSampleCount() const {return totnscount;} | 
|---|
| 106 | protected: | 
|---|
| 107 | int_8 nread,nwrite,totnscount; | 
|---|
| 108 | }; | 
|---|
| 109 |  | 
|---|
| 110 | //////////////////////////////////////////////////////////////// | 
|---|
| 111 | // Le code de la classe du processeur (peut etre mis a part) | 
|---|
| 112 | DemoPipe::DemoPipe(string n) | 
|---|
| 113 | : nread(0), nwrite(0),totnscount(0) | 
|---|
| 114 | { | 
|---|
| 115 | name = n; | 
|---|
| 116 | } | 
|---|
| 117 |  | 
|---|
| 118 | DemoPipe::~DemoPipe() | 
|---|
| 119 | { | 
|---|
| 120 | } | 
|---|
| 121 |  | 
|---|
| 122 | void DemoPipe::PrintStatus(::ostream & os) | 
|---|
| 123 | { | 
|---|
| 124 | os<<"DemoPipe::Print -- nread  = "<<nread<<endl | 
|---|
| 125 | <<"                -- nwrite = "<<nwrite<<endl; | 
|---|
| 126 | } | 
|---|
| 127 |  | 
|---|
| 128 | void DemoPipe::init() { | 
|---|
| 129 | // Declaration des tuyaux a connecter. L'ordre de declaration compte! | 
|---|
| 130 | cout << "DemoPipe::init" << endl; | 
|---|
| 131 | declareInput("entree_bolo_1");     // input  index 0 | 
|---|
| 132 | declareInput("entree_bolo_2");     // input  index 1 | 
|---|
| 133 | declareInput("entree_bolo_3");     // input  index 2 | 
|---|
| 134 | declareOutput("sortie_bolo_sum");  // output index 0 | 
|---|
| 135 | declareOutput("sortie_bolo_mul");  // output index 1 | 
|---|
| 136 | lowExtra = 10; | 
|---|
| 137 | upExtra = 10; | 
|---|
| 138 | } | 
|---|
| 139 |  | 
|---|
| 140 | void DemoPipe::run() | 
|---|
| 141 | { | 
|---|
| 142 | // Verification des connections en entree | 
|---|
| 143 | if(!checkInputTOIIndex(0) || !checkInputTOIIndex(1) || !checkInputTOIIndex(2)) { | 
|---|
| 144 | cout<<"DemoPipe::run() - Input TOI (entree_bolo_1/2/3) not connected! "<<endl; | 
|---|
| 145 | throw ParmError("DemoPipe::run() Output TOI (entree_bolo_1/2/3) not connected!"); | 
|---|
| 146 | } | 
|---|
| 147 |  | 
|---|
| 148 | // Verification des connections en sortie | 
|---|
| 149 | if(!checkOutputTOIIndex(0) || !checkOutputTOIIndex(1)) { | 
|---|
| 150 | cout<<"DemoPipe::run() - Output TOI (boloSum/Mul) not connected! "<<endl; | 
|---|
| 151 | throw ParmError("DemoPipe::run() Output TOI (boloSum/Mul) not connected!"); | 
|---|
| 152 | } | 
|---|
| 153 |  | 
|---|
| 154 | // On recupere les sample numbers | 
|---|
| 155 | int snb = getMinIn(); | 
|---|
| 156 | int sne = getMaxIn(); | 
|---|
| 157 | cout<<"DemoPipe::run: sn="<<snb<<" sne="<<sne<<endl; | 
|---|
| 158 | if(snb>sne) { | 
|---|
| 159 | cout<<"DemoPipe::run() - Bad sample interval"<<snb<<" , "<<sne<<endl; | 
|---|
| 160 | throw ParmError("DemoPipe::run() - Bad sample interval "); | 
|---|
| 161 | } | 
|---|
| 162 |  | 
|---|
| 163 | //--------------------------------------------------------- | 
|---|
| 164 | uint_8 flb1,flb2,flb3,flbs,flbm; | 
|---|
| 165 | double b1,b2,b3,bs,bm; | 
|---|
| 166 |  | 
|---|
| 167 | for(int k=snb;k<=sne;k++) { | 
|---|
| 168 | totnscount++; | 
|---|
| 169 |  | 
|---|
| 170 | getData(0,k,b1,flb1); | 
|---|
| 171 | getData(1,k,b2,flb2); | 
|---|
| 172 | getData(2,k,b3,flb3); | 
|---|
| 173 | nread++; | 
|---|
| 174 |  | 
|---|
| 175 | bs   = b1   +  b2  +  b3; | 
|---|
| 176 | flbs = flb1 | flb2 | flb3; | 
|---|
| 177 | bm   = b1   *  b2  *  b3; | 
|---|
| 178 | flbm = flb1 | flb2 | flb3; | 
|---|
| 179 | /* | 
|---|
| 180 | cout<<"b1="<<b1<<" flb1 "<<flb1 | 
|---|
| 181 | <<" / b2="<<b2<<" flb2 "<<flb2 | 
|---|
| 182 | <<" / b3="<<b3<<" flb3 "<<flb3<<endl; | 
|---|
| 183 | cout<<"...bs="<<bs<<" flbs "<<flbs<<"   bm="<<bm<<" flbm "<<flbm<<endl; | 
|---|
| 184 | */ | 
|---|
| 185 |  | 
|---|
| 186 | putData(0,k,bs,flbs); | 
|---|
| 187 | putData(1,k,bm,flbm); | 
|---|
| 188 | nwrite++; | 
|---|
| 189 | } | 
|---|
| 190 | cout<<"DemoPipe::run: end"<<endl; | 
|---|
| 191 | } | 
|---|
| 192 |  | 
|---|
| 193 |  | 
|---|
| 194 | //////////////////////////////////////////////////////////////// | 
|---|
| 195 | //////////////////////////////////////////////////////////////// | 
|---|
| 196 | //////////////////////////////////////////////////////////////// | 
|---|
| 197 | //////////////////////////////////////////////////////////////// | 
|---|
| 198 | // Le main program | 
|---|
| 199 | int main(int narg, char** arg) | 
|---|
| 200 | { | 
|---|
| 201 | // Initialisation de Sophya | 
|---|
| 202 | SophyaInit(); | 
|---|
| 203 |  | 
|---|
| 204 | // Creation des fichiers fits utilises par la demo (Rien a voir avec le Pipe!) | 
|---|
| 205 | crefits(); | 
|---|
| 206 |  | 
|---|
| 207 | // Ouverture du gestionnaire de TOI. | 
|---|
| 208 | TOIManager* mgr = TOIManager::getManager(); | 
|---|
| 209 |  | 
|---|
| 210 | // Selection eventuelle des sample num a traiter | 
|---|
| 211 | long sdeb=1,sfin=-1; | 
|---|
| 212 | if(narg>1) sscanf(arg[1],"%ld,%ld",&sdeb,&sfin); | 
|---|
| 213 | if(sfin>=sdeb) mgr->setRequestedSample(sdeb,sfin); | 
|---|
| 214 |  | 
|---|
| 215 | //-------------------------------------------------------------------- | 
|---|
| 216 | try { // On met tous ca dans un bloc "try" pour recuperer les exceptions | 
|---|
| 217 | //-------------------------------------------------------------------- | 
|---|
| 218 |  | 
|---|
| 219 | //////////////////////////////////////////////////////// | 
|---|
| 220 | //////// Creation des lecteurs de fichiers fits //////// | 
|---|
| 221 | //////////////////////////////////////////////////////// | 
|---|
| 222 |  | 
|---|
| 223 | // FITS reader du premier fichier | 
|---|
| 224 | FITSTOIReader rfits1("demo1.fits"); | 
|---|
| 225 | rfits1.setName("rdr1"); | 
|---|
| 226 | int ncol1 = rfits1.getNOut(); | 
|---|
| 227 | cout<<"Lecteur_1: Number of columns in fits  : "<<ncol1<<endl; | 
|---|
| 228 | if(ncol1<1) exit(-1); | 
|---|
| 229 |  | 
|---|
| 230 | // FITS reader du deuxieme fichier | 
|---|
| 231 | FITSTOIReader rfits2("demo2.fits"); | 
|---|
| 232 | rfits2.setName("rdr2"); | 
|---|
| 233 | int ncol2 = rfits2.getNOut(); | 
|---|
| 234 | cout<<"Lecteur_2: Number of columns in fits  : "<<ncol2<<endl; | 
|---|
| 235 | if(ncol1<2) exit(-1); | 
|---|
| 236 |  | 
|---|
| 237 | ///////////////////////////////////////////////////////// | 
|---|
| 238 | //////// Creation de l'ecriveur de fichiers fits //////// | 
|---|
| 239 | ///////////////////////////////////////////////////////// | 
|---|
| 240 |  | 
|---|
| 241 | FITSTOIWriter wfits("!demo.fits"); | 
|---|
| 242 | cout<<"Ecriveur: created"<<endl; | 
|---|
| 243 |  | 
|---|
| 244 | //////////////////////////////////////////////////// | 
|---|
| 245 | //////// Creation du (/des) TOI processeurs //////// | 
|---|
| 246 | //////////////////////////////////////////////////// | 
|---|
| 247 |  | 
|---|
| 248 | DemoPipe demo("demo0"); | 
|---|
| 249 | DemoPipe demo1("demo1"); | 
|---|
| 250 |  | 
|---|
| 251 | ////////////////////////////////////////////////////////////////// | 
|---|
| 252 | //////// Creation des tuyaux et des connections associees //////// | 
|---|
| 253 | ////////////////////////////////////////////////////////////////// | 
|---|
| 254 |  | 
|---|
| 255 | int taille = 1024; | 
|---|
| 256 | bool writeflag = true; | 
|---|
| 257 |  | 
|---|
| 258 | //creation des connections | 
|---|
| 259 | cout << "***** Connecting all tois *****" << endl; | 
|---|
| 260 |  | 
|---|
| 261 | // connection des 3 colonnes des lecteurs fits avec le writer | 
|---|
| 262 | mgr->connect(rfits1, "boloMuV_10", wfits, "boloMuV_10", "tuyau_bolo_10", taille, writeflag); | 
|---|
| 263 | mgr->connect(rfits1, "boloMuV_20", wfits, "boloMuV_20", "tuyau_bolo_20", taille, writeflag); | 
|---|
| 264 | mgr->connect(rfits2, "boloMuV_30", wfits, "boloMuV_30", "tuyau_bolo_30", taille, writeflag); | 
|---|
| 265 |  | 
|---|
| 266 |  | 
|---|
| 267 | // connection des 3 colonnes des lecteurs fits avec le processeur | 
|---|
| 268 | mgr->connect(rfits1,"boloMuV_10", demo, "entree_bolo_1", "tuyau_bolo_10", taille, writeflag); | 
|---|
| 269 | mgr->connect(rfits1,"boloMuV_20", demo, "entree_bolo_2", "tuyau_bolo_20", taille, writeflag); | 
|---|
| 270 | mgr->connect(rfits2,"boloMuV_30", demo, "entree_bolo_3", "tuyau_bolo_30", taille, writeflag); | 
|---|
| 271 |  | 
|---|
| 272 | // connection des 2 sorties processeurs avec le writer | 
|---|
| 273 | mgr->connect(demo, "sortie_bolo_sum", wfits, "boloSum", "tuyau_bolo_sum", taille, writeflag); | 
|---|
| 274 | mgr->connect(demo, "sortie_bolo_mul", wfits, "boloMul", "tuyau_bolo_mul", taille, writeflag); | 
|---|
| 275 |  | 
|---|
| 276 | // connection des 2 sorties processeurs avec le processeur suivant | 
|---|
| 277 | mgr->connect(demo, "sortie_bolo_sum", demo1, "entree_bolo_1", "tuyau_bolo_10", taille, writeflag); | 
|---|
| 278 | mgr->connect(demo, "sortie_bolo_mul", demo1, "entree_bolo_2", "tuyau_bolo_20", taille, writeflag); | 
|---|
| 279 |  | 
|---|
| 280 | // connection du 2eme fitsreader avec le 2eme processeur | 
|---|
| 281 | mgr->connect(rfits2,"boloMuV_30", demo1, "entree_bolo_3", "tuyau_bolo_30", taille, writeflag); | 
|---|
| 282 |  | 
|---|
| 283 | // connection des 2 sorties du 2eme processeur avec le writer | 
|---|
| 284 | mgr->connect(demo1, "sortie_bolo_sum", wfits, "boloSum2", "tuyau_bolo_sum2", taille, writeflag); | 
|---|
| 285 | mgr->connect(demo1, "sortie_bolo_mul", wfits, "boloMul2", "tuyau_bolo_mul2", taille, writeflag); | 
|---|
| 286 |  | 
|---|
| 287 |  | 
|---|
| 288 | // ajout d'une contrainte sur le 1ere processeur | 
|---|
| 289 | //wfits.setRequestedSample(1001000,1001050); | 
|---|
| 290 |  | 
|---|
| 291 | cout << "***** All tois connected *****" << endl; | 
|---|
| 292 |  | 
|---|
| 293 | /* | 
|---|
| 294 | // Print de status avant lancement des taches: | 
|---|
| 295 | cout<<"----- FITSReaderTOI::PrintStatus() 1 : -----"<<endl; | 
|---|
| 296 | rfits1.PrintStatus(cout); | 
|---|
| 297 | cout<<"----- FITSReaderTOI::PrintStatus() 2 : -----"<<endl; | 
|---|
| 298 | rfits2.PrintStatus(cout); | 
|---|
| 299 | cout<<"----- FITSWriterTOI::PrintStatus() : -----"<<endl; | 
|---|
| 300 | wfits.PrintStatus(cout); | 
|---|
| 301 | cout<<"----- TOISegmented::PrintStatus() : -----"<<endl; | 
|---|
| 302 | bolo10->PrintStatus(cout); | 
|---|
| 303 | bolo20->PrintStatus(cout); | 
|---|
| 304 | bolo30->PrintStatus(cout); | 
|---|
| 305 | cout<<"----- DemoPipe::PrintStatus() : -----"<<endl; | 
|---|
| 306 | demo.PrintStatus(cout); | 
|---|
| 307 | */ | 
|---|
| 308 |  | 
|---|
| 309 | ////////////////////////////////////// | 
|---|
| 310 | //////// Lancement des taches //////// | 
|---|
| 311 | ////////////////////////////////////// | 
|---|
| 312 |  | 
|---|
| 313 | cout << "***** Starting execution *****" << endl; | 
|---|
| 314 | mgr->startAll(); | 
|---|
| 315 |  | 
|---|
| 316 | //  Affichage de l'avancement des TOIProcessors (optionnel) | 
|---|
| 317 | // ProcSampleCounter<FITSTOIReader> statr(rfits1); | 
|---|
| 318 | // statr.InfoMessage() = "tstdemopipe/Info rfits1"; | 
|---|
| 319 | // statr.PrintStats(); | 
|---|
| 320 |  | 
|---|
| 321 | // ProcSampleCounter<FITSTOIWriter> statw(wfits); | 
|---|
| 322 | // statw.InfoMessage() = "tstdemopipe/Info wfits"; | 
|---|
| 323 | // statw.PrintStats(); | 
|---|
| 324 |  | 
|---|
| 325 | // ProcSampleCounter<DemoPipe> statp(demo); | 
|---|
| 326 | // statp.InfoMessage() = "tstdemopipe/Info DemoPipe"; | 
|---|
| 327 | // statp.PrintStats(); | 
|---|
| 328 |  | 
|---|
| 329 | // Gestion de la re-connection des threads | 
|---|
| 330 | cout<<"***** Joining threads *****"<<endl; | 
|---|
| 331 | mgr->joinAll(); | 
|---|
| 332 | cout<<"***** End threads *****"<<endl; | 
|---|
| 333 |  | 
|---|
| 334 | //-------------------------------------------------------------------- | 
|---|
| 335 | // Que fait on avec les exceptions qui ont ete lancees ? | 
|---|
| 336 | } catch (PThrowable & exc) {    // Sophya exceptions | 
|---|
| 337 | cout<<"\ntstdemopipe: Catched Exception \n"<<(string)typeid(exc).name() | 
|---|
| 338 | <<" - Msg= "<<exc.Msg()<<endl; | 
|---|
| 339 | } catch (const std::exception & sex) {    // Standard exceptions | 
|---|
| 340 | cout<<"\ntstdemopipe: Catched std::exception \n" | 
|---|
| 341 | <<(string)typeid(sex).name()<<endl; | 
|---|
| 342 | } catch (...) {    // Other exceptions | 
|---|
| 343 | cout<<"\ntstdemopipe: some other exception was caught ! "<<endl; | 
|---|
| 344 | } | 
|---|
| 345 | //-------------------------------------------------------------------- | 
|---|
| 346 |  | 
|---|
| 347 | return(0); | 
|---|
| 348 | } | 
|---|
| 349 |  | 
|---|
| 350 |  | 
|---|
| 351 | /////////////////////////////////////////////////////////// | 
|---|
| 352 | //////// Just for the test, NOT CONNECTED WITH THE PIPE ! | 
|---|
| 353 | /////////////////////////////////////////////////////////// | 
|---|
| 354 | #include "srandgen.h" | 
|---|
| 355 | #include "fabtwriter.h" | 
|---|
| 356 | void crefits(void) | 
|---|
| 357 | { | 
|---|
| 358 | const long nro =  5000; | 
|---|
| 359 | const long sn1 = 1000001; | 
|---|
| 360 | const long sn2 = 1000001+100; | 
|---|
| 361 | FitsABTWriter fw1("!demo1.fits",BINARY_TBL); | 
|---|
| 362 | fw1.SetExtName("MON_EXTENSION1"); | 
|---|
| 363 | fw1.AddCol("sampleNum",NULL,"integer",TDOUBLE); | 
|---|
| 364 | fw1.AddCol("boloMuV_10",NULL,"double",TDOUBLE); | 
|---|
| 365 | fw1.AddCol("fg_boloMuV_10",NULL,"UInt_8Flag",TLONG); | 
|---|
| 366 | fw1.AddCol("boloMuV_20",NULL,"double",TDOUBLE); | 
|---|
| 367 | //fw1.AddCol("fg_boloMuV_20",NULL,"UInt_8Flag",TLONG); | 
|---|
| 368 | long i; | 
|---|
| 369 | for(i=0;i<nro;i++) { | 
|---|
| 370 | fw1.Write(0,i,(double) sn1+i); | 
|---|
| 371 | fw1.Write(1,i,10.+NorRand()); | 
|---|
| 372 | fw1.Write(2,i,((frand01()<0.5) ? 1: 0)); // 1 pt/10 flaggue | 
|---|
| 373 | fw1.Write(3,i,20.+NorRand()); | 
|---|
| 374 | //fw1.Write(4,i,((frand01()<0.5) ? 2: 0)); // 1 pt/10 flaggue | 
|---|
| 375 | } | 
|---|
| 376 |  | 
|---|
| 377 | FitsABTWriter fw2("!demo2.fits",BINARY_TBL); | 
|---|
| 378 | fw2.SetExtName("MON_EXTENSION2"); | 
|---|
| 379 | fw2.AddCol("sampleNum",NULL,"integer",TDOUBLE); | 
|---|
| 380 | fw2.AddCol("boloMuV_30",NULL,"double",TDOUBLE); | 
|---|
| 381 | fw2.AddCol("fg_boloMuV_30",NULL,"UInt_8Flag",TLONG); | 
|---|
| 382 | for(i=0;i<nro;i++) { | 
|---|
| 383 | fw2.Write(0,i,(double) sn2+i); | 
|---|
| 384 | fw2.Write(1,i,30.+NorRand()); | 
|---|
| 385 | fw2.Write(2,i,((frand01()<0.5) ? 4: 0)); | 
|---|
| 386 | } | 
|---|
| 387 | } | 
|---|
| 388 |  | 
|---|
| 389 |  | 
|---|
| 390 |  | 
|---|
| 391 |  | 
|---|
| 392 |  | 
|---|
| 393 |  | 
|---|
| 394 |  | 
|---|
| 395 |  | 
|---|
| 396 |  | 
|---|
| 397 |  | 
|---|
| 398 |  | 
|---|
| 399 |  | 
|---|
| 400 |  | 
|---|
| 401 |  | 
|---|
| 402 |  | 
|---|
| 403 |  | 
|---|
| 404 |  | 
|---|