source: Sophya/trunk/Poubelle/archTOI.old/toillboloproducer.cc@ 556

Last change on this file since 556 was 534, checked in by ansari, 26 years ago

V2

File size: 2.2 KB
RevLine 
[534]1// toillboloproducer.cc
2// Eric Aubourg CEA/DAPNIA/SPP septembre 1999
3
4#include "toillboloproducer.h"
5#include "archfileset.h"
6#include "toimanager.h"
7#include "requesthandler.h"
8
9#define raw "rawBoloData"
10#define muv "boloRawMuV"
11#define muvCN "boloRawMuVCN"
12
13#define val_DS(j,i) (blk->data_bolo[j][i]&0x1fffff)
14
15TOILLBoloProducer::TOILLBoloProducer()
16{
17 possibleTOIs.insert(TOI(raw, TOI::all, "", "ADU"));
18 possibleTOIs.insert(TOI(muv, TOI::all, "", "microVolts"));
19 possibleTOIs.insert(TOI(muvCN, TOI::all, "", "microVolts"));
20}
21
22string TOILLBoloProducer::getName() {
23 return("TOILLBoloProducer 1.0");
24}
25
26
27void TOILLBoloProducer::handleBlock(ArchFileSet* fs)
28{
29 block_type_bolo* blk = fs->lastBolo();
30 long sample0 = numero_block(blk)*72;
31 for (set<TOI>::iterator i = producedTOIs.begin(); i != producedTOIs.end(); i++) {
32 int ibolo = (*i).index;
33 if ((*i).name == raw) {
34 for (int j=0; j<nb_per_block*2; j++) {
35 computedValue((*i),sample0+j, val_DS(ibolo,j));
36 }
37 } else if ((*i).name == muv) {
38 block_type_reglage* reglage = fs->lastReglage();
39 block_type_param* param = fs->lastParam();
40 for (int j=0; j<nb_per_block*2; j++) {
41 int s = j % 2 ? 1 : -1;
42 computedValue((*i),sample0+j,
43 s*bolo_muV(&param->param, &reglage->reglage, val_DS(ibolo,j), ibolo));
44 }
45 } else if ((*i).name == muvCN) {
46 // Si pas bloc comprime -> 1 bit
47 int lastbit = 1;
48 block_type_reglage* reglage = fs->lastReglage();
49 block_type_param* param = fs->lastParam();
50 bool isComp = (!(fs->lastBoloComp() == NULL) &&
51 (numero_block(fs->lastBoloComp()) != numero_block(fs->lastBolo())));
52 unsigned int4* data = isComp ? fs->lastBoloComp()->data_bolo[ibolo] : NULL;
53 for (int imesure=0; imesure<nb_per_block*2; imesure++) {
54 // Les deux premieres valeurs sont codees directement...
55 if (isComp && (imesure>=2)) {
56 int iExp = (imesure-2)/4 + 1;
57 int expo = data[iExp] & 0xf;
58 lastbit = 1 << expo;
59 } else {
60 lastbit = 1;
61 }
62 double noise = (
63 bolo_muV(&param->param, &reglage->reglage, lastbit, ibolo) -
64 bolo_muV(&param->param, &reglage->reglage, 0, ibolo)) /2.;
65 computedValue((*i),sample0+imesure,noise);
66 }
67 }
68 }
69}
70
Note: See TracBrowser for help on using the repository browser.