MdtDataPreparator.h 5.12 KB
Newer Older
1
2
3
4
5
6
7
/*
  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/

#ifndef  TRIGL2MUONSA_MDTDATAPREPARATOR_H
#define  TRIGL2MUONSA_MDTDATAPREPARATOR_H

8
#include "AthenaBaseComps/AthAlgTool.h"
9
10
#include "GaudiKernel/ServiceHandle.h"

11
#include "MuonCnvToolInterfaces/IMuonRdoToPrepDataTool.h"
12
13
14
15
16
17
#include "MuonCnvToolInterfaces/IMuonRawDataProviderTool.h"
#include "ByteStreamCnvSvcBase/ROBDataProviderSvc.h"
#include "TrigT1Interfaces/RecMuonRoI.h"
#include "RegionSelector/IRegSelSvc.h"
#include "Identifier/IdentifierHash.h"
#include "MuonRDO/MdtCsmContainer.h"
18
#include "TrigSteeringEvent/TrigRoiDescriptor.h"
19

20
21
22
#include "MuonIdHelpers/MuonIdHelperTool.h"
#include "MuonIdHelpers/MdtIdHelper.h"

23
24
25
26
27
28
29
30
#include "TrigL2MuonSA/TgcData.h"
#include "TrigL2MuonSA/MdtData.h"
#include "TrigL2MuonSA/RecMuonRoIUtils.h"
#include "TrigL2MuonSA/MdtRegionDefiner.h"

#include "TrigL2MuonSA/RpcFitResult.h"
#include "TrigL2MuonSA/TgcFitResult.h"

31
32
#include "MuonMDT_Cabling/MuonMDT_CablingSvc.h"

33
class StoreGateSvc;
34
35
36
37
38
39
class MdtIdHelper;
namespace MuonGM{
     class MuonDetectorManager;
     class MdtReadoutElement;
     class MuonStation;
}
40
41
42
43
44
45

// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------

namespace TrigL2MuonSA {
  
46
  class MdtDataPreparator: public AthAlgTool
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
  {
  public:
    
    static const InterfaceID& interfaceID();
    
  public:
    
    MdtDataPreparator(const std::string& type, 
		      const std::string& name,
		      const IInterface*  parent);
    
    ~MdtDataPreparator();
    
    virtual StatusCode initialize();
    virtual StatusCode finalize  ();
    
  public:
    
    StatusCode prepareData(const LVL1::RecMuonRoI*           p_roi,
66
			   const TrigRoiDescriptor*          p_roids,
67
68
69
70
71
72
73
			   const TrigL2MuonSA::RpcFitResult& rpcFitResult,
			   TrigL2MuonSA::MuonRoad&           muonRoad,
			   TrigL2MuonSA::MdtRegion&          mdtRegion,
			   TrigL2MuonSA::MdtHits&            mdtHits_normal,
			   TrigL2MuonSA::MdtHits&            mdtHits_overlap);

    StatusCode prepareData(const LVL1::RecMuonRoI*           p_roi,
74
			   const TrigRoiDescriptor*          p_roids,
75
76
77
78
79
80
			   const TrigL2MuonSA::TgcFitResult& tgcFitResult,
			   TrigL2MuonSA::MuonRoad&           muonRoad,
			   TrigL2MuonSA::MdtRegion&          mdtRegion,
			   TrigL2MuonSA::MdtHits&            mdtHits_normal,
			   TrigL2MuonSA::MdtHits&            mdtHits_overlap);

81
    void setRpcGeometry(bool use_rpc);
82
    void setMdtDataCollection(bool use_mdtcsm);
83
    void setRoIBasedDataAccess(bool use_RoIBasedDataAccess);
84

85
86
87
  public:
    float etaMinChamber[10],etaMaxChamber[10],phiMinChamber[10],phiMaxChamber[10];

88
89
90
  private:
    
    StatusCode getMdtHits(const LVL1::RecMuonRoI* p_roi,
91
			  const TrigRoiDescriptor* p_roids, 
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
			  const TrigL2MuonSA::MdtRegion& mdtRegion,
			  TrigL2MuonSA::MuonRoad& muonRoad,
			  TrigL2MuonSA::MdtHits& mdtHits_normal,
			  TrigL2MuonSA::MdtHits& mdtHits_overlap);

    void getMdtIdHashesBarrel(const TrigL2MuonSA::MdtRegion& mdtRegion,
			std::vector<IdentifierHash>& mdtIdHashes_normal,
			std::vector<IdentifierHash>& mdtIdHashes_overlap);
    
    void getMdtIdHashesEndcap(const TrigL2MuonSA::MdtRegion& mdtRegion,
			std::vector<IdentifierHash>& mdtIdHashes_normal,
			std::vector<IdentifierHash>& mdtIdHashes_overlap);
    
    StatusCode getMdtCsm(const MdtCsmContainer* pMdtCsmContainer,
			 const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& v_robFragments,
			 const std::vector<IdentifierHash>& v_idHash,
			 std::vector<const MdtCsm*>& v_mdtCsms);
    
    bool decodeMdtCsm(const MdtCsm* csm, TrigL2MuonSA::MdtHits& mdtHits, const TrigL2MuonSA::MuonRoad& muonRoad);
    uint32_t get_system_id (unsigned short int SubsystemId) const;
    
113
114
115
116
117
    StatusCode collectMdtHitsFromPrepData(const std::vector<IdentifierHash>& v_idHash,
					  std::vector<uint32_t>& v_robIds,
					  TrigL2MuonSA::MdtHits& mdtHits,
					  const TrigL2MuonSA::MuonRoad& muonRoad);

118
119
    void initDeadChannels(const MuonGM::MdtReadoutElement* mydetEl);

120
121
122
123
  private:

    // Reference to StoreGateSvc;
    ServiceHandle<StoreGateSvc>    m_storeGateSvc;
124
    ActiveStoreSvc* m_activeStore;
125
126
127
128
129
    
    // Tools for the Raw data conversion
    ToolHandle<Muon::IMuonRawDataProviderTool>  m_mdtRawDataProvider;
    
    // Cabling
130
131
132
133
134
135
136
137
    MuonMDT_CablingSvc* m_mdtCabling;
    
    // Geometry Services
    const MuonGM::MuonDetectorManager* m_muonMgr;
    const MuonGM::MdtReadoutElement* m_mdtReadout;
    const MuonGM::MuonStation* m_muonStation;
    const MdtIdHelper* m_mdtIdHelper;
    IdentifierHash hash_id;
138
139
140
141
142
143
144
145
146
    
    // Region Selector
    IRegSelSvc*          m_regionSelector;
    
    // ROB DataProvider
    ROBDataProviderSvc*  m_robDataProvider;
    
    // Utils
    TrigL2MuonSA::RecMuonRoIUtils m_recMuonRoIUtils;
147
   
148
    //
149
    ToolHandle<MdtRegionDefiner>  m_mdtRegionDefiner;
150
151
152
153
154

    // handles to data access
    ToolHandle<Muon::IMuonRdoToPrepDataTool> m_mdtPrepDataProvider;

    bool m_use_mdtcsm;
155
    bool m_use_RoIBasedDataAccess;
156
157
158
    bool m_BMGpresent;
    int  m_BMGid;
    std::map<Identifier, std::vector<Identifier> > m_DeadChannels;
159

160
  };
161

162
163
164
} // namespace TrigL2MuonSA

#endif  //