ATLAS Offline Software
CscRawDataCnv_p1.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "MuonRDO/CscRawData.h"
6 #include "CscRawDataCnv_p1.h"
7 
8 #include "GaudiKernel/GaudiException.h"
9 
10 void
11 CscRawDataCnv_p1::transToPers(const CscRawData* /*trans*/, CscRawData_p1* /*pers*/, MsgStream &)
12 {
13  throw GaudiException("Writing to CscRawData_p1 is not supported ", "CscRawDataCnv_p1::transToPers(...)", StatusCode::FAILURE);
14 }
15 
16 void
17 CscRawDataCnv_p1::persToTrans(const CscRawData_p1* pers, CscRawData* trans, MsgStream &)
18 {
19 
23  unsigned int size = (pers->m_amps).size();
24  std::vector<uint16_t> amps(size);
25  for (unsigned int i=0; i<size; ++i)
26  amps[i] = pers->m_amps[i] + 2048;
27 
28 
30  int stationName = ( ( pers->m_address & 0x00010000) >> 16 ) + 50;
31  int stationEta = ( ((pers->m_address & 0x00001000) >> 12 ) == 0x0) ? -1 : 1;
32  int stationPhi = ( ( pers->m_address & 0x0000E000) >> 13 ) + 1;
33  int chamberLayer = ( ( pers->m_address & 0x00000800) >> 11) + 1;
34  int wireLayer = ( ( pers->m_address & 0x00000600) >> 9) + 1;
35  int measuresPhi = ( ( pers->m_address & 0x00000100) >> 8);
36  int strip = ( pers->m_address & 0x000000FF) + 1; // 1 ~ 48
37 
38  // redefine the ranges
39  uint32_t nameIndex = uint32_t(stationName-50);
40  uint32_t etaIndex = (stationEta == -1) ? 0 : 1;
44  uint32_t chamberIndex = uint32_t (chamberLayer-0);
45  uint32_t layerIndex = uint32_t (wireLayer-1);
46  uint32_t stripType = uint32_t (measuresPhi);
47  uint32_t stripNumber = uint32_t (strip-1); // 0 ~ 47
48 
49 
50  // schema evolution for case a) below https://savannah.cern.ch/bugs/?56002
51  // There can be two cases:
52  // (a) Reco in 15.5.X.Y or after reading RDO made in 15.3.X.Y and before.
53  // (b) both reco and simulation in 15.5.X.Y or after
54  // This is for ATLAS-CSC-XXX tag...
55 
56  if (stationEta==1 && measuresPhi==1) { // for Wheel A phi strips
57  stripNumber = uint32_t(47 - stripNumber); // 0 ~ 47
58  }
59 
60  // build the address
61  uint32_t address = nameIndex << 16 |
62  phiIndex << 13 |
63  etaIndex << 12 |
64  chamberIndex << 11 |
65  layerIndex << 9 |
66  stripType << 8 |
67  stripNumber;
68 
69 
73  uint16_t spuID = 0x0;
74  if ( stripType == 0 ) spuID = static_cast<uint16_t>( nameIndex*5 + layerIndex );
75  else spuID = static_cast<uint16_t>( (nameIndex+1)*5-1 );
76 
77  *trans = CscRawData (amps, address, pers->m_id,
78  spuID, 1);
79 }
80 
Muon::nsw::STGTPSegments::moduleIDBits::stationPhi
constexpr uint8_t stationPhi
station Phi 1 to 8
Definition: NSWSTGTPDecodeBitmaps.h:158
CscRawDataCnv_p1::persToTrans
virtual void persToTrans(const CscRawData_p1 *persObj, CscRawData *transObj, MsgStream &log)
Definition: CscRawDataCnv_p1.cxx:17
SiliconTech::strip
@ strip
CscRawData_p1::m_address
uint32_t m_address
Definition: CscRawData_p1.h:33
dumpTgcDigiDeadChambers.stationName
dictionary stationName
Definition: dumpTgcDigiDeadChambers.py:30
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
CscRawDataCnv_p1::transToPers
virtual void transToPers(const CscRawData *transObj, CscRawData_p1 *persObj, MsgStream &log)
Definition: CscRawDataCnv_p1.cxx:11
CscRawData
CscRawData
Definition: MuonEventAthenaPoolTPCnv.cxx:59
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
lumiFormat.i
int i
Definition: lumiFormat.py:85
CscRawData_p1
Definition: CscRawData_p1.h:19
CscRawDataCnv_p1.h
CscRawData.h
RTTAlgmain.address
address
Definition: RTTAlgmain.py:55
eflowRec::phiIndex
unsigned int phiIndex(float phi, float binsize)
calculate phi index for a given phi
Definition: EtaPhiLUT.cxx:23
CscRawData
Class to hold the electronic output for a single CSC readout channel: n sampling ADC data + the addre...
Definition: CscRawData.h:21
CscRawData_p1::m_id
uint16_t m_id
Definition: CscRawData_p1.h:34
Muon::nsw::STGTPSegments::moduleIDBits::stationEta
constexpr uint8_t stationEta
1 to 3
Definition: NSWSTGTPDecodeBitmaps.h:156
CscRawData_p1::m_amps
std::vector< uint16_t > m_amps
persistent data members
Definition: CscRawData_p1.h:32