Changeset 1736 in Sophya for trunk/ArchTOIPipe/ProcWSophya


Ignore:
Timestamp:
Nov 7, 2001, 6:31:37 PM (24 years ago)
Author:
cmv
Message:

add FlagOutOfRange cmv 7/11/2001

Location:
trunk/ArchTOIPipe/ProcWSophya
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ArchTOIPipe/ProcWSophya/ktoibad.cc

    r1735 r1736  
    44#include "ntuple.h"
    55#include "ktoibad.h"
     6
     7
     8////////////////////////////////////////////////////////////////////////
     9// Flag des sample hors dynamique
     10////////////////////////////////////////////////////////////////////////
     11
     12FlagOutOfRange::FlagOutOfRange(r_8 vmin,r_8 vmax,uint_8 flag)
     13  : VMin(vmin), VMax(vmax), flgBad(flag)
     14{
     15 if(VMax<VMin) {
     16   cout<<"FlagOutOfRange::run() - Bad range interval "<<VMin<<" , "<<VMax<<endl;
     17   throw ParmError("FlagOutOfRange::FlagOutOfRange() - Bad range interval");
     18 }
     19}
     20
     21FlagOutOfRange::~FlagOutOfRange()
     22{
     23}
     24
     25void FlagOutOfRange::Print(ostream & os)
     26{
     27 os<<"FlagOutOfRange::Print Range: ["<<VMin<<","<<VMax<<"] flgBad="<<flgBad<<endl;
     28}
     29
     30void FlagOutOfRange::init()
     31{
     32  cout << "FlagOutOfRange::init" << endl;
     33  declareInput("DataIn");       // input index 0
     34  declareOutput("DataOut");     // output index 0
     35}
     36
     37void FlagOutOfRange::run()
     38{
     39long snb = getMinIn();
     40long sne = getMaxIn();
     41
     42if(snb>sne) {
     43  cout<<"FlagOutOfRange::run() - Bad sample interval"<<snb<<" , "<<sne<<endl;
     44  throw ParmError("FlagOutOfRange::run() - Bad sample interval");
     45}
     46if(!checkInputTOIIndex(0)) {
     47  cout<<"FlagOutOfRange::run() - Input TOI (DataIn) not connected! "<<endl;
     48  throw ParmError("FlagOutOfRange::run() Input TOI (DataIn) not connected!");
     49}
     50if(!checkOutputTOIIndex(0)) {
     51  cout<<"FlagOutOfRange::run() - Output TOI (DataOut) not connected! "<<endl;
     52  throw ParmError("FlagOutOfRange::run() Output TOI (DataOut) not connected!");
     53}
     54
     55//---------------------------------------------------------
     56try {
     57
     58cout<<"FlagOutOfRange::run(): SampleNum de "<<snb<<" a "<<sne<<endl;
     59uint_4 nbad=0;
     60
     61for(int_4 sn=snb;sn<=sne;sn++) {
     62  r_8 bolo; uint_8 fgbolo=0;
     63  getData(0,sn,bolo,fgbolo);
     64  if(bolo<VMin || bolo>VMax) { // Pixel out of range
     65    nbad++;
     66    fgbolo |= flgBad;
     67  }
     68  putData(0,sn,bolo,fgbolo);
     69}
     70cout<<"FlagOutOfRange::run(): Fin de boucle: nbad="<<nbad
     71    <<" / tot="<<sne-snb+1<<endl;
     72
     73//---------------------------------------------------------
     74} catch (PException & exc) {
     75  cout<<"FlagOutOfRange: Catched Exception "<<(string)typeid(exc).name()
     76      <<"\n .... Msg= "<<exc.Msg()<<endl;
     77}
     78
     79return;                                                                           
     80}
     81
    682
    783////////////////////////////////////////////////////////////////////////
     
    1995////////////////////////////////////////////////////////////////////////
    2096
    21 ////////////////////////////////////////////////////////////////////////
    2297FlagGlitch::FlagGlitch(uint_4 lg,uint_4 lm,r_8 nsg)
    2398  : mLP(0), mLPsnb(-1), mLPsne(-1)
     
    42117}
    43118
    44 ////////////////////////////////////////////////////////////////////////
    45119void FlagGlitch::Print(ostream & os)
    46120{
     
    52126
    53127////////////////////////////////////////////////////////////////////////
    54 void FlagGlitch::init() {
     128void FlagGlitch::init()
     129{
    55130  if(mLP) cout << "FlagGlitch::init" << endl;
    56   declareInput("BoloIn");       // input index 0
    57   declareOutput("BoloOut");     // output index 0
     131  declareInput("DataIn");       // input index 0
     132  declareOutput("DataOut");     // output index 0
    58133
    59134  for(int i=0;i<2;i++)
     
    64139}
    65140
    66 ////////////////////////////////////////////////////////////////////////
    67141void FlagGlitch::run()
    68142{
     
    75149}
    76150if(!checkInputTOIIndex(0)) {
    77   cout<<"FlagGlitch::run() - Input TOI (BoloIn) not connected! "<<endl;
    78   throw ParmError("FlagGlitch::run() Input TOI (BoloIn) not connected!");
     151  cout<<"FlagGlitch::run() - Input TOI (DataIn) not connected! "<<endl;
     152  throw ParmError("FlagGlitch::run() Input TOI (DataIn) not connected!");
    79153}
    80154if(!checkOutputTOIIndex(0)) {
    81   cout<<"FlagGlitch::run() - Output TOI (BoloOut) not connected! "<<endl;
    82   throw ParmError("FlagGlitch::run() Output TOI (BoloOut) not connected!");
     155  cout<<"FlagGlitch::run() - Output TOI (DataOut) not connected! "<<endl;
     156  throw ParmError("FlagGlitch::run() Output TOI (DataOut) not connected!");
    83157}
    84158
     
    220294
    221295
    222 
    223 
    224 
    225 
    226 
    227296////////////////////////////////////////////////////////////////////////
    228297// Flag des sample autour d'un sample deja flaggue :
     
    232301////////////////////////////////////////////////////////////////////////
    233302
    234 ////////////////////////////////////////////////////////////////////////
    235 FlagAround::FlagAround(uint_4 lm,uint_8 flgs)
     303FlagAroundFlag::FlagAroundFlag(uint_4 lm,uint_8 flgs)
    236304{
    237305 // Mise en forme des arguments
     
    240308 SetFlag();
    241309 SetFlagAroundFlag(flgs);
    242 }
    243 
    244 FlagAround::~FlagAround()
    245 {
    246 }
    247 
    248 ////////////////////////////////////////////////////////////////////////
    249 void FlagAround::Print(ostream & os)
    250 {
    251  os<<"FlagAround::Print"
     310 SetLimits();
     311}
     312
     313FlagAroundFlag::~FlagAroundFlag()
     314{
     315}
     316
     317void FlagAroundFlag::Print(ostream & os)
     318{
     319 os<<"FlagAroundFlag::Print"
    252320   <<" LSide="<<LSide
    253    <<" flgSample="<<flgSample<<" flgAround="<<flgAround
    254    <<endl;
    255 }
    256 
    257 ////////////////////////////////////////////////////////////////////////
    258 void FlagAround::init() {
    259   cout << "FlagAround::init" << endl;
    260   declareInput("BoloIn");       // input index 0
    261   declareOutput("BoloOut");     // output index 0
     321   <<" flgSample="<<flgSample<<" flgAround="<<flgAround<<endl
     322   <<" ... Range: ["<<VMin<<","<<VMax<<"]"<<" flgBad="<<flgBad<<endl;
     323}
     324
     325void FlagAroundFlag::init()
     326{
     327  cout << "FlagAroundFlag::init" << endl;
     328  declareInput("DataIn");       // input index 0
     329  declareOutput("DataOut");     // output index 0
    262330
    263331  int_4 lbuff = 2*LSide +10;
     
    265333}
    266334
    267 ////////////////////////////////////////////////////////////////////////
    268 void FlagAround::run()
     335void FlagAroundFlag::run()
    269336{
    270337long snb = getMinIn();
     
    272339
    273340if(snb>sne) {
    274   cout<<"FlagAround::run() - Bad sample interval"<<snb<<" , "<<sne<<endl;
    275   throw ParmError("FlagAround::run() - Bad sample interval");
     341  cout<<"FlagAroundFlag::run() - Bad sample interval"<<snb<<" , "<<sne<<endl;
     342  throw ParmError("FlagAroundFlag::run() - Bad sample interval");
    276343}
    277344if(!checkInputTOIIndex(0)) {
    278   cout<<"FlagAround::run() - Input TOI (BoloIn) not connected! "<<endl;
    279   throw ParmError("FlagAround::run() Input TOI (BoloIn) not connected!");
     345  cout<<"FlagAroundFlag::run() - Input TOI (DataIn) not connected! "<<endl;
     346  throw ParmError("FlagAroundFlag::run() Input TOI (DataIn) not connected!");
    280347}
    281348if(!checkOutputTOIIndex(0)) {
    282   cout<<"FlagAround::run() - Output TOI (BoloOut) not connected! "<<endl;
    283   throw ParmError("FlagAround::run() Output TOI (BoloOut) not connected!");
     349  cout<<"FlagAroundFlag::run() - Output TOI (DataOut) not connected! "<<endl;
     350  throw ParmError("FlagAroundFlag::run() Output TOI (DataOut) not connected!");
    284351}
    285352
     
    287354try {
    288355
    289 cout<<"FlagAround::run(): SampleNum de "<<snb<<" a "<<sne<<endl;
    290 uint_4 nflag=0, nflagged=0, nflagalready=0;
    291 
    292 // Un peu boeuf! On pourrait optimiser!
     356cout<<"FlagAroundFlag::run(): SampleNum de "<<snb<<" a "<<sne<<endl;
     357uint_4 nflag=0, nflagged=0, nflagalready=0, nbad=0;
     358
     359// Un peu lourdingue! On pourrait optimiser!
    293360// Si on ne tue pas (LSide=0), alors juste un transfert de donnees
    294361for(int_4 sn=snb;sn<=sne;sn++) {
    295362  r_8 bolo; uint_8 fgbolo=0;
    296363  getData(0,sn,bolo,fgbolo);
    297   if(fgbolo&flgSample) { // Pixel flaggue flgSample
     364  if(VMin<=VMax && (bolo<VMin || bolo>VMax)) { // Pixel out of range
     365    nbad++;
     366    fgbolo |= flgBad;
     367  } else if(fgbolo&flgSample) { // Pixel flaggue flgSample
    298368    nflag++;
    299369  } else if(fgbolo&flgAround) { // Pixel deja flagge around?
     
    310380  putData(0,sn,bolo,fgbolo);
    311381}
    312 cout<<"FlagAround::run(): Fin de boucle: nflag="<<nflag
    313     <<" nflagged="<<nflagged<<" (already="<<nflagalready
    314     <<") / tot="<<sne-snb+1<<endl;
     382cout<<"FlagAroundFlag::run(): Fin de boucle: nflag="<<nflag
     383    <<" nflagged="<<nflagged<<" (already="<<nflagalready<<")"<<endl
     384    <<" ......      bad="<<nbad<<" / tot="<<sne-snb+1<<endl;
    315385
    316386//---------------------------------------------------------
    317387} catch (PException & exc) {
    318   cout<<"FlagAround: Catched Exception "<<(string)typeid(exc).name()
     388  cout<<"FlagAroundFlag: Catched Exception "<<(string)typeid(exc).name()
    319389      <<"\n .... Msg= "<<exc.Msg()<<endl;
    320390}
  • trunk/ArchTOIPipe/ProcWSophya/ktoibad.h

    r1735 r1736  
    77#include "slinparbuff.h"
    88
     9//////////////////////////////////////////////////////
     10//-- Pour flagguer les samples hors dynamique
     11//   toi BoloIn ---> |FlagOutOfRange| ---> toi BoloOut
     12//////////////////////////////////////////////////////
     13class FlagOutOfRange : public TOIProcessor {
     14public:
     15  FlagOutOfRange(r_8 vmin,r_8 vmax,uint_8 flag=FlgToiOut);
     16  virtual ~FlagOutOfRange();
     17
     18  virtual void  init(void);
     19  virtual void  run(void);
     20
     21  //! Print
     22  void Print(ostream & os);
     23  inline void Print(void) {Print(cout);}
     24
     25protected:
     26  uint_8 flgBad;
     27  r_8 VMin,VMax;
     28};
     29
     30//////////////////////////////////////////////////////
    931//-- Pour rechercher les glitches
    10 //   toi BoloIn ---> |FlagGlitch | ---> toi BoloOut
     32//   toi BoloIn ---> |FlagGlitch| ---> toi BoloOut
     33//////////////////////////////////////////////////////
    1134class FlagGlitch : public TOIProcessor {
    1235public:
     
    4265};
    4366
     67//////////////////////////////////////////////////////
    4468//-- Pour flagguer les samples autour de samples deja flaggues
    45 //   toi BoloIn ---> |FlagAround | ---> toi BoloOut
    46 class FlagAround : public TOIProcessor {
     69//   Permet aussi de flagguer les samples ayant de mauvaises valeurs.
     70//   toi BoloIn ---> |FlagAroundFlag| ---> toi BoloOut
     71//////////////////////////////////////////////////////
     72class FlagAroundFlag : public TOIProcessor {
    4773public:
    48   FlagAround(uint_4 lm,uint_8 flgs=FlgToiAll);
    49   virtual ~FlagAround();
     74  FlagAroundFlag(uint_4 lm,uint_8 flgs=FlgToiAll);
     75  virtual ~FlagAroundFlag();
    5076
    5177  virtual void  init(void);
     
    5682  //! Flagguer autour des samples ayant la valeur flag
    5783  inline void SetFlagAroundFlag(uint_8 flag=FlgToiAll) {flgSample = flag;}
     84  //! Flagguer les samples hors limite
     85  inline void SetLimits(r_8 vmin=1.,r_8 vmax=-1.,uint_8 flag=FlgToiOut)
     86              {VMin=vmin; VMax=vmax; flgBad = flag;}
    5887  //! Print
    5988  void Print(ostream & os);
     
    6190
    6291protected:
    63   uint_8 flgSample,flgAround;
     92  uint_8 flgSample,flgAround,flgBad;
    6493  uint_4 LSide;
     94  r_8 VMin,VMax;
    6595};
    6696
Note: See TracChangeset for help on using the changeset viewer.