#ifndef ESSD_H #define ESSD_H #include "IoSd.h" #include "Ec.h" #include "TShowerParams.h" //extern bool UseInfillRec; /// Constants specific to Es namespace kEs { ///definition for IsT4 return values const int T4_FD = 1; const int T4_TOT = 2; const int T4_4C1 = 4; ///Distance cut for lonely tanks const double D1_CUT = 1800.0; const double D2_CUT = 5000.0; const double TMIN_CUT_REG=-700.; const double TMAX_CUT_REG=2600.; const double TMIN_CUT_INF=-500.; const double TMAX_CUT_INF=1400.; // Infilled (from PMS 31-07-2008) + missing 1777 tank // - radio tanks (handled by UseRadio() // Fixed 15-09-2008: 1544 -> 1776 // Add new infill detector working since Aug 10th, 2009 // Last infill tanks working since Aug 25th, 2011 + HeatLet 1829 to 1833 //Tanks 1788 and 1790 added in august 2012 const unsigned int infilllist[]={1570,1574,1622,1625,1627,1760,1761, 1762,1763,1764,1765,1766,1767,1768, 1769,1770,1771,1772,1773,1774,1775, 1776,1777,1810,1811,1812,1813,1814, 1815,1816,1823,1825,1826,1827,1829, 1830,1831,1832,1833,1835,1836,1837, 1838,1839,1840,1841,1842,1843,1844, 1845,1788,1790}; void UseEA(int); void UseRadio(int); void UseUpgrades(int); void UseInfillStations(int); void UseBatata(int); void UseDoublets(int); unsigned int Crown(double x1, double x2, double y1, double y2,bool infilldist); void UseQualityCuts(int flag); void UseCheckT2(int flag); void UseCheckT2CommsCrisis(int flag); bool UseNewTriggers(int flag); bool NewTriggersUsed(); } class TEsEvent; /// Seeds (not flat triangles in one crown) class TSeed : public TShowerParams { public: bool operator ==(const TSeed &) const; bool operator <(const TSeed &) const; vector < TCalibStation * > fStations; TEsEvent * fEvent; bool fValid; double fVem; bool fTot; int fNbCompat; TSeed(TEsEvent * evt) { fEvent = evt; fValid = 0; fVem = 0; fTot = 0; fNbCompat = 0; fStations.reserve(3); }; void AddStat(unsigned int); double DeltaAng(TSeed *); double DeltaTime(unsigned int); void Select(); int DistInCrown(unsigned int); bool IsPhysics(); }; /// Event for selection class TEsEvent:public TEcEvent { private: int t4level; bool fIs5T5Pos; bool fIs6T5; public: TEsEvent(); TEsEvent(const IoSdEvent &); TEsEvent(const TEcEvent &); TEsEvent(EventPos); TEsEvent(EventId); TEsEvent(const TEsEvent &); void Init(); ~TEsEvent(); TEsEvent & operator =(const TEsEvent &); int GetT4Level() const {return t4level;} bool Is6T5() const {return fIs6T5;} bool Is5T5Pos() const {return fIs5T5Pos;} // Variable to select which kind of reconstruction we will do: //Normal --> false (S1000) or Infill --> true (S450) bool UseInfillRec; unsigned int fIdTankHottest; // To switch on-off the QualityCuts and the T2 Life checks for each tank bool IsCommsCrisis; bool FlagTankKilledQC; int FlagTankModifiedQC; bool FlagTankKilledT2; //Function to remove Test Tanks from April 1, 2009 void UseTestTanks(int); // High level trigger functions bool OfficialSelection(); ///< Official tank selection bool IsICRC2005(); ///< Official ICRC 2005 selection ? bool IsICRC2005Posterior(double xc, double yc); ///< Official ICRC 2005 selection posterior ? bool OldIsICRC2005Posterior(double xc, double yc); ///< Official ICRC 2005 selection posterior ? int IsT4(); ///< Is event a T4? (first removes unused stations) unsigned int IsT5(unsigned int crown=1);///< Official T5: T4 and maximum signal station has 6 neighbours. Returns max signal station Id, or 0 if not a T5 // Selection functions called by high level trigger void RemoveExternalTriggers(); ///< removes tanks with external trigger void RemoveLightning(); ///< removes lightning event tanks void RemoveBadAltitude(); ///< removes tanks with incorrect altitude void RemoveBadPosition(); ///< removes tanks with incorrect position and too far from the real one void RemoveBadStations(); ///< removes selected bad tanks void RemoveDuplicatedStations(); ///< removes duplicated from merged events void RemoveLonelyStations(double d1Cut = kEs::D1_CUT, double d2Cut = kEs::D2_CUT); void BottomUpSelection(double cutActive = -1.0, double cutSilent = -1.0); void UseNewTriggers(bool yes); //use or not the new MoPS and TOTd triggers int T4Criteria(); ///< T4 criteria, without removing stations unsigned int T5Criteria(unsigned int crown=1); ///< T5 criteria, without checking T4 /// a function to prune all stations not in the fSelected and fSilent vectors to reduce output size. void Prune(); // the vectors one should use (and not the ones from IoSd or Ec) vector < TCalibStation * >fRandomStations; ///< Casual tanks in event vector < TCalibStation * >fAmbiguousStations; ///< Ambiguous tanks vector < TCalibStation * >fSelectedStations; ///< Good tanks in the event vector < TCalibStation * >fSilentStations; ///< Stations without signal to be used as silent for reconstruction vector < TCalibStation * >fBadStations; ///< Stations one should ignore (EA tanks, infilled, doublets...) /// a vector of seeds used for determining if it is a T4 vector < TSeed > fSeeds; int ExperimentalT4(); void ExperimentalRemoveLonelyStations(double d1Cut, double d2Cut, double d3Cut); void QualityCuts(); void MoreQualityCuts(); void UseNonRainingOnly(); void RemoveXbee(); void CheckT2(); void CheckT2CommsCrisis(); int IsPos(double xc, double yc); int GetNeighbours(); TShowerParams fEstimated; ///< Estimation of the reconstruction bool TopDownSelection(bool newtrig); vector fOrd, fIndexes; int TopDownDiagnostics[3]; void OrderStationsBySignals(); void Remove777Stations(); bool PatternRecovering(); bool RecoverNStations(int); bool Recover3Stations(); void TopDownEstimateCore(); double TopDownCorrectTimeAltitude(int); double TopDownCorrectTimeAltitudeCurv(int); bool TopDownIsGoodTimeConfig(int); bool TopDownIsGoodSpaceConfig(); bool TopDownIsAligned(); const char *EsVersion(); }; const char *EsVersion(); #endif