Skip to content
Snippets Groups Projects
  • Mark Jones's avatar
    4d4418d0
    Modify THcCoinTime and THcTrigDet · 4d4418d0
    Mark Jones authored
    1) THcTrigDet
       a) Modify code to use string vector fTrigNames to identify which of the trigger
         trigger detector TDC signals to use for coincidence timing. This
          replaces the hard-coded names. The integer array fTrigId[4] keeps
         track of the array ID in the overall fTDcNames vector that goes
          with the fTrigNames[4]
       b) The fTrigNames must be in order of SHMS ROC1, HMS ROC1, SHMS ROC2
         and HMS ROC2.
       c) Default names are "pTRIG1_ROC1","pTRIG4_ROC1","pTRIG1_ROC2","pTRIG4_ROC2"
          The parameter is t_coin_trigNames
          For example:
          t_coin_trigNames="pTRIG1_ROC1 pTRIG4_ROC1 pTRIG1_ROC2 pTRIG4_ROC2"
          This parameter is read-in and the split into a string vector fTrigNames.
       d) In HcTrigDet::ReadDatabase , all members of fTrigID array are set
    to -1 then a loop over all Tdc in the trigger detector looks for match between
    fTdcNames amd fTrigNames to set fTrigId. If match not found the fTrigId = -1.
       e) In THcTrigDet.h made new method Get_CT_TrigTime(Int_t ii) to be used
    in in THcCoinTime to get the 4 trigger times: SHMS ROC1 (ii=0), HMS ROC1 (ii=1),
    SHMS ROC2 (ii=2) and HMS ROC2 (ii=3).  If fTrigId[ii]=0 then it returns 0
    otherwise returns fTdcTime[fTrigID[ii]].
    
    2) THcCoinTime
      a) Previously used the raw trigger times and had a hard-coded 0.1 ns/channel
    conversion. Now use the trigger times which already are in ns using the
    ns/channel conversion set in the TrigDet.
      b) Now use the new TrgiDet method Get_CT_TrigTime(ii) to get the
    trigger times for SHMS ROC1, HMS ROC1, SHMS ROC2 and HMS ROC2.
    4d4418d0
    History
    Modify THcCoinTime and THcTrigDet
    Mark Jones authored
    1) THcTrigDet
       a) Modify code to use string vector fTrigNames to identify which of the trigger
         trigger detector TDC signals to use for coincidence timing. This
          replaces the hard-coded names. The integer array fTrigId[4] keeps
         track of the array ID in the overall fTDcNames vector that goes
          with the fTrigNames[4]
       b) The fTrigNames must be in order of SHMS ROC1, HMS ROC1, SHMS ROC2
         and HMS ROC2.
       c) Default names are "pTRIG1_ROC1","pTRIG4_ROC1","pTRIG1_ROC2","pTRIG4_ROC2"
          The parameter is t_coin_trigNames
          For example:
          t_coin_trigNames="pTRIG1_ROC1 pTRIG4_ROC1 pTRIG1_ROC2 pTRIG4_ROC2"
          This parameter is read-in and the split into a string vector fTrigNames.
       d) In HcTrigDet::ReadDatabase , all members of fTrigID array are set
    to -1 then a loop over all Tdc in the trigger detector looks for match between
    fTdcNames amd fTrigNames to set fTrigId. If match not found the fTrigId = -1.
       e) In THcTrigDet.h made new method Get_CT_TrigTime(Int_t ii) to be used
    in in THcCoinTime to get the 4 trigger times: SHMS ROC1 (ii=0), HMS ROC1 (ii=1),
    SHMS ROC2 (ii=2) and HMS ROC2 (ii=3).  If fTrigId[ii]=0 then it returns 0
    otherwise returns fTdcTime[fTrigID[ii]].
    
    2) THcCoinTime
      a) Previously used the raw trigger times and had a hard-coded 0.1 ns/channel
    conversion. Now use the trigger times which already are in ns using the
    ns/channel conversion set in the TrigDet.
      b) Now use the new TrgiDet method Get_CT_TrigTime(ii) to get the
    trigger times for SHMS ROC1, HMS ROC1, SHMS ROC2 and HMS ROC2.
THcTrigDet.h 2.35 KiB
#ifndef ROOT_THcTrigDet
#define ROOT_THcTrigDet

#include <string>
#include <vector>

#include "THaDetector.h"
#include "THcHitList.h"

class TDatime;

class THaApparatus;
class THaEvData;


class THcTrigDet : public THaDetector, public THcHitList {
  public:
    THcTrigDet(
      const char* name, const char* description="",
      THaApparatus* app=NULL
    );
    ~THcTrigDet();

    virtual EStatus Init(const TDatime& date);

    virtual void Clear(Option_t* opt="");
    Int_t Decode(const THaEvData& evData);

    virtual void SetSpectName( const char* name);
    virtual void AddEvtType(int evtype);
    virtual void SetEvtType(int evtype);
    virtual Bool_t IsIgnoreType(Int_t evtype) const;
    virtual Bool_t HaveIgnoreList() const;
    Int_t          End(THaRunBase* run);
    //Funtions to get TDCtime for cointime module 
    Double_t Get_CT_Trigtime(Int_t ii) { return (fTrigId[ii]==-1 ? 0. : fTdcTime[fTrigId[ii]]) ;}

  protected:
    void Setup(const char* name, const char* description);
    virtual Int_t ReadDatabase(const TDatime& date);
    virtual Int_t DefineVariables(EMode mode=kDefine);
    


    std::string fKwPrefix;

    Int_t fNumAdc;
    Int_t fNumTdc;
    Int_t fTrigId[4];

    Double_t fAdcTdcOffset;
    Double_t fTdcOffset;
    Double_t fTdcChanperNS;

    std::vector<std::string> fAdcNames;
    std::vector<std::string> fTdcNames;
    std::vector<std::string> fTrigNames;

    static const int fMaxAdcChannels = 200;
    static const int fMaxTdcChannels = 200;

    Int_t fTdcTimeRaw[fMaxTdcChannels];
    Double_t fTdcTime[fMaxTdcChannels];
    Int_t fTDC_RefTimeCut;
    Int_t fADC_RefTimeCut;

    Double_t *fAdcTimeWindowMin;    
    Double_t *fAdcTimeWindowMax;    
    Double_t *fTdcTimeWindowMin;    
    Double_t *fTdcTimeWindowMax;    

    
    Int_t fAdcPedRaw[fMaxAdcChannels];
    Int_t fAdcPulseIntRaw[fMaxAdcChannels];
    Int_t fAdcPulseAmpRaw[fMaxAdcChannels];
    Int_t fAdcPulseTimeRaw[fMaxAdcChannels];

    Double_t fAdcPed[fMaxAdcChannels];
    Double_t fAdcPulseInt[fMaxAdcChannels];
    Double_t fAdcPulseAmp[fMaxAdcChannels];
    Double_t fAdcPulseTime[fMaxAdcChannels];

    Int_t fTdcMultiplicity[fMaxTdcChannels];
    Int_t fAdcMultiplicity[fMaxAdcChannels];

    TString fSpectName;
    std::vector<Int_t> eventtypes;
    Bool_t* fPresentP;

  private:
    THcTrigDet();
    ClassDef(THcTrigDet, 0);
};


#endif  // ROOT_THcTrigDet