//////////////////////////////////////////////////////////////////// /// \class RAT::UnCal /// /// \brief Uncalibrate the MC, to mimic data /// /// \author Gabriel D. Orebi Gann /// \author Javier Caravaca - Contact /// /// REVISION HISTORY:\n /// 29 Mar 2010 : G. Orebi Gann - First version. /// Currently `uncalibration' consists of /// converting the time from ns back to ADC counts, /// and adding in nominal pedestal values, with the /// associated smearing, to the simulated Q and T /// (More detailed uncalibration is pending). /// 30 Mar 2010 : G. Orebi Gann - Enforce a maximum value of 12 bits /// for all Q and T values in PMTUnCal. /// 01 Apr 2010 : G. Orebi Gann - Remove TotalQ (this should come /// from PMTCal/Truth, and is set in PMTCalib/EventBuilder) /// 01 Apr 2010 : G. Orebi Gann - Get truth MC from PMTTruth, not PMTCal /// 27 Apr 2010 : G. Orebi Gann - Update TAC curl uncalibration /// 03 Mar 2011 : G Orebi Gann - Create PMT objects by type (normal, owl etc) /// 17 Oct 2011 : Gabriel Orebi Gann - Move bit funcs to BitManip /// 03 Feb 2014 : GDOG - allow up to 99 TSlope points /// - handle early hits better (dont throw them out!) /// 27 Jun 2015 : J. Caravaca - ECA by rate and occupancy /// 09 Nov 2016 : N. Barros - Moved constructor code to BeginOfRun, to avoid /// database access before run number is known /// and run plane tables are made available /// /// \details This class applies the constants generated from /// ECA and PCA runs to the perfect `truth' MC, to /// `uncalibrate' it, in order to mimic real data. /// Once uncalibrated, the Q and T values are then /// digitised (since the detector can only record int /// values in the range [0,(2^12 - 1)], in ADC counts) /// /// /// /// //////////////////////////////////////////////////////////////////// #ifndef __RAT_UnCal__ #define __RAT_UnCal__ #include #include #include #include #include #include #include "dprintf.hpp" #include "fileio.hpp" #include "multiio.hpp" #include "TFile.h" #include "TMath.h" #include namespace RAT { class UnCal{ public: UnCal(); virtual ~UnCal(); void UnCalibrateEvent(DS::Entry& ds, int iev, double GTtime); virtual void SetRun(DS::Run& _run) {fRun = &_run;}; void BeginOfRun(DS::Run &run); void EndOfRun(DS::Run &run); protected: virtual unsigned short DigitiseT(double RelHitTime); virtual unsigned short DigitiseQ(float HitCharge); void Pedestals(int cccc); void TSlope(int cccc); void UnCalibStatus(int flag, bool &eca, bool &pca, bool &mc); // Output and status methods void Die(std::string message, int flag_err, int info1, int info2, int return_code=1); void DontDie(std::string message, int flag_err, int info1, int info2, int info3=0); bool FileExists(std::string filename); BitManip *fBits; DBLinkPtr fPedsbank; DBLinkPtr fTslpbank; DBLinkPtr fUnCalbank; bool fDoECA; bool fDoPCA; bool fDoMC; bool fDoUncal; bool fDoPed; bool fDoTslp; std::vector fPedQHS; std::vector fPedQHL; std::vector fPedQLX; //std::vector fPedTAC; std::vector fPedSigQHS; std::vector fPedSigQHL; std::vector fPedSigQLX; std::vector fPedSigTAC; std::vector fTslope; std::vector fTslopeX; std::vector fTslopeBadTemp; std::vector > fTslopeBad; int fNcrate; int fNcard; int fNchannel; int fNcell; int fTotChannel; int fNTotCell; int fNSlopePoints; int fNdim; float fQHS, fQHL, fQLX; double fTAC; UShort_t fsQHS, fsQHL, fsQLX, fsTAC; DS::Run *fRun; }; } // namespace RAT #endif