Changeset 1736 in Sophya for trunk/ArchTOIPipe/ProcWSophya
- Timestamp:
- Nov 7, 2001, 6:31:37 PM (24 years ago)
- Location:
- trunk/ArchTOIPipe/ProcWSophya
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ArchTOIPipe/ProcWSophya/ktoibad.cc
r1735 r1736 4 4 #include "ntuple.h" 5 5 #include "ktoibad.h" 6 7 8 //////////////////////////////////////////////////////////////////////// 9 // Flag des sample hors dynamique 10 //////////////////////////////////////////////////////////////////////// 11 12 FlagOutOfRange::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 21 FlagOutOfRange::~FlagOutOfRange() 22 { 23 } 24 25 void FlagOutOfRange::Print(ostream & os) 26 { 27 os<<"FlagOutOfRange::Print Range: ["<<VMin<<","<<VMax<<"] flgBad="<<flgBad<<endl; 28 } 29 30 void FlagOutOfRange::init() 31 { 32 cout << "FlagOutOfRange::init" << endl; 33 declareInput("DataIn"); // input index 0 34 declareOutput("DataOut"); // output index 0 35 } 36 37 void FlagOutOfRange::run() 38 { 39 long snb = getMinIn(); 40 long sne = getMaxIn(); 41 42 if(snb>sne) { 43 cout<<"FlagOutOfRange::run() - Bad sample interval"<<snb<<" , "<<sne<<endl; 44 throw ParmError("FlagOutOfRange::run() - Bad sample interval"); 45 } 46 if(!checkInputTOIIndex(0)) { 47 cout<<"FlagOutOfRange::run() - Input TOI (DataIn) not connected! "<<endl; 48 throw ParmError("FlagOutOfRange::run() Input TOI (DataIn) not connected!"); 49 } 50 if(!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 //--------------------------------------------------------- 56 try { 57 58 cout<<"FlagOutOfRange::run(): SampleNum de "<<snb<<" a "<<sne<<endl; 59 uint_4 nbad=0; 60 61 for(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 } 70 cout<<"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 79 return; 80 } 81 6 82 7 83 //////////////////////////////////////////////////////////////////////// … … 19 95 //////////////////////////////////////////////////////////////////////// 20 96 21 ////////////////////////////////////////////////////////////////////////22 97 FlagGlitch::FlagGlitch(uint_4 lg,uint_4 lm,r_8 nsg) 23 98 : mLP(0), mLPsnb(-1), mLPsne(-1) … … 42 117 } 43 118 44 ////////////////////////////////////////////////////////////////////////45 119 void FlagGlitch::Print(ostream & os) 46 120 { … … 52 126 53 127 //////////////////////////////////////////////////////////////////////// 54 void FlagGlitch::init() { 128 void FlagGlitch::init() 129 { 55 130 if(mLP) cout << "FlagGlitch::init" << endl; 56 declareInput(" BoloIn"); // input index 057 declareOutput(" BoloOut"); // output index 0131 declareInput("DataIn"); // input index 0 132 declareOutput("DataOut"); // output index 0 58 133 59 134 for(int i=0;i<2;i++) … … 64 139 } 65 140 66 ////////////////////////////////////////////////////////////////////////67 141 void FlagGlitch::run() 68 142 { … … 75 149 } 76 150 if(!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!"); 79 153 } 80 154 if(!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!"); 83 157 } 84 158 … … 220 294 221 295 222 223 224 225 226 227 296 //////////////////////////////////////////////////////////////////////// 228 297 // Flag des sample autour d'un sample deja flaggue : … … 232 301 //////////////////////////////////////////////////////////////////////// 233 302 234 //////////////////////////////////////////////////////////////////////// 235 FlagAround::FlagAround(uint_4 lm,uint_8 flgs) 303 FlagAroundFlag::FlagAroundFlag(uint_4 lm,uint_8 flgs) 236 304 { 237 305 // Mise en forme des arguments … … 240 308 SetFlag(); 241 309 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 313 FlagAroundFlag::~FlagAroundFlag() 314 { 315 } 316 317 void FlagAroundFlag::Print(ostream & os) 318 { 319 os<<"FlagAroundFlag::Print" 252 320 <<" 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 0261 declareOutput(" BoloOut"); // output index 0321 <<" flgSample="<<flgSample<<" flgAround="<<flgAround<<endl 322 <<" ... Range: ["<<VMin<<","<<VMax<<"]"<<" flgBad="<<flgBad<<endl; 323 } 324 325 void FlagAroundFlag::init() 326 { 327 cout << "FlagAroundFlag::init" << endl; 328 declareInput("DataIn"); // input index 0 329 declareOutput("DataOut"); // output index 0 262 330 263 331 int_4 lbuff = 2*LSide +10; … … 265 333 } 266 334 267 //////////////////////////////////////////////////////////////////////// 268 void FlagAround::run() 335 void FlagAroundFlag::run() 269 336 { 270 337 long snb = getMinIn(); … … 272 339 273 340 if(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"); 276 343 } 277 344 if(!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!"); 280 347 } 281 348 if(!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!"); 284 351 } 285 352 … … 287 354 try { 288 355 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!356 cout<<"FlagAroundFlag::run(): SampleNum de "<<snb<<" a "<<sne<<endl; 357 uint_4 nflag=0, nflagged=0, nflagalready=0, nbad=0; 358 359 // Un peu lourdingue! On pourrait optimiser! 293 360 // Si on ne tue pas (LSide=0), alors juste un transfert de donnees 294 361 for(int_4 sn=snb;sn<=sne;sn++) { 295 362 r_8 bolo; uint_8 fgbolo=0; 296 363 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 298 368 nflag++; 299 369 } else if(fgbolo&flgAround) { // Pixel deja flagge around? … … 310 380 putData(0,sn,bolo,fgbolo); 311 381 } 312 cout<<"FlagAround ::run(): Fin de boucle: nflag="<<nflag313 <<" nflagged="<<nflagged<<" (already="<<nflagalready 314 <<" )/ tot="<<sne-snb+1<<endl;382 cout<<"FlagAroundFlag::run(): Fin de boucle: nflag="<<nflag 383 <<" nflagged="<<nflagged<<" (already="<<nflagalready<<")"<<endl 384 <<" ...... bad="<<nbad<<" / tot="<<sne-snb+1<<endl; 315 385 316 386 //--------------------------------------------------------- 317 387 } catch (PException & exc) { 318 cout<<"FlagAround : Catched Exception "<<(string)typeid(exc).name()388 cout<<"FlagAroundFlag: Catched Exception "<<(string)typeid(exc).name() 319 389 <<"\n .... Msg= "<<exc.Msg()<<endl; 320 390 } -
trunk/ArchTOIPipe/ProcWSophya/ktoibad.h
r1735 r1736 7 7 #include "slinparbuff.h" 8 8 9 ////////////////////////////////////////////////////// 10 //-- Pour flagguer les samples hors dynamique 11 // toi BoloIn ---> |FlagOutOfRange| ---> toi BoloOut 12 ////////////////////////////////////////////////////// 13 class FlagOutOfRange : public TOIProcessor { 14 public: 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 25 protected: 26 uint_8 flgBad; 27 r_8 VMin,VMax; 28 }; 29 30 ////////////////////////////////////////////////////// 9 31 //-- Pour rechercher les glitches 10 // toi BoloIn ---> |FlagGlitch | ---> toi BoloOut 32 // toi BoloIn ---> |FlagGlitch| ---> toi BoloOut 33 ////////////////////////////////////////////////////// 11 34 class FlagGlitch : public TOIProcessor { 12 35 public: … … 42 65 }; 43 66 67 ////////////////////////////////////////////////////// 44 68 //-- 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 ////////////////////////////////////////////////////// 72 class FlagAroundFlag : public TOIProcessor { 47 73 public: 48 FlagAround (uint_4 lm,uint_8 flgs=FlgToiAll);49 virtual ~FlagAround ();74 FlagAroundFlag(uint_4 lm,uint_8 flgs=FlgToiAll); 75 virtual ~FlagAroundFlag(); 50 76 51 77 virtual void init(void); … … 56 82 //! Flagguer autour des samples ayant la valeur flag 57 83 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;} 58 87 //! Print 59 88 void Print(ostream & os); … … 61 90 62 91 protected: 63 uint_8 flgSample,flgAround ;92 uint_8 flgSample,flgAround,flgBad; 64 93 uint_4 LSide; 94 r_8 VMin,VMax; 65 95 }; 66 96
Note:
See TracChangeset
for help on using the changeset viewer.