diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/MuonSegmMonitoring/CSCSegmValAlg.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/MuonSegmMonitoring/CSCSegmValAlg.h new file mode 100755 index 0000000000000000000000000000000000000000..497f31b57241a2262bad743588a8651fa5908e15 --- /dev/null +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/MuonSegmMonitoring/CSCSegmValAlg.h @@ -0,0 +1,216 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/* ********************************************************************** + * Program : CSCSegmValAlg + * Package : MuonSegmMonitoring + * Author : Jason Veatch <jason.veatch@cern.ch> + * Venkat Kaushik <Venkat.Kaushik@CERN.CH> + * Purpose : CSC segment DQ Monitoring + *---------------------------------------------------------------------- + * # Date Comments By + *---------------------------------------------------------------------- + * 0 28/08/2008 VSK + * 1 11/03/2009 Improved Software. Removed CSCSegmentTree VSK + * 2 17/03/2011 Access CSC segments from MuonSegments Jason + ************************************************************************/ + +#ifndef CSCSegmValAlg_H +#define CSCSegmValAlg_H + +// Gaudi Tools +#include "GaudiKernel/StatusCode.h" +#include "GaudiKernel/ToolHandle.h" +#include "GaudiKernel/MsgStream.h" + +// Athena Monitoring +#include "AthenaMonitoring/AthenaMonManager.h" +#include "AthenaMonitoring/ManagedMonitorToolBase.h" +#include "AthenaBaseComps/AthAlgorithm.h" + +// Muon Segment +#include "MuonSegment/MuonSegment.h" +#include "TrkSegment/SegmentCollection.h" + +// Muon Track +#include "TrkParameters/TrackParameters.h" +#include "TrkTrack/Track.h" +#include "TrkTrack/TrackCollection.h" + +//TDT +#include "TrigDecisionTool/TrigDecisionTool.h" + +// STL +#include <vector> +#include <string> +#include <map> + +using CLHEP::mg; + +class TH1; +class TH1F; +class TH2F; +class CscIdHelper; +class TgcIdHelper; + +namespace Muon { + class MuonEDMHelperTool; + class MuonIdHelperTool; +} + + +namespace Trk { + class IUpdator; + class RIO_OnTrack; + class Track; + class TrackStateOnSurface; + class MeasurementBase; +} + +class CSCSegmValAlg : public ManagedMonitorToolBase { + + public: + /** Constructor */ + CSCSegmValAlg( const std::string & type, const std::string & name, const IInterface* parent ); + /** Destructor */ + virtual ~CSCSegmValAlg(); + /** Histogram booking method */ + virtual StatusCode bookHistograms(); + /** Histogram filling method */ + virtual StatusCode fillHistograms(); + virtual StatusCode procHistograms(); + + StatusCode initialize(); + StatusCode finalize(); + + private: + + typedef std::map<std::string, int> MuonSegmType; + typedef std::map<std::string, int>::const_iterator MuonSegmIter; + + typedef std::vector<TH1 *> SegmHistType; + typedef std::vector<TH1 *>::const_iterator SegmHistIter; + + typedef std::vector<const Trk::MeasurementBase*> TrkSegmType; + typedef std::vector<const Trk::MeasurementBase*>::const_iterator TrkSegmIter; + + std::vector<MonGroup *> m_segmDetail_EA, m_segmDetail_EC; + std::vector<MonGroup *> m_segmOview_EA, m_segmOview_EC; + + typedef enum EndCaps { ECA = 0, ECC } EndCapType; + + void bookSegmentHistograms(); + void clearHistogramVectors(); + bool isCscSegment( const Muon::MuonSegment* seg ) const; + unsigned int cscHits( const Muon::MuonSegment* seg ) const; + void setCSCLayerLabels(TH1 *h, int m_side); + void regCSCHist(TH1 *h, MonGroup *mg ); + bool segmSlopeCut(float& csc_x, float& csc_ax, float& cut ); + //Trigger aware monitoring + bool evtSelTriggersPassed(); + + + StoreGateSvc* m_storeGate; + + //!< TDT handle + ToolHandle<Trig::TrigDecisionTool> m_trigDec; + + std::vector<std::string> m_sampSelTriggers; + bool m_doEvtSel; + + const CscIdHelper* m_cscIdHelper; + const TgcIdHelper* m_tgcIdHelper; + MuonSegmType m_segmKey; //!< Reconstructed segm collection name + std::map<std::string, std::string> m_segmPrefix; + std::map<std::string, double> m_segmSlope; + + //std::vector<int> m_segmCollectionFlag; + const Trk::SegmentCollection* m_segms; //container for segms + + bool m_debuglevel; //!< private member to control debug messages + bool bookedhistos; + + std::vector<std::string> m_ecap, m_segcoll; + + std::vector<TH2F*> h2CSC_Segm_NumOfSegs_EA; + std::vector<TH2F*> h2CSC_Segm_NumOfSegs_EC; + + unsigned int m_ncoll; + std::vector<std::string> m_clusStatWord; + std::vector<std::string> m_NClusWord; + + std::vector<TH2F*> h2CSC_Segm_NumOfNClusSegs_Eta_EA; + std::vector<TH2F*> h2CSC_Segm_NumOfNClusSegs_Eta_EC; + + std::vector<TH1F*> h1CSC_Segm_Efficiency_Eta_EA; + std::vector<TH1F*> h1CSC_Segm_Efficiency_Eta_EC; + + std::vector<TH2F*> h2CSC_Segm_QsumOfGoodClusMap_Eta_EA; + std::vector<TH2F*> h2CSC_Segm_QsumOfGoodClusMap_Eta_EC; + + std::vector<TH2F*> h2CSC_Segm_TimeOfGoodClusMap_Eta_EA; + std::vector<TH2F*> h2CSC_Segm_TimeOfGoodClusMap_Eta_EC; + + std::vector<TH1F*> h1CSC_Segm_StatOfClus_Eta_EA; + std::vector<TH1F*> h1CSC_Segm_NumOfClus_Eta_EA; + std::vector<TH1F*> h1CSC_Segm_NumOfGoodClus_Eta_EA; + std::vector<TH1F*> h1CSC_Segm_QsumOfClus_Eta_EA; + std::vector<TH1F*> h1CSC_Segm_QsumOfGoodClus_Eta_EA; + std::vector<TH1F*> h1CSC_Segm_TimeOfClus_Eta_EA; + std::vector<TH1F*> h1CSC_Segm_TimeOfGoodClus_Eta_EA; + + std::vector<TH1F*> h1CSC_Segm_StatOfClus_Eta_EC; + std::vector<TH1F*> h1CSC_Segm_NumOfClus_Eta_EC; + std::vector<TH1F*> h1CSC_Segm_NumOfGoodClus_Eta_EC; + std::vector<TH1F*> h1CSC_Segm_QsumOfClus_Eta_EC; + std::vector<TH1F*> h1CSC_Segm_QsumOfGoodClus_Eta_EC; + std::vector<TH1F*> h1CSC_Segm_TimeOfClus_Eta_EC; + std::vector<TH1F*> h1CSC_Segm_TimeOfGoodClus_Eta_EC; + + std::vector<TH2F*> h2CSC_Segm_QsumOfGoodClusMap_Phi_EA; + std::vector<TH2F*> h2CSC_Segm_QsumOfGoodClusMap_Phi_EC; + + std::vector<TH2F*> h2CSC_Segm_TimeOfGoodClusMap_Phi_EA; + std::vector<TH2F*> h2CSC_Segm_TimeOfGoodClusMap_Phi_EC; + + std::vector<TH1F*> h1CSC_Segm_StatOfClus_Phi_EA; + std::vector<TH1F*> h1CSC_Segm_NumOfClus_Phi_EA; + std::vector<TH1F*> h1CSC_Segm_NumOfGoodClus_Phi_EA; + std::vector<TH1F*> h1CSC_Segm_QsumOfClus_Phi_EA; + std::vector<TH1F*> h1CSC_Segm_QsumOfGoodClus_Phi_EA; + std::vector<TH1F*> h1CSC_Segm_TimeOfClus_Phi_EA; + std::vector<TH1F*> h1CSC_Segm_TimeOfGoodClus_Phi_EA; + + std::vector<TH1F*> h1CSC_Segm_StatOfClus_Phi_EC; + std::vector<TH1F*> h1CSC_Segm_NumOfClus_Phi_EC; + std::vector<TH1F*> h1CSC_Segm_NumOfGoodClus_Phi_EC; + std::vector<TH1F*> h1CSC_Segm_QsumOfClus_Phi_EC; + std::vector<TH1F*> h1CSC_Segm_QsumOfGoodClus_Phi_EC; + std::vector<TH1F*> h1CSC_Segm_TimeOfClus_Phi_EC; + std::vector<TH1F*> h1CSC_Segm_TimeOfGoodClus_Phi_EC; + + std::vector<TH2F*> h2CSC_Segm_QsumOfGoodClus_PhiVsEta_EA; + std::vector<TH2F*> h2CSC_Segm_QsumOfGoodClus_PhiVsEta_EC; + + std::vector< SegmHistType* > m_cscSegmDetailEA, m_cscSegmDetailEC; + + /* + std::vector<TH1*> //m_cscSegmExpert , + //m_cscSegmShift , + m_cscSegmDetailEA_Moore , + m_cscSegmDetailEA_MuBoy , + m_cscSegmDetailEC_Moore , + m_cscSegmDetailEC_MuBoy , + m_cscSegmOviewEA_Moore , + m_cscSegmOviewEA_MuBoy , + m_cscSegmOviewEC_Moore , + m_cscSegmOviewEC_MuBoy ; + */ + + // Tool handles + ToolHandle<Muon::MuonEDMHelperTool> m_helperTool; + ToolHandle<Muon::MuonIdHelperTool> m_idHelperTool; +}; + +#endif diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/MuonSegmMonitoring/CSCSegmValidation.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/MuonSegmMonitoring/CSCSegmValidation.h new file mode 100755 index 0000000000000000000000000000000000000000..1a92a4ce3fd9f337432b8080a05cf2d436f29ac2 --- /dev/null +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/MuonSegmMonitoring/CSCSegmValidation.h @@ -0,0 +1,190 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef CSCSegmValidation_H +#define CSCSegmValidation_H + +// ********************************************************************** +// CSCSegmValidation +// AUTHOR: I. Christidi - N. Benekos (UIUC) +// ********************************************************************** + +// Gaudi Tools +#include "GaudiKernel/StatusCode.h" +#include "GaudiKernel/ToolHandle.h" +#include "GaudiKernel/MsgStream.h" + +#include "AthenaMonitoring/AthenaMonManager.h" +#include "AthenaMonitoring/ManagedMonitorToolBase.h" +#include "AthenaBaseComps/AthAlgorithm.h" + +// Track +#include "TrkParameters/TrackParameters.h" + +#include "MuonReadoutGeometry/MuonDetectorManager.h" +#include "MuonReadoutGeometry/MdtReadoutElement.h" +#include "MuonReadoutGeometry/RpcReadoutElement.h" +#include "MuonReadoutGeometry/TgcReadoutElement.h" + +#include "TrkTrack/Track.h" +#include "TrkTrack/TrackCollection.h" + +// ROOT Classes +#include "TH1F.h" +#include "TH2F.h" +#include "TProfile.h" + +// +#include "MuonSegment/MuonSegment.h" +#include "TrkSegment/SegmentCollection.h" + +#include "MuonDQAUtils/MuonDQATrackHistTool.h" +#include "MuonDQAUtils/MuonDQAFitFunc.h" +#include "MuonDQAUtils/MuonDQAHistTool.h" + +// C++ +#include <vector> + +class ActiveStoreSvc; + +namespace Trk { + class IResidualPullCalculator; +} + +namespace Muon { + class MuonEDMPrinterTool; + class MuonEDMHelperTool; + class MuonIdHelperTool; +} + +namespace Trk { + class IUpdator; + class IPropagator; + class RIO_OnTrack; + class Track; + class TrackStateOnSurface; +} + +class CSCSegmValidation : public ManagedMonitorToolBase +{ + public: + /** Constructor */ + CSCSegmValidation( const std::string & type, const std::string & name, const IInterface* parent ); + /** Destructor */ + virtual ~CSCSegmValidation(); + + /** Histogram booking method */ + virtual StatusCode bookHistograms(); + + /** Histogram filling method */ + virtual StatusCode fillHistograms(); + + virtual StatusCode procHistograms(); + + StatusCode initialize(); + StatusCode finalize(); + + protected: + + + private: + + static const int COLLECTIONS = 2; + static const int ENDCAPS = 2; + static const int SECTORS = 16; + + void bookSegmentHistograms(); + // void deleteUnwantedHistograms( Muon::MuonDQATrackHistTool::TrackHistos histos_from_tool, std::string m_segmCollectionName, int j); + bool isCscSegment( const Muon::MuonSegment* seg ) const; + unsigned int cscHits( const Muon::MuonSegment* seg ) const; + + StoreGateSvc* m_storeGate; + ActiveStoreSvc* m_activeStore; + + const MuonGM::MuonDetectorManager* m_muonMgr; + const CscIdHelper* m_cscIdHelper; + const TgcIdHelper* m_tgcIdHelper; + std::vector<std::string> m_segmCollectionName; //!< Reconstructed segm collection name + std::vector<int> m_segmCollectionFlag; + bool m_doMDT; // subsystem flags + bool m_doRPC; + bool m_doTGC; + bool m_doCSC; + const Trk::SegmentCollection* m_segms; //container for segms + + int nsegm_Counter[COLLECTIONS][ENDCAPS]; + //int nsegm_ECA_Counter[COLLECTIONS]; + //int nsegm_ECC_Counter[COLLECTIONS]; + int nsegm_sect_Counter[COLLECTIONS][ENDCAPS][SECTORS]; + + int m_eventCounter; + int m_eventNumber; + int m_rec_nSoS; + static const int s_maxEvents; //!< Maximum number of events per run + static const int s_maxSoS; //!< Maximum number of SegmStateOnSurface objects associated to the segm + + bool m_debuglevel; //!< private member to control debug messages + bool b_status; + + std::vector<std::string> ecap, coll; + + // Muon Monitoring Histograms + Muon::MuonDQATrackHistTool::TrackHistos histos_from_tool_Moore; + Muon::MuonDQATrackHistTool::TrackHistos histos_from_tool_MBoy; + std::vector<Muon::MuonDQATrackHistTool::TrackHistos> histos_from_tool; + + TH1F* h_nsegm[COLLECTIONS][ENDCAPS]; + TH1F* h_nsegm_oview[COLLECTIONS][ENDCAPS]; + TH1F* h_nsegm_sect[COLLECTIONS][ENDCAPS][SECTORS]; + + //TH1F* h_nclust_per_segm; + + /* + TH1F* nthreehitseg_sect; + TH1F* nfourhitseg_sect; + TH1F* seg_eff_sect; + */ + + //TH1F* chi2_histo; + + std::vector<TH1F*> m_num_segms; + std::vector<TH2F*> m_num_hits_per_segmvsphi; + std::vector<TH2F*> m_num_hits_per_segm_vs_station; + std::vector<TH2F*> chi2_vs_station; + + std::vector<TH2F*> m_segm_etavsphi; + std::vector<TH2F*> m_segm_eta_vs_phi; + std::vector<TH2F*> m_segm_eta_vs_phiInner; + std::vector<TH2F*> m_segm_eta_vs_phiMiddle; + std::vector<TH2F*> m_segm_eta_vs_phiOuter; + + MonGroup *cscsegm_detailEA_Moore, *cscsegm_detailEA_MuBoy, + *cscsegm_detailEC_Moore, *cscsegm_detailEC_MuBoy, + *cscsegm_oviewEA_Moore, *cscsegm_oviewEA_MuBoy, + *cscsegm_oviewEC_Moore, *cscsegm_oviewEC_MuBoy; + + std::vector<TH1*> //m_cscSegmExpert , + //m_cscSegmShift , + m_cscSegmDetailEA_Moore , + m_cscSegmDetailEA_MuBoy , + m_cscSegmDetailEC_Moore , + m_cscSegmDetailEC_MuBoy , + m_cscSegmOviewEA_Moore , + m_cscSegmOviewEA_MuBoy , + m_cscSegmOviewEC_Moore , + m_cscSegmOviewEC_MuBoy ; + + + // Tool handles + ToolHandle<Trk::IResidualPullCalculator> m_pullCalculator; //<! tool to calculate residuals and pulls + ToolHandle<Muon::MuonEDMHelperTool> m_helperTool; + ToolHandle<Muon::MuonEDMPrinterTool> m_printer; + ToolHandle<Muon::MuonIdHelperTool> m_idHelperTool; + ToolHandle<Trk::IPropagator> m_propagator; + ToolHandle<Muon::MuonDQATrackHistTool> m_TrackHistoTool; + ToolHandle<Muon::MuonDQAFitFunc> m_muondqafitfunc; + ToolHandle<Muon::MuonDQAHistTool> m_histoTool; +}; + +#endif diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/MuonSegmMonitoring/MuonSegmValidation.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/MuonSegmMonitoring/MuonSegmValidation.h new file mode 100755 index 0000000000000000000000000000000000000000..c3d0865a3bbf17afc509c7c0fd66f040ab9ffe61 --- /dev/null +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/MuonSegmMonitoring/MuonSegmValidation.h @@ -0,0 +1,172 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef MuonSegmValidation_H +#define MuonSegmValidation_H + +// ********************************************************************** +// MuonSegmValidation +// AUTHOR: I. Christidi - N. Benekos (UIUC) +// ********************************************************************** + +// Gaudi Tools +#include "GaudiKernel/StatusCode.h" +#include "GaudiKernel/ToolHandle.h" +#include "GaudiKernel/MsgStream.h" + +#include "AthenaMonitoring/AthenaMonManager.h" +#include "AthenaMonitoring/ManagedMonitorToolBase.h" +#include "AthenaBaseComps/AthAlgorithm.h" + +// Track +#include "TrkParameters/TrackParameters.h" + +#include "MuonReadoutGeometry/MuonDetectorManager.h" +#include "MuonReadoutGeometry/MdtReadoutElement.h" +#include "MuonReadoutGeometry/RpcReadoutElement.h" +#include "MuonReadoutGeometry/TgcReadoutElement.h" + +#include "TrkTrack/Track.h" +#include "TrkTrack/TrackCollection.h" + +// ROOT Classes +#include "TH1F.h" +#include "TH2F.h" +#include "TProfile.h" + +// +#include "MuonSegment/MuonSegment.h" +#include "TrkSegment/SegmentCollection.h" + +#include "MuonDQAUtils/MuonDQATrackHistTool.h" +#include "MuonDQAUtils/MuonDQAFitFunc.h" +#include "MuonDQAUtils/MuonDQAHistTool.h" + +// C++ +#include <vector> + +class ActiveStoreSvc; + +namespace Trk { + class IResidualPullCalculator; +} + +namespace Muon { + class MuonEDMPrinterTool; + class MuonEDMHelperTool; + class MuonIdHelperTool; +} + +namespace Trk { + class IUpdator; + class IPropagator; + class RIO_OnTrack; + class Track; + class TrackStateOnSurface; +} + +class MuonSegmValidation : public ManagedMonitorToolBase +{ + public: + /** Constructor */ + MuonSegmValidation( const std::string & type, const std::string & name, const IInterface* parent ); + /** Destructor */ + virtual ~MuonSegmValidation(); + /** Histogram booking method */ + //virtual StatusCode bookHistograms (bool isNewEventsBlock, bool isNewLumiBlock, bool isNewRun ); + virtual StatusCode bookHistogramsRecurrent (); + + /** Histogram filling method */ + virtual StatusCode fillHistograms(); + + // virtual StatusCode procHistograms( bool isEndOfEventsBlock, bool isEndOfLumiBlock, bool isEndOfRun ); + virtual StatusCode procHistograms (); + + StatusCode initialize(); + StatusCode finalize(); + + protected: + + + private: + + StoreGateSvc* m_storeGate; + ActiveStoreSvc* m_activeStore; + + const MuonGM::MuonDetectorManager* m_muonMgr; + const MdtIdHelper* m_mdtIdHelper; + const RpcIdHelper* m_rpcIdHelper; + const CscIdHelper* m_cscIdHelper; + const TgcIdHelper* m_tgcIdHelper; + std::vector<std::string> m_segmCollectionName; //!< Reconstructed segm collection name + std::vector<int> m_segmCollectionFlag; + bool m_doMDT; // subsystem flags + bool m_doRPC; + bool m_doTGC; + bool m_doCSC; + const Trk::SegmentCollection* m_segms; //container for segms + + int m_eventCounter; + int m_eventNumber; + int m_rec_nSoS; + static const int s_maxEvents; //!< Maximum number of events per run + static const int s_maxSoS; //!< Maximum number of SegmStateOnSurface objects associated to the segm + + bool m_debuglevel; //!< private member to control debug messages + bool b_status; + + + // Muon Monitoring Histograms + Muon::MuonDQATrackHistTool::TrackHistos histos_from_tool_Moore; + Muon::MuonDQATrackHistTool::TrackHistos histos_from_tool_MBoy; + std::vector<Muon::MuonDQATrackHistTool::TrackHistos> histos_from_tool; + + std::vector<TH1F*> mdt_pulls_BarrelA; + std::vector<TH1F*> mdt_pulls_BarrelC; + std::vector<TH1F*> mdt_pulls_ECA; + std::vector<TH1F*> mdt_pulls_ECC; + + std::vector<TH2F*> mdt2_pulls_BarrelA; + std::vector<TH2F*> mdt2_pulls_BarrelC; + std::vector<TH2F*> mdt2_pulls_ECA; + std::vector<TH2F*> mdt2_pulls_ECC; + + std::vector<TProfile*> mdt_hits_BarrelA; + std::vector<TProfile*> mdt_hits_BarrelC; + std::vector<TProfile*> mdt_hits_ECA; + std::vector<TProfile*> mdt_hits_ECC; + + std::vector<TProfile*> chi2_BarrelA; + std::vector<TProfile*> chi2_BarrelC; + std::vector<TProfile*> chi2_ECA; + std::vector<TProfile*> chi2_ECC; + + std::vector<TH1F*> nsegm_BarrelA; + std::vector<TH1F*> nsegm_BarrelC; + std::vector<TH1F*> nsegm_ECA; + std::vector<TH1F*> nsegm_ECC; + + std::vector<TH1F*> m_num_segms; + std::vector<TH2F*> m_num_hits_per_segmvsphi; + std::vector<TH2F*> m_num_hits_per_segm_vs_station; + std::vector<TH2F*> chi2_vs_station; + + std::vector<TH2F*> m_segm_etavsphi; + std::vector<TH2F*> m_segm_eta_vs_phi; + std::vector<TH2F*> m_segm_eta_vs_phiInner; + std::vector<TH2F*> m_segm_eta_vs_phiMiddle; + std::vector<TH2F*> m_segm_eta_vs_phiOuter; + + // Tool handles + ToolHandle<Trk::IResidualPullCalculator> m_pullCalculator; //<! tool to calculate residuals and pulls + ToolHandle<Muon::MuonEDMHelperTool> m_helperTool; + ToolHandle<Muon::MuonEDMPrinterTool> m_printer; + ToolHandle<Muon::MuonIdHelperTool> m_idHelperTool; + ToolHandle<Trk::IPropagator> m_propagator; + ToolHandle<Muon::MuonDQATrackHistTool> m_TrackHistoTool; + ToolHandle<Muon::MuonDQAFitFunc> m_muondqafitfunc; + ToolHandle<Muon::MuonDQAHistTool> m_histoTool; +}; + +#endif diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/cmt/requirements b/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/cmt/requirements new file mode 100644 index 0000000000000000000000000000000000000000..dcdb1c2c6d569a220146c5ecba64ee12d3fcf9b7 --- /dev/null +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/cmt/requirements @@ -0,0 +1,62 @@ +package MuonSegmMonitoring + +manager Nectarios Ch. Benekos <Nectarios.Benekos@cern.ch> + +author Nectarios Ch. Benekos <Nectarios.Benekos@cern.ch> +author Ilektra A. Christidi <Electra.Christidi@cern.ch> + +branches src cmt doc +branches run + +use AtlasPolicy AtlasPolicy-* + +use AtlasROOT AtlasROOT-* External + +# Athena Control Dependencies +use AthenaBaseComps AthenaBaseComps-* Control + +# Athena Monitoring Dependencies +use AthenaMonitoring AthenaMonitoring-* Control +use GaudiInterface GaudiInterface-* External + +# MuonSpectrometer dependencies +use MuonReadoutGeometry MuonReadoutGeometry-* MuonSpectrometer/MuonDetDescr +use MuonDQAUtils MuonDQAUtils-* MuonSpectrometer/MuonValidation/MuonDQA +use MuonSegment MuonSegment-* MuonSpectrometer/MuonReconstruction/MuonRecEvent + +# EDM dependencies +use TrkParameters TrkParameters-* Tracking/TrkEvent +use TrkTrack TrkTrack-* Tracking/TrkEvent +use TrkSegment TrkSegment-* Tracking/TrkEvent + +# Trigger Aware Monitoring (TDT helper) +use TrigDecisionTool TrigDecisionTool-* Trigger/TrigAnalysis + +private +use EventPrimitives EventPrimitives-* Event +use MuonIdHelpers MuonIdHelpers-* MuonSpectrometer +use MuonRIO_OnTrack MuonRIO_OnTrack-* MuonSpectrometer/MuonReconstruction/MuonRecEvent +use MuonPrepRawData MuonPrepRawData-* MuonSpectrometer/MuonReconstruction/MuonRecEvent +use MuonRecHelperTools MuonRecHelperTools-* MuonSpectrometer/MuonReconstruction/MuonRecTools +use StoreGate StoreGate-* Control +use TrkCompetingRIOsOnTrack TrkCompetingRIOsOnTrack-* Tracking/TrkEvent +use TrkEventPrimitives TrkEventPrimitives-* Tracking/TrkEvent +use TrkExInterfaces TrkExInterfaces-* Tracking/TrkExtrapolation +use TrkGeometry TrkGeometry-* Tracking/TrkDetDescr +use TrkMeasurementBase TrkMeasurementBase-* Tracking/TrkEvent +use TrkSurfaces TrkSurfaces-* Tracking/TrkDetDescr +use TrkToolInterfaces TrkToolInterfaces-* Tracking/TrkTools +end_private + +###### build a component library + +library MuonSegmMonitoring *.cxx -s=components *.cxx +apply_pattern declare_joboptions files="-s=../share *.py" +apply_pattern component_library +apply_pattern declare_runtime + +apply_tag ROOTGraphicsLibs + +#private +#macro cppdebugflags '$(cppdebugflags_s)' +#macro_remove componentshr_linkopts "-Wl,-s" diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/share/CSCSegmMon_topOptions.py b/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/share/CSCSegmMon_topOptions.py new file mode 100644 index 0000000000000000000000000000000000000000..8962aa00086b6913e0fd1a564246791287fd0649 --- /dev/null +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/share/CSCSegmMon_topOptions.py @@ -0,0 +1,283 @@ +################################################### +# File : Job Options to run monitoring in stand-alone mode +# Author : Venkat.Kaushik@cern.ch +# Date : Jan 2010 +################################################### + +doCSCSegm = True +doCSCRDO = False +doCSCPRD = False +doCSCClus = False +doLocal = True + +import sys + +###################################################################################### +# helper gets input collection +############################## +def getInputFiles(dir, AODHLTP): + + import fnmatch, os, glob + if len(AODHLTP) > 0: + del AODHLTP[:] + + if len(dir) == 2: + all_dirs = glob.glob(dir[0]) + for thedir in all_dirs: + print 'i am in', thedir + for fileName in os.listdir(thedir): + if fnmatch.fnmatch(fileName, dir[1] ): + fullpath = os.path.join(thedir,fileName) + print 'file ', fullpath + AODHLTP.append(fullpath) + + +###################################################################################### +# Input files +############################## + +## list of files of the form [ directory, files-matching-pattern ] +#AODir = [ '/raid01/venkat/dataset/data/hlt/2011/177531/express_express', 'data11_7TeV*merge.AOD.*lb*' ] +#AODirdefault = [ '/raid01/venkat/dataset/data/csc/2011/mcpskim/data10_7TeV.00165821.physics_Muons.recon.DESD_ZMUMU.f293_m590_f293', 'data10_7TeV.*DESD_ZMUMU*' ] + +AODir = ['/raid01/venkat/dataset/data/csc/2011/mcpskim/data10_7TeV.*.phys*', 'data10_7TeV*DESD_ZMUMU*'] +AODir2 = ['/raid01/jveatch/data/dataset/CSCMon/data11_7TeV.00189751.physics_Muons.recon.DESD_ZMUMU.f405_m716_f405', 'data11_7TeV*DESD_ZMUMU*'] + +CSCInputFiles = [] +if doLocal: + getInputFiles(AODir2, CSCInputFiles) + print CSCInputFiles + if len(CSCInputFiles) < 1: + print "No input files specified yet! Cannot do anything." + sys.exit(0) + else: + for file in CSCInputFiles: + print file + +###################################################################################### +# Auto configure everything +################################# + +import AthenaPoolCnvSvc.ReadAthenaPool +if doLocal: + ServiceMgr.EventSelector.InputCollections= CSCInputFiles +else: + ServiceMgr.EventSelector.InputCollections= [ "/raid01/venkat/dataset/data/hlt/2011/177531/express_express/data11_7TeV.00177531.express_express.merge.AOD.x93_m755._lb0057-lb0076._0001.1" ] + +ServiceMgr.PoolSvc.AttemptCatalogPatch = True; +ServiceMgr.OutputLevel=ERROR + + +if 1: + # + from AthenaCommon.AthenaCommonFlags import athenaCommonFlags + + if len(athenaCommonFlags.FilesInput()) == 0: + athenaCommonFlags.FilesInput = ServiceMgr.EventSelector.InputCollections + + # + import AthenaPoolCnvSvc.ReadAthenaPool + + import AthenaPoolCnvSvc.WriteAthenaPool + + # + from RecExConfig.RecFlags import rec + + rec.AutoConfiguration .set_Value_and_Lock(["everything"]) + + rec.abortOnUncheckedStatusCode .set_Value_and_Lock(False) + + rec.doCBNT .set_Value_and_Lock(False) + rec.doESD .set_Value_and_Lock(False) + rec.doHist .set_Value_and_Lock(False) + rec.doPerfMon .set_Value_and_Lock(False) + + rec.doWriteAOD .set_Value_and_Lock(False) + rec.doWriteESD .set_Value_and_Lock(False) + rec.doWriteTAG .set_Value_and_Lock(False) + rec.doWriteTAGCOM .set_Value_and_Lock(False) + + # + from AthenaCommon.Include import include + + include ("RecExCommon/RecExCommon_topOptions.py") + +# +for i in ServiceMgr: i.OutputLevel=INFO + + +###################################################################################### +# Output file +############################## +OutputFile = 'Monitoring.CSC.root' + +myc = 0 +if 1: + isdata = inputFileSummary['evt_type'][0] + isdata = isdata.replace('IS_','') + runno = inputFileSummary['run_number'][0] + streamname = inputFileSummary['stream_names'][0] + streamname = streamname.replace('Stream','') + events = inputFileSummary['nentries'] + OutputFile = 'Monitoring.CSC.'+isdata.lower()+'.'+str(runno)+'.'+streamname.lower()+'.'+str(events)+'.root' + + +from GaudiSvc.GaudiSvcConf import THistSvc +svcMgr += THistSvc() +svcMgr.THistSvc.Output += ["CSCMonitor DATAFILE='" + OutputFile + "' OPT='RECREATE'"] + +###################################################################################### +# Add the Toplevel Alg +############################## + +from AthenaCommon.AlgSequence import AlgSequence +topSequence = AlgSequence() + +############################### +# Configure the job +############################### + +#from AthenaCommon.GlobalFlags import GlobalFlags as globalflags +#GlobalFlags.DetGeo.set_atlas() +#globalflags.DetGeo.set_Value_and_Lock('atlas') +#from AthenaCommon.GlobalFlags import GlobalFlags +#GlobalFlags.DetGeo.set_atlas() +from AthenaCommon.GlobalFlags import globalflags +globalflags.DetGeo = 'atlas' + +from RecExConfig.RecFlags import rec +rec.readRDO=False +rec.readAOD=True +rec.doWriteESD=False +rec.doWriteAOD=False +rec.doWriteTAG=False + + +############################### +# Setup Athena Monitoring +############################### +from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager + +if not 'DQMonFlags' in dir(): + from AthenaMonitoring.DQMonFlags import DQMonFlags + from MuonDQAMonFlags.MuonDQAProperFlags import MuonDQADetFlags + +from AthenaCommon.AppMgr import ToolSvc + +############################### +# Setup CfgMgr +############################### + +from AthenaCommon import CfgMgr +from AthenaCommon.CfgGetter import getPublicTool,getPublicToolClone + +############################### +# CSC monitoring algorithms +############################### + +muonOutputLevel=INFO + +#--------------------------------------------------------------- +# CSC PRD Monitoring +#-------------------------------------------------------------- + +CalibCscStripFitter = getPublicTool("CalibCscStripFitter") +ToolSvc += CalibCscStripFitter + +if doCSCPRD: + cscprdRawMonMan = AthenaMonManager(name="CscPrdRawMonManager", + FileKey = DQMonFlags.monManFileKey(), + Environment = DQMonFlags.monManEnvironment(), + OutputLevel = muonOutputLevel) + + from CscRawDataMonitoring.CscRawDataMonitoringConf import CscPrdValAlg + cscPrdESDValAlg = CscPrdValAlg ( name = 'cscPrdESDValAlg', + CSCPrepRawDataPath = 'Muon/MuonRawDataMonitoring/CSC/PRD', + CSCPrepRawDataKey = 'CSC_Measurements', + NoiseCutADC = 100, + CSCStripFitter = ToolSvc.CalibCscStripFitter + ) + ToolSvc += cscPrdESDValAlg + cscprdRawMonMan.AthenaMonTools += [ cscPrdESDValAlg ] + + topSequence += cscprdRawMonMan + cscprdRawMonMan.FileKey = "CSCMonitor" + + +#--------------------------------------------------------------- +# CSC Cluster Monitoring +#--------------------------------------------------------------- +if doCSCClus: + cscesdRawMonMan = AthenaMonManager(name="CscClusterEsdRawMonManager", + FileKey = DQMonFlags.monManFileKey(), + Environment = DQMonFlags.monManEnvironment(), + OutputLevel = muonOutputLevel) + + from CscRawDataMonitoring.CscRawDataMonitoringConf import CscClusterValAlg + cscClusterESDValAlg = CscClusterValAlg( name = 'cscClusterESDValAlg', + CSCClusterPath = 'Muon/MuonRawDataMonitoring/CSC/Clusters', + CSCClusterKey = 'CSC_Clusters', + CSCPrepRawDataKey = 'CSC_Measurements', + CSCQmaxCutADC = 200, + CSCCalibTool = ToolSvc.CscCalibTool, + CSCStripFitter = ToolSvc.CalibCscStripFitter + ) + + ToolSvc += cscClusterESDValAlg + cscesdRawMonMan.AthenaMonTools += [cscClusterESDValAlg] + + topSequence += cscesdRawMonMan + cscesdRawMonMan.FileKey = "CSCMonitor" + + + +#--------------------------------------------------------------- +# CSC Segment Monitoring +#--------------------------------------------------------------- +if doCSCSegm: + cscsegmMonMan = AthenaMonManager(name="CscSegmEsdRawMonManager", + FileKey = DQMonFlags.monManFileKey(), + Environment = DQMonFlags.monManEnvironment(), + OutputLevel = muonOutputLevel) + + from MuonSegmMonitoring.MuonSegmMonitoringConf import CSCSegmValAlg + from MuonDQAMonFlags.MuonDQAFlags import MuonDQAFlags as MuonDQAFlags + MuonDQAFlags.doMuonSegmMon = True + + ## TDT instance (this should be done already?) + from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool + ToolSvc += Trig__TrigDecisionTool( "TrigDecisionTool" ) + ToolSvc.TrigDecisionTool.OutputLevel=ERROR + ToolSvc.TrigDecisionTool.Navigation.OutputLevel = ERROR + + segmCollections = { "MooreSegments":1, "ConvertedMBoySegments":1 } + segmPrefixes = { "MooreSegments":"Moore", "ConvertedMBoySegments":"MuBoy" } + segmSlopeCuts = { "MooreSegments":0.07, "ConvertedMBoySegments":0.07 } + clusStatWords = [ "Unspoiled", "Simple", "Edge", "MultiPeak", "Narrow", + "Wide", "Skewed", "QRatInc", "StripFitFailed", + "SplitUnspoiled", "SplitSimple", "SplitEdge", "SplitMultiPeak", + "SplitNarrow", "SplitWide", "SplitSkewed", "SplitQRatInc", + "SplitStripFitFailed", "Undefined" ] + ## trigger-aware monitoring: sample seletion triggers (express stream menu physics_pp_v2) + evtSelectionTriggers = [ "L1_MU10", "L1_MU15", "EF_mu20_muCombTag_NoEF", "EF_mu15", "EF_mu15_mu10_EFFS", "EF_2mu10", "EF_2mu10_loose" ] + + CSCSegmValAlg = CSCSegmValAlg ( name = "CSCSegmValAlg", SegmentKeys = segmCollections, + TrigDecisionTool = ToolSvc.TrigDecisionTool, DoEventSelection = False, EventSelTriggers = evtSelectionTriggers, + SegmentPrefixes = segmPrefixes, SegmentSlopeCuts = segmSlopeCuts, ClusterStatus = clusStatWords) + + ToolSvc += CSCSegmValAlg + cscsegmMonMan.AthenaMonTools += [ CSCSegmValAlg ] + + topSequence += cscsegmMonMan + cscsegmMonMan.FileKey = "CSCMonitor" + + +# in order to check available detectors +from RecExConfig.RecFlags import rec + +########################## +# Events to run over +########################## + +theApp.EvtMax = 10000 + diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/share/MuonCSCSegmDQA_options.py b/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/share/MuonCSCSegmDQA_options.py new file mode 100755 index 0000000000000000000000000000000000000000..5c918345eb698bbab2a2b9dc683b8b683120a0dc --- /dev/null +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/share/MuonCSCSegmDQA_options.py @@ -0,0 +1,52 @@ +#====================================================================== +# TOP JobOptions to run on MuonSegmMonitoring +#====================================================================== +#print '\n****************************************************************************************\n' +#print " ******** Welcome to the Offline MuonSegmentMonitoring package. ******** " +#print " ******** Documentation may be found at:******** " +#print " **** https://twiki.cern.ch/twiki/bin/view/Atlas/MuonOfflineDQA ***** " +#print '\n****************************************************************************************\n' + +if not 'MuonDQAFlags' in dir(): + print "MuonDQAFlags.py: MuonDQAFlags not yet imported - I import them now" + from MuonDQAMonFlags.MuonDQAFlags import MuonDQAFlags as MuonDQAFlags + +if MuonDQADetFlags.doCSCSegmMon: + cscSegmMonMan = AthenaMonManager(name="CSCSegmMonManager", + FileKey = DQMonFlags.monManFileKey(), + Environment = DQMonFlags.monManEnvironment(), + OutputLevel = muonOutputLevel) + #====================================================================== + # CSC Segment Monitoring JobOptions + #====================================================================== + from MuonSegmMonitoring.MuonSegmMonitoringConf import CSCSegmValAlg + myTrigDecisionTool = "" + ## TDT instance (this should be done already?) + if(DQMonFlags.useTrigger() and hasattr(ToolSvc, DQMonFlags.nameTrigDecTool())): + myTrigDecisionTool = getattr(ToolSvc, DQMonFlags.nameTrigDecTool()) + + segmCollections = { "MooreSegments":1, "ConvertedMBoySegments":1 } + segmPrefixes = { "MooreSegments":"Moore", "ConvertedMBoySegments":"MuBoy" } + segmSlopeCuts = { "MooreSegments":0.07, "ConvertedMBoySegments":0.07 } + + clusStatWords = [ "Unspoiled", "Simple", "Edge", "MultiPeak", "Narrow", + "Wide", "Skewed", "QRatInc", "StripFitFailed", + "SplitUnspoiled", "SplitSimple", "SplitEdge", "SplitMultiPeak", + "SplitNarrow", "SplitWide", "SplitSkewed", "SplitQRatInc", + "SplitStripFitFailed", "Undefined" ] + + ## trigger-aware monitoring: sample seletion triggers (express stream menu physics_pp_v2) + evtSelectionTriggers = [ "L1_MU10", "L1_MU15", "EF_mu20_muCombTag_NoEF", "EF_mu15", "EF_mu15_mu10_EFFS", "EF_2mu10", "EF_2mu10_loose" ] + + CSCSegmValAlg = CSCSegmValAlg ( + name = "CSCSegmValAlg", + SegmentKeys = segmCollections, + TrigDecisionTool = myTrigDecisionTool, + DoEventSelection = False, + EventSelTriggers = evtSelectionTriggers, + SegmentPrefixes = segmPrefixes, SegmentSlopeCuts = segmSlopeCuts, ClusterStatus = clusStatWords) + + ToolSvc += CSCSegmValAlg + cscSegmMonMan.AthenaMonTools += [ CSCSegmValAlg ] + topSequence += cscSegmMonMan + print cscSegmMonMan diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/share/MuonSegmDQA_options.py b/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/share/MuonSegmDQA_options.py new file mode 100755 index 0000000000000000000000000000000000000000..df8c272aba76b7c2e3dc16b5b1f08a391fea86f8 --- /dev/null +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/share/MuonSegmDQA_options.py @@ -0,0 +1,33 @@ +#====================================================================== +# TOP JobOptions to run on MuonSegmMonitoring +#====================================================================== +#print '\n****************************************************************************************\n' +#print " ******** Welcome to the Offline MuonSegmentMonitoring package. ******** " +#print " ******** Documentation may be found at:******** " +#print " **** https://twiki.cern.ch/twiki/bin/view/Atlas/MuonOfflineDQA ***** " +#print '\n****************************************************************************************\n' + +if not 'MuonDQAFlags' in dir(): + print "MuonDQAFlags.py: MuonDQAFlags not yet imported - I import them now" + from MuonDQAMonFlags.MuonDQAFlags import MuonDQAFlags as MuonDQAFlags + +if MuonDQADetFlags.doMuonSegmMon: + muSegmMonMan = AthenaMonManager(name="MuonSegmMonManager", + FileKey = DQMonFlags.monManFileKey(), + Environment = DQMonFlags.monManEnvironment(), + OutputLevel = muonOutputLevel) + ###MuonSegmMonitoring################## + from MuonSegmMonitoring.MuonSegmMonitoringConf import MuonSegmValidation + # Which Segm Collections to read (set array element to 0 or 1): + # 1-> Moore, 2->MuonBoy + MuonSegmValidation = MuonSegmValidation(name = "MuonSegmValidation", + WhichSegmCollections = [1,1], + MuonSegmCollections = ["MooreSegments" ,"ConvertedMBoySegments" ], + doMDT = True, + doRPC = True, + doTGC = True, + doCSC = False ) + ToolSvc += MuonSegmValidation + muSegmMonMan.AthenaMonTools += [ MuonSegmValidation ] + topSequence += muSegmMonMan + print muSegmMonMan diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/share/MuonSegmMonitoring_CPUPerfMon.py b/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/share/MuonSegmMonitoring_CPUPerfMon.py new file mode 100644 index 0000000000000000000000000000000000000000..076de08ddb612ded2805c113ffe15de8a4361ea5 --- /dev/null +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/share/MuonSegmMonitoring_CPUPerfMon.py @@ -0,0 +1,65 @@ +#-------------------------------------------------------------- +# useful CPU PerfMon debugging/info tools +#-------------------------------------------------------------- +theApp.Dlls += [ "GaudiAlg","GaudiAud" ] +#-------------------------------------------------------------- +#Detail time measurement and auditors write out a summary of the time spent +#-------------------------------------------------------------- +from AthenaCommon.ConfigurableDb import getConfigurable +#-------------------------------------------------------------- +# write out summary of the memory usage +#-------------------------------------------------------------- +if MuonDQAFlags.doAuditor: + theApp.AuditAlgorithms=True + theApp.AuditServices=True + theAuditorSvc += getConfigurable("MemStatAuditor")(OutputLevel = WARNING) + #number of events to be skip to detect memory leak + svcMgr.ChronoStatSvc.NumberOfSkippedEventsForMemStat = 5 # number of events to be skip to detect memory leak + if recFlags.doNameAuditor(): + theAuditorSvc += getConfigurable("NameAuditor")() + theAuditorSvc += getConfigurable("ChronoAuditor")() + svcMgr.AthenaPoolCnvSvc.UseDetailChronoStat = True + +if MuonDQAFlags.doFinalCPU: + svcMgr.ChronoStatSvc.ChronoDestinationCout = True + svcMgr.ChronoStatSvc.PrintUserTime = True + svcMgr.ChronoStatSvc.PrintSystemTime = True + svcMgr.ChronoStatSvc.PrintEllapsedTime = True + svcMgr.ChronoStatSvc.AsciiStatsOutputFile = "MuonSegmMonitoring_chronoStats.ascii" +#--------------------------------------------------------------------------- +# printout summary of messages +#--------------------------------------------------------------------------- +theAuditorSvc.Auditors += [ "AlgErrorAuditor" ] +# show summary of WAR NING ER ROR and FATAL messages +#--------------------------------------------------------------------------- +svcMgr.MessageSvc.showStats=True +svcMgr.MessageSvc.statLevel=WARNING +svcMgr.MessageSvc.enableSuppression = True +#-------------------------------------------------------------- +## switch on LSFTimeKeeperSvc +#--------------------------------------------------------------------------- +if MuonDQAFlags.doTimeLimit: + include ("LSFTimeKeeper/LSFTimeKeeperOptions.py") + LSFTimeKeeperSvc= Service("LSFTimeKeeperSvc") + LSFTimeKeeperSvc.OutputLevel=DEBUG +#-------------------------------------------------------------- +# Load Performance monitoring Service +# ------------------------------------------------------------- +if MuonDQAFlags.doMuonDQAPerfMonitoring: + from PerfMonComps.PerfMonFlags import jobproperties + jobproperties.PerfMonFlags.doMonitoring = True + jobproperties.PerfMonFlags.doPersistencyMonitoring = True + jobproperties.PerfMonFlags.OutputFile = "muonsegmmon.perfmon.pmon.gz" + from PerfMonComps.JobOptCfg import PerfMonSvc + svcMgr += PerfMonSvc( "PerfMonSvc", OutputLevel = INFO ) + +#-------------------------------------------------------------- +# Dump configuration to file +#-------------------------------------------------------------- +import os +if MuonDQAFlags.doDumpFile: + f = open("MuonSegmMonitoring_config.txt",'w') + f.write( str(ServiceMgr) + os.linesep ) + f.write( str(ToolSvc) + os.linesep ) + f.write( str(topSequence) + os.linesep ) + f.close() diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/share/MuonSegmMonitoring_Example.py b/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/share/MuonSegmMonitoring_Example.py new file mode 100755 index 0000000000000000000000000000000000000000..466c2fe70a745bc08ee3fc410c16fa3b6cee598d --- /dev/null +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/share/MuonSegmMonitoring_Example.py @@ -0,0 +1,309 @@ +#====================================================================== +# TOP JobOptions to run on Muons Segm Validation +# Nektarios Chr. Benekos (UIUC) - Ilektra Christidi +#====================================================================== +#------------------------------- +# Setup Athena common flags +#-------------------------------- +from AthenaCommon.AthenaCommonFlags import athenaCommonFlags + +# import AlgSequence +from AthenaCommon.AlgSequence import AlgSequence +topSequence = AlgSequence() + +# import ToolSvc +from AthenaCommon.AppMgr import ToolSvc + +# import theApp +from AthenaCommon.AppMgr import theApp + +#import ServiceMgr +from AthenaCommon.AppMgr import ServiceMgr +svcMgr = theApp.serviceMgr() + +#-------------------------------------------------------------- +# Load POOL support - to read conditions in POOL, not events +#-------------------------------------------------------------- +import AthenaPoolCnvSvc.AthenaPool +#-------------------------------------------------------------- +# Access to IOVSvc, IOVDbSvc and CondDBMySQLCnvSvc +#-------------------------------------------------------------- +import IOVDbSvc.IOVDb + +from AthenaCommon import CfgMgr +from RecExConfig.RecFlags import rec as recFlags + +############################################################### +# +# Configuration jobOptions file +# +############################################################### +from RecExConfig.RecFlags import rec as recFlags +#-------------------------------------------------------------------------------- +# Setup Internal flags for the Muon Spectrometer Commissioning (defaults values) +#-------------------------------------------------------------------------------- +from MuonCommRecExample.MuonCommRecFlags import MuonCommRecFlags as MuDetCosmicFlags +from MuonRecExample.MuonRecFlags import muonRecFlags +from MuonRecExample import ConfiguredMuonRec +ConfiguredMuonRec.defaultPackage = 'MuonCommRecExample' + +# initial flags for calibration constants loading and PRDs +MuDetCosmicFlags.doM4 = False +MuDetCosmicFlags.doM5 = True +MuDetCosmicFlags.doP2 = False +# input +MuDetCosmicFlags.doSim = False +#temporary fix +MuDetCosmicFlags.doMDT_TBCabling=True + +#-----------------Results as vector of histos------------------------------------ +MuDetCosmicFlags.doMuonboy=True +MuDetCosmicFlags.doMoore=True +#-------------------------------------------------------------------------------- +# ----Write ESD +MuDetCosmicFlags.doESD = False +############################################################### +#----------------------------------------------------------------- +# Setup Internal flags for the Muon DQA Monitoring (defaults values) +#----------------------------------------------------------------- +from MuonDQAMonitoring.MuonDQAFlags import MuonDQAFlags as MuonDQAFlags + +####CPU and txt files +MuonDQAFlags.doCpuMuonMon = True +MuonDQAFlags.doMuonDQAPerfMonitoring = True +MuonDQAFlags.doAuditor = True +MuonDQAFlags.doFinalCPU = False +MuonDQAFlags.doDumpFile = False +MuonDQAFlags.doSimpleFile = True + +##MuonSegm Monitoring options +MuonDQAFlags.doMuonMonitoring = True +MuonDQAFlags.doMuonSegmMon = True + +##Event Display +MuonDQAFlags.doVP1=False + +#----------------------------------------------------------------- +# setup Mx/Px data +#----------------------------------------------------------------- +if MuDetCosmicFlags.doM4: + ###FOR M4 --> list of good M4 data-->https://twiki.cern.ch/twiki/bin/view/Atlas/M4OnlineRunList + MuonDQAFlags.RunNumber = 20304 + inDir='/castor/cern.ch/grid/atlas/t0/perm/DAQ/' + MuonDQAFlags.InputDir = inDir + datafiles='nsls ' +str(MuonDQAFlags.InputDir)+' | grep 00'+str(MuonDQAFlags.RunNumber)+'.physics.cosmics.' + sampletype='daq.m4_combined.'+str(MuonDQAFlags.RunNumber)+'.physics.cosmics' + +if MuDetCosmicFlags.doM5: + ###FOR M5 --> list of good M5 data-->https://twiki.cern.ch/twiki/bin/view/Atlas/M5MuonRunList + MuonDQAFlags.RunNumber = 29548 #28940 + inDir='/castor/cern.ch/grid/atlas/t0/perm/DAQ/M5' + MuonDQAFlags.InputDir = inDir + datafiles='nsls ' +str(MuonDQAFlags.InputDir)+' | grep daq.m5_combined.00'+str(MuonDQAFlags.RunNumber) + sampletype='daq.m5_combined.'+str(MuonDQAFlags.RunNumber)+'.physics.cosmics' + +if MuDetCosmicFlags.doP2: + ###FOR P2 --> list of good P2 data-->https://twiki.cern.ch/twiki/bin/view/Atlas/P2MuonRunList + MuonDQAFlags.RunNumber = 33623 #33842 # 34267 + inDir='/castor/cern.ch/grid/atlas/t0/perm/DAQ/MuonWeekDec07' + MuonDQAFlags.InputDir = inDir + datafiles='nsls ' +str(MuonDQAFlags.InputDir)+' | grep daq.muon_combined.00'+str(MuonDQAFlags.RunNumber) + sampletype='daq.P2_combined.'+str(MuonDQAFlags.RunNumber)+'.physics.cosmics' + + +############################################################### +# ------------------------------------ +# import GlobalFlags and DetFlags +# ------------------------------------ +from AthenaCommon.GlobalFlags import GlobalFlags +GlobalFlags.DetGeo.set_commis() +GlobalFlags.Print() + +from AthenaCommon.DetFlags import DetFlags +DetFlags.detdescr.Muon_setOn() +DetFlags.detdescr.ID_setOff() +DetFlags.detdescr.LAr_setOff() +DetFlags.detdescr.Tile_setOff() +DetFlags.Print() + +# ----------------------------------------- +# Set Data Inputs (real data or simulation) +# ----------------------------------------- +if MuDetCosmicFlags.doSim: + MuDetCosmicFlags.doTruth = True +#reading simulated data from pool + GlobalFlags.DataSource.set_geant4() + GlobalFlags.InputFormat.set_pool() + include ("MuonCommRecExample/MuDetCosmicDigitization_jobOptions.py") +else: + MuDetCosmicFlags.doTruth = False +#reading real data from ByteStream + GlobalFlags.DataSource.set_data() + GlobalFlags.InputFormat.set_bytestream() + +# synchronise new-style flags +recFlags.doTruth = MuDetCosmicFlags.doTruth + +#-------------------------------------------------------------- +# Load POOL support +#-------------------------------------------------------------- +if MuDetCosmicFlags.doSim: + print 'Run on simulated data ' + include( "AthenaPoolCnvSvc/ReadAthenaPool_jobOptions.py" ) + # Read Pool data + ServiceMgr.EventSelector.InputCollections += [ + "rfio:/castor/cern.ch/user/l/lytken/cosmic_1250/digitization/MuonVolume/withEndCaps/dig.05AprProd-10000000.root", + "rfio:/castor/cern.ch/user/l/lytken/cosmic_1250/digitization/MuonVolume/withEndCaps/dig.05AprProd-10000001.root", + "rfio:/castor/cern.ch/user/l/lytken/cosmic_1250/digitization/MuonVolume/withEndCaps/dig.05AprProd-10000099.root" + ] + ServiceMgr.PoolSvc.AttemptCatalogPatch = True + +else: + print 'Run on Real data ' + include( "ByteStreamCnvSvc/BSEventStorageEventSelector_jobOptions.py" ) + svcMgr.ROBDataProviderSvc.filterEmptyROB = True + include( "ByteStreamCnvSvcBase/BSAddProvSvc_RIO_jobOptions.py" ) + include( "ByteStreamCnvSvcBase/BSAddProvSvc_RDO_jobOptions.py" ) + # Specify input file + ByteStreamInputSvc = svcMgr.ByteStreamInputSvc + # Input directory + ByteStreamInputSvc.InputDirectory = [ MuonDQAFlags.InputDir ] + # Prefix + ByteStreamInputSvc.FilePrefix = [ MuonDQAFlags.FilePrefix ] + # Run number + ByteStreamInputSvc.RunNumber = [ MuonDQAFlags.RunNumber ] + if MuonDQAFlags.doSimpleFile: + fileNames = os.popen(datafiles).readlines() + fileNames.sort() + ByteStreamInputSvc.FullFileName += [ os.path.join(inDir,f).strip() for f in fileNames ] + print "Input files:" + print ByteStreamInputSvc.FullFileName + +# ------------------------------------ +# Detector Description /IOV Svc +# ------------------------------------ +include ("MuonCommRecExample/MuDetCosmicDetDescr_jobOptions.py" ) +#-------------------------------------------------------------- +# include joboptions to read Muon PREPRAWDATA, cabling maps +#-------------------------------------------------------------- +include ("MuonCommRecExample/MuDetCosmicPRD_jobOptions.py") +#-------------------------------------------------------------- +#initialize MuCTPI converter +#-------------------------------------------------------------- +if MuDetCosmicFlags.doMUCTPI or MuDetCosmicFlags.doCTP: + include ("MuonCommRecExample/ReadMuCTPI_jobOptions.py") +#-------------------------------------------------------------- +# Conditions database access (only for real data for the moment) +#-------------------------------------------------------------- +if not MuDetCosmicFlags.doSim: + include ("MuonCommRecExample/MuDetCosmicConDB_jobOptions.py") +#-------------------------------------------------------------- +# Setup reconstruction +#-------------------------------------------------------------- +include("MuonCommRecExample/MuonCommRec_jobOptions.py") +#-------------------------------------------------------------- +# Write out ESD +#-------------------------------------------------------------- +if MuDetCosmicFlags.doESD: + include( "MuonCommRecExample/MuDetCosmicPOOL_jobOptions.py") +#-------------------------------------------------------------- +# Monitoring Histogram +#-------------------------------------------------------------- +if MuonDQAFlags.doMuonMonitoring: + if MuonDQAFlags.doMuonSegmMon: + include("MuonSegmMonitoring/MuonSegmMonitoring_options.py") + if MuDetCosmicFlags.doMoore and not MuDetCosmicFlags.doMuonboy: + ToolSvc.MuonSegmValidation.WhichSegmCollections = [1,0] + if MuDetCosmicFlags.doMuonboy and not MuDetCosmicFlags.doMoore: + ToolSvc.MuonSegmValidation.WhichSegmCollections = [0,1] +### Histograms Service + from GaudiSvc.GaudiSvcConf import THistSvc + svcMgr +=THistSvc() + atlaspak='MuonSegmMonitoring' + RootHistOutputFileName = str(atlaspak)+'.'+str(sampletype)+'.root' + + from MuonDQAUtils.MuonDQAUtilsConf import Muon__MuonDQATrackHistTool + Muon__MuonDQATrackHistTool = Muon__MuonDQATrackHistTool(name = "MuonDQATrackHistTool" ) + ToolSvc += Muon__MuonDQATrackHistTool + +# Writing the histogram file + if os.path.exists(RootHistOutputFileName): + os.remove(RootHistOutputFileName) + # Writing the histogram files from each sub-algorithm + svcMgr.THistSvc.Output += ["GLOBAL DATAFILE='%s' OPT='NEW'" % RootHistOutputFileName ] + +#-------------------------------------------------------------- +# Graphics +#-------------------------------------------------------------- +if MuDetCosmicFlags.doGraphics: + include( "MuonCommRecExample/MuDetCosmicGraphics_jobOptions.py" ) +#-------------------------------------------------------------- +# Performace monitoring (CPU and Memory) +#-------------------------------------------------------------- +if MuonDQAFlags.doCpuMuonMon: + include("MuonSegmMonitoring/MuonSegmMonitoring_CPUPerfMon.py") +# ------------------------------------------------------------- +# Number of events to be processed (default is 10) +# ------------------------------------------------------------- +# get EventSelector +from ByteStreamCnvSvc.ByteStreamCnvSvcConf import EventSelectorByteStream +svcMgr += EventSelectorByteStream("EventSelector") +theApp.EvtSel = "EventSelector" +# for EventType +from ByteStreamCnvSvc.ByteStreamCnvSvcConf import ByteStreamCnvSvc +svcMgr += ByteStreamCnvSvc() +# Properties +EventSelector = svcMgr.EventSelector +EventSelector.ByteStreamInputSvc = "ByteStreamInputSvc"; +EventPersistencySvc = svcMgr.EventPersistencySvc +EventPersistencySvc.CnvServices += [ "ByteStreamCnvSvc" ] + +MuDetCosmicFlags.EvtMax=10 +# Number of events to be processed (default is 10) +theApp.EvtMax = MuDetCosmicFlags.EvtMax + +MuDetCosmicFlags.SkipEvents=0 +svcMgr.EventSelector.SkipEvents=MuDetCosmicFlags.SkipEvents + +# ------------------------------------------------------------- +#Output level +# ------------------------------------------------------------- +ServiceMgr += CfgMgr.MessageSvc( Format = "% F%50W%S%7W%R%T %0W%M", + defaultLimit=1000000 , + OutputLevel = INFO, + useColors = False # use color output text + ) +#-------------------------------------------------------------- +#For Callgrind Tests +#-------------------------------------------------------------- +if MuonDQAFlags.doCallgrind: + from Valkyrie.ValkyrieConf import ValgrindSvc + valgrindSvc = ValgrindSvc( OutputLevel = VERBOSE ) + if MuonDQAFlags.doMuonHitMon: + valgrindSvc.ProfiledAlgs += MuonDQAFlags.CallgrindSegmAlgs + valgrindSvc.IgnoreFirstNEvents = MuonDQAFlags.CallgrindSkip # to start instrumentation after the second event only + # Add service and turn on auditing + svcMgr += valgrindSvc + theApp.CreateSvc += [svcMgr.ValgrindSvc.getFullJobOptName()] + theApp.AuditAlgorithms = True + theApp.AuditTools = True + theApp.AuditServices = True + +#--------------------------------------------------------------------------- +# THIS IS TEMPORY HACK TO GET RID OF MUON ERRORS BEING PRINTED FOR EVERY EVENT +# NEED A REAL FIX +#--------------------------------------------------------------------------- +ToolSvc += CfgMgr.MuonSegmValidation(OutputLevel = INFO) +Service( "THistSvc" ).OutputLevel = WARNING +#--------------------------------------------------------------------------- +print "List all DLL" +print theApp.Dlls +print "List all ExtSvc" +print theApp.ExtSvc +print "List of all top algorithms" +print theApp.TopAlg +#--------------------------------------------------------------------------- +print topSequence +print ServiceMgr +print ToolSvc +#====================================================================== diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/share/MuonSegmMonitoring_options.py b/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/share/MuonSegmMonitoring_options.py new file mode 100755 index 0000000000000000000000000000000000000000..c8681eb2570b8d24b72ed11708694bc91fb59d22 --- /dev/null +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/share/MuonSegmMonitoring_options.py @@ -0,0 +1,25 @@ +#====================================================================== +# TOP JobOptions to run on MuonSegmMonitoring +#====================================================================== +from MuonDQAMonFlags.MuonDQAFlags import MuonDQAFlags as MuonDQAFlags +from MuonSegmMonitoring.MuonSegmMonitoringConf import MuonSegmValidation +if MuonDQAFlags.doMuonSegmMon: + #############MuonSegmValidation############# + MuonSegmValidation = MuonSegmValidation ( + name = "MuonSegmValidation" ) + ### Which Segm Collections to read (set array element to 0 or 1): + # 1-> Moore, 2->MuonBoy + MuonSegmValidation.WhichSegmCollections = [1,1] + MuonSegmValidation.MuonSegmCollections = ["MooreSegments" ,"ConvertedMBoySegments" ] + ToolSvc += MuonSegmValidation + monMan.AthenaMonTools += [ MuonSegmValidation ] + + #====================================================================== + # CSC Segment Monitoring JobOptions + #====================================================================== + from MuonSegmMonitoring.MuonSegmMonitoringConf import CSCSegmValAlg + segmCollections = { "MooreSegments":1, "ConvertedMBoySegments":1 } + CSCSegmValAlg = CSCSegmValAlg ( name = "CSCSegmValAlg", MuonSegmentKeys = segmCollections ) + ToolSvc += CSCSegmValAlg + monMan.AthenaMonTools += [ CSCSegmValAlg ] + diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/src/CSCSegmValAlg.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/src/CSCSegmValAlg.cxx new file mode 100755 index 0000000000000000000000000000000000000000..96443795bd28f91b84c0d6fae0e012b45b73ec69 --- /dev/null +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/src/CSCSegmValAlg.cxx @@ -0,0 +1,1124 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/* ********************************************************************** + * Program : CSCSegmValAlg + * Package : MuonSegmMonitoring + * Authors : Venkat Kaushik <Venkat.Kaushik@CERN.CH> Jason Veatch <jason.veatch@cern.ch> + * Purpose : CSC segment monitoring source code + *---------------------------------------------------------------------- + */ + +#include "MuonSegmMonitoring/CSCSegmValAlg.h" + +#include "MuonPrepRawData/CscClusterStatus.h" +#include "MuonPrepRawData/CscStripPrepDataCollection.h" +#include "MuonPrepRawData/CscStripPrepDataContainer.h" +#include "MuonPrepRawData/CscPrepData.h" + +#include "MuonRecHelperTools/MuonEDMHelperTool.h" +#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/CscIdHelper.h" +#include "MuonIdHelpers/TgcIdHelper.h" + +// Track +#include "TrkTrack/TrackCollection.h" +#include "TrkEventPrimitives/PropDirection.h" +#include "TrkEventPrimitives/LocalDirection.h" +#include "TrkSurfaces/PlaneSurface.h" + + +#include "TrkCompetingRIOsOnTrack/CompetingRIOsOnTrack.h" +#include "MuonRIO_OnTrack/CscClusterOnTrack.h" + +// Gaudi Tools +#include "GaudiKernel/SmartDataPtr.h" +#include "GaudiKernel/INTupleSvc.h" +#include "AthenaMonitoring/AthenaMonManager.h" + +// Storegate +#include "StoreGate/StoreGate.h" + +// ROOT +#include "TH1.h" +#include "TH1F.h" +#include "TH2F.h" +#include "TMath.h" + +// STL +#include <sstream> +using CLHEP::cm3; + +//________________________________________________________________________________________________________ +CSCSegmValAlg::CSCSegmValAlg( const std::string & type, const std::string & name, const IInterface* parent ) + : ManagedMonitorToolBase( type, name, parent ), + m_storeGate(0), + m_trigDec( "" ), + m_debuglevel(false) { + m_helperTool = ToolHandle<Muon::MuonEDMHelperTool>("Muon::MuonEDMHelperTool/MuonEDMHelperTool"); + m_idHelperTool = ToolHandle<Muon::MuonIdHelperTool>("Muon::MuonIdHelperTool/MuonIdHelperTool"); + + //declareProperty( "UseCollections", m_segmCollectionFlag); + declareProperty( "SegmentKeys", m_segmKey); + declareProperty( "SegmentPrefixes", m_segmPrefix); + declareProperty( "SegmentSlopeCuts", m_segmSlope); + declareProperty( "ClusterStatus", m_clusStatWord); + + //trigger aware monitoring + declareProperty("TrigDecisionTool", m_trigDec ); + declareProperty("DoEventSelection", m_doEvtSel = false ); + declareProperty("EventSelTriggers", m_sampSelTriggers ); + + ATH_MSG_INFO( " in CSCSegmValAlg::CSCSegmValAlg() " ); +} + + +//________________________________________________________________________________________________________ +CSCSegmValAlg::~CSCSegmValAlg() { + for(unsigned int i = 0; i < m_segmDetail_EA.size(); i++) { + if(m_segmDetail_EA[i]) { delete m_segmDetail_EA[i]; m_segmDetail_EA[i] = 0; } + } + m_segmDetail_EA.clear(); + for(unsigned int i = 0; i < m_segmDetail_EC.size(); i++) { + if(m_segmDetail_EC[i]) { delete m_segmDetail_EC[i]; m_segmDetail_EC[i] = 0; } + } + m_segmDetail_EC.clear(); + for(unsigned int i = 0; i < m_segmOview_EA.size(); i++) { + if(m_segmOview_EA[i]) { delete m_segmOview_EA[i]; m_segmOview_EA[i] = 0; } + } + m_segmOview_EA.clear(); + for(unsigned int i = 0; i < m_segmOview_EC.size(); i++) { + if(m_segmOview_EC[i]) { delete m_segmOview_EC[i]; m_segmOview_EC[i] = 0; } + } + m_segmOview_EC.clear(); + + ATH_MSG_INFO( " in CSCSegmValAlg::~CSCSegmValAlg() " ); +} + + + +//________________________________________________________________________________________________________ +StatusCode CSCSegmValAlg::initialize() { + + bookedhistos=false; + + StatusCode sc = ManagedMonitorToolBase::initialize(); + if(!sc.isSuccess()) return sc; + + ATH_MSG_INFO( "in CSCSegmValAlg::init()" ); + + if( m_doEvtSel ) { + sc = m_trigDec.retrieve(); + if ( sc.isFailure() ) { + ATH_MSG_WARNING ( "CSCSegmValAlg: Unable to retrieve trigger decision tool"); + m_doEvtSel = false; + //return sc; + } else { + ATH_MSG_INFO ( "TrigDecisionTool : " << "Using TDT \"" << m_trigDec->name() << "\"" ); + } + //m_doEvtSel = false; + } + + if(m_sampSelTriggers.empty() && m_doEvtSel) { + ATH_MSG_WARNING("Event selection triggers not specified. Switching off trigger-aware monitoring"); + m_doEvtSel = false; + } + + + // load defaults if items are empty or inconsistent + if(m_segmKey.empty()) { + m_segmKey.insert(std::pair<std::string, int>("MooreSegments",1)); + } + if(m_segmPrefix.empty() || (m_segmPrefix.size() != m_segmKey.size())) { + m_segmPrefix.clear(); + m_segmSlope.clear(); + for(MuonSegmIter it = m_segmKey.begin(); it != m_segmKey.end(); ++it ) { + std::string prefix = (*it).first; + if(prefix.length()>2) prefix = prefix.substr(0,prefix.length()/2); + m_segmPrefix.insert(std::pair<std::string, std::string>((*it).first,prefix)); + m_segmSlope.insert(std::pair<std::string, double>((*it).first,0.07)); + + } + } + if(m_clusStatWord.empty()) { + m_clusStatWord.push_back("Unspoiled"); m_clusStatWord.push_back("Simple"); + m_clusStatWord.push_back("Edge"); m_clusStatWord.push_back("MultiPeak"); + m_clusStatWord.push_back("Narrow"); m_clusStatWord.push_back("Wide"); + m_clusStatWord.push_back("Skewed"); m_clusStatWord.push_back("QRatInc"); + m_clusStatWord.push_back("StripFitFailed"); m_clusStatWord.push_back("SplitUnspoiled"); + m_clusStatWord.push_back("SplitSimple"); m_clusStatWord.push_back("SplitEdge"); + m_clusStatWord.push_back("SplitMultiPeak"); m_clusStatWord.push_back("SplitNarrow"); + m_clusStatWord.push_back("SplitWide"); m_clusStatWord.push_back("SplitSkewed"); + m_clusStatWord.push_back("SplitQRatInc"); m_clusStatWord.push_back("SplitStripFitFailed"); + } + + m_NClusWord.clear(); + m_NClusWord.push_back("234"); + m_NClusWord.push_back("134"); + m_NClusWord.push_back("124"); + m_NClusWord.push_back("123"); + m_NClusWord.push_back("All"); + + + // initialize num of collections + m_ncoll = m_segmKey.size(); + + //initializing tools + // Retrieve the StoreGate service + + sc = service( "StoreGateSvc", m_storeGate ); + if ( sc.isFailure() ){ + ATH_MSG_FATAL( "Unable to retrieve the StoreGate service... Exiting!" ); + return sc; + } + if (m_debuglevel) ATH_MSG_DEBUG( "Defined detector service" ); + + // Initialize the IdHelper + StoreGateSvc* detStore = 0; + sc = service("DetectorStore", detStore); + if (sc.isFailure()) { + ATH_MSG_FATAL( "DetectorStore service not found !" ); + return sc; + } + if (m_debuglevel) ATH_MSG_DEBUG( "Defined DetectorStore" ); + + + sc = detStore->retrieve(m_cscIdHelper,"CSCIDHELPER"); + if (sc.isFailure()) { + ATH_MSG_FATAL( "Cannot get CscIdHelper" ); + return sc; + } + if (m_debuglevel) ATH_MSG_DEBUG( " Found the CscIdHelper " ); + + sc = detStore->retrieve(m_tgcIdHelper,"TGCIDHELPER"); + if (sc.isFailure()) { + ATH_MSG_FATAL( "Can't retrieve TgcIdHelper" ); + return sc; + } + if (m_debuglevel) ATH_MSG_DEBUG( " Found the TgcIdHelper " ); + + // Retrieve helper tools + sc = m_helperTool.retrieve(); + if (sc.isFailure()){ + ATH_MSG_FATAL("Could not get " << m_helperTool ); + return sc; + } + if (m_debuglevel) ATH_MSG_DEBUG( "Retrieved " << m_helperTool ); + + sc = m_idHelperTool.retrieve(); + if (sc.isFailure()){ + ATH_MSG_FATAL( "Could not get " << m_idHelperTool ); + return sc; + } + if (m_debuglevel) ATH_MSG_DEBUG( "Retrieved " << m_idHelperTool ); + + return sc; +} + + +//________________________________________________________________________________________________________ +void CSCSegmValAlg::bookSegmentHistograms() { + + + // Book histograms + + int nybinsEA = 90; // 16 chambers (x 5 layers per chamber) + 1 set extra + float nyminEA = 0.; // + float nymaxEA = 18.; // + + int nybinsEC = 85; // 16 chambers (x 5 layers per chamber) + 1 set extra + float nyminEC = -17.; // + float nymaxEC = 0.; // + + + int nsegbins = 20; + float nsegmin = 0; + float nsegmax = 80; + + int nclustbins = 50; + float nclustmin = .5; + float nclustmax = 5.5; + + // (1ke = 1ADC = 1 count) 80, 0, 4000. + int nqbins = 80; + float nqmin = 0.; + float nqmax = 4000.; + + int ntbins = 40; + float ntmin = -200.; + float ntmax = 200.; + + + int nsbins = 11; + float nsmin = -0.5; + float nsmax = 10.5; + + clearHistogramVectors(); + + std::string segm_detailA = "Muon/MuonSegmentMonitoring/EndCapA/Detail/"; + std::string segm_detailC = "Muon/MuonSegmentMonitoring/EndCapC/Detail/"; + std::string segm_oviewA = "Muon/MuonSegmentMonitoring/EndCapA/Overview/"; + std::string segm_oviewC = "Muon/MuonSegmentMonitoring/EndCapC/Overview/"; + + unsigned int ic = 0; + for(MuonSegmIter it = m_segmKey.begin(); it != m_segmKey.end(); ++it, ic++ ) { + std::string theKey = (*it).first; + int useSegm = (*it).second; + if (useSegm != 1) continue; + + if (m_debuglevel) ATH_MSG_DEBUG("Finished booking histos for " << theKey ); + + std::string pfx = m_segmPrefix[theKey]; + + float binmin = -0.5; + int nbins = m_clusStatWord.size(); + float binmax = float(nbins) + binmin; + + MgmtAttr_t attr = ATTRIB_MANAGED; + m_segmDetail_EA.push_back(new MonGroup(this, segm_detailA+theKey+"/CSC", run, attr ));; + m_segmDetail_EC.push_back(new MonGroup(this, segm_detailC+theKey+"/CSC", run, attr )); + m_segmOview_EA.push_back(new MonGroup(this, segm_oviewA+theKey+"/CSC", run, attr )); + m_segmOview_EC.push_back(new MonGroup(this, segm_oviewC+theKey+"/CSC", run, attr )); + + // segment hists + h2CSC_Segm_NumOfSegs_EA.push_back( new TH2F(Form("%s_Segm_NumSegments_EA",pfx.c_str()), + Form("EndCap A: No. of segments; #segments;[sector] + [0.2 #times layer]"), + nsegbins,nsegmin,nsegmax,nybinsEA,nyminEA,nymaxEA)); + h2CSC_Segm_NumOfSegs_EC.push_back( new TH2F(Form("%s_Segm_NumSegments_EC",pfx.c_str()), + Form("EndCap C: No. of segments; #segments;[sector] + [0.2 #times layer]"), + nsegbins,nsegmin,nsegmax,nybinsEC,nyminEC,nymaxEC)); + regCSCHist(h2CSC_Segm_NumOfSegs_EA[ic], m_segmOview_EA[ic]); + regCSCHist(h2CSC_Segm_NumOfSegs_EC[ic], m_segmOview_EC[ic]); + + // precision clusters on segment + + h2CSC_Segm_NumOfNClusSegs_Eta_EA.push_back(new TH2F(Form("%s_Segm_NumNClusSegments_EA",pfx.c_str()), + Form("EndCap A: #eta-number of 3 and 4 cluster segments with each layer;counts;[sector] + [0.2 #times layer]"), + nclustbins,nclustmin,nclustmax,nybinsEA,nyminEA,nymaxEA)); + setCSCLayerLabels(h2CSC_Segm_NumOfNClusSegs_Eta_EA[ic], 1); + h2CSC_Segm_NumOfNClusSegs_Eta_EC.push_back(new TH2F(Form("%s_Segm_NumNClusSegments_EC",pfx.c_str()), + Form("EndCap C: #eta-number of 3 and 4 cluster segments with each layer;counts;[sector] + [0.2 #times layer]"), + nclustbins,nclustmin,nclustmax,nybinsEC,nyminEC,nymaxEC)); + setCSCLayerLabels(h2CSC_Segm_NumOfNClusSegs_Eta_EC[ic], -1); + regCSCHist(h2CSC_Segm_NumOfNClusSegs_Eta_EA[ic], m_segmDetail_EA[ic]); + regCSCHist(h2CSC_Segm_NumOfNClusSegs_Eta_EC[ic], m_segmDetail_EC[ic]); + + for (size_t j = 0; j < m_NClusWord.size(); j++) { + h2CSC_Segm_NumOfNClusSegs_Eta_EA[ic]->GetXaxis()->SetBinLabel(j*10+5, m_NClusWord[j].c_str()); + h2CSC_Segm_NumOfNClusSegs_Eta_EC[ic]->GetXaxis()->SetBinLabel(j*10+5, m_NClusWord[j].c_str()); + } + + h1CSC_Segm_Efficiency_Eta_EA.push_back(new TH1F(Form("%s_Segm_Efficiency_EA",pfx.c_str()), + Form("EndCap A: #eta-segment efficiency per sector;[sector] + [0.2 #times layer];efficiency"), + nybinsEA,nyminEA,nymaxEA)); + setCSCLayerLabels(h1CSC_Segm_Efficiency_Eta_EA[ic], 1); + h1CSC_Segm_Efficiency_Eta_EC.push_back(new TH1F(Form("%s_Segm_Efficiency_EC",pfx.c_str()), + Form("EndCap C: #eta-segment efficiency per sector;[sector] + [0.2 #times layer];efficiency"), + nybinsEC,nyminEC,nymaxEC)); + setCSCLayerLabels(h1CSC_Segm_Efficiency_Eta_EC[ic], -1); + + regCSCHist(h1CSC_Segm_Efficiency_Eta_EA[ic], m_segmOview_EA[ic]); + regCSCHist(h1CSC_Segm_Efficiency_Eta_EC[ic], m_segmOview_EC[ic]); + + h2CSC_Segm_QsumOfGoodClusMap_Eta_EA.push_back(new TH2F(Form("%s_Segm_QSumEtaGoodClusPerLayer_EA",pfx.c_str()), + Form("EndCap A: #eta-cluster charge per layer;counts;[sector] + [0.2 #times layer]"), + nqbins,nqmin,nqmax,nybinsEA,nyminEA,nymaxEA)); + + h2CSC_Segm_QsumOfGoodClusMap_Eta_EC.push_back(new TH2F(Form("%s_Segm_QSumEtaGoodClusPerLayer_EC",pfx.c_str()), + Form("EndCap C: #eta-cluster charge per layer;counts;[sector] + [0.2 #times layer]"), + nqbins,nqmin,nqmax,nybinsEC,nyminEC,nymaxEC)); + + regCSCHist(h2CSC_Segm_QsumOfGoodClusMap_Eta_EA[ic], m_segmOview_EA[ic]); + regCSCHist(h2CSC_Segm_QsumOfGoodClusMap_Eta_EC[ic], m_segmOview_EC[ic]); + + h2CSC_Segm_TimeOfGoodClusMap_Eta_EA.push_back(new TH2F(Form("%s_Segm_TimeEtaGoodClusPerLayer_EA",pfx.c_str()), + Form("EndCap A: #eta-cluster time per layer;time [ns];[sector] + [0.2 #times layer]"), + ntbins,ntmin,ntmax,nybinsEA,nyminEA,nymaxEA)); + + h2CSC_Segm_TimeOfGoodClusMap_Eta_EC.push_back(new TH2F(Form("%s_Segm_TimeEtaGoodClusPerLayer_EC",pfx.c_str()), + Form("EndCap C: #eta-cluster time per layer;time [ns];[sector] + [0.2 #times layer]"), + ntbins,ntmin,ntmax,nybinsEC,nyminEC,nymaxEC)); + + regCSCHist(h2CSC_Segm_TimeOfGoodClusMap_Eta_EA[ic], m_segmOview_EA[ic]); + regCSCHist(h2CSC_Segm_TimeOfGoodClusMap_Eta_EC[ic], m_segmOview_EC[ic]); + + + h1CSC_Segm_StatOfClus_Eta_EA.push_back( new TH1F(Form("%s_Segm_EtaClusterStatus_EA",pfx.c_str()), + "Endcap A: #eta-cluster status;;entries",nbins,binmin,binmax)); + + h1CSC_Segm_StatOfClus_Eta_EC.push_back( new TH1F(Form("%s_Segm_EtaClusterStatus_EC",pfx.c_str()), + "Endcap C: #eta-cluster status;;entries",nbins,binmin,binmax)); + for (size_t j = 0; j < m_clusStatWord.size(); j++) { + h1CSC_Segm_StatOfClus_Eta_EA[ic]->GetXaxis()->SetBinLabel(j+1, m_clusStatWord[j].c_str()); + h1CSC_Segm_StatOfClus_Eta_EC[ic]->GetXaxis()->SetBinLabel(j+1, m_clusStatWord[j].c_str()); + } + regCSCHist(h1CSC_Segm_StatOfClus_Eta_EA[ic], m_segmDetail_EA[ic]); + regCSCHist(h1CSC_Segm_StatOfClus_Eta_EC[ic], m_segmDetail_EC[ic]); + + h1CSC_Segm_NumOfClus_Eta_EA.push_back( new TH1F(Form("%s_Segm_NumEtaCluster_EA",pfx.c_str()), + "Endcap A: No. of #eta-clusters on segment;#clusters;entries", nsbins,nsmin,nsmax)); + h1CSC_Segm_NumOfClus_Eta_EC.push_back( new TH1F(Form("%s_Segm_NumEtaCluster_EC",pfx.c_str()), + "Endcap C: No. of #eta-clusters on segment;#clusters;entries", nsbins,nsmin,nsmax)); + regCSCHist(h1CSC_Segm_NumOfClus_Eta_EA[ic], m_segmDetail_EA[ic]); + regCSCHist(h1CSC_Segm_NumOfClus_Eta_EC[ic], m_segmDetail_EC[ic]); + + h1CSC_Segm_NumOfGoodClus_Eta_EA.push_back( new TH1F(Form("%s_Segm_NumGoodEtaCluster_EA",pfx.c_str()), + "Endcap A: No. of good #eta-clusters on segment;#good-clusters;entries", nsbins,nsmin,nsmax)); + h1CSC_Segm_NumOfGoodClus_Eta_EC.push_back( new TH1F(Form("%s_Segm_NumGoodEtaCluster_EC",pfx.c_str()), + "Endcap C: No. of good #eta-clusters on segment;#good-clusters;entries", nsbins,nsmin,nsmax)); + regCSCHist(h1CSC_Segm_NumOfGoodClus_Eta_EA[ic], m_segmDetail_EA[ic]); + regCSCHist(h1CSC_Segm_NumOfGoodClus_Eta_EC[ic], m_segmDetail_EC[ic]); + + h1CSC_Segm_QsumOfClus_Eta_EA.push_back( new TH1F(Form("%s_Segm_QSumEtaCluster_EA",pfx.c_str()), + "Endcap A: #eta-cluster Qsum;counts;entries", nqbins,nqmin,nqmax )); + h1CSC_Segm_QsumOfClus_Eta_EC.push_back( new TH1F(Form("%s_Segm_QSumEtaCluster_EC",pfx.c_str()), + "Endcap C: #eta-cluster Qsum;counts;entries", nqbins,nqmin,nqmax )); + regCSCHist(h1CSC_Segm_QsumOfClus_Eta_EA[ic], m_segmDetail_EA[ic]); + regCSCHist(h1CSC_Segm_QsumOfClus_Eta_EC[ic], m_segmDetail_EC[ic]); + + h1CSC_Segm_TimeOfClus_Eta_EA.push_back( new TH1F(Form("%s_Segm_TimeEtaCluster_EA",pfx.c_str()), + "Endcap A: #eta-cluster Time;time [ns];entries", ntbins,ntmin,ntmax )); + h1CSC_Segm_TimeOfClus_Eta_EC.push_back( new TH1F(Form("%s_Segm_TimeEtaCluster_EC",pfx.c_str()), + "Endcap C: #eta-cluster Time;time [ns];entries", ntbins,ntmin,ntmax )); + regCSCHist(h1CSC_Segm_TimeOfClus_Eta_EA[ic], m_segmDetail_EA[ic]); + regCSCHist(h1CSC_Segm_TimeOfClus_Eta_EC[ic], m_segmDetail_EC[ic]); + + h1CSC_Segm_QsumOfGoodClus_Eta_EA.push_back( new TH1F(Form("%s_Segm_QSumGoodEtaCluster_EA",pfx.c_str()), + "Endcap A: Good #eta-cluster Qsum;counts;entries", nqbins,nqmin,nqmax )); + h1CSC_Segm_QsumOfGoodClus_Eta_EC.push_back( new TH1F(Form("%s_Segm_QSumGoodEtaCluster_EC",pfx.c_str()), + "Endcap C: Good #eta-cluster Qsum;counts;entries", nqbins,nqmin,nqmax )); + regCSCHist(h1CSC_Segm_QsumOfGoodClus_Eta_EA[ic], m_segmDetail_EA[ic]); + regCSCHist(h1CSC_Segm_QsumOfGoodClus_Eta_EC[ic], m_segmDetail_EC[ic]); + + h1CSC_Segm_TimeOfGoodClus_Eta_EA.push_back( new TH1F(Form("%s_Segm_TimeGoodEtaCluster_EA",pfx.c_str()), + "Endcap A: Good #eta-cluster Time;time [ns];entries", ntbins,ntmin,ntmax )); + h1CSC_Segm_TimeOfGoodClus_Eta_EC.push_back( new TH1F(Form("%s_Segm_TimeGoodEtaCluster_EC",pfx.c_str()), + "Endcap C: Good #eta-cluster Time;time [ns];entries", ntbins,ntmin,ntmax )); + regCSCHist(h1CSC_Segm_TimeOfGoodClus_Eta_EA[ic], m_segmDetail_EA[ic]); + regCSCHist(h1CSC_Segm_TimeOfGoodClus_Eta_EC[ic], m_segmDetail_EC[ic]); + + + // transverse clusters on segment + h2CSC_Segm_QsumOfGoodClusMap_Phi_EA.push_back(new TH2F(Form("%s_Segm_QSumPhiGoodClusPerLayer_EA",pfx.c_str()), + Form("EndCap A: #phi-cluster charge per layer;counts;[sector] + [0.2 #times layer]"), + nqbins,nqmin,nqmax,nybinsEA,nyminEA,nymaxEA)); + + h2CSC_Segm_QsumOfGoodClusMap_Phi_EC.push_back(new TH2F(Form("%s_Segm_QSumPhiGoodClusPerLayer_EC",pfx.c_str()), + Form("EndCap C: #phi-cluster charge per layer;counts;[sector] + [0.2 #times layer]"), + nqbins,nqmin,nqmax,nybinsEC,nyminEC,nymaxEC)); + + regCSCHist(h2CSC_Segm_QsumOfGoodClusMap_Phi_EA[ic], m_segmOview_EA[ic]); + regCSCHist(h2CSC_Segm_QsumOfGoodClusMap_Phi_EC[ic], m_segmOview_EC[ic]); + + h2CSC_Segm_TimeOfGoodClusMap_Phi_EA.push_back(new TH2F(Form("%s_Segm_TimePhiGoodClusPerLayer_EA",pfx.c_str()), + Form("EndCap A: #phi-cluster time per layer;time [ns];[sector] + [0.2 #times layer]"), + ntbins,ntmin,ntmax,nybinsEA,nyminEA,nymaxEA)); + + h2CSC_Segm_TimeOfGoodClusMap_Phi_EC.push_back(new TH2F(Form("%s_Segm_TimePhiGoodClusPerLayer_EC",pfx.c_str()), + Form("EndCap C: #phi-cluster time per layer;time [ns];[sector] + [0.2 #times layer]"), + ntbins,ntmin,ntmax,nybinsEC,nyminEC,nymaxEC)); + + regCSCHist(h2CSC_Segm_TimeOfGoodClusMap_Phi_EA[ic], m_segmOview_EA[ic]); + regCSCHist(h2CSC_Segm_TimeOfGoodClusMap_Phi_EC[ic], m_segmOview_EC[ic]); + + h1CSC_Segm_StatOfClus_Phi_EA.push_back( new TH1F(Form("%s_Segm_PhiClusterStatus_EA",pfx.c_str()), + "Endcap A: #phi-cluster status;;entries",nbins,binmin,binmax)); + + h1CSC_Segm_StatOfClus_Phi_EC.push_back( new TH1F(Form("%s_Segm_PhiClusterStatus_EC",pfx.c_str()), + "Endcap C: #phi-cluster status;;entries",nbins,binmin,binmax)); + + for (size_t j = 0; j < m_clusStatWord.size(); j++) { + h1CSC_Segm_StatOfClus_Phi_EA[ic]->GetXaxis()->SetBinLabel(j+1, m_clusStatWord[j].c_str()); + h1CSC_Segm_StatOfClus_Phi_EC[ic]->GetXaxis()->SetBinLabel(j+1, m_clusStatWord[j].c_str()); + } + regCSCHist(h1CSC_Segm_StatOfClus_Phi_EA[ic], m_segmDetail_EA[ic]); + regCSCHist(h1CSC_Segm_StatOfClus_Phi_EC[ic], m_segmDetail_EC[ic]); + + h1CSC_Segm_NumOfClus_Phi_EA.push_back( new TH1F(Form("%s_Segm_NumPhiCluster_EA",pfx.c_str()), + "Endcap A: No. of #phi-clusters on segment;#clusters;entries", nsbins,nsmin,nsmax)); + h1CSC_Segm_NumOfClus_Phi_EC.push_back( new TH1F(Form("%s_Segm_NumPhiCluster_EC",pfx.c_str()), + "Endcap C: No. of #phi-clusters on segment;#clusters;entries", nsbins,nsmin,nsmax)); + regCSCHist(h1CSC_Segm_NumOfClus_Phi_EA[ic], m_segmDetail_EA[ic]); + regCSCHist(h1CSC_Segm_NumOfClus_Phi_EC[ic], m_segmDetail_EC[ic]); + + h1CSC_Segm_NumOfGoodClus_Phi_EA.push_back( new TH1F(Form("%s_Segm_NumGoodPhiCluster_EA",pfx.c_str()), + "Endcap A: No. of good #phi-clusters on segment;#good-clusters;entries", nsbins,nsmin,nsmax)); + h1CSC_Segm_NumOfGoodClus_Phi_EC.push_back( new TH1F(Form("%s_Segm_NumGoodPhiCluster_EC",pfx.c_str()), + "Endcap C: No. of good #phi-clusters on segment;#good-clusters;entries", nsbins,nsmin,nsmax)); + regCSCHist(h1CSC_Segm_NumOfGoodClus_Phi_EA[ic], m_segmDetail_EA[ic]); + regCSCHist(h1CSC_Segm_NumOfGoodClus_Phi_EC[ic], m_segmDetail_EC[ic]); + + h1CSC_Segm_QsumOfClus_Phi_EA.push_back( new TH1F(Form("%s_Segm_QSumPhiCluster_EA",pfx.c_str()), + "Endcap A: #phi-cluster Qsum;counts;entries", nqbins,nqmin,nqmax )); + h1CSC_Segm_QsumOfClus_Phi_EC.push_back( new TH1F(Form("%s_Segm_QSumPhiCluster_EC",pfx.c_str()), + "Endcap C: #phi-cluster Qsum;counts;entries", nqbins,nqmin,nqmax )); + regCSCHist(h1CSC_Segm_QsumOfClus_Phi_EA[ic], m_segmDetail_EA[ic]); + regCSCHist(h1CSC_Segm_QsumOfClus_Phi_EC[ic], m_segmDetail_EC[ic]); + + h1CSC_Segm_TimeOfClus_Phi_EA.push_back( new TH1F(Form("%s_Segm_TimePhiCluster_EA",pfx.c_str()), + "Endcap A: #phi-cluster Time;time [ns];entries", ntbins,ntmin,ntmax )); + h1CSC_Segm_TimeOfClus_Phi_EC.push_back( new TH1F(Form("%s_Segm_TimePhiCluster_EC",pfx.c_str()), + "Endcap C: #phi-cluster Time;time [ns];entries", ntbins,ntmin,ntmax )); + regCSCHist(h1CSC_Segm_TimeOfClus_Phi_EA[ic], m_segmDetail_EA[ic]); + regCSCHist(h1CSC_Segm_TimeOfClus_Phi_EC[ic], m_segmDetail_EC[ic]); + + h1CSC_Segm_QsumOfGoodClus_Phi_EA.push_back( new TH1F(Form("%s_Segm_QSumGoodPhiCluster_EA",pfx.c_str()), + "Endcap A: Good #phi-cluster Qsum;counts;entries", nqbins,nqmin,nqmax )); + h1CSC_Segm_QsumOfGoodClus_Phi_EC.push_back( new TH1F(Form("%s_Segm_QSumGoodPhiCluster_EC",pfx.c_str()), + "Endcap C: Good #phi-cluster Qsum;counts;entries", nqbins,nqmin,nqmax )); + regCSCHist(h1CSC_Segm_QsumOfGoodClus_Phi_EA[ic], m_segmDetail_EA[ic]); + regCSCHist(h1CSC_Segm_QsumOfGoodClus_Phi_EC[ic], m_segmDetail_EC[ic]); + + h1CSC_Segm_TimeOfGoodClus_Phi_EA.push_back( new TH1F(Form("%s_Segm_TimeGoodPhiCluster_EA",pfx.c_str()), + "Endcap A: Good #phi-cluster Time;time [ns];entries", ntbins,ntmin,ntmax )); + h1CSC_Segm_TimeOfGoodClus_Phi_EC.push_back( new TH1F(Form("%s_Segm_TimeGoodPhiCluster_EC",pfx.c_str()), + "Endcap C: Good #phi-cluster Time;time [ns];entries", ntbins,ntmin,ntmax )); + regCSCHist(h1CSC_Segm_TimeOfGoodClus_Phi_EA[ic], m_segmDetail_EA[ic]); + regCSCHist(h1CSC_Segm_TimeOfGoodClus_Phi_EC[ic], m_segmDetail_EC[ic]); + + // eta vs. phi correlation + h2CSC_Segm_QsumOfGoodClus_PhiVsEta_EA.push_back( new TH2F(Form("%s_Segm_QSumGoodClusCorrelation_EA",pfx.c_str()), + "Endcap A: #phi-cluster vs. good #eta-cluster;good #eta-cluster counts;good #phi-cluster counts", nqbins,nqmin,nqmax, nqbins,nqmin,nqmax)); + h2CSC_Segm_QsumOfGoodClus_PhiVsEta_EC.push_back( new TH2F(Form("%s_Segm_QSumGoodClusCorrelation_EC",pfx.c_str()), + "Endcap A: #phi-cluster vs. good #eta-cluster;good #eta-cluster counts;good #phi-cluster counts", nqbins,nqmin,nqmax, nqbins,nqmin,nqmax)); + regCSCHist(h2CSC_Segm_QsumOfGoodClus_PhiVsEta_EA[ic], m_segmDetail_EA[ic]); + regCSCHist(h2CSC_Segm_QsumOfGoodClus_PhiVsEta_EC[ic], m_segmDetail_EC[ic]); + + //m_h2csc_clus_r_vs_z_hitmap = new TH2F("h2csc_clus_r_vs_z_hitmap", "R vs. Z Cluster hitmap;z(CLHEP::mm);R(CLHEP::mm)",200, -10000., 10000., 40, 0., 4000); + //m_h2csc_clus_y_vs_x_hitmap = new TH2F("h2csc_clus_y_vs_x_hitmap", "Y vs. X Cluster hitmap;x(CLHEP::mm);y(CLHEP::mm)",100, -5000., 5000., 100, -5000., 5000); + + } + + bookedhistos=true; +} + + +//________________________________________________________________________________________________________ +StatusCode CSCSegmValAlg::bookHistograms() { + + if (m_debuglevel) ATH_MSG_DEBUG( "CSCSegmValAlg::bookHistograms() to setup tools/services" ); + StatusCode sc = StatusCode::SUCCESS; + + if( m_environment == AthenaMonManager::tier0 || m_environment == AthenaMonManager::tier0ESD ) { + + //if(newEventsBlock){} + //if(newLumiBlock){} + //if(newRun) { + if(!bookedhistos) bookSegmentHistograms(); + //} // if NewRun + + } // environment if + return sc; + +} + + +//________________________________________________________________________________________________________ +StatusCode CSCSegmValAlg::fillHistograms() { + + StatusCode sc = StatusCode::SUCCESS; + ATH_MSG_DEBUG( "in CSCSegmValAlg::fillHistograms() " ); + + if( m_environment == AthenaMonManager::tier0 || m_environment == AthenaMonManager::tier0ESD || m_environment == AthenaMonManager::user ) { + + // if required, check if event passed sample-selection triggers + if(m_doEvtSel) { if(!evtSelTriggersPassed()) return sc; } + + // Segment Cluster counter + int m_segmClustCount[33]; + + // arrays to hold cluster-count + // 32 chambers and 8 layers (each has one extra - index '0' is not counted) + int m_clusCount[33][9]; + //, m_sigclusCount[33][9]; + //unsigned int m_nEtaClusWidthCnt = 0, m_nPhiClusWidthCnt = 0; + for(unsigned int kl = 0; kl < 33; kl++ ) { + for(unsigned int cm3 = 0; cm3 < 9; cm3++ ) { + m_clusCount[kl][cm3] = 0; + } + } + + + bool got_coll = false; unsigned int ic = 0; + for (MuonSegmIter it = m_segmKey.begin(); it != m_segmKey.end(); ++it, ic++ ) { + + std::string theKey = (*it).first; + int useSegm = (*it).second; + + if (m_debuglevel) ATH_MSG_DEBUG( (useSegm == 1 ? "Using ": "Not using ") << " collection " << theKey ); + + if ( useSegm != 1 ) continue; + + //Get segms from SG + sc = m_storeGate->retrieve(m_segms, theKey); + + if ( sc.isFailure() ){ + if ( (ic == m_segmKey.size()-1) && !got_coll ){ + ATH_MSG_DEBUG( "Unable to retrieve reconstructed segms from any collection... Exiting!" ); + return StatusCode::FAILURE; + } else { + ATH_MSG_DEBUG( "Unable to retrieve reconstructed segms from collection... Trying next..." ); + continue; + } + } else { + if (m_debuglevel) ATH_MSG_DEBUG( "Segms in StoreGate found. Segm collection is " << theKey ); + got_coll = true; + } + + if ( m_segms->empty() ){ + + if (m_debuglevel){ + ATH_MSG_DEBUG( " Segm Collection is Empty. Trying next... "); + } + continue; + } + + if (m_debuglevel){ + ATH_MSG_DEBUG( " Segm Collection size " ); + ATH_MSG_DEBUG( "Number of segms found: " << m_segms->size() ); + } + + if ( m_segms->size() > 0 ){ + ATH_MSG_DEBUG( "Number of segms in event is: " << m_segms->size() ); + ATH_MSG_DEBUG( "This algorithm is designed to operate for single segm / event only" ); + ATH_MSG_DEBUG( "Processing only the first segm in the segm collection" ); + } + + int segnum = 0; + int layerindex = 0; + + //Loop over segms + for (Trk::SegmentCollection::const_iterator s = m_segms->begin();s != m_segms->end(); ++s) { + + // Get segm + Muon::MuonSegment *segm=dynamic_cast<Muon::MuonSegment*>(*s); + + if (segm == 0) { + ATH_MSG_ERROR( "no pointer to segm!!!" ); + continue; + } + + // Loop over segment ROTs - not necessary 03-23 + // for(unsigned int i =0; i < segm->numberOfContainedROTs(); ++i) { + ATH_MSG_DEBUG( "Looking at segment id" ); + + // Skip segment if there are no csc hits + if ( cscHits(segm)<1 ) continue; + + // Get contained measurements + const std::vector<const Trk::MeasurementBase*> meas = segm->containedMeasurements(); + + // Skip segment if no measurements + // Number of clusters on segment + int n_clust=meas.size(); + if ( n_clust < 2 ) continue; + + // Analyze segment if it is a csc segment + if ( isCscSegment(segm) ) { + + segnum++; + + // Initialize cluster counter + for(int sect = 0; sect < 33; sect++) { + m_segmClustCount[sect] = 0; + for(unsigned int ilay = 0; ilay < 9; ilay++ ) { + m_clusCount[sect][ilay] = 0; + } + + } + + // Print out segment information + const Trk::FitQuality* fq = segm->fitQuality(); + double chi2 = 999.; + int ndof = -1; + if( fq ) { + chi2 = fq->chiSquared(); + ndof = fq->numberDoF(); + ATH_MSG_DEBUG( "Chi2 " << chi2 ); + //chi2_histo->Fill(chi2); + ATH_MSG_DEBUG( "Ndof " << ndof ); + } + + // cut on segment angle + float segm_ly = segm->localParameters()[Trk::locY]; + float segm_ayz = segm->localDirection().angleYZ(); + segm_ayz -= M_PI/2.; + float segm_cut = m_segmSlope[theKey]; + bool segmAngle_cut = segmSlopeCut(segm_ly, segm_ayz, segm_cut); + ATH_MSG_DEBUG(theKey << " local_pos: " << segm_ly << + "\tangle_yz: " << segm_ayz << "\tcut: " << segm_cut << "\t pass = " << segmAngle_cut ); + if(!segmAngle_cut) continue; + + + ATH_MSG_DEBUG( "R " << segm->globalPosition().perp() ); + ATH_MSG_DEBUG( "Z " << segm->globalPosition().z() ); + ATH_MSG_DEBUG( "Phi " << segm->globalPosition().phi() ); + ATH_MSG_DEBUG( "Eta " << segm->globalPosition().eta() ); + ATH_MSG_DEBUG( "Dir Phi " << segm->globalDirection().phi() ); + ATH_MSG_DEBUG( "Dir Eta " << segm->globalDirection().eta() ); + + + // ============================================================================== + // Field Range Notes + // ============================================================================== + // StationName unsigned integer maps to "CSS", "CSL", etc. + // StationEta [-1,1] -1 for backward, 1 for forward endcap + // StationPhi [1,8] increases with Phi + // Technology [1] maps to "CSC" + // ChamberLayer [1,2] increases with |Z| + // WireLayer [1,4] increases with |Z| + // MeasuresPhi [0,1] 0 if measures R, 1 if measures Phi + // Strip [1,n] increases with R for MeasuresPhi=0 + // increases with Phi for MeasuresPhi=1 + // ============================================================================== + + // identify the segment location + const Trk::MeasurementBase* rio = meas.at(0); + Identifier segmId = m_helperTool->getIdentifier(*rio); + + int segm_stationPhi = m_cscIdHelper->stationPhi(segmId); + int segm_stationEta = m_cscIdHelper->stationEta(segmId); + int segm_stationName = m_cscIdHelper->stationName(segmId); + std::string segm_stationString = m_cscIdHelper->stationNameString(segm_stationName); + int segm_chamberType = segm_stationString == "CSS" ? 0 : 1; + int segm_sectorNo = segm_stationEta * (2 * segm_stationPhi - segm_chamberType); // [-16 -> -1] and [+1 -> +16] + int segm_isec = segm_sectorNo < 0 ? segm_sectorNo*(-1) : segm_sectorNo+16; // [-16 -> -1] shifted to [1 -> 16] and [+1 -> +16] shifted to [+17 -> +32] + ATH_MSG_DEBUG(" sgsec = " << segm_isec << "\tsec = " << segm_sectorNo); + if(segm_stationEta == 1) h2CSC_Segm_NumOfSegs_EA[ic]->Fill(n_clust, segm_sectorNo); + else h2CSC_Segm_NumOfSegs_EC[ic]->Fill(n_clust, segm_sectorNo); + + // Loop over clusters + // [i][j] {i == 0(EA), 1(EC) } + float clus_kiloele = 1.0e-3; // multiply # of electrons by this number to get kiloElectrons (1 ke = 1 ADC) + int eta_clus_count[2][2] = {{0},{0}}, phi_clus_count[2][2] = {{0},{0}}; // no. of prec/trans hits per segment + float eta_clus_qsum[2][5] = {{-1.}, {-1.}}, phi_clus_qsum[2][5] = {{-1.}, {-1.}}; // qsum over each prec/trans. layer on segment + float eta_clus_time[2][5] = {{-1.}, {-1.}}, phi_clus_time[2][5] = {{-1.}, {-1.}}; // time over each prec/trans. layer on segment + int eta_clus_use[2][5] = {{0},{0}}, phi_clus_use[2][5] = {{0}, {0}}; + //int eta_clus_status[5] = {-1}, phi_clus_status[5] = {-1}; + + layerindex = 0; + + for(TrkSegmIter hit = segm->containedMeasurements().begin(); + hit != segm->containedMeasurements().end(); ++hit ) { + const Muon::CscClusterOnTrack* clust_rot = dynamic_cast<const Muon::CscClusterOnTrack*>(*hit); + if( clust_rot ) { + Identifier clusId = m_helperTool->getIdentifier(*clust_rot); + + // get the cluster coordinates + int clus_stationName = m_cscIdHelper->stationName(clusId); + std::string clus_stationString = m_cscIdHelper->stationNameString(clus_stationName); + int clus_chamberType = clus_stationString == "CSS" ? 0 : 1; + int clus_stationEta = m_cscIdHelper->stationEta(clusId); + int clus_stationPhi = m_cscIdHelper->stationPhi(clusId); + int clus_wireLayer = m_cscIdHelper->wireLayer(clusId); + int clus_measuresPhi = m_cscIdHelper->measuresPhi(clusId); + + // convert to my coordinates + int clus_sectorNo = clus_stationEta * (2 * clus_stationPhi - clus_chamberType); // [-16 -> -1] and [+1 -> +16] + float clus_secLayer = clus_sectorNo + 0.2 * (clus_wireLayer - 1) + 0.1; + //int xfac = clus_measuresPhi ? -1 : 1; // [-1 -> -48] / [+1 -> +192] + int clus_isec = clus_sectorNo < 0 ? clus_sectorNo*(-1) : clus_sectorNo+16; // [-16 -> -1] shifted to [1 -> 16] and [+1 -> +16] shifted to [+17 -> +32] + int clus_ilay = (clus_measuresPhi ? clus_wireLayer : clus_wireLayer+4); + + // check the cluster status; probably need to read status info from jobOptions - not done for the moment + // status = Muon::CscStatusUnspoiled (i.e 0) or Muon::CscStatusSplitUnspoiled (i.e 10) are considered good for precision clusters + // status = Muon::CscStatusSimple (i.e 1) could be good for non-precision clusters (i.e for phi-layers) + Muon::CscClusterStatus status = clust_rot->status(); + if(segm_stationEta == 1) { + if(clus_measuresPhi == 0) h1CSC_Segm_StatOfClus_Eta_EA[ic]->Fill(status); + else h1CSC_Segm_StatOfClus_Phi_EA[ic]->Fill(status); + } else { + if(clus_measuresPhi == 0) h1CSC_Segm_StatOfClus_Eta_EC[ic]->Fill(status); + else h1CSC_Segm_StatOfClus_Phi_EC[ic]->Fill(status); + } + + //if(clus_measuresPhi == 0) eta_clus_status[clus_wireLayer] = status; + //else phi_clus_status[clus_wireLayer] = status; + + std::string clus_stat = Muon::toString(status); + bool clus_status = ( (clus_stat == "unspoiled") || + (clus_stat == "unspoiled with split") || + (clus_stat == "simple") + ) ? true : false; + bool clus_stat_eff = ( (int(status) >= 0 && int(status) < 8) || + (int(status) > 8 && int(status) < 18) ) ? true : false; + + // get cluster + const Muon::CscPrepData* theClus = clust_rot->prepRawData(); + float clus_qsum = 0, clus_time = -1.; + //float clus_globx = 0., clus_globy = 0., clus_globz = 0., clus_globr = 0.; + + if(theClus) { + clus_qsum = theClus->charge() * clus_kiloele; + clus_time = theClus->time(); + //clus_globx = theClus->globalPosition().x(); + //clus_globy = theClus->globalPosition().y(); + //clus_globz = theClus->globalPosition().z(); + //clus_globr = theClus->globalPosition().perp(); + + if(clus_measuresPhi == 0) { + if(clus_stationEta == 1) eta_clus_count[0][0]++; + else eta_clus_count[1][0]++; + } else { + if(clus_stationEta == 1) phi_clus_count[0][0]++; + else phi_clus_count[1][0]++; + } + } + + // get no. of strips per cluster + unsigned int clus_noStrips = theClus->rdoList().size(); + + // need at least three strips in an eta-cluster + bool clus_eta_status = clus_status && ( clus_noStrips > 2 ) && (clus_measuresPhi == 0); + bool clus_eta_eff = clus_stat_eff && ( clus_noStrips > 2 ) && (clus_measuresPhi == 0); + if(clus_eta_eff) { + if(clus_stationEta == 1) { + eta_clus_count[0][1]++; + } else { + eta_clus_count[1][1]++; + } + } + if(clus_eta_status) { + if(clus_stationEta == 1) { + eta_clus_qsum[0][clus_wireLayer] = clus_qsum; + eta_clus_time[0][clus_wireLayer] = clus_time; + eta_clus_use[0][clus_wireLayer] = 1; + h2CSC_Segm_QsumOfGoodClusMap_Eta_EA[ic]->Fill(clus_qsum, clus_secLayer); + if(fabs(clus_time) <= 200) h2CSC_Segm_TimeOfGoodClusMap_Eta_EA[ic]->Fill(clus_time, clus_secLayer); + } else { + eta_clus_qsum[1][clus_wireLayer] = clus_qsum; + eta_clus_time[1][clus_wireLayer] = clus_time; + eta_clus_use[1][clus_wireLayer] = 1; + h2CSC_Segm_QsumOfGoodClusMap_Eta_EC[ic]->Fill(clus_qsum, clus_secLayer); + if(fabs(clus_time) <= 200) h2CSC_Segm_TimeOfGoodClusMap_Eta_EC[ic]->Fill(clus_time, clus_secLayer); + } + } + + // need at least one strip in a phi-cluster + bool clus_phi_status = clus_status && ( clus_noStrips > 0 ) && (clus_measuresPhi == 1); + if(clus_phi_status) { + if(clus_stationEta == 1) { + phi_clus_qsum[0][clus_wireLayer] = clus_qsum; + phi_clus_time[0][clus_wireLayer] = clus_time; + phi_clus_use[0][clus_wireLayer] = 1; + phi_clus_count[0][1]++; + h2CSC_Segm_QsumOfGoodClusMap_Phi_EA[ic]->Fill(clus_qsum, clus_secLayer); + if(fabs(clus_time) <= 200) h2CSC_Segm_TimeOfGoodClusMap_Phi_EA[ic]->Fill(clus_time, clus_secLayer); + } else { + phi_clus_qsum[1][clus_wireLayer] = clus_qsum; + phi_clus_time[1][clus_wireLayer] = clus_time; + phi_clus_use[1][clus_wireLayer] = 1; + phi_clus_count[1][1]++; + h2CSC_Segm_QsumOfGoodClusMap_Phi_EC[ic]->Fill(clus_qsum, clus_secLayer); + if(fabs(clus_time) <= 200) h2CSC_Segm_TimeOfGoodClusMap_Phi_EC[ic]->Fill(clus_time, clus_secLayer); + } + } + + // increment the cluster-count for this layer + if(clus_eta_status || clus_phi_status) m_clusCount[clus_isec][clus_ilay]++; + + // increment segment cluster count + if(clus_eta_status) m_segmClustCount[clus_isec]++; + + if(clus_eta_status) layerindex+=clus_wireLayer; + + ATH_MSG_DEBUG("status = " << clus_stat << "\tcharge = " << clus_qsum << "\ttime= " << clus_time << "\tnstrips = " << clus_noStrips); + + } else { + } // if cluster found + } // for loop over clusters + + // Print out segment number and cluster count + //for (int isect = 1; isect < 33; isect++){ + // if(m_segmClustCount[isect] < 3) continue; + //} + + //ATH_MSG_VERBOSE("eta_count(EA) = " << eta_clus_count[0][0] << "\tphi_count(EA) = " << phi_clus_count[0][0]); + //ATH_MSG_VERBOSE("eta_count(EC) = " << eta_clus_count[1][0] << "\tphi_count(EC) = " << phi_clus_count[1][0]); + //ATH_MSG_VERBOSE("eta_good_count(EA) = " << eta_clus_count[0][1] << "\tphi_good_count(EA) = " << phi_clus_count[0][1]); + //ATH_MSG_VERBOSE("eta_good_count(EC) = " << eta_clus_count[1][1] << "\tphi_good_count(EC) = " << phi_clus_count[1][1]); + // fill (good- )cluster counts on each eta-station (EA, EC) for eta/phi clusters + if(eta_clus_count[0][0] > 0) h1CSC_Segm_NumOfClus_Eta_EA[ic]->Fill(eta_clus_count[0][0]); + if(phi_clus_count[0][0] > 0) h1CSC_Segm_NumOfClus_Phi_EA[ic]->Fill(phi_clus_count[0][0]); + if(eta_clus_count[0][1] > 0) h1CSC_Segm_NumOfGoodClus_Eta_EA[ic]->Fill(eta_clus_count[0][1]); + if(phi_clus_count[0][1] > 0) h1CSC_Segm_NumOfGoodClus_Phi_EA[ic]->Fill(phi_clus_count[0][1]); + if(eta_clus_count[1][0] > 0) h1CSC_Segm_NumOfClus_Eta_EC[ic]->Fill(eta_clus_count[1][0]); + if(phi_clus_count[1][0] > 0) h1CSC_Segm_NumOfClus_Phi_EC[ic]->Fill(phi_clus_count[1][0]); + if(eta_clus_count[1][1] > 0) h1CSC_Segm_NumOfGoodClus_Eta_EC[ic]->Fill(eta_clus_count[1][1]); + if(phi_clus_count[1][1] > 0) h1CSC_Segm_NumOfGoodClus_Phi_EC[ic]->Fill(phi_clus_count[1][1]); + + // Fill number of 3 and 4 cluster segment histogram + for (int isect = 1; isect < 17; isect++) { + if(m_segmClustCount[isect+16] > 2){ + h2CSC_Segm_NumOfNClusSegs_Eta_EA[ic]->Fill(layerindex-5, isect); + } + if(m_segmClustCount[isect] > 2){ + h2CSC_Segm_NumOfNClusSegs_Eta_EC[ic]->Fill(layerindex-5, (-1.)*isect); + } + if(m_segmClustCount[isect+16] > 3){ + h2CSC_Segm_NumOfNClusSegs_Eta_EA[ic]->Fill(1, isect); + h2CSC_Segm_NumOfNClusSegs_Eta_EA[ic]->Fill(2, isect); + h2CSC_Segm_NumOfNClusSegs_Eta_EA[ic]->Fill(3, isect); + h2CSC_Segm_NumOfNClusSegs_Eta_EA[ic]->Fill(4, isect); + } + if(m_segmClustCount[isect] > 3){ + h2CSC_Segm_NumOfNClusSegs_Eta_EC[ic]->Fill(1, -1.*isect); + h2CSC_Segm_NumOfNClusSegs_Eta_EC[ic]->Fill(2, -1.*isect); + h2CSC_Segm_NumOfNClusSegs_Eta_EC[ic]->Fill(3, -1.*isect); + h2CSC_Segm_NumOfNClusSegs_Eta_EC[ic]->Fill(4, -1.*isect); + } + } + + float eta_clus_qsum_tot = 0., phi_clus_qsum_tot = 0.; // total qsum over all prec. trans. layers on segment + for(unsigned int i = 0; i < 2; i++) { + eta_clus_qsum_tot = 0; phi_clus_qsum_tot = 0.; + for(unsigned int j = 1; j < 5; j++) { + if(i==0) h1CSC_Segm_QsumOfClus_Eta_EA[ic]->Fill(eta_clus_qsum[i][j]); + if(i==1) h1CSC_Segm_QsumOfClus_Eta_EC[ic]->Fill(eta_clus_qsum[i][j]); + if(i==0) h1CSC_Segm_QsumOfClus_Phi_EA[ic]->Fill(phi_clus_qsum[i][j]); + if(i==1) h1CSC_Segm_QsumOfClus_Phi_EC[ic]->Fill(phi_clus_qsum[i][j]); + if(i==0 && fabs(eta_clus_time[i][j]) <= 200) h1CSC_Segm_TimeOfClus_Eta_EA[ic]->Fill(eta_clus_time[i][j]); + if(i==1 && fabs(eta_clus_time[i][j]) <= 200) h1CSC_Segm_TimeOfClus_Eta_EC[ic]->Fill(eta_clus_time[i][j]); + if(i==0 && fabs(phi_clus_time[i][j]) <= 200) h1CSC_Segm_TimeOfClus_Phi_EA[ic]->Fill(phi_clus_time[i][j]); + if(i==1 && fabs(phi_clus_time[i][j]) <= 200) h1CSC_Segm_TimeOfClus_Phi_EC[ic]->Fill(phi_clus_time[i][j]); + if(phi_clus_use[i][j] && eta_clus_use[i][j]) { + eta_clus_qsum_tot += eta_clus_qsum[i][j]; + if(i==0) h1CSC_Segm_QsumOfGoodClus_Eta_EA[ic]->Fill(eta_clus_qsum[i][j]); + if(i==1) h1CSC_Segm_QsumOfGoodClus_Eta_EC[ic]->Fill(eta_clus_qsum[i][j]); + if(i==0 && fabs(eta_clus_time[i][j]) <= 200) h1CSC_Segm_TimeOfGoodClus_Eta_EA[ic]->Fill(eta_clus_time[i][j]); + if(i==1 && fabs(eta_clus_time[i][j]) <= 200) h1CSC_Segm_TimeOfGoodClus_Eta_EC[ic]->Fill(eta_clus_time[i][j]); + phi_clus_qsum_tot += phi_clus_qsum[i][j]; + if(i==0) h1CSC_Segm_QsumOfGoodClus_Phi_EA[ic]->Fill(phi_clus_qsum[i][j]); + if(i==1) h1CSC_Segm_QsumOfGoodClus_Phi_EC[ic]->Fill(phi_clus_qsum[i][j]); + if(i==0 && fabs(phi_clus_time[i][j]) <= 200) h1CSC_Segm_TimeOfGoodClus_Phi_EA[ic]->Fill(phi_clus_time[i][j]); + if(i==1 && fabs(phi_clus_time[i][j]) <= 200) h1CSC_Segm_TimeOfGoodClus_Phi_EC[ic]->Fill(phi_clus_time[i][j]); + } + //ATH_MSG_VERBOSE("phi charge = " << phi_clus_qsum[i][j] << "\tphi time = " << phi_clus_time[i][j]); + //ATH_MSG_VERBOSE("eta charge = " << eta_clus_qsum[i][j] << "\teta time = " << eta_clus_time[i][j]); + } + if(i==0) h2CSC_Segm_QsumOfGoodClus_PhiVsEta_EA[ic]->Fill(eta_clus_qsum_tot,phi_clus_qsum_tot); + if(i==1) h2CSC_Segm_QsumOfGoodClus_PhiVsEta_EC[ic]->Fill(eta_clus_qsum_tot,phi_clus_qsum_tot); + //ATH_MSG_VERBOSE("eta_qsum_tot = " << eta_clus_qsum_tot << "\tphi_qsum = " << phi_clus_qsum_tot); + } + + } // if is csc segment + // } // loop over ROTs + + } // loop over segms + + } // loop over collections + + } // environment if + + if (m_debuglevel) ATH_MSG_DEBUG( " done with CSCSegmValAlg::fillHistograms()" ); + + return sc; +} + + +//________________________________________________________________________________________________________ +StatusCode CSCSegmValAlg::procHistograms() { + + if( m_environment == AthenaMonManager::tier0 || m_environment == AthenaMonManager::tier0ESD ) { + + if (m_debuglevel) ATH_MSG_DEBUG( "in CSCSegmValAlg::procHistograms()" ); + if(endOfEventsBlock){} + if(endOfLumiBlock){} + if(endOfRun){ + + } // endOfRun + } // environment if + + return StatusCode::SUCCESS; +} + +//________________________________________________________________________________________________________ +bool CSCSegmValAlg::evtSelTriggersPassed() { + + if(!m_doEvtSel) return true; + std::vector<std::string>::const_iterator + it = m_sampSelTriggers.begin(), itE = m_sampSelTriggers.end(); + for ( ; it != itE; it++ ) { + if (m_trigDec->isPassed(*it, TrigDefs::eventAccepted)) { + return true; + } + } + return false; + +} // end evtSelTriggersPassed + +//________________________________________________________________________________________________________ +StatusCode CSCSegmValAlg::finalize() { + StatusCode sc = ManagedMonitorToolBase::finalize(); + if(!sc.isSuccess()) return sc; + return sc; + +} + + +//________________________________________________________________________________________________________ +bool CSCSegmValAlg::isCscSegment( const Muon::MuonSegment* seg ) const { + bool isCsc(false); + + std::vector<const Trk::MeasurementBase*> mbs = seg->containedMeasurements(); + for( unsigned int i = 0; i< mbs.size(); ++i){ + + const Trk::RIO_OnTrack* rot = dynamic_cast<const Trk::RIO_OnTrack*> (mbs[i]); + if (!rot){ + const Trk::CompetingRIOsOnTrack* crot = dynamic_cast<const Trk::CompetingRIOsOnTrack*> (mbs[i]); + if (crot) rot = &(crot->rioOnTrack(0)); + } + if( !rot ) { + continue; + } + if( m_cscIdHelper->is_csc( rot->identify() ) ) isCsc=true; + } + + return isCsc; +} + + +//________________________________________________________________________________________________________ +unsigned int CSCSegmValAlg::cscHits( const Muon::MuonSegment* seg ) const { + unsigned int nrHits(0); + if( !isCscSegment(seg) ) return nrHits; + + std::vector<const Trk::MeasurementBase*> mbs = seg->containedMeasurements(); + for( unsigned int i = 0; i< mbs.size(); ++i){ + + const Trk::RIO_OnTrack* rot = dynamic_cast<const Trk::RIO_OnTrack*> (mbs[i]); + if (!rot){ + const Trk::CompetingRIOsOnTrack* crot = dynamic_cast<const Trk::CompetingRIOsOnTrack*> (mbs[i]); + if (crot) rot = &(crot->rioOnTrack(0)); + } + if( !rot ) { + continue; + } + if( m_cscIdHelper->is_csc( rot->identify() ) ) ++nrHits; + } + + return nrHits ; +} + +//________________________________________________________________________________________________________ +void CSCSegmValAlg::setCSCLayerLabels(TH1 *h, int m_side) { + + if(!h) return; + if(!(m_side == 1 || m_side == -1)) return; + if(h->GetNbinsX() < 85) return; + + h->GetXaxis()->SetTitle(""); + h->GetXaxis()->SetLabelSize(0.03); + if(m_side == -1) { + for(unsigned int j=6; j<86; j++) { + if( j%5 != 0 ) { + float xmid = h->GetBinLowEdge(j) + h->GetBinWidth(j); + xmid -= 1.0; xmid *= -1.0; + int seclay = int(ceil(xmid*10)); // get sector/layer + int sec = seclay/10; + int lay = (seclay%10)/2 ; + lay = (4 - lay) + 1; + h->GetXaxis()->SetBinLabel(j,Form("%c%02d:%d",(sec%2==0?'S':'L'),sec,lay)); + } // end for + } // end if + } else if (m_side == 1) { + for(unsigned int j=6; j<86; j++) { + if( j%5 != 0 ) { + float xmid = h->GetBinLowEdge(j) + h->GetBinWidth(j); + int seclay = int(ceil(xmid*10)); // get sector/layer + int sec = seclay/10; + int lay = (seclay%10)/2 ; + h->GetXaxis()->SetBinLabel(j,Form("%c%02d:%d",(sec%2==0?'S':'L'),sec,lay)); + } + } // end for + } // end else + +} // setCSCLayerLabels + + +//________________________________________________________________________________________________________ +void CSCSegmValAlg::regCSCHist(TH1 *h, MonGroup *cm3 ) { + StatusCode sc = StatusCode::SUCCESS; + if(!cm3 || !h) return; + + ATH_MSG_INFO ( "registering histogram: " << h->GetName() << " with group: " << cm3->system() ); + sc = cm3->regHist(h); + if ( sc.isFailure() ) { + ATH_MSG_ERROR ( "Failed to register histogram: " << h->GetName() << " with group: " << cm3->system() ); + } + ATH_MSG_VERBOSE ( "registered histogram: " << h->GetName() << " with group: " << cm3->system() ); +} + +//________________________________________________________________________________________________________ +void CSCSegmValAlg::clearHistogramVectors( ) { + + h2CSC_Segm_NumOfNClusSegs_Eta_EA.clear(); + h2CSC_Segm_NumOfNClusSegs_Eta_EC.clear(); + + h1CSC_Segm_Efficiency_Eta_EA.clear(); + h1CSC_Segm_Efficiency_Eta_EC.clear(); + + h2CSC_Segm_QsumOfGoodClusMap_Eta_EA.clear(); + h2CSC_Segm_QsumOfGoodClusMap_Eta_EC.clear(); + + h2CSC_Segm_TimeOfGoodClusMap_Eta_EA.clear(); + h2CSC_Segm_TimeOfGoodClusMap_Eta_EC.clear(); + + h1CSC_Segm_StatOfClus_Eta_EA.clear(); + h1CSC_Segm_NumOfClus_Eta_EA.clear(); + h1CSC_Segm_NumOfGoodClus_Eta_EA.clear(); + h1CSC_Segm_QsumOfClus_Eta_EA.clear(); + h1CSC_Segm_QsumOfGoodClus_Eta_EA.clear(); + h1CSC_Segm_TimeOfClus_Eta_EA.clear(); + h1CSC_Segm_TimeOfGoodClus_Eta_EA.clear(); + + h1CSC_Segm_StatOfClus_Eta_EC.clear(); + h1CSC_Segm_NumOfClus_Eta_EC.clear(); + h1CSC_Segm_NumOfGoodClus_Eta_EC.clear(); + h1CSC_Segm_QsumOfClus_Eta_EC.clear(); + h1CSC_Segm_QsumOfGoodClus_Eta_EC.clear(); + h1CSC_Segm_TimeOfClus_Eta_EC.clear(); + h1CSC_Segm_TimeOfGoodClus_Eta_EC.clear(); + + h2CSC_Segm_QsumOfGoodClusMap_Phi_EA.clear(); + h2CSC_Segm_QsumOfGoodClusMap_Phi_EC.clear(); + + h2CSC_Segm_TimeOfGoodClusMap_Phi_EA.clear(); + h2CSC_Segm_TimeOfGoodClusMap_Phi_EC.clear(); + + h1CSC_Segm_StatOfClus_Phi_EA.clear(); + h1CSC_Segm_NumOfClus_Phi_EA.clear(); + h1CSC_Segm_NumOfGoodClus_Phi_EA.clear(); + h1CSC_Segm_QsumOfClus_Phi_EA.clear(); + h1CSC_Segm_QsumOfGoodClus_Phi_EA.clear(); + h1CSC_Segm_TimeOfClus_Phi_EA.clear(); + h1CSC_Segm_TimeOfGoodClus_Phi_EA.clear(); + + h1CSC_Segm_StatOfClus_Phi_EC.clear(); + h1CSC_Segm_NumOfClus_Phi_EC.clear(); + h1CSC_Segm_NumOfGoodClus_Phi_EC.clear(); + h1CSC_Segm_QsumOfClus_Phi_EC.clear(); + h1CSC_Segm_QsumOfGoodClus_Phi_EC.clear(); + h1CSC_Segm_TimeOfClus_Phi_EC.clear(); + h1CSC_Segm_TimeOfGoodClus_Phi_EC.clear(); + + h2CSC_Segm_QsumOfGoodClus_PhiVsEta_EA.clear(); + h2CSC_Segm_QsumOfGoodClus_PhiVsEta_EC.clear(); + + m_segmDetail_EA.clear(); + m_segmDetail_EC.clear(); + m_segmOview_EA.clear(); + m_segmOview_EC.clear(); + +} + +//________________________________________________________________________________________________________ +bool CSCSegmValAlg::segmSlopeCut(float& csc_x, float& csc_ax, float& cut ) { + float s0 = csc_x; + float s1 = -tan(csc_ax); + float s1corr = s1 - 0.000119 * s0; + bool good_segm = fabs(s1corr)<cut ? true : false; + return good_segm; +} + diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/src/CSCSegmValidation.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/src/CSCSegmValidation.cxx new file mode 100755 index 0000000000000000000000000000000000000000..a9b5095906ae7173e699b9ef3a667064762bcc29 --- /dev/null +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/src/CSCSegmValidation.cxx @@ -0,0 +1,1497 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/* =========================================================================== + CSCSegmValidation.cxx + ------------------------------ + + AUTHORS: I. Christidi + Modified: N. Benekos (Illinois) + created: January 2008 + description: Implementation code for the CSCSegmValidation + =========================================================================== */ + +#include "MuonSegmMonitoring/CSCSegmValidation.h" +#include "MuonRecHelperTools/MuonEDMPrinterTool.h" +#include "MuonRecHelperTools/MuonEDMHelperTool.h" +#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonDQAUtils/MuonChamberNameConverter.h" +#include "MuonDQAUtils/MuonDQAFitFunc.h" + +// Track +#include "TrkExInterfaces/IPropagator.h" +#include "TrkToolInterfaces/IResidualPullCalculator.h" + +#include "TrkEventPrimitives/FitQualityOnSurface.h" +#include "EventPrimitives/EventPrimitives.h" +#include "TrkEventPrimitives/FitQuality.h" +#include "TrkMeasurementBase/MeasurementBase.h" +#include "TrkSurfaces/BoundaryCheck.h" + +#include "TrkParameters/TrackParameters.h" +#include "TrkGeometry/MagneticFieldProperties.h" + +#include "TrkTrack/TrackCollection.h" +#include "TrkEventPrimitives/ResidualPull.h" +#include "TrkEventPrimitives/PropDirection.h" + +#include "TrkCompetingRIOsOnTrack/CompetingRIOsOnTrack.h" +#include "MuonRIO_OnTrack/CscClusterOnTrack.h" + +// Gaudi Tools +#include "GaudiKernel/SmartDataPtr.h" +#include "GaudiKernel/INTupleSvc.h" +#include "AthenaMonitoring/AthenaMonManager.h" + +// Storegate +#include "StoreGate/StoreGate.h" + +// ROOT Classes +#include <TH1F.h> +#include <TH2F.h> + +// C++ +#include <TMath.h> +#include <sstream> + + +const int s_maxEvents = 100000; +const int s_maxComponents = 50; +const int s_maxSoS = 80; + +namespace CscBins { + void BinLabels(TH1 *h, int m_side) { + h->GetXaxis()->SetTitle(""); + h->GetXaxis()->SetLabelSize(0.03); + if(m_side == -1) { + for(size_t j=6; j<86; j++) { + if( j%5 != 0 ) { + float xmid = h->GetBinLowEdge(j) + h->GetBinWidth(j); + xmid -= 1.0; xmid *= -1.0; + int seclay = int(ceil(xmid*10)); // get sector/layer + int sec = seclay/10; + int lay = (seclay%10)/2 ; + lay = (4 - lay) + 1; + h->GetXaxis()->SetBinLabel(j,Form("%c%02d:%d",(sec%2==0?'S':'L'),sec,lay)); + } // end for + } // end if + } else if (m_side == 1) { + for(size_t j=6; j<86; j++) { + if( j%5 != 0 ) { + float xmid = h->GetBinLowEdge(j) + h->GetBinWidth(j); + int seclay = int(ceil(xmid*10)); // get sector/layer + int sec = seclay/10; + int lay = (seclay%10)/2 ; + h->GetXaxis()->SetBinLabel(j,Form("%c%02d:%d",(sec%2==0?'S':'L'),sec,lay)); + } + } // end for + } // end else + + } // BinLabels + +} // end namespace CscBins + + +// ********************************************************************* +// Public Methods +// ********************************************************************* + +CSCSegmValidation::CSCSegmValidation( const std::string & type, const std::string & name, const IInterface* parent ) + :ManagedMonitorToolBase( type, name, parent ), + m_storeGate(0), + m_eventCounter(0), + m_debuglevel(false) +{ + m_pullCalculator = ToolHandle<Trk::IResidualPullCalculator>("Trk::ResidualPullCalculator/ResidualPullCalculator"); + m_helperTool = ToolHandle<Muon::MuonEDMHelperTool>("Muon::MuonEDMHelperTool/MuonEDMHelperTool"); + m_printer = ToolHandle<Muon::MuonEDMPrinterTool>("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"); + m_idHelperTool = ToolHandle<Muon::MuonIdHelperTool>("Muon::MuonIdHelperTool/MuonIdHelperTool"); + m_propagator = ToolHandle<Trk::IPropagator>("Trk::StraightLinePropagator/MuonStraightLinePropagator"); + m_histoTool = ToolHandle<Muon::MuonDQAHistTool>("Muon::MuonDQAHistTool/MuonDQAHistTool"); + m_TrackHistoTool = ToolHandle<Muon::MuonDQATrackHistTool>("Muon::MuonDQATrackHistTool/MuonDQATrackHistTool"); + m_muondqafitfunc = ToolHandle<Muon::MuonDQAFitFunc>("Muon::MuonDQAFitFunc/MuonDQAFitFunc"); + + declareProperty( "WhichSegmCollections", m_segmCollectionFlag); + declareProperty( "MuonSegmCollections", m_segmCollectionName); + declareProperty( "doMDT", m_doMDT); + declareProperty( "doRPC", m_doRPC); + declareProperty( "doTGC", m_doTGC); + declareProperty( "doCSC", m_doCSC); +} + +// +//--------------------------------------------------------------------------------------- +// + +CSCSegmValidation::~CSCSegmValidation() +{ + ATH_MSG_INFO( " deleting CSCSegmValidation " ); +} + + +//==================================================================// +/** Initialize */ +//==================================================================// + +StatusCode CSCSegmValidation::initialize() +{ + StatusCode sc = ManagedMonitorToolBase::initialize(); + if(!sc.isSuccess()) return sc; + + ATH_MSG_INFO( "in initialize() in SegmMonitoring" ); + + //initializing tools + // Retrieve the StoreGate service + + sc = service( "StoreGateSvc", m_storeGate ); + if ( sc.isFailure() ){ + ATH_MSG_FATAL( "Unable to retrieve the StoreGate service... Exiting!" ); + return sc; + } + if (m_debuglevel) ATH_MSG_DEBUG( "Defined detector service" ); + + // retrieve the active store + sc = serviceLocator()->service("ActiveStoreSvc", m_activeStore); + if (sc.isFailure()) { + ATH_MSG_FATAL( " Cannot get ActiveStoreSvc " ); + return sc ; + } + if (m_debuglevel) ATH_MSG_DEBUG( "Defined ActiveStoreSvc" ); + + // Initialize the IdHelper + StoreGateSvc* detStore = 0; + sc = service("DetectorStore", detStore); + if (sc.isFailure()) { + ATH_MSG_FATAL( "DetectorStore service not found !" ); + return sc; + } + if (m_debuglevel) ATH_MSG_DEBUG( "Defined DetectorStore" ); + + // Retrieve the MuonDetectorManager + sc = detStore->retrieve(m_muonMgr); + if (sc.isFailure()) { + ATH_MSG_DEBUG( "Cannot get MuonDetectorManager from detector store" ); + return sc; + } + if (m_debuglevel) ATH_MSG_DEBUG( " Found the MuonDetectorManager from detector store. " ); + + sc = detStore->retrieve(m_cscIdHelper,"CSCIDHELPER"); + if (sc.isFailure()) { + ATH_MSG_FATAL( "Cannot get CscIdHelper" ); + return sc; + } + if (m_debuglevel) ATH_MSG_DEBUG( " Found the CscIdHelper " ); + + sc = detStore->retrieve(m_tgcIdHelper,"TGCIDHELPER"); + if (sc.isFailure()) { + ATH_MSG_FATAL( "Can't retrieve TgcIdHelper" ); + return sc; + } + if (m_debuglevel) ATH_MSG_DEBUG( " Found the TgcIdHelper " ); + + // Retrieve pull calculator + sc = m_pullCalculator.retrieve(); + if (sc.isFailure()) { + ATH_MSG_FATAL("Can't retrieve " << m_pullCalculator ); + return sc; + } + if (m_debuglevel) ATH_MSG_FATAL(" Found the " << m_pullCalculator ); + + // Retrieve helper tools + sc = m_helperTool.retrieve(); + if (sc.isFailure()){ + ATH_MSG_FATAL("Could not get " << m_helperTool ); + return sc; + } + if (m_debuglevel) ATH_MSG_DEBUG( "Retrieved " << m_helperTool ); + + sc = m_idHelperTool.retrieve(); + if (sc.isFailure()){ + ATH_MSG_FATAL( "Could not get " << m_idHelperTool ); + return sc; + } + if (m_debuglevel) ATH_MSG_DEBUG( "Retrieved " << m_idHelperTool ); + + // Retrieve printer + sc = m_printer.retrieve(); + if (sc.isFailure()){ + ATH_MSG_FATAL( "Could not get " << m_printer ); + return sc; + } + if (m_debuglevel) ATH_MSG_DEBUG( "Retrieved " << m_printer ); + + // Retrieve histoTool + sc = m_histoTool.retrieve(); + if (sc.isFailure()){ + ATH_MSG_FATAL( "Could not get " << m_histoTool ); + return sc; + } + if (m_debuglevel) ATH_MSG_DEBUG( "Retrieved " << m_histoTool ); + + // Retrieve TrackHistoTool + sc = m_TrackHistoTool.retrieve(); + if (sc.isFailure()){ + ATH_MSG_FATAL( "Could not get " << m_TrackHistoTool ); + return sc; + } + if (m_debuglevel) ATH_MSG_DEBUG( "Retrieved " << m_TrackHistoTool ); + + // Retrieve propagators + sc = m_propagator.retrieve(); + if( sc.isFailure() ){ + ATH_MSG_FATAL( "Could not get " << m_propagator ); + return sc; + } + if (m_debuglevel) ATH_MSG_INFO( "Retrieved " << m_propagator ); + + // Retrieve fitting tool + sc = m_muondqafitfunc.retrieve(); + if (sc.isFailure()){ + ATH_MSG_FATAL( "Could not get " << m_muondqafitfunc ); + return sc; + } + if (m_debuglevel) ATH_MSG_INFO( "Retrieved " << m_muondqafitfunc ); + + for(int collection = 0; collection < 2; collection++){ + for(int endcap = 0; endcap < 2; endcap++){ + h_nsegm[collection][endcap] = 0; + h_nsegm_oview[collection][endcap] = 0; + for(int sector = 0; sector < 16; sector++){ + ATH_MSG_DEBUG( " initializing = " << endcap << " sector = " << sector + 1 ); + h_nsegm_sect[collection][endcap][sector] = 0; + } // sector + } // endcap + } // collection + + ecap.clear(); coll.clear(); + ecap.push_back("ECA"); + ecap.push_back("ECC"); + coll.push_back("Moore"); + coll.push_back("MuBoy"); + + return sc; +} + +// +//--------------------------------------------------------------------------------------- +// + +void CSCSegmValidation::bookSegmentHistograms() { + + // Clear MonGroups + //m_cscSegmExpert.clear(); + //m_cscSegmShift.clear(); + m_cscSegmDetailEA_Moore.clear(); + m_cscSegmDetailEA_MuBoy.clear(); + m_cscSegmDetailEC_Moore.clear(); + m_cscSegmDetailEC_MuBoy.clear(); + m_cscSegmOviewEA_Moore.clear(); + m_cscSegmOviewEA_MuBoy.clear(); + m_cscSegmOviewEC_Moore.clear(); + m_cscSegmOviewEC_MuBoy.clear(); + + // Book histograms + //h_nclust_per_segm = new TH1F("csc_nclust_per_segm","Number of clusters on CSC segments",4,0,4); + //chi2_histo = new TH1F("csc_chi2","Chi2 of csc segments",100,0,100); + + //std::string ecap[2]= {"ECA", "ECC" }; + //std::string coll[2]= {"Moore", "MuBoy" }; + for(int collection = 0; collection < 2; collection++){ + for(int endcap = 0; endcap < 2; endcap++){ + h_nsegm[collection][endcap] = new TH1F(Form("%s_%s_csc_nsegm",coll[collection].c_str(),ecap[endcap].c_str()), + Form("Number of %s segments at %s;#segments;entries",coll[collection].c_str(),ecap[endcap].c_str()),20,0,20); + ATH_MSG_DEBUG( " booked histo for " << coll[collection] << " collection endcap = " << ecap[endcap] ); + h_nsegm_oview[collection][endcap] = new TH1F(Form("%s_%s_csc_nsegm",coll[collection].c_str(),ecap[endcap].c_str()), + Form("Number of %s segments at %s;#segments;entries",coll[collection].c_str(),ecap[endcap].c_str()),20,0,20); + ATH_MSG_DEBUG( " booked overview histo for " << coll[collection] << " collection endcap = " << ecap[endcap] ); + for(int sector = 0; sector < 16; sector++){ + ATH_MSG_DEBUG( " endcap = " << endcap << " sector = " << sector + 1 ); + h_nsegm_sect[collection][endcap][sector] = new TH1F(Form("%s_%s_csc_nsegm_sec%02d",coll[collection].c_str(),ecap[endcap].c_str(),sector+1), + Form("Number of %s segments at %s sector %02d;#segments;entries",coll[collection].c_str(),ecap[endcap].c_str(),sector+1),20,0,20); + ATH_MSG_DEBUG( " booked histo for " << coll[collection] << " collection endcap = " << ecap[endcap] << " sector = " << sector ); + } // sector + } // endcap + } // collection + + // Add histograms to MonGroups + // nsegm detail histos + m_cscSegmDetailEA_Moore.push_back(h_nsegm[0][0]); + ATH_MSG_DEBUG( " added histo for " << coll[0] << " collection endcap = " << ecap[0] ); + m_cscSegmDetailEA_MuBoy.push_back(h_nsegm[1][0]); + ATH_MSG_DEBUG( " added histo for " << coll[1] << " collection endcap = " << ecap[0] ); + m_cscSegmDetailEC_Moore.push_back(h_nsegm[0][1]); + ATH_MSG_DEBUG( " added histo for " << coll[0] << " collection endcap = " << ecap[1] ); + m_cscSegmDetailEC_MuBoy.push_back(h_nsegm[1][1]); + ATH_MSG_DEBUG( " added histo for " << coll[1] << " collection endcap = " << ecap[1] ); + + // nsegm overview histos + m_cscSegmOviewEA_Moore.push_back(h_nsegm_oview[0][0]); + ATH_MSG_DEBUG( " added overview histo for " << coll[0] << " collection endcap = " << ecap[0] ); + m_cscSegmOviewEA_MuBoy.push_back(h_nsegm_oview[1][0]); + ATH_MSG_DEBUG( " added overview histo for " << coll[1] << " collection endcap = " << ecap[0] ); + m_cscSegmOviewEC_Moore.push_back(h_nsegm_oview[0][1]); + ATH_MSG_DEBUG( " added overview histo for " << coll[0] << " collection endcap = " << ecap[1] ); + m_cscSegmOviewEC_MuBoy.push_back(h_nsegm_oview[1][1]); + ATH_MSG_DEBUG( " added overview histo for " << coll[1] << " collection endcap = " << ecap[1] ); + + // nsegm_sect histos + for(int sector = 0; sector < 16; sector++){ + // detail histos + m_cscSegmDetailEA_Moore.push_back(h_nsegm_sect[0][0][sector]); + ATH_MSG_DEBUG( " added histo for " << coll[0] << " collection endcap = " << ecap[0] << " sector = " << sector ); + m_cscSegmDetailEA_MuBoy.push_back(h_nsegm_sect[1][0][sector]); + ATH_MSG_DEBUG( " added histo for " << coll[1] << " collection endcap = " << ecap[0] << " sector = " << sector ); + m_cscSegmDetailEC_Moore.push_back(h_nsegm_sect[0][1][sector]); + ATH_MSG_DEBUG( " added histo for " << coll[0] << " collection endcap = " << ecap[1] << " sector = " << sector ); + m_cscSegmDetailEC_MuBoy.push_back(h_nsegm_sect[1][1][sector]); + ATH_MSG_DEBUG( " added histo for " << coll[1] << " collection endcap = " << ecap[1] << " sector = " << sector ); + } // sector + + //m_cscSegmExpert.push_back(chi2_histo); + //m_cscSegmExpert.push_back(h_nclust_per_segm); + +} + +// +//--------------------------------------------------------------------------------------- +// + +StatusCode CSCSegmValidation::bookHistograms() +{ + if (m_debuglevel) { + ATH_MSG_DEBUG( "CSCSegmValidation::bookHistograms() to setup tools/services" ); + } + StatusCode sc = StatusCode::SUCCESS; + + if( m_environment == AthenaMonManager::tier0 || m_environment == AthenaMonManager::tier0ESD ) { + + histos_from_tool.push_back(histos_from_tool_Moore); + histos_from_tool.push_back(histos_from_tool_MBoy); + ATH_MSG_DEBUG( "Filled vector with structures histos_from_tool" ); + + for (int j=0;j<(int)m_segmCollectionName.size();j++) { + if ( m_segmCollectionFlag[j] == 0 ) continue; + + std::string m_path_muonsegm = "Muon/MuonSegmentMonitoring"; + MgmtAttr_t attr = ATTRIB_MANAGED; + MonGroup al_muonsegms_shift(this,m_path_muonsegm+"/Global/"+m_segmCollectionName[j],run, attr ); + MonGroup al_muonsegms_debug(this,m_path_muonsegm+"/Global/"+m_segmCollectionName[j],run, attr ); + + MonGroup al_mBAsegms_debug(this,m_path_muonsegm+"/BarrelA/Detail/"+m_segmCollectionName[j],run, attr ); + MonGroup al_mBCsegms_debug(this,m_path_muonsegm+"/BarrelC/Detail/"+m_segmCollectionName[j],run, attr ); + MonGroup al_mEAsegms_debug(this,m_path_muonsegm+"/EndCapA/Detail/"+m_segmCollectionName[j],run, attr ); + MonGroup al_mECsegms_debug(this,m_path_muonsegm+"/EndCapC/Detail/"+m_segmCollectionName[j],run, attr ); + + MonGroup al_mEsegms_debug(this,m_path_muonsegm+"/EndCap/Detail/"+m_segmCollectionName[j],run, attr ); + + MonGroup al_mBAsegms_shift(this,m_path_muonsegm+"/BarrelA/Overview/"+m_segmCollectionName[j],run, attr ); + MonGroup al_mBCsegms_shift(this,m_path_muonsegm+"/BarrelC/Overview/"+m_segmCollectionName[j],run, attr ); + MonGroup al_mEAsegms_shift(this,m_path_muonsegm+"/EndCapA/Overview/"+m_segmCollectionName[j],run, attr ); + MonGroup al_mECsegms_shift(this,m_path_muonsegm+"/EndCapC/Overview/"+m_segmCollectionName[j],run, attr ); + + if(newEventsBlock){} + if(newLumiBlock){} + if(newRun) + { + ATH_MSG_INFO( "Segment Monitoring : begin of run" ); + std::string prefix = ( m_segmCollectionName[j]=="ConvertedMBoySegments" ? "MuBoy_" : "Moore_" ); + + b_status = m_TrackHistoTool->book(histos_from_tool[j],prefix,false,false,false,true); + ATH_MSG_INFO( "Booked histos for " << m_segmCollectionName[j] << " with histTool" ); + + // Book some histograms + bookSegmentHistograms(); + + // Register MonGroups here + std::vector<TH1 *>::iterator m_iT; + /* + // register shift histograms + MonGroup cscsegm_shift( this, "Muon/MuonSegmentMonitoring/CSC/Segment/Shift", shift, run ); + std::vector<TH1 *>::iterator m_iT = m_cscSegmShift.begin(); + ATH_MSG_DEBUG ( "Found " << m_cscSegmShift.size() << " shift Histograms " ); + for (; m_iT != m_cscSegmShift.end(); ++m_iT) { + sc = cscsegm_shift.regHist(*m_iT); + if ( sc.isFailure() ) { + ATH_MSG_ERROR ( "Cannot register histogram " << (*m_iT)->GetName() ); + return sc; + } + } + */ + + /* + // register expert histograms + MonGroup cscsegm_expert( this, "Muon/MuonSegmentMonitoring/CSC/Segment/Expert", expert, run ); + m_iT = m_cscSegmExpert.begin(); + ATH_MSG_DEBUG ( "Found " << m_cscSegmExpert.size() << " expert Histograms " ); + for (; m_iT != m_cscSegmExpert.end(); ++m_iT) { + sc = cscsegm_expert.regHist(*m_iT); + if ( sc.isFailure() ) { + ATH_MSG_ERROR ( "Cannot register histogram " << (*m_iT)->GetName() ); + return sc; + } + } + */ + + // register detail histograms for EA + cscsegm_detailEA_Moore = new MonGroup( this, "Muon/MuonSegmentMonitoring/EndCapA/Detail/MooreSegments", run, attr ); + m_iT = m_cscSegmDetailEA_Moore.begin(); + ATH_MSG_DEBUG ( "Found " << m_cscSegmDetailEA_Moore.size() << " CSCEA Moore Detail Histograms " ); + for (; m_iT != m_cscSegmDetailEA_Moore.end(); ++m_iT) { + sc = cscsegm_detailEA_Moore->regHist(*m_iT); + if ( sc.isFailure() ) { + ATH_MSG_ERROR ( "Cannot register detail histogram for Endcap A Moore Segments: " << (*m_iT)->GetName() ); + return sc; + } + } + + cscsegm_detailEA_MuBoy = new MonGroup( this, "Muon/MuonSegmentMonitoring/EndCapA/Detail/ConvertedMBoySegments", run, attr ); + m_iT = m_cscSegmDetailEA_MuBoy.begin(); + ATH_MSG_DEBUG ( "Found " << m_cscSegmDetailEA_MuBoy.size() << " CSCEA MuBoy Detail Histograms " ); + for (; m_iT != m_cscSegmDetailEA_MuBoy.end(); ++m_iT) { + sc = cscsegm_detailEA_MuBoy->regHist(*m_iT); + if ( sc.isFailure() ) { + ATH_MSG_ERROR ( "Cannot register detail histogram for Endcap A MuBoy Segments: " << (*m_iT)->GetName() ); + return sc; + } + } + + // register overview histograms for EA + cscsegm_oviewEA_Moore = new MonGroup( this, "Muon/MuonSegmentMonitoring/EndCapA/Overview/MooreSegments", run, attr ); + m_iT = m_cscSegmOviewEA_Moore.begin(); + ATH_MSG_DEBUG ( "Found " << m_cscSegmOviewEA_Moore.size() << " CSCEA Moore Overview Histograms " ); + for (; m_iT != m_cscSegmOviewEA_Moore.end(); ++m_iT) { + sc = cscsegm_oviewEA_Moore->regHist(*m_iT); + if ( sc.isFailure() ) { + ATH_MSG_ERROR ( "Cannot register overview histogram for Endcap A Moore Segments: " << (*m_iT)->GetName() ); + return sc; + } + } + + cscsegm_oviewEA_MuBoy = new MonGroup( this, "Muon/MuonSegmentMonitoring/EndCapA/Overview/ConvertedMBoySegments", run, attr ); + m_iT = m_cscSegmOviewEA_MuBoy.begin(); + ATH_MSG_DEBUG ( "Found " << m_cscSegmOviewEA_MuBoy.size() << " CSCEA MuBoy Overview Histograms " ); + for (; m_iT != m_cscSegmOviewEA_MuBoy.end(); ++m_iT) { + sc = cscsegm_oviewEA_MuBoy->regHist(*m_iT); + if ( sc.isFailure() ) { + ATH_MSG_ERROR ( "Cannot register overview histogram for Endcap A MuBoy Segments: " << (*m_iT)->GetName() ); + return sc; + } + } + + // register detail histograms for EC + cscsegm_detailEC_Moore = new MonGroup( this, "Muon/MuonSegmentMonitoring/EndCapA/Detail/MooreSegments", run, attr ); + m_iT = m_cscSegmDetailEC_Moore.begin(); + ATH_MSG_DEBUG ( "Found " << m_cscSegmDetailEC_Moore.size() << " CSCEC Moore Detail Histograms " ); + for (; m_iT != m_cscSegmDetailEC_Moore.end(); ++m_iT) { + sc = cscsegm_detailEC_Moore->regHist(*m_iT); + if ( sc.isFailure() ) { + ATH_MSG_ERROR ( "Cannot register detail histogram for Endcap A Moore Segments: " << (*m_iT)->GetName() ); + return sc; + } + } + + cscsegm_detailEC_MuBoy = new MonGroup( this, "Muon/MuonSegmentMonitoring/EndCapA/Detail/ConvertedMBoySegments", run, attr ); + m_iT = m_cscSegmDetailEC_MuBoy.begin(); + ATH_MSG_DEBUG ( "Found " << m_cscSegmDetailEC_MuBoy.size() << " CSCEC MuBoy Detail Histograms " ); + for (; m_iT != m_cscSegmDetailEC_MuBoy.end(); ++m_iT) { + sc = cscsegm_detailEC_MuBoy->regHist(*m_iT); + if ( sc.isFailure() ) { + ATH_MSG_ERROR ( "Cannot register detail histogram for Endcap A MuBoy Segments: " << (*m_iT)->GetName() ); + return sc; + } + } + + // register overview histograms for EC + cscsegm_oviewEC_Moore = new MonGroup( this, "Muon/MuonSegmentMonitoring/EndCapA/Overview/MooreSegments", run, attr ); + m_iT = m_cscSegmOviewEC_Moore.begin(); + ATH_MSG_DEBUG ( "Found " << m_cscSegmOviewEC_Moore.size() << " CSCEC Moore Overview Histograms " ); + for (; m_iT != m_cscSegmOviewEC_Moore.end(); ++m_iT) { + sc = cscsegm_oviewEC_Moore->regHist(*m_iT); + if ( sc.isFailure() ) { + ATH_MSG_ERROR ( "Cannot register overview histogram for Endcap A Moore Segments: " << (*m_iT)->GetName() ); + return sc; + } + } + + cscsegm_oviewEC_MuBoy = new MonGroup( this, "Muon/MuonSegmentMonitoring/EndCapA/Overview/ConvertedMBoySegments", run, attr ); + m_iT = m_cscSegmOviewEC_MuBoy.begin(); + ATH_MSG_DEBUG ( "Found " << m_cscSegmOviewEC_MuBoy.size() << " CSCEC MuBoy Overview Histograms " ); + for (; m_iT != m_cscSegmOviewEC_MuBoy.end(); ++m_iT) { + sc = cscsegm_oviewEC_MuBoy->regHist(*m_iT); + if ( sc.isFailure() ) { + ATH_MSG_ERROR ( "Cannot register overview histogram for Endcap A MuBoy Segments: " << (*m_iT)->GetName() ); + return sc; + } + } + + // Delete a bunch of unwanted histograms + //deleteUnwantedHistograms(histos_from_tool, m_segmCollectionName, j); + + if (m_debuglevel) ATH_MSG_DEBUG( "Booked residual histos for " << m_segmCollectionName[j] ); + b_status = m_TrackHistoTool->registerHist(al_muonsegms_shift,al_muonsegms_debug,al_mBAsegms_debug,al_mBCsegms_debug,al_mEsegms_debug,al_mEAsegms_debug,al_mECsegms_debug,histos_from_tool[j]); + if (m_debuglevel) ATH_MSG_DEBUG("Finished booking histos for " << m_segmCollectionName[j] ); + + } // if NewRun + + } // loop over Muon Segm collections + + } // environment if + return sc; + +} + +// +//--------------------------------------------------------------------------------------- +// + +StatusCode CSCSegmValidation::fillHistograms() +{ + StatusCode sc = StatusCode::SUCCESS; + ATH_MSG_DEBUG( "******************************************************************************" ); + ATH_MSG_DEBUG( " INSIDE fillHistograms() " ); + ATH_MSG_DEBUG( "******************************************************************************" ); + + if( m_environment == AthenaMonManager::tier0 || m_environment == AthenaMonManager::tier0ESD || m_environment == AthenaMonManager::user ) { + + // Set the event counter + m_eventNumber = m_eventCounter; + + // Set nsegm counter + for(int collection = 0; collection < 2; collection++){ + for(int endcap = 0; endcap < 2; endcap++){ + nsegm_Counter[collection][endcap] = 0; + for(int sector = 0; sector < 16; sector++){ + nsegm_sect_Counter[collection][endcap][sector] = 0; + } // sector + } // endcap + } // collection + + bool got_coll = false; + int h_index = -1; + for (int j=0;j<(int)m_segmCollectionName.size();++j) { + + if (m_debuglevel) ATH_MSG_DEBUG( "Segm collection FLAG is " << m_segmCollectionFlag[j] ); + + if ( m_segmCollectionFlag[j] == 0 ) continue; + ++h_index; + + //Get segms from SG + sc = m_storeGate->retrieve(m_segms, m_segmCollectionName[j]); + + if (m_debuglevel) ATH_MSG_DEBUG( "Segm collection Name is " << m_segmCollectionName[j] ); + + if ( sc.isFailure() ){ + if ( (j == (int)m_segmCollectionName.size()-1) && !got_coll ){ + + ATH_MSG_DEBUG( "Unable to retrieve reconstructed segms from any collection... Exiting!" ); + return StatusCode::FAILURE; } + else { + + ATH_MSG_DEBUG( "Unable to retrieve reconstructed segms from collection... Trying next..." ); + + continue; } + }else{ + + if (m_debuglevel){ ATH_MSG_DEBUG( "Segms in StoreGate found"); + ATH_MSG_DEBUG( "Segm collection Name is " << m_segmCollectionName[j] );} + got_coll = true; + } + + if ( m_segms->empty() ){ + + if (m_debuglevel){ + ATH_MSG_DEBUG( "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"); + ATH_MSG_DEBUG( " Segm Collection is Empty. Trying next... "); + ATH_MSG_DEBUG( "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"); + } + continue; + } + + if (m_debuglevel){ + ATH_MSG_DEBUG( "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"); + ATH_MSG_DEBUG( " Segm Collection size " ); + ATH_MSG_DEBUG( "Number of segms found: " << m_segms->size() ); + ATH_MSG_DEBUG( "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"); + } + + if ( m_segms->size() > 0 ){ + ATH_MSG_DEBUG( "********************************* WARNING ************************************" ); + ATH_MSG_DEBUG( "Number of segms in event is: " << m_segms->size() ); + ATH_MSG_DEBUG( "This algorithm is designed to operate for single segm / event only" ); + ATH_MSG_DEBUG( "Processing only the first segm in the segm collection" ); + ATH_MSG_DEBUG( "******************************************************************************" ); + } + ATH_MSG_DEBUG( "Made it to point A" ); + + //Loop over segms + for (Trk::SegmentCollection::const_iterator s = m_segms->begin();s != m_segms->end(); ++s) { + // Get segm + Muon::MuonSegment *segm=dynamic_cast<Muon::MuonSegment*>(*s); + + if (segm == 0) { + ATH_MSG_ERROR( "no pointer to segm!!!" ); + continue; + } + + // Loop over segment ROTs + for(unsigned int i =0; i < segm->numberOfContainedROTs(); ++i) { + //const Trk::RIO_OnTrack* rio = segm->rioOnTrack(i); + //Identifier id = rio->identify(); + ATH_MSG_DEBUG( "Looking at segment id" ); + + // Skip segment if there are no csc hits + if ( cscHits(segm)<1 ) continue; + + // Get contained measurements + const std::vector<const Trk::MeasurementBase*> meas = segm->containedMeasurements(); + + // Skip segment if no measurements + if ( meas.size()<1 ) continue; + + // Analyze segment if it is a csc segment + if ( /*m_idHelperTool->isCsc(id)*/ isCscSegment(segm) ) + { + + // Print out segment information + const Trk::FitQuality* fq = segm->fitQuality(); + double chi2 = 999.; + int ndof = -1; + if( fq ) + { + chi2 = fq->chiSquared(); + ndof = fq->numberDoF(); + ATH_MSG_DEBUG( "Chi2 " << chi2 ); + //chi2_histo->Fill(chi2); + ATH_MSG_DEBUG( "Ndof " << ndof ); + } + + ATH_MSG_DEBUG( "R " << segm->globalPosition().perp() ); + ATH_MSG_DEBUG( "Z " << segm->globalPosition().z() ); + ATH_MSG_DEBUG( "Phi " << segm->globalPosition().phi() ); + ATH_MSG_DEBUG( "Eta " << segm->globalPosition().eta() ); + ATH_MSG_DEBUG( "Dir Phi " << segm->globalDirection().phi() ); + ATH_MSG_DEBUG( "Dir Eta " << segm->globalDirection().eta() ); + + //ATH_MSG_DEBUG( "New Segment " << nsegm_Counter[j][(segm->globalDirection().eta()+1)/2] + 1 ); + /* + if(histos.layers || histos.mlayers) { + const MdtIdHelper *m_mdtIdHelper = m_muonMgr->mdtIdHelper(); + std::set<int> multiLayers; + std::set<int> tubeLayers; + const std::vector<const Trk::MeasurementBase*> measurements = segment.containedMeasurements(); + for(unsigned int i =0; i < measurements.size(); ++i) { + const Trk::MeasurementBase* meas = measurements[i]; + Identifier measId = m_helperTool->getIdentifier(*meas); + if (m_mdtIdHelper->is_mdt(measId)) { + multiLayers.insert(m_mdtIdHelper->multilayer(measId)); + tubeLayers.insert( (m_mdtIdHelper->multilayer(measId)-1)*4 + m_mdtIdHelper->tubeLayer(measId) ); + } + } + if( histos.layers ) ATH_MSG_INFO( "Layers " << histos.layers ); + if( histos.mlayers ) ATH_MSG_INFO( "mLayers " << histos.mlayers ); + } + */ + + + // Get segm parameters + //const std::vector<const Trk::MeasurementBase*> meas = segm->containedMeasurements(); + const Trk::AtaPlane* segPars = m_helperTool->createTrackParameters(*segm,10000.,0.); // segm,momentum,charge + if( !segPars ) return false; + + // ============================================================================== + // Field Range Notes + // ============================================================================== + // StationName unsigned integer maps to "CSS", "CSL", etc. + // StationEta [-1,1] -1 for backward, 1 for forward endcap + // StationPhi [1,8] increases with Phi + // Technology [1] maps to "CSC" + // ChamberLayer [1,2] increases with |Z| + // WireLayer [1,4] increases with |Z| + // MeasuresPhi [0,1] 0 if measures R, 1 if measures Phi + // Strip [1,n] increases with R for MeasuresPhi=0 + // increases with Phi for MeasuresPhi=1 + // ============================================================================== + + //if (meas.size()>0) + //{ + + const Trk::MeasurementBase* rio = meas[0]; + Identifier id = m_helperTool->getIdentifier(*rio); + std::string name; + + // Chamber name stuff. Take info from first hit + //int PhiStation=0, EtaStation=0; + int PhiStation=0; + //bool isInner=false, isMiddle=false, isOuter=false, isSideA=false; + //int chamberIndex=0; + int icscstationPhi=0, icscstationEta=0, icscEndcap=0; + + icscstationPhi = int(m_cscIdHelper->stationPhi(id)); + icscstationEta = int(m_cscIdHelper->stationEta(id)); + icscEndcap = (icscstationEta+1)/2; + bool cscIsLarge = !( m_idHelperTool->isSmallChamber(id)); + if (cscIsLarge) { name = "CSL_"; } + else { name = "CSS_"; } + if (icscstationEta>0) { name = name+"A"; } + else { name = name+"C"; } + if (cscIsLarge) { PhiStation = icscstationPhi*2-1; } + else { PhiStation = icscstationPhi*2; } + //EtaStation = ( icscstationEta>0 ? icscstationEta+14 : icscstationEta-14 ); + + // Get first and last hits on segment + std::vector< const Trk::MeasurementBase* >::const_iterator hit = segm->containedMeasurements().begin(); + std::vector< const Trk::MeasurementBase* >::const_iterator hit_end = segm->containedMeasurements().end(); + + // Loop over hits + for( ;hit!=hit_end;hit++ ){ + Identifier clust_id; + const Muon::CscClusterOnTrack* clust_rot = dynamic_cast<const Muon::CscClusterOnTrack*>(*hit); + if( clust_rot ) { + + } + else{ + + } + } + + // Number of clusters on segment + int n_clust=meas.size(); + + // Loop over all clusters on segment + for(int i = 0; i < n_clust; i++) { + //Identifier clustId = m_helperTool->getIdentifier(meas[i]); + } // loop over clusters + + //} // if meas.size()>0 + + // Count segment + ATH_MSG_DEBUG( " icscstationEta = " << icscstationEta << " PhiStation = " << PhiStation ); + nsegm_Counter[j][icscEndcap]++; + ATH_MSG_DEBUG( " " << coll[j] << " collection endcap " << ecap[icscEndcap] << " nsegm counted" ); + nsegm_sect_Counter[j][icscEndcap][PhiStation]++; + ATH_MSG_DEBUG( " " << coll[j] << " collection endcap " << ecap[icscEndcap] << " sector " << PhiStation << " nsegm counted" ); + + // Fill segment histos + // Fill histos with tool + b_status = m_TrackHistoTool->fill(histos_from_tool[j],*segm); + + // Fill number of layers histo + //h_nclust_per_segm->Fill(n_clust); + + // Fill profile histos + //const Trk::TrackParameters* pars; + //const Trk::ResidualPull* resPull; + + /* + for (unsigned int i=0; i<meas.size(); ++i) { + const Trk::MeasurementBase* rio = meas[i]; + Identifier id = m_helperTool->getIdentifier(*rio); + + } + */ + + + delete segPars; //Added this here because of compiler error + } // if is csc segment + } // loop over ROTs + + // delete segPars; + } // loop over segms + + // Fill nsegm histos + for(int collection = 0; collection < 2; collection++){ + for(int endcap = 0; endcap < 2; endcap++){ + if(nsegm_Counter[collection][endcap]>0){ + h_nsegm[collection][endcap]->Fill(nsegm_Counter[collection][endcap]); + ATH_MSG_DEBUG( " h_nsegm[" << collection << "][" << endcap << "] filled " << nsegm_Counter[collection][endcap] ); + h_nsegm_oview[collection][endcap]->Fill(nsegm_Counter[collection][endcap]); + ATH_MSG_DEBUG( " h_nsegm_oview[" << collection << "][" << endcap << "] filled " << nsegm_Counter[collection][endcap] ); + } + for(int sector = 0; sector < 16; sector++){ + //ATH_MSG_DEBUG( " nsegm_sect[" << endcap << "][" << sector << "] = " << nsegm_sect_Counter[endcap][sector] ); + if(nsegm_sect_Counter[collection][endcap][sector]>0){ + h_nsegm_sect[collection][endcap][sector]->Fill(nsegm_sect_Counter[collection][endcap][sector]); + ATH_MSG_DEBUG( " h_nsegm_sect[" << collection << "]" << "[" << endcap << "][" << sector << "] filled " << nsegm_sect_Counter[collection][endcap][sector] ); + } + } + } + } + + ATH_MSG_DEBUG( "Number of Segments" << nsegm_Counter ); + } // loop over collections + + ++m_eventCounter; + if (m_debuglevel) ATH_MSG_DEBUG( "Number of events : "<< m_eventCounter ); + + } // environment if + + if (m_debuglevel) ATH_MSG_DEBUG( "CSCSegmValidation::Finalisation of " << name() << " was successful" ); + + return sc; +} + +// +//--------------------------------------------------------------------------------------- +// + +StatusCode CSCSegmValidation::procHistograms() +{ + if( m_environment == AthenaMonManager::tier0 || m_environment == AthenaMonManager::tier0ESD ) { + + if (m_debuglevel) ATH_MSG_DEBUG( "MuonSegmMonitoring procHistograms()" ); + if(endOfEventsBlock){} + if(endOfLumiBlock){} + if(endOfRun){ + + } // endOfRun + } // environment if + + return StatusCode::SUCCESS; +} + +// +//--------------------------------------------------------------------------------------- +// + +//=====================================================// +/** finalize */ +//=====================================================// + + +StatusCode CSCSegmValidation::finalize() +{ + StatusCode sc = ManagedMonitorToolBase::finalize(); + if(!sc.isSuccess()) return sc; + + m_num_segms.clear(); + m_num_hits_per_segmvsphi.clear(); + m_num_hits_per_segm_vs_station.clear(); + chi2_vs_station.clear(); + + m_segm_etavsphi.clear(); + m_segm_eta_vs_phi.clear(); + m_segm_eta_vs_phiInner.clear(); + m_segm_eta_vs_phiMiddle.clear(); + m_segm_eta_vs_phiOuter.clear(); + + histos_from_tool.clear(); + return sc; + +} + +// +//--------------------------------------------------------------------------------------- +// + +bool CSCSegmValidation::isCscSegment( const Muon::MuonSegment* seg ) const { + bool isCsc(false); + + std::vector<const Trk::MeasurementBase*> mbs = seg->containedMeasurements(); + for( unsigned int i = 0; i< mbs.size(); ++i){ + + const Trk::RIO_OnTrack* rot = dynamic_cast<const Trk::RIO_OnTrack*> (mbs[i]); + if (!rot){ + const Trk::CompetingRIOsOnTrack* crot = dynamic_cast<const Trk::CompetingRIOsOnTrack*> (mbs[i]); + if (crot) rot = &(crot->rioOnTrack(0)); + } + if( !rot ) { + continue; + } + if( m_cscIdHelper->is_csc( rot->identify() ) ) isCsc=true; + } + + return isCsc; +} + +// +//--------------------------------------------------------------------------------------- +// + + +unsigned int CSCSegmValidation::cscHits( const Muon::MuonSegment* seg ) const { + unsigned int nrHits(0); + if( !isCscSegment(seg) ) return nrHits; + + std::vector<const Trk::MeasurementBase*> mbs = seg->containedMeasurements(); + for( unsigned int i = 0; i< mbs.size(); ++i){ + + const Trk::RIO_OnTrack* rot = dynamic_cast<const Trk::RIO_OnTrack*> (mbs[i]); + if (!rot){ + const Trk::CompetingRIOsOnTrack* crot = dynamic_cast<const Trk::CompetingRIOsOnTrack*> (mbs[i]); + if (crot) rot = &(crot->rioOnTrack(0)); + } + if( !rot ) { + continue; + } + if( m_cscIdHelper->is_csc( rot->identify() ) ) ++nrHits; + } + + return nrHits ; +} + +// +//--------------------------------------------------------------------------------------- +// + +/* + void CSCSegmValidation::deleteUnwantedHistograms( Muon::MuonDQATrackHistTool::TrackHistos histos_from_tool, std::string m_segmCollectionName, int j){ + + // numbers of segments/hits... + // Delete histos irrelevant for segments, that HistTool books automatically - hack... + if ( m_segmCollectionName[j] == "ConvertedMBoySegments" ) + { + if ( histos_from_tool[j].hitHistos.countHistos.netaTrig ){ + histos_from_tool[j].hitHistos.countHistos.netaTrig->Delete(); + histos_from_tool[j].hitHistos.countHistos.netaTrig = 0; + } + if ( histos_from_tool[j].hitHistos.countHistos.netaTrigCh ){ + histos_from_tool[j].hitHistos.countHistos.netaTrigCh->Delete(); + histos_from_tool[j].hitHistos.countHistos.netaTrigCh = 0; + } + if ( histos_from_tool[j].hitHistos.countHistos.rpcs.neta ){ + histos_from_tool[j].hitHistos.countHistos.rpcs.neta->Delete(); + histos_from_tool[j].hitHistos.countHistos.rpcs.neta = 0; + } + if ( histos_from_tool[j].hitHistos.countHistos.rpcs.netaCh ){ + histos_from_tool[j].hitHistos.countHistos.rpcs.netaCh->Delete(); + histos_from_tool[j].hitHistos.countHistos.rpcs.netaCh = 0; + } + if ( histos_from_tool[j].hitHistos.countHistos.tgcs.neta ){ + histos_from_tool[j].hitHistos.countHistos.tgcs.neta->Delete(); + histos_from_tool[j].hitHistos.countHistos.tgcs.neta = 0; + } + if ( histos_from_tool[j].hitHistos.countHistos.tgcs.netaCh ){ + histos_from_tool[j].hitHistos.countHistos.tgcs.netaCh->Delete(); + histos_from_tool[j].hitHistos.countHistos.tgcs.netaCh = 0; + } + } + + // Segment fit + coordinates + // Delete histos irrelevant for segments, that HistTool books automatically - hack... + if ( histos_from_tool[j].pt ){ + histos_from_tool[j].pt->Delete(); + histos_from_tool[j].pt = 0; + } + if ( histos_from_tool[j].momentum ){ + histos_from_tool[j].momentum->Delete(); + histos_from_tool[j].momentum = 0; + } + + // Hit Residuals + pulls + // Delete histos irrelevant for segments, that HistTool books automatically - hack... + ATH_MSG_DEBUG( "deleting histos for " << m_segmCollectionName[j] ); + + if ( histos_from_tool[j].hitHistos.residualHistos.all.error ){ + histos_from_tool[j].hitHistos.residualHistos.all.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.all.error = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.all.lposX ){ + histos_from_tool[j].hitHistos.residualHistos.all.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.all.lposX = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.all.lposY ){ + histos_from_tool[j].hitHistos.residualHistos.all.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.all.lposY = 0; + } + + if ( histos_from_tool[j].hitHistos.residualHistos.mdts.resProf ){ + histos_from_tool[j].hitHistos.residualHistos.mdts.resProf->Delete(); + histos_from_tool[j].hitHistos.residualHistos.mdts.resProf = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.mdtsBarrelA.resProf ){ + histos_from_tool[j].hitHistos.residualHistos.mdtsBarrelA.resProf->Delete(); + histos_from_tool[j].hitHistos.residualHistos.mdtsBarrelA.resProf = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.mdtsBarrelC.resProf ){ + histos_from_tool[j].hitHistos.residualHistos.mdtsBarrelC.resProf->Delete(); + histos_from_tool[j].hitHistos.residualHistos.mdtsBarrelC.resProf = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.mdtsECA.resProf ){ + histos_from_tool[j].hitHistos.residualHistos.mdtsECA.resProf->Delete(); + histos_from_tool[j].hitHistos.residualHistos.mdtsECA.resProf = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.mdtsECC.resProf ){ + histos_from_tool[j].hitHistos.residualHistos.mdtsECC.resProf->Delete(); + histos_from_tool[j].hitHistos.residualHistos.mdtsECC.resProf = 0; + } + + if ( histos_from_tool[j].hitHistos.residualHistos.mdts.pullProf ){ + histos_from_tool[j].hitHistos.residualHistos.mdts.pullProf->Delete(); + histos_from_tool[j].hitHistos.residualHistos.mdts.pullProf = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.mdtsBarrelA.pullProf ){ + histos_from_tool[j].hitHistos.residualHistos.mdtsBarrelA.pullProf->Delete(); + histos_from_tool[j].hitHistos.residualHistos.mdtsBarrelA.pullProf = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.mdtsBarrelC.pullProf ){ + histos_from_tool[j].hitHistos.residualHistos.mdtsBarrelC.pullProf->Delete(); + histos_from_tool[j].hitHistos.residualHistos.mdtsBarrelC.pullProf = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.mdtsECA.pullProf ){ + histos_from_tool[j].hitHistos.residualHistos.mdtsECA.pullProf->Delete(); + histos_from_tool[j].hitHistos.residualHistos.mdtsECA.pullProf = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.mdtsECC.pullProf ){ + histos_from_tool[j].hitHistos.residualHistos.mdtsECC.pullProf->Delete(); + histos_from_tool[j].hitHistos.residualHistos.mdtsECC.pullProf = 0; + } + + if ( histos_from_tool[j].hitHistos.countHistos.mdts.nmdtProf ){ + histos_from_tool[j].hitHistos.countHistos.mdts.nmdtProf->Delete(); + histos_from_tool[j].hitHistos.countHistos.mdts.nmdtProf = 0; + } + if ( histos_from_tool[j].hitHistos.countHistos.mdtsBarrelA.nmdtProf ){ + histos_from_tool[j].hitHistos.countHistos.mdtsBarrelA.nmdtProf->Delete(); + histos_from_tool[j].hitHistos.countHistos.mdtsBarrelA.nmdtProf = 0; + } + if ( histos_from_tool[j].hitHistos.countHistos.mdtsBarrelC.nmdtProf ){ + histos_from_tool[j].hitHistos.countHistos.mdtsBarrelC.nmdtProf->Delete(); + histos_from_tool[j].hitHistos.countHistos.mdtsBarrelC.nmdtProf = 0; + } + if ( histos_from_tool[j].hitHistos.countHistos.mdtsECA.nmdtProf ){ + histos_from_tool[j].hitHistos.countHistos.mdtsECA.nmdtProf->Delete(); + histos_from_tool[j].hitHistos.countHistos.mdtsECA.nmdtProf = 0; + } + if ( histos_from_tool[j].hitHistos.countHistos.mdtsECC.nmdtProf ){ + histos_from_tool[j].hitHistos.countHistos.mdtsECC.nmdtProf->Delete(); + histos_from_tool[j].hitHistos.countHistos.mdtsECC.nmdtProf = 0; + } + + if ( histos_from_tool[j].hitHistos.countHistos.mdts.nsegm ){ + histos_from_tool[j].hitHistos.countHistos.mdts.nsegm->Delete(); + histos_from_tool[j].hitHistos.countHistos.mdts.nsegm = 0; + } + if ( histos_from_tool[j].hitHistos.countHistos.mdtsBarrelA.nsegm ){ + histos_from_tool[j].hitHistos.countHistos.mdtsBarrelA.nsegm->Delete(); + histos_from_tool[j].hitHistos.countHistos.mdtsBarrelA.nsegm = 0; + } + if ( histos_from_tool[j].hitHistos.countHistos.mdtsBarrelC.nsegm ){ + histos_from_tool[j].hitHistos.countHistos.mdtsBarrelC.nsegm->Delete(); + histos_from_tool[j].hitHistos.countHistos.mdtsBarrelC.nsegm = 0; + } + if ( histos_from_tool[j].hitHistos.countHistos.mdtsECA.nsegm ){ + histos_from_tool[j].hitHistos.countHistos.mdtsECA.nsegm->Delete(); + histos_from_tool[j].hitHistos.countHistos.mdtsECA.nsegm = 0; + } + if ( histos_from_tool[j].hitHistos.countHistos.mdtsECC.nsegm ){ + histos_from_tool[j].hitHistos.countHistos.mdtsECC.nsegm->Delete(); + histos_from_tool[j].hitHistos.countHistos.mdtsECC.nsegm = 0; + } + + if ( histos_from_tool[j].hitHistos.countHistos.mdts.chi2Prof ){ + histos_from_tool[j].hitHistos.countHistos.mdts.chi2Prof->Delete(); + histos_from_tool[j].hitHistos.countHistos.mdts.chi2Prof = 0; + } + if ( histos_from_tool[j].hitHistos.countHistos.mdtsBarrelA.chi2Prof ){ + histos_from_tool[j].hitHistos.countHistos.mdtsBarrelA.chi2Prof->Delete(); + histos_from_tool[j].hitHistos.countHistos.mdtsBarrelA.chi2Prof = 0; + } + if ( histos_from_tool[j].hitHistos.countHistos.mdtsBarrelC.chi2Prof ){ + histos_from_tool[j].hitHistos.countHistos.mdtsBarrelC.chi2Prof->Delete(); + histos_from_tool[j].hitHistos.countHistos.mdtsBarrelC.chi2Prof = 0; + } + if ( histos_from_tool[j].hitHistos.countHistos.mdtsECA.chi2Prof ){ + histos_from_tool[j].hitHistos.countHistos.mdtsECA.chi2Prof->Delete(); + histos_from_tool[j].hitHistos.countHistos.mdtsECA.chi2Prof = 0; + } + if ( histos_from_tool[j].hitHistos.countHistos.mdtsECC.chi2Prof ){ + histos_from_tool[j].hitHistos.countHistos.mdtsECC.chi2Prof->Delete(); + histos_from_tool[j].hitHistos.countHistos.mdtsECC.chi2Prof = 0; + } + + + if ( m_segmCollectionName[j] == "ConvertedMBoySegments" ) + { + ATH_MSG_DEBUG( "deleting histos specifically for muonboy" ); + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEta.res ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEta.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEta.res = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEta.pull ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEta.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEta.pull = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEta.error ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEta.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEta.error = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEta.lposX ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEta.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEta.lposX = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEta.lposY ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEta.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEta.lposY = 0; + } + + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA.res ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA.res = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA.pull ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA.pull = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA.error ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA.error = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA.lposX ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA.lposX = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA.lposY ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA.lposY = 0; + } + + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC.res ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC.res = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC.pull ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC.pull = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC.error ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC.error = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC.lposX ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC.lposX = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC.lposY ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC.lposY = 0; + } + + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA1.res ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA1.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA1.res = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA1.pull ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA1.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA1.pull = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA1.error ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA1.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA1.error = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA1.lposX ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA1.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA1.lposX = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA1.lposY ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA1.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA1.lposY = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA2.res ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA2.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA2.res = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA2.pull ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA2.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA2.pull = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA2.error ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA2.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA2.error = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA2.lposX ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA2.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA2.lposX = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA2.lposY ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA2.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA2.lposY = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA3.res ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA3.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA3.res = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA3.pull ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA3.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA3.pull = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA3.error ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA3.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA3.error = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA3.lposX ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA3.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA3.lposX = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA3.lposY ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA3.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA3.lposY = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA4.res ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA4.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA4.res = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA4.pull ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA4.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA4.pull = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA4.error ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA4.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA4.error = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA4.lposX ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA4.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA4.lposX = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA4.lposY ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA4.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA4.lposY = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA5.res ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA5.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA5.res = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA5.pull ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA5.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA5.pull = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA5.error ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA5.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA5.error = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA5.lposX ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA5.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA5.lposX = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA5.lposY ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA5.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA5.lposY = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA6.res ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA6.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA6.res = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA6.pull ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA6.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA6.pull = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA6.error ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA6.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA6.error = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA6.lposX ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA6.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA6.lposX = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA6.lposY ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA6.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA6.lposY = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA7.res ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA7.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA7.res = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA7.pull ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA7.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA7.pull = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA7.error ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA7.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA7.error = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA7.lposX ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA7.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA7.lposX = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA7.lposY ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA7.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA7.lposY = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA8.res ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA8.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA8.res = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA8.pull ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA8.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA8.pull = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA8.error ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA8.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA8.error = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA8.lposX ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA8.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA8.lposX = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA8.lposY ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA8.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA8.lposY = 0; + } + + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC1.res ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC1.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC1.res = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC1.pull ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC1.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC1.pull = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC1.error ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC1.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC1.error = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC1.lposX ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC1.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC1.lposX = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC1.lposY ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC1.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC1.lposY = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC2.res ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC2.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC2.res = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC2.pull ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC2.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC2.pull = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC2.error ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC2.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC2.error = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC2.lposX ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC2.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC2.lposX = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC2.lposY ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC2.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC2.lposY = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC3.res ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC3.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC3.res = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC3.pull ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC3.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC3.pull = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC3.error ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC3.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC3.error = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC3.lposX ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC3.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC3.lposX = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC3.lposY ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC3.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC3.lposY = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC4.res ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC4.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC4.res = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC4.pull ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC4.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC4.pull = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC4.error ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC4.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC4.error = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC4.lposX ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC4.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC4.lposX = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC4.lposY ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC4.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC4.lposY = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC5.res ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC5.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC5.res = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC5.pull ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC5.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC5.pull = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC5.error ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC5.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC5.error = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC5.lposX ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC5.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC5.lposX = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC5.lposY ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC5.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC5.lposY = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC6.res ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC6.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC6.res = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC6.pull ){ + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC6.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC6.pull = 0; + } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC6.error ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC6.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC6.error = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC6.lposX ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC6.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC6.lposX = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC6.lposY ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC6.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC6.lposY = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC7.res ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC7.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC7.res = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC7.pull ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC7.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC7.pull = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC7.error ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC7.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC7.error = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC7.lposX ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC7.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC7.lposX = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC7.lposY ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC7.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC7.lposY = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC8.res ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC8.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC8.res = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC8.pull ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC8.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC8.pull = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC8.error ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC8.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC8.error = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC8.lposX ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC8.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC8.lposX = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC8.lposY ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC8.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC8.lposY = 0; } + + if ( histos_from_tool[j].hitHistos.residualHistos.tgcsEta.res ) + { histos_from_tool[j].hitHistos.residualHistos.tgcsEta.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.tgcsEta.res = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.tgcsEta.pull ) + { histos_from_tool[j].hitHistos.residualHistos.tgcsEta.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.tgcsEta.pull = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.tgcsEta.error ) + { histos_from_tool[j].hitHistos.residualHistos.tgcsEta.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.tgcsEta.error = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.tgcsEta.lposX ) + { histos_from_tool[j].hitHistos.residualHistos.tgcsEta.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.tgcsEta.lposX = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.tgcsEta.lposY ) + { histos_from_tool[j].hitHistos.residualHistos.tgcsEta.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.tgcsEta.lposY = 0; } + ATH_MSG_DEBUG( "deleted histos specifically for muonboy" ); + } + } +*/ diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/src/MuonSegmValidation.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/src/MuonSegmValidation.cxx new file mode 100755 index 0000000000000000000000000000000000000000..5381ad02c03c3dc986baae42a7b13a824f389eb0 --- /dev/null +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/src/MuonSegmValidation.cxx @@ -0,0 +1,1785 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + + +/* =========================================================================== + MuonSegmValidation.cxx + ------------------------------ + + AUTHORS: I. Christidi + Modified: N. Benekos (Illinois) + created: January 2008 + description: Implementation code for the MuonSegmValidation + =========================================================================== */ + +#include "MuonSegmMonitoring/MuonSegmValidation.h" +#include "MuonRecHelperTools/MuonEDMPrinterTool.h" +#include "MuonRecHelperTools/MuonEDMHelperTool.h" +#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonDQAUtils/MuonChamberNameConverter.h" +#include "MuonDQAUtils/MuonDQAFitFunc.h" + +// Track +#include "TrkExInterfaces/IPropagator.h" +#include "TrkToolInterfaces/IResidualPullCalculator.h" + +#include "EventPrimitives/EventPrimitives.h" +#include "TrkEventPrimitives/FitQualityOnSurface.h" +#include "TrkEventPrimitives/FitQuality.h" +#include "TrkMeasurementBase/MeasurementBase.h" +#include "TrkSurfaces/BoundaryCheck.h" + +#include "TrkParameters/TrackParameters.h" +#include "TrkGeometry/MagneticFieldProperties.h" + +#include "TrkTrack/TrackCollection.h" +#include "TrkEventPrimitives/ResidualPull.h" +#include "TrkEventPrimitives/PropDirection.h" + +// Gaudi Tools +#include "GaudiKernel/SmartDataPtr.h" +#include "GaudiKernel/INTupleSvc.h" +#include "AthenaMonitoring/AthenaMonManager.h" + +// Storegate +#include "StoreGate/StoreGate.h" + +// ROOT Classes +#include <TH1F.h> +#include <TH2F.h> + +// C++ +#include <TMath.h> + + +const int s_maxEvents = 100000; +const int s_maxComponents = 50; +const int s_maxSoS = 80; + +// ********************************************************************* +// Public Methods +// ********************************************************************* + +MuonSegmValidation::MuonSegmValidation( const std::string & type, const std::string & name, const IInterface* parent ) + :ManagedMonitorToolBase( type, name, parent ), + m_storeGate(0), + m_eventCounter(0), + m_debuglevel(false) +{ + m_pullCalculator = ToolHandle<Trk::IResidualPullCalculator>("Trk::ResidualPullCalculator/ResidualPullCalculator"); + m_helperTool = ToolHandle<Muon::MuonEDMHelperTool>("Muon::MuonEDMHelperTool/MuonEDMHelperTool"); + m_printer = ToolHandle<Muon::MuonEDMPrinterTool>("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"); + m_idHelperTool = ToolHandle<Muon::MuonIdHelperTool>("Muon::MuonIdHelperTool/MuonIdHelperTool"); + m_propagator = ToolHandle<Trk::IPropagator>("Trk::StraightLinePropagator/MuonStraightLinePropagator"); + m_histoTool = ToolHandle<Muon::MuonDQAHistTool>("Muon::MuonDQAHistTool/MuonDQAHistTool"); + m_TrackHistoTool = ToolHandle<Muon::MuonDQATrackHistTool>("Muon::MuonDQATrackHistTool/MuonDQATrackHistTool"); + m_muondqafitfunc = ToolHandle<Muon::MuonDQAFitFunc>("Muon::MuonDQAFitFunc/MuonDQAFitFunc"); + + declareProperty( "WhichSegmCollections", m_segmCollectionFlag); + declareProperty( "MuonSegmCollections", m_segmCollectionName); + declareProperty( "doMDT", m_doMDT); + declareProperty( "doRPC", m_doRPC); + declareProperty( "doTGC", m_doTGC); + declareProperty( "doCSC", m_doCSC); +} +//--------------------------------------------------------------------------------------- +MuonSegmValidation::~MuonSegmValidation() +{ + ATH_MSG_INFO( " deleting MuonSegmValidation " ); +} + + +//==================================================================// +/** Initialize */ +//==================================================================// + +StatusCode MuonSegmValidation::initialize() +{ + StatusCode sc = ManagedMonitorToolBase::initialize(); + if(!sc.isSuccess()) return sc; + + ATH_MSG_INFO( "in initialize() in SegmMonitoring" ); + + //initializing tools + // Retrieve the StoreGate service + + sc = service( "StoreGateSvc", m_storeGate ); + if ( sc.isFailure() ){ + ATH_MSG_FATAL( "Unable to retrieve the StoreGate service... Exiting!" ); + return sc; + } + if (m_debuglevel) ATH_MSG_DEBUG( "Defined detector service" ); + + // retrieve the active store + sc = serviceLocator()->service("ActiveStoreSvc", m_activeStore); + if (sc.isFailure()) { + ATH_MSG_FATAL( " Cannot get ActiveStoreSvc " ); + return sc ; + } + if (m_debuglevel) ATH_MSG_DEBUG( "Defined ActiveStoreSvc" ); + + // Initialize the IdHelper + StoreGateSvc* detStore = 0; + sc = service("DetectorStore", detStore); + if (sc.isFailure()) { + ATH_MSG_FATAL( "DetectorStore service not found !" ); + return sc; + } + if (m_debuglevel) ATH_MSG_DEBUG( "Defined DetectorStore" ); + + // Retrieve the MuonDetectorManager + sc = detStore->retrieve(m_muonMgr); + if (sc.isFailure()) { + ATH_MSG_DEBUG( "Cannot get MuonDetectorManager from detector store" ); + return sc; + } + if (m_debuglevel) ATH_MSG_DEBUG( " Found the MuonDetectorManager from detector store. " ); + + // Retrieve the subsystem helpers + sc = detStore->retrieve(m_mdtIdHelper,"MDTIDHELPER"); + if (sc.isFailure()) { + ATH_MSG_FATAL( "Cannot get MdtIdHelper" ); + return sc; + } + if (m_debuglevel) ATH_MSG_DEBUG( " Found the MdtIdHelper " ); + + sc = detStore->retrieve(m_cscIdHelper,"CSCIDHELPER"); + if (sc.isFailure()) { + ATH_MSG_FATAL( "Cannot get CscIdHelper" ); + return sc; + } + if (m_debuglevel) ATH_MSG_DEBUG( " Found the CscIdHelper " ); + + sc = detStore->retrieve(m_rpcIdHelper,"RPCIDHELPER"); + if (sc.isFailure()) { + ATH_MSG_FATAL( "Can't retrieve RpcIdHelper" ); + return sc; + } + if (m_debuglevel) ATH_MSG_DEBUG( " Found the RpcIdHelper " ); + + sc = detStore->retrieve(m_tgcIdHelper,"TGCIDHELPER"); + if (sc.isFailure()) { + ATH_MSG_FATAL( "Can't retrieve TgcIdHelper" ); + return sc; + } + if (m_debuglevel) ATH_MSG_DEBUG( " Found the TgcIdHelper " ); + + // Retrieve pull calculator + sc = m_pullCalculator.retrieve(); + if (sc.isFailure()) { + ATH_MSG_FATAL("Can't retrieve " << m_pullCalculator ); + return sc; + } + if (m_debuglevel) ATH_MSG_FATAL(" Found the " << m_pullCalculator ); + + // Retrieve helper tools + sc = m_helperTool.retrieve(); + if (sc.isFailure()){ + ATH_MSG_FATAL("Could not get " << m_helperTool ); + return sc; + } + if (m_debuglevel) ATH_MSG_DEBUG( "Retrieved " << m_helperTool ); + + sc = m_idHelperTool.retrieve(); + if (sc.isFailure()){ + ATH_MSG_FATAL( "Could not get " << m_idHelperTool ); + return sc; + } + if (m_debuglevel) ATH_MSG_DEBUG( "Retrieved " << m_idHelperTool ); + + // Retrieve printer + sc = m_printer.retrieve(); + if (sc.isFailure()){ + ATH_MSG_FATAL( "Could not get " << m_printer ); + return sc; + } + if (m_debuglevel) ATH_MSG_DEBUG( "Retrieved " << m_printer ); + + + // Retrieve histoTool + sc = m_histoTool.retrieve(); + if (sc.isFailure()){ + ATH_MSG_FATAL( "Could not get " << m_histoTool ); + return sc; + } + if (m_debuglevel) ATH_MSG_DEBUG( "Retrieved " << m_histoTool ); + + // Retrieve TrackHistoTool + sc = m_TrackHistoTool.retrieve(); + if (sc.isFailure()){ + ATH_MSG_FATAL( "Could not get " << m_TrackHistoTool ); + return sc; + } + if (m_debuglevel) ATH_MSG_DEBUG( "Retrieved " << m_TrackHistoTool ); + + // Retrieve propagators + sc = m_propagator.retrieve(); + if( sc.isFailure() ){ + ATH_MSG_FATAL( "Could not get " << m_propagator ); + return sc; + } + if (m_debuglevel) ATH_MSG_INFO( "Retrieved " << m_propagator ); + + // Retrieve fitting tool + sc = m_muondqafitfunc.retrieve(); + if (sc.isFailure()){ + ATH_MSG_FATAL( "Could not get " << m_muondqafitfunc ); + return sc; + } + if (m_debuglevel) ATH_MSG_INFO( "Retrieved " << m_muondqafitfunc ); + + return sc; +} + +//--------------------------------------------------------------------------------------- +//StatusCode MuonSegmValidation::bookHistograms( bool isNewEventsBlock, bool isNewLumiBlock, bool isNewRun ) +StatusCode MuonSegmValidation::bookHistogramsRecurrent() +{ + if (m_debuglevel) { + ATH_MSG_DEBUG( "MuonSegmValidation::bookHistograms() to setup tools/services" ); + } + StatusCode sc = StatusCode::SUCCESS; + + if( m_environment == AthenaMonManager::tier0 || m_environment == AthenaMonManager::tier0ESD ) { + + histos_from_tool.push_back(histos_from_tool_Moore); + histos_from_tool.push_back(histos_from_tool_MBoy); + ATH_MSG_DEBUG( "Filled vector with structures histos_from_tool" ); + + for (int j=0;j<(int)m_segmCollectionName.size();j++) { + if ( m_segmCollectionFlag[j] == 0 ) continue; + + std::string m_path_muonsegm = "Muon/MuonSegmentMonitoring"; + + MgmtAttr_t attr = ATTRIB_UNMANAGED; + MonGroup al_muonsegms_shift(this,m_path_muonsegm+"/Global/"+m_segmCollectionName[j],run, attr ); + MonGroup al_muonsegms_debug(this,m_path_muonsegm+"/Global/"+m_segmCollectionName[j],run, attr ); + + MonGroup al_mBAsegms_debug(this,m_path_muonsegm+"/BarrelA/Detail/"+m_segmCollectionName[j],run, attr ); + MonGroup al_mBCsegms_debug(this,m_path_muonsegm+"/BarrelC/Detail/"+m_segmCollectionName[j],run, attr ); + MonGroup al_mEAsegms_debug(this,m_path_muonsegm+"/EndCapA/Detail/"+m_segmCollectionName[j],run, attr ); + MonGroup al_mECsegms_debug(this,m_path_muonsegm+"/EndCapC/Detail/"+m_segmCollectionName[j],run, attr ); + + MonGroup al_mEsegms_debug(this,m_path_muonsegm+"/EndCap/Detail/"+m_segmCollectionName[j],run, attr ); + + MonGroup al_mBAsegms_shift(this,m_path_muonsegm+"/BarrelA/Overview/"+m_segmCollectionName[j],run, attr ); + MonGroup al_mBCsegms_shift(this,m_path_muonsegm+"/BarrelC/Overview/"+m_segmCollectionName[j],run, attr ); + MonGroup al_mEAsegms_shift(this,m_path_muonsegm+"/EndCapA/Overview/"+m_segmCollectionName[j],run, attr ); + MonGroup al_mECsegms_shift(this,m_path_muonsegm+"/EndCapC/Overview/"+m_segmCollectionName[j],run, attr ); + + if(newEventsBlock){} + if(newLumiBlock){} + if(newRun) + { + ATH_MSG_INFO( "Segment Monitoring : begin of run" ); + std::string prefix = ( m_segmCollectionName[j]=="ConvertedMBoySegments" ? "MuBoy_" : "Moore_" ); + + b_status = m_TrackHistoTool->book(histos_from_tool[j],prefix,m_doMDT,m_doRPC,m_doTGC,m_doCSC); + ATH_MSG_INFO( "Booked histos for " << m_segmCollectionName[j] << " with histTool" ); + + // Overview histos + // Pull + mdt2_pulls_BarrelA.push_back(m_histoTool->makeAndRegisterTH2F(al_muonsegms_shift, (prefix+"mdt2_pull_BA").c_str(),"MDT 2D hit pull vs IMO-phi sector, Barrel A",48,1.,49.,100,-10.,10.)); ; + mdt_pulls_BarrelA.push_back(m_histoTool->makeAndRegisterTH1F(al_mBAsegms_shift,(prefix+"mdt_pull_BA").c_str(),"MDT hit pull vs IMO-phi sector, Barrel A",48,1.,49.)); + mdt_pulls_BarrelA.back()->GetXaxis()->SetTitle("[1-16] Sectors 1-16 Inner, [17-32] Sectors 1-16 Middle, [33-48] Sectors 1-16 Outer"); + + mdt2_pulls_BarrelC.push_back(m_histoTool->makeAndRegisterTH2F(al_muonsegms_shift,(prefix+"mdt2_pull_BC").c_str(),"MDT 2D hit pull vs IMO-phi sector, Barrel C",48,1.,49.,100,-10.,10.)); + mdt_pulls_BarrelC.push_back(m_histoTool->makeAndRegisterTH1F(al_mBCsegms_shift,(prefix+"mdt_pull_BC").c_str(),"MDT hit pull vs IMO-phi sector, Barrel C",48,1.,49.)); + mdt_pulls_BarrelC.back()->GetXaxis()->SetTitle("[1-16] Sectors 1-16 Inner, [17-32] Sectors 1-16 Middle, [33-48] Sectors 1-16 Outer"); + + mdt2_pulls_ECA.push_back(m_histoTool->makeAndRegisterTH2F(al_muonsegms_shift,(prefix+"mdt2_pull_ECA").c_str(),"MDT 2D hit pull vs IMO-phi sector, EC A",48,1.,49.,100,-10.,10.)); + mdt_pulls_ECA.push_back(m_histoTool->makeAndRegisterTH1F(al_mEAsegms_shift,(prefix+"mdt_pull_ECA").c_str(),"MDT hit pull vs IMO-phi sector, EC A",48,1.,49.)); + mdt_pulls_ECA.back()->GetXaxis()->SetTitle("[1-16] Sectors 1-16 Inner, [17-32] Sectors 1-16 Middle, [33-48] Sectors 1-16 Outer"); + + mdt2_pulls_ECC.push_back(m_histoTool->makeAndRegisterTH2F(al_muonsegms_shift,(prefix+"mdt2_pull_ECC").c_str(),"MDT 2D hit pull vs IMO-phi sector, EC C",48,1.,49.,100,-10.,10.)); + mdt_pulls_ECC.push_back(m_histoTool->makeAndRegisterTH1F(al_mECsegms_shift,(prefix+"mdt_pull_ECC").c_str(),"MDT hit pull vs IMO-phi sector, EC C",48,1.,49.)); + mdt_pulls_ECC.back()->GetXaxis()->SetTitle("[1-16] Sectors 1-16 Inner, [17-32] Sectors 1-16 Middle, [33-48] Sectors 1-16 Outer"); + + // Nhits/segm + mdt_hits_BarrelA.push_back(new TProfile((prefix+"mdt_hits_BA").c_str(),"MDT hits vs IMO-phi sector, Barrel A",48,1.,49.,0.,90.)); + mdt_hits_BarrelA.back()->GetXaxis()->SetTitle("[1-16] Sectors 1-16 Inner, [17-32] Sectors 1-16 Middle, [33-48] Sectors 1-16 Outer"); + sc=al_mBAsegms_shift.regHist(mdt_hits_BarrelA.back()); + mdt_hits_BarrelC.push_back(new TProfile((prefix+"mdt_hits_BC").c_str(),"MDT hits vs IMO-phi sector, Barrel C",48,1.,49.,0.,90.)); + mdt_hits_BarrelC.back()->GetXaxis()->SetTitle("[1-16] Sectors 1-16 Inner, [17-32] Sectors 1-16 Middle, [33-48] Sectors 1-16 Outer"); + sc=al_mBCsegms_shift.regHist(mdt_hits_BarrelC.back()); + mdt_hits_ECA.push_back(new TProfile((prefix+"mdt_hits_ECA").c_str(),"MDT hits vs IMO-phi sector, EC A",48,1.,49.,0.,90.)); + mdt_hits_ECA.back()->GetXaxis()->SetTitle("[1-16] Sectors 1-16 Inner, [17-32] Sectors 1-16 Middle, [33-48] Sectors 1-16 Outer"); + sc=al_mEAsegms_shift.regHist(mdt_hits_ECA.back()); + mdt_hits_ECC.push_back(new TProfile((prefix+"mdt_hits_ECC").c_str(),"MDT hits vs IMO-phi sector, EC C",48,1.,49.,0.,90.)); + mdt_hits_ECC.back()->GetXaxis()->SetTitle("[1-16] Sectors 1-16 Inner, [17-32] Sectors 1-16 Middle, [33-48] Sectors 1-16 Outer"); + sc=al_mECsegms_shift.regHist(mdt_hits_ECC.back()); + + // chi2/ndof + chi2_BarrelA.push_back(new TProfile((prefix+"chi2_BA").c_str(),"Chi2/ndof vs IMO-phi sector, Barrel A",48,1.,49.,0.,3000.)); + chi2_BarrelA.back()->GetXaxis()->SetTitle("[1-16] Sectors 1-16 Inner, [17-32] Sectors 1-16 Middle, [33-48] Sectors 1-16 Outer"); + sc=al_mBAsegms_shift.regHist(chi2_BarrelA.back()); + chi2_BarrelC.push_back(new TProfile((prefix+"chi2_BC").c_str(),"Chi2/ndof vs IMO-phi sector, Barrel C",48,1.,49.,0.,3000.)); + chi2_BarrelC.back()->GetXaxis()->SetTitle("[1-16] Sectors 1-16 Inner, [17-32] Sectors 1-16 Middle, [33-48] Sectors 1-16 Outer"); + sc=al_mBCsegms_shift.regHist(chi2_BarrelC.back()); + chi2_ECA.push_back(new TProfile((prefix+"chi2_ECA").c_str(),"Chi2/ndof vs IMO-phi sector, EC A",48,1.,49.,0.,3000.)); + chi2_ECA.back()->GetXaxis()->SetTitle("[1-16] Sectors 1-16 Inner, [17-32] Sectors 1-16 Middle, [33-48] Sectors 1-16 Outer"); + sc=al_mEAsegms_shift.regHist(chi2_ECA.back()); + chi2_ECC.push_back(new TProfile((prefix+"chi2_ECC").c_str(),"Chi2/ndof vs IMO-phi sector, EC C",48,1.,49.,0.,3000.)); + chi2_ECC.back()->GetXaxis()->SetTitle("[1-16] Sectors 1-16 Inner, [17-32] Sectors 1-16 Middle, [33-48] Sectors 1-16 Outer"); + sc=al_mECsegms_shift.regHist(chi2_ECC.back()); + + // Nsegm + nsegm_BarrelA.push_back(m_histoTool->makeAndRegisterTH1F(al_mBAsegms_shift,(prefix+"nsegm_BA").c_str(),"Number of segments vs IMO-phi sector, Barrel A",48,1.,49.)); + nsegm_BarrelA.back()->GetXaxis()->SetTitle("[1-16] Sectors 1-16 Inner, [17-32] Sectors 1-16 Middle, [33-48] Sectors 1-16 Outer"); + + nsegm_BarrelC.push_back(m_histoTool->makeAndRegisterTH1F(al_mBCsegms_shift,(prefix+"nsegm_BC").c_str(),"Number of segments vs IMO-phi sector, Barrel C",48,1.,49.)); + nsegm_BarrelC.back()->GetXaxis()->SetTitle("[1-16] Sectors 1-16 Inner, [17-32] Sectors 1-16 Middle, [33-48] Sectors 1-16 Outer"); + + nsegm_ECA.push_back(m_histoTool->makeAndRegisterTH1F(al_mEAsegms_shift,(prefix+"nsegm_ECA").c_str(),"Number of segments vs IMO-phi sector, EC A",48,1.,49.)); + nsegm_ECA.back()->GetXaxis()->SetTitle("[1-16] Sectors 1-16 Inner, [17-32] Sectors 1-16 Middle, [33-48] Sectors 1-16 Outer"); + + nsegm_ECC.push_back(m_histoTool->makeAndRegisterTH1F(al_mECsegms_shift,(prefix+"nsegm_ECC").c_str(),"Number of segments vs IMO-phi sector, EC C",48,1.,49.)); + nsegm_ECC.back()->GetXaxis()->SetTitle("[1-16] Sectors 1-16 Inner, [17-32] Sectors 1-16 Middle, [33-48] Sectors 1-16 Outer"); + + ATH_MSG_DEBUG( "Booked Overview histos for " << m_segmCollectionName[j] ); + + // numbers of segments/hits... + // Delete histos irrelevant for segments, that HistTool books automatically - hack... + if ( m_segmCollectionName[j] == "ConvertedMBoySegments" ) + { + if ( histos_from_tool[j].hitHistos.countHistos.netaTrig ) + { histos_from_tool[j].hitHistos.countHistos.netaTrig->Delete(); + histos_from_tool[j].hitHistos.countHistos.netaTrig = 0; } + if ( histos_from_tool[j].hitHistos.countHistos.netaTrigCh ) + { histos_from_tool[j].hitHistos.countHistos.netaTrigCh->Delete(); + histos_from_tool[j].hitHistos.countHistos.netaTrigCh = 0; } + + if ( histos_from_tool[j].hitHistos.countHistos.rpcs.neta ) + { histos_from_tool[j].hitHistos.countHistos.rpcs.neta->Delete(); + histos_from_tool[j].hitHistos.countHistos.rpcs.neta = 0; } + if ( histos_from_tool[j].hitHistos.countHistos.rpcs.netaCh ) + { histos_from_tool[j].hitHistos.countHistos.rpcs.netaCh->Delete(); + histos_from_tool[j].hitHistos.countHistos.rpcs.netaCh = 0; } + if ( histos_from_tool[j].hitHistos.countHistos.tgcs.neta ) + { histos_from_tool[j].hitHistos.countHistos.tgcs.neta->Delete(); + histos_from_tool[j].hitHistos.countHistos.tgcs.neta = 0; } + if ( histos_from_tool[j].hitHistos.countHistos.tgcs.netaCh ) + { histos_from_tool[j].hitHistos.countHistos.tgcs.netaCh->Delete(); + histos_from_tool[j].hitHistos.countHistos.tgcs.netaCh = 0; } + } + + m_num_segms.push_back(new TH1F((prefix+"n_segms").c_str(),"Number of segments per event", 30,-0.,30.)); + sc=al_muonsegms_shift.regHist(m_num_segms.back()); + + m_num_hits_per_segmvsphi.push_back(new TH2F((prefix+"n_hits_per_segm_vs_phi").c_str(),"Number of hits per segment vs phi", 40,-4.,4., 50,0.,50.)); + sc=al_muonsegms_debug.regHist(m_num_hits_per_segmvsphi.back()); + + m_num_hits_per_segm_vs_station.push_back(new TH2F((prefix+"n_hits_per_segm_vs_station").c_str(),"Number of hits per segment vs station",32,0.,32.,50,0.,50.)); + sc=al_muonsegms_debug.regHist(m_num_hits_per_segm_vs_station.back()); + + ATH_MSG_DEBUG( "Booked number of hit histos for " << m_segmCollectionName[j] ); + + // Segment fit + coordinates + // Delete histos irrelevant for segments, that HistTool books automatically - hack... + if ( histos_from_tool[j].pt ) + { histos_from_tool[j].pt->Delete(); + histos_from_tool[j].pt = 0; } + if ( histos_from_tool[j].momentum ) + { histos_from_tool[j].momentum->Delete(); + histos_from_tool[j].momentum = 0; } + + chi2_vs_station.push_back(new TH2F((prefix+"chi2_vs_station").c_str(),"Chi2 vs station",32,0.,32.,600,0.,300.)); + sc=al_muonsegms_debug.regHist(chi2_vs_station.back()); + + m_segm_etavsphi.push_back(new TH2F((prefix+"segm_eta_vs_phi").c_str(),"Segment eta vs phi", 40,-4.,4., 40,-4.,4.)); + sc=al_muonsegms_debug.regHist(m_segm_etavsphi.back()); + + m_segm_eta_vs_phi.push_back(new TH2F((prefix+"segm_station_eta_vs_phi").c_str(),"Segment station eta vs phi", 16,1.,17.,31,-15.,15.)); + sc=al_muonsegms_debug.regHist(m_segm_eta_vs_phi.back()); + m_segm_eta_vs_phiInner.push_back(new TH2F((prefix+"segm_station_eta_vs_phiInner").c_str(),"Segment station eta vs phi Inner", 16,1.,17.,31,-15.,15.)); + sc=al_muonsegms_shift.regHist(m_segm_eta_vs_phiInner.back()); + m_segm_eta_vs_phiMiddle.push_back(new TH2F((prefix+"segm_station_eta_vs_phiMiddle").c_str(),"Segment station eta vs phi Middle", 16,1.,17.,31,-15.,15.)); + sc=al_muonsegms_shift.regHist(m_segm_eta_vs_phiMiddle.back()); + m_segm_eta_vs_phiOuter.push_back(new TH2F((prefix+"segm_station_eta_vs_phiOuter").c_str(),"Segment station eta vs phi Outer", 16,1.,17.,31,-15.,15.)); + sc=al_muonsegms_shift.regHist(m_segm_eta_vs_phiOuter.back()); + + + /* m_Miss_segm_eta_vs_phi.push_back(new TH2F("Miss_segm_station_eta_vs_phi","Missed segment station eta vs phi", 16,1.,17.,31,-15.,15.)); + sc=al_muonsegms_shift.regHist(m_Miss_segm_eta_vs_phi.back()); + m_Miss_segm_eta_vs_phiInner.push_back(new TH2F("Miss_segm_station_eta_vs_phiInner","Missed segment station eta vs phi Inner", 16,1.,17.,31,-15.,15.)); + sc=al_muonsegms_shift.regHist(m_Miss_segm_eta_vs_phiInner.back()); + m_Miss_segm_eta_vs_phiMiddle.push_back(new TH2F("Miss_segm_station_eta_vs_phiMiddle","Missed segment station eta vs phi Middle", 16,1.,17.,31,-15.,15.)); + sc=al_muonsegms_shift.regHist(m_Miss_segm_eta_vs_phiMiddle.back()); + m_Miss_segm_eta_vs_phiOuter.push_back(new TH2F("Miss_segm_station_eta_vs_phiOuter","Missed segment station eta vs phi Outer", 16,1.,17.,31,-15.,15.)); + sc=al_muonsegms_shift.regHist(m_Miss_segm_eta_vs_phiOuter.back()); + + m_Expect_segm_eta_vs_phi.push_back(new TH2F("Expect_segm_station_eta_vs_phi","Expected segment station eta vs phi", 16,1.,17.,31,-15.,15.)); + sc=al_muonsegms_shift.regHist(m_Expect_segm_eta_vs_phi.back()); + m_Expect_segm_eta_vs_phiInner.push_back(new TH2F("Expect_segm_station_eta_vs_phiInner","Expected segment station eta vs phi Inner", 16,1.,17.,31,-15.,15.)); + sc=al_muonsegms_shift.regHist(m_Expect_segm_eta_vs_phiInner.back()); + m_Expect_segm_eta_vs_phiMiddle.push_back(new TH2F("Expect_segm_station_eta_vs_phiMiddle","Expected segment station eta vs phi Middle", 16,1.,17.,31,-15.,15.)); + sc=al_muonsegms_shift.regHist(m_Expect_segm_eta_vs_phiMiddle.back()); + m_Expect_segm_eta_vs_phiOuter.push_back(new TH2F("Expect_segm_station_eta_vs_phiOuter","Expected segment station eta vs phi Outer", 16,1.,17.,31,-15.,15.)); + sc=al_muonsegms_shift.regHist(m_Expect_segm_eta_vs_phiOuter.back()); */ + + ATH_MSG_DEBUG( "Booked segment fit and coordinate histos for " << m_segmCollectionName[j] ); + + // Hit Residuals + pulls + // Delete histos irrelevant for segments, that HistTool books automatically - hack... + ATH_MSG_DEBUG( "deleting histos for " << m_segmCollectionName[j] ); + + if ( histos_from_tool[j].hitHistos.residualHistos.all.error ) + { histos_from_tool[j].hitHistos.residualHistos.all.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.all.error = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.all.lposX ) + { histos_from_tool[j].hitHistos.residualHistos.all.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.all.lposX = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.all.lposY ) + { histos_from_tool[j].hitHistos.residualHistos.all.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.all.lposY = 0; } + + if ( histos_from_tool[j].hitHistos.residualHistos.mdts.resProf ) + { histos_from_tool[j].hitHistos.residualHistos.mdts.resProf->Delete(); + histos_from_tool[j].hitHistos.residualHistos.mdts.resProf = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.mdtsBarrelA.resProf ) + { histos_from_tool[j].hitHistos.residualHistos.mdtsBarrelA.resProf->Delete(); + histos_from_tool[j].hitHistos.residualHistos.mdtsBarrelA.resProf = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.mdtsBarrelC.resProf ) + { histos_from_tool[j].hitHistos.residualHistos.mdtsBarrelC.resProf->Delete(); + histos_from_tool[j].hitHistos.residualHistos.mdtsBarrelC.resProf = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.mdtsECA.resProf ) + { histos_from_tool[j].hitHistos.residualHistos.mdtsECA.resProf->Delete(); + histos_from_tool[j].hitHistos.residualHistos.mdtsECA.resProf = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.mdtsECC.resProf ) + { histos_from_tool[j].hitHistos.residualHistos.mdtsECC.resProf->Delete(); + histos_from_tool[j].hitHistos.residualHistos.mdtsECC.resProf = 0; } + + if ( histos_from_tool[j].hitHistos.residualHistos.mdts.pullProf ) + { histos_from_tool[j].hitHistos.residualHistos.mdts.pullProf->Delete(); + histos_from_tool[j].hitHistos.residualHistos.mdts.pullProf = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.mdtsBarrelA.pullProf ) + { histos_from_tool[j].hitHistos.residualHistos.mdtsBarrelA.pullProf->Delete(); + histos_from_tool[j].hitHistos.residualHistos.mdtsBarrelA.pullProf = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.mdtsBarrelC.pullProf ) + { histos_from_tool[j].hitHistos.residualHistos.mdtsBarrelC.pullProf->Delete(); + histos_from_tool[j].hitHistos.residualHistos.mdtsBarrelC.pullProf = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.mdtsECA.pullProf ) + { histos_from_tool[j].hitHistos.residualHistos.mdtsECA.pullProf->Delete(); + histos_from_tool[j].hitHistos.residualHistos.mdtsECA.pullProf = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.mdtsECC.pullProf ) + { histos_from_tool[j].hitHistos.residualHistos.mdtsECC.pullProf->Delete(); + histos_from_tool[j].hitHistos.residualHistos.mdtsECC.pullProf = 0; } + + if ( histos_from_tool[j].hitHistos.countHistos.mdts.nmdtProf ) + { histos_from_tool[j].hitHistos.countHistos.mdts.nmdtProf->Delete(); + histos_from_tool[j].hitHistos.countHistos.mdts.nmdtProf = 0; } + if ( histos_from_tool[j].hitHistos.countHistos.mdtsBarrelA.nmdtProf ) + { histos_from_tool[j].hitHistos.countHistos.mdtsBarrelA.nmdtProf->Delete(); + histos_from_tool[j].hitHistos.countHistos.mdtsBarrelA.nmdtProf = 0; } + if ( histos_from_tool[j].hitHistos.countHistos.mdtsBarrelC.nmdtProf ) + { histos_from_tool[j].hitHistos.countHistos.mdtsBarrelC.nmdtProf->Delete(); + histos_from_tool[j].hitHistos.countHistos.mdtsBarrelC.nmdtProf = 0; } + if ( histos_from_tool[j].hitHistos.countHistos.mdtsECA.nmdtProf ) + { histos_from_tool[j].hitHistos.countHistos.mdtsECA.nmdtProf->Delete(); + histos_from_tool[j].hitHistos.countHistos.mdtsECA.nmdtProf = 0; } + if ( histos_from_tool[j].hitHistos.countHistos.mdtsECC.nmdtProf ) + { histos_from_tool[j].hitHistos.countHistos.mdtsECC.nmdtProf->Delete(); + histos_from_tool[j].hitHistos.countHistos.mdtsECC.nmdtProf = 0; } + + if ( histos_from_tool[j].hitHistos.countHistos.mdts.nsegm ) + { histos_from_tool[j].hitHistos.countHistos.mdts.nsegm->Delete(); + histos_from_tool[j].hitHistos.countHistos.mdts.nsegm = 0; } + if ( histos_from_tool[j].hitHistos.countHistos.mdtsBarrelA.nsegm ) + { histos_from_tool[j].hitHistos.countHistos.mdtsBarrelA.nsegm->Delete(); + histos_from_tool[j].hitHistos.countHistos.mdtsBarrelA.nsegm = 0; } + if ( histos_from_tool[j].hitHistos.countHistos.mdtsBarrelC.nsegm ) + { histos_from_tool[j].hitHistos.countHistos.mdtsBarrelC.nsegm->Delete(); + histos_from_tool[j].hitHistos.countHistos.mdtsBarrelC.nsegm = 0; } + if ( histos_from_tool[j].hitHistos.countHistos.mdtsECA.nsegm ) + { histos_from_tool[j].hitHistos.countHistos.mdtsECA.nsegm->Delete(); + histos_from_tool[j].hitHistos.countHistos.mdtsECA.nsegm = 0; } + if ( histos_from_tool[j].hitHistos.countHistos.mdtsECC.nsegm ) + { histos_from_tool[j].hitHistos.countHistos.mdtsECC.nsegm->Delete(); + histos_from_tool[j].hitHistos.countHistos.mdtsECC.nsegm = 0; } + + if ( histos_from_tool[j].hitHistos.countHistos.mdts.chi2Prof ) + { histos_from_tool[j].hitHistos.countHistos.mdts.chi2Prof->Delete(); + histos_from_tool[j].hitHistos.countHistos.mdts.chi2Prof = 0; } + if ( histos_from_tool[j].hitHistos.countHistos.mdtsBarrelA.chi2Prof ) + { histos_from_tool[j].hitHistos.countHistos.mdtsBarrelA.chi2Prof->Delete(); + histos_from_tool[j].hitHistos.countHistos.mdtsBarrelA.chi2Prof = 0; } + if ( histos_from_tool[j].hitHistos.countHistos.mdtsBarrelC.chi2Prof ) + { histos_from_tool[j].hitHistos.countHistos.mdtsBarrelC.chi2Prof->Delete(); + histos_from_tool[j].hitHistos.countHistos.mdtsBarrelC.chi2Prof = 0; } + if ( histos_from_tool[j].hitHistos.countHistos.mdtsECA.chi2Prof ) + { histos_from_tool[j].hitHistos.countHistos.mdtsECA.chi2Prof->Delete(); + histos_from_tool[j].hitHistos.countHistos.mdtsECA.chi2Prof = 0; } + if ( histos_from_tool[j].hitHistos.countHistos.mdtsECC.chi2Prof ) + { histos_from_tool[j].hitHistos.countHistos.mdtsECC.chi2Prof->Delete(); + histos_from_tool[j].hitHistos.countHistos.mdtsECC.chi2Prof = 0; } + + + if ( m_segmCollectionName[j] == "ConvertedMBoySegments" ) + { + ATH_MSG_DEBUG( "deleting histos specifically for muonboy" ); + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEta.res ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEta.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEta.res = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEta.pull ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEta.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEta.pull = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEta.error ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEta.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEta.error = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEta.lposX ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEta.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEta.lposX = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEta.lposY ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEta.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEta.lposY = 0; } + + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA.res ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA.res = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA.pull ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA.pull = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA.error ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA.error = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA.lposX ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA.lposX = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA.lposY ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA.lposY = 0; } + + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC.res ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC.res = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC.pull ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC.pull = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC.error ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC.error = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC.lposX ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC.lposX = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC.lposY ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC.lposY = 0; } + + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA1.res ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA1.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA1.res = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA1.pull ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA1.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA1.pull = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA1.error ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA1.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA1.error = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA1.lposX ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA1.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA1.lposX = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA1.lposY ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA1.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA1.lposY = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA2.res ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA2.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA2.res = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA2.pull ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA2.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA2.pull = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA2.error ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA2.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA2.error = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA2.lposX ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA2.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA2.lposX = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA2.lposY ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA2.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA2.lposY = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA3.res ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA3.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA3.res = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA3.pull ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA3.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA3.pull = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA3.error ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA3.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA3.error = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA3.lposX ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA3.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA3.lposX = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA3.lposY ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA3.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA3.lposY = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA4.res ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA4.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA4.res = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA4.pull ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA4.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA4.pull = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA4.error ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA4.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA4.error = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA4.lposX ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA4.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA4.lposX = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA4.lposY ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA4.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA4.lposY = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA5.res ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA5.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA5.res = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA5.pull ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA5.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA5.pull = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA5.error ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA5.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA5.error = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA5.lposX ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA5.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA5.lposX = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA5.lposY ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA5.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA5.lposY = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA6.res ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA6.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA6.res = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA6.pull ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA6.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA6.pull = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA6.error ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA6.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA6.error = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA6.lposX ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA6.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA6.lposX = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA6.lposY ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA6.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA6.lposY = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA7.res ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA7.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA7.res = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA7.pull ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA7.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA7.pull = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA7.error ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA7.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA7.error = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA7.lposX ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA7.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA7.lposX = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA7.lposY ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA7.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA7.lposY = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA8.res ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA8.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA8.res = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA8.pull ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA8.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA8.pull = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA8.error ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA8.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA8.error = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA8.lposX ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA8.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA8.lposX = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA8.lposY ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA8.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaA8.lposY = 0; } + + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC1.res ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC1.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC1.res = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC1.pull ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC1.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC1.pull = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC1.error ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC1.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC1.error = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC1.lposX ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC1.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC1.lposX = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC1.lposY ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC1.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC1.lposY = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC2.res ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC2.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC2.res = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC2.pull ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC2.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC2.pull = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC2.error ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC2.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC2.error = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC2.lposX ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC2.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC2.lposX = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC2.lposY ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC2.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC2.lposY = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC3.res ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC3.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC3.res = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC3.pull ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC3.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC3.pull = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC3.error ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC3.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC3.error = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC3.lposX ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC3.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC3.lposX = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC3.lposY ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC3.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC3.lposY = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC4.res ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC4.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC4.res = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC4.pull ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC4.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC4.pull = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC4.error ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC4.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC4.error = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC4.lposX ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC4.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC4.lposX = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC4.lposY ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC4.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC4.lposY = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC5.res ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC5.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC5.res = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC5.pull ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC5.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC5.pull = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC5.error ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC5.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC5.error = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC5.lposX ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC5.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC5.lposX = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC5.lposY ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC5.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC5.lposY = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC6.res ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC6.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC6.res = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC6.pull ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC6.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC6.pull = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC6.error ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC6.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC6.error = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC6.lposX ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC6.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC6.lposX = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC6.lposY ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC6.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC6.lposY = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC7.res ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC7.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC7.res = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC7.pull ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC7.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC7.pull = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC7.error ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC7.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC7.error = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC7.lposX ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC7.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC7.lposX = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC7.lposY ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC7.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC7.lposY = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC8.res ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC8.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC8.res = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC8.pull ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC8.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC8.pull = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC8.error ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC8.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC8.error = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC8.lposX ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC8.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC8.lposX = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC8.lposY ) + { histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC8.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.rpcsEtaC8.lposY = 0; } + + if ( histos_from_tool[j].hitHistos.residualHistos.tgcsEta.res ) + { histos_from_tool[j].hitHistos.residualHistos.tgcsEta.res->Delete(); + histos_from_tool[j].hitHistos.residualHistos.tgcsEta.res = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.tgcsEta.pull ) + { histos_from_tool[j].hitHistos.residualHistos.tgcsEta.pull->Delete(); + histos_from_tool[j].hitHistos.residualHistos.tgcsEta.pull = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.tgcsEta.error ) + { histos_from_tool[j].hitHistos.residualHistos.tgcsEta.error->Delete(); + histos_from_tool[j].hitHistos.residualHistos.tgcsEta.error = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.tgcsEta.lposX ) + { histos_from_tool[j].hitHistos.residualHistos.tgcsEta.lposX->Delete(); + histos_from_tool[j].hitHistos.residualHistos.tgcsEta.lposX = 0; } + if ( histos_from_tool[j].hitHistos.residualHistos.tgcsEta.lposY ) + { histos_from_tool[j].hitHistos.residualHistos.tgcsEta.lposY->Delete(); + histos_from_tool[j].hitHistos.residualHistos.tgcsEta.lposY = 0; } + ATH_MSG_DEBUG( "deleted histos specifically for muonboy" ); + } + + + + //histos_from_tool[j].hitHistos.residualHistos.mdts.error->Delete(); + + //histos_from_tool[j].hitHistos.residualHistos.cscsEta.error->Delete(); + + //histos_from_tool[j].hitHistos.residualHistos.cscsPhi.error->Delete(); + + //histos_from_tool[j].hitHistos.residualHistos.rpcsEta.error->Delete(); + + //histos_from_tool[j].hitHistos.residualHistos.rpcsPhi.error->Delete(); + + //histos_from_tool[j].hitHistos.residualHistos.tgcsEta.error->Delete(); + + //histos_from_tool[j].hitHistos.residualHistos.tgcsPhi.error->Delete(); + + //histos_from_tool[j].hitHistos.residualHistos.mdts.error = 0; + + //histos_from_tool[j].hitHistos.residualHistos.cscsEta.error = 0; + + //histos_from_tool[j].hitHistos.residualHistos.cscsPhi.error = 0; + + //histos_from_tool[j].hitHistos.residualHistos.rpcsEta.error = 0; + + //histos_from_tool[j].hitHistos.residualHistos.rpcsPhi.error = 0; + + //histos_from_tool[j].hitHistos.residualHistos.tgcsEta.error = 0; + + //histos_from_tool[j].hitHistos.residualHistos.tgcsPhi.error = 0; + + + if (m_debuglevel) ATH_MSG_DEBUG( "Booked residual histos for " << m_segmCollectionName[j] ); + + // b_status = m_TrackHistoTool->registerHist(al_muonsegms_shift,al_muonsegms_debug,al_muonSelBsegms_debug,al_muonSelEAsegms_debug,al_muonSelECsegms_debug,histos_from_tool[j]); + b_status = m_TrackHistoTool->registerHist(al_muonsegms_shift,al_muonsegms_debug,al_mBAsegms_debug,al_mBCsegms_debug,al_mEsegms_debug,al_mEAsegms_debug,al_mECsegms_debug,histos_from_tool[j]); + if (m_debuglevel) ATH_MSG_DEBUG("Finished booking histos for " << m_segmCollectionName[j] ); + + + } // if NewRun + + + } // loop over Muon Segm collections + + } // environment if + return sc; + +} +//--------------------------------------------------------------------------------------- +StatusCode MuonSegmValidation::fillHistograms() +{ + StatusCode sc = StatusCode::SUCCESS; + ATH_MSG_DEBUG( "******************************************************************************" ); + ATH_MSG_DEBUG( " INSIDE fillHistograms() " ); + ATH_MSG_DEBUG( "******************************************************************************" ); + + if( m_environment == AthenaMonManager::tier0 || m_environment == AthenaMonManager::tier0ESD ) { + + // Set the event counter + m_eventNumber = m_eventCounter; + + bool got_coll = false; + int h_index = -1; + for (int j=0;j<(int)m_segmCollectionName.size();++j) { + + if (m_debuglevel) ATH_MSG_DEBUG( "Segm collection FLAG is " << m_segmCollectionFlag[j] ); + + if ( m_segmCollectionFlag[j] == 0 ) continue; + ++h_index; + + //Get segms from SG + sc = m_storeGate->retrieve(m_segms, m_segmCollectionName[j]); + + if (m_debuglevel) ATH_MSG_DEBUG( "Segm collection Name is " << m_segmCollectionName[j] ); + + if ( sc.isFailure() ){ + if ( (j == (int)m_segmCollectionName.size()-1) && !got_coll ){ + ATH_MSG_DEBUG( "Unable to retrieve reconstructed segms from any collection... Exiting!" ); + return StatusCode::FAILURE; } + else { + ATH_MSG_DEBUG( "Unable to retrieve reconstructed segms from collection... Trying next..." ); + + continue; } + }else{ + if (m_debuglevel){ ATH_MSG_DEBUG( "Segms in StoreGate found"); + ATH_MSG_DEBUG( "Segm collection Name is " << m_segmCollectionName[j] );} + got_coll = true; + } + + if ( m_segms->empty() ){ + if (m_debuglevel){ + ATH_MSG_DEBUG( "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"); + ATH_MSG_DEBUG( " Segm Collection is Empty. Trying next... "); + ATH_MSG_DEBUG( "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"); + } + continue; + } + + if (m_num_segms[h_index]) m_num_segms[h_index]->Fill(m_segms->size()); + if (m_debuglevel){ + ATH_MSG_DEBUG( "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"); + ATH_MSG_DEBUG( " Segm Collection size " ); + ATH_MSG_DEBUG( "Number of segms found: " << m_segms->size() ); + ATH_MSG_DEBUG( "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"); + } + + if ( m_segms->size() > 0 ){ + ATH_MSG_DEBUG( "********************************* WARNING ************************************" ); + ATH_MSG_DEBUG( "Number of segms in event is: " << m_segms->size() ); + ATH_MSG_DEBUG( "This algorithm is designed to operate for single segm / event only" ); + ATH_MSG_DEBUG( "Processing only the first segm in the segm collection" ); + ATH_MSG_DEBUG( "******************************************************************************" ); + } + + + //Loop over segms + for (Trk::SegmentCollection::const_iterator s = m_segms->begin();s != m_segms->end(); ++s) { + // Get segm + Muon::MuonSegment *segm=dynamic_cast<Muon::MuonSegment*>(*s); + if (segm == 0) { + ATH_MSG_ERROR( "no pointer to segm!!!" ); + break; + } + + // check technology and skip segment if wanted + bool skipSegm = false; + for(unsigned int i =0; i < segm->numberOfContainedROTs(); ++i) { + const Trk::RIO_OnTrack* rio = segm->rioOnTrack(i); + Identifier id = rio->identify(); + if ( (!m_doMDT&&m_idHelperTool->isMdt(id)) || (!m_doRPC&&m_idHelperTool->isRpc(id)) || (!m_doTGC&&m_idHelperTool->isTgc(id)) || (!m_doCSC&&m_idHelperTool->isCsc(id)) ) + { + skipSegm = true; + break; + } + } + if (skipSegm) continue; + + // Fill histos with tool + b_status = m_TrackHistoTool->fill(histos_from_tool[j],*segm); + + // Get segm parameters + const std::vector<const Trk::MeasurementBase*> meas = segm->containedMeasurements(); + const Trk::AtaPlane* segPars = m_helperTool->createTrackParameters(*segm,10000.,0.); // segm,momentum,charge + if( !segPars ) return false; + const Trk::FitQuality* fq = segm->fitQuality(); + ATH_MSG_DEBUG( "MuonSegment chi2, ndof " << (float)segm->fitQuality()->chiSquared() + << "/" << (int)segm->fitQuality()->numberDoF() ); + + + const Amg::Vector3D& globalPos = segm->globalPosition(); + //const Amg::Vector3D direction = segm->globalDirection(); + if (m_num_hits_per_segmvsphi[h_index]) m_num_hits_per_segmvsphi[h_index]->Fill(globalPos.phi(),(float)meas.size()); + + // Chamber name stuff. Take info from first hit. + int PhiStation=0, EtaStation=0; + bool isInner=false, isMiddle=false, isOuter=false, isSideA=false; + int chamberIndex=0; + + if (meas.size()>0) + { + const Trk::MeasurementBase* rio = meas[0]; + Identifier id = m_helperTool->getIdentifier(*rio); + std::string name; + if (m_idHelperTool->isMdt(id)) + { + int imdtstationPhi = int(m_mdtIdHelper->stationPhi(id)); + int imdtstationEta = int(m_mdtIdHelper->stationEta(id)); + int imdtstationName = int(m_mdtIdHelper->stationName(id)); + bool mdtIsLarge = !( m_idHelperTool->isSmallChamber(id)); + std::string type="MDT"; + std::string hardware_name = convertChamberName(imdtstationName,imdtstationEta,imdtstationPhi,type); + if ( strlen(hardware_name.c_str())<3 ) continue; + + isInner = hardware_name[1]=='I'; + isMiddle = hardware_name[1]=='M'; + isOuter = hardware_name[1]=='O'; + isSideA = imdtstationEta>0; + if (!m_idHelperTool->isEndcap(id)) { name = "Barrel_"; } + else { name = "EC_";} + if (imdtstationEta>0) { name = name+"A_"; } + else { name = name+"C_"; } + if (hardware_name[2]!='S' && hardware_name[2]!='L') { name = name+"Special"; } + else { + if (isInner) { name = name+"Inner_"; } + else if (isMiddle) { name = name+"Middle_"; } + else if (isOuter) { name = name+"Outer_"; } + if (hardware_name[2]=='S') { name = name+"Short"; } + else if (hardware_name[2]=='L') { name = name+"Long"; } + } + if (mdtIsLarge) { PhiStation = imdtstationPhi*2-1; } + else { PhiStation = imdtstationPhi*2; } + if (!(m_mdtIdHelper->isEndcap(id))) { EtaStation = imdtstationEta; } + else { EtaStation = ( imdtstationEta>0 ? imdtstationEta+8 : imdtstationEta-8 ); } + // Fill overview histos + if (isInner) chamberIndex=abs(PhiStation); + if (isMiddle) chamberIndex=16+abs(PhiStation); + if (isOuter) chamberIndex=32+abs(PhiStation); + if (!m_idHelperTool->isEndcap(id)) // Barrel + { + if (isSideA) // side A + { + nsegm_BarrelA[h_index]->Fill((float)chamberIndex); + mdt_hits_BarrelA[h_index]->Fill((float)chamberIndex,(float)meas.size()); + chi2_BarrelA[h_index]->Fill((float)chamberIndex,fq->chiSquared()); + } + else + { + nsegm_BarrelC[h_index]->Fill((float)chamberIndex); + mdt_hits_BarrelC[h_index]->Fill((float)chamberIndex,(float)meas.size()); + chi2_BarrelC[h_index]->Fill((float)chamberIndex,fq->chiSquared()); + } + } + else // EC + { + if (isSideA) // side A + { + nsegm_ECA[h_index]->Fill((float)chamberIndex); + mdt_hits_ECA[h_index]->Fill((float)chamberIndex,(float)meas.size()); + chi2_ECA[h_index]->Fill((float)chamberIndex,fq->chiSquared()); + } + else + { + nsegm_ECC[h_index]->Fill((float)chamberIndex); + mdt_hits_ECC[h_index]->Fill((float)chamberIndex,(float)meas.size()); + chi2_ECC[h_index]->Fill((float)chamberIndex,fq->chiSquared()); + } + } + } + else if (m_idHelperTool->isCsc(id)) + { + int icscstationPhi = int(m_cscIdHelper->stationPhi(id)); + int icscstationEta = int(m_cscIdHelper->stationEta(id)); + bool cscIsLarge = !( m_idHelperTool->isSmallChamber(id)); + if (cscIsLarge) { name = "BigWheel_"; } + else { name = "SmallWheel_"; } + if (icscstationEta>0) { name = name+"A"; } + else { name = name+"C"; } + if (cscIsLarge) { PhiStation = icscstationPhi*2-1; } + else { PhiStation = icscstationPhi*2; } + EtaStation = ( icscstationEta>0 ? icscstationEta+14 : icscstationEta-14 ); + } + + if (m_num_hits_per_segm_vs_station[h_index]) m_num_hits_per_segm_vs_station[h_index]->Fill(name.c_str(),(float)meas.size(),1); + if (m_segm_eta_vs_phi[h_index]) m_segm_eta_vs_phi[h_index]->Fill((float)PhiStation,(float)EtaStation); + if (isInner) if (m_segm_eta_vs_phiInner[h_index]) m_segm_eta_vs_phiInner[h_index]->Fill((float)PhiStation,(float)EtaStation); + if (isMiddle) if (m_segm_eta_vs_phiMiddle[h_index]) m_segm_eta_vs_phiMiddle[h_index]->Fill((float)PhiStation,(float)EtaStation); + if (isOuter) if (m_segm_eta_vs_phiOuter[h_index]) m_segm_eta_vs_phiOuter[h_index]->Fill((float)PhiStation,(float)EtaStation); + + if (chi2_vs_station[h_index]) chi2_vs_station[h_index]->Fill(name.c_str(),fq->chiSquared(),1); + } + if (m_segm_etavsphi[h_index]) m_segm_etavsphi[h_index]->Fill(globalPos.phi(),globalPos.eta()); + + // Fill profile histos + const Trk::TrackParameters* pars; + const Trk::ResidualPull* resPull; + + for (unsigned int i=0; i<meas.size(); ++i) { + const Trk::MeasurementBase* rio = meas[i]; + Identifier id = m_helperTool->getIdentifier(*rio); + + if (m_idHelperTool->isMdt(id)) + { + Trk::MagneticFieldProperties magProps; + pars = m_propagator->propagate(*segPars,rio->associatedSurface(),Trk::anyDirection,false,magProps); + resPull = m_pullCalculator->residualPull(rio, pars, Trk::ResidualPull::Unbiased); + float pull = resPull ? resPull->pull().front() : -9999; + delete pars; pars = 0; + delete resPull; resPull = 0; + + // Fill overview histos + if (!m_idHelperTool->isEndcap(id)) // Barrel + { + if (isSideA) // side A + { + if(static_cast<int>(mdt2_pulls_BarrelA.size())>h_index && mdt2_pulls_BarrelA[h_index]) { + mdt2_pulls_BarrelA[h_index]->Fill((float)chamberIndex,pull); + } + } + else + { + if(static_cast<int>(mdt2_pulls_BarrelC.size())>h_index && mdt2_pulls_BarrelC[h_index]) { + mdt2_pulls_BarrelC[h_index]->Fill((float)chamberIndex,pull); + } + } + } + else // EC + { + if (isSideA) // side A + { + if(static_cast<int>(mdt2_pulls_ECA.size())>h_index && mdt2_pulls_ECA[h_index]) { + mdt2_pulls_ECA[h_index]->Fill((float)chamberIndex,pull); + } + } + else + { + if(static_cast<int>(mdt2_pulls_ECC.size())>h_index && mdt2_pulls_ECC[h_index]) { + mdt2_pulls_ECC[h_index]->Fill((float)chamberIndex,pull); + } + } + } + } // if MDT + + + } // ROT loop + + + delete segPars; + } // loop over segms + } // loop over collections + + ++m_eventCounter; + if (m_debuglevel) ATH_MSG_DEBUG( "Number of events : "<< m_eventCounter ); + + } // environment if + + if (m_debuglevel) ATH_MSG_DEBUG( "MuonSegmValidation::Finalisation of " << name() << " was successful" ); + + return sc; +} + +//--------------------------------------------------------------------------------------- +StatusCode MuonSegmValidation::procHistograms() +{ + if( m_environment == AthenaMonManager::tier0 || m_environment == AthenaMonManager::tier0ESD ) { + + if (m_debuglevel) ATH_MSG_DEBUG( "MuonSegmMonitoring procHistograms()" ); + if(endOfEventsBlock){} + if(endOfLumiBlock){} + if(endOfRun){ + + int h_index = -1; + for (int i=0;i<(int)m_segmCollectionName.size();i++) + { + if ( m_segmCollectionFlag[i] == 0 ) continue; + ++h_index; + + // fill overview pull histos with Gauss fit result + if(mdt2_pulls_BarrelA[h_index]->GetEntries()>0){ + mdt_pulls_BarrelA[h_index]->Sumw2(); + m_muondqafitfunc->FillGaussMeanAndWidth(mdt2_pulls_BarrelA[h_index],mdt_pulls_BarrelA[h_index],-5.,5.); + mdt2_pulls_BarrelA[h_index]->Delete(); + mdt2_pulls_BarrelA[h_index] = 0; + } + if(mdt2_pulls_BarrelC[h_index]->GetEntries()>0){ + mdt_pulls_BarrelC[h_index]->Sumw2(); + m_muondqafitfunc->FillGaussMeanAndWidth(mdt2_pulls_BarrelC[h_index],mdt_pulls_BarrelC[h_index],-5.,5.); + mdt2_pulls_BarrelC[h_index]->Delete(); + mdt2_pulls_BarrelC[h_index] = 0; + } + if(mdt2_pulls_ECA[h_index]->GetEntries()>0){ + mdt_pulls_ECA[h_index]->Sumw2(); + m_muondqafitfunc->FillGaussMeanAndWidth(mdt2_pulls_ECA[h_index],mdt_pulls_ECA[h_index],-5.,5.); + mdt2_pulls_ECA[h_index]->Delete(); + mdt2_pulls_ECA[h_index] = 0; + } + if(mdt2_pulls_ECC[h_index]->GetEntries()>0){ + mdt_pulls_ECC[h_index]->Sumw2(); + m_muondqafitfunc->FillGaussMeanAndWidth(mdt2_pulls_ECC[h_index],mdt_pulls_ECC[h_index],-5.,5.); + mdt2_pulls_ECC[h_index]->Delete(); + mdt2_pulls_ECC[h_index] = 0; + } + + mdt2_pulls_BarrelA.clear(); + mdt_pulls_BarrelA.clear(); + mdt2_pulls_BarrelC.clear(); + mdt_pulls_BarrelC.clear(); + mdt2_pulls_ECA.clear(); + mdt_pulls_ECA.clear(); + mdt2_pulls_ECC.clear(); + mdt_pulls_ECC.clear(); + + mdt_hits_BarrelA.clear(); + mdt_hits_BarrelC.clear(); + mdt_hits_ECA.clear(); + mdt_hits_ECC.clear(); + + chi2_BarrelA.clear(); + chi2_BarrelC.clear(); + chi2_ECA.clear(); + chi2_ECC.clear(); + + nsegm_BarrelA.clear(); + nsegm_BarrelC.clear(); + nsegm_ECA.clear(); + nsegm_ECC.clear(); + + m_num_segms.clear(); + m_num_hits_per_segmvsphi.clear(); + m_num_hits_per_segm_vs_station.clear(); + chi2_vs_station.clear(); + + m_segm_etavsphi.clear(); + m_segm_eta_vs_phi.clear(); + m_segm_eta_vs_phiInner.clear(); + m_segm_eta_vs_phiMiddle.clear(); + m_segm_eta_vs_phiOuter.clear(); + + if ( histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA1.resProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA1.resProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA1.resProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA1.resProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA2.resProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA2.resProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA2.resProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA2.resProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA3.resProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA3.resProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA3.resProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA3.resProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA4.resProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA4.resProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA4.resProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA4.resProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA5.resProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA5.resProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA5.resProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA5.resProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA6.resProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA6.resProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA6.resProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA6.resProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA7.resProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA7.resProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA7.resProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA7.resProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA8.resProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA8.resProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA8.resProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA8.resProf->LabelsOption("va","X"); } + + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC1.resProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC1.resProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC1.resProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC1.resProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC2.resProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC2.resProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC2.resProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC2.resProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC3.resProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC3.resProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC3.resProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC3.resProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC4.resProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC4.resProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC4.resProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC4.resProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC5.resProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC5.resProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC5.resProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC5.resProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC6.resProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC6.resProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC6.resProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC6.resProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC7.resProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC7.resProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC7.resProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC7.resProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC8.resProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC8.resProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC8.resProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC8.resProf->LabelsOption("va","X"); } + + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA1.resProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA1.resProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA1.resProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA1.resProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA2.resProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA2.resProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA2.resProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA2.resProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA3.resProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA3.resProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA3.resProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA3.resProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA4.resProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA4.resProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA4.resProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA4.resProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA5.resProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA5.resProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA5.resProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA5.resProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA6.resProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA6.resProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA6.resProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA6.resProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA7.resProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA7.resProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA7.resProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA7.resProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA8.resProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA8.resProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA8.resProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA8.resProf->LabelsOption("va","X"); } + + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC1.resProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC1.resProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC1.resProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC1.resProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC2.resProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC2.resProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC2.resProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC2.resProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC3.resProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC3.resProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC3.resProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC3.resProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC4.resProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC4.resProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC4.resProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC4.resProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC5.resProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC5.resProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC5.resProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC5.resProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC6.resProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC6.resProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC6.resProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC6.resProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC7.resProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC7.resProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC7.resProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC7.resProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC8.resProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC8.resProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC8.resProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC8.resProf->LabelsOption("va","X"); } + + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA1.pullProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA1.pullProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA1.pullProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA1.pullProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA2.pullProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA2.pullProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA2.pullProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA2.pullProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA3.pullProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA3.pullProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA3.pullProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA3.pullProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA4.pullProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA4.pullProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA4.pullProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA4.pullProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA5.pullProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA5.pullProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA5.pullProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA5.pullProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA6.pullProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA6.pullProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA6.pullProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA6.pullProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA7.pullProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA7.pullProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA7.pullProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA7.pullProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA8.pullProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA8.pullProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA8.pullProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelA8.pullProf->LabelsOption("va","X"); } + + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC1.pullProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC1.pullProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC1.pullProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC1.pullProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC2.pullProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC2.pullProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC2.pullProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC2.pullProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC3.pullProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC3.pullProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC3.pullProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC3.pullProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC4.pullProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC4.pullProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC4.pullProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC4.pullProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC5.pullProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC5.pullProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC5.pullProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC5.pullProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC6.pullProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC6.pullProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC6.pullProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC6.pullProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC7.pullProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC7.pullProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC7.pullProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC7.pullProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC8.pullProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC8.pullProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC8.pullProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsBarrelC8.pullProf->LabelsOption("va","X"); } + + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA1.pullProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA1.pullProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA1.pullProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA1.pullProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA2.pullProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA2.pullProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA2.pullProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA2.pullProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA3.pullProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA3.pullProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA3.pullProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA3.pullProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA4.pullProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA4.pullProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA4.pullProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA4.pullProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA5.pullProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA5.pullProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA5.pullProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA5.pullProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA6.pullProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA6.pullProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA6.pullProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA6.pullProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA7.pullProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA7.pullProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA7.pullProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA7.pullProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA8.pullProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA8.pullProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA8.pullProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsECA8.pullProf->LabelsOption("va","X"); } + + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC1.pullProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC1.pullProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC1.pullProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC1.pullProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC2.pullProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC2.pullProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC2.pullProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC2.pullProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC3.pullProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC3.pullProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC3.pullProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC3.pullProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC4.pullProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC4.pullProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC4.pullProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC4.pullProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC5.pullProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC5.pullProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC5.pullProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC5.pullProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC6.pullProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC6.pullProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC6.pullProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC6.pullProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC7.pullProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC7.pullProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC7.pullProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC7.pullProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC8.pullProf && histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC8.pullProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC8.pullProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.residualHistos.mdtsECC8.pullProf->LabelsOption("va","X"); } + + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA1.nsegm && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA1.nsegm->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA1.nsegm->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA1.nsegm->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA2.nsegm && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA2.nsegm->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA2.nsegm->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA2.nsegm->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA3.nsegm && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA3.nsegm->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA3.nsegm->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA3.nsegm->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA4.nsegm && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA4.nsegm->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA4.nsegm->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA4.nsegm->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA5.nsegm && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA5.nsegm->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA5.nsegm->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA5.nsegm->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA6.nsegm && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA6.nsegm->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA6.nsegm->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA6.nsegm->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA7.nsegm && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA7.nsegm->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA7.nsegm->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA7.nsegm->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA8.nsegm && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA8.nsegm->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA8.nsegm->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA8.nsegm->LabelsOption("va","X"); } + + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC1.nsegm && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC1.nsegm->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC1.nsegm->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC1.nsegm->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC2.nsegm && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC2.nsegm->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC2.nsegm->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC2.nsegm->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC3.nsegm && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC3.nsegm->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC3.nsegm->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC3.nsegm->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC4.nsegm && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC4.nsegm->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC4.nsegm->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC4.nsegm->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC5.nsegm && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC5.nsegm->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC5.nsegm->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC5.nsegm->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC6.nsegm && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC6.nsegm->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC6.nsegm->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC6.nsegm->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC7.nsegm && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC7.nsegm->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC7.nsegm->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC7.nsegm->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC8.nsegm && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC8.nsegm->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC8.nsegm->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC8.nsegm->LabelsOption("va","X"); } + + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECA1.nsegm && histos_from_tool[h_index].hitHistos.countHistos.mdtsECA1.nsegm->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECA1.nsegm->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECA1.nsegm->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECA2.nsegm && histos_from_tool[h_index].hitHistos.countHistos.mdtsECA2.nsegm->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECA2.nsegm->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECA2.nsegm->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECA3.nsegm && histos_from_tool[h_index].hitHistos.countHistos.mdtsECA3.nsegm->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECA3.nsegm->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECA3.nsegm->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECA4.nsegm && histos_from_tool[h_index].hitHistos.countHistos.mdtsECA4.nsegm->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECA4.nsegm->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECA4.nsegm->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECA5.nsegm && histos_from_tool[h_index].hitHistos.countHistos.mdtsECA5.nsegm->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECA5.nsegm->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECA5.nsegm->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECA6.nsegm && histos_from_tool[h_index].hitHistos.countHistos.mdtsECA6.nsegm->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECA6.nsegm->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECA6.nsegm->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECA7.nsegm && histos_from_tool[h_index].hitHistos.countHistos.mdtsECA7.nsegm->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECA7.nsegm->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECA7.nsegm->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECA8.nsegm && histos_from_tool[h_index].hitHistos.countHistos.mdtsECA8.nsegm->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECA8.nsegm->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECA8.nsegm->LabelsOption("va","X"); } + + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECC1.nsegm && histos_from_tool[h_index].hitHistos.countHistos.mdtsECC1.nsegm->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECC1.nsegm->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECC1.nsegm->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECC2.nsegm && histos_from_tool[h_index].hitHistos.countHistos.mdtsECC2.nsegm->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECC2.nsegm->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECC2.nsegm->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECC3.nsegm && histos_from_tool[h_index].hitHistos.countHistos.mdtsECC3.nsegm->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECC3.nsegm->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECC3.nsegm->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECC4.nsegm && histos_from_tool[h_index].hitHistos.countHistos.mdtsECC4.nsegm->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECC4.nsegm->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECC4.nsegm->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECC5.nsegm && histos_from_tool[h_index].hitHistos.countHistos.mdtsECC5.nsegm->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECC5.nsegm->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECC5.nsegm->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECC6.nsegm && histos_from_tool[h_index].hitHistos.countHistos.mdtsECC6.nsegm->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECC6.nsegm->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECC6.nsegm->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECC7.nsegm && histos_from_tool[h_index].hitHistos.countHistos.mdtsECC7.nsegm->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECC7.nsegm->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECC7.nsegm->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECC8.nsegm && histos_from_tool[h_index].hitHistos.countHistos.mdtsECC8.nsegm->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECC8.nsegm->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECC8.nsegm->LabelsOption("va","X"); } + + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA1.chi2Prof && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA1.chi2Prof->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA1.chi2Prof->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA1.chi2Prof->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA2.chi2Prof && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA2.chi2Prof->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA2.chi2Prof->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA2.chi2Prof->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA3.chi2Prof && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA3.chi2Prof->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA3.chi2Prof->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA3.chi2Prof->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA4.chi2Prof && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA4.chi2Prof->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA4.chi2Prof->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA4.chi2Prof->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA5.chi2Prof && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA5.chi2Prof->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA5.chi2Prof->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA5.chi2Prof->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA6.chi2Prof && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA6.chi2Prof->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA6.chi2Prof->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA6.chi2Prof->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA7.chi2Prof && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA7.chi2Prof->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA7.chi2Prof->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA7.chi2Prof->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA8.chi2Prof && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA8.chi2Prof->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA8.chi2Prof->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA8.chi2Prof->LabelsOption("va","X"); } + + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC1.chi2Prof && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC1.chi2Prof->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC1.chi2Prof->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC1.chi2Prof->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC2.chi2Prof && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC2.chi2Prof->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC2.chi2Prof->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC2.chi2Prof->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC3.chi2Prof && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC3.chi2Prof->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC3.chi2Prof->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC3.chi2Prof->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC4.chi2Prof && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC4.chi2Prof->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC4.chi2Prof->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC4.chi2Prof->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC5.chi2Prof && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC5.chi2Prof->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC5.chi2Prof->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC5.chi2Prof->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC6.chi2Prof && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC6.chi2Prof->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC6.chi2Prof->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC6.chi2Prof->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC7.chi2Prof && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC7.chi2Prof->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC7.chi2Prof->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC7.chi2Prof->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC8.chi2Prof && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC8.chi2Prof->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC8.chi2Prof->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC8.chi2Prof->LabelsOption("va","X"); } + + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECA1.chi2Prof && histos_from_tool[h_index].hitHistos.countHistos.mdtsECA1.chi2Prof->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECA1.chi2Prof->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECA1.chi2Prof->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECA2.chi2Prof && histos_from_tool[h_index].hitHistos.countHistos.mdtsECA2.chi2Prof->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECA2.chi2Prof->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECA2.chi2Prof->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECA3.chi2Prof && histos_from_tool[h_index].hitHistos.countHistos.mdtsECA3.chi2Prof->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECA3.chi2Prof->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECA3.chi2Prof->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECA4.chi2Prof && histos_from_tool[h_index].hitHistos.countHistos.mdtsECA4.chi2Prof->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECA4.chi2Prof->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECA4.chi2Prof->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECA5.chi2Prof && histos_from_tool[h_index].hitHistos.countHistos.mdtsECA5.chi2Prof->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECA5.chi2Prof->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECA5.chi2Prof->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECA6.chi2Prof && histos_from_tool[h_index].hitHistos.countHistos.mdtsECA6.chi2Prof->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECA6.chi2Prof->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECA6.chi2Prof->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECA7.chi2Prof && histos_from_tool[h_index].hitHistos.countHistos.mdtsECA7.chi2Prof->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECA7.chi2Prof->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECA7.chi2Prof->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECA8.chi2Prof && histos_from_tool[h_index].hitHistos.countHistos.mdtsECA8.chi2Prof->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECA8.chi2Prof->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECA8.chi2Prof->LabelsOption("va","X"); } + + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECC1.chi2Prof && histos_from_tool[h_index].hitHistos.countHistos.mdtsECC1.chi2Prof->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECC1.chi2Prof->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECC1.chi2Prof->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECC2.chi2Prof && histos_from_tool[h_index].hitHistos.countHistos.mdtsECC2.chi2Prof->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECC2.chi2Prof->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECC2.chi2Prof->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECC3.chi2Prof && histos_from_tool[h_index].hitHistos.countHistos.mdtsECC3.chi2Prof->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECC3.chi2Prof->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECC3.chi2Prof->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECC4.chi2Prof && histos_from_tool[h_index].hitHistos.countHistos.mdtsECC4.chi2Prof->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECC4.chi2Prof->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECC4.chi2Prof->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECC5.chi2Prof && histos_from_tool[h_index].hitHistos.countHistos.mdtsECC5.chi2Prof->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECC5.chi2Prof->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECC5.chi2Prof->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECC6.chi2Prof && histos_from_tool[h_index].hitHistos.countHistos.mdtsECC6.chi2Prof->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECC6.chi2Prof->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECC6.chi2Prof->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECC7.chi2Prof && histos_from_tool[h_index].hitHistos.countHistos.mdtsECC7.chi2Prof->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECC7.chi2Prof->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECC7.chi2Prof->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECC8.chi2Prof && histos_from_tool[h_index].hitHistos.countHistos.mdtsECC8.chi2Prof->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECC8.chi2Prof->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECC8.chi2Prof->LabelsOption("va","X"); } + + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA1.nmdtProf && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA1.nmdtProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA1.nmdtProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA1.nmdtProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA2.nmdtProf && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA2.nmdtProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA2.nmdtProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA2.nmdtProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA3.nmdtProf && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA3.nmdtProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA3.nmdtProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA3.nmdtProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA4.nmdtProf && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA4.nmdtProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA4.nmdtProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA4.nmdtProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA5.nmdtProf && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA5.nmdtProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA5.nmdtProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA5.nmdtProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA6.nmdtProf && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA6.nmdtProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA6.nmdtProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA6.nmdtProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA7.nmdtProf && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA7.nmdtProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA7.nmdtProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA7.nmdtProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA8.nmdtProf && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA8.nmdtProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA8.nmdtProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelA8.nmdtProf->LabelsOption("va","X"); } + + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC1.nmdtProf && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC1.nmdtProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC1.nmdtProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC1.nmdtProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC2.nmdtProf && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC2.nmdtProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC2.nmdtProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC2.nmdtProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC3.nmdtProf && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC3.nmdtProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC3.nmdtProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC3.nmdtProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC4.nmdtProf && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC4.nmdtProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC4.nmdtProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC4.nmdtProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC5.nmdtProf && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC5.nmdtProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC5.nmdtProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC5.nmdtProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC6.nmdtProf && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC6.nmdtProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC6.nmdtProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC6.nmdtProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC7.nmdtProf && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC7.nmdtProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC7.nmdtProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC7.nmdtProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC8.nmdtProf && histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC8.nmdtProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC8.nmdtProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsBarrelC8.nmdtProf->LabelsOption("va","X"); } + + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECA1.nmdtProf && histos_from_tool[h_index].hitHistos.countHistos.mdtsECA1.nmdtProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECA1.nmdtProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECA1.nmdtProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECA2.nmdtProf && histos_from_tool[h_index].hitHistos.countHistos.mdtsECA2.nmdtProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECA2.nmdtProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECA2.nmdtProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECA3.nmdtProf && histos_from_tool[h_index].hitHistos.countHistos.mdtsECA3.nmdtProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECA3.nmdtProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECA3.nmdtProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECA4.nmdtProf && histos_from_tool[h_index].hitHistos.countHistos.mdtsECA4.nmdtProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECA4.nmdtProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECA4.nmdtProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECA5.nmdtProf && histos_from_tool[h_index].hitHistos.countHistos.mdtsECA5.nmdtProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECA5.nmdtProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECA5.nmdtProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECA6.nmdtProf && histos_from_tool[h_index].hitHistos.countHistos.mdtsECA6.nmdtProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECA6.nmdtProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECA6.nmdtProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECA7.nmdtProf && histos_from_tool[h_index].hitHistos.countHistos.mdtsECA7.nmdtProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECA7.nmdtProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECA7.nmdtProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECA8.nmdtProf && histos_from_tool[h_index].hitHistos.countHistos.mdtsECA8.nmdtProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECA8.nmdtProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECA8.nmdtProf->LabelsOption("va","X"); } + + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECC1.nmdtProf && histos_from_tool[h_index].hitHistos.countHistos.mdtsECC1.nmdtProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECC1.nmdtProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECC1.nmdtProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECC2.nmdtProf && histos_from_tool[h_index].hitHistos.countHistos.mdtsECC2.nmdtProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECC2.nmdtProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECC2.nmdtProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECC3.nmdtProf && histos_from_tool[h_index].hitHistos.countHistos.mdtsECC3.nmdtProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECC3.nmdtProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECC3.nmdtProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECC4.nmdtProf && histos_from_tool[h_index].hitHistos.countHistos.mdtsECC4.nmdtProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECC4.nmdtProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECC4.nmdtProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECC5.nmdtProf && histos_from_tool[h_index].hitHistos.countHistos.mdtsECC5.nmdtProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECC5.nmdtProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECC5.nmdtProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECC6.nmdtProf && histos_from_tool[h_index].hitHistos.countHistos.mdtsECC6.nmdtProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECC6.nmdtProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECC6.nmdtProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECC7.nmdtProf && histos_from_tool[h_index].hitHistos.countHistos.mdtsECC7.nmdtProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECC7.nmdtProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECC7.nmdtProf->LabelsOption("va","X"); } + if (histos_from_tool[h_index].hitHistos.countHistos.mdtsECC8.nmdtProf && histos_from_tool[h_index].hitHistos.countHistos.mdtsECC8.nmdtProf->GetEntries()!=0 ) { + //histos_from_tool[h_index].hitHistos.countHistos.mdtsECC8.nmdtProf->LabelsDeflate("X"); + histos_from_tool[h_index].hitHistos.countHistos.mdtsECC8.nmdtProf->LabelsOption("va","X"); } + + } + + } // isEndOfRun + histos_from_tool.clear(); + } // environment if + + return StatusCode::SUCCESS; +} + +//--------------------------------------------------------------------------------------- + + +//=====================================================// +/** finalize */ +//=====================================================// + + +StatusCode MuonSegmValidation::finalize() +{ + StatusCode sc = ManagedMonitorToolBase::finalize(); + if(!sc.isSuccess()) return sc; + + mdt2_pulls_BarrelA.clear(); + mdt_pulls_BarrelA.clear(); + mdt2_pulls_BarrelC.clear(); + mdt_pulls_BarrelC.clear(); + mdt2_pulls_ECA.clear(); + mdt_pulls_ECA.clear(); + mdt2_pulls_ECC.clear(); + mdt_pulls_ECC.clear(); + + mdt_hits_BarrelA.clear(); + mdt_hits_BarrelC.clear(); + mdt_hits_ECA.clear(); + mdt_hits_ECC.clear(); + + chi2_BarrelA.clear(); + chi2_BarrelC.clear(); + chi2_ECA.clear(); + chi2_ECC.clear(); + + nsegm_BarrelA.clear(); + nsegm_BarrelC.clear(); + nsegm_ECA.clear(); + nsegm_ECC.clear(); + + m_num_segms.clear(); + m_num_hits_per_segmvsphi.clear(); + m_num_hits_per_segm_vs_station.clear(); + chi2_vs_station.clear(); + + m_segm_etavsphi.clear(); + m_segm_eta_vs_phi.clear(); + m_segm_eta_vs_phiInner.clear(); + m_segm_eta_vs_phiMiddle.clear(); + m_segm_eta_vs_phiOuter.clear(); + + histos_from_tool.clear(); + return sc; + +} diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/src/components/MuonSegmMonitoring_entries.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/src/components/MuonSegmMonitoring_entries.cxx new file mode 100755 index 0000000000000000000000000000000000000000..3022ac8166bdc657a81b7bda53527895bd031da1 --- /dev/null +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/src/components/MuonSegmMonitoring_entries.cxx @@ -0,0 +1,15 @@ +#include "GaudiKernel/DeclareFactoryEntries.h" +#include "MuonSegmMonitoring/MuonSegmValidation.h" +#include "MuonSegmMonitoring/CSCSegmValidation.h" +#include "MuonSegmMonitoring/CSCSegmValAlg.h" + +DECLARE_TOOL_FACTORY(MuonSegmValidation) +DECLARE_TOOL_FACTORY(CSCSegmValidation) +DECLARE_TOOL_FACTORY(CSCSegmValAlg) + +DECLARE_FACTORY_ENTRIES(MuonSegmMonitoring) +{ + DECLARE_ALGTOOL(MuonSegmValidation) + DECLARE_ALGTOOL(CSCSegmValidation) + DECLARE_ALGTOOL(CSCSegmValAlg) +} diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/src/components/MuonSegmMonitoring_load.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/src/components/MuonSegmMonitoring_load.cxx new file mode 100755 index 0000000000000000000000000000000000000000..dca047786a5d8c0403362d3cb0c1aa41d210cb33 --- /dev/null +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonSegmMonitoring/src/components/MuonSegmMonitoring_load.cxx @@ -0,0 +1,2 @@ +#include "GaudiKernel/LoadFactoryEntries.h" +LOAD_FACTORY_ENTRIES(MuonSegmMonitoring)