ATLAS Offline Software
Loading...
Searching...
No Matches
MuonCalib::CscCalcPed Class Reference

does calibration of the CSC chambers More...

#include <CscCalcPed.h>

Inheritance diagram for MuonCalib::CscCalcPed:

Public Member Functions

 CscCalcPed (const std::string &name, ISvcLocator *pSvcLocator)
 ~CscCalcPed ()=default
StatusCode initialize (void)
 basic required functions
StatusCode execute (void)
StatusCode finalize (void)
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
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 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

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

StatusCode collectEventInfo ()
 event loop functions
StatusCode calculateParameters ()
 Finalize functions.
StatusCode writeCalibrationFile ()
StatusCode storeGateRecord ()
DataVector< TH2F > * makeBitCorrelation ()
StatusCode calOutput0 ()
StatusCode calOutput1 ()
StatusCode calOutput3 ()
void outputParameter3 (const CscCalibResultCollection &results, std::ofstream &out)
StatusCode hashToChamberName (IdentifierHash, std::string)
 Utility functions.
StatusCode fillBitHist (TH1I *bitHist, const uint16_t &val, TH2F *bitProds)
template<typename dataType>
dataType GetMinMax (std::vector< dataType > &vec)
void onlineToOfflineHashId (const unsigned int &onlineId, unsigned int &hashId) const
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"}
 Services and tools.
SmartIF< IChronoStatSvc > m_chronoSvc
ToolHandle< Muon::ICSC_RDO_Decoderm_cscRdoDecoderTool {this,"CscRdoDecoderTool","Muon::CscRDO_Decoder"}
SG::ReadCondHandleKey< CscCondDbDatam_readKey {this, "ReadKey", "CscCondDbData", "Key of CscCondDbData"}
std::string m_outputFileName
 Parameters input through joboptions.
std::string m_titlePrefix
std::string m_titlePostfix
std::string m_calOutputVersion
bool m_doCorrelation
float m_thresholdMultiplier
int m_expectedChamberLayer
std::string m_onlineDbFile
 filename for file with online database information
unsigned int m_maxStripHash
 Internally global variables.
unsigned int m_ampHistLowBound
unsigned int m_ampHistHighBound
unsigned int m_ampHistNumBins
const unsigned int m_numBits
bool m_doBitHists
bool m_doSampleHists
int m_numSamplesExpected
bool m_doF001
DataVector< TH1I > * m_ampHists
DataVector< DataVector< TH1I > > * m_sampHists
DataVector< TH1I > * m_bitHists
DataVector< TH2F > * m_bitProds
DataVector< TH1F > * m_bitCorrelation
std::vector< int > m_onlineThresholds
std::vector< int > m_onlineThresholdFailureCount
CscCalibResultCollectionm_peds
CscCalibResultCollectionm_noises
CscCalibResultCollectionm_rmses
CscCalibResultCollectionm_f001s
CscCalibResultCollectionm_onlineTHoldBreaches
int m_eventCnt
double * m_crossTalkFix
std::string m_cmt_parameter
bool m_doOnlineDbFile
DataObjIDColl m_extendedExtraObjects
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

does calibration of the CSC chambers

Author
lampe.nosp@m.n@ph.nosp@m.ysics.nosp@m..ari.nosp@m.zona..nosp@m.edu

Description

CscCalcPed is an algorithm that cycles through calibration events and generates the pedestals. A root file is also generated where the user can view the validity of the constants.

Definition at line 44 of file CscCalcPed.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ CscCalcPed()

MuonCalib::CscCalcPed::CscCalcPed ( const std::string & name,
ISvcLocator * pSvcLocator )

Definition at line 24 of file CscCalcPed.cxx.

24 :
25 AthAlgorithm(name,pSvcLocator),
27 m_numBits(12),
28 m_ampHists(nullptr),
29 m_sampHists(nullptr),
30 m_bitHists(nullptr),
31 m_bitProds(nullptr),
32 m_bitCorrelation(nullptr),
33 m_peds(nullptr),
34 m_noises(nullptr),
35 m_rmses(nullptr),
36 m_f001s(nullptr),
37 m_onlineTHoldBreaches(nullptr),
38 m_eventCnt(0),
39 m_crossTalkFix(nullptr)
40 {
41 declareProperty("OutputFile", m_outputFileName = "output.cal");
42 declareProperty("TitlePrefix",m_titlePrefix = ""); //Prefix appended to title of histograms and graphs
43 declareProperty("TitlePostfix",m_titlePostfix = ""); //Prefix appended to title of histograms and graphs
44 declareProperty("PedAmpHighBound", m_ampHistHighBound = 2600);
45 declareProperty("PedAmpLowBound", m_ampHistLowBound = 1800);
46 declareProperty("PedAmpNumBins", m_ampHistNumBins = 800);
47 declareProperty("ExpectedChamberLayer", m_expectedChamberLayer = 2);
48 declareProperty("ThresholdMultiplier", m_thresholdMultiplier = 3.1);
49 declareProperty("DoBitHists", m_doBitHists = false);
50 declareProperty("CalOutputVersion", m_calOutputVersion="03-00");
51 declareProperty("DoCorrelation", m_doCorrelation = false);
52
53 declareProperty("DoSampHists", m_doSampleHists = false);
54 declareProperty("NumSamplesExpected", m_numSamplesExpected = 4);
55 declareProperty("DoF001", m_doF001 = true);
56
57 declareProperty("OnlineCalibFile", m_onlineDbFile = "", "File with data currently stored in online configuration database");
58 declareProperty("CompareOnlineCalibFile",m_doOnlineDbFile = true, "Compare new to online data?");
59
60
61 //Can't do correlation without bitHists
62 if(!m_doBitHists){
63 m_doCorrelation = false;
64 }
65 }
AthAlgorithm()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
std::string m_titlePostfix
Definition CscCalcPed.h:91
CscCalibResultCollection * m_noises
Definition CscCalcPed.h:124
CscCalibResultCollection * m_peds
Definition CscCalcPed.h:123
unsigned int m_ampHistNumBins
Definition CscCalcPed.h:105
DataVector< TH1I > * m_ampHists
Definition CscCalcPed.h:116
unsigned int m_ampHistHighBound
Definition CscCalcPed.h:105
DataVector< TH2F > * m_bitProds
Definition CscCalcPed.h:119
const unsigned int m_numBits
Definition CscCalcPed.h:107
DataVector< TH1F > * m_bitCorrelation
Definition CscCalcPed.h:120
CscCalibResultCollection * m_f001s
Definition CscCalcPed.h:126
DataVector< DataVector< TH1I > > * m_sampHists
Definition CscCalcPed.h:117
std::string m_onlineDbFile
filename for file with online database information
Definition CscCalcPed.h:100
DataVector< TH1I > * m_bitHists
Definition CscCalcPed.h:118
unsigned int m_maxStripHash
Internally global variables.
Definition CscCalcPed.h:103
std::string m_calOutputVersion
Definition CscCalcPed.h:92
std::string m_titlePrefix
Definition CscCalcPed.h:91
CscCalibResultCollection * m_onlineTHoldBreaches
Definition CscCalcPed.h:127
unsigned int m_ampHistLowBound
Definition CscCalcPed.h:105
CscCalibResultCollection * m_rmses
Definition CscCalcPed.h:125
std::string m_outputFileName
Parameters input through joboptions.
Definition CscCalcPed.h:90

◆ ~CscCalcPed()

MuonCalib::CscCalcPed::~CscCalcPed ( )
default

Member Function Documentation

◆ calculateParameters()

StatusCode MuonCalib::CscCalcPed::calculateParameters ( )
private

Finalize functions.

Definition at line 495 of file CscCalcPed.cxx.

496 {
497 Chrono chrono(m_chronoSvc,"calculateParameters");
498
499
500 //**********Calculate all the parameters from data collected during execute*****************//
501
502 for(unsigned int stripHash = 0 ;stripHash <= m_maxStripHash; stripHash++)
503 {
504 if(stripHash < 50 || stripHash%1000 == 0)
505 {
506 ATH_MSG_INFO("Analyzing strip with hash " << stripHash << " out of " << m_maxStripHash);
507 ATH_MSG_VERBOSE((float)clock()/((float)CLOCKS_PER_SEC) << " is the time");
508 }
509
510 TH1I * ampHist = (*m_ampHists)[stripHash];
511 if(ampHist)
512 {
513 ATH_MSG_VERBOSE("Have data for strip hash " << stripHash);
514 if(ampHist->GetEntries() >0) //If strip wasn't tested, it won't have entries
515 {
516 //Following Schernau's work
517 float histMean = ampHist->GetMean();
518 float histRMS = ampHist->GetRMS();
519 float histRMSError = ampHist->GetRMSError();
520
521 float lowbound = histMean - 3*histRMS;
522 float highbound = histMean + 3*histRMS;
523 ATH_MSG_VERBOSE("About to fit...");
524
525 int result = ampHist->Fit("gaus","QL","",lowbound,highbound);
526 ATH_MSG_VERBOSE("Result is " << result);
527 TF1 * fittedFunction = ampHist->GetFunction("gaus");
528 double meanError = fittedFunction->GetParError(1);
529 double sigma = fittedFunction->GetParameter(2);
530 double sigmaError = fittedFunction->GetParError(2);
531 double chi2 = fittedFunction->GetChisquare();
532 int ndf = fittedFunction->GetNDF();
533
534 m_peds->push_back(new CscCalibResult(stripHash,histMean,meanError,chi2,ndf));
535 m_noises->push_back(new CscCalibResult(stripHash,sigma,sigmaError,chi2,ndf));
536 m_rmses->push_back(new CscCalibResult(stripHash,histRMS,histRMSError,0,0));
537
538
539
540 //Integrated threshold (f001) calculation
541 if(m_doF001){
542 int num = (int)ampHist->GetEntries();
543 int thr = ampHist->GetNbinsX() + 1; // start at overflow bin
544 double maxSum = 0.001*num; // 99.90 of pedestals under thr
545 //double maxSum = 0.0001*num; // 99.99 of pedestals under thr
546
547 double sum = 0;
548 do{
549 sum += ampHist->GetBinContent(thr);
550 thr--;
551 } while ((thr>0)&&(sum<maxSum));
552
553 //double threshold = ampHist->GetXaxis()->GetBinLowEdge(thr) +2; //For some reason +2 here matches Michael Schernau's +1
554 double threshold = ampHist->GetXaxis()->GetBinLowEdge(thr) +1; //For some reason +2 here matches Michael Schernau's +1
555 m_f001s->push_back(new CscCalibResult(stripHash,threshold,0,0,0));
556
558 m_onlineTHoldBreaches->push_back(new CscCalibResult(stripHash,m_onlineThresholdFailureCount[stripHash],0));
559 }
560 }
561 }
562 }
563 else
564 ATH_MSG_VERBOSE("Don't have data for strip hash " << stripHash);
565 }//end loop over strips
566
567
568 //don't need it anymore, clear ram taken by m_failure tests
569 ATH_MSG_DEBUG("Clearing m_onlineThresholdFailureCount");
571
572
573 ATH_MSG_INFO("Completed calculating parameters.");
574
575 return StatusCode::SUCCESS;
576 }//End calculateParameters()
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
SmartIF< IChronoStatSvc > m_chronoSvc
Definition CscCalcPed.h:84
std::vector< int > m_onlineThresholdFailureCount
Definition CscCalcPed.h:122
double chi2(TH1 *h0, TH1 *h1)

◆ calOutput0()

StatusCode MuonCalib::CscCalcPed::calOutput0 ( )
private

Definition at line 601 of file CscCalcPed.cxx.

601 {
602
603 std::ofstream out;
604 out.open(m_outputFileName.c_str());
605 if(!out.is_open())
606 {
607 ATH_MSG_ERROR("Can't open file " << m_outputFileName.c_str());
608 return StatusCode::RECOVERABLE;
609 }
610
611 out << "00-00 ";
612 out << m_peds->size() << " ";
613 out << "ped ";
614 out << "noise ";
615 out << "rms ";
616 out << "END_HEADER\n";
617
618 ATH_MSG_DEBUG("Begining loop over all " << m_peds->size() << " channels data was collected for.");
619
620 //form is:hashID chamber LayerOrientationStrip parametervalue parametervalue
623 CscCalibResultCollection::iterator noiseItr = m_noises->begin();
625 for(;pedItr!= pedEnd;++pedItr,++noiseItr, ++rmsItr)//,tholdItr++)
626 {
627 int hashId = (*pedItr)->hashId();
628 double ped = (*pedItr)->value();
629 double noise = (*noiseItr)->value();
630 double rms = (*rmsItr)->value();
631
632 ATH_MSG_DEBUG("we're on hash " << hashId << " with pedestal " << ped << "and noise " << noise);
633 Identifier id;
634 IdContext channelContext = m_idHelperSvc->cscIdHelper().channel_context();
635 m_idHelperSvc->cscIdHelper().get_id(hashId,id, &channelContext);
636
637 Identifier chamberId = m_idHelperSvc->cscIdHelper().elementID(id);
638 if(!m_idHelperSvc->cscIdHelper().valid(chamberId))
639 {
640 ATH_MSG_WARNING(chamberId.getString() << " is not a valid id!");
641 ATH_MSG_WARNING("identifier is: " << m_idHelperSvc->cscIdHelper().show_to_string(chamberId));
642 }
643
644 IdentifierHash chamberHash;
645 m_idHelperSvc->cscIdHelper().get_module_hash(id,chamberHash);
646
647 //print out values.
648 out << hashId;
649 out <<" " << chamberHash;
650 out << " " << m_idHelperSvc->cscIdHelper().show_to_string(id) << " ";
651 out << " " << ped;
652 out << " " << noise;
653 out << " " << rms;
654 out << "\n" ;
655 } //end loop over hash Ids
656
657 out.close(); //done writing
658 ATH_MSG_INFO("File written");
659 return StatusCode::SUCCESS;
660 }//end calOutput0
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
DataModel_detail::iterator< DataVector > iterator
Definition DataVector.h:842
std::string getString() const
Provide a string form of the identifier - hexadecimal.
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Services and tools.
Definition CscCalcPed.h:83

◆ calOutput1()

StatusCode MuonCalib::CscCalcPed::calOutput1 ( )
private

Definition at line 664 of file CscCalcPed.cxx.

664 {
665
666 std::ofstream out;
667 std::string onlineFileName = m_outputFileName + "_online";
668
669 out.open(onlineFileName.c_str());
670 if(!out.is_open())
671 {
672 ATH_MSG_ERROR("Can't open online file " << m_outputFileName.c_str());
673 return StatusCode::RECOVERABLE;
674 }
675
676 out << "32\n";
677
678 ATH_MSG_DEBUG("Begining loop over all " << m_peds->size() << " channels data was collected for.");
679
680 SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey};
681 const CscCondDbData* readCdo{*readHandle};
682
683 //form is:hashID chamber LayerOrientationStrip parametervalue parametervalue
686 CscCalibResultCollection::iterator noiseItr = m_noises->begin();
689 for(;pedItr!= pedEnd;++pedItr,++noiseItr, ++rmsItr, ++f001Itr)//,tholdItr++)
690 {
691 int hashId = (*pedItr)->hashId();
692 double ped = (*pedItr)->value();
693 double noise = (*noiseItr)->value();
694 //double rms = (*rmsItr)->value();
695 double f001 = (*f001Itr)->value();
696
697 //double thold = (*tholdItr)->value();
698 std::string onlineHexId;
699
700 //Online ids are same as "string ids" used internally in COOL db.
701 readCdo->indexToStringId(&m_idHelperSvc->cscIdHelper(), hashId, "CHANNEL", onlineHexId).ignore();
702
703 ATH_MSG_DEBUG("we're on hash " << hashId << " with pedestal " << ped << "and noise " << noise);
704 Identifier id;
705 IdContext channelContext = m_idHelperSvc->cscIdHelper().channel_context();
706 m_idHelperSvc->cscIdHelper().get_id(hashId,id, &channelContext);
707
708 Identifier chamberId = m_idHelperSvc->cscIdHelper().elementID(id);
709 if(!m_idHelperSvc->cscIdHelper().valid(chamberId))
710 {
711 ATH_MSG_WARNING(chamberId.getString() << " is not a valid id!");
712 ATH_MSG_WARNING("identifier is: " << m_idHelperSvc->cscIdHelper().show_to_string(chamberId));
713 }
714
715 char orientationChar = (m_idHelperSvc->cscIdHelper().measuresPhi(id) ? 'Y':'X');
716
717
718 IdentifierHash chamberHash;
719 m_idHelperSvc->cscIdHelper().get_module_hash(id,chamberHash);
720
721 //print out values.
722 out.setf(std::ios::right);//right aligned columns
723 out << std::setfill('0') << std::setw(8) << onlineHexId;
724 out <<" "
725 << std::setw(2) << chamberHash << orientationChar << (m_idHelperSvc->cscIdHelper().wireLayer(id)-1)
726 <<" "
727 << std::setw(3) << m_idHelperSvc->cscIdHelper().strip(id) -1 << " " ;
728 out.setf(std::ios::fixed);
729
730
731 out << " " << std::setprecision(3) << std::setw(8) << ped << " 0000.00";
732 out << " " << std::setprecision(3) << std::setw(8) << noise << " 0000.000";
733 out << " " << f001;
734 out << "\n" ;
735 } //end loop over hash Ids
736
737 out.close(); //done writing
738 ATH_MSG_INFO("File written");
739 return StatusCode::SUCCESS;
740 }//end calOutput1
StatusCode indexToStringId(const CscIdHelper *, const unsigned int &, const std::string &, std::string &) const
SG::ReadCondHandleKey< CscCondDbData > m_readKey
Definition CscCalcPed.h:86

◆ calOutput3()

StatusCode MuonCalib::CscCalcPed::calOutput3 ( )
private

Definition at line 744 of file CscCalcPed.cxx.

744 {
745 std::ofstream out;
746 out.open(m_outputFileName.c_str());
747 if(!out.is_open())
748 {
749 ATH_MSG_ERROR("Can't open output 3 type file " << m_outputFileName.c_str() << " for writing ");
750 return StatusCode::RECOVERABLE;
751 }
752 out << "03-00 <END_HEADER>";
753
757 if(m_doF001)
759 out << "\n<END_FILE>";
760 out.close();
761
762 return StatusCode::SUCCESS;
763 }
void outputParameter3(const CscCalibResultCollection &results, std::ofstream &out)

◆ collectEventInfo()

StatusCode MuonCalib::CscCalcPed::collectEventInfo ( )
private

event loop functions

Definition at line 343 of file CscCalcPed.cxx.

344 {
345 //start the timer
346 Chrono chrono(m_chronoSvc,"collectEventInfo");
347
348
349 m_eventCnt++;
350 ATH_MSG_DEBUG("Collecting event info for event " << m_eventCnt);
351 //Below might need to be changed depending on how we get data
352 const CscRawDataContainer* rawDataContainer;
353 StatusCode sc_read = evtStore()->retrieve(rawDataContainer, "CSCRDO");
354 if (sc_read != StatusCode::SUCCESS)
355 {
356 ATH_MSG_FATAL("Could not find event");
357 return StatusCode::FAILURE;
358 }
359
360 ATH_MSG_VERBOSE("Retrieved RDO from storegate ");
361
362 if(rawDataContainer->size() == 0)
363 {
364 ATH_MSG_FATAL("no rods in RDO!");
365 return StatusCode::FAILURE;
366 }
367
368 ATH_MSG_VERBOSE("There are " << rawDataContainer->size() << " rods in the RDO");
369
370 IdContext channelContext = m_idHelperSvc->cscIdHelper().channel_context();
371
372 //Loop over RODs (data from 2 chambers), each of which is in
373 //a single CscRawaData collection
374
375 for(const auto rod : *rawDataContainer)
376 {
377 Chrono chronoRod(m_chronoSvc,"RodItr");
378 ATH_MSG_VERBOSE("Examining a ROD");
379
380 ATH_MSG_VERBOSE("There are " << rod->size() << " clusters in the ROD");
381 if(rod->size() >0)
382 {
383 //Loop over strips in rod
384
385
386 for(const auto cluster: *rod)
387 {
388 Chrono chronoClus(m_chronoSvc,"ClusterItr");
389 int numStrips = cluster->width();
390 int samplesPerStrip = (cluster->samples()).size()/numStrips;
391
392 ATH_MSG_VERBOSE("About to collect info from " << numStrips << " strips");
393 for(int stripItr = 0; stripItr <numStrips; stripItr++)
394 {
395
396 Chrono chronoStrip(m_chronoSvc,"stripItr");
397 // WP Added
398 Identifier channelId =m_cscRdoDecoderTool->channelIdentifier(cluster, &m_idHelperSvc->cscIdHelper(), stripItr);
399 IdentifierHash cscChannelHashId;
400 m_idHelperSvc->cscIdHelper().get_channel_hash(channelId, cscChannelHashId);
401
403 int stripHash = cscChannelHashId;
404
405 Identifier stripId;
406 m_idHelperSvc->cscIdHelper().get_id(stripHash, stripId, &channelContext);
407
408
409 Chrono chronoAfterId(m_chronoSvc,"afterID1");
410
411 if( m_idHelperSvc->cscIdHelper().chamberLayer(channelId) != m_expectedChamberLayer)
412 {
413 ATH_MSG_WARNING("Wrong chamber layer a hash ("
414 << stripHash << ") from the wrong multilayer has appeared in the data. Its string id is " << m_idHelperSvc->cscIdHelper().show_to_string(stripId)
415 << " " << m_idHelperSvc->cscIdHelper().show_to_string(channelId));
416
417 ATH_MSG_INFO("WP added (1) "
418 << m_idHelperSvc->cscIdHelper().stationEta(stripId) << " " << m_idHelperSvc->cscIdHelper().measuresPhi(stripId) << " "
419 << stripHash << " " << cscChannelHashId);
420
421 ATH_MSG_INFO("WP added (2) "
422 << m_idHelperSvc->cscIdHelper().stationEta(stripId) << " " << m_idHelperSvc->cscIdHelper().measuresPhi(stripId) << " "
423 << stripId << " " << channelId);
424
425 stripId = m_idHelperSvc->cscIdHelper().channelID(
426 m_idHelperSvc->cscIdHelper().stationName(stripId),
427 m_idHelperSvc->cscIdHelper().stationEta(stripId),
428 m_idHelperSvc->cscIdHelper().stationPhi(stripId),
429 2,
430 m_idHelperSvc->cscIdHelper().wireLayer(stripId),
431 m_idHelperSvc->cscIdHelper().measuresPhi(stripId),
432 m_idHelperSvc->cscIdHelper().strip(stripId)
433 );
434 IdentifierHash newHash;
435 m_idHelperSvc->cscIdHelper().get_channel_hash(stripId, newHash );
436 stripHash = newHash;
437 ATH_MSG_DEBUG("New hash " << stripHash);
438 }
439 else{
440 if(m_idHelperSvc->cscIdHelper().measuresPhi(stripId))
441 ATH_MSG_VERBOSE(" good id Measures Phi");
442 else
443 ATH_MSG_VERBOSE(" good id is eta");
444 }
445
446 Chrono chronoAfterId2(m_chronoSvc,"afterID2");
447
448 //Get samples. Each shows amplitude of pulse at different
449 //time slice.
450 std::vector<uint16_t> samples;
451 cluster->samples(stripItr,samplesPerStrip,samples);
452
453 //Test for threshold breach...
454 size_t sampCnt = 0;
455
456
457 for(const auto & thisSample: samples)
458 {
459 (*m_ampHists)[stripHash]->Fill(thisSample);
461 (*((*m_sampHists)[stripHash]))[sampCnt]->Fill(thisSample);
462 if(m_bitHists && sampCnt==1)
463 {
464 TH2F* prodHist = nullptr;
465 if(m_bitProds)
466 prodHist = (*m_bitProds)[stripHash];
467 if(!fillBitHist((*m_bitHists)[stripHash],thisSample, prodHist).isSuccess())
468 ATH_MSG_WARNING("Failed recording bits for strip " << stripHash);
469 }//end if(m_bitHists)
470
471 if(m_doOnlineDbFile){//m_doF001){
472 //test if any samples are obvoe the online threshold
473 if (thisSample > m_onlineThresholds[stripHash] ){
475 ATH_MSG_VERBOSE("StripHash: " << stripHash <<
476 " has online threshold breach. Sample: " << thisSample << " Thold: "
477 << m_onlineThresholds[stripHash]);
478 }
479 }
480 sampCnt++;
481 }//end Sample loop
482 }//end strip loop
483 }//end cluster loop
484 }
485 else
486 ATH_MSG_DEBUG("There is an empty rod (CscRawDataContainer).");
487 }//end rod loop
488 ATH_MSG_DEBUG("end collectEventInfo()");
489 return StatusCode::SUCCESS;
490 }// end collectEventInfo()
#define ATH_MSG_FATAL(x)
Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current CscRawDataContainer
size_t size() const
Duplicate of fullSize for backwards compatability.
StatusCode fillBitHist(TH1I *bitHist, const uint16_t &val, TH2F *bitProds)
Definition CscCalcPed.h:139
std::vector< int > m_onlineThresholds
Definition CscCalcPed.h:121
ToolHandle< Muon::ICSC_RDO_Decoder > m_cscRdoDecoderTool
Definition CscCalcPed.h:85
::StatusCode StatusCode
StatusCode definition for legacy code.
TH2F(name, title, nxbins, bins_par2, bins_par3, bins_par4, bins_par5=None, bins_par6=None, path='', **kwargs)

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::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 }

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::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< Algorithm > >::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< Algorithm > >::evtStore ( )
inlineinherited

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

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode MuonCalib::CscCalcPed::execute ( void )

Definition at line 281 of file CscCalcPed.cxx.

282 {
283 ATH_MSG_DEBUG("Begin execute");
284 //collectEventInfo collects infomation about each event by filling ampHistCollection and peaktHist.
286
287 if(!sc.isSuccess())
288 {
289 ATH_MSG_ERROR("There was an error collecting information from the RDO this event.");
290 return StatusCode::RECOVERABLE;
291 }
292 ATH_MSG_DEBUG("End execute");
293 return StatusCode::SUCCESS;
294 } //end execute()
static Double_t sc
StatusCode collectEventInfo()
event loop functions

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::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

◆ extraOutputDeps()

const DataObjIDColl & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 50 of file AthAlgorithm.cxx.

51{
52 // If we didn't find any symlinks to add, just return the collection
53 // from the base class. Otherwise, return the extended collection.
54 if (!m_extendedExtraObjects.empty()) {
56 }
57 return Algorithm::extraOutputDeps();
58}
DataObjIDColl m_extendedExtraObjects

◆ fillBitHist()

StatusCode MuonCalib::CscCalcPed::fillBitHist ( TH1I * bitHist,
const uint16_t & val,
TH2F * bitProds )
inlineprivate

Definition at line 139 of file CscCalcPed.h.

140 {
141 if(!bitHist)
142 return StatusCode::RECOVERABLE;
143
144 //Num bits should always be m_numBits
145 std::bitset<12> bitVal(val);
146
147 for(unsigned int bitIndex = 0; bitIndex < m_numBits; bitIndex++){
148 if(bitVal[bitIndex]){
149 bitHist->Fill(bitIndex);
150 if(bitProds){
151 for(unsigned int bitIndex2 = 0 ; bitIndex2 <= bitIndex ; bitIndex2++) {
152 if(bitVal[bitIndex2]){
153 bitProds->Fill(bitIndex,bitIndex2);
154 if(bitIndex != bitIndex2)
155 bitProds->Fill(bitIndex2,bitIndex);
156 }
157
158 }
159 }
160 }
161
162 }
163
164
165 return StatusCode::SUCCESS;
166 }

◆ finalize()

StatusCode MuonCalib::CscCalcPed::finalize ( void )

Definition at line 296 of file CscCalcPed.cxx.

296 {
297 if(m_eventCnt ==0)
298 {
299 ATH_MSG_FATAL("No events processed!");
300 return StatusCode::FAILURE;
301 }
302 else
303 ATH_MSG_INFO("In finalize() after analyzing " << m_eventCnt << " events ");
304
306
307 ATH_MSG_INFO("not dump all hists!");
308
309 //calculateParameters() finds means and fits gain curves from the data in
310 //m_ampHistCollection and/or m_peaktHist
312 if(!sc.isSuccess())
313 {
314 ATH_MSG_FATAL("Calculation of parameters failed!");
315 return StatusCode::FAILURE;
316 }
317 ATH_MSG_DEBUG("Finished calculating parameters");
318
319
320 //writeCalibrationFile() writes the calculated parameters into a calibration fie.
322 if(!sc.isSuccess())
323 {
324 ATH_MSG_FATAL("Calculation of parameters failed!");
325 return StatusCode::FAILURE;
326 }
327
328 //Record report (ampHists) and results to storegate for future algorithms
329 //like COOL database storage or monitoring to collect
331 if (!sc.isSuccess())
332 {
333 ATH_MSG_FATAL("Failed recording data in storegate");
334 return StatusCode::FAILURE;
335 }
336
337 ATH_MSG_INFO("Finished finalize");
338 return StatusCode::SUCCESS;
339 }//end finalize()
StatusCode calculateParameters()
Finalize functions.
StatusCode storeGateRecord()
StatusCode writeCalibrationFile()

◆ GetMinMax()

template<typename dataType>
dataType MuonCalib::CscCalcPed::GetMinMax ( std::vector< dataType > & vec)
inlineprivate

Definition at line 74 of file CscCalcPed.h.

74 {
75 const auto [pMin, pMax] = std::minmax_element(vec.begin(), vec.end());
76 return *pMax - *pMin;
77 }
std::vector< size_t > vec

◆ hashToChamberName()

StatusCode MuonCalib::CscCalcPed::hashToChamberName ( IdentifierHash ,
std::string  )
private

Utility functions.

◆ initialize()

StatusCode MuonCalib::CscCalcPed::initialize ( void )

basic required functions

Store Gate active store

Definition at line 67 of file CscCalcPed.cxx.

68 {
69 ATH_MSG_INFO("CscCalcPed::initialize() called");
70
72 ATH_MSG_FATAL("Either specify an OnlineCalibFile or set CompareOnlineCalibFile to false");
73 return StatusCode::FAILURE;
74 }
75
76 //*******Register services and tools *********/
78
79 ATH_CHECK(m_idHelperSvc.retrieve());
80
81 ATH_CHECK(m_readKey.initialize());
82
83 m_chronoSvc = service("ChronoStatSvc");
84 ATH_CHECK(m_chronoSvc.isValid());
85
87
88 //Set to SG::VIEW_ELEMENTS, since we want root to do its own memory
89 //management.
90 m_ampHists = new DataVector<TH1I>(SG::VIEW_ELEMENTS);
91 if(m_doSampleHists) m_sampHists = new DataVector< DataVector<TH1I> >;
92 if(m_doBitHists) m_bitHists = new DataVector<TH1I>(SG::VIEW_ELEMENTS);
93
94 //Loop through ids to find out what hash range we're working on (in case we're using some
95 //unusual geometry)
96 const std::vector<Identifier> &ids = m_idHelperSvc->cscIdHelper().idVector();
97
98
100
101 for(const auto &thisChamberId: ids)
102 {
103 std::vector<Identifier> stripVect;
104 m_idHelperSvc->cscIdHelper().idChannels(thisChamberId,stripVect);
105
106
107
108 for(const auto & thisStrip: stripVect)
109 {
110 IdentifierHash stripHash;
111 m_idHelperSvc->cscIdHelper().get_channel_hash(thisStrip,stripHash);
112 if((unsigned int)stripHash > m_maxStripHash)
113 m_maxStripHash = (int)stripHash;
114 }//End strip loop
115 }//end chamber loop
116
117
118 //Now creating ampHists. It wasn't done in last loop since there
119 //is no gaurantee that it will come out in strip order, and we assume
120 //later that m_ampHists's index = stripHash
121 ATH_MSG_DEBUG("Preparing ampHists. Only allowing those for " << " chamberLayer " << m_expectedChamberLayer);
122 for(unsigned int stripItr = 0 ; stripItr <=m_maxStripHash; stripItr++)
123 {
124
125 IdentifierHash stripHash =stripItr;
126 Identifier stripId;
127 IdContext channelContext = m_idHelperSvc->cscIdHelper().channel_context();
128 m_idHelperSvc->cscIdHelper().get_id(stripHash, stripId, &channelContext);
129
130 int chamLayer = m_idHelperSvc->cscIdHelper().chamberLayer(stripId);
131 if(chamLayer == m_expectedChamberLayer) //Only second chamber layer exists
132 {
133 int stationEta = m_idHelperSvc->cscIdHelper().stationEta(stripId);
134 int stationPhi = m_idHelperSvc->cscIdHelper().stationPhi(stripId);
135 int stripNumber = m_idHelperSvc->cscIdHelper().strip(stripId);
136 int wireLayer = m_idHelperSvc->cscIdHelper().wireLayer(stripId);
137 char orientation = m_idHelperSvc->cscIdHelper().measuresPhi(stripId) ? 'Y':'X';
138
139
140 char name[30],titleSeed[600];
141 TH1I* hist = nullptr;
142
143 int stationName = m_idHelperSvc->cscIdHelper().stationName(stripId);
144 //Amplitude histogram
145 sprintf(name, "ampHist%u",stripItr);
146 sprintf(titleSeed, "Amplitude Histogram for eta %d, sector %d, layer %d%c, strip %d",
147 stationEta,(2*stationPhi+50 - stationName),wireLayer,orientation,stripNumber);
148 std::string title = m_titlePrefix + titleSeed + m_titlePostfix;
149
150 hist = new TH1I(name,title.c_str(),m_ampHistNumBins,m_ampHistLowBound,
152 hist->GetXaxis()->SetTitle("Amplitude (ADC value)");
153 hist->GetYaxis()->SetTitle("Counts");
154 m_ampHists->push_back(hist);
155
156 if(m_doSampleHists) {
157 DataVector<TH1I>* tempVect = new DataVector<TH1I>(SG::VIEW_ELEMENTS);
158 for(int cnt = 0; cnt < m_numSamplesExpected ; cnt++) {
159 sprintf(name, "sampHist%u_%d",stripItr,cnt);
160 sprintf(titleSeed, "Amplitude Histogram for eta %d, sector %d, layer %d%c, strip %d, sample %d",
161 stationEta,(2*stationPhi+50 - stationName),wireLayer,orientation,stripNumber,cnt);
162
163 hist = new TH1I(name,title.c_str(),m_ampHistNumBins,m_ampHistLowBound,
165 tempVect->push_back(hist);
166
167 }
168 m_sampHists->push_back(tempVect);
169 }
170
171 if(m_bitHists)
172 {
173 //Bit histogram (for looking for stuck-bits)
174 sprintf(name, "bitHist%u",stripItr);
175 sprintf(titleSeed, "Bit histogram for eta %d, sector %d, layer %d%c strip %d",
176 stationEta,(2*stationPhi+50 - stationName),wireLayer,orientation,stripNumber);
177 title = m_titlePrefix + titleSeed + m_titlePostfix;
178 hist = new TH1I(name, title.c_str(), m_numBits, 0, m_numBits); //12 bits
179 hist->GetXaxis()->SetTitle("Bit");
180 hist->GetYaxis()->SetTitle("Counts");
181 m_bitHists->push_back(hist);
182 if(m_doCorrelation) {
183 (*m_bitProds)[stripItr] = new TH2F(TString::Format("bitProds%d",stripItr),"Bit products", m_numBits,0,m_numBits, m_numBits, 0, m_numBits);
184
185 }
186 }
187 }
188 else
189 {
190 m_ampHists->push_back(nullptr);
191 if(m_bitHists) m_bitHists->push_back(nullptr);
192 if(m_doSampleHists) m_sampHists->push_back(nullptr);
193 }
194 }//end strip loop
195
196 //Setup result collections. These will be passed to storegate for any monitoring later
197 m_peds = new CscCalibResultCollection("ped");
198 m_noises = new CscCalibResultCollection("noise");
199 m_rmses = new CscCalibResultCollection("rms");
200 if(m_doF001){
201 ATH_MSG_DEBUG("Doing f001");
202 //For f001 values
203 m_f001s = new CscCalibResultCollection("f001");
204
205 //Initializing for comparing new values to an online database file
207
208 //How many samples failed the online threshold test of f001 +2*RMS
209 //(f001 and RMS read from a file from online configuration db)
210 m_onlineTHoldBreaches = new CscCalibResultCollection("OnlTHoldBreaches");
211
212
213
214 //Vector we use to count the online thresholds
216
217 //Retrieve current online thresholds
219 std::ifstream ifile; ifile.open(m_onlineDbFile.c_str());
220 if(!ifile.is_open()){
221 ATH_MSG_FATAL("Failed to open online database file " << m_onlineDbFile);
222 return StatusCode::FAILURE;
223 }
224 std::string buf;
225 ifile >> buf; // skip 32 at start of file
226 unsigned int onlineId;
227 unsigned int hashId;
228 double rms;
229 double f001;
230
231 if(!ifile){
232 ATH_MSG_FATAL("Problem with file after one word read in.");
233 return StatusCode::FAILURE;
234 }
235
236
237 ATH_MSG_DEBUG("Reading in online thresholds from file " << m_onlineDbFile);
238 ATH_MSG_DEBUG("First (junk) word: " << buf);
239 int chanCnt = 0;
240 while(ifile >> std::hex >> onlineId >> std::dec) {
241 chanCnt++;
242 onlineToOfflineHashId(onlineId,hashId);
243
244 ifile >> buf >> buf >> buf >> buf >> rms >> buf >> f001;
245 double thold = f001 + 2*rms;
246 ATH_MSG_VERBOSE("onlid: " << std::hex << onlineId << std::dec << " hash: " << hashId << " rms: " << rms << " f001: " << f001 << " thold: " << thold);
247 m_onlineThresholds.at(hashId) = thold;
248 if(!ifile)
249 ATH_MSG_VERBOSE("input file is done, ready to close!");
250 else
251 ATH_MSG_VERBOSE("Input file still good!");
252
253
254 }
255 if(chanCnt != 30720){
256 ATH_MSG_FATAL("Did not retrieve expected 30720 channels from online database! Retrieved: " << chanCnt);
257 ATH_MSG_FATAL("Last onlineId read: " << std::hex << onlineId << std::dec);
258 return StatusCode::FAILURE;
259 }
260
261 }//if m_doOnlineDBFile
262 }//db file
263
264 ATH_MSG_INFO("highest strip hash id is " << m_maxStripHash);
265
266 //If we're doing correlation plots, set up the product histogram array
267 if(m_doCorrelation){
268 m_bitProds = new DataVector<TH2F>(SG::VIEW_ELEMENTS);
269 m_bitProds->resize(m_maxStripHash+1);
270 }
271
272
273
274
275
276 ATH_MSG_INFO("m_prods value: " << m_bitProds << "\ndoCorrelation" << m_doCorrelation);
277 return StatusCode::SUCCESS;
278 }
#define ATH_CHECK
Evaluate an expression and check for errors.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
void onlineToOfflineHashId(const unsigned int &onlineId, unsigned int &hashId) const
constexpr uint8_t stationPhi
station Phi 1 to 8
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::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.

◆ makeBitCorrelation()

DataVector< TH2F > * MuonCalib::CscCalcPed::makeBitCorrelation ( )
private

Definition at line 856 of file CscCalcPed.cxx.

856 {
857
858 if(!m_bitProds || !m_bitHists)
859 return nullptr;
860
861 DataVector<TH2F> * correlations = new DataVector<TH2F>(SG::VIEW_ELEMENTS);
862 correlations->resize(m_maxStripHash +1);
863
864 for(unsigned int hashItr =0; hashItr <= m_maxStripHash; hashItr++) {
865 IdentifierHash stripHash =hashItr;
866 Identifier stripId;
867 IdContext channelContext = m_idHelperSvc->cscIdHelper().channel_context();
868 m_idHelperSvc->cscIdHelper().get_id(stripHash, stripId, &channelContext);
869
870 int chamLayer = m_idHelperSvc->cscIdHelper().chamberLayer(stripId);
871 if(chamLayer == m_expectedChamberLayer) //Only second chamber layer exists
872 {
873 int stationName = m_idHelperSvc->cscIdHelper().stationName(stripId);
874 //int stationEta = m_idHelperSvc->cscIdHelper().stationEta(stripId);
875 int stationPhi = m_idHelperSvc->cscIdHelper().stationPhi(stripId);
876 int stripNumber = m_idHelperSvc->cscIdHelper().strip(stripId);
877 int wireLayer = m_idHelperSvc->cscIdHelper().wireLayer(stripId);
878 char orientation = m_idHelperSvc->cscIdHelper().measuresPhi(stripId) ? 'Y':'X';
879
880 int sector = 2*stationPhi + 50 - stationName;
881
882 std::stringstream name;
883 name << "h_bitCorr_sector_" << std::setfill('0') << std::setw(2) << sector <<
884 "_lay_" << wireLayer << orientation << "_strip_" << std::setw(3) << stripNumber;
885 std::stringstream title;
886 title << "h_bitCorr_sector_" << std::setfill('0') << std::setw(2) << sector <<
887 "_lay_" << wireLayer << orientation << "_strip_" << std::setw(3) << stripNumber;
888
889 TH2F* correlationHist = new TH2F(
890 name.str().c_str(),
891 title.str().c_str(),
894 );
895 (*correlations)[hashItr] = correlationHist;
896
897 //each amphis is filled exaclty the number of times the bits are sampled,
898 //so its a good place to get n
899 double n = (*m_ampHists)[hashItr]->GetEntries();
900 TH1I * bitHist = (*m_bitHists)[hashItr];
901 TH2F * bitProds = (*m_bitProds)[hashItr];
902 for(unsigned int bit1 = 1; bit1 <=m_numBits; bit1++){
903 for(unsigned int bit2 = 1; bit2 <=bit1; bit2++){
904
905 float xy = bitProds->GetBinContent(bit1,bit2);
906 float x = bitHist->GetBinContent(bit1);
907 float y = bitHist->GetBinContent(bit2);
908
909 float r;
910 float denom = (n*x-x*x)*(n*y-y*y);
911 if(denom <= 0 )
912 r= 0;
913 else
914 r = (n*xy - x*y)/std::sqrt(denom);
915
916 //Pearson r
917 correlationHist->SetBinContent(bit1,bit2,r);
918 if(bit1!=bit2)
919 correlationHist->SetBinContent(bit2,bit1,r);
920
921
922 }
923 }
924 }
925 }
926 return correlations;
927 }//end makeBitCorrelations
#define y
#define x
void resize(size_type sz)
Resizes the collection to the specified number of elements.
int r
Definition globals.cxx:22

◆ msg()

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msgLvl()

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

Definition at line 30 of file AthCommonMsg.h.

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

◆ onlineToOfflineHashId()

void MuonCalib::CscCalcPed::onlineToOfflineHashId ( const unsigned int & onlineId,
unsigned int & hashId ) const
private

Definition at line 930 of file CscCalcPed.cxx.

931 {
932 int stationName = ((onlineId >> 16)&0x1) + 50;
933 int phi = ((onlineId >> 13)&0x7)+1;
934 int eta = ((((onlineId >> 12)&0x1) == 1) ? 1:-1);
935 int chamLay = ((onlineId>>11)&0x1) +1;
936 int wireLay = ((onlineId>>9)&0x3) +1;
937 int measuresPhi = ((onlineId >> 8)&0x1);
938 int strip;
939
940 // Online and offline phi ids are flipped on A wheel
941 if( measuresPhi && eta == 1){
942 strip = 48 - ((onlineId)&0xff) ; //equivalent: 49 -( onlineId&0xff +1)
943 }
944 else {
945 strip = ((onlineId)&0xff) +1;
946 }
947
948 Identifier chanId = m_idHelperSvc->cscIdHelper().channelID(stationName,eta,phi,chamLay,wireLay,measuresPhi,strip);
949
950 IdentifierHash chanHash;
951 m_idHelperSvc->cscIdHelper().get_channel_hash(chanId, chanHash);
952
953 hashId = (unsigned int)chanHash;
954
955 }
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::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.

◆ outputParameter3()

void MuonCalib::CscCalcPed::outputParameter3 ( const CscCalibResultCollection & results,
std::ofstream & out )
private

Definition at line 767 of file CscCalcPed.cxx.

767 {
768
769 SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey};
770 const CscCondDbData* readCdo{*readHandle};
771
772 out << "\n";
773 out << "<NEW_PAR> " << results.parName() << "\n";
774 std::string idString;
775
778 for(; resItr != resEnd; ++resItr){
779 unsigned int hashId = (*resItr)->hashId();
780 double value = (*resItr)->value();
781 std::string idString;
782
783 readCdo->indexToStringId(&m_idHelperSvc->cscIdHelper(), hashId, "CHANNEL", idString).ignore();
784
785 out << idString << " " << value << "\n";
786 }
787
788 out << "<END_PAR>" ;
789 }
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838

◆ 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< Algorithm > >::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< Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ storeGateRecord()

StatusCode MuonCalib::CscCalcPed::storeGateRecord ( )
private

Definition at line 795 of file CscCalcPed.cxx.

796 {
797 StatusCode sc = StatusCode::SUCCESS;
798
799 bool thereIsAnError = false;
800
801 std::string histKey = "cscPedCalibReport";
802 ATH_MSG_DEBUG("Recording pedestal amplitude histograms to TDS with key " << histKey);
803
804 //CscCalibReport has extraraneous monitoring information
805 CscCalibReportPed * report = new CscCalibReportPed("pedAmps");
806 report->setPedAmpHists(m_ampHists); //report now has ownership of the DataVector
807 report->setBitHists(m_bitHists); //report now has ownership of the DataVector
808 if(m_doSampleHists){
809 report->setSampHists(m_sampHists);
810 }
811 if(m_bitProds){
812 report->setBitCorrelation( makeBitCorrelation());
813 }
814
815 CscCalibReportContainer * repCont = new CscCalibReportContainer(histKey);
816 repCont->push_back(report);
817
818 sc = evtStore()->record(repCont, histKey);
819 if(!sc.isSuccess())
820 {
821 ATH_MSG_ERROR("Failed to record CscCalibReportPed to storegate");
822 thereIsAnError = true;
823 delete repCont;
824 }
825
826
827 //CscCalibResult contains the actual parameters that we recorded, mostly things that should be entered
828 //into cool
829 std::string key = "CscCalibResultPed";
830 ATH_MSG_DEBUG("Recording calibration results to TDS with key " << key);
831
832 CscCalibResultContainer * calibResults
833 = new CscCalibResultContainer("CscCalibResultPed");
834 calibResults->push_back(m_peds);
835 calibResults->push_back(m_noises);
836 calibResults->push_back(m_rmses);
837 calibResults->push_back(m_f001s);
839 calibResults->push_back(m_onlineTHoldBreaches);
840
841 sc = evtStore()->record(calibResults,key);
842 if(!sc.isSuccess())
843 {
844 ATH_MSG_ERROR("Failed to record data to storegate");
845 thereIsAnError = true;
846 delete calibResults;
847 }
848
849 if(thereIsAnError)
850 return StatusCode::RECOVERABLE;
851
852 return StatusCode::SUCCESS;
853 }
DataVector< TH2F > * makeBitCorrelation()
list report
Definition checkTP.py:125

◆ sysInitialize()

StatusCode AthAlgorithm::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, and PyAthena::Alg.

Definition at line 66 of file AthAlgorithm.cxx.

66 {
68
69 if (sc.isFailure()) {
70 return sc;
71 }
72 ServiceHandle<ICondSvc> cs("CondSvc",name());
73 for (auto h : outputHandles()) {
74 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
75 // do this inside the loop so we don't create the CondSvc until needed
76 if ( cs.retrieve().isFailure() ) {
77 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
78 return StatusCode::SUCCESS;
79 }
80 if (cs->regHandle(this,*h).isFailure()) {
81 sc = StatusCode::FAILURE;
82 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
83 << " with CondSvc");
84 }
85 }
86 }
87 return sc;
88}
virtual StatusCode sysInitialize() override
Override sysInitialize.
AthCommonDataStore(const std::string &name, T... args)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Algorithm > >::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< Algorithm > >::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

◆ writeCalibrationFile()

StatusCode MuonCalib::CscCalcPed::writeCalibrationFile ( )
private

Definition at line 579 of file CscCalcPed.cxx.

580 {
581 Chrono chrono(m_chronoSvc,"writeFile");
582 //***Take conditions data held in summary histograms and print to the calibration file***//
583 ATH_MSG_INFO("Parameters calculated, preparing to output to file: " << m_outputFileName << " Types 1 and " << m_calOutputVersion);
584
586
587 if(m_calOutputVersion == "00-00"){
588 return calOutput0();
589 }
590 else if(m_calOutputVersion == "03-00") {
591 return calOutput3();
592 }
593 else{
594 ATH_MSG_WARNING("Don't know how to write calibration file version " << m_calOutputVersion);
595 return StatusCode::RECOVERABLE;
596 }
597 // this part of the code cannot be reached since one of the if statements before already exits the code
598 // return StatusCode::SUCCESS;
599 }
StatusCode calOutput1()
StatusCode calOutput3()
StatusCode calOutput0()

Member Data Documentation

◆ m_ampHistHighBound

unsigned int MuonCalib::CscCalcPed::m_ampHistHighBound
private

Definition at line 105 of file CscCalcPed.h.

◆ m_ampHistLowBound

unsigned int MuonCalib::CscCalcPed::m_ampHistLowBound
private

Definition at line 105 of file CscCalcPed.h.

◆ m_ampHistNumBins

unsigned int MuonCalib::CscCalcPed::m_ampHistNumBins
private

Definition at line 105 of file CscCalcPed.h.

◆ m_ampHists

DataVector<TH1I>* MuonCalib::CscCalcPed::m_ampHists
private

Definition at line 116 of file CscCalcPed.h.

◆ m_bitCorrelation

DataVector<TH1F>* MuonCalib::CscCalcPed::m_bitCorrelation
private

Definition at line 120 of file CscCalcPed.h.

◆ m_bitHists

DataVector<TH1I>* MuonCalib::CscCalcPed::m_bitHists
private

Definition at line 118 of file CscCalcPed.h.

◆ m_bitProds

DataVector<TH2F>* MuonCalib::CscCalcPed::m_bitProds
private

Definition at line 119 of file CscCalcPed.h.

◆ m_calOutputVersion

std::string MuonCalib::CscCalcPed::m_calOutputVersion
private

Definition at line 92 of file CscCalcPed.h.

◆ m_chronoSvc

SmartIF<IChronoStatSvc> MuonCalib::CscCalcPed::m_chronoSvc
private

Definition at line 84 of file CscCalcPed.h.

◆ m_cmt_parameter

std::string MuonCalib::CscCalcPed::m_cmt_parameter
private

Definition at line 132 of file CscCalcPed.h.

◆ m_crossTalkFix

double* MuonCalib::CscCalcPed::m_crossTalkFix
private

Definition at line 129 of file CscCalcPed.h.

◆ m_cscRdoDecoderTool

ToolHandle<Muon::ICSC_RDO_Decoder> MuonCalib::CscCalcPed::m_cscRdoDecoderTool {this,"CscRdoDecoderTool","Muon::CscRDO_Decoder"}
private

Definition at line 85 of file CscCalcPed.h.

85{this,"CscRdoDecoderTool","Muon::CscRDO_Decoder"};

◆ m_detStore

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

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_doBitHists

bool MuonCalib::CscCalcPed::m_doBitHists
private

Definition at line 109 of file CscCalcPed.h.

◆ m_doCorrelation

bool MuonCalib::CscCalcPed::m_doCorrelation
private

Definition at line 93 of file CscCalcPed.h.

◆ m_doF001

bool MuonCalib::CscCalcPed::m_doF001
private

Definition at line 114 of file CscCalcPed.h.

◆ m_doOnlineDbFile

bool MuonCalib::CscCalcPed::m_doOnlineDbFile
private

Definition at line 134 of file CscCalcPed.h.

◆ m_doSampleHists

bool MuonCalib::CscCalcPed::m_doSampleHists
private

Definition at line 110 of file CscCalcPed.h.

◆ m_eventCnt

int MuonCalib::CscCalcPed::m_eventCnt
private

Definition at line 128 of file CscCalcPed.h.

◆ m_evtStore

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

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_expectedChamberLayer

int MuonCalib::CscCalcPed::m_expectedChamberLayer
private

Definition at line 98 of file CscCalcPed.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.h.

◆ m_f001s

CscCalibResultCollection* MuonCalib::CscCalcPed::m_f001s
private

Definition at line 126 of file CscCalcPed.h.

◆ m_idHelperSvc

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

Services and tools.

Definition at line 83 of file CscCalcPed.h.

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

◆ m_maxStripHash

unsigned int MuonCalib::CscCalcPed::m_maxStripHash
private

Internally global variables.

Definition at line 103 of file CscCalcPed.h.

◆ m_noises

CscCalibResultCollection* MuonCalib::CscCalcPed::m_noises
private

Definition at line 124 of file CscCalcPed.h.

◆ m_numBits

const unsigned int MuonCalib::CscCalcPed::m_numBits
private

Definition at line 107 of file CscCalcPed.h.

◆ m_numSamplesExpected

int MuonCalib::CscCalcPed::m_numSamplesExpected
private

Definition at line 112 of file CscCalcPed.h.

◆ m_onlineDbFile

std::string MuonCalib::CscCalcPed::m_onlineDbFile
private

filename for file with online database information

Definition at line 100 of file CscCalcPed.h.

◆ m_onlineTHoldBreaches

CscCalibResultCollection* MuonCalib::CscCalcPed::m_onlineTHoldBreaches
private

Definition at line 127 of file CscCalcPed.h.

◆ m_onlineThresholdFailureCount

std::vector<int> MuonCalib::CscCalcPed::m_onlineThresholdFailureCount
private

Definition at line 122 of file CscCalcPed.h.

◆ m_onlineThresholds

std::vector<int> MuonCalib::CscCalcPed::m_onlineThresholds
private

Definition at line 121 of file CscCalcPed.h.

◆ m_outputFileName

std::string MuonCalib::CscCalcPed::m_outputFileName
private

Parameters input through joboptions.

Definition at line 90 of file CscCalcPed.h.

◆ m_peds

CscCalibResultCollection* MuonCalib::CscCalcPed::m_peds
private

Definition at line 123 of file CscCalcPed.h.

◆ m_readKey

SG::ReadCondHandleKey<CscCondDbData> MuonCalib::CscCalcPed::m_readKey {this, "ReadKey", "CscCondDbData", "Key of CscCondDbData"}
private

Definition at line 86 of file CscCalcPed.h.

86{this, "ReadKey", "CscCondDbData", "Key of CscCondDbData"};

◆ m_rmses

CscCalibResultCollection* MuonCalib::CscCalcPed::m_rmses
private

Definition at line 125 of file CscCalcPed.h.

◆ m_sampHists

DataVector< DataVector<TH1I> >* MuonCalib::CscCalcPed::m_sampHists
private

Definition at line 117 of file CscCalcPed.h.

◆ m_thresholdMultiplier

float MuonCalib::CscCalcPed::m_thresholdMultiplier
private

Definition at line 97 of file CscCalcPed.h.

◆ m_titlePostfix

std::string MuonCalib::CscCalcPed::m_titlePostfix
private

Definition at line 91 of file CscCalcPed.h.

◆ m_titlePrefix

std::string MuonCalib::CscCalcPed::m_titlePrefix
private

Definition at line 91 of file CscCalcPed.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: