// // File : EyeEventClassifier.hh // // Purpose: Classification class for shower/muon/noise discrimination // // Authors: Pedro Facal, Paolo Privitera // // $Id: EyeEventClassifier.hh 11578 2010-10-11 10:13:03Z mathes $ // /** @file EyeEventClassifier.hh * Declaration of the class EyeEventClassifier. * @author P. Privitera & P. Facal, INFN Rome */ #ifndef _EyeEventClassifier_hh_ #define _EyeEventClassifier_hh_ #include #include #include #include #include #include #include #include #include #include #include #include #include // --- forward declaration(s) class TEyeEvent; // --- this class contains the FD data /** This class implements a classification algorithm for the FD mirror event * data (TEyeEvent). * * The classification is mainly based on the SLT data and the corresponding * FADC traces. * * Sketch of the algorithm: * Tbd! */ class EyeEventClassifier : public FdUtil::Singleton { friend class FdUtil::Singleton; /** Constructor for the class EyeEventClassifier. * * Initialize all variables to their default values. */ EyeEventClassifier(); /** Destructor for the class EyeEventClassifier. * * Delete all internal data objects and close the log file. */ virtual ~EyeEventClassifier(); public: /** Perform the classification of the passed TMirrorEvent, i.e. do a * partial analysis of the passed data in order to find out its basic * signature. */ void DoClassification(TEyeEvent*); /** Calculate total shower signal in ADC counts. */ void CalculateTotalSignal(); /** Get the result of the last classification performed. */ TEyeEventHeader::EEventClass GetEventClass() { return fEventClass; } /** Coordinates to send to CDAS. * These values are only if fEventClass==kShowerCandidate. * @li AzimutAtGround -> Expected azimut of the landing point * @li TimeAtGround -> Expected landing GPS Nano time. */ float GetAzimuthAtGround() { return fAzimuthAtGround; } /** Coordinates to send to CDAS. */ int GetTimeAtGround() { return fTimeAtGround; } #ifdef USE_UBA_EXTENSION /** Do some cuts to the events with large number of pixels with no pulse. */ void FirstProcess(); #endif // USE_UBA_EXTENSION /** Number of selected pixels for T3. */ int GetNPixels() { return fT3List->GetT3Pixels(); } /** Zenith angle of the SDP normal vector. */ float GetSDPTheta() { return fSDPTheta; } /** Azimuth angle of the SDP normal vector. */ float GetSDPPhi() { return fSDPPhi; } /* Total shower signal in ADC counts*/ float GetTotalSignal() { return fTotSignal; } /** Get a Pointer to the list of Pixels. */ T3PixelList * GetT3PixelList() { return fT3List; } /** Set the name for the log file and open it. The log level is set to 1. * The log file is closed upon desctruction of the EyeEventClassifier object. */ void OpenLogfile(const char* filename); /** Print the statistics of classification. */ void PrintStatistics(FILE *str=stdout); /** Print info about current event to the specified stream. */ virtual void Show(unsigned int level=1,FILE *str=stdout); /** Print info about current event to the specified stream. */ virtual void Show(unsigned int level=1,std::ostream& ostr=std::cout); /** Print the current settings of the EyeEventClassifier to the * specified stream. */ void ShowSettings(std::ostream& ostr=std::cout); /** Print shower pixels. */ void ShowShowerPixels(); /** Set the print (verbosity) level of this class. This levels have the * following meaning: * @li 0 -> No printout at all * @li 1 -> Shower Candidates * @li 2 -> All events * @li 3 -> Events+Pixels */ void SetPrintLevel(unsigned int level) { fPrintLevel = level; } /** Set the log print (verbosity) level of this class. * * Log file must be opended first. @see also SetPrintLevel(). */ void SetLogLevel(unsigned int level); protected: /** Classify the event. Use T1 and FADC information. */ void ClassifyEvent(); /** Clear the internal variables and data area. */ void Clear(); /** Clear the internal variables and data area. */ void ClearMirrorData(); /** Convert azimuth and time from local to CDAS reference system and time. */ void ConvertAzimuthTime(); /** Convert azimuth and time of pixels from local to CDAS reference * system and time. */ void ConvertAzimuthTimePixel(); /** Find shower time at ground (local time). */ void FitTime(); /** Find shower azimuth at ground (local coordinates). */ void FitTrack(); /** */ void FindSDP(); /** Methods used in the T3 classification algorithm. * * Select pixels to be included in class T3PixelSel. * Use T2 patterns and multipatterns. */ void PixelSelection(); /** Reject pixels with time inconsistent with fit. */ void PixelTimeReject(); /** Reject pixels with position inconsistent with fit. */ void PixelTrackReject(); /** Find kIsShower. */ void ProcessShower(); /** Find pixel position in TEyePixelList in order to retrieve FADC data. */ void AssignPixel(); /** Find time of maximum in FADC pulse. Used to reject long muons and * find close showers. */ void PulseFinding(); /** Find kIsMuon. Fast muon rejection using only T1 information. */ void RejectMuons(); /** Test if a pixel is compatible with a given T2 pattern. * * Note: Uses only T1 info. */ void TestPattern(int pattern, int col, int row, int time); /** Test if a pixel is compatible with a given T2 multipattern. * * Note: Uses only T1 info. */ void TestMultiPattern(int col, int row, int time); private: // avoid copying, etc. EyeEventClassifier(EyeEventClassifier&); EyeEventClassifier& operator=(EyeEventClassifier&); T3PixelList *fT3List; // Used to keep track of pixels already included in T3PixelList. */ bool fPixelSelected[FdUtil::Fd::kMI_NCOLS+1][FdUtil::Fd::kMI_NROWS+1]; // Result of the linear fit: // fAzimuth = fAzimutSlope * fElevation + fAzimuth0 , in local coordinates. float fAzimuth0; float fAzimuthSlope; // Result of the linear fit: // fT1 = fTimeSlope * fElevation + fTime0 , in local coordinates. float fTime0; float fTimeSlope; // Result of FindSDP float fSDPTheta; float fSDPPhi; // Time of the first T2 pattern of the event. // It should correspond to the GPS time and nanotime of the event. int fTimePattern[7]; // Nanotime of the mirror int fNanoTime[7]; // Time offset of the mirror int fTimeOffset[7]; // Extrapolated shower azimuth at the impact point on ground. // CDAS coordinates. float fAzimuthAtGround; // Extrapolated shower time at the impact point on ground. // In units of GPS nanoseconds for CDAS. int fTimeAtGround; // Total Shower Signal in ADC counts float fTotSignal; // Current mirror being analysed int fCurrentMirror; #if (EYEEVENT_VERSION_CODE >= ModuleVersionCode(2,0,0)) // Current mirrors axis pointing data FdUtil::FdGeometry::CameraPointing_t fCurrentAxis; #endif // EYEEVENT_VERSION_CODE // Number of T1 and T2 pixels int fNT1; int fNT2; TEyeEventHeader *fHeader; TEyePixelList *fEyePixelList; const FdRoot::TTimeStamp *fTimeStamp; // time stamp for NxPage TMirrorPixelData *fPixelData; TEyeFADCData *fEyeFadcData; TStopwatch fClassificationTime; // time needed for a classification unsigned int fPrintLevel; // more means more output unsigned int fLogLevel; // more means more output FILE *fLogfile; char *fLogfileName; float fSDPPhiGround ; TH1F *NT2mT1; TH1F *Ssp; TH2F *NT2vT1; TEyeEventHeader::EEventClass fEventClass; }; #endif // _EyeEventClassifier_hh_