ATLAS Offline Software
Loading...
Searching...
No Matches
Muon::NSWCalibSmearingTool Class Reference

#include <NSWCalibSmearingTool.h>

Inheritance diagram for Muon::NSWCalibSmearingTool:
Collaboration diagram for Muon::NSWCalibSmearingTool:

Public Member Functions

 NSWCalibSmearingTool (const std::string &, const std::string &, const IInterface *)
virtual ~NSWCalibSmearingTool ()
virtual StatusCode initialize () override
virtual StatusCode isAccepted (const Identifier id, bool &accepted, CLHEP::HepRandomEngine *rndmEngine) const override
double getHighVoltage (Identifier id) const
StatusCode smearTimeAndCharge (const Identifier id, float &time, float &charge, bool &accepted, CLHEP::HepRandomEngine *rndmEngine) const override
StatusCode smearCharge (const Identifier id, float &charge, bool &accepted, CLHEP::HepRandomEngine *rndmEngine) const override
virtual StatusCode getGainFraction (const Identifier id, float &charge) override
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () 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
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.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

bool getIdFields (const Identifier id, int &etaSector, int &phiSector, int &gasGap) const
bool getPCBIdentifier (const Identifier id, Identifier &pcb_id) const
double getMMEfficiencyFromHV (double hv) const
double getMMGainFractionFromHV (double hv) const
StatusCode readHighVoltagesStatus ()
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
Gaudi::Property< std::vector< double > > m_timeSmear {this, "TimeSmear" ,{8.,8.,8.,8.,8.,8.,8.,8.}}
Gaudi::Property< std::vector< double > > m_chargeSmear {this, "ChargeSmear" ,{0.,0.,0.,0.,0.,0.,0.,0.}}
Gaudi::Property< std::vector< double > > m_channelEfficiency {this, "ChannelEfficiency", {1.,1.,1.,1.,1.,1.,1.,1.}}
Gaudi::Property< std::vector< double > > m_clusterEfficiency {this, "ClusterEfficiency", {1.,1.,1.,1.,1.,1.,1.,1.}}
Gaudi::Property< std::vector< double > > m_gainFraction {this, "GainFraction", {1.,1.,1.,1.,1.,1.,1.,1.}}
Gaudi::Property< std::vector< bool > > m_phiSectors {this, "PhiSectors", {true,true,true,true,true,true,true,true}}
Gaudi::Property< std::vector< bool > > m_etaSectors {this, "EtaSectors", {}}
Gaudi::Property< bool > m_readEfficiencyFromFile {this, "ReadEfficiencyFromFile", false}
Gaudi::Property< bool > m_readGainFractionFromFile {this, "ReadGainFractionFromFile", false}
Gaudi::Property< std::string > m_fileName {this, "FileName", ""}
std::map< Identifier, float > m_hvMap
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 24 of file NSWCalibSmearingTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ NSWCalibSmearingTool()

Muon::NSWCalibSmearingTool::NSWCalibSmearingTool ( const std::string & t,
const std::string & n,
const IInterface * p )

Definition at line 18 of file NSWCalibSmearingTool.cxx.

20 :
21 AthAlgTool(t,n,p)
22{
23 declareInterface<INSWCalibSmearingTool>(this);
24}
AthAlgTool()
Default constructor:

◆ ~NSWCalibSmearingTool()

virtual Muon::NSWCalibSmearingTool::~NSWCalibSmearingTool ( )
inlinevirtual

Definition at line 30 of file NSWCalibSmearingTool.h.

30{};

Member Function Documentation

◆ declareGaudiProperty()

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

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

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

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

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ 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.

◆ evtStore()

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.

◆ 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

◆ getGainFraction()

StatusCode Muon::NSWCalibSmearingTool::getGainFraction ( const Identifier id,
float & charge )
overridevirtual

Implements Muon::INSWCalibSmearingTool.

Definition at line 196 of file NSWCalibSmearingTool.cxx.

197{
198 int etaSector = 0;
199 int phiSector = 0;
200 int gasGap = 0;
201
202 if (!getIdFields(id,etaSector,phiSector,gasGap)) {
203 ATH_MSG_WARNING("Invalid identifier");
204 return StatusCode::SUCCESS;
205 }
206
207 gainFraction = 1.0;
208
210 if ( m_phiSectors.value()[phiSector-1] && m_etaSectors.value()[etaSector-1] ) {
211 gainFraction = m_gainFraction.value()[gasGap-1];
212 }
213 }
214 else {
215 float hv = getHighVoltage(id);
216 if(hv == -2.0) { // could not convert id to PCB id
217 return StatusCode::FAILURE;
218 }
219 else if(hv == -1.0) { // could not find PCB in HV map
220 gainFraction = 1;
221 }
222 else {
223 gainFraction=getMMGainFractionFromHV(hv);
224 ATH_MSG_DEBUG("Got gain fraction: "<< gainFraction << " for id " << m_idHelperSvc->toString(id));
225 }
226 }
227 return StatusCode::SUCCESS;
228}
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
bool getIdFields(const Identifier id, int &etaSector, int &phiSector, int &gasGap) const
double getMMGainFractionFromHV(double hv) const
Gaudi::Property< std::vector< double > > m_gainFraction
double getHighVoltage(Identifier id) const
Gaudi::Property< std::vector< bool > > m_phiSectors
Gaudi::Property< std::vector< bool > > m_etaSectors
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Gaudi::Property< bool > m_readGainFractionFromFile

◆ getHighVoltage()

double NSWCalibSmearingTool::getHighVoltage ( Identifier id) const

Definition at line 271 of file NSWCalibSmearingTool.cxx.

272{
273 Identifier pcbId;
274 bool foundPCB = getPCBIdentifier(stripId,pcbId);
275 if ( !foundPCB ) {
276 ATH_MSG_ERROR("Identifier " << m_idHelperSvc->toString(stripId) << " not converted" );
277 return -2.0;
278 }
279
280 double hv = -1.0;
281 std::map<Identifier,float>::const_iterator it = m_hvMap.find(pcbId);
282 if (it == m_hvMap.end() ) {
283 ATH_MSG_DEBUG("Identifier " << m_idHelperSvc->toString(pcbId) << " not found in the map" );
284 return -1.0;
285 }
286
287 hv = (*it).second;
288 return hv;
289}
#define ATH_MSG_ERROR(x)
bool getPCBIdentifier(const Identifier id, Identifier &pcb_id) const
std::map< Identifier, float > m_hvMap

◆ getIdFields()

bool NSWCalibSmearingTool::getIdFields ( const Identifier id,
int & etaSector,
int & phiSector,
int & gasGap ) const
private

Definition at line 234 of file NSWCalibSmearingTool.cxx.

235{
236 if ( m_idHelperSvc->isMM(id) ) {
237 int multilayer = m_idHelperSvc->mmIdHelper().multilayer(id);
238 gasGap = (multilayer-1)*4+m_idHelperSvc->mmIdHelper().gasGap(id);
239 etaSector = m_idHelperSvc->mmIdHelper().stationEta(id);
240 phiSector = m_idHelperSvc->mmIdHelper().stationPhi(id);
241 // transform the eta sector
242 etaSector < 0 ? etaSector = etaSector + 3 : etaSector = etaSector + 2;
243 }
244 else if ( m_idHelperSvc->issTgc(id) ) {
245 int multilayer = m_idHelperSvc->stgcIdHelper().multilayer(id);
246 gasGap = (multilayer-1)*4+m_idHelperSvc->stgcIdHelper().gasGap(id);
247 etaSector = m_idHelperSvc->stgcIdHelper().stationEta(id);
248 phiSector = m_idHelperSvc->stgcIdHelper().stationPhi(id);
249 // transform the eta sector
250 etaSector < 0 ? etaSector = etaSector + 4 : etaSector = etaSector + 3;
251 }
252 else {
253 ATH_MSG_WARNING("Wrong identifier: should be MM or STGC");
254 return false;
255 }
256
257
258 if ( phiSector < 1 || phiSector> (int) m_phiSectors.value().size()
259 || etaSector < (int) (-m_etaSectors.value().size()) || etaSector> (int) m_etaSectors.value().size() || etaSector==0
260 || gasGap < 1 || gasGap> (int) m_timeSmear.value().size() || gasGap>(int) m_chargeSmear.value().size() ) {
261 ATH_MSG_WARNING("Wrong phi, eta sector, or gasGap number: " << phiSector << " "
262 << etaSector << " " << gasGap << "Size of m_chargeSmear " << m_chargeSmear.value().size() << " size of m_etaSectors "<< m_etaSectors.value().size());
263 return false;
264 }
265
266 return true;
267}
Gaudi::Property< std::vector< double > > m_chargeSmear
Gaudi::Property< std::vector< double > > m_timeSmear

◆ getMMEfficiencyFromHV()

double NSWCalibSmearingTool::getMMEfficiencyFromHV ( double hv) const
private

Definition at line 294 of file NSWCalibSmearingTool.cxx.

295{
296
297 // sigmoid to paramtrize efficiency (initial values from BB5 measurements)
298 double eff = 1.0/(1+exp(-0.0551*(hv-510.54)));
299
300 return eff;
301}

◆ getMMGainFractionFromHV()

double NSWCalibSmearingTool::getMMGainFractionFromHV ( double hv) const
private

Definition at line 305 of file NSWCalibSmearingTool.cxx.

306{
307
308 // initial values from BB5 measurements. Scale cluster charge with respect to 570 V
309 return std::exp(-8.87971 + 0.0224561 * hv) / std::exp(-8.87971 + 0.0224561 * 570);
310
311}

◆ getPCBIdentifier()

bool NSWCalibSmearingTool::getPCBIdentifier ( const Identifier id,
Identifier & pcb_id ) const
private

Definition at line 318 of file NSWCalibSmearingTool.cxx.

319{
320
321 if ( m_idHelperSvc->isMM(id) ) {
322 // get the channel number
323 int channel = m_idHelperSvc->mmIdHelper().channel(id);
324 int pcb_strip = channel/1024;
325 pcb_strip = pcb_strip * 1024 + 512;
326
327 int stationName = m_idHelperSvc->mmIdHelper().stationName(id);
328 int stationEta = m_idHelperSvc->mmIdHelper().stationEta(id);
329 int stationPhi = m_idHelperSvc->mmIdHelper().stationPhi(id);
330
331 int multilayer = m_idHelperSvc->mmIdHelper().multilayer(id);
332 int gasGap = m_idHelperSvc->mmIdHelper().gasGap(id);
333
334 pcb_id = m_idHelperSvc->mmIdHelper().channelID(stationName,stationEta,stationPhi,multilayer,gasGap,pcb_strip);
335 }
336 else {
337 ATH_MSG_WARNING("Requesting PCB id for STGC");
338 return false;
339 }
340
341 return true;
342}

◆ initialize()

StatusCode Muon::NSWCalibSmearingTool::initialize ( )
overridevirtual

Definition at line 26 of file NSWCalibSmearingTool.cxx.

27{
28 ATH_MSG_DEBUG("In initialize()");
29 ATH_CHECK(m_idHelperSvc.retrieve());
30
31 if ( !(m_idHelperSvc->hasMM() || m_idHelperSvc->hasSTGC() ) ) {
32 ATH_MSG_ERROR("MM or STGC not part of initialized detector layout");
33 return StatusCode::FAILURE;
34 }
35
36
39 }
40
41 return StatusCode::SUCCESS;
42}
#define ATH_CHECK
Evaluate an expression and check for errors.
Gaudi::Property< bool > m_readEfficiencyFromFile

◆ 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()

const InterfaceID & Muon::INSWCalibSmearingTool::interfaceID ( )
inlinestaticinherited

Definition at line 19 of file INSWCalibSmearingTool.h.

19{static const InterfaceID IID_INSWCalibSmearingTool("Muon::INSWCalibSmearingTool",1,0); return IID_INSWCalibSmearingTool;}

◆ isAccepted()

StatusCode Muon::NSWCalibSmearingTool::isAccepted ( const Identifier id,
bool & accepted,
CLHEP::HepRandomEngine * rndmEngine ) const
overridevirtual

either efficiency per layer set via configuration, or read from file

check if a full hit can be accepted

Implements Muon::INSWCalibSmearingTool.

Definition at line 47 of file NSWCalibSmearingTool.cxx.

48{
49 accepted = true;
50
51 int etaSector = 0;
52 int phiSector = 0;
53 int gasGap = 0;
54
55 if (!getIdFields(id,etaSector,phiSector,gasGap)) {
56 ATH_MSG_WARNING("Invalid identifier");
57 return StatusCode::SUCCESS;
58 }
59
61 float efficiencyCut = 0.0;
63 efficiencyCut = m_clusterEfficiency.value()[gasGap-1];
64 }
65 else {
66 // get the efficiency from the HV map and the parametrization
67 Identifier pcb_id;
68 if ( !getPCBIdentifier(id, pcb_id) ) {
69 ATH_MSG_ERROR("Could not convert the id " << m_idHelperSvc->toString(id) << " to a PCB identifier" );
70 return StatusCode::FAILURE;
71 }
72
73 // get the HV
74 std::map<Identifier,float>::const_iterator it = m_hvMap.find(pcb_id);
75 if ( it != m_hvMap.end() ) {
76 double hv = it->second;
77 efficiencyCut = getMMEfficiencyFromHV(hv);
78 }
79 else {
80 ATH_MSG_WARNING("PCB Id not found in the HV map " << m_idHelperSvc->toString(pcb_id));
81 accepted = true;
82 return StatusCode::SUCCESS;
83 }
84 }
85
87 if ( CLHEP::RandFlat::shoot(rndmEngine, 0. , 1.) > efficiencyCut ) {
88 accepted = false;
89 }
90
91 return StatusCode::SUCCESS;
92
93}
double getMMEfficiencyFromHV(double hv) const
Gaudi::Property< std::vector< double > > m_clusterEfficiency

◆ msg()

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ 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.

◆ readHighVoltagesStatus()

StatusCode NSWCalibSmearingTool::readHighVoltagesStatus ( )
private

PCB range is 1 to 5 for stations 1, 1 to 3 for stations 2

add the PCB to the map

Definition at line 347 of file NSWCalibSmearingTool.cxx.

348{
349
350 std::string fileNamesA[16] = {"A01.txt","A02.txt","A03.txt","A04.txt",
351 "A05.txt","A06.txt","A07.txt","A08.txt",
352 "A09.txt","A10.txt","A11.txt","A12.txt",
353 "A13.txt","A14.txt","A15.txt","A16.txt" };
354
355 for (int ifile = 0 ; ifile<16 ; ++ifile) {
356
357 std::string fileName = PathResolverFindCalibFile(Form("NSWCalibTools/210128_initial/%s", fileNamesA[ifile].c_str()));
358
359 std::ifstream file(fileName,std::ios::in);
360 if ( !file.is_open() ) {
361 ATH_MSG_DEBUG("HV File " << fileNamesA[ifile] << " not available " );
362 continue;
363 }
364 ATH_MSG_INFO("Reading HV from configuration file: " << fileName);
365
366 //LM sector
367 //Layer PCB HV_left HV_right HV_min
368 //LM1 - IP
369
370 std::string line;
371 bool isLM,isSM,isIP,isHO;
372 int stationName,stationPhi,gasGap,HVval;
373 int side = 0;
374 std::string layerId[4] = {"L1","L2","L3","L4"};
375
376 int endPCB=0;
377
378 getline(file,line);
379 ATH_MSG_VERBOSE(line);
380 getline(file,line);
381 ATH_MSG_VERBOSE(line);
382
383 while ( getline(file,line) ) {
384 ATH_MSG_VERBOSE(line);
385
386 isIP=false;
387 isHO=false;
388
389 std::string secName = fileNamesA[ifile].substr(0,2);
390
391 if ( secName.substr(0,1)=="A" ) side = +1;
392 else if ( secName.substr(0,1)=="C" ) side = -1;
393 else {
394 ATH_MSG_ERROR("ERROR side not defined");
395 return StatusCode::FAILURE;
396 }
397 int phiSec = std::stoi(fileNamesA[ifile].substr(1,2));
398 stationPhi = (phiSec-1)/2+1;
399
400 size_t fLM = line.find("LM");
401 size_t fSM = line.find("SM");
402 isLM = (fLM!=std::string::npos);
403 isSM = (fSM!=std::string::npos);
404
405 // get layer 1 from the line with the module name
406 if ( isLM || isSM ) {
407 int stationEta = 0;
408 if ( isSM ) {
409 stationEta = side*std::stoi(line.substr(fSM+2,1));
410 }
411 else {
412 stationEta = side*std::stoi(line.substr(fLM+2,1));
413 }
414
416 if (stationEta==1) endPCB=5;
417 else if (stationEta==2) endPCB=3;
418 else {
419 ATH_MSG_ERROR("wrong stationEta value = " << stationEta);
420 }
421
422 isSM ? stationName=55 : stationName=56;
423
424 int multilayer = 0;
425 std::size_t fIP = line.find("IP");
426 isIP = (fIP!=std::string::npos);
427 std::size_t fHO = line.find("HO");
428 isHO = (fHO!=std::string::npos);
429 if ( !isIP && !isHO ) {
430 ATH_MSG_ERROR("ERROR multilayer id not found (IP/HO) ");
431 return StatusCode::FAILURE;
432 }
433 else if ( isIP && isHO ) {
434 ATH_MSG_ERROR("ERROR multilayer id duplicated (IP and HO) ");
435 return StatusCode::FAILURE;
436 }
437 else if ( isIP ) {
438 multilayer = 1;
439 }
440 else if ( isHO ) {
441 multilayer = 2;
442 }
443
444 // now read the various layers
445 //int ilayer = 1;
446 //int ipcb = 1;
447 for (int ilayer = 1; ilayer <= 4; ilayer++) {
448 for (int ipcb = 1; ipcb <= endPCB; ipcb++) {
449 getline(file,line);
450 ATH_MSG_VERBOSE(line);
451
452 std::istringstream elem(line);
453 std::vector<std::string> elements;
454
455 while(elem) {
456 std::string subs_elem;
457 elem >> subs_elem;
458 if (!subs_elem.empty()) elements.push_back(subs_elem);
459 }
460
461 gasGap = std::stoi(elements[0]);
462 int readed_pcb = std::stoi(elements[1]);
463 if (gasGap != ilayer || readed_pcb != ipcb) {
464 ATH_MSG_ERROR("Layer or pcb wrong!");
465 return StatusCode::FAILURE;
466 }
467
468 HVval=std::stoi(elements[4]);
469
470 ATH_MSG_DEBUG("PCB done, stationName, stationEta, stationPhi, ml, layer, pcb, hv: "
471 << stationName<< " " << stationEta << " " << stationPhi << " " << multilayer << " "
472 << ilayer << " " << ipcb << " " << HVval );
473
474 int chanNum = (ipcb-1)*1024+512;
476 Identifier pcbId = m_idHelperSvc->mmIdHelper().channelID(stationName,stationEta,stationPhi,
477 multilayer,ilayer,chanNum);
478 float hv = (float)HVval;
479 m_hvMap.insert(std::pair<Identifier,float>(pcbId,hv));
480
481 }
482 if ( ilayer == 4 ) {
483 getline(file,line);
484 ATH_MSG_VERBOSE(line);
485 }
486 } // loop on the layers
487 }
488 }
489 } // loop on the files
490 return StatusCode::SUCCESS;
491}
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
TFile * file

◆ 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();
384 }
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)

◆ 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 {
366 }

◆ smearCharge()

StatusCode Muon::NSWCalibSmearingTool::smearCharge ( const Identifier id,
float & charge,
bool & accepted,
CLHEP::HepRandomEngine * rndmEngine ) const
overridevirtual

either efficiency per layer set via configuration, or read from file

Implements Muon::INSWCalibSmearingTool.

Definition at line 99 of file NSWCalibSmearingTool.cxx.

100{
101
102 ATH_MSG_DEBUG("Smearing the strips charge");
103
104 int etaSector = 0;
105 int phiSector = 0;
106 int gasGap = 0;
107
108 if (!getIdFields(id,etaSector,phiSector,gasGap)) {
109 ATH_MSG_WARNING("Invalid identifier");
110 return StatusCode::SUCCESS;
111 }
113
114
115 float efficiencyCut = 0.0;
117 efficiencyCut = m_clusterEfficiency.value()[gasGap-1];
118 }
119 else {
120 // get the efficiency from the HV map and the parametrization
121 Identifier pcb_id;
122 if ( !getPCBIdentifier(id, pcb_id) ) {
123 ATH_MSG_ERROR("Could not convert the id " << m_idHelperSvc->toString(id) << " to a PCB identifier" );
124 return StatusCode::FAILURE;
125 }
126 // get the HV
127 std::map<Identifier,float>::const_iterator it = m_hvMap.find(pcb_id);
128 if ( it != m_hvMap.end() ) {
129 double hv = it->second;
130 efficiencyCut = getMMEfficiencyFromHV(hv);
131 }
132 else {
133 ATH_MSG_WARNING("PCB Id not found in the HV map " << m_idHelperSvc->toString(pcb_id));
134 accepted = true;
135 return StatusCode::SUCCESS;
136 }
137 }
138
139 if ( m_phiSectors.value()[phiSector-1] && m_etaSectors.value()[etaSector-1] ) {
140 // smear charge
141 double chargeSmear = m_chargeSmear.value()[gasGap-1];
142 charge = charge + CLHEP::RandGaussZiggurat::shoot(rndmEngine,0.0, chargeSmear);
143
144 // check if the single strip can be accepted
145 accepted = true;
146 if ( CLHEP::RandFlat::shoot(rndmEngine, 0. , 1.) > efficiencyCut ) {
147 accepted = false;
148 }
149 }
150
151 return StatusCode::SUCCESS;
152}
double charge(const T &p)
Definition AtlasPID.h:997

◆ smearTimeAndCharge()

StatusCode Muon::NSWCalibSmearingTool::smearTimeAndCharge ( const Identifier id,
float & time,
float & charge,
bool & accepted,
CLHEP::HepRandomEngine * rndmEngine ) const
overridevirtual

Implements Muon::INSWCalibSmearingTool.

Definition at line 157 of file NSWCalibSmearingTool.cxx.

158{
159
160 if ( m_idHelperSvc->issTgc(id) ) {
161 ATH_MSG_ERROR("Can't smear time for the STGC's");
162 return StatusCode::FAILURE;
163 }
164
165 int etaSector = 0;
166 int phiSector = 0;
167 int gasGap = 0;
168
169 if (!getIdFields(id,etaSector,phiSector,gasGap)) {
170 ATH_MSG_WARNING("Invalid identifier");
171 return StatusCode::SUCCESS;
172 }
173
174 if ( m_phiSectors.value()[phiSector-1] && m_etaSectors.value()[etaSector-1] ) {
175
176 // smear time and charge
177 double timeSmear = m_timeSmear.value()[gasGap-1];
178 double chargeSmear = m_chargeSmear.value()[gasGap-1];
179
180 time = time + CLHEP::RandGaussZiggurat::shoot(rndmEngine,0.0, timeSmear);
181 charge = charge + CLHEP::RandGaussZiggurat::shoot(rndmEngine,0.0, chargeSmear);
182
183 // check if the RDO can be accepted
184 accepted = true;
185 if ( CLHEP::RandFlat::shoot(rndmEngine, 0. , 1.) > m_channelEfficiency.value()[gasGap-1] ) {
186 accepted = false;
187 }
188 }
189
190 return StatusCode::SUCCESS;
191}
Gaudi::Property< std::vector< double > > m_channelEfficiency
time(flags, cells_name, *args, **kw)

◆ 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 asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ 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) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_channelEfficiency

Gaudi::Property<std::vector<double> > Muon::NSWCalibSmearingTool::m_channelEfficiency {this, "ChannelEfficiency", {1.,1.,1.,1.,1.,1.,1.,1.}}
private

Definition at line 60 of file NSWCalibSmearingTool.h.

60{this, "ChannelEfficiency", {1.,1.,1.,1.,1.,1.,1.,1.}};

◆ m_chargeSmear

Gaudi::Property<std::vector<double> > Muon::NSWCalibSmearingTool::m_chargeSmear {this, "ChargeSmear" ,{0.,0.,0.,0.,0.,0.,0.,0.}}
private

Definition at line 58 of file NSWCalibSmearingTool.h.

58{this, "ChargeSmear" ,{0.,0.,0.,0.,0.,0.,0.,0.}};

◆ m_clusterEfficiency

Gaudi::Property<std::vector<double> > Muon::NSWCalibSmearingTool::m_clusterEfficiency {this, "ClusterEfficiency", {1.,1.,1.,1.,1.,1.,1.,1.}}
private

Definition at line 61 of file NSWCalibSmearingTool.h.

61{this, "ClusterEfficiency", {1.,1.,1.,1.,1.,1.,1.,1.}};

◆ 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_etaSectors

Gaudi::Property<std::vector<bool> > Muon::NSWCalibSmearingTool::m_etaSectors {this, "EtaSectors", {}}
private

Definition at line 66 of file NSWCalibSmearingTool.h.

66{this, "EtaSectors", {}}; // needs to be set via config since it differs for MMs and sTGCs

◆ 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_fileName

Gaudi::Property<std::string> Muon::NSWCalibSmearingTool::m_fileName {this, "FileName", ""}
private

Definition at line 70 of file NSWCalibSmearingTool.h.

70{this, "FileName", ""};

◆ m_gainFraction

Gaudi::Property<std::vector<double> > Muon::NSWCalibSmearingTool::m_gainFraction {this, "GainFraction", {1.,1.,1.,1.,1.,1.,1.,1.}}
private

Definition at line 63 of file NSWCalibSmearingTool.h.

63{this, "GainFraction", {1.,1.,1.,1.,1.,1.,1.,1.}};

◆ m_hvMap

std::map<Identifier,float> Muon::NSWCalibSmearingTool::m_hvMap
private

Definition at line 73 of file NSWCalibSmearingTool.h.

◆ m_idHelperSvc

ServiceHandle<Muon::IMuonIdHelperSvc> Muon::NSWCalibSmearingTool::m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
private

Definition at line 55 of file NSWCalibSmearingTool.h.

55{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};

◆ m_phiSectors

Gaudi::Property<std::vector<bool> > Muon::NSWCalibSmearingTool::m_phiSectors {this, "PhiSectors", {true,true,true,true,true,true,true,true}}
private

Definition at line 65 of file NSWCalibSmearingTool.h.

65{this, "PhiSectors", {true,true,true,true,true,true,true,true}};

◆ m_readEfficiencyFromFile

Gaudi::Property<bool> Muon::NSWCalibSmearingTool::m_readEfficiencyFromFile {this, "ReadEfficiencyFromFile", false}
private

Definition at line 68 of file NSWCalibSmearingTool.h.

68{this, "ReadEfficiencyFromFile", false};

◆ m_readGainFractionFromFile

Gaudi::Property<bool> Muon::NSWCalibSmearingTool::m_readGainFractionFromFile {this, "ReadGainFractionFromFile", false}
private

Definition at line 69 of file NSWCalibSmearingTool.h.

69{this, "ReadGainFractionFromFile", false};

◆ m_timeSmear

Gaudi::Property<std::vector<double> > Muon::NSWCalibSmearingTool::m_timeSmear {this, "TimeSmear" ,{8.,8.,8.,8.,8.,8.,8.,8.}}
private

Definition at line 57 of file NSWCalibSmearingTool.h.

57{this, "TimeSmear" ,{8.,8.,8.,8.,8.,8.,8.,8.}};

◆ 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: