/data3/calcul/jacquem/working_dir/Micromegas/micromegasFrameWork/include/root/MTEvent.hh

Go to the documentation of this file.
00001 #ifndef ROOT_MTEvent
00002 #define ROOT_MTEvent
00003 
00004 #include "TObject.h"
00005 #include "TClonesArray.h"
00006 #include "TRefArray.h"
00007 #include "TRef.h"
00008 #include "TH1.h"
00009 #include "TMath.h"
00010 #include <vector>
00011 #include <map>
00012 
00013 #include "root/MTChipSoftId.hh"
00014 
00015 
00016 class Event;
00017 class ChannelHit ;
00018 class MTChannel ;
00019 class MTTrack ;
00020 ////////////////////////////////////////////////////////////////////////////////////////
00021 ///     CLASS EVENT (containing Header and MTChannel)
00022 /// - Hardroc + Dirac: 1 evenement == 1 lecture de tous les chips d'une Dif 
00023 /// - Gassiplex : 1 evenement == 1 Trigger PM == 1 ecriture Gassiplex
00024 ///////////////////////////////////////////////////////////////////////////////////////
00025 class MTEvent : public TObject {
00026 
00027 private:
00028    bool fSquareEvt; // default false
00029    bool fBorderEvt; // default false
00030    bool fChipEvt; // default false
00031    bool fTimeInfo; // default false:  ->true si l'info en temps est vrai, c.a.d. si la dernièrer lecture était il y a moins de 3.35 s. sinon false
00032 
00033    UInt_t                   fEventId;
00034    Double32_t               fTemperature;
00035    std::map<UInt_t,Float_t> fTemperatureAsu1;  // Key is difId
00036    std::map<UInt_t,Float_t> fTemperatureAsu2;  // Key is difId
00037    std::map<UInt_t,Float_t> fTemperatureDif;  // Key is difId
00038    Double32_t               fPressure;
00039    ULong64_t                  fDifSynchro;
00040    ULong64_t                fTimestamp;  // millisecond fromn 1 janv 1970
00041    UInt_t                   fGlobalTriggerCounter; // increment at each trigger
00042    UInt_t                   fDifTriggerCounter;    // increment on trigger only if dif store data
00043 
00044    std::map<UInt_t, std::map<UInt_t, UInt_t>* >fNbHitPerAbsTime;   // key is boardId, key is bcId_hit, value is nbHi
00045    // Absolutime is compute as following : bcid_abs - (bcid_dif - bcid_hit)
00046 
00047    Int_t          fNchannel;          //Number of channels hit for this event
00048    TClonesArray  *fChannels;          //->array with all channels
00049    // channels are sorted before being inserted into TClonesArray.
00050    // Thus fChannels[0] will contain highest channel response and fChannels[fChannels.GetSize()-1]
00051    // will contain lowest channel responce
00052 
00053    std::map<UInt_t, std::map<UInt_t, std::map<UInt_t, Float_t>* >* >fMeshVoltage;
00054    std::map<UInt_t, std::map<UInt_t, std::map<UInt_t, Float_t>* >* >fDriftVoltage;
00055 
00056    std::vector<UInt_t> fDtCandidate;
00057 
00058    MTTrack* fTrack;
00059 
00060 
00061 
00062 
00063 
00064    static TClonesArray *fgChannels;
00065 
00066 
00067    bool fCrcIsCorrect;
00068    UInt_t fValid;
00069 
00070 public:
00071    MTEvent();
00072    virtual ~MTEvent();
00073    MTEvent&  operator=( const  Event& rhs) ;
00074    MTEvent&  operator=( const  MTEvent& rhs);
00075 
00076    //MTEvent&      operator=( const  MTEvent& rhs) ;
00077    void          Build(UInt_t evtId,ULong64_t difSynchro, Double32_t  temperature, Double32_t  pressure , ULong64_t  timestamp );
00078    void          SetTrack(MTTrack* aTrack) { fTrack = aTrack;};
00079    MTTrack*      GetTrack(void){  return fTrack;} ;
00080 
00081    bool          GetSquareEvt(void) { return fSquareEvt; } ;
00082    void          SetSquareEvt(bool value){ fSquareEvt = value; } ;
00083    bool          GetBorderEvt(void) { return fBorderEvt; } ;
00084    void          SetBorderEvt(bool value){ fBorderEvt = value; } ;
00085    bool          GetChipEvt(void) { return fChipEvt; } ;
00086    void          SetChipEvt(bool value){ fChipEvt = value; } ;
00087    bool          GetTimeInfo(void) { return fTimeInfo; } ;
00088    void          SetTimeInfo(bool value){ fTimeInfo = value; } ;
00089 
00090    std::vector<UInt_t>& GetDtCandidate() { return fDtCandidate; }
00091 
00092    void          Clear(Option_t *option ="");
00093    static void   Reset(Option_t *option ="");
00094    void          SortChannel() { fChannels->Sort(); };
00095    void SetGlobalTriggerCounter(UInt_t value) { fGlobalTriggerCounter = value; };
00096    void SetDifTriggerCounter(UInt_t value) { fDifTriggerCounter = value; };
00097    UInt_t GetGlobalTriggerCounter(void) const { return fGlobalTriggerCounter; };
00098    UInt_t GetDifTriggerCounter(void) const { return fDifTriggerCounter; };
00099 
00100    void   AddHitForAbsTime(UInt_t boardId,UInt_t abs_time, UInt_t increment); 
00101    UInt_t  GetNbHitPerAbsTime(UInt_t boardId,UInt_t abs_time) const ;
00102    std::map< UInt_t, std::map<UInt_t, UInt_t>* > & GetNbHitPerAbsTime(){ return fNbHitPerAbsTime; };
00103 
00104    bool GetCrcIsCorrect(void) const { return fCrcIsCorrect;} ;
00105    UInt_t  GetValidFlag(void) const { return fValid;} ;
00106    void SetValidFlag(UInt_t  value) { fValid = fValid + value; };
00107    bool IsValid(void);
00108 
00109    void SetCrcIsCorrect(bool value) { fCrcIsCorrect = value; };
00110   bool IsSquare(UInt_t nbPad, UInt_t &asu, UInt_t &abs_time, UInt_t chb); //input : nbPad = threshold where we consider an event "Square"; chb = chamber ID; outputs: asu = the asu where the event is square; abs_time = the abs_time when the event is square
00111   bool IsBorder(UInt_t nbPad, UInt_t &asu, UInt_t &abs_time, UInt_t chb); //input : nbPad = threshold where we consider an event "Border"; chb = chamber ID; outputs: asu = the asu where the event is border; abs_time = the abs_time when the event is border
00112   bool IsChip(UInt_t nbPad, UInt_t &chip, UInt_t &abs_time, UInt_t chb); //input : nbPad = threshold where we consider an event "Chip"; chb = chamber ID; outputs: chip = the chip where the event is chip; abs_time = the abs_time when the event is chip
00113 
00114    void          SetDifSynchro(ULong64_t t) { fDifSynchro = t; };
00115    void          SetTemperature(Double32_t t) { fTemperature = t; };
00116    void          SetPressure(Double32_t t) { fPressure = t; };
00117    void          SetTimestamp(ULong64_t t) { fTimestamp = t; };
00118    void          SetEventId(UInt_t aId) { fEventId = aId; } ;
00119    MTChannel*    AddChannel(const ChannelHit& hit, UInt_t order);
00120    MTChannel*    AddChannel(MTChannel* aChannel) ;
00121 
00122 
00123    UInt_t        GetEventId() const { return fEventId; };
00124    UInt_t        GetId() const { return GetEventId(); };
00125    ULong64_t       GetDifSynchro() const { return fDifSynchro; } ;
00126    UInt_t        GetNchannel() const { return fNchannel; };
00127    void          SetNchannel(Int_t n) ;
00128 
00129    UInt_t        GetNchannel(UInt_t chamberId) const ;
00130    Double32_t    GetTemperature() const { return fTemperature; };
00131    ULong64_t     GetTimestamp() const {return fTimestamp;};           
00132    Double32_t    GetPressure() const { return fPressure; };
00133    TClonesArray* GetChannels() const { return fChannels; };
00134    MTChannel*    GetChannelByOrder(UInt_t order,UInt_t chamberId) const;
00135 
00136    std::map<UInt_t, std::map<UInt_t, std::map<UInt_t, Float_t>* >*  >GetMeshVoltage() const { return fMeshVoltage; };
00137    std::map<UInt_t, std::map<UInt_t, std::map<UInt_t, Float_t>* >*  >GetDriftVoltage() const { return fDriftVoltage; };
00138 
00139    Float_t GetMeshVoltage(const Int_t chamberId,Int_t difId, Int_t boardId) const ;
00140    Float_t GetDriftVoltage(const Int_t chamberId,Int_t difId, Int_t boardId) const ;
00141 
00142    void    SetMeshVoltage(const Int_t chamberId, Int_t difId, Int_t boardId,const Float_t aValue) ;
00143    void    SetDriftVoltage(const Int_t chamberId, Int_t difId, Int_t boardId,const Float_t aValue) ;
00144 
00145    void SetTemperature(UInt_t difId,Float_t asu1, Float_t asu2, Float_t dif);
00146    void SetTemperatureAsu1(UInt_t difId,Float_t asu1);
00147    void SetTemperatureAsu2(UInt_t difId,Float_t asu2);
00148    void SetTemperatureDif(UInt_t difId, Float_t dif);
00149 
00150    Float_t GetTemperatureAsu1( UInt_t difId ) const ;
00151    Float_t GetTemperatureAsu2( UInt_t difId ) const ;
00152    Float_t GetTemperatureDif( UInt_t difId ) const ;
00153 
00154    std::map<UInt_t,Float_t>GetTemperatureAsu1(void) { return fTemperatureAsu1; } ;
00155    std::map<UInt_t,Float_t>GetTemperatureAsu2(void) { return fTemperatureAsu2; } ;
00156    std::map<UInt_t,Float_t>GetTemperatureDif(void)  { return fTemperatureDif; } ;
00157 
00158 
00159 
00160 private:
00161 
00162    ClassDef(MTEvent, 30)  //MTEvent structure
00163 };
00164 
00165 
00166 #endif

Generated on Mon Jun 11 16:55:45 2012 for MicromegasFramework by  doxygen 1.4.7