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

does calibration of the CSC chambers More...

#include <CscCalcSlope.h>

Inheritance diagram for MuonCalib::CscCalcSlope:

Public Member Functions

 CscCalcSlope (const std::string &name, ISvcLocator *pSvcLocator)
 ~CscCalcSlope ()=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 ()
StatusCode makeCalibPoints ()
 Utility functions.
double calShape (double *x, double *par)
StatusCode calOutput0 ()
StatusCode calOutput3 ()
void outputParameter3 (const CscCalibResultCollection &results, std::ofstream &out)
StatusCode fillBitHist (TH1I *bitHist, const uint16_t &val)
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ToolHandle< ICscCalibToolm_cscCalibTool {this, "CscCalibTool", "CscCalibTool"}
 Services and tools.
ToolHandle< Muon::ICSC_RDO_Decoderm_cscRdoDecoderTool {this,"CscRDODecoder","Muon::CscRDO_Decoder"}
ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
SmartIF< IChronoStatSvc > m_chronoSvc
SG::ReadCondHandleKey< CscCondDbDatam_readKey {this, "ReadKey", "CscCondDbData", "Key of CscCondDbData"}
std::string m_outputFileName
 Parameters input through joboptions.
std::string m_calOutputVersion
double m_minDeltaAdc
bool m_dumpAllHists
bool m_ignoreDatabaseError
bool m_doBitHists
std::string m_titlePrefix
std::string m_titlePostfix
unsigned int m_maxStripHash
 Internally global variables.
int m_lastPulserLevel
DataVector< DataVector< TProfile > > * m_fracProfs
DataVector< DataVector< TGraph > > * m_fracGraphs
std::vector< TH1I * > m_bitHists
std::vector< float > m_fitReturns
TGraph * m_resGraph
std::vector< TGraphErrors * > m_calGraphs
TProfile * m_currentAmpProf
std::map< int, TProfile * > m_ampProfs
std::set< int > m_pulsedChambers
int m_eventCnt
 coherent correction array has the corrections to the coherently pulsed channels to get the basic channels
CscCalibResultCollectionm_slopes
CscCalibResultCollectionm_intercepts
BipolarFit m_bipolarFit
bool m_doBipolarFit
std::array< double, 24 > m_crossTalkFix {}
bool m_doCrossTalkFix
std::vector< float > m_dbLevels
float * m_peds
float * m_noises
bool m_pedFile
std::string m_pedFileName
int m_expectedChamberLayer
std::string m_calFitFunc
bool m_findPeakTime
TProfile * m_peakTimeProf
CscCalibResultCollectionm_peakTimes
bool m_doLinPlot
std::string m_cmd_parameters
unsigned int m_numBits
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

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

Definition at line 52 of file CscCalcSlope.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

◆ CscCalcSlope()

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

Definition at line 27 of file CscCalcSlope.cxx.

27 :
28 AthAlgorithm(name,pSvcLocator),
29 m_outputFileName("output.cal"),
30 m_dumpAllHists(false),
33 m_fracProfs(nullptr),
34 m_fracGraphs(nullptr),
35 m_resGraph(nullptr),
36 m_currentAmpProf(nullptr),
37 m_eventCnt(0),
38 m_slopes(nullptr),
39 m_intercepts(nullptr),
40 m_peds(nullptr),
41 m_noises(nullptr),
42 m_peakTimeProf(nullptr),
43 m_peakTimes(nullptr),
44 m_numBits(12)
45 {
46 declareProperty("OutputFile", m_outputFileName = "");
47 declareProperty("IgnoreDatabaseError",m_ignoreDatabaseError = false); //Set to true to ignore database errors
48 declareProperty("TitlePrefix",m_titlePrefix = ""); //Prefix appended to title of histograms and graphs
49 declareProperty("TitlePostfix",m_titlePostfix = ""); //Postfix appended to title of histograms and graphs
50
51 //test parameters
52 declareProperty("DoBipolarFit", m_doBipolarFit = true);
53 declareProperty("DoCrossTalkFix",m_doCrossTalkFix = true);
54
55 declareProperty("GetPedFromFile",m_pedFile = false);
56 declareProperty("PedFileName",m_pedFileName = "");
57
58 declareProperty("ExpectedChamberLayer", m_expectedChamberLayer = 2);
59
60 declareProperty("DoLinPlot" , m_doLinPlot = false);
61 declareProperty("CalibFitFunction" , m_calFitFunc = "[0] + [1]*10^(x/-20)");
62 declareProperty("MinDeltaAdc",m_minDeltaAdc = 10, "Minimum change in ADC a calgraph needs to drop for a fit lower bound to be set");
63
64 /*
65 ADC = mC(db) = m*C_max*10^(db/20) + intercept // C_max = maximum charge
66
67 we divide by c_max later to get m (the function as in m_calFitFunc has
68 [1] = max ADC, so we divide max charge to get
69
70 since attenuation is negative
71
72 db = -20 log(ADC+intercept/mC_max)
73
74 db = -20 log(ADC - intercept / mC_max)
75
76 (-20 since V^2 gives power disipation)
77
78 */
79
80 declareProperty("FindPeakTime", m_findPeakTime = true);
81 declareProperty("DoBitHists", m_doBitHists = true);
82
83 declareProperty("CalOutputVersion", m_calOutputVersion="03-00");
84
85 m_crossTalkFix[0] = 1.0322840930;
86 m_crossTalkFix[1] = 1.0422690324;
87 m_crossTalkFix[2] = 1.0235384586;
88 m_crossTalkFix[3] = 1.0183445962;
89 m_crossTalkFix[4] = 1.0151409212;
90 m_crossTalkFix[5] = 1.0152511102;
91 m_crossTalkFix[6] = 1.0103618910;
92 m_crossTalkFix[7] = 1.0113985580;
93 m_crossTalkFix[8] = 1.0040464232;
94 m_crossTalkFix[9] = 1.0049431193;
95 m_crossTalkFix[10] = 0.9997829589;
96 m_crossTalkFix[11] = 1.0003994005;
97 m_crossTalkFix[12] = 0.9826108255;
98 m_crossTalkFix[13] = 0.9850002836;
99 m_crossTalkFix[14] = 0.9831852065;
100 m_crossTalkFix[15] = 0.9826508145;
101 m_crossTalkFix[16] = 0.9804885017;
102 m_crossTalkFix[17] = 0.9811262196;
103 m_crossTalkFix[18] = 0.9784119832;
104 m_crossTalkFix[19] = 0.9777689757;
105 m_crossTalkFix[20] = 0.9704773978;
106 m_crossTalkFix[21] = 0.9738781078;
107 m_crossTalkFix[22] = 0.9710430303;
108 m_crossTalkFix[23] = 0.9743144079;
109 }
AthAlgorithm()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
std::string m_outputFileName
Parameters input through joboptions.
CscCalibResultCollection * m_peakTimes
std::array< double, 24 > m_crossTalkFix
CscCalibResultCollection * m_intercepts
CscCalibResultCollection * m_slopes
std::string m_calOutputVersion
int m_eventCnt
coherent correction array has the corrections to the coherently pulsed channels to get the basic chan...
DataVector< DataVector< TProfile > > * m_fracProfs
unsigned int m_maxStripHash
Internally global variables.
DataVector< DataVector< TGraph > > * m_fracGraphs

◆ ~CscCalcSlope()

MuonCalib::CscCalcSlope::~CscCalcSlope ( )
default

Member Function Documentation

◆ calculateParameters()

StatusCode MuonCalib::CscCalcSlope::calculateParameters ( )
private

Finalize functions.

Definition at line 518 of file CscCalcSlope.cxx.

519 {
520 Chrono chrono(m_chronoSvc,"calculateParameters");
521 StatusCode sc;
522 ATH_MSG_INFO("Calculating calibration constants.");
523
524 unsigned int numCalibPoints = m_ampProfs.size();
525 ATH_MSG_INFO("There are " << numCalibPoints << " pulser levels to evaluate.");
526
527 IdContext channelContext = m_idHelperSvc->cscIdHelper().channel_context();
528
529 float chargeMax = 530.88; //in fC
530
531 int crossTalkCnt = 0;
532
533 for(unsigned int stripHash = 0 ;stripHash <= m_maxStripHash; stripHash++)
534 {
535
536 if(true)//stripHash < 50 || stripHash%1000 == 0)
537 {
538 ATH_MSG_INFO("Analyzing strip with hash " << stripHash << " out of " << m_maxStripHash);
539 }
540
541 //**Now tackle slope calculation
542
543
544 Identifier id;
545 m_idHelperSvc->cscIdHelper().get_id((IdentifierHash)stripHash,id,&channelContext);
546 int chamberLayer = m_idHelperSvc->cscIdHelper().chamberLayer(id);
547 char orientation = (m_idHelperSvc->cscIdHelper().measuresPhi(id) ? 'Y':'X');
548
549 int wireLayer = m_idHelperSvc->cscIdHelper().wireLayer(id);
550
551
552 int stationName = m_idHelperSvc->cscIdHelper().stationName(id);
553 int stationPhi = m_idHelperSvc->cscIdHelper().stationPhi(id);
554 int stationEta = m_idHelperSvc->cscIdHelper().stationEta(id);
555 int stripNumber = m_idHelperSvc->cscIdHelper().strip(id);
556
557 IdentifierHash chamHash;
558 m_idHelperSvc->cscIdHelper().get_module_hash(id,chamHash);
559
560 if(chamberLayer != m_expectedChamberLayer)
561 continue;
562
564 {
565 if(m_peakTimeProf->GetBinEntries(stripHash+1)) //See if any peaking times were recorded for strip
566 {
567 float peakt = m_peakTimeProf->GetBinContent(stripHash+1);
568 float peaktError = m_peakTimeProf->GetBinError(stripHash+1);
569 CscCalibResult * peaktResult = new CscCalibResult(stripHash,peakt, peaktError);
570 m_peakTimes->push_back(peaktResult);
571 }
572 }//end if(m_findPeakTime)
573
574 //Don't find slope for this strip if it is a transverse strip
575 if(orientation != 'X')
576 continue;
577
578 //For removing plateau's from fit
579 bool foundMin(false);
580 double fitMinX = 0;
581 double fitMaxX = 0;
582 double lastVal = -1;
583 double lastDrop=0;
584 double thisDrop=0;
585
586
587 TGraphErrors * calGraph = new TGraphErrors(numCalibPoints); //calGraph will be what the gain will be found on
588 char calName[20],titleSeed[500];
589 sprintf(calName, "calGraph%u",stripHash);
590 sprintf(titleSeed, "Calgraph for eta %d, sector %d, layer %d%c, strip %d",stationEta,(2*stationPhi+50 - stationName),wireLayer,orientation, stripNumber);
591 calGraph->SetName(calName);
592 std::string title = m_titlePrefix + titleSeed + m_titlePostfix;
593 calGraph->SetTitle(title.c_str());
594 calGraph->GetYaxis()->SetTitle("ADC counts");
595 calGraph->GetXaxis()->SetTitle("Attenuation (-db)");
596
597 ATH_MSG_DEBUG(" Generating " << title);
598
599 bool isGoodStrip = false;
600
601 //Loop over all attenuation levels, filling the calGraph with the amplitudes
602 //for this strip
603 ATH_MSG_DEBUG("Number of ampProfs " << m_ampProfs.size());
604 int calPointItr = 0;
605 for(const auto & [pulserLevel, pAmplitudeProfile] : m_ampProfs)
606 {
607 if(!pAmplitudeProfile){
608 ATH_MSG_FATAL("Failed at accessing ampProf!");
609 return StatusCode::FAILURE;
610 }
611 ATH_MSG_DEBUG("\tLooking for data for pulser level "
612 << pulserLevel);
613
614 if(pAmplitudeProfile->GetBinEntries(stripHash+1))
615 {
616
617 ATH_MSG_VERBOSE("\nHave data for strip " << stripHash);
618
619 isGoodStrip = true;
620
621
622 float adcValue = pAmplitudeProfile->GetBinContent(stripHash+1);
623 float adcError = pAmplitudeProfile->GetBinError(stripHash+1);
625 {
626 ATH_MSG_VERBOSE("\tCrosstalk fix " << m_crossTalkFix[crossTalkCnt]);
627 adcValue /= m_crossTalkFix[crossTalkCnt];
628 adcError /= m_crossTalkFix[crossTalkCnt];
629 }
630 if(adcError != adcError)
631 adcError = 0.01;
632
633 float db = m_dbLevels[pulserLevel];
634
635
636 float attenValue =0;
637 if(m_doLinPlot)
638 attenValue = 300*std::pow(10,db/20);
639 else
640 attenValue = db;
641
642 ATH_MSG_DEBUG("\tStoring at db of " << db << " with attenValue " << attenValue << " from pulser level of " << pulserLevel << " and adcValue " << adcValue);
643
644
645
646 //See if the last two drops were far down enough
647 if(!foundMin){
648 thisDrop = lastVal - adcValue;
649 ATH_MSG_DEBUG("\tFinding fit min:"
650 << "\tlastVal = " << lastVal
651 << ";lastDrop " << lastDrop << "; thisDrop " << thisDrop);
652 if(thisDrop > m_minDeltaAdc && lastDrop > m_minDeltaAdc){
653 ATH_MSG_DEBUG("Found fitMin!");
654 foundMin = true;
655 fitMinX = attenValue;
656 }
657 else{
658 //Not enough deltaADC, store this iterations values for the next loop
659 lastDrop = thisDrop;
660 lastVal = adcValue;
661 }
662 }
663
664 //Use highest attenuation level as fitMaxX
665 if(attenValue > fitMaxX)
666 fitMaxX = attenValue;
667
668 calGraph->SetPoint(calPointItr,attenValue,adcValue);
669 calGraph->SetPointError(calPointItr,0.01,adcError);
670 calPointItr++;
671 }//done if(entries >0)
672
673 }//Done ampProfItr loop
674
675 if(!foundMin && isGoodStrip){
676 ATH_MSG_WARNING("Failed to find minium for " << title);
677 }
678
679 //***Do a simple fit to calGraph***
680 //Here we only fit the linear part of the plot. m_fitCutoff can be set by user.
681 if(isGoodStrip)
682 {
683 ATH_MSG_INFO("we have a good stripHash at " << stripHash);
684
685 m_pulsedChambers.insert(chamHash); //Programer note: Only gets filled on x-axis. Probably OK.
686
687 float slope, slopeError, intercept, interceptError, chiSquared;
688 int ndf;
689 int fitRet=0;
690
691 //Setup our gain fit function
692 TF1 myFunc("myFunction", m_calFitFunc.c_str(), fitMinX, fitMaxX);
693 myFunc.SetLineColor(kRed);
694 if(m_doLinPlot)
695 {
696 myFunc.SetParameters(0,5);
697 slope = myFunc.GetParameter(1);
698 slopeError = myFunc.GetParError(1);
699 intercept = myFunc.GetParameter(0);
700 interceptError = myFunc.GetParError(0);
701 chiSquared = myFunc.GetChisquare();
702 ndf = myFunc.GetNDF();
703 }
704 else
705 {
706 myFunc.SetParameters(0.1,2000);
707
708 fitRet = calGraph->Fit(&myFunc,"RV");
709
710 slope = myFunc.GetParameter(1)/chargeMax;
711 slopeError = myFunc.GetParError(1);
712 intercept = myFunc.GetParameter(0);
713 interceptError = myFunc.GetParError(0);
714 chiSquared = myFunc.GetChisquare();
715 ndf = myFunc.GetNDF();
716 }
717
718 float invertedSlope;
719 if(std::abs(slope) < 0.00001 || slope == -999) //watch out for slope==0
720 {
721 ATH_MSG_WARNING("Slope invalid ");
722 continue;
723 }
724
725 invertedSlope = 1/slope;
726
727 ATH_MSG_ERROR("Inserting calgraph in for hash " << stripHash);
728 m_calGraphs[stripHash] = calGraph;
729
730 ATH_MSG_DEBUG("StripHash: " << stripHash << "; slope: " <<slope
731 << "; intercept: " << intercept
732 << "; chi^2/ndf: " << chiSquared << "/" << ndf);
733 CscCalibResult * slopeResult = new CscCalibResult(stripHash,invertedSlope,slopeError,chiSquared,ndf);
734 CscCalibResult * interceptResult = new CscCalibResult(stripHash, intercept, interceptError, chiSquared, ndf);
735
736 m_slopes->push_back(slopeResult);
737 m_intercepts->push_back(interceptResult);
738 m_fitReturns[stripHash] = fitRet;
739
740 }//end if(isGoodStrip)
741
742
743 if(crossTalkCnt == 23)
744 crossTalkCnt = 0;
745 else
746 crossTalkCnt++;
747 ATH_MSG_DEBUG("Looping over next strip...");
748 }//end loop over strips
749 ATH_MSG_INFO("Completed calculating parameters for each strip");
750 return StatusCode::SUCCESS;
751 }//End calculateParameters()
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
static Double_t sc
std::set< int > m_pulsedChambers
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
std::vector< TGraphErrors * > m_calGraphs
std::map< int, TProfile * > m_ampProfs
std::vector< float > m_dbLevels
std::vector< float > m_fitReturns
SmartIF< IChronoStatSvc > m_chronoSvc
::StatusCode StatusCode
StatusCode definition for legacy code.
float chiSquared(const U &p)
constexpr uint8_t stationPhi
station Phi 1 to 8

◆ calOutput0()

StatusCode MuonCalib::CscCalcSlope::calOutput0 ( )
private

Definition at line 771 of file CscCalcSlope.cxx.

771 {
772 //***Take conditions data held in summary histograms and print to the calibration file***//
773 ATH_MSG_INFO("Parameters calculated, preparing to outputing to file: " << m_outputFileName);
774 std::ofstream out;
775 out.open(m_outputFileName.c_str());
776 if(!out.is_open())
777 {
778 ATH_MSG_FATAL("Can't open file " << m_outputFileName.c_str() << "for writing");
779 return StatusCode::FAILURE;
780 }
781 //Start by writing file version number (mainly for COOL program to read)
782 out << "00-00 ";
783 //Number of strips we have info for:
784 out << m_slopes->size() << " ";
785 //print out header
786 out << "pslope ";
787 if(m_findPeakTime) out << "peakt ";
788 out << "END_HEADER\n";
789 //Now we loop over each strip's parameters and print them out
790 ATH_MSG_DEBUG("Begining loop over all " << m_maxStripHash << " hash ids.");
791
792 //form is:
793 //hashID chamber LayerOrientationStrip parametervalue parametervalue
799 {
800 peaktItr = m_peakTimes->begin();
801 peaktEnd = m_peakTimes->end();
802 }
803 for(; slopeItr != slopeEnd; ++slopeItr)
804 {
805 if(m_findPeakTime && (peaktItr == peaktEnd) )
806 {
807 ATH_MSG_FATAL("Peaktimes out of sync with slopes. Quiting write.");
808
809 return StatusCode::FAILURE;
810 }
811
812 //Output hashId
813 out << (*slopeItr)->hashId();
814
815 //get id for next few outputs
816 Identifier id;
817 IdContext channelContext = m_idHelperSvc->cscIdHelper().channel_context();
818 m_idHelperSvc->cscIdHelper().get_id((*slopeItr)->hashId(),id, &channelContext);
819
820 //output chamber #
821 IdentifierHash chamberHash;
822 Identifier chamberId = m_idHelperSvc->cscIdHelper().elementID(id);
823 if(!m_idHelperSvc->cscIdHelper().valid(chamberId))
824 {
825 ATH_MSG_FATAL(chamberId.getString() << " is not a valid id!");
826 ATH_MSG_FATAL("identifier is: " << m_idHelperSvc->cscIdHelper().show_to_string(chamberId));
827 return StatusCode::FAILURE;
828 }
829
830 m_idHelperSvc->cscIdHelper().get_module_hash(id,chamberHash);
831 out <<" " << chamberHash;
832
833 //output strip details
834 out << " " << m_idHelperSvc->cscIdHelper().show_to_string(id) << " ";
835
836 //output parameter values
837 out << " " << (*slopeItr)->value();
838 if(m_findPeakTime) out << " " << (*peaktItr)->value();
839 out << "\n" ; //to improve readability
840 } //end loop over hash Ids
841
842 out.close(); //done writing
843
844 return StatusCode::SUCCESS;
845 }//end calOutput0
DataModel_detail::iterator< DataVector > iterator
Definition DataVector.h:842
std::string getString() const
Provide a string form of the identifier - hexadecimal.

◆ calOutput3()

StatusCode MuonCalib::CscCalcSlope::calOutput3 ( )
private

Definition at line 901 of file CscCalcSlope.cxx.

901 {
902 std::ofstream out;
903 out.open(m_outputFileName.c_str());
904 if(!out.is_open())
905 {
906 ATH_MSG_ERROR("Can't open file " << m_outputFileName.c_str());
907 return StatusCode::RECOVERABLE;
908 }
909 out << "03-00 <END_HEADER>";
910
912 out << "\n<END_FILE>";
913 out.close();
914
915 ATH_MSG_INFO("Successfully opened file " << m_outputFileName);
916
917 return StatusCode::SUCCESS;
918 }
void outputParameter3(const CscCalibResultCollection &results, std::ofstream &out)

◆ calShape()

double MuonCalib::CscCalcSlope::calShape ( double * x,
double * par )
private

◆ collectEventInfo()

StatusCode MuonCalib::CscCalcSlope::collectEventInfo ( )
private

event loop functions

Definition at line 302 of file CscCalcSlope.cxx.

303 {
304 MsgStream mLog( msgSvc(), name() );
305
306 // apparently not used since code is exited automatically if there is an error
307 // bool thereIsAnError = false;
308
309 Chrono chrono(m_chronoSvc,"collectEventInfo");
310 ATH_MSG_DEBUG("Collecting event info for event " << m_eventCnt);
311 //Below might need to be changed depending on how we get data
312 const CscRawDataContainer* fullRDO;
313 StatusCode sc_read = evtStore()->retrieve(fullRDO, "CSCRDO");
314 if (sc_read != StatusCode::SUCCESS)
315 {
316 ATH_MSG_FATAL("Could not find event");
317 return StatusCode::FAILURE;
318 }
319
320 SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey};
321 const CscCondDbData* readCdo{*readHandle};
322
323 //Loop over RODs (data from 2 chambers), each of which is in
324 //a single CscRawaData collection
325
326
327 for(const auto rod:*fullRDO)
328 {
329 if(not rod->empty())
330 {
331
332 uint16_t pulsedWireLayer = rod->calLayer();
333
334 int pulserLevel = rod->calAmplitude();
335 ATH_MSG_VERBOSE("Pulser level is " << pulserLevel);
336 if( pulserLevel != m_lastPulserLevel)
337 {
338 ATH_MSG_INFO("New pulser level found. (" << pulserLevel <<").");
339
340 std::map<int,TProfile*>::iterator alreadyExistingProfile = m_ampProfs.find(pulserLevel);
341
342 if(alreadyExistingProfile == m_ampProfs.end())
343 {//No previous profile for this amplitude exists
344
345 ATH_MSG_DEBUG(" creating new amplitude profile");
346 std::stringstream name, title;
347 name << "ampProf_" << pulserLevel;
348 title << m_titlePrefix << "Amplitudes For Pulser Level " << pulserLevel << m_titlePostfix;
349 m_currentAmpProf = new TProfile(name.str().c_str(), title.str().c_str(),
351 m_currentAmpProf->GetXaxis()->SetTitle("Channel (Hash Id)");
352 m_currentAmpProf->GetYaxis()->SetTitle("Amplitude (ADC value)");
353 ATH_MSG_DEBUG("Adding new amplitude profile");
354 m_ampProfs.insert(std::pair<int, TProfile*>( pulserLevel, m_currentAmpProf));
355 }
356 else
357 {
358 ATH_MSG_DEBUG(" using existing amplitude profile");
359 m_currentAmpProf = alreadyExistingProfile->second;
360 }
361
362 m_lastPulserLevel = pulserLevel;
363 }
364
365 unsigned int samplingPhase = rod->samplingPhase();
366 uint8_t samplingPeriod = rod->rate(); //sampling period in ns
367
368
369 //Loop over strips in rod
370
371
372 for(const auto cluster: *rod)
373 {
374 //Note: For a pulser or ped run, the "cluster"
375 //is the size of an entire layer
376 int numStrips = cluster->width();
377 int samplesPerStrip = (cluster->samples()).size()/numStrips;
378
379 IdContext channelContext = m_idHelperSvc->cscIdHelper().channel_context();
380
381 for(int stripItr = 0; stripItr <numStrips; stripItr++)
382 {
383 Identifier stripId =m_cscRdoDecoderTool->channelIdentifier(cluster, &m_idHelperSvc->cscIdHelper(), stripItr);
384 IdentifierHash cscChannelHashId;
385 m_idHelperSvc->cscIdHelper().get_channel_hash(stripId, cscChannelHashId);
386 if (!cscChannelHashId.is_valid())[[unlikely]]{
387 ATH_MSG_WARNING("Hash "<< cscChannelHashId <<" is invalid");
388 continue;
389 }
390 int stripHash = cscChannelHashId;
391 ATH_MSG_VERBOSE("The eta of this strip is: " << m_idHelperSvc->cscIdHelper().stationEta(stripId));
392
393 int chamberLayer = m_idHelperSvc->cscIdHelper().chamberLayer(stripId);
394 if(chamberLayer != m_expectedChamberLayer)
395 {
396 ATH_MSG_FATAL("Cluster includes strip in chamber layer "
397 << chamberLayer << ". Only " << m_expectedChamberLayer
398 << " is valid.");
399 return StatusCode::FAILURE;
400 }
401
402 int currentWireLayer = m_idHelperSvc->cscIdHelper().wireLayer(stripId) - 1;
403 if( currentWireLayer < 0 || currentWireLayer > 3)
404 {
405 ATH_MSG_FATAL("Problem in getting wire layer! - Current value is "
406 << m_idHelperSvc->cscIdHelper().wireLayer(stripId) << " while only values between 1-4 are allowed.");
407 return StatusCode::FAILURE;
408 }
409 bool isThisLayerPulsed = (pulsedWireLayer >> currentWireLayer)&0x1;
410 if(isThisLayerPulsed)
411 {
412
413 std::vector<uint16_t> samples;
414 cluster->samples(stripItr,samplesPerStrip,samples); //Retrieve samples for a single strip
415
416 float ped = 0;
417 float noise = 0;
418 if(m_pedFile)
419 {
420 ped = m_peds[stripHash];
421 noise = m_noises[stripHash];
422 }
423 else{
424
425 if(!readCdo->readChannelPed(stripHash, ped).isSuccess()){
426 ped = 2054;
427 if (m_ignoreDatabaseError) ATH_MSG_WARNING("Failed at getting pedestal from COOL for hash " << stripHash);
428 else ATH_MSG_ERROR("Failed at getting pedestal from COOL for hash " << stripHash);
430 return StatusCode::RECOVERABLE;
431 ATH_MSG_WARNING("Setting to " << ped);
432 }
433 else
434 ATH_MSG_VERBOSE("Got pedestal of " << ped);
435 if(!readCdo->readChannelNoise(stripHash, noise).isSuccess())
436 {
437 noise = .001;
438 if (m_ignoreDatabaseError) ATH_MSG_WARNING("Failed at getting noise from COOL for hash " << stripHash);
439 else ATH_MSG_ERROR("Failed at getting noise from COOL for hash " << stripHash);
441 return StatusCode::FAILURE;
442 ATH_MSG_WARNING("Setting to " << noise);
443 }
444
445 }
446
447 double peakAmp{}, peakTime{};
448 int success{};
449 if(!m_doBipolarFit)
450 {
451 //Need to convert vector from ints to floats to pass to findCharge
452 std::vector<float> floatSamples;
453 for(const auto & thisSample:samples){
454 floatSamples.push_back(thisSample-ped);
455 if(m_doBitHists){
456 if(!fillBitHist(m_bitHists[stripHash],thisSample)){
457 ATH_MSG_WARNING("Failed recording bits for strip " << stripHash);
458 }
459
460 }
461 }
462
463 success = m_cscCalibTool->findCharge((float)samplingPeriod, samplingPhase,floatSamples,peakAmp,peakTime);
464
465 }
466 else
467 {
468 //Need to convert vector from ints to doubles to pass to bipolar fit
469 double adcSamples[4];
470 for(int i = 0; i < 4; i++) adcSamples[i] = samples[i] -ped;
471 double fitResult[3],fitErrors[3], chi2;
472 double width = samplingPeriod == 50 ? 7.2:14.4; //check if 50 or 25ns period
473
474 m_bipolarFit.Fit(adcSamples,noise,ped,width,fitResult,fitErrors,&chi2);
475 success = true;
476 peakAmp = fitResult[0];
477 peakTime = fitResult[1] - (samplingPhase ? 25 : 0);
478 }//end if m_doBipolarFit
479
480
481 if(success)
482 {
483 m_currentAmpProf->Fill(stripHash,peakAmp);
484 //((*m_ampHists)[stripHash])->Fill(peakAmp);
485
487 m_peakTimeProf->Fill(stripHash,peakTime);
488 }
489 else
490 {
491 ATH_MSG_WARNING("Failed at fitting pulse shape. Debug info: ");
492 ATH_MSG_WARNING("stripHash " << stripHash);
493 ATH_MSG_WARNING("strip in chamber " << stripItr);
494 ATH_MSG_WARNING(" and detailed id " << m_idHelperSvc->cscIdHelper().show_to_string(stripId,&channelContext));
495 ATH_MSG_WARNING("Pulsed layer " << pulsedWireLayer<< ", Samples: " << samples[0] <<", " << samples[1] << ", " << samples[2] << ", " << samples[3]);
496 }
497 }//end if (islayerPulsedand and is precision layer)
498 }//end strip loop
499
500 }//end cluster loop
501 }//end if rod >1
502 }//end rod loop
503
504
505 ATH_MSG_DEBUG("end collectEventInfo()");
506 m_eventCnt++;
507
508 // at this part of the code thereIsAnError is always false - if true it would exit earlier
509 // if(thereIsAnError)
510 // return StatusCode::RECOVERABLE;
511
512 return StatusCode::SUCCESS;
513 }// end collectEventInfo()
Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current CscRawDataContainer
const double width
StatusCode readChannelPed(IdentifierHash, float &) const
StatusCode readChannelNoise(IdentifierHash, float &) const
constexpr bool is_valid() const
SG::ReadCondHandleKey< CscCondDbData > m_readKey
ToolHandle< ICscCalibTool > m_cscCalibTool
Services and tools.
StatusCode fillBitHist(TH1I *bitHist, const uint16_t &val)
ToolHandle< Muon::ICSC_RDO_Decoder > m_cscRdoDecoderTool
std::vector< TH1I * > m_bitHists
double chi2(TH1 *h0, TH1 *h1)
setWord1 uint16_t
#define unlikely(x)

◆ 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::CscCalcSlope::execute ( void )

Definition at line 243 of file CscCalcSlope.cxx.

244 {
245 ATH_MSG_INFO("Begin execute");
246 //collectEventInfo collects infomation about each event by filling ampHistCollection and peaktHist.
248
249 if(!sc.isSuccess())
250 {
251 ATH_MSG_WARNING("There was an error collecting information from the RDO this event.");
252 return sc;
253 }
254 ATH_MSG_INFO("End execute");
255 return StatusCode::SUCCESS;
256 } //end execute()
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::CscCalcSlope::fillBitHist ( TH1I * bitHist,
const uint16_t & val )
inlineprivate

Definition at line 148 of file CscCalcSlope.h.

149 {
150 if(!bitHist)
151 return StatusCode::RECOVERABLE;
152
153 //Num bits should always be m_numBits
154 std::bitset<12> bitVal(val);
155
156 for(unsigned int bitIndex = 0; bitIndex < m_numBits; bitIndex++){
157 if(bitVal[bitIndex]){
158 bitHist->Fill(bitIndex);
159 }
160 }
161
162
163 return StatusCode::SUCCESS;
164 }

◆ finalize()

StatusCode MuonCalib::CscCalcSlope::finalize ( void )

m_adcValues and/or m_allPeaktsHist

Definition at line 258 of file CscCalcSlope.cxx.

259 {
260 ATH_MSG_INFO("In finalize()");
261
263
264 bool thereIsAFatal=false;
265
266 //calculateParameters() finds means and fits gain curves from the data in
269 if(sc.isFailure())
270 {
271 ATH_MSG_WARNING("Calculation of parameters failed!");
272 }
273 ATH_MSG_DEBUG("Finished calculating parameters");
274
275 //writeCalibrationFile() writes the calculated parameters into a calibration fie.
277 if(!sc.isSuccess())
278 {
279 ATH_MSG_FATAL("Failed to write parameters to disk!");
280 thereIsAFatal = true; //Not quiting yet to ensure memory is properly deleted
281 }
282
284 if(sc.isFailure())
285 {
286 ATH_MSG_FATAL("Failed to record parameters in StoreGate ");
287 thereIsAFatal = true;
288 }
289
290 delete m_peakTimeProf;
291
292 ATH_MSG_DEBUG("Finished finalize()");
293
294 if(thereIsAFatal)
295 return StatusCode::FAILURE;
296
297 return StatusCode::SUCCESS;
298 }//end finalize()
StatusCode calculateParameters()
Finalize functions.
StatusCode writeCalibrationFile()

◆ initialize()

StatusCode MuonCalib::CscCalcSlope::initialize ( void )

basic required functions

Definition at line 111 of file CscCalcSlope.cxx.

112 {
113 ATH_MSG_INFO("CscCalcSlope::initialize() called");
114
115 //*******Register services and tools *********/
116 ATH_CHECK(m_idHelperSvc.retrieve());
117
118 m_chronoSvc = service("ChronoStatSvc");
119 ATH_CHECK(m_chronoSvc.isValid());
120
121 ATH_CHECK(m_cscCalibTool.retrieve());
122
123 ATH_CHECK(m_cscRdoDecoderTool.retrieve());
124
125 ATH_MSG_INFO("Finished initializing services. ");
126 //*****Initialize internal variables and histograms*******/
127 m_ampProfs.clear();
128 //Setup lookup table for pulser levels
129 m_dbLevels.resize(64);
130 for(unsigned int pulserLevel=0; pulserLevel < 64; pulserLevel++)
131 m_dbLevels[pulserLevel] = pulserLevel*.5;
132
133 IdContext channelContext = m_idHelperSvc->cscIdHelper().channel_context();
134
135 if(m_doBitHists) m_bitHists.clear();
136 //Loop through ids to find out what hash range we're working on, and to
137 //initialize histograms.
138 const std::vector<Identifier> & ids = m_idHelperSvc->cscIdHelper().idVector();
139
140
141 m_maxStripHash = 0;
142 for(const auto & thisChamberId:ids)
143 {
144 std::vector<Identifier> stripVect;
145 m_idHelperSvc->cscIdHelper().idChannels(thisChamberId,stripVect);
146
147
148
149 for(const auto & thisStripId:stripVect)
150 {
151 IdentifierHash stripHash;
152 m_idHelperSvc->cscIdHelper().get_channel_hash(thisStripId,stripHash);
153
154 if(m_maxStripHash < (unsigned int)stripHash)
155 m_maxStripHash = (unsigned int)stripHash;
156
157 if(m_doBitHists)
158 {
159 Identifier id;
160 m_idHelperSvc->cscIdHelper().get_id((IdentifierHash)stripHash,id,&channelContext);
161 int wireLayer = m_idHelperSvc->cscIdHelper().wireLayer(id);
162 char orientation = (m_idHelperSvc->cscIdHelper().measuresPhi(id) ? 'Y':'X');
163
164 int stationName = m_idHelperSvc->cscIdHelper().stationName(id);
165 int stationPhi = m_idHelperSvc->cscIdHelper().stationPhi(id);
166 int stationEta = m_idHelperSvc->cscIdHelper().stationEta(id);
167
168 int stripNumber = m_idHelperSvc->cscIdHelper().strip(id);
169
170 char bitName[200], titleSeed[500];
171 //Bit histogram (for looking for stuck-bits)
172 sprintf(bitName, "bitHist%d",(int)stripHash);
173 sprintf(titleSeed, "Bit histogram for eta %d, sector %d, layer %d%c strip %d",
174 stationEta,(2*stationPhi+50 - stationName),wireLayer,orientation,stripNumber);
175 std::string title = m_titlePrefix + titleSeed + m_titlePostfix;
176 TH1I* hist = new TH1I(bitName, title.c_str(), m_numBits, 0, m_numBits); //12 bits
177 hist->GetXaxis()->SetTitle("Bit");
178 hist->GetYaxis()->SetTitle("Counts");
179 m_bitHists.push_back(hist);
180 }
181 }
182 }//end chamber loop
183
184 m_fitReturns.clear();
185 m_fitReturns.resize(m_maxStripHash+1,0);
186
187 m_calGraphs.clear();
188 for(unsigned int chanItr =0; chanItr <= m_maxStripHash; chanItr++)
189 {
190 m_calGraphs.push_back(nullptr);
191 }
192
193
194 if(m_pedFile)
195 {
196 ATH_MSG_INFO("Opening pedestal file");
197 std::ifstream in(m_pedFileName.c_str());
198 int stripHash;
199 double ped,noise;//,pedError,noiseError;
200 std::string buff;
201 in >> buff >> buff >> buff >> buff >> buff ;// skip header
202 m_peds = new float[m_maxStripHash+1];
203 m_noises = new float[m_maxStripHash+1];
204
205 while(!in.eof())
206 {
207 in >> stripHash >> buff >> buff >> ped >> noise;
208 ATH_MSG_INFO(stripHash << "\t" << ped << "\t" << noise);
209 if( stripHash < 0 || (unsigned int) stripHash > m_maxStripHash ) {
210 //cppcheck-suppress shiftNegative
211 ATH_MSG_FATAL("The hash "<< (int) stripHash << " is out of range for the Ped-Vector - Crashing!");
212 return StatusCode::FAILURE;
213 }
214 m_peds[stripHash] = ped;
215 m_noises[stripHash] = noise;
216 }
217 }
218 else
219 {
220 ATH_CHECK(m_readKey.initialize());
221 }
222
223 ATH_MSG_INFO("Counted " << m_maxStripHash +1 << " strips.");
224
225 m_slopes = new CscCalibResultCollection("pslope");
226 m_intercepts = new CscCalibResultCollection("pinter");
227
229 {
230 m_peakTimeProf = new TProfile("PeakTimes","Peaking Time for each channel",m_maxStripHash+1,
231 0,m_maxStripHash+1);
232 m_peakTimes = new CscCalibResultCollection("peakt");
233 }
234
235 m_pulsedChambers.clear();
236
237
238 ATH_MSG_DEBUG("End initialize");
239 return StatusCode::SUCCESS;
240 }//end initialize
#define ATH_CHECK
Evaluate an expression and check for errors.

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

◆ makeCalibPoints()

StatusCode MuonCalib::CscCalcSlope::makeCalibPoints ( )
private

Utility functions.

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

◆ 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::CscCalcSlope::outputParameter3 ( const CscCalibResultCollection & results,
std::ofstream & out )
private

Definition at line 921 of file CscCalcSlope.cxx.

921 {
922 ATH_MSG_INFO("Printing out parameter " << results.parName());
923
924 SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey};
925 const CscCondDbData* readCdo{*readHandle};
926
927 out << "\n";
928 out << "<NEW_PAR> " << results.parName() << "\n";
929 std::string idString;
930
933 for(; resItr != resEnd; ++resItr){
934 unsigned int hashId = (*resItr)->hashId();
935 double value = (*resItr)->value();
936 std::string idString;
937
938 readCdo->indexToStringId(&m_idHelperSvc->cscIdHelper(), hashId, "CHANNEL", idString).ignore();
939
940 out << idString << " " << value << "\n";
941 }
942
943 out << "<END_PAR>" ;
944 }
StatusCode indexToStringId(const CscIdHelper *, const unsigned int &, std::string_view, std::string &) const
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::CscCalcSlope::storeGateRecord ( )
private

Definition at line 847 of file CscCalcSlope.cxx.

848 {
849 ATH_MSG_INFO("Recording csc calibration report.");
850
851 StatusCode sc = StatusCode::SUCCESS;
852
853 bool thereIsAnError = false;
854
855 std::string histKey = "cscSlopeCalibReport";
856 ATH_MSG_DEBUG("Recording calibration graphs to TDS with key " << histKey);
857
858 CscCalibReportSlope * report = new CscCalibReportSlope("calGraphs");
859
860 report->setCalGraphs(std::move(m_calGraphs));
861 report->setAmpProfs(std::move(m_ampProfs));
862 report->setPulsedChambers(std::move(m_pulsedChambers));
863 report->setBitHists(std::move(m_bitHists));
864 report->setFitResults(std::move(m_fitReturns));
865
866 CscCalibReportContainer * repCont = new CscCalibReportContainer(histKey);
867 repCont->push_back(report);
868
869 sc = evtStore()->record(repCont, histKey);
870 if(sc.isFailure())
871 {
872 ATH_MSG_ERROR("Failed to record CscCalibReportSlope to storegate");
873 thereIsAnError = true;
874 //Since storegate isn't taking ownership, we'll delete it:
875 delete repCont;
876 }
877
878 CscCalibResultContainer * calibResults
879 = new CscCalibResultContainer("CscCalibResultSlope");
880 calibResults->push_back(m_slopes);
881 calibResults->push_back(m_intercepts);
883 calibResults->push_back(m_peakTimes);
884 sc = evtStore()->record(calibResults,"CscCalibResultSlope");
885 if(sc.isFailure())
886 {
887 ATH_MSG_ERROR("Failed to record results to storegate");
888 thereIsAnError = true;
889 //Since storegate isn't taking ownership, we'll delete it
890 delete calibResults;
891 }
892
893 if(thereIsAnError)
894 return StatusCode::RECOVERABLE;
895
896 return StatusCode::SUCCESS;
897 }
value_type push_back(value_type pElem)
Add an element to the end of the collection.
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::CscCalcSlope::writeCalibrationFile ( )
private

Definition at line 754 of file CscCalcSlope.cxx.

755 {
756 Chrono chrono(m_chronoSvc,"writeCalibrationFile");
757 if(m_calOutputVersion == "00-00"){
758 ATH_MSG_INFO("Printing output file version 00-00");
759 return calOutput0();
760 }
761 else if(m_calOutputVersion == "03-00") {
762 ATH_MSG_INFO("Printing output file version 03-00");
763 return calOutput3();
764 }
765 else{
766 ATH_MSG_INFO("Don't know how to write calibration file version " << m_calOutputVersion);
767 return StatusCode::RECOVERABLE;
768 }
769 }

Member Data Documentation

◆ m_ampProfs

std::map<int, TProfile*> MuonCalib::CscCalcSlope::m_ampProfs
private

Definition at line 108 of file CscCalcSlope.h.

◆ m_bipolarFit

BipolarFit MuonCalib::CscCalcSlope::m_bipolarFit
private

Definition at line 118 of file CscCalcSlope.h.

◆ m_bitHists

std::vector<TH1I*> MuonCalib::CscCalcSlope::m_bitHists
private

Definition at line 102 of file CscCalcSlope.h.

◆ m_calFitFunc

std::string MuonCalib::CscCalcSlope::m_calFitFunc
private

Definition at line 131 of file CscCalcSlope.h.

◆ m_calGraphs

std::vector<TGraphErrors*> MuonCalib::CscCalcSlope::m_calGraphs
private

Definition at line 106 of file CscCalcSlope.h.

◆ m_calOutputVersion

std::string MuonCalib::CscCalcSlope::m_calOutputVersion
private

Definition at line 87 of file CscCalcSlope.h.

◆ m_chronoSvc

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

Definition at line 82 of file CscCalcSlope.h.

◆ m_cmd_parameters

std::string MuonCalib::CscCalcSlope::m_cmd_parameters
private

Definition at line 142 of file CscCalcSlope.h.

◆ m_crossTalkFix

std::array<double, 24> MuonCalib::CscCalcSlope::m_crossTalkFix {}
private

Definition at line 120 of file CscCalcSlope.h.

120{};

◆ m_cscCalibTool

ToolHandle<ICscCalibTool> MuonCalib::CscCalcSlope::m_cscCalibTool {this, "CscCalibTool", "CscCalibTool"}
private

Services and tools.

Definition at line 79 of file CscCalcSlope.h.

79{this, "CscCalibTool", "CscCalibTool"};

◆ m_cscRdoDecoderTool

ToolHandle<Muon::ICSC_RDO_Decoder> MuonCalib::CscCalcSlope::m_cscRdoDecoderTool {this,"CscRDODecoder","Muon::CscRDO_Decoder"}
private

Definition at line 80 of file CscCalcSlope.h.

80{this,"CscRDODecoder","Muon::CscRDO_Decoder"};

◆ m_currentAmpProf

TProfile* MuonCalib::CscCalcSlope::m_currentAmpProf
private

Definition at line 107 of file CscCalcSlope.h.

◆ m_dbLevels

std::vector<float> MuonCalib::CscCalcSlope::m_dbLevels
private

Definition at line 122 of file CscCalcSlope.h.

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

bool MuonCalib::CscCalcSlope::m_doBipolarFit
private

Definition at line 119 of file CscCalcSlope.h.

◆ m_doBitHists

bool MuonCalib::CscCalcSlope::m_doBitHists
private

Definition at line 93 of file CscCalcSlope.h.

◆ m_doCrossTalkFix

bool MuonCalib::CscCalcSlope::m_doCrossTalkFix
private

Definition at line 121 of file CscCalcSlope.h.

◆ m_doLinPlot

bool MuonCalib::CscCalcSlope::m_doLinPlot
private

Definition at line 139 of file CscCalcSlope.h.

◆ m_dumpAllHists

bool MuonCalib::CscCalcSlope::m_dumpAllHists
private

Definition at line 91 of file CscCalcSlope.h.

◆ m_eventCnt

int MuonCalib::CscCalcSlope::m_eventCnt
private

coherent correction array has the corrections to the coherently pulsed channels to get the basic channels

Definition at line 112 of file CscCalcSlope.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::CscCalcSlope::m_expectedChamberLayer
private

Definition at line 129 of file CscCalcSlope.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.h.

◆ m_findPeakTime

bool MuonCalib::CscCalcSlope::m_findPeakTime
private

Definition at line 134 of file CscCalcSlope.h.

◆ m_fitReturns

std::vector<float> MuonCalib::CscCalcSlope::m_fitReturns
private

Definition at line 103 of file CscCalcSlope.h.

◆ m_fracGraphs

DataVector<DataVector<TGraph> >* MuonCalib::CscCalcSlope::m_fracGraphs
private

Definition at line 101 of file CscCalcSlope.h.

◆ m_fracProfs

DataVector<DataVector<TProfile> >* MuonCalib::CscCalcSlope::m_fracProfs
private

Definition at line 100 of file CscCalcSlope.h.

◆ m_idHelperSvc

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

Definition at line 81 of file CscCalcSlope.h.

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

◆ m_ignoreDatabaseError

bool MuonCalib::CscCalcSlope::m_ignoreDatabaseError
private

Definition at line 92 of file CscCalcSlope.h.

◆ m_intercepts

CscCalibResultCollection * MuonCalib::CscCalcSlope::m_intercepts
private

Definition at line 114 of file CscCalcSlope.h.

◆ m_lastPulserLevel

int MuonCalib::CscCalcSlope::m_lastPulserLevel
private

Definition at line 98 of file CscCalcSlope.h.

◆ m_maxStripHash

unsigned int MuonCalib::CscCalcSlope::m_maxStripHash
private

Internally global variables.

Definition at line 97 of file CscCalcSlope.h.

◆ m_minDeltaAdc

double MuonCalib::CscCalcSlope::m_minDeltaAdc
private

Definition at line 89 of file CscCalcSlope.h.

◆ m_noises

float * MuonCalib::CscCalcSlope::m_noises
private

Definition at line 124 of file CscCalcSlope.h.

◆ m_numBits

unsigned int MuonCalib::CscCalcSlope::m_numBits
private

Definition at line 145 of file CscCalcSlope.h.

◆ m_outputFileName

std::string MuonCalib::CscCalcSlope::m_outputFileName
private

Parameters input through joboptions.

Definition at line 86 of file CscCalcSlope.h.

◆ m_peakTimeProf

TProfile* MuonCalib::CscCalcSlope::m_peakTimeProf
private

Definition at line 135 of file CscCalcSlope.h.

◆ m_peakTimes

CscCalibResultCollection* MuonCalib::CscCalcSlope::m_peakTimes
private

Definition at line 136 of file CscCalcSlope.h.

◆ m_pedFile

bool MuonCalib::CscCalcSlope::m_pedFile
private

Definition at line 126 of file CscCalcSlope.h.

◆ m_pedFileName

std::string MuonCalib::CscCalcSlope::m_pedFileName
private

Definition at line 127 of file CscCalcSlope.h.

◆ m_peds

float* MuonCalib::CscCalcSlope::m_peds
private

Definition at line 124 of file CscCalcSlope.h.

◆ m_pulsedChambers

std::set<int> MuonCalib::CscCalcSlope::m_pulsedChambers
private

Definition at line 109 of file CscCalcSlope.h.

◆ m_readKey

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

Definition at line 83 of file CscCalcSlope.h.

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

◆ m_resGraph

TGraph* MuonCalib::CscCalcSlope::m_resGraph
private

Definition at line 105 of file CscCalcSlope.h.

◆ m_slopes

CscCalibResultCollection* MuonCalib::CscCalcSlope::m_slopes
private

Definition at line 114 of file CscCalcSlope.h.

◆ m_titlePostfix

std::string MuonCalib::CscCalcSlope::m_titlePostfix
private

Definition at line 95 of file CscCalcSlope.h.

◆ m_titlePrefix

std::string MuonCalib::CscCalcSlope::m_titlePrefix
private

Definition at line 95 of file CscCalcSlope.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: