CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
SiStripGainsCalibTreeWorker Class Reference

user includes More...

#include <SiStripGainsCalibTreeWorker.cc>

Inheritance diagram for SiStripGainsCalibTreeWorker:
DQMGlobalEDAnalyzer< APVGain::APVGainHistograms > DQMGlobalEDAnalyzerBase< APVGain::APVGainHistograms, Args... > edm::global::EDProducer< edm::RunCache< APVGain::APVGainHistograms >, edm::EndRunProducer, edm::Accumulator, Args... > edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &, APVGain::APVGainHistograms &) const override
 
void dqmAnalyze (edm::Event const &, edm::EventSetup const &, APVGain::APVGainHistograms const &) const override
 
 SiStripGainsCalibTreeWorker (const edm::ParameterSet &)
 
- Public Member Functions inherited from DQMGlobalEDAnalyzer< APVGain::APVGainHistograms >
virtual void dqmEndRun (edm::Run const &, edm::EventSetup const &, APVGain::APVGainHistograms const &) const
 
void globalEndRunProduce (edm::Run &run, edm::EventSetup const &setup) const final
 
- Public Member Functions inherited from DQMGlobalEDAnalyzerBase< APVGain::APVGainHistograms, Args... >
void accumulate (edm::StreamID id, edm::Event const &event, edm::EventSetup const &setup) const final
 
 DQMGlobalEDAnalyzerBase ()
 
std::shared_ptr< APVGain::APVGainHistogramsglobalBeginRun (edm::Run const &run, edm::EventSetup const &setup) const final
 
void globalEndRun (edm::Run const &, edm::EventSetup const &) const final
 
- Public Member Functions inherited from edm::global::EDProducer< edm::RunCache< APVGain::APVGainHistograms >, edm::EndRunProducer, edm::Accumulator, Args... >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void checkBookAPVColls (const TrackerGeometry *bareTkGeomPtr, APVGain::APVGainHistograms &histograms) const
 
void dqmBeginRun (edm::Run const &, edm::EventSetup const &, APVGain::APVGainHistograms &) const override
 
int statCollectionFromMode (const char *tag) const
 

Private Attributes

bool AllowSaturation
 
std::string CalibPrefix_
 
std::string CalibSuffix_
 
std::vector< std::string > calibTreeFileNames_
 
std::string calibTreeName_
 
bool doChargeMonitorPerPlane
 
std::vector< std::string > dqm_tag_
 
std::string EventPrefix_
 
std::string EventSuffix_
 
bool FirstSetOfConstants
 
edm::ESGetToken< SiStripGain, SiStripGainRcdgainToken_
 
bool hasProcessed_
 
std::string m_calibrationMode
 
std::string m_DQMdir
 
unsigned int MaxNrStrips
 
double MaxTrackChiOverNdf
 
double MaxTrackEta
 
int MaxTrackingIteration
 
double MaxTrackMomentum
 
double MinTrackEta
 
unsigned int MinTrackHits
 
double MinTrackMomentum
 
bool OldGainRemoving
 
edm::ESGetToken< SiStripQuality, SiStripQualityRcdqualityToken_
 
std::map< unsigned int, APVloctheTopologyMap
 
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordtkGeomToken_
 
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordtkGeomTokenBR_
 
std::string TrackPrefix_
 
std::string TrackSuffix_
 
edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtTopoToken_
 
bool useCalibration
 
bool Validation
 
std::vector< std::string > VChargeHisto
 

Additional Inherited Members

- Public Types inherited from DQMGlobalEDAnalyzerBase< APVGain::APVGainHistograms, Args... >
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from DQMGlobalEDAnalyzerBase< APVGain::APVGainHistograms, Args... >
uint64_t meId (edm::Run const &run) const
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 
- Protected Attributes inherited from DQMGlobalEDAnalyzerBase< APVGain::APVGainHistograms, Args... >
DQMStoredqmstore_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

user includes

Description: Fill DQM histograms with SiStrip Charge normalized to path length

Definition at line 50 of file SiStripGainsCalibTreeWorker.cc.

Constructor & Destructor Documentation

◆ SiStripGainsCalibTreeWorker()

SiStripGainsCalibTreeWorker::SiStripGainsCalibTreeWorker ( const edm::ParameterSet iConfig)
explicit

Definition at line 127 of file SiStripGainsCalibTreeWorker.cc.

References AllowSaturation, CalibPrefix_, CalibSuffix_, calibTreeFileNames_, calibTreeName_, doChargeMonitorPerPlane, dqm_tag_, edm::EDConsumerBase::esConsumes(), EventPrefix_, EventSuffix_, dqmdumpme::first, FirstSetOfConstants, gainToken_, edm::ParameterSet::getUntrackedParameter(), hasProcessed_, mps_fire::i, m_calibrationMode, m_DQMdir, MaxNrStrips, MaxTrackChiOverNdf, MaxTrackEta, MaxTrackingIteration, MaxTrackMomentum, MinTrackEta, MinTrackHits, MinTrackMomentum, APVGain::monHnames(), OldGainRemoving, qualityToken_, alignCSCRings::s, ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::barrel::side(), AlCaHLTBitMon_QueryRunRegistry::string, APVGain::subdetectorId(), APVGain::subdetectorPlane(), APVGain::subdetectorSide(), theTopologyMap, APVGain::thickness(), tkGeomTokenBR_, TrackPrefix_, TrackSuffix_, tTopoToken_, useCalibration, Validation, and VChargeHisto.

127  {
128  MinTrackMomentum = iConfig.getUntrackedParameter<double>("minTrackMomentum", 3.0);
129  MaxTrackMomentum = iConfig.getUntrackedParameter<double>("maxTrackMomentum", 99999.0);
130  MinTrackEta = iConfig.getUntrackedParameter<double>("minTrackEta", -5.0);
131  MaxTrackEta = iConfig.getUntrackedParameter<double>("maxTrackEta", 5.0);
132  MaxNrStrips = iConfig.getUntrackedParameter<unsigned>("maxNrStrips", 2);
133  MinTrackHits = iConfig.getUntrackedParameter<unsigned>("MinTrackHits", 8);
134  MaxTrackChiOverNdf = iConfig.getUntrackedParameter<double>("MaxTrackChiOverNdf", 3);
135  MaxTrackingIteration = iConfig.getUntrackedParameter<int>("MaxTrackingIteration", 7);
136  AllowSaturation = iConfig.getUntrackedParameter<bool>("AllowSaturation", false);
137  FirstSetOfConstants = iConfig.getUntrackedParameter<bool>("FirstSetOfConstants", true);
138  Validation = iConfig.getUntrackedParameter<bool>("Validation", false);
139  OldGainRemoving = iConfig.getUntrackedParameter<bool>("OldGainRemoving", false);
140  useCalibration = iConfig.getUntrackedParameter<bool>("UseCalibration", false);
141  doChargeMonitorPerPlane = iConfig.getUntrackedParameter<bool>("doChargeMonitorPerPlane", false);
142  m_DQMdir = iConfig.getUntrackedParameter<std::string>("DQMdir", "AlCaReco/SiStripGains");
143  m_calibrationMode = iConfig.getUntrackedParameter<std::string>("calibrationMode", "StdBunch");
144  VChargeHisto = iConfig.getUntrackedParameter<std::vector<std::string>>("ChargeHisto");
145 
146  // fill in the mapping between the histogram indices and the (id,side,plane) tuple
147  std::vector<std::pair<std::string, std::string>> hnames =
149  for (unsigned int i = 0; i < hnames.size(); i++) {
150  int id = APVGain::subdetectorId((hnames[i]).first);
151  int side = APVGain::subdetectorSide((hnames[i]).first);
152  int plane = APVGain::subdetectorPlane((hnames[i]).first);
153  int thick = APVGain::thickness((hnames[i]).first);
154  std::string s = hnames[i].first;
155 
156  auto loc = APVloc(thick, id, side, plane, s);
157  theTopologyMap.insert(std::make_pair(i, loc));
158  }
159 
160  //Set the monitoring element tag and store
161  dqm_tag_.reserve(7);
162  dqm_tag_.clear();
163  dqm_tag_.push_back("StdBunch"); // statistic collection from Standard Collision Bunch @ 3.8 T
164  dqm_tag_.push_back("StdBunch0T"); // statistic collection from Standard Collision Bunch @ 0 T
165  dqm_tag_.push_back("AagBunch"); // statistic collection from First Collision After Abort Gap @ 3.8 T
166  dqm_tag_.push_back("AagBunch0T"); // statistic collection from First Collision After Abort Gap @ 0 T
167  dqm_tag_.push_back("IsoMuon"); // statistic collection from Isolated Muon @ 3.8 T
168  dqm_tag_.push_back("IsoMuon0T"); // statistic collection from Isolated Muon @ 0 T
169  dqm_tag_.push_back("Harvest"); // statistic collection: Harvest
170 
171  hasProcessed_ = false;
172 
173  edm::ParameterSet swhallowgain_pset = iConfig.getUntrackedParameter<edm::ParameterSet>("gain");
174  CalibPrefix_ = swhallowgain_pset.getUntrackedParameter<std::string>("prefix");
175  CalibSuffix_ = swhallowgain_pset.getUntrackedParameter<std::string>("suffix");
176  edm::ParameterSet evtinfo_pset = iConfig.getUntrackedParameter<edm::ParameterSet>("evtinfo");
177  EventPrefix_ = evtinfo_pset.getUntrackedParameter<std::string>("prefix");
178  EventSuffix_ = evtinfo_pset.getUntrackedParameter<std::string>("suffix");
179  edm::ParameterSet track_pset = iConfig.getUntrackedParameter<edm::ParameterSet>("tracks");
180  TrackPrefix_ = track_pset.getUntrackedParameter<std::string>("prefix");
181  TrackSuffix_ = track_pset.getUntrackedParameter<std::string>("suffix");
182 
183  calibTreeName_ = iConfig.getUntrackedParameter<std::string>("CalibTreeName");
184  calibTreeFileNames_ = iConfig.getUntrackedParameter<std::vector<std::string>>("CalibTreeFiles");
185 
187  tkGeomTokenBR_ = esConsumes<edm::Transition::BeginRun>();
188  gainToken_ = esConsumes<edm::Transition::BeginRun>();
189  qualityToken_ = esConsumes<edm::Transition::BeginRun>();
190 }
std::vector< std::string > dqm_tag_
edm::ESGetToken< SiStripGain, SiStripGainRcd > gainToken_
std::vector< std::string > VChargeHisto
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomTokenBR_
std::map< unsigned int, APVloc > theTopologyMap
int subdetectorPlane(uint32_t, const TrackerTopology *)
edm::ESGetToken< SiStripQuality, SiStripQualityRcd > qualityToken_
T getUntrackedParameter(std::string const &, T const &) const
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
std::vector< std::string > calibTreeFileNames_
int subdetectorSide(uint32_t, const TrackerTopology *)
int thickness(uint32_t)
std::vector< std::pair< std::string, std::string > > monHnames(std::vector< std::string >, bool, const char *tag)
int subdetectorId(uint32_t)

Member Function Documentation

◆ bookHistograms()

void SiStripGainsCalibTreeWorker::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  run,
edm::EventSetup const &  setup,
APVGain::APVGainHistograms histograms 
) const
overridevirtual

Implements DQMGlobalEDAnalyzerBase< APVGain::APVGainHistograms, Args... >.

Definition at line 622 of file SiStripGainsCalibTreeWorker.cc.

References a, b, dqm::implementation::IBooker::book1DD(), dqm::implementation::IBooker::book2S(), dqm::implementation::NavigatorBase::cd(), doChargeMonitorPerPlane, dqm_tag_, JetChargeProducer_cfi::exp, dqmdumpme::first, mps_fire::i, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, dqm-mbProfile::log, m_calibrationMode, m_DQMdir, APVGain::monHnames(), LaserDQM_cfg::p1, SiStripOfflineCRack_cfg::p2, edm::second(), dqm::implementation::NavigatorBase::setCurrentFolder(), statCollectionFromMode(), AlCaHLTBitMon_QueryRunRegistry::string, makeGlobalPositionRcd_cfg::tag, VChargeHisto, and y.

625  {
626  ibooker.cd();
627  std::string dqm_dir = m_DQMdir;
628  const char* tag = dqm_tag_[statCollectionFromMode(m_calibrationMode.c_str())].c_str();
629 
630  edm::LogInfo("SiStripGainsCalibTreeWorker")
631  << "Setting " << dqm_dir << " in DQM and booking histograms for tag " << tag << std::endl;
632 
633  ibooker.setCurrentFolder(dqm_dir);
634 
635  std::string stag(tag);
636  if (!stag.empty() && stag[0] != '_')
637  stag.insert(0, 1, '_');
638 
639  std::string cvi = std::string("Charge_Vs_Index") + stag;
640  std::string cvpTIB = std::string("Charge_Vs_PathlengthTIB") + stag;
641  std::string cvpTOB = std::string("Charge_Vs_PathlengthTOB") + stag;
642  std::string cvpTIDP = std::string("Charge_Vs_PathlengthTIDP") + stag;
643  std::string cvpTIDM = std::string("Charge_Vs_PathlengthTIDM") + stag;
644  std::string cvpTECP1 = std::string("Charge_Vs_PathlengthTECP1") + stag;
645  std::string cvpTECP2 = std::string("Charge_Vs_PathlengthTECP2") + stag;
646  std::string cvpTECM1 = std::string("Charge_Vs_PathlengthTECM1") + stag;
647  std::string cvpTECM2 = std::string("Charge_Vs_PathlengthTECM2") + stag;
648 
649  int elepos = statCollectionFromMode(tag);
650 
651  histograms.Charge_Vs_Index.reserve(dqm_tag_.size());
652  histograms.Charge_Vs_PathlengthTIB.reserve(dqm_tag_.size());
653  histograms.Charge_Vs_PathlengthTOB.reserve(dqm_tag_.size());
654  histograms.Charge_Vs_PathlengthTIDP.reserve(dqm_tag_.size());
655  histograms.Charge_Vs_PathlengthTIDM.reserve(dqm_tag_.size());
656  histograms.Charge_Vs_PathlengthTECP1.reserve(dqm_tag_.size());
657  histograms.Charge_Vs_PathlengthTECP2.reserve(dqm_tag_.size());
658  histograms.Charge_Vs_PathlengthTECM1.reserve(dqm_tag_.size());
659  histograms.Charge_Vs_PathlengthTECM2.reserve(dqm_tag_.size());
660 
661  // The cluster charge is stored by exploiting a non uniform binning in order
662  // reduce the histogram memory size. The bin width is relaxed with a falling
663  // exponential function and the bin boundaries are stored in the binYarray.
664  // The binXarray is used to provide as many bins as the APVs.
665  //
666  // More details about this implementations are here:
667  // https://indico.cern.ch/event/649344/contributions/2672267/attachments/1498323/2332518/OptimizeChHisto.pdf
668 
669  std::vector<float> binXarray;
670  binXarray.reserve(histograms.NStripAPVs + 1);
671  for (unsigned int a = 0; a <= histograms.NStripAPVs; a++) {
672  binXarray.push_back((float)a);
673  }
674 
675  std::array<float, 688> binYarray;
676  double p0 = 5.445;
677  double p1 = 0.002113;
678  double p2 = 69.01576;
679  double y = 0.;
680  for (int b = 0; b < 687; b++) {
681  binYarray[b] = y;
682  if (y <= 902.)
683  y = y + 2.;
684  else
685  y = (p0 - log(exp(p0 - p1 * y) - p2 * p1)) / p1;
686  }
687  binYarray[687] = 4000.;
688 
689  histograms.Charge_1[elepos].clear();
690  histograms.Charge_2[elepos].clear();
691  histograms.Charge_3[elepos].clear();
692  histograms.Charge_4[elepos].clear();
693 
694  auto it = histograms.Charge_Vs_Index.begin();
695  histograms.Charge_Vs_Index.insert(
696  it + elepos,
697  ibooker.book2S(cvi.c_str(), cvi.c_str(), histograms.NStripAPVs, &binXarray[0], 687, binYarray.data()));
698 
699  it = histograms.Charge_Vs_PathlengthTIB.begin();
700  histograms.Charge_Vs_PathlengthTIB.insert(it + elepos,
701  ibooker.book2S(cvpTIB.c_str(), cvpTIB.c_str(), 20, 0.3, 1.3, 250, 0, 2000));
702 
703  it = histograms.Charge_Vs_PathlengthTOB.begin();
704  histograms.Charge_Vs_PathlengthTOB.insert(it + elepos,
705  ibooker.book2S(cvpTOB.c_str(), cvpTOB.c_str(), 20, 0.3, 1.3, 250, 0, 2000));
706 
707  it = histograms.Charge_Vs_PathlengthTIDP.begin();
708  histograms.Charge_Vs_PathlengthTIDP.insert(
709  it + elepos, ibooker.book2S(cvpTIDP.c_str(), cvpTIDP.c_str(), 20, 0.3, 1.3, 250, 0, 2000));
710 
711  it = histograms.Charge_Vs_PathlengthTIDM.begin();
712  histograms.Charge_Vs_PathlengthTIDM.insert(
713  it + elepos, ibooker.book2S(cvpTIDM.c_str(), cvpTIDM.c_str(), 20, 0.3, 1.3, 250, 0, 2000));
714 
715  it = histograms.Charge_Vs_PathlengthTECP1.begin();
716  histograms.Charge_Vs_PathlengthTECP1.insert(
717  it + elepos, ibooker.book2S(cvpTECP1.c_str(), cvpTECP1.c_str(), 20, 0.3, 1.3, 250, 0, 2000));
718 
719  it = histograms.Charge_Vs_PathlengthTECP2.begin();
720  histograms.Charge_Vs_PathlengthTECP2.insert(
721  it + elepos, ibooker.book2S(cvpTECP2.c_str(), cvpTECP2.c_str(), 20, 0.3, 1.3, 250, 0, 2000));
722 
723  it = histograms.Charge_Vs_PathlengthTECM1.begin();
724  histograms.Charge_Vs_PathlengthTECM1.insert(
725  it + elepos, ibooker.book2S(cvpTECM1.c_str(), cvpTECM1.c_str(), 20, 0.3, 1.3, 250, 0, 2000));
726 
727  it = histograms.Charge_Vs_PathlengthTECM2.begin();
728  histograms.Charge_Vs_PathlengthTECM2.insert(
729  it + elepos, ibooker.book2S(cvpTECM2.c_str(), cvpTECM2.c_str(), 20, 0.3, 1.3, 250, 0, 2000));
730 
731  std::vector<std::pair<std::string, std::string>> hnames =
733  for (unsigned int i = 0; i < hnames.size(); i++) {
734  std::string htag = (hnames[i]).first + stag;
735  histograms.Charge_1[elepos].push_back(ibooker.book1DD(htag.c_str(), (hnames[i]).second.c_str(), 100, 0., 1000.));
736  }
737 
739  for (unsigned int i = 0; i < hnames.size(); i++) {
740  std::string htag = (hnames[i]).first + stag;
741  histograms.Charge_2[elepos].push_back(ibooker.book1DD(htag.c_str(), (hnames[i]).second.c_str(), 100, 0., 1000.));
742  }
743 
745  for (unsigned int i = 0; i < hnames.size(); i++) {
746  std::string htag = (hnames[i]).first + stag;
747  histograms.Charge_3[elepos].push_back(ibooker.book1DD(htag.c_str(), (hnames[i]).second.c_str(), 100, 0., 1000.));
748  }
749 
751  for (unsigned int i = 0; i < hnames.size(); i++) {
752  std::string htag = (hnames[i]).first + stag;
753  histograms.Charge_4[elepos].push_back(ibooker.book1DD(htag.c_str(), (hnames[i]).second.c_str(), 100, 0., 1000.));
754  }
755 }
std::vector< std::string > dqm_tag_
MonitorElement * book2S(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:263
std::vector< std::string > VChargeHisto
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
U second(std::pair< T, U > const &p)
MonitorElement * book1DD(TString const &name, TString const &title, int nchX, double lowX, double highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:155
int statCollectionFromMode(const char *tag) const
Log< level::Info, false > LogInfo
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
std::vector< std::pair< std::string, std::string > > monHnames(std::vector< std::string >, bool, const char *tag)

◆ checkBookAPVColls()

void SiStripGainsCalibTreeWorker::checkBookAPVColls ( const TrackerGeometry bareTkGeomPtr,
APVGain::APVGainHistograms histograms 
) const
private

Definition at line 507 of file SiStripGainsCalibTreeWorker.cc.

References sistrip::APV, TrackerGeometry::dets(), mps_fire::i, dqmiolumiharvest::j, PixelTopology::ncolumns(), PixelTopology::nrows(), StripTopology::nstrips(), PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, DetId::rawId(), ntupleEnum::SubDet, DetId::subdetId(), StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, and StripSubdetector::TOB.

Referenced by dqmBeginRun().

508  {
509  if (bareTkGeomPtr) { // pointer not yet set: called the first time => fill the APVColls
510  auto const& Det = bareTkGeomPtr->dets();
511 
512  edm::LogInfo("SiStripGainsCalibTreeWorker") << " Resetting APV struct" << std::endl;
513 
514  unsigned int Index = 0;
515 
516  for (unsigned int i = 0; i < Det.size(); i++) {
517  DetId Detid = Det[i]->geographicalId();
518  int SubDet = Detid.subdetId();
519 
522  auto DetUnit = dynamic_cast<const StripGeomDetUnit*>(Det[i]);
523  if (!DetUnit)
524  continue;
525 
526  const StripTopology& Topo = DetUnit->specificTopology();
527  unsigned int NAPV = Topo.nstrips() / 128;
528 
529  for (unsigned int j = 0; j < NAPV; j++) {
530  auto APV = std::make_shared<stAPVGain>();
531  APV->Index = Index;
532  APV->Bin = -1;
533  APV->DetId = Detid.rawId();
534  APV->APVId = j;
535  APV->SubDet = SubDet;
536  APV->FitMPV = -1;
537  APV->FitMPVErr = -1;
538  APV->FitWidth = -1;
539  APV->FitWidthErr = -1;
540  APV->FitChi2 = -1;
541  APV->FitNorm = -1;
542  APV->Gain = -1;
543  APV->PreviousGain = 1;
544  APV->PreviousGainTick = 1;
545  APV->x = DetUnit->position().basicVector().x();
546  APV->y = DetUnit->position().basicVector().y();
547  APV->z = DetUnit->position().basicVector().z();
548  APV->Eta = DetUnit->position().basicVector().eta();
549  APV->Phi = DetUnit->position().basicVector().phi();
550  APV->R = DetUnit->position().basicVector().transverse();
551  APV->Thickness = DetUnit->surface().bounds().thickness();
552  APV->NEntries = 0;
553  APV->isMasked = false;
554 
555  histograms.APVsCollOrdered.push_back(APV);
556  histograms.APVsColl[(APV->DetId << 4) | APV->APVId] = APV;
557  Index++;
558  histograms.NStripAPVs++;
559  } // loop on APVs
560  } // if is Strips
561  } // loop on dets
562 
563  for (unsigned int i = 0; i < Det.size();
564  i++) { //Make two loop such that the Pixel information is added at the end --> make transition simpler
565  DetId Detid = Det[i]->geographicalId();
566  int SubDet = Detid.subdetId();
568  auto DetUnit = dynamic_cast<const PixelGeomDetUnit*>(Det[i]);
569  if (!DetUnit)
570  continue;
571 
572  const PixelTopology& Topo = DetUnit->specificTopology();
573  unsigned int NROCRow = Topo.nrows() / (80.);
574  unsigned int NROCCol = Topo.ncolumns() / (52.);
575 
576  for (unsigned int j = 0; j < NROCRow; j++) {
577  for (unsigned int i = 0; i < NROCCol; i++) {
578  auto APV = std::make_shared<stAPVGain>();
579  APV->Index = Index;
580  APV->Bin = -1;
581  APV->DetId = Detid.rawId();
582  APV->APVId = (j << 3 | i);
583  APV->SubDet = SubDet;
584  APV->FitMPV = -1;
585  APV->FitMPVErr = -1;
586  APV->FitWidth = -1;
587  APV->FitWidthErr = -1;
588  APV->FitChi2 = -1;
589  APV->Gain = -1;
590  APV->PreviousGain = 1;
591  APV->PreviousGainTick = 1;
592  APV->x = DetUnit->position().basicVector().x();
593  APV->y = DetUnit->position().basicVector().y();
594  APV->z = DetUnit->position().basicVector().z();
595  APV->Eta = DetUnit->position().basicVector().eta();
596  APV->Phi = DetUnit->position().basicVector().phi();
597  APV->R = DetUnit->position().basicVector().transverse();
598  APV->Thickness = DetUnit->surface().bounds().thickness();
599  APV->isMasked = false; //SiPixelQuality_->IsModuleBad(Detid.rawId());
600  APV->NEntries = 0;
601 
602  histograms.APVsCollOrdered.push_back(APV);
603  histograms.APVsColl[(APV->DetId << 4) | APV->APVId] = APV;
604  Index++;
605  histograms.NPixelDets++;
606 
607  } // loop on ROC cols
608  } // loop on ROC rows
609  } // if Pixel
610  } // loop on Dets
611  } //if (!bareTkGeomPtr_) ...
612 }
static constexpr auto TEC
virtual int nstrips() const =0
virtual int ncolumns() const =0
virtual int nrows() const =0
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
static constexpr auto TOB
Log< level::Info, false > LogInfo
Definition: DetId.h:17
static constexpr auto TIB
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
static constexpr auto TID

◆ dqmAnalyze()

void SiStripGainsCalibTreeWorker::dqmAnalyze ( edm::Event const &  iEvent,
edm::EventSetup const &  iSetup,
APVGain::APVGainHistograms const &  histograms 
) const
overridevirtual

Implements DQMGlobalEDAnalyzerBase< APVGain::APVGainHistograms, Args... >.

Definition at line 243 of file SiStripGainsCalibTreeWorker.cc.

References AllowSaturation, CustomPhysics_cfi::amplitude, sistrip::APV, CalibPrefix_, CalibSuffix_, calibTreeFileNames_, calibTreeName_, ALCARECOTkAlJpsiMuMu_cff::charge, PixelTestBeamValidation_cfi::Charge, EventPrefix_, EventSuffix_, APVGain::FetchIndices(), FirstSetOfConstants, edm::EventSetup::getData(), hasProcessed_, mps_fire::i, dqmdumpme::indices, createfilelist::int, LogDebug, visualization-live-secondInstance_cfg::m, m_calibrationMode, SiStripPI::max, MaxNrStrips, MaxTrackChiOverNdf, MaxTrackEta, MaxTrackingIteration, MaxTrackMomentum, MinTrackEta, MinTrackHits, MinTrackMomentum, OldGainRemoving, castor_dqm_sourceclient_file_cfg::path, cond::runnumber, alignCSCRings::s, EcalSCDynamicDPhiParametersESProducer_cfi::saturation, statCollectionFromMode(), mps_setup::stdout, StripSubdetector::TEC, theTopologyMap, StripSubdetector::TIB, StripSubdetector::TID, StripSubdetector::TOB, TrackPrefix_, TrackSuffix_, tTopoToken_, useCalibration, and Validation.

245  {
246  if (!hasProcessed_) {
247  const TrackerTopology* topo = &iSetup.getData(tTopoToken_);
248 
249  for (const auto& elem : theTopologyMap) {
250  LogDebug("SiStripGainsCalibTreeWorker")
251  << elem.first << " - " << elem.second.m_string << " " << elem.second.m_subdetectorId << " "
252  << elem.second.m_subdetectorSide << " " << elem.second.m_subdetectorPlane << std::endl;
253  }
254 
255  LogDebug("SiStripGainsCalibTreeWorker") << "for mode" << m_calibrationMode << std::endl;
256 
257  // data members
258  unsigned int eventnumber = 0;
259  unsigned int runnumber = 0;
260 #ifdef ExtendedCALIBTree
261  const std::vector<bool>* TrigTech = nullptr;
262  const std::vector<double>* chargeoverpath = nullptr;
263 #endif
264  // Track data
265  const std::vector<double>* trackchi2ndof = nullptr;
266  const std::vector<float>* trackp = nullptr;
267  const std::vector<float>* trackpt = nullptr;
268  const std::vector<double>* tracketa = nullptr;
269  const std::vector<double>* trackphi = nullptr;
270  const std::vector<unsigned int>* trackhitsvalid = nullptr;
271  const std::vector<int>* trackalgo = nullptr;
272  // CalibTree data
273  const std::vector<int>* trackindex = nullptr;
274  const std::vector<unsigned int>* rawid = nullptr;
275  const std::vector<double>* localdirx = nullptr;
276  const std::vector<double>* localdiry = nullptr;
277  const std::vector<double>* localdirz = nullptr;
278  const std::vector<unsigned short>* firststrip = nullptr;
279  const std::vector<unsigned short>* nstrips = nullptr;
280  const std::vector<bool>* saturation = nullptr;
281  const std::vector<bool>* overlapping = nullptr;
282  const std::vector<bool>* farfromedge = nullptr;
283  const std::vector<unsigned int>* charge = nullptr;
284  const std::vector<double>* path = nullptr;
285  const std::vector<unsigned char>* amplitude = nullptr;
286  const std::vector<double>* gainused = nullptr;
287  const std::vector<double>* gainusedTick = nullptr;
288 
289  TChain tree{calibTreeName_.c_str()};
290  for (const auto& ctFn : calibTreeFileNames_) {
291  tree.Add(ctFn.c_str());
292  }
293 
294  tree.SetBranchAddress((EventPrefix_ + "event" + EventSuffix_).c_str(), &eventnumber, nullptr);
295  tree.SetBranchAddress((EventPrefix_ + "run" + EventSuffix_).c_str(), &runnumber, nullptr);
296 #ifdef ExtendedCALIBTree
297  tree.SetBranchAddress((EventPrefix_ + "TrigTech" + EventSuffix_).c_str(), &TrigTech, nullptr);
298  tree.SetBranchAddress((CalibPrefix_ + "chargeoverpath" + CalibSuffix_).c_str(), &chargeoverpath, nullptr);
299 #endif
300  tree.SetBranchAddress((TrackPrefix_ + "chi2ndof" + TrackSuffix_).c_str(), &trackchi2ndof, nullptr);
301  tree.SetBranchAddress((TrackPrefix_ + "momentum" + TrackSuffix_).c_str(), &trackp, nullptr);
302  tree.SetBranchAddress((TrackPrefix_ + "pt" + TrackSuffix_).c_str(), &trackpt, nullptr);
303  tree.SetBranchAddress((TrackPrefix_ + "eta" + TrackSuffix_).c_str(), &tracketa, nullptr);
304  tree.SetBranchAddress((TrackPrefix_ + "phi" + TrackSuffix_).c_str(), &trackphi, nullptr);
305  tree.SetBranchAddress((TrackPrefix_ + "hitsvalid" + TrackSuffix_).c_str(), &trackhitsvalid, nullptr);
306  tree.SetBranchAddress((TrackPrefix_ + "algo" + TrackSuffix_).c_str(), &trackalgo, nullptr);
307 
308  tree.SetBranchAddress((CalibPrefix_ + "trackindex" + CalibSuffix_).c_str(), &trackindex, nullptr);
309  tree.SetBranchAddress((CalibPrefix_ + "rawid" + CalibSuffix_).c_str(), &rawid, nullptr);
310  tree.SetBranchAddress((CalibPrefix_ + "localdirx" + CalibSuffix_).c_str(), &localdirx, nullptr);
311  tree.SetBranchAddress((CalibPrefix_ + "localdiry" + CalibSuffix_).c_str(), &localdiry, nullptr);
312  tree.SetBranchAddress((CalibPrefix_ + "localdirz" + CalibSuffix_).c_str(), &localdirz, nullptr);
313  tree.SetBranchAddress((CalibPrefix_ + "firststrip" + CalibSuffix_).c_str(), &firststrip, nullptr);
314  tree.SetBranchAddress((CalibPrefix_ + "nstrips" + CalibSuffix_).c_str(), &nstrips, nullptr);
315  tree.SetBranchAddress((CalibPrefix_ + "saturation" + CalibSuffix_).c_str(), &saturation, nullptr);
316  tree.SetBranchAddress((CalibPrefix_ + "overlapping" + CalibSuffix_).c_str(), &overlapping, nullptr);
317  tree.SetBranchAddress((CalibPrefix_ + "farfromedge" + CalibSuffix_).c_str(), &farfromedge, nullptr);
318  tree.SetBranchAddress((CalibPrefix_ + "charge" + CalibSuffix_).c_str(), &charge, nullptr);
319  tree.SetBranchAddress((CalibPrefix_ + "path" + CalibSuffix_).c_str(), &path, nullptr);
320 
321  tree.SetBranchAddress((CalibPrefix_ + "amplitude" + CalibSuffix_).c_str(), &amplitude, nullptr);
322  tree.SetBranchAddress((CalibPrefix_ + "gainused" + CalibSuffix_).c_str(), &gainused, nullptr);
323  tree.SetBranchAddress((CalibPrefix_ + "gainusedTick" + CalibSuffix_).c_str(), &gainusedTick, nullptr);
324 
325  int elepos = statCollectionFromMode(m_calibrationMode.c_str());
326  const auto nEntries = tree.GetEntries();
327  printf("Progressing Bar :0%% 20%% 40%% 60%% 80%% 100%%\n");
328  printf("Looping on the Tree :");
329  const auto treeProgStep = std::max(nEntries / 50, Long64_t(1));
330  for (Long64_t i{0}; i != nEntries; ++i) {
331  if ((i % treeProgStep) == 0) {
332  printf(".");
333  fflush(stdout);
334  }
335  tree.GetEntry(i);
336 
337  unsigned int FirstAmplitude = 0;
338  for (unsigned int i = 0; i < charge->size(); i++) {
339  FirstAmplitude += (*nstrips)[i];
340  int TI = (*trackindex)[i];
341 
342  if ((*tracketa)[TI] < MinTrackEta)
343  continue;
344  if ((*tracketa)[TI] > MaxTrackEta)
345  continue;
346  if ((*trackp)[TI] < MinTrackMomentum)
347  continue;
348  if ((*trackp)[TI] > MaxTrackMomentum)
349  continue;
350  if ((*trackhitsvalid)[TI] < MinTrackHits)
351  continue;
352  if ((*trackchi2ndof)[TI] > MaxTrackChiOverNdf)
353  continue;
354  if ((*trackalgo)[TI] > MaxTrackingIteration)
355  continue;
356 
357  std::shared_ptr<stAPVGain> APV = histograms.APVsColl.at(
358  ((*rawid)[i] << 4) |
359  ((*firststrip)[i] /
360  128)); //works for both strip and pixel thanks to firstStrip encoding for pixel in the calibTree
361 
362  if (APV->SubDet > 2 && (*farfromedge)[i] == false)
363  continue;
364  if (APV->SubDet > 2 && (*overlapping)[i] == true)
365  continue;
366  if (APV->SubDet > 2 && (*saturation)[i] && !AllowSaturation)
367  continue;
368  if (APV->SubDet > 2 && (*nstrips)[i] > MaxNrStrips)
369  continue;
370 
371  int Charge = 0;
372  if (APV->SubDet > 2 && (useCalibration || !FirstSetOfConstants)) {
373  bool Saturation = false;
374  for (unsigned int s = 0; s < (*nstrips)[i]; s++) {
375  int StripCharge = (*amplitude)[FirstAmplitude - (*nstrips)[i] + s];
377  StripCharge = (int)(StripCharge * (APV->PreviousGain / APV->CalibGain));
378  } else if (useCalibration) {
379  StripCharge = (int)(StripCharge / APV->CalibGain);
380  } else if (!FirstSetOfConstants) {
381  StripCharge = (int)(StripCharge * APV->PreviousGain);
382  }
383  if (StripCharge > 1024) {
384  StripCharge = 255;
385  Saturation = true;
386  } else if (StripCharge > 254) {
387  StripCharge = 254;
388  Saturation = true;
389  }
390  Charge += StripCharge;
391  }
392  if (Saturation && !AllowSaturation)
393  continue;
394  } else if (APV->SubDet > 2) {
395  Charge = (*charge)[i];
396  } else {
397  Charge = (*charge)[i] / 265.0; //expected scale factor between pixel and strip charge
398  }
399 
400  double ClusterChargeOverPath = ((double)Charge) / (*path)[i];
401  if (APV->SubDet > 2) {
402  if (Validation) {
403  ClusterChargeOverPath /= (*gainused)[i];
404  }
405  if (OldGainRemoving) {
406  ClusterChargeOverPath *= (*gainused)[i];
407  }
408  }
409 
410  // keep processing of pixel cluster charge until here
411  if (APV->SubDet <= 2)
412  continue;
413 
414  // real histogram for calibration
415  histograms.Charge_Vs_Index[elepos]->Fill(APV->Index, ClusterChargeOverPath);
416  LogDebug("SiStripGainsCalibTreeWorker")
417  << " for mode " << m_calibrationMode << "\n"
418  << " i " << i << " useCalibration " << useCalibration << " FirstSetOfConstants " << FirstSetOfConstants
419  << " APV->PreviousGain " << APV->PreviousGain << " APV->CalibGain " << APV->CalibGain << " APV->DetId "
420  << APV->DetId << " APV->Index " << APV->Index << " Charge " << Charge << " Path " << (*path)[i]
421  << " ClusterChargeOverPath " << ClusterChargeOverPath << std::endl;
422 
423  // Fill monitoring histograms
424  int mCharge1 = 0;
425  int mCharge2 = 0;
426  int mCharge3 = 0;
427  int mCharge4 = 0;
428  if (APV->SubDet > 2) {
429  for (unsigned int s = 0; s < (*nstrips)[i]; s++) {
430  int StripCharge = (*amplitude)[FirstAmplitude - (*nstrips)[i] + s];
431  if (StripCharge > 1024)
432  StripCharge = 255;
433  else if (StripCharge > 254)
434  StripCharge = 254;
435  mCharge1 += StripCharge;
436  mCharge2 += StripCharge;
437  mCharge3 += StripCharge;
438  mCharge4 += StripCharge;
439  }
440  // Revome gains for monitoring
441  mCharge2 *= (*gainused)[i]; // remove G2
442  mCharge3 *= (*gainusedTick)[i]; // remove G1
443  mCharge4 *= ((*gainused)[i] * (*gainusedTick)[i]); // remove G1 and G2
444  }
445 
446  LogDebug("SiStripGainsCalibTreeWorker")
447  << " full charge " << mCharge1 << " remove G2 " << mCharge2 << " remove G1 " << mCharge3 << " remove G1*G2 "
448  << mCharge4 << std::endl;
449 
450  auto indices = APVGain::FetchIndices(theTopologyMap, (*rawid)[i], topo);
451 
452  for (auto m : indices)
453  histograms.Charge_1[elepos][m]->Fill(((double)mCharge1) / (*path)[i]);
454  for (auto m : indices)
455  histograms.Charge_2[elepos][m]->Fill(((double)mCharge2) / (*path)[i]);
456  for (auto m : indices)
457  histograms.Charge_3[elepos][m]->Fill(((double)mCharge3) / (*path)[i]);
458  for (auto m : indices)
459  histograms.Charge_4[elepos][m]->Fill(((double)mCharge4) / (*path)[i]);
460 
461  if (APV->SubDet == StripSubdetector::TIB) {
462  histograms.Charge_Vs_PathlengthTIB[elepos]->Fill((*path)[i], Charge); // TIB
463 
464  } else if (APV->SubDet == StripSubdetector::TOB) {
465  histograms.Charge_Vs_PathlengthTOB[elepos]->Fill((*path)[i], Charge); // TOB
466 
467  } else if (APV->SubDet == StripSubdetector::TID) {
468  if (APV->Eta < 0) {
469  histograms.Charge_Vs_PathlengthTIDM[elepos]->Fill((*path)[i], Charge);
470  } // TID minus
471  else if (APV->Eta > 0) {
472  histograms.Charge_Vs_PathlengthTIDP[elepos]->Fill((*path)[i], Charge);
473  } // TID plus
474 
475  } else if (APV->SubDet == StripSubdetector::TEC) {
476  if (APV->Eta < 0) {
477  if (APV->Thickness < 0.04) {
478  histograms.Charge_Vs_PathlengthTECM1[elepos]->Fill((*path)[i], Charge);
479  } // TEC minus, type 1
480  else if (APV->Thickness > 0.04) {
481  histograms.Charge_Vs_PathlengthTECM2[elepos]->Fill((*path)[i], Charge);
482  } // TEC minus, type 2
483  } else if (APV->Eta > 0) {
484  if (APV->Thickness < 0.04) {
485  histograms.Charge_Vs_PathlengthTECP1[elepos]->Fill((*path)[i], Charge);
486  } // TEC plus, type 1
487  else if (APV->Thickness > 0.04) {
488  histograms.Charge_Vs_PathlengthTECP2[elepos]->Fill((*path)[i], Charge);
489  } // TEC plus, type 2
490  }
491  }
492 
493  } // END OF ON-CLUSTER LOOP
494 
495  //LogDebug("SiStripGainsCalibTreeWorker")<<" for mode"<< m_calibrationMode
496  // <<" entries in histogram:"<< histograms.Charge_Vs_Index[elepos].getEntries()
497 
498  // <<std::endl;
499  }
500 
501  hasProcessed_ = true;
502  }
503 }
static constexpr auto TEC
std::vector< unsigned int > FetchIndices(std::map< unsigned int, APVloc >, uint32_t, const TrackerTopology *topo=nullptr)
std::map< unsigned int, APVloc > theTopologyMap
int statCollectionFromMode(const char *tag) const
static constexpr auto TOB
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
static constexpr auto TIB
std::vector< std::string > calibTreeFileNames_
Definition: tree.py:1
static constexpr auto TID
#define LogDebug(id)

◆ dqmBeginRun()

void SiStripGainsCalibTreeWorker::dqmBeginRun ( edm::Run const &  run,
edm::EventSetup const &  iSetup,
APVGain::APVGainHistograms histograms 
) const
overrideprivatevirtual

Reimplemented from DQMGlobalEDAnalyzerBase< APVGain::APVGainHistograms, Args... >.

Definition at line 193 of file SiStripGainsCalibTreeWorker.cc.

References a, sistrip::APV, checkBookAPVColls(), beamvalidation::exit(), gainToken_, edm::EventSetup::getData(), edm::EventSetup::getHandle(), PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, qualityToken_, mps_setup::stdout, and tkGeomTokenBR_.

195  {
196  using namespace edm;
197 
198  // fills the APV collections at each begin run
199  const TrackerGeometry* bareTkGeomPtr = &iSetup.getData(tkGeomTokenBR_);
200  checkBookAPVColls(bareTkGeomPtr, histograms);
201 
202  const auto gainHandle = iSetup.getHandle(gainToken_);
203  if (!gainHandle.isValid()) {
204  edm::LogError("SiStripGainPCLWorker") << "gainHandle is not valid\n";
205  exit(0);
206  }
207 
208  const auto& SiStripQuality_ = &iSetup.getData(qualityToken_);
209 
210  for (unsigned int a = 0; a < histograms.APVsCollOrdered.size(); a++) {
211  std::shared_ptr<stAPVGain> APV = histograms.APVsCollOrdered[a];
212 
214  continue;
215 
216  APV->isMasked = SiStripQuality_->IsApvBad(APV->DetId, APV->APVId);
217 
218  if (gainHandle->getNumberOfTags() != 2) {
219  edm::LogError("SiStripGainPCLWorker") << "NUMBER OF GAIN TAG IS EXPECTED TO BE 2\n";
220  fflush(stdout);
221  exit(0);
222  };
223  float newPreviousGain = gainHandle->getApvGain(APV->APVId, gainHandle->getRange(APV->DetId, 1), 1);
224  if (APV->PreviousGain != 1 and newPreviousGain != APV->PreviousGain)
225  edm::LogWarning("SiStripGainPCLWorker") << "WARNING: ParticleGain in the global tag changed\n";
226  APV->PreviousGain = newPreviousGain;
227 
228  float newPreviousGainTick = gainHandle->getApvGain(APV->APVId, gainHandle->getRange(APV->DetId, 0), 0);
229  if (APV->PreviousGainTick != 1 and newPreviousGainTick != APV->PreviousGainTick) {
230  edm::LogWarning("SiStripGainPCLWorker")
231  << "WARNING: TickMarkGain in the global tag changed\n"
232  << std::endl
233  << " APV->SubDet: " << APV->SubDet << " APV->APVId:" << APV->APVId << std::endl
234  << " APV->PreviousGainTick: " << APV->PreviousGainTick << " newPreviousGainTick: " << newPreviousGainTick
235  << std::endl;
236  }
237  APV->PreviousGainTick = newPreviousGainTick;
238  }
239 }
edm::ESGetToken< SiStripGain, SiStripGainRcd > gainToken_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomTokenBR_
Log< level::Error, false > LogError
edm::ESGetToken< SiStripQuality, SiStripQualityRcd > qualityToken_
HLT enums.
double a
Definition: hdecay.h:121
Log< level::Warning, false > LogWarning
void checkBookAPVColls(const TrackerGeometry *bareTkGeomPtr, APVGain::APVGainHistograms &histograms) const
def exit(msg="")

◆ fillDescriptions()

void SiStripGainsCalibTreeWorker::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 615 of file SiStripGainsCalibTreeWorker.cc.

References edm::ConfigurationDescriptions::addDefault(), and submitPVResolutionJobs::desc.

615  {
617  desc.setUnknown();
618  descriptions.addDefault(desc);
619 }
void addDefault(ParameterSetDescription const &psetDescription)

◆ statCollectionFromMode()

int SiStripGainsCalibTreeWorker::statCollectionFromMode ( const char *  tag) const
inlineprivate

Definition at line 109 of file SiStripGainsCalibTreeWorker.cc.

References dqm_tag_, relativeConstraints::empty, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, None, AlCaHLTBitMon_QueryRunRegistry::string, and makeGlobalPositionRcd_cfg::tag.

Referenced by bookHistograms(), and dqmAnalyze().

109  {
110  std::vector<std::string>::const_iterator it = dqm_tag_.begin();
111  while (it != dqm_tag_.end()) {
112  if (*it == std::string(tag))
113  return it - dqm_tag_.begin();
114  it++;
115  }
116 
117  if (std::string(tag).empty())
118  return 0; // return StdBunch calibration mode for backward compatibility
119 
120  return None;
121 }
std::vector< std::string > dqm_tag_

Member Data Documentation

◆ AllowSaturation

bool SiStripGainsCalibTreeWorker::AllowSaturation
private

Definition at line 78 of file SiStripGainsCalibTreeWorker.cc.

Referenced by dqmAnalyze(), and SiStripGainsCalibTreeWorker().

◆ CalibPrefix_

std::string SiStripGainsCalibTreeWorker::CalibPrefix_
private

Definition at line 98 of file SiStripGainsCalibTreeWorker.cc.

Referenced by dqmAnalyze(), and SiStripGainsCalibTreeWorker().

◆ CalibSuffix_

std::string SiStripGainsCalibTreeWorker::CalibSuffix_
private

Definition at line 99 of file SiStripGainsCalibTreeWorker.cc.

Referenced by dqmAnalyze(), and SiStripGainsCalibTreeWorker().

◆ calibTreeFileNames_

std::vector<std::string> SiStripGainsCalibTreeWorker::calibTreeFileNames_
private

Definition at line 101 of file SiStripGainsCalibTreeWorker.cc.

Referenced by dqmAnalyze(), and SiStripGainsCalibTreeWorker().

◆ calibTreeName_

std::string SiStripGainsCalibTreeWorker::calibTreeName_
private

Definition at line 100 of file SiStripGainsCalibTreeWorker.cc.

Referenced by dqmAnalyze(), and SiStripGainsCalibTreeWorker().

◆ doChargeMonitorPerPlane

bool SiStripGainsCalibTreeWorker::doChargeMonitorPerPlane
private

Charge monitor per detector plane

Definition at line 83 of file SiStripGainsCalibTreeWorker.cc.

Referenced by bookHistograms(), and SiStripGainsCalibTreeWorker().

◆ dqm_tag_

std::vector<std::string> SiStripGainsCalibTreeWorker::dqm_tag_
private

◆ EventPrefix_

std::string SiStripGainsCalibTreeWorker::EventPrefix_
private

Definition at line 94 of file SiStripGainsCalibTreeWorker.cc.

Referenced by dqmAnalyze(), and SiStripGainsCalibTreeWorker().

◆ EventSuffix_

std::string SiStripGainsCalibTreeWorker::EventSuffix_
private

Definition at line 95 of file SiStripGainsCalibTreeWorker.cc.

Referenced by dqmAnalyze(), and SiStripGainsCalibTreeWorker().

◆ FirstSetOfConstants

bool SiStripGainsCalibTreeWorker::FirstSetOfConstants
private

Definition at line 79 of file SiStripGainsCalibTreeWorker.cc.

Referenced by dqmAnalyze(), and SiStripGainsCalibTreeWorker().

◆ gainToken_

edm::ESGetToken<SiStripGain, SiStripGainRcd> SiStripGainsCalibTreeWorker::gainToken_
private

Definition at line 105 of file SiStripGainsCalibTreeWorker.cc.

Referenced by dqmBeginRun(), and SiStripGainsCalibTreeWorker().

◆ hasProcessed_

bool SiStripGainsCalibTreeWorker::hasProcessed_
mutableprivate

Definition at line 85 of file SiStripGainsCalibTreeWorker.cc.

Referenced by dqmAnalyze(), and SiStripGainsCalibTreeWorker().

◆ m_calibrationMode

std::string SiStripGainsCalibTreeWorker::m_calibrationMode
private

Type of statistics for the calibration

Definition at line 88 of file SiStripGainsCalibTreeWorker.cc.

Referenced by bookHistograms(), dqmAnalyze(), and SiStripGainsCalibTreeWorker().

◆ m_DQMdir

std::string SiStripGainsCalibTreeWorker::m_DQMdir
private

DQM folder hosting the charge statistics and the monitor plots

Definition at line 87 of file SiStripGainsCalibTreeWorker.cc.

Referenced by bookHistograms(), and SiStripGainsCalibTreeWorker().

◆ MaxNrStrips

unsigned int SiStripGainsCalibTreeWorker::MaxNrStrips
private

Definition at line 74 of file SiStripGainsCalibTreeWorker.cc.

Referenced by dqmAnalyze(), and SiStripGainsCalibTreeWorker().

◆ MaxTrackChiOverNdf

double SiStripGainsCalibTreeWorker::MaxTrackChiOverNdf
private

Definition at line 76 of file SiStripGainsCalibTreeWorker.cc.

Referenced by dqmAnalyze(), and SiStripGainsCalibTreeWorker().

◆ MaxTrackEta

double SiStripGainsCalibTreeWorker::MaxTrackEta
private

Definition at line 73 of file SiStripGainsCalibTreeWorker.cc.

Referenced by dqmAnalyze(), and SiStripGainsCalibTreeWorker().

◆ MaxTrackingIteration

int SiStripGainsCalibTreeWorker::MaxTrackingIteration
private

Definition at line 77 of file SiStripGainsCalibTreeWorker.cc.

Referenced by dqmAnalyze(), and SiStripGainsCalibTreeWorker().

◆ MaxTrackMomentum

double SiStripGainsCalibTreeWorker::MaxTrackMomentum
private

Definition at line 71 of file SiStripGainsCalibTreeWorker.cc.

Referenced by dqmAnalyze(), and SiStripGainsCalibTreeWorker().

◆ MinTrackEta

double SiStripGainsCalibTreeWorker::MinTrackEta
private

Definition at line 72 of file SiStripGainsCalibTreeWorker.cc.

Referenced by dqmAnalyze(), and SiStripGainsCalibTreeWorker().

◆ MinTrackHits

unsigned int SiStripGainsCalibTreeWorker::MinTrackHits
private

Definition at line 75 of file SiStripGainsCalibTreeWorker.cc.

Referenced by dqmAnalyze(), and SiStripGainsCalibTreeWorker().

◆ MinTrackMomentum

double SiStripGainsCalibTreeWorker::MinTrackMomentum
private

Definition at line 70 of file SiStripGainsCalibTreeWorker.cc.

Referenced by dqmAnalyze(), and SiStripGainsCalibTreeWorker().

◆ OldGainRemoving

bool SiStripGainsCalibTreeWorker::OldGainRemoving
private

Definition at line 81 of file SiStripGainsCalibTreeWorker.cc.

Referenced by dqmAnalyze(), and SiStripGainsCalibTreeWorker().

◆ qualityToken_

edm::ESGetToken<SiStripQuality, SiStripQualityRcd> SiStripGainsCalibTreeWorker::qualityToken_
private

Definition at line 106 of file SiStripGainsCalibTreeWorker.cc.

Referenced by dqmBeginRun(), and SiStripGainsCalibTreeWorker().

◆ theTopologyMap

std::map<unsigned int, APVloc> SiStripGainsCalibTreeWorker::theTopologyMap
private

Definition at line 92 of file SiStripGainsCalibTreeWorker.cc.

Referenced by dqmAnalyze(), and SiStripGainsCalibTreeWorker().

◆ tkGeomToken_

edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> SiStripGainsCalibTreeWorker::tkGeomToken_
private

Definition at line 104 of file SiStripGainsCalibTreeWorker.cc.

◆ tkGeomTokenBR_

edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> SiStripGainsCalibTreeWorker::tkGeomTokenBR_
private

Definition at line 104 of file SiStripGainsCalibTreeWorker.cc.

Referenced by dqmBeginRun(), and SiStripGainsCalibTreeWorker().

◆ TrackPrefix_

std::string SiStripGainsCalibTreeWorker::TrackPrefix_
private

Definition at line 96 of file SiStripGainsCalibTreeWorker.cc.

Referenced by dqmAnalyze(), and SiStripGainsCalibTreeWorker().

◆ TrackSuffix_

std::string SiStripGainsCalibTreeWorker::TrackSuffix_
private

Definition at line 97 of file SiStripGainsCalibTreeWorker.cc.

Referenced by dqmAnalyze(), and SiStripGainsCalibTreeWorker().

◆ tTopoToken_

edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> SiStripGainsCalibTreeWorker::tTopoToken_
private

Definition at line 103 of file SiStripGainsCalibTreeWorker.cc.

Referenced by dqmAnalyze(), and SiStripGainsCalibTreeWorker().

◆ useCalibration

bool SiStripGainsCalibTreeWorker::useCalibration
private

Definition at line 82 of file SiStripGainsCalibTreeWorker.cc.

Referenced by dqmAnalyze(), and SiStripGainsCalibTreeWorker().

◆ Validation

bool SiStripGainsCalibTreeWorker::Validation
private

Definition at line 80 of file SiStripGainsCalibTreeWorker.cc.

Referenced by dqmAnalyze(), and SiStripGainsCalibTreeWorker().

◆ VChargeHisto

std::vector<std::string> SiStripGainsCalibTreeWorker::VChargeHisto
private

Charge monitor plots to be output

Definition at line 89 of file SiStripGainsCalibTreeWorker.cc.

Referenced by bookHistograms(), and SiStripGainsCalibTreeWorker().