ATLAS Offline Software
InDetRawDataFakeCreator.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef SRC_INDETRAWDATAFAKECREATOR_H
6 # define SRC_INDETRAWDATAFAKECREATOR_H
7 
33 #include "InDetIdentifier/SCT_ID.h"
34 #include "InDetIdentifier/TRT_ID.h"
35 #include "GaudiKernel/MsgStream.h"
36 
37 
39 {
40 public:
41 
44 
48  const PixelID* pixelId,
49  MsgStream& log);
50 
54  const SCT_ID* sctId,
55  MsgStream& log);
56 
60  const TRT_ID* trtId,
61  MsgStream& log);
62 };
63 
64 
65 
67 {
68 }
69 
70 
73  const PixelID* pixelId,
74  MsgStream& log)
75 {
76 
77  // create a new pixel RDO collection
80 
81  IdContext cntx(pixelId->wafer_context());
82 
83  // need the DE identifier
84  Identifier waferId = pixelId->wafer_id (hashId);
85  rdocoll->setIdentifier(waferId);
86 
87  log << MSG::VERBOSE << "hash, id1, id2: "
88  << MSG::hex << (unsigned int)hashId << MSG::dec << " "
89  << MSG::hex << waferId << MSG::dec << " "
90  << MSG::hex << pixelId->wafer_id(hashId) << MSG::dec << " "
91  << pixelId->show_to_string(waferId) << " "
92  << pixelId->show_to_string(pixelId->wafer_id(hashId)) << " "
93  << endmsg;
94 
95  int deltaPhi = pixelId->phi_index_max(waferId)/6;
96  int deltaEta = pixelId->eta_index_max(waferId)/6;
97  log << MSG::VERBOSE << "phi max, eta max, dphi, deta: "
98  << pixelId->phi_index_max(waferId) << " "
99  << pixelId->eta_index_max(waferId) << " "
100  << deltaPhi << " "
101  << deltaEta << " "
102  << endmsg;
103 
104  int phi = deltaPhi;
105  // loop on 16 digits
106  for (int j = 0; j < 4; ++j, phi += deltaPhi) {
107  int eta = deltaEta;
108  for (int k = 0; k < 4; ++k, eta += deltaEta) {
109 
110  Identifier id_readout = pixelId->pixel_id(waferId, phi, eta);
111  const unsigned int mo = (1 & 0x1F) << 27;
112  const unsigned int fe2 =(1 & 0xF) << 21;
113  const unsigned int row2=(1 & 0xFF) << 13;
114  const unsigned int col2=(1 & 0x1F) << 8;
115  const unsigned int tot =(5 & 0xFF);
116  unsigned int pixelWord = (mo|fe2|row2|col2|tot);
117 
118  Pixel1RawData *rdo= new Pixel1RawData(id_readout, pixelWord);
119  if (rdo) {
120  rdocoll->push_back(rdo);
121 
122  } else {
123  log << MSG::ERROR << "Could not create Pixel1RawData object !"
124  << endmsg;
125  }
126  // Print out contents of RDO
127  log << MSG::VERBOSE << "Created RDO: "
128  << pixelId->show_to_string(rdo->identify()) << " "
129  << MSG::hex << rdo->getWord() << endmsg;
130  }
131  }
132 
133  return (rdocoll);
134 }
135 
138  const SCT_ID* sctId,
139  MsgStream& log)
140 {
141  // create a new sct RDO collection
142  auto * rdocoll = new InDetRawDataCollection< SCT_RDORawData >(hashId);
143  IdContext cntx(sctId->wafer_context());
144  // need the DE identifier
145  Identifier waferId = sctId->wafer_id (hashId);
146  rdocoll->setIdentifier(waferId);
147  const int maxPossibleStrip = sctId->strip_max(waferId);
148  if (maxPossibleStrip<0) { //error condition, if waferId not found
149  delete rdocoll;
150  log << MSG::WARNING <<"waferId unknown in InDetRawDataFakeCreator::createSCT_RawDataColl"<<endmsg;
151  return nullptr;
152  }
153  int deltaStrip = maxPossibleStrip/6;
154  log << MSG::VERBOSE << "strip max, dstrip: "
155  << sctId->strip_max(waferId) << " "
156  << deltaStrip << " "
157  << endmsg;
158 
159  int strip = deltaStrip;
160  // loop on 4 digits
161  for (int j = 0; j < 4; ++j, strip += deltaStrip) {
162 
163  Identifier id_readout = sctId->strip_id(waferId, strip);
164  const unsigned int str =(strip) << 16;
165  const unsigned int group = 4;
166  unsigned int word= (group|str);
167 
168  SCT1_RawData *rdo= new SCT1_RawData(id_readout, word);
169  if (rdo) {
170  rdocoll->push_back(rdo);
171 
172  } else {
173  log << MSG::ERROR << "Could not create SCT1_RawData object !"
174  << endmsg;
175  }
176  // Print out contents of RDO
177  log << MSG::VERBOSE << "Created RDO: "
178  << sctId->show_to_string(rdo->identify()) << " "
179  << MSG::hex << rdo->getWord() << endmsg;
180  }
181 
182  return (rdocoll);
183 }
184 
185 
188  const TRT_ID* trtId,
189  MsgStream& log)
190 {
191  // create a new trt RDO collection
194 
195  IdContext cntx(trtId->straw_layer_context());
196 
197  // need the DE identifier
198  Identifier strLayId = trtId->layer_id (hashId);
199  rdocoll->setIdentifier(strLayId);
200 
201  int deltaStraw = trtId->straw_max(strLayId)/6;
202  log << MSG::VERBOSE << "straw max, dstraw: "
203  << trtId->straw_max(strLayId) << " "
204  << deltaStraw << " "
205  << endmsg;
206 
207  int straw = deltaStraw;
208  // loop on 16 digits
209  for (int j = 0; j < 4; ++j, straw += deltaStraw) {
210 
211  Identifier id_readout = trtId->straw_id(strLayId, straw);
212  unsigned int trtWord= (0xFFFFFFFF);
213 
214  TRT_LoLumRawData *rdo= new TRT_LoLumRawData(id_readout, trtWord);
215  if (rdo) {
216  rdocoll->push_back(rdo);
217 
218  } else {
219  log << MSG::ERROR << "Could not create TRT_LoLumRawData object !"
220  << endmsg;
221  }
222  // Print out contents of RDO
223  log << MSG::VERBOSE << "Created RDO: "
224  << trtId->show_to_string(rdo->identify()) << " "
225  << MSG::hex << rdo->getWord() << endmsg;
226  }
227  return (rdocoll);
228 }
229 
230 
231 
232 #endif // SRC_INDETRAWDATAFAKECREATOR_H
233 
PixelID.h
This is an Identifier helper class for the Pixel subdetector. This class is a factory for creating co...
InDetRawDataFakeCreator
Class which encapsulates the creation of an InDetRawDataCollection.
Definition: InDetRawDataFakeCreator.h:39
TRT_ID::layer_id
Identifier layer_id(int barrel_ec, int phi_module, int layer_or_wheel, int straw_layer) const
For an individual straw layer.
Definition: TRT_ID.h:494
SCT_ID.h
This is an Identifier helper class for the SCT subdetector. This class is a factory for creating comp...
TRT::Hit::straw
@ straw
Definition: HitInfo.h:82
SiliconTech::strip
@ strip
TRT_ID::straw_max
int straw_max(const Identifier &id) const
Definition: TRT_ID.cxx:803
InDetRawDataCollection::setIdentifier
void setIdentifier(Identifier id)
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
TRT_LoLumRawData
Definition: TRT_LoLumRawData.h:25
xAOD::deltaPhi
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap setEtaBin setIsTgcFailure setDeltaPt deltaPhi
Definition: L2StandAloneMuon_v1.cxx:161
TRT_RDO_Collection.h
TRT_ID.h
This is an Identifier helper class for the TRT subdetector. This class is a factory for creating comp...
SCT_ID::wafer_context
IdContext wafer_context() const
Definition: SCT_ID.h:705
PixelID::wafer_id
Identifier wafer_id(int barrel_ec, int layer_disk, int phi_module, int eta_module) const
For a single crystal.
Definition: PixelID.h:360
PixelID::wafer_context
IdContext wafer_context() const
Definition: PixelID.h:586
InDetRawDataFakeCreator::InDetRawDataFakeCreator
InDetRawDataFakeCreator()
Default constructor.
Definition: InDetRawDataFakeCreator.h:66
PixelID::phi_index_max
int phi_index_max(const Identifier &id) const
Definition: PixelID.cxx:143
P4Helpers::deltaEta
double deltaEta(const I4Momentum &p1, const I4Momentum &p2)
Computes efficiently .
Definition: P4Helpers.h:66
PixelRDO_Collection.h
PixelID::eta_index_max
int eta_index_max(const Identifier &id) const
Definition: PixelID.cxx:162
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
python.CaloAddPedShiftConfig.str
str
Definition: CaloAddPedShiftConfig.py:42
InDetRawDataFakeCreator::createSCT_RawDataColl
const InDetRawDataCollection< SCT_RDORawData > * createSCT_RawDataColl(IdentifierHash hashId, const SCT_ID *sctId, MsgStream &log)
Create SCT_RawDataCollection.
Definition: InDetRawDataFakeCreator.h:137
InDetRawDataCollection
Definition: InDetRawDataCollection.h:31
InDetRawDataFakeCreator::createTRT_RawDataColl
const InDetRawDataCollection< TRT_RDORawData > * createTRT_RawDataColl(IdentifierHash hashId, const TRT_ID *trtId, MsgStream &log)
Create TRT_RawDataCollection.
Definition: InDetRawDataFakeCreator.h:187
Pixel1RawData
Definition: Pixel1RawData.h:23
PixelCalibrationConfig.tot
tot
Definition: PixelCalibrationConfig.py:28
TRT_ID::straw_layer_context
IdContext straw_layer_context() const
straw_layer id
Definition: TRT_ID.h:707
SCT_RDO_Collection.h
DataVector< RawDataT >::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
TRT_ID
Definition: TRT_ID.h:82
InDetRawData::getWord
unsigned int getWord() const
Definition: InDetRawData.h:47
CaloLCW_tf.group
group
Definition: CaloLCW_tf.py:28
python.CaloAddPedShiftConfig.int
int
Definition: CaloAddPedShiftConfig.py:45
AtlasDetectorID::show_to_string
std::string show_to_string(Identifier id, const IdContext *context=0, char sep='.') const
or provide the printout in string form
Definition: AtlasDetectorID.cxx:360
SCT_ID
Definition: SCT_ID.h:68
PixelID::pixel_id
Identifier pixel_id(int barrel_ec, int layer_disk, int phi_module, int eta_module, int phi_index, int eta_index) const
For an individual pixel.
Definition: PixelID.h:428
SCT_ID::strip_max
int strip_max(const Identifier &id) const
Definition: SCT_ID.cxx:197
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
SCT1_RawData
Definition: SCT1_RawData.h:27
str
Definition: BTagTrackIpAccessor.cxx:11
InDetRawData::identify
virtual Identifier identify() const override final
Definition: InDetRawData.h:41
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:13
SCT_ID::wafer_id
Identifier wafer_id(int barrel_ec, int layer_disk, int phi_module, int eta_module, int side) const
For a single side of module.
Definition: SCT_ID.h:464
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
PixelID
Definition: PixelID.h:67
IdContext
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition: IdContext.h:26
InDetRawDataFakeCreator::createPixelRawDataColl
const InDetRawDataCollection< PixelRDORawData > * createPixelRawDataColl(IdentifierHash hashId, const PixelID *pixelId, MsgStream &log)
Create PixelRawDataCollection.
Definition: InDetRawDataFakeCreator.h:72
fitman.k
k
Definition: fitman.py:528
TRT_ID::straw_id
Identifier straw_id(int barrel_ec, int phi_module, int layer_or_wheel, int straw_layer, int straw) const
Three ways of getting id for a single straw:
Definition: TRT_ID.h:575
SCT_ID::strip_id
Identifier strip_id(int barrel_ec, int layer_disk, int phi_module, int eta_module, int side, int strip) const
For an individual strip.
Definition: SCT_ID.h:535
Identifier
Definition: IdentifierFieldParser.cxx:14