ATLAS Offline Software
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
CscThresholdClusterBuilderTool Class Reference

#include <CscThresholdClusterBuilderTool.h>

Inheritance diagram for CscThresholdClusterBuilderTool:
Collaboration diagram for CscThresholdClusterBuilderTool:

Public Types

enum  NoiseOption { rms = 0, sigma, f001 }
 

Public Member Functions

 CscThresholdClusterBuilderTool (const std::string &type, const std::string &aname, const IInterface *)
 
 ~CscThresholdClusterBuilderTool ()
 
StatusCode initialize ()
 AlgTool InterfaceID. More...
 
StatusCode getClusters (std::vector< IdentifierHash > &idVect, std::vector< IdentifierHash > &selectedIdVect, Muon::CscPrepDataContainer *object)
 
StatusCode finalize ()
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Static Public Member Functions

static const InterfaceID & interfaceID ()
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
 
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

int make_clusters (bool measphi, const std::vector< const Muon::CscStripPrepData * > &strips, Muon::CscPrepDataCollection *&collection)
 
StatusCode getClusters (IdentifierHash idVect, std::vector< IdentifierHash > &selectedIdVect)
 
StatusCode getClusters (IdentifierHash idVect, std::vector< IdentifierHash > &selectedIdVect, Muon::CscPrepDataContainer *pclusters)
 
StatusCode getClusters (std::vector< IdentifierHash > &selectedIdVect, Muon::CscPrepDataContainer *pclusters)
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

double m_threshold
 
float m_kFactor
 
std::string m_noiseOptionStr
 
NoiseOption m_noiseOption
 
SG::ReadHandleKey< Muon::CscStripPrepDataContainerm_digit_key
 
ToolHandle< ICscCalibToolm_cscCalibTool
 
ToolHandle< ICscStripFitterm_pstrip_fitter
 
ToolHandle< ICscClusterFitterm_pfitter_def
 
ToolHandle< ICscClusterFitterm_pfitter_prec
 
ToolHandle< ICscClusterFitterm_pfitter_split
 
ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc
 
SG::ReadCondHandleKey< MuonGM::MuonDetectorManagerm_DetectorManagerKey
 retrieve MuonDetectorManager from the conditions store More...
 
bool m_makeNarrowClusterThreeStrips
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

Definition at line 75 of file CscThresholdClusterBuilderTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Member Enumeration Documentation

◆ NoiseOption

Enumerator
rms 
sigma 
f001 

Definition at line 77 of file CscThresholdClusterBuilderTool.h.

77 { rms = 0, sigma, f001 };

Constructor & Destructor Documentation

◆ CscThresholdClusterBuilderTool()

CscThresholdClusterBuilderTool::CscThresholdClusterBuilderTool ( const std::string &  type,
const std::string &  aname,
const IInterface *  parent 
)

Definition at line 69 of file CscThresholdClusterBuilderTool.cxx.

70  :
71  AthAlgTool(type, aname, parent), m_noiseOption(rms), m_digit_key("CSC_Measurements") {
72  declareInterface<ICscClusterBuilder>(this);
73 
74  declareProperty("threshold", m_threshold = 20000.0);
75  declareProperty("kFactor", m_kFactor = 6.5);
76  declareProperty("noiseOption", m_noiseOptionStr = "f001");
77  declareProperty("digit_key", m_digit_key);
78  declareProperty("makeNarrowClusterThreeStrips", m_makeNarrowClusterThreeStrips = true);
79 }

◆ ~CscThresholdClusterBuilderTool()

CscThresholdClusterBuilderTool::~CscThresholdClusterBuilderTool ( )
default

Member Function Documentation

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyArrayType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKeyArray>

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleBase>

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ detStore()

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

95 { return m_detStore; }

◆ evtStore() [1/2]

ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

85 { return m_evtStore; }

◆ evtStore() [2/2]

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( ) const
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase &  ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ finalize()

StatusCode CscThresholdClusterBuilderTool::finalize ( )

Definition at line 347 of file CscThresholdClusterBuilderTool.cxx.

347  {
348  ATH_MSG_VERBOSE("Finalizing " << name());
349  return StatusCode::SUCCESS;
350 }

◆ getClusters() [1/4]

StatusCode CscThresholdClusterBuilderTool::getClusters ( IdentifierHash  idVect,
std::vector< IdentifierHash > &  selectedIdVect 
)
private

◆ getClusters() [2/4]

StatusCode CscThresholdClusterBuilderTool::getClusters ( IdentifierHash  idVect,
std::vector< IdentifierHash > &  selectedIdVect,
Muon::CscPrepDataContainer pclusters 
)
private

Definition at line 164 of file CscThresholdClusterBuilderTool.cxx.

165  {
166  // identifiers of collections already decoded and stored in the container will be skipped
167  if (pclusters->indexFindPtr(givenHashId) != nullptr) {
168  decodedIds.push_back(givenHashId);
169  ATH_MSG_DEBUG("A collection already exists in the container for offline id hash. " << (int)givenHashId);
170  return StatusCode::SUCCESS;
171  }
172 
173  // Retrieve the CSC digits for this event.
175  if (pdigcon.isValid()) {
176  ATH_MSG_DEBUG("Retrieved strip container " << m_digit_key.key() << " with " << pdigcon->size() << " entries.");
177  } else {
178  ATH_MSG_WARNING("Failure to retrieve strip container " << m_digit_key.key());
179  return StatusCode::SUCCESS;
180  }
181 
182  //**********************************************
183  // retrieve specific collection for the givenID
184  const CscStripPrepDataCollection* col = pdigcon->indexFindPtr(givenHashId);
185  if (nullptr == col) {
186  unsigned int coll_hash = givenHashId;
187  ATH_MSG_WARNING("Specific CSC Strip PrepData collection retrieving failed for collection hash = " << coll_hash);
188  return StatusCode::SUCCESS;
189  }
190 
191  ATH_MSG_DEBUG("Retrieved " << col->size() << " CSC Strip PrepDatas.");
192 
193  Identifier colid = col->identify();
194  int istation = m_idHelperSvc->cscIdHelper().stationName(colid) - 49;
195  int zsec = m_idHelperSvc->cscIdHelper().stationEta(colid);
196  int phisec = m_idHelperSvc->cscIdHelper().stationPhi(colid);
197 
198  ATH_MSG_DEBUG(" Strip collection " << chamber(istation, zsec, phisec) << " has " << col->size() << " strips");
199 
200  // Create arrays to hold digits and cathode plane parameters.
201  vector<const CscStripPrepData*> strips[8];
202  int maxstrip[8] = {0, 0, 0, 0, 0, 0, 0, 0};
203 
204  // retrieve MuonDetectorManager from the conditions store
206  const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr();
207  if (MuonDetMgr == nullptr) {
208  ATH_MSG_ERROR("Null pointer to the MuonDetectorManager conditions object");
209  return StatusCode::FAILURE;
210  }
211 
213  // Loop over digits and fill these arrays.
214  for (CscStripPrepDataCollection::const_iterator idig = col->begin(); idig != col->end(); ++idig) {
215  const CscStripPrepData& dig = **idig;
216  Identifier did = dig.identify();
217  hash = dig.collectionHash();
218  const CscReadoutElement* pro = MuonDetMgr->getCscReadoutElement(did);
219  int wlay = m_idHelperSvc->cscIdHelper().wireLayer(did);
220  int measphi = m_idHelperSvc->cscIdHelper().measuresPhi(did);
221  int idx = 2 * (wlay - 1) + measphi;
222  // First entry for a cathode plane, initialize.
223  if (maxstrip[idx] == 0) {
224  maxstrip[idx] = pro->maxNumberOfStrips(measphi);
225  for (int istrip = 0; istrip < maxstrip[idx]; ++istrip) strips[idx].push_back(nullptr);
226  }
227  int istrip = m_idHelperSvc->cscIdHelper().strip(did) - 1;
228  if (istrip < 0 || istrip >= maxstrip[idx]) {
229  ATH_MSG_WARNING("Invalid strip number");
230  continue;
231  }
232  strips[idx][istrip] = &dig;
233  }
234 
235  // Cluster.
236  CscPrepDataCollection* newCollection = nullptr;
237  for (int measphi = 0; measphi < 2; ++measphi) {
238  for (int wlay = 1; wlay < 5; ++wlay) {
239  int idx = 2 * (wlay - 1) + measphi;
240  if (maxstrip[idx]) {
241  make_clusters(measphi, strips[idx], newCollection);
242  ATH_MSG_DEBUG(" " << wlay << "th layer ");
243  }
244  }
245  }
246  if (newCollection) {
247  if (pclusters->addCollection(newCollection, hash).isFailure()) {
248  ATH_MSG_ERROR("Couldn't add CscPrepdataCollection to container!");
249  return StatusCode::RECOVERABLE;
250  }
251  decodedIds.push_back(hash); // Record that this collection contains data
252  }
253 
254  return StatusCode::SUCCESS;
255 }

◆ getClusters() [3/4]

StatusCode CscThresholdClusterBuilderTool::getClusters ( std::vector< IdentifierHash > &  idVect,
std::vector< IdentifierHash > &  selectedIdVect,
Muon::CscPrepDataContainer object 
)
virtual

Implements ICscClusterBuilder.

◆ getClusters() [4/4]

StatusCode CscThresholdClusterBuilderTool::getClusters ( std::vector< IdentifierHash > &  selectedIdVect,
Muon::CscPrepDataContainer pclusters 
)
private

Definition at line 259 of file CscThresholdClusterBuilderTool.cxx.

259  {
260  // Retrieve the CSC digits for this event.
262  if (pdigcon.isValid()) {
263  ATH_MSG_DEBUG("Retrieved strip container " << m_digit_key.key() << " with " << pdigcon->size() << " entries.");
264  } else {
265  ATH_MSG_WARNING("Failure to retrieve strip container " << m_digit_key.key());
266  return StatusCode::SUCCESS;
267  }
268 
269  // Loop over digit collections.
270  // This a loop over chambers (each with 4 wire planes).
271  const CscStripPrepDataContainer& con = *pdigcon;
272  for (CscStripPrepDataContainer::const_iterator icol = con.begin(); icol != con.end(); ++icol) {
274  // check if the collection is already used
275  if (pclusters->indexFindPtr(col.identifyHash()) != nullptr) {
276  // store the identifier hash and continue
277  decodedIds.push_back(col.identifyHash());
278  continue;
279  }
280  Identifier colid = col.identify();
281  int istation = m_idHelperSvc->cscIdHelper().stationName(colid) - 49;
282  int zsec = m_idHelperSvc->cscIdHelper().stationEta(colid);
283  int phisec = m_idHelperSvc->cscIdHelper().stationPhi(colid);
284  ATH_MSG_DEBUG("**Strip collection " << chamber(istation, zsec, phisec) << " sector " << m_idHelperSvc->cscIdHelper().sector(colid)
285  << " has " << col.size() << " strips");
286 
287  // Create arrays to hold digits and cathode plane parameters.
288  vector<const CscStripPrepData*> strips[8];
289  int maxstrip[8] = {0, 0, 0, 0, 0, 0, 0, 0};
290 
291  // retrieve MuonDetectorManager from the conditions store
293  const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr();
294  if (MuonDetMgr == nullptr) {
295  ATH_MSG_ERROR("Null pointer to the MuonDetectorManager conditions object");
296  return StatusCode::FAILURE;
297  }
298 
300  // Loop over digits and fill these arrays.
301  for (CscStripPrepDataCollection::const_iterator idig = col.begin(); idig != col.end(); ++idig) {
302  const CscStripPrepData& dig = **idig;
303  Identifier did = dig.identify();
304  hash = dig.collectionHash();
305  const CscReadoutElement* pro = MuonDetMgr->getCscReadoutElement(did);
306  int wlay = m_idHelperSvc->cscIdHelper().wireLayer(did);
307  int measphi = m_idHelperSvc->cscIdHelper().measuresPhi(did);
308  int idx = 2 * (wlay - 1) + measphi;
309  // First entry for a cathode plane, initialize.
310  if (maxstrip[idx] == 0) {
311  maxstrip[idx] = pro->maxNumberOfStrips(measphi);
312  for (int istrip = 0; istrip < maxstrip[idx]; ++istrip) strips[idx].push_back(nullptr);
313  }
314  int istrip = m_idHelperSvc->cscIdHelper().strip(did) - 1;
315  if (istrip < 0 || istrip >= maxstrip[idx]) {
316  ATH_MSG_WARNING("Invalid strip number");
317  continue;
318  }
319  strips[idx][istrip] = &dig;
320  }
321 
322  // Cluster.
323  CscPrepDataCollection* newCollection = nullptr;
324  for (int measphi = 0; measphi < 2; ++measphi) {
325  for (int wlay = 1; wlay < 5; ++wlay) {
326  int idx = 2 * (wlay - 1) + measphi;
327  if (maxstrip[idx]) {
328  ATH_MSG_DEBUG("*** " << chamber(istation, zsec, phisec) << " sector " << m_idHelperSvc->cscIdHelper().sector(colid)
329  << " " << wlay << "th layer ");
330  make_clusters(measphi, strips[idx], newCollection);
331  }
332  }
333  }
334  if (newCollection) {
335  if (pclusters->addCollection(newCollection, hash).isFailure()) {
336  ATH_MSG_ERROR("Couldn't add CscPrepdataCollection to container!");
337  return StatusCode::FAILURE;
338  }
339  decodedIds.push_back(hash); // Record that this collection contains data
340  }
341  } // end loop over chambers
342 
343  return StatusCode::SUCCESS;
344 }

◆ initialize()

StatusCode CscThresholdClusterBuilderTool::initialize ( )

AlgTool InterfaceID.

Definition at line 89 of file CscThresholdClusterBuilderTool.cxx.

89  {
90  // Display algorithm properties.
91  ATH_MSG_DEBUG("Properties for " << name() << ":");
92  ATH_MSG_DEBUG(" Strip threshold is Max( " << m_threshold << ", " << m_kFactor << "*stripNoise ) where stripNoise is from "
93  << m_noiseOptionStr);
94  ATH_CHECK(m_digit_key.initialize());
95  if (m_noiseOptionStr != "rms" && m_noiseOptionStr != "sigma" && m_noiseOptionStr != "f001") {
96  ATH_MSG_DEBUG(" noiseOption is not among rms/sigma/f001. rms is used for default!!");
97  m_noiseOptionStr = "rms";
98  }
99  if (m_noiseOptionStr == "rms")
100  m_noiseOption = rms;
101  else if (m_noiseOptionStr == "sigma")
103  else if (m_noiseOptionStr == "f001")
105 
106  ATH_MSG_DEBUG(" Strip fitter is " << m_pstrip_fitter.typeAndName());
107  ATH_MSG_DEBUG(" Default cluster fitter is " << m_pfitter_def.typeAndName());
108  ATH_MSG_DEBUG(" Precision cluster fitter is " << m_pfitter_prec.typeAndName());
109  ATH_MSG_DEBUG(" Split cluster fitter is " << m_pfitter_split.typeAndName());
110  ATH_MSG_DEBUG(" Input digit key is " << m_digit_key.key());
111 
112  // CSC calibratin tool for the Condtiions Data base access //
114 
115  // Retrieve the strip fitting tool.
117  ATH_MSG_DEBUG("Retrieved strip fitting tool " << m_pstrip_fitter);
118 
119  // Retrieve the default cluster fitting tool.
121  ATH_MSG_DEBUG("Retrieved CSC default cluster fitting tool");
122 
123  // Retrieve the precision cluster fitting tool.
125  ATH_MSG_DEBUG("Retrieved CSC precision cluster fitting tool");
126 
127  // Retrieve the split cluster fitting tool.
129  ATH_MSG_DEBUG("Retrieved CSC split cluster fitting tool");
130 
131  // retrieve MuonDetectorManager from the conditions store
133  ATH_CHECK(m_idHelperSvc.retrieve());
134 
135  return StatusCode::SUCCESS;
136 }

◆ inputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interfaceID()

static const InterfaceID& ICscClusterBuilder::interfaceID ( )
inlinestaticinherited

Must declare this, with name of interface

Definition at line 30 of file ICscClusterBuilder.h.

30  {
32  static const InterfaceID IID_ICscClusterBuilder("ICscClusterBuilder", 1, 0);
33  return IID_ICscClusterBuilder;
34  }

◆ make_clusters()

int CscThresholdClusterBuilderTool::make_clusters ( bool  measphi,
const std::vector< const Muon::CscStripPrepData * > &  strips,
Muon::CscPrepDataCollection *&  collection 
)
private

Make every cluster have three strips ///////////////////////////////////////////

Definition at line 364 of file CscThresholdClusterBuilderTool.cxx.

365  {
366  // Loop over channels.
367  unsigned int maxstrip = strips.size();
368 
369  ATH_MSG_DEBUG(" Clustering for " << setaphi(measphi) << " plane with " << maxstrip << " strips");
370 
372  // Phase I:
373  //
374  // Loop over strips and fetch the charge and time for each.
375  // Also set flag indicating if this strip has pointer and charge is above threshold(active)
377  ICscClusterFitter::StripFitList allStripfits;
378  std::vector<bool> astrip; // check active strip
379  std::vector<bool> bstrip; // check bad strip
380  IdentifierHash cscHashId;
381 
382  // Always [0, 191] or [0, 47]
383  for (unsigned int istrip = 0; istrip < strips.size(); ++istrip) {
384  const CscStripPrepData* pstrip = strips[istrip];
386  bool active = false;
387  bool isBadChannel = false;
388  if (pstrip) {
389  if (!newCollection) {
390  Identifier elementId = m_idHelperSvc->cscIdHelper().elementID(pstrip->identify());
391  cscHashId = pstrip->collectionHash();
392  newCollection = new CscPrepDataCollection(cscHashId);
393  newCollection->setIdentifier(elementId);
394  }
395  res = m_pstrip_fitter->fit(*pstrip);
396 
397  IdentifierHash stripHash;
398  Identifier stripId = pstrip->identify();
399  if (m_idHelperSvc->cscIdHelper().get_channel_hash(stripId, stripHash)) {
400  ATH_MSG_WARNING("Unable to get CSC striphash id "
401  << " the identifier is ");
402  stripId.show();
403  }
404 
405  if (res.stripStatus == Muon::CscStrStatHot || res.stripStatus == Muon::CscStrStatDead) isBadChannel = true;
406 
407  float stripNoise = 0;
408  if (m_noiseOption == rms) {
409  stripNoise = m_cscCalibTool->stripRMS(stripHash);
410  } else if (m_noiseOption == sigma) {
411  stripNoise = m_cscCalibTool->stripNoise(stripHash);
412  } else if (m_noiseOption == f001) { // f001 is rawADC +1
413  stripNoise = m_cscCalibTool->stripF001(stripHash) - m_cscCalibTool->stripPedestal(stripHash);
414  stripNoise /= 3.251;
415  }
416 
417  active = res.charge >= m_threshold && res.charge >= m_kFactor * stripNoise;
418  if (isBadChannel) active = false; // Let's remove Bad channel First...
419 
420  if (msgLvl(MSG::DEBUG)) {
421  // Log message.
422  ostringstream strlog;
423  strlog << " Strip " << setw(3) << istrip + 1 << ": charge= " << setw(7) << int(res.charge) << " dcharge= " << setw(7)
424  << int(res.dcharge);
425  if (std::fabs(res.time) < 1e8)
426  strlog << " time=" << setw(3) << int(res.time + 0.5);
427  else
428  strlog << " time=OVERFLOW";
429  if (active)
430  strlog << " *";
431  else if (isBadChannel)
432  strlog << " b";
433  else
434  strlog << " .";
435  if (res.status)
436  strlog << " x";
437  else
438  strlog << " o";
439  strlog << " :" << res.status;
440  ATH_MSG_DEBUG(strlog.str());
441  }
442  }
443  allStripfits.push_back(res);
444  astrip.push_back(active);
445  bstrip.push_back(isBadChannel);
446  }
447 
449  // Phase II:
450  //
451  // Bad Channel recovery in case of strip above strip being nearby
453 
454  // 1. identify strips to recover
455  std::vector<bool> rstrip; // check recover strip
456  bool IsAnyStripRecovered = false;
457  for (unsigned int istrip = 0; istrip < strips.size(); ++istrip) {
458  bool adjacentActive = false;
459  if (bstrip[istrip]) {
460  if (istrip > 0 && astrip[istrip - 1]) adjacentActive = true;
461  if (istrip + 1 < strips.size() && astrip[istrip + 1]) adjacentActive = true;
462  if (adjacentActive) IsAnyStripRecovered = true;
463  }
464  rstrip.push_back(adjacentActive);
465  }
466 
467  // 2. make it active if strip to recover is not active
468  if (IsAnyStripRecovered) { // This loop is needed if there is any bad strip recovered because of adjacent active strip
469 
470  if (msgLvl(MSG::DEBUG)) {
471  ostringstream checklog1;
472  ostringstream checklog2;
473 
474  for (unsigned int istrip = 0; istrip < strips.size(); ++istrip) {
475  if (istrip % 24 == 0) checklog1 << "\n";
476  checklog1 << int(astrip[istrip]) << " ";
477 
478  if (!astrip[istrip] && rstrip[istrip]) { // not active but bad strip with adjacent strip active
479  ATH_MSG_DEBUG("**** Strip " << istrip << " is recovered!!");
480  }
481  if (istrip % 24 == 0) checklog2 << "\n";
482  checklog2 << int(astrip[istrip]) << " ";
483  }
484  ATH_MSG_DEBUG("Strip active map before and after");
485  ATH_MSG_DEBUG(checklog1.str());
486  ATH_MSG_DEBUG(checklog2.str());
487  }
488 
489  for (unsigned int istrip = 0; istrip < strips.size(); ++istrip) {
490  if (!astrip[istrip] && rstrip[istrip]) { // not active but bad strip with adjacent strip active
491  astrip[istrip] = rstrip[istrip]; // insert true
492  }
493  }
494  }
496  // Phase III:
497  //
498  // Find clusters : save first strip and nstrip
500  vector<unsigned int> strip0s;
501  vector<unsigned int> nstrips;
502 
503  // Loop over strips and create clusters.
504  int nstrip = 0;
505  int first_strip = 0; // First strip in the cluster.
506  bool incluster = false;
507  for (unsigned int istrip = 0; istrip < strips.size(); ++istrip) {
508  // If the current strip is not active, skip it.
509  if (!astrip[istrip]) continue;
510  assert(strips[istrip] != 0); // CscStripPrepData* pstrip = strips[istrip];
511 
512  if (!incluster) {
513  incluster = true;
514  nstrip = 0;
515  first_strip = istrip;
516  }
517  ++nstrip;
518 
519  // If this is not the last strip in the plane, and the next
520  // strip is active, add the next strip to the cluster.
521  if (istrip != maxstrip - 1 && astrip[istrip + 1]) continue;
522 
523  // Recover narrow cluster
524  if (!measphi && nstrip < 3) {
525  bool collectLeftStrip = false;
526  bool collectRightStrip = false;
527 
528  if (nstrip == 1) {
529  if (int(istrip) >= nstrip // left adjacent strip should be inside of CSC chamber >0
530  && istrip + 1 < maxstrip // the other side strip should be available < 192
531  && (allStripfits[istrip - 1].charge > 0.1 && allStripfits[istrip + 1].charge > 0.1) // charge should be positive
532  && strips[istrip - 1] && strips[istrip + 1]) { // both adjacent strip identifier should exist
533  collectLeftStrip = true;
534  collectRightStrip = true;
535  }
536  } else if (nstrip == 2) {
537  if (allStripfits[istrip - 1].charge > allStripfits[istrip].charge) { // In case of left strip not fired
538  if (int(istrip) >= nstrip // nstrip 2
539  && allStripfits[istrip - 2].charge > 0.1 // charge should be positive
540  && strips[istrip - 2]) // left strip Identifier should exist
541  collectLeftStrip = true;
542  } else { // In case of right strip not fired
543  if (istrip + 1 < maxstrip &&
544  allStripfits[istrip + 1].charge > 0.1 // charge should be positive if 0, then 0.341E-134 will enter
545  && strips[istrip + 1]) // right strip Identifier should exist
546  collectRightStrip = true;
547  }
548  }
549 
550  if (collectLeftStrip) {
551  first_strip = first_strip - 1;
552  nstrip += 1;
553  }
554  if (collectRightStrip) { nstrip += 1; }
555 
556  if (msgLvl(MSG::DEBUG)) {
557  // Log message.
558  ostringstream narrowlog;
559  narrowlog << " ** narrow Clusters " << first_strip + 1 << " " << nstrip << " L:R " << collectLeftStrip << " "
560  << collectRightStrip;
561  for (int i = 0; i < nstrip; ++i) { narrowlog << " " << allStripfits[first_strip + i].charge; }
562  for (int i = 0; i < nstrip; ++i) { narrowlog << " " << strips[first_strip + i]; }
563  ATH_MSG_DEBUG(narrowlog.str());
564  }
565  } // Only for eta plane nstrip <3
566 
567  strip0s.push_back(first_strip);
568  nstrips.push_back(nstrip);
569 
570  // Reset incluster.
571  incluster = false;
572  }
573 
575  // Phase IV:
576  //
577  // Merge narrow cluster into adjacent cluster if any exists.
578  // Only for eta strips...
580  vector<unsigned int> newStrip0s;
581  vector<unsigned int> newNstrips;
582 
583  int nMerged = 0; // the difference b/w old Nclu and new Nclu
584  for (unsigned int icl = 0; icl < nstrips.size(); ++icl) {
585  unsigned int nstrip = nstrips[icl];
586  unsigned int strip0 = strip0s[icl];
587 
588  ATH_MSG_VERBOSE(" " << icl << "th cluster merger " << strip0 << " " << nstrip);
589 
590  //#### if you find narrow cluster
591  if (!measphi) {
592  if (nstrip < 3) {
593  // at least one cluster before to check left cluster and continuous
594  if (icl > 0 && (strip0 == strip0s[icl - 1] + nstrips[icl - 1])) {
595  unsigned int newStrip0 = strip0s[icl - 1];
596  unsigned int newNstrip = nstrips[icl - 1] + nstrip;
597 
598  ATH_MSG_DEBUG(" " << icl << " ** narrow Cluster merger Type I" << newStrip0 << " " << newNstrip);
599 
600  newStrip0s[icl - 1 - nMerged] = newStrip0;
601  newNstrips[icl - 1 - nMerged] = newNstrip;
602  ++nMerged;
603  continue;
604  }
605  // at least one cluster after to check right cluster and continuous
606  if (icl + 1 < nstrips.size() && (strip0 + nstrip == strip0s[icl + 1])) {
607  unsigned int newStrip0 = strip0;
608  unsigned int newNstrip = nstrip + nstrips[icl + 1];
609 
610  ATH_MSG_DEBUG(" " << icl << " ** narrow Cluster merger Type II" << newStrip0 << " " << newNstrip);
611 
612  newStrip0s.push_back(newStrip0);
613  newNstrips.push_back(newNstrip);
614 
615  icl += 1;
616  ++nMerged;
617  continue;
618  }
619  }
620  } // !measphi
621  // if nstrip >2 OR
622  // still narrow strip then just keep it...
623  newStrip0s.push_back(strip0);
624  newNstrips.push_back(nstrip);
625  } // for
626 
627  if (strip0s.size() != newStrip0s.size()) {
628  ATH_MSG_DEBUG(" Phase II -> III Merged " << strip0s.size() << ":" << nstrips.size() << " " << newStrip0s.size() << ":"
629  << newNstrips.size());
630  for (unsigned int icl = 0; icl < nstrips.size(); ++icl)
631  ATH_MSG_DEBUG(" *** " << icl << " [" << strip0s[icl] << "," << strip0s[icl] + nstrips[icl] - 1 << "] " << nstrips[icl]);
632  for (unsigned int icl = 0; icl < newNstrips.size(); ++icl)
633  ATH_MSG_DEBUG(" ****** " << icl << " [" << newStrip0s[icl] << "," << newStrip0s[icl] + newNstrips[icl] - 1 << "] "
634  << newNstrips[icl]);
635  }
636 
638  // Phase V:
639  //
640  // Using strip0 and nstrip fill up collection
642 
644  std::vector<const CscStripPrepData*> clusterStrips;
645  clusterStrips.reserve(50);
646  std::vector<Identifier> prd_digit_ids;
647  prd_digit_ids.reserve(50);
648 
649  for (unsigned int icl = 0; icl < newNstrips.size(); ++icl) { // for each cluster
650 
651  ATH_MSG_VERBOSE(" Creating " << icl << "th cluster");
652 
653  unsigned int nstrip = newNstrips[icl]; // only used here
654  unsigned int strip0 = newStrip0s[icl]; // only used here
655 
656  sfits.clear();
657  clusterStrips.clear();
658  prd_digit_ids.clear();
659 
660  for (unsigned int ist = strip0; ist < strip0 + nstrip; ++ist) {
661  const CscStripPrepData* pstrip = strips[ist];
662  const ICscClusterFitter::StripFit& sfit = allStripfits[ist];
663 
664  sfits.push_back(sfit);
665  clusterStrips.push_back(pstrip);
666  prd_digit_ids.push_back(pstrip->identify());
667  }
668 
669  ATH_MSG_VERBOSE(" ++++++++++++++ nstrip +++++ " << nstrip);
671  if (nstrip < 3 && m_makeNarrowClusterThreeStrips) {
675 
676  bool leftToFill = false;
677  bool rightToFill = false;
678  if (nstrip == 1) {
679  leftToFill = true;
680  rightToFill = true;
681  } else {
682  if (sfits[0].charge > sfits[1].charge) {
683  leftToFill = true;
684  } else if (sfits[0].charge < sfits[1].charge) {
685  rightToFill = true;
686  } else {
687  ATH_MSG_DEBUG(" It should be CHECKED!!! ");
688  if (strip0 > 0) {
689  if (strips[strip0 - 1]) {
690  leftToFill = true;
691  } else if (strips[strip0 + 2]) {
692  rightToFill = true;
693  }
694  } else if (strips[strip0 + 2]) {
695  rightToFill = true;
696  }
697  }
698  }
699 
700  ATH_MSG_VERBOSE(" strip0 nstrip filling left or right " << strip0 << " " << nstrip << " " << leftToFill << " "
701  << rightToFill);
702  ATH_MSG_VERBOSE(" sfits[0] " << sfits[0].charge);
703  if (nstrip == 2) ATH_MSG_VERBOSE(" sfits[1] " << sfits[1].charge);
704 
705  for (unsigned int i = 0; i < allStripfits.size(); ++i) { ATH_MSG_VERBOSE("index " << i << " " << allStripfits[i].charge); }
706 
707  if (leftToFill) {
708  // ATH_MSG_DEBUG( " Left to fill " << allStripfits[strip0-1].charge);
709  bool fillTheOtherSide = false;
710  if (strip0 == 0) {
711  fillTheOtherSide = true;
712  } else {
713  if (strips[strip0 - 1] == nullptr) fillTheOtherSide = true;
714  }
715 
716  if (strip0 + nstrip >= allStripfits.size()) { fillTheOtherSide = false; }
717 
718  if (!fillTheOtherSide) {
719  if (strips[strip0 - 1]) {
720  sfits.insert(sfits.begin(), allStripfits[strip0 - 1]);
721  clusterStrips.insert(clusterStrips.begin(), strips[strip0 - 1]);
722  prd_digit_ids.insert(prd_digit_ids.begin(), strips[strip0 - 1]->identify());
723  strip0--;
724  nstrip = prd_digit_ids.size();
725  }
726  } else {
727  if (strips[strip0 + nstrip]) { // for edge this can happen
728  sfits.push_back(allStripfits[strip0 + nstrip]); // This is the case for example
729  // 12799.6 39183.9 39698
730  clusterStrips.push_back(strips[strip0 + nstrip]);
731  prd_digit_ids.push_back(strips[strip0 + nstrip]->identify());
732  nstrip = prd_digit_ids.size();
733  }
734  }
735  }
736 
737  if (rightToFill) {
738  bool fillTheOtherSide = false;
739  if (strip0 + nstrip >= allStripfits.size()) {
740  fillTheOtherSide = true;
741  } else {
742  if (strips[strip0 + nstrip] == nullptr) fillTheOtherSide = true;
743  }
744 
745  if (strip0 == 0) { fillTheOtherSide = false; }
746 
747  if (!fillTheOtherSide) {
748  if (strips[strip0 + nstrip]) {
749  sfits.push_back(allStripfits[strip0 + nstrip]);
750  clusterStrips.push_back(strips[strip0 + nstrip]);
751  prd_digit_ids.push_back(strips[strip0 + nstrip]->identify());
752  nstrip = prd_digit_ids.size();
753  }
754  } else {
755  if (strips[strip0 - 1]) { // for edge this can happen
756  sfits.insert(sfits.begin(), allStripfits[strip0 - 1]);
757  clusterStrips.insert(clusterStrips.begin(), strips[strip0 - 1]);
758  prd_digit_ids.insert(prd_digit_ids.begin(), strips[strip0 - 1]->identify());
759  strip0--;
760  nstrip = prd_digit_ids.size();
761  }
762  }
763  }
764  }
766 
767  int fitresult = 99;
768  std::vector<ICscClusterFitter::Result> results;
769 
770  // Precision fit.
771  if (!measphi) {
772  results = m_pfitter_prec->fit(sfits);
773  fitresult = results[0].fitStatus;
774  ATH_MSG_VERBOSE(" Performing precision fit " << m_pfitter_prec << " result return=" << fitresult);
775 
776  // in case of multipeak cluster
777  if (fitresult == 6) {
778  results = m_pfitter_split->fit(sfits);
779  fitresult = results[0].fitStatus;
780  for (unsigned int i = 0; i < results.size(); ++i)
781  ATH_MSG_VERBOSE(" Performing split fit with " << m_pfitter_split << " result return=" << results[i].fitStatus);
782  }
783  }
784 
785  bool precisionFitFailed = fitresult > 0 && fitresult < 20; // splitclusterFit fail => 19
786  // Default fit for phi and eta failed
787  if (measphi || precisionFitFailed) {
789  CscClusterStatus oldclustatus;
790  if (!measphi) {
791  res = results[0];
792  oldclustatus = res.clusterStatus;
793  } else {
794  oldclustatus = Muon::CscStatusSimple;
795  }
796  results = m_pfitter_def->fit(sfits);
797  if (!results.empty()) {
798  res = results[0];
799  fitresult = results[0].fitStatus;
800  if (msgLvl(MSG::VERBOSE)) {
801  ostringstream deflog;
802  deflog << " Performing default fit with " << m_pfitter_def;
803  if (fitresult) {
804  deflog << " failed: return=" << fitresult;
805  } else {
806  deflog << " succeeded";
807  }
808  ATH_MSG_VERBOSE(deflog.str());
809  }
810  // Keep the status from the first fit if it is defined.
811  if (oldclustatus != Muon::CscStatusUndefined) {
812  res.clusterStatus = oldclustatus;
813  // we want to keep oldcluster status
814  results[0] = res;
815  }
816  }
817  }
818 
820  //
821  // Phase V. For multiple results, fill up collection
822  //
824  unsigned int nresults = results.size();
825  for (unsigned int ire = 0; ire < nresults; ++ire) {
826  CscClusterStatus clustatus = results[ire].clusterStatus;
827  Muon::CscTimeStatus timeStatus = results[ire].timeStatus;
828  double pos = results[ire].position;
829  double err = results[ire].dposition;
830  unsigned int id_strip = results[ire].strip; // return peak strip index (unsigned integer)
831  double cluster_charge = results[ire].charge;
832  double cluster_time = results[ire].time;
833  if (clustatus == Muon::CscStatusUndefined) ATH_MSG_DEBUG(" Csc Cluster Status is not defined.");
834 
835  if (id_strip >= sfits.size()) {
836  ATH_MSG_WARNING(" Fit size check failed: ");
837  continue;
838  }
839  // Fetch the strip used to identify this cluster.
840  const CscStripPrepData* pstrip_id = nullptr;
841  if (id_strip < clusterStrips.size()) pstrip_id = clusterStrips[id_strip];
842  if (!pstrip_id) {
843  ATH_MSG_WARNING(" Fit ID check failed: ");
844  continue;
845  }
846 
847  // Create ATLAS CSC cluster.
848  Identifier cluster_id = pstrip_id->identify();
849  IdentifierHash cluster_hash = pstrip_id->collectionHash();
850  int zsec = m_idHelperSvc->cscIdHelper().stationEta(cluster_id);
851  int wlay = m_idHelperSvc->cscIdHelper().wireLayer(cluster_id);
852  // This local position is in the muon (not tracking) coordinate system.
853  // retrieve MuonDetectorManager from the conditions store
855  const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr();
856  if (MuonDetMgr == nullptr) {
857  ATH_MSG_ERROR("Null pointer to the MuonDetectorManager conditions object");
858  return 0;
859  }
860  const CscReadoutElement* pro = MuonDetMgr->getCscReadoutElement(cluster_id);
861  // Amg::Vector3D local_pos = pro->localClusterPos(zsec, wlay, measphi, pos);
862  Amg::Vector3D localTrk_pos = pro->nominalLocalClusterPos(zsec, wlay, measphi, pos);
863 
864  auto cov = Amg::MatrixX(1, 1);
865  (cov)(0, 0) = err * err;
866  Amg::Vector2D plpos(measphi ? localTrk_pos.y() : localTrk_pos.z(), measphi ? localTrk_pos.z() : localTrk_pos.y());
867  if (msgLvl(MSG::DEBUG)) {
868  ATH_MSG_DEBUG(" Cluster parameters: " << nresults);
869  ATH_MSG_DEBUG(" ID strip: " << first_strip + id_strip << "(" << first_strip << ":" << id_strip << ")");
870  ATH_MSG_DEBUG(" local position: " << plpos.x() << " " << plpos.y() << " error: " << Amg::toString(cov));
871  ATH_MSG_DEBUG(" charge: " << cluster_charge);
872  ATH_MSG_DEBUG(" time: " << cluster_time);
873  ATH_MSG_DEBUG(" status: " << Muon::toString(clustatus));
874  }
875  unsigned int fstrip = results[ire].fstrip;
876  unsigned int lstrip = results[ire].lstrip;
877  std::vector<Identifier> prd_digit_ids_submit;
878  for (unsigned int ids_index = fstrip; ids_index < lstrip + 1; ++ids_index) {
879  if (ids_index >= prd_digit_ids.size()) {
880  ATH_MSG_WARNING("index out of range " << ids_index << " size " << prd_digit_ids.size());
881  continue;
882  }
883  prd_digit_ids_submit.push_back(prd_digit_ids[ids_index]);
884  }
885  unsigned int nstrip = prd_digit_ids_submit.size();
886  ATH_MSG_DEBUG(" size: " << nstrip << " " << sfits.size());
887  ATH_MSG_DEBUG(" all size: " << strips.size() << " " << allStripfits.size());
888 
889  // allStripfits.push_back(res);
890 
891  CscPrepData* pclus = new CscPrepData(cluster_id,
892  cluster_hash,
893  plpos,
894  prd_digit_ids_submit,
895  cov,
896  pro,
897  int(cluster_charge + 0.5),
898  cluster_time,
899  clustatus,
900  timeStatus);
901  pclus->setHashAndIndex(newCollection->identifyHash(),
902  newCollection->size());
903 
904  newCollection->push_back(pclus);
905  }
906  } // end loop over clusters
907 
908  return 0;
909 }

◆ msg() [1/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24  {
25  return this->msgStream();
26  }

◆ msg() [2/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30  {
31  return this->msgLevel(lvl);
32  }

◆ outputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t<std::is_void_v<std::result_of_t<decltype(&T::renounce)(T)> > && !std::is_base_of_v<SG::VarHandleKeyArray, T> && std::is_base_of_v<Gaudi::DataHandle, T>, void> AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T &  h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381  {
382  h.renounce();
383  PBASE::renounce (h);
384  }

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364  {
365  handlesArray.renounce();
366  }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in DerivationFramework::CfAthAlgTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and asg::AsgMetadataTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase &  )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308  {
309  // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310  // << " size: " << m_vhka.size() << endmsg;
311  for (auto &a : m_vhka) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_cscCalibTool

ToolHandle<ICscCalibTool> CscThresholdClusterBuilderTool::m_cscCalibTool
private
Initial value:
{
this,
"cscCalibTool",
"CscCalibTool/CscCalibTool",
}

Definition at line 118 of file CscThresholdClusterBuilderTool.h.

◆ m_DetectorManagerKey

SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> CscThresholdClusterBuilderTool::m_DetectorManagerKey
private
Initial value:
{
this,
"DetectorManagerKey",
"MuonDetectorManager",
"Key of input MuonDetectorManager condition data",
}

retrieve MuonDetectorManager from the conditions store

Definition at line 155 of file CscThresholdClusterBuilderTool.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_digit_key

SG::ReadHandleKey<Muon::CscStripPrepDataContainer> CscThresholdClusterBuilderTool::m_digit_key
private

Definition at line 115 of file CscThresholdClusterBuilderTool.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_idHelperSvc

ServiceHandle<Muon::IMuonIdHelperSvc> CscThresholdClusterBuilderTool::m_idHelperSvc
private
Initial value:
{
this,
"MuonIdHelperSvc",
"Muon::MuonIdHelperSvc/MuonIdHelperSvc",
}

Definition at line 148 of file CscThresholdClusterBuilderTool.h.

◆ m_kFactor

float CscThresholdClusterBuilderTool::m_kFactor
private

Definition at line 112 of file CscThresholdClusterBuilderTool.h.

◆ m_makeNarrowClusterThreeStrips

bool CscThresholdClusterBuilderTool::m_makeNarrowClusterThreeStrips
private

Definition at line 162 of file CscThresholdClusterBuilderTool.h.

◆ m_noiseOption

NoiseOption CscThresholdClusterBuilderTool::m_noiseOption
private

Definition at line 114 of file CscThresholdClusterBuilderTool.h.

◆ m_noiseOptionStr

std::string CscThresholdClusterBuilderTool::m_noiseOptionStr
private

Definition at line 113 of file CscThresholdClusterBuilderTool.h.

◆ m_pfitter_def

ToolHandle<ICscClusterFitter> CscThresholdClusterBuilderTool::m_pfitter_def
private
Initial value:
{
this,
"default_fitter",
"SimpleCscClusterFitter/SimpleCscClusterFitter",
}

Definition at line 132 of file CscThresholdClusterBuilderTool.h.

◆ m_pfitter_prec

ToolHandle<ICscClusterFitter> CscThresholdClusterBuilderTool::m_pfitter_prec
private
Initial value:
{
this,
"precision_fitter",
"QratCscClusterFitter/QratCscClusterFitter",
}

Definition at line 137 of file CscThresholdClusterBuilderTool.h.

◆ m_pfitter_split

ToolHandle<ICscClusterFitter> CscThresholdClusterBuilderTool::m_pfitter_split
private
Initial value:
{
this,
"split_fitter",
"CscSplitClusterFitter/CscSplitClusterFitter",
}

Definition at line 142 of file CscThresholdClusterBuilderTool.h.

◆ m_pstrip_fitter

ToolHandle<ICscStripFitter> CscThresholdClusterBuilderTool::m_pstrip_fitter
private
Initial value:
{
this,
"strip_fitter",
"CalibCscStripFitter/CalibCscStripFitter",
}

Definition at line 125 of file CscThresholdClusterBuilderTool.h.

◆ m_threshold

double CscThresholdClusterBuilderTool::m_threshold
private

Definition at line 111 of file CscThresholdClusterBuilderTool.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files:
CscThresholdClusterBuilderTool::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: CscThresholdClusterBuilderTool.h:148
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:29
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
IdentifiableContainerMT::addCollection
virtual StatusCode addCollection(const T *coll, IdentifierHash hashId) override final
insert collection into container with id hash if IDC should not take ownership of collection,...
Definition: IdentifiableContainerMT.h:300
CscThresholdClusterBuilderTool::m_digit_key
SG::ReadHandleKey< Muon::CscStripPrepDataContainer > m_digit_key
Definition: CscThresholdClusterBuilderTool.h:115
Muon::CscStripPrepDataCollection
MuonPrepDataCollection< CscStripPrepData > CscStripPrepDataCollection
Definition: MuonPrepDataCollection.h:111
calibdata.chamber
chamber
Definition: calibdata.py:32
CscThresholdClusterBuilderTool::m_noiseOptionStr
std::string m_noiseOptionStr
Definition: CscThresholdClusterBuilderTool.h:113
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
MuonGM::CscReadoutElement::nominalLocalClusterPos
Amg::Vector3D nominalLocalClusterPos(int eta, int wireLayer, int measPhi, double x0) const
ignores internal alignment parameters, hence gives generally incorrect answer (local here is the stat...
Definition: CscReadoutElement.cxx:410
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
CscThresholdClusterBuilderTool::m_pstrip_fitter
ToolHandle< ICscStripFitter > m_pstrip_fitter
Definition: CscThresholdClusterBuilderTool.h:125
CscThresholdClusterBuilderTool::m_DetectorManagerKey
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_DetectorManagerKey
retrieve MuonDetectorManager from the conditions store
Definition: CscThresholdClusterBuilderTool.h:155
plotBeamSpotVxVal.cov
cov
Definition: plotBeamSpotVxVal.py:201
CscThresholdClusterBuilderTool::m_pfitter_prec
ToolHandle< ICscClusterFitter > m_pfitter_prec
Definition: CscThresholdClusterBuilderTool.h:137
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
ATH_CHECK_RECOVERABLE
#define ATH_CHECK_RECOVERABLE
Evaluate an expression and check for errors.
Definition: AthCheckMacros.h:48
AthCommonMsg< AlgTool >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
CscThresholdClusterBuilderTool::rms
@ rms
Definition: CscThresholdClusterBuilderTool.h:77
MuonGM::CscReadoutElement
Definition: CscReadoutElement.h:56
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
Muon::CscStripPrepData::collectionHash
virtual const IdentifierHash collectionHash() const final
returns the IdentifierHash corresponding to the channel.
Definition: CscStripPrepData.h:158
atlasStyleMacro.icol
int icol
Definition: atlasStyleMacro.py:13
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
python.Dumpers.aname
string aname
Definition: Dumpers.py:5541
Muon::CscStripPrepData
Class representing the raw data of one CSC strip (for clusters look at Muon::CscPrepData).
Definition: CscStripPrepData.h:40
Muon::CscStrStatHot
@ CscStrStatHot
Definition: CscStripStatus.h:29
Muon::CscStrStatDead
@ CscStrStatDead
Definition: CscStripStatus.h:31
Muon::toString
std::string toString(CscStripStatus cstat)
Return a string description of a CSC cluster status flag.
Definition: CscStripStatus.h:48
MuonGM::CscReadoutElement::maxNumberOfStrips
int maxNumberOfStrips(int measuresPhi) const
Definition: CscReadoutElement.cxx:162
AthCommonDataStore
Definition: AthCommonDataStore.h:52
Amg::toString
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Definition: GeoPrimitivesToStringConverter.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ICscClusterFitter::Result
Definition: ICscClusterFitter.h:52
Trk::active
@ active
Definition: Layer.h:48
dqt_zlumi_pandas.err
err
Definition: dqt_zlumi_pandas.py:193
lumiFormat.i
int i
Definition: lumiFormat.py:92
MuonGM::MuonDetectorManager::getCscReadoutElement
const CscReadoutElement * getCscReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:225
Trk::PrepRawData::setHashAndIndex
void setHashAndIndex(unsigned short collHash, unsigned short objIndex)
TEMP for testing: might make some classes friends later ...
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
Muon::CscPrepData
Class representing clusters from the CSC.
Definition: CscPrepData.h:39
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
Muon::CscStatusSimple
@ CscStatusSimple
Cluster with non-precision fit.
Definition: CscClusterStatus.h:29
res
std::pair< std::vector< unsigned int >, bool > res
Definition: JetGroupProductTest.cxx:14
test_pyathena.parent
parent
Definition: test_pyathena.py:15
CscThresholdClusterBuilderTool::make_clusters
int make_clusters(bool measphi, const std::vector< const Muon::CscStripPrepData * > &strips, Muon::CscPrepDataCollection *&collection)
Definition: CscThresholdClusterBuilderTool.cxx:364
CscThresholdClusterBuilderTool::m_pfitter_split
ToolHandle< ICscClusterFitter > m_pfitter_split
Definition: CscThresholdClusterBuilderTool.h:142
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
Muon::CscStripPrepDataContainer
MuonPrepDataContainerT< CscStripPrepData > CscStripPrepDataContainer
Definition: MuonPrepDataContainer.h:99
ICscStripFitter::Result
Definition: ICscStripFitter.h:25
CscThresholdClusterBuilderTool::m_kFactor
float m_kFactor
Definition: CscThresholdClusterBuilderTool.h:112
Muon::CscStatusUndefined
@ CscStatusUndefined
Undefined, should not happen, most likely indicates a problem.
Definition: CscClusterStatus.h:94
Identifier::show
void show() const
Print out in hex form.
Definition: Identifier.cxx:36
CscThresholdClusterBuilderTool::m_makeNarrowClusterThreeStrips
bool m_makeNarrowClusterThreeStrips
Definition: CscThresholdClusterBuilderTool.h:162
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
CscThresholdClusterBuilderTool::f001
@ f001
Definition: CscThresholdClusterBuilderTool.h:77
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
Trk::PrepRawData::identify
Identifier identify() const
return the identifier
Muon::CscPrepDataCollection
MuonPrepDataCollection< CscPrepData > CscPrepDataCollection
Definition: MuonPrepDataCollection.h:109
fitman.fitresult
fitresult
Definition: fitman.py:590
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
charge
double charge(const T &p)
Definition: AtlasPID.h:494
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
python.ami.results
def results
Definition: ami.py:386
CscThresholdClusterBuilderTool::m_pfitter_def
ToolHandle< ICscClusterFitter > m_pfitter_def
Definition: CscThresholdClusterBuilderTool.h:132
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
query_example.col
col
Definition: query_example.py:7
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
IdentifiableContainerMT::indexFindPtr
virtual const T * indexFindPtr(IdentifierHash hashId) const override final
return pointer on the found entry or null if out of range using hashed index - fast version,...
Definition: IdentifiableContainerMT.h:292
a
TList * a
Definition: liststreamerinfos.cxx:10
h
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
CscThresholdClusterBuilderTool::m_noiseOption
NoiseOption m_noiseOption
Definition: CscThresholdClusterBuilderTool.h:114
MuonGM::MuonDetectorManager
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:49
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
DEBUG
#define DEBUG
Definition: page_access.h:11
CscThresholdClusterBuilderTool::m_threshold
double m_threshold
Definition: CscThresholdClusterBuilderTool.h:111
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:616
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
CscThresholdClusterBuilderTool::m_cscCalibTool
ToolHandle< ICscCalibTool > m_cscCalibTool
Definition: CscThresholdClusterBuilderTool.h:118
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
ICscClusterFitter::StripFitList
std::vector< StripFit > StripFitList
Definition: ICscClusterFitter.h:40
Muon::CscClusterStatus
CscClusterStatus
Enum to represent the cluster status - see the specific enum values for more details.
Definition: CscClusterStatus.h:23
IdentifierHash
Definition: IdentifierHash.h:38
CscThresholdClusterBuilderTool::sigma
@ sigma
Definition: CscThresholdClusterBuilderTool.h:77
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
fitman.k
k
Definition: fitman.py:528
Muon::CscTimeStatus
CscTimeStatus
Enum to represent the cluster time measurement status - see the specific enum values for more details...
Definition: CscTimeStatus.h:24