| 1 | 
 /** @file | 
 /** @file | 
| 2 | 
  * $Author: kusanagi $ | 
  * $Author: kusanagi $ | 
| 3 | 
  * $Date: 2004/09/24 11:57:49 $ | 
  * $Date: 2005/05/28 08:30:11 $ | 
| 4 | 
  * $Revision: 2.1 $ | 
  * $Revision: 4.2 $ | 
| 5 | 
  *  | 
  *  | 
| 6 | 
  * Header file for the algorithms used to read the techmodel data file. | 
  * Header file for the algorithms used to read the techmodel data file. | 
| 7 | 
  */ | 
  */ | 
| 13 | 
 #include "PscuEvent.h" | 
 #include "PscuEvent.h" | 
| 14 | 
  | 
  | 
| 15 | 
  | 
  | 
| 16 | 
 #include "PhysEndRunEvent.h" | 
 #include "endrun/PhysEndRunEvent.h" | 
| 17 | 
 #include "CalibCalPulse1Event.h" | 
 #include "CalibCalPulse1Event.h" | 
| 18 | 
 #include "CalibCalPulse2Event.h" | 
 #include "CalibCalPulse2Event.h" | 
| 19 | 
 #include "physics/TrackerReader.h" | 
 #include "physics/TrackerReader.h" | 
| 20 | 
 #include "physics/AnticounterReader.h" | 
 #include "physics/AnticounterReader.h" | 
| 21 | 
 #include "physics/CalorimeterReader.h" | 
 #include "physics/CalorimeterReader.h" | 
| 22 | 
 #include "physics/NeutronDetectorReader.h" | 
 #include "physics/NeutronDetectorReader.h" | 
| 23 | 
 #include "CalibTrkBothEvent.h" | 
 #include "physics/S4Reader.h" | 
| 24 | 
  | 
 #include "physics/TofReader.h" | 
| 25 | 
  | 
 #include "physics/TriggerReader.h" | 
| 26 | 
 #include "CalibTrk1Event.h" | 
 #include "CalibTrk1Event.h" | 
| 27 | 
 #include "CalibTrk2Event.h" | 
 #include "CalibTrk2Event.h" | 
 | 
 #include "CalibTrdEvent.h" | 
  | 
| 28 | 
 #include "CalibTofEvent.h" | 
 #include "CalibTofEvent.h" | 
| 29 | 
 #include "CalibS4Event.h" | 
 #include "CalibS4Event.h" | 
| 30 | 
 #include "CalibCalPedEvent.h" | 
 #include "CalibCalPedEvent.h" | 
| 31 | 
 #include "CalibAcEvent.h" | 
 #include "Calib1_Ac1Event.h" | 
| 32 | 
  | 
 #include "Calib1_Ac2Event.h" | 
| 33 | 
  | 
 #include "Calib2_Ac1Event.h" | 
| 34 | 
  | 
 #include "Calib2_Ac2Event.h" | 
| 35 | 
 #include "RunHeaderEvent.h" | 
 #include "RunHeaderEvent.h" | 
| 36 | 
 #include "RunTrailerEvent.h" | 
 #include "RunTrailerEvent.h" | 
| 37 | 
 #include "CalibHeaderEvent.h" | 
 #include "CalibHeaderEvent.h" | 
| 45 | 
 #include "varDump/VarDumpEvent.h" | 
 #include "varDump/VarDumpEvent.h" | 
| 46 | 
 #include "arrDump/ArrDumpEvent.h" | 
 #include "arrDump/ArrDumpEvent.h" | 
| 47 | 
 #include "tabDump/TabDumpEvent.h" | 
 #include "tabDump/TabDumpEvent.h" | 
| 48 | 
  | 
 #include "tsbt/TsbTEvent.h" | 
| 49 | 
  | 
 #include "tsbb/TsbBEvent.h" | 
| 50 | 
 #include "tmtc/TmtcEvent.h" | 
 #include "tmtc/TmtcEvent.h" | 
| 51 | 
 #include "mcmd/McmdEvent.h" | 
 #include "mcmd/McmdEvent.h" | 
| 52 | 
 #include "ForcedFECmdEvent.h" | 
 #include "ForcedFECmdEvent.h" | 
| 53 | 
 #include "AcInitEvent.h" | 
 #include "Ac1InitEvent.h" | 
| 54 | 
 #include "CalInitEvent.h" | 
 #include "CalInitEvent.h" | 
| 55 | 
 #include "TrkInitEvent.h" | 
 #include "TrkInitEvent.h" | 
| 56 | 
 #include "TofInitEvent.h" | 
 #include "TofInitEvent.h" | 
| 57 | 
 #include "TrgInitEvent.h" | 
 #include "TrgInitEvent.h" | 
| 58 | 
 #include "NdInitEvent.h" | 
 #include "NdInitEvent.h" | 
| 59 | 
  | 
 #include "S4InitEvent.h" | 
| 60 | 
  | 
 #include "Ac2InitEvent.h" | 
| 61 | 
 #include "CalAlarmEvent.h" | 
 #include "CalAlarmEvent.h" | 
| 62 | 
 #include "AcAlarmEvent.h" | 
 #include "AcAlarmEvent.h" | 
| 63 | 
 #include "TrkAlarmEvent.h" | 
 #include "TrkAlarmEvent.h" | 
| 64 | 
 #include "TrgAlarmEvent.h" | 
 #include "TrgAlarmEvent.h" | 
| 65 | 
 #include "TofAlarmEvent.h" | 
 #include "TofAlarmEvent.h" | 
| 66 | 
  | 
 #include "S4AlarmEvent.h" | 
| 67 | 
  | 
  | 
| 68 | 
 using namespace std; | 
 using namespace std; | 
| 69 | 
  | 
  | 
| 134 | 
       anticounter::AnticounterReader*   anticounterReader; | 
       anticounter::AnticounterReader*   anticounterReader; | 
| 135 | 
       calorimeter::CalorimeterReader*   calorimeterReader; | 
       calorimeter::CalorimeterReader*   calorimeterReader; | 
| 136 | 
       neutron::NeutronDetectorReader*   neutronReader; | 
       neutron::NeutronDetectorReader*   neutronReader; | 
| 137 | 
  | 
       S4::S4Reader*                     s4Reader; | 
| 138 | 
  | 
       tof::TofReader*                   tofReader; | 
| 139 | 
  | 
       trigger::TriggerReader*           triggerReader; | 
| 140 | 
     public: | 
     public: | 
| 141 | 
       PhysicsReader(void); | 
       PhysicsReader(void); | 
| 142 | 
       virtual void Init(PamelaRun *); | 
       virtual void Init(PamelaRun *); | 
| 146 | 
  | 
  | 
| 147 | 
  | 
  | 
| 148 | 
 /********************************************** | 
 /********************************************** | 
 | 
 * Event reader algorithm for CalibTrkBoth events. | 
  | 
 | 
 **********************************************/ | 
  | 
 | 
     class CalibTrkBothReader: public TechmodelAlgorithm { | 
  | 
 | 
     private: | 
  | 
 | 
       /** The CalibTrkBoth event that is created in the reader. */ | 
  | 
 | 
       CalibTrkBothEvent* calibTrkBoth; | 
  | 
 | 
     public: | 
  | 
 | 
       CalibTrkBothReader(void); | 
  | 
 | 
       virtual void Init(PamelaRun *); | 
  | 
 | 
       virtual void RunEvent(int, long int) throw (Exception); | 
  | 
 | 
       //this type of RUNEvent should be the future develop.  | 
  | 
 | 
       //Pass the buffer not the pointer to file | 
  | 
 | 
       //virtual void RunEvent(int, long int, char[]); | 
  | 
 | 
       virtual std::string GetVersionInfo(void) const; | 
  | 
 | 
     }; | 
  | 
 | 
  | 
  | 
 | 
  | 
  | 
 | 
 /********************************************** | 
  | 
| 149 | 
 * Event reader algorithm for CalibTrk1 events. | 
 * Event reader algorithm for CalibTrk1 events. | 
| 150 | 
 **********************************************/ | 
 **********************************************/ | 
| 151 | 
     class CalibTrk1Reader: public TechmodelAlgorithm { | 
     class CalibTrk1Reader: public TechmodelAlgorithm { | 
| 179 | 
  | 
  | 
| 180 | 
  | 
  | 
| 181 | 
 /********************************************** | 
 /********************************************** | 
 | 
 * Event reader algorithm for CalibTrd events. | 
  | 
 | 
 **********************************************/ | 
  | 
 | 
     class CalibTrdReader: public TechmodelAlgorithm { | 
  | 
 | 
     private: | 
  | 
 | 
       /** The CalibTrd event that is created in the reader. */ | 
  | 
 | 
       CalibTrdEvent* calibTrd; | 
  | 
 | 
     public: | 
  | 
 | 
       CalibTrdReader(void); | 
  | 
 | 
       virtual void Init(PamelaRun *); | 
  | 
 | 
       virtual void RunEvent(int, long int) throw (Exception); | 
  | 
 | 
       virtual std::string GetVersionInfo(void) const; | 
  | 
 | 
     }; | 
  | 
 | 
  | 
  | 
 | 
  | 
  | 
 | 
 /********************************************** | 
  | 
| 182 | 
 * Event reader algorithm for CalibTof events. | 
 * Event reader algorithm for CalibTof events. | 
| 183 | 
 **********************************************/ | 
 **********************************************/ | 
| 184 | 
     class CalibTofReader: public TechmodelAlgorithm { | 
     class CalibTofReader: public TechmodelAlgorithm { | 
| 199 | 
     class CalibS4Reader: public TechmodelAlgorithm { | 
     class CalibS4Reader: public TechmodelAlgorithm { | 
| 200 | 
     private: | 
     private: | 
| 201 | 
       /** The CalibCal event that is created in the reader. */ | 
       /** The CalibCal event that is created in the reader. */ | 
| 202 | 
       CalibS4Event* CalibS4; | 
       CalibS4Event* calibS4; | 
| 203 | 
     public: | 
     public: | 
| 204 | 
       CalibS4Reader(void); | 
       CalibS4Reader(void); | 
| 205 | 
       virtual void Init(PamelaRun *); | 
       virtual void Init(PamelaRun *); | 
| 206 | 
       virtual void RunEvent(int, long int) throw (Exception); | 
       virtual void RunEvent(int, long int) throw (WrongCRCException); | 
| 207 | 
       virtual std::string GetVersionInfo(void) const; | 
       virtual std::string GetVersionInfo(void) const; | 
| 208 | 
     }; | 
     }; | 
| 209 | 
  | 
  | 
| 224 | 
  | 
  | 
| 225 | 
  | 
  | 
| 226 | 
 /*********************************************** | 
 /*********************************************** | 
| 227 | 
 * Event reader algorithm for CalibAc events. | 
 * Event reader algorithm for Calib1_Ac1 events. | 
| 228 | 
 **********************************************/ | 
 **********************************************/ | 
| 229 | 
     class CalibAcReader: public TechmodelAlgorithm { | 
     class Calib1_Ac1Reader: public TechmodelAlgorithm { | 
| 230 | 
     private: | 
     private: | 
| 231 | 
       /** The CalibAc event that is created in the reader. */ | 
       /** The CalibAc event that is created in the reader. */ | 
| 232 | 
       CalibAcEvent* CalibAc; | 
       Calib1_Ac1Event* calib1_Ac1; | 
| 233 | 
     public: | 
     public: | 
| 234 | 
       CalibAcReader(void); | 
       Calib1_Ac1Reader(void); | 
| 235 | 
  | 
       virtual void Init(PamelaRun *); | 
| 236 | 
  | 
       virtual void RunEvent(int, long int) throw (Exception); | 
| 237 | 
  | 
       virtual std::string GetVersionInfo(void) const; | 
| 238 | 
  | 
     }; | 
| 239 | 
  | 
  | 
| 240 | 
  | 
  | 
| 241 | 
  | 
 /*********************************************** | 
| 242 | 
  | 
 * Event reader algorithm for Calib1_Ac2 events. | 
| 243 | 
  | 
 **********************************************/ | 
| 244 | 
  | 
     class Calib1_Ac2Reader: public TechmodelAlgorithm { | 
| 245 | 
  | 
     private: | 
| 246 | 
  | 
       /** The Calib1_Ac2 event that is created in the reader. */ | 
| 247 | 
  | 
       Calib1_Ac2Event* calib1_Ac2; | 
| 248 | 
  | 
     public: | 
| 249 | 
  | 
       Calib1_Ac2Reader(void); | 
| 250 | 
  | 
       virtual void Init(PamelaRun *); | 
| 251 | 
  | 
       virtual void RunEvent(int, long int) throw (Exception); | 
| 252 | 
  | 
       virtual std::string GetVersionInfo(void) const; | 
| 253 | 
  | 
     }; | 
| 254 | 
  | 
  | 
| 255 | 
  | 
 /*********************************************** | 
| 256 | 
  | 
 * Event reader algorithm for Calib2_Ac1 events. | 
| 257 | 
  | 
 **********************************************/ | 
| 258 | 
  | 
     class Calib2_Ac1Reader: public TechmodelAlgorithm { | 
| 259 | 
  | 
     private: | 
| 260 | 
  | 
       /** The Calib2_Ac1 event that is created in the reader. */ | 
| 261 | 
  | 
       Calib2_Ac1Event* calib2_Ac1; | 
| 262 | 
  | 
     public: | 
| 263 | 
  | 
       Calib2_Ac1Reader(void); | 
| 264 | 
  | 
       virtual void Init(PamelaRun *); | 
| 265 | 
  | 
       virtual void RunEvent(int, long int) throw (Exception); | 
| 266 | 
  | 
       virtual std::string GetVersionInfo(void) const; | 
| 267 | 
  | 
     }; | 
| 268 | 
  | 
  | 
| 269 | 
  | 
 /*********************************************** | 
| 270 | 
  | 
 * Event reader algorithm for Calib2_Ac2 events. | 
| 271 | 
  | 
 **********************************************/ | 
| 272 | 
  | 
     class Calib2_Ac2Reader: public TechmodelAlgorithm { | 
| 273 | 
  | 
     private: | 
| 274 | 
  | 
       /** The Calib2_Ac2 event that is created in the reader. */ | 
| 275 | 
  | 
       Calib2_Ac2Event* calib2_Ac2; | 
| 276 | 
  | 
     public: | 
| 277 | 
  | 
       Calib2_Ac2Reader(void); | 
| 278 | 
       virtual void Init(PamelaRun *); | 
       virtual void Init(PamelaRun *); | 
| 279 | 
       virtual void RunEvent(int, long int) throw (Exception); | 
       virtual void RunEvent(int, long int) throw (Exception); | 
| 280 | 
       virtual std::string GetVersionInfo(void) const; | 
       virtual std::string GetVersionInfo(void) const; | 
| 479 | 
 **********************************************/ | 
 **********************************************/ | 
| 480 | 
     class TmtcReader: public TechmodelAlgorithm { | 
     class TmtcReader: public TechmodelAlgorithm { | 
| 481 | 
     //Length in bytes of the subPacket (that is te TmtcRecord excluded subCRC) | 
     //Length in bytes of the subPacket (that is te TmtcRecord excluded subCRC) | 
| 482 | 
     static const int TMTC_SUB_LENGTH = 57; | 
     static const int TMTC_SUB_LENGTH = 44; | 
| 483 | 
     //Length in bytes of the subPacketCRC | 
     //Length in bytes of the subPacketCRC | 
| 484 | 
     static const int TMTC_SUBCRC_LENGTH = 1; | 
     static const int TMTC_SUBCRC_LENGTH = 1; | 
| 485 | 
     //Length in bytes of the PacketCRC | 
     //Length in bytes of the PacketCRC | 
| 487 | 
     private: | 
     private: | 
| 488 | 
       /** The TMTC event that is created in the reader. */ | 
       /** The TMTC event that is created in the reader. */ | 
| 489 | 
       TmtcEvent* Tmtc; | 
       TmtcEvent* Tmtc; | 
| 490 | 
       float convert_th(int); | 
       //float convert_th(int); | 
| 491 | 
     public: | 
     public: | 
| 492 | 
     TmtcReader(void); | 
     TmtcReader(void); | 
| 493 | 
     virtual void Init(PamelaRun *); | 
     virtual void Init(PamelaRun *); | 
| 527 | 
  | 
  | 
| 528 | 
  | 
  | 
| 529 | 
 /********************************************** | 
 /********************************************** | 
| 530 | 
 * Event reader algorithm for AcInit events. | 
 * Event reader algorithm for Ac1Init events. | 
| 531 | 
 **********************************************/ | 
 **********************************************/ | 
| 532 | 
     class AcInitReader: public TechmodelAlgorithm { | 
     class Ac1InitReader: public TechmodelAlgorithm { | 
| 533 | 
     private: | 
     private: | 
| 534 | 
       /** The AcInit event that is created in the reader. */ | 
       /** The Ac1Init event that is created in the reader. */ | 
| 535 | 
       AcInitEvent* acInit; | 
       Ac1InitEvent* ac1Init; | 
| 536 | 
     public: | 
     public: | 
| 537 | 
       AcInitReader(void); | 
       Ac1InitReader(void); | 
| 538 | 
       virtual void Init(PamelaRun *); | 
       virtual void Init(PamelaRun *); | 
| 539 | 
       virtual void RunEvent(int, long int) throw (WrongCRCException); | 
       virtual void RunEvent(int, long int) throw (WrongCRCException); | 
| 540 | 
       virtual std::string GetVersionInfo(void) const; | 
       virtual std::string GetVersionInfo(void) const; | 
| 614 | 
       virtual std::string GetVersionInfo(void) const; | 
       virtual std::string GetVersionInfo(void) const; | 
| 615 | 
     }; | 
     }; | 
| 616 | 
  | 
  | 
| 617 | 
  | 
 /********************************************** | 
| 618 | 
  | 
 * Event reader algorithm for S4Init events. | 
| 619 | 
  | 
 **********************************************/ | 
| 620 | 
  | 
     class S4InitReader: public TechmodelAlgorithm { | 
| 621 | 
  | 
     private: | 
| 622 | 
  | 
       /** The S4Init event that is created in the reader. */ | 
| 623 | 
  | 
       S4InitEvent* s4Init; | 
| 624 | 
  | 
     public: | 
| 625 | 
  | 
       S4InitReader(void); | 
| 626 | 
  | 
       virtual void Init(PamelaRun *); | 
| 627 | 
  | 
       virtual void RunEvent(int, long int) throw (WrongCRCException); | 
| 628 | 
  | 
       virtual std::string GetVersionInfo(void) const; | 
| 629 | 
  | 
     }; | 
| 630 | 
  | 
  | 
| 631 | 
  | 
  | 
| 632 | 
  | 
 /********************************************** | 
| 633 | 
  | 
 * Event reader algorithm for Ac2Init events. | 
| 634 | 
  | 
 **********************************************/ | 
| 635 | 
  | 
     class Ac2InitReader: public TechmodelAlgorithm { | 
| 636 | 
  | 
     private: | 
| 637 | 
  | 
       /** The Ac2Init event that is created in the reader. */ | 
| 638 | 
  | 
       Ac2InitEvent* ac2Init; | 
| 639 | 
  | 
     public: | 
| 640 | 
  | 
       Ac2InitReader(void); | 
| 641 | 
  | 
       virtual void Init(PamelaRun *); | 
| 642 | 
  | 
       virtual void RunEvent(int, long int) throw (WrongCRCException); | 
| 643 | 
  | 
       virtual std::string GetVersionInfo(void) const; | 
| 644 | 
  | 
     }; | 
| 645 | 
  | 
  | 
| 646 | 
  | 
  | 
| 647 | 
 /********************************************** | 
 /********************************************** | 
| 648 | 
 * Event reader algorithm for CalAlarm events. | 
 * Event reader algorithm for CalAlarm events. | 
| 715 | 
     }; | 
     }; | 
| 716 | 
  | 
  | 
| 717 | 
 /********************************************** | 
 /********************************************** | 
| 718 | 
  | 
 * Event reader algorithm for S4Alarm events. | 
| 719 | 
  | 
 **********************************************/ | 
| 720 | 
  | 
     class S4AlarmReader: public TechmodelAlgorithm { | 
| 721 | 
  | 
     private: | 
| 722 | 
  | 
       /** The S4Alarm event that is created in the reader. */ | 
| 723 | 
  | 
       S4AlarmEvent* s4Alarm; | 
| 724 | 
  | 
     public: | 
| 725 | 
  | 
       S4AlarmReader(void); | 
| 726 | 
  | 
       virtual void Init(PamelaRun *); | 
| 727 | 
  | 
       virtual void RunEvent(int, long int) throw (WrongCRCException); | 
| 728 | 
  | 
       virtual std::string GetVersionInfo(void) const; | 
| 729 | 
  | 
     }; | 
| 730 | 
  | 
  | 
| 731 | 
  | 
 /********************************************** | 
| 732 | 
  | 
 * Event reader algorithm for TsbT events. | 
| 733 | 
  | 
 **********************************************/ | 
| 734 | 
  | 
     class TsbTReader: public TechmodelAlgorithm { | 
| 735 | 
  | 
     private: | 
| 736 | 
  | 
       /** The TsbT event that is created in the reader. */ | 
| 737 | 
  | 
       TsbTEvent* TsbT; | 
| 738 | 
  | 
     public: | 
| 739 | 
  | 
       TsbTReader(void); | 
| 740 | 
  | 
       virtual void Init(PamelaRun *); | 
| 741 | 
  | 
       virtual void RunEvent(int, long int) throw (WrongCRCException); | 
| 742 | 
  | 
       virtual std::string GetVersionInfo(void) const; | 
| 743 | 
  | 
     }; | 
| 744 | 
  | 
  | 
| 745 | 
  | 
 /********************************************** | 
| 746 | 
  | 
 * Event reader algorithm for TsbB events. | 
| 747 | 
  | 
 **********************************************/ | 
| 748 | 
  | 
     class TsbBReader: public TechmodelAlgorithm { | 
| 749 | 
  | 
     private: | 
| 750 | 
  | 
       /** The TsbB event that is created in the reader. */ | 
| 751 | 
  | 
       TsbBEvent* TsbB; | 
| 752 | 
  | 
     public: | 
| 753 | 
  | 
       TsbBReader(void); | 
| 754 | 
  | 
       virtual void Init(PamelaRun *); | 
| 755 | 
  | 
       virtual void RunEvent(int, long int) throw (WrongCRCException); | 
| 756 | 
  | 
       virtual std::string GetVersionInfo(void) const; | 
| 757 | 
  | 
     }; | 
| 758 | 
  | 
  | 
| 759 | 
  | 
 /********************************************** | 
| 760 | 
 * Event reader algorithm for PSCU events. | 
 * Event reader algorithm for PSCU events. | 
| 761 | 
 **********************************************/ | 
 **********************************************/ | 
| 762 | 
     class PscuReader: public TechmodelAlgorithm { | 
     class PscuReader: public TechmodelAlgorithm { | 
| 777 | 
 #endif /* READER_ALGORITHM_H */ | 
 #endif /* READER_ALGORITHM_H */ | 
| 778 | 
  | 
  | 
| 779 | 
  | 
  | 
| 780 | 
  | 
  | 
| 781 | 
  | 
  |