CMS 3D CMS Logo

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

#include <DPGAnalysis/SiStripTools/plugins/CommonModeAnalyzer.cc>

Inheritance diagram for CommonModeAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 CommonModeAnalyzer (const edm::ParameterSet &)
 
 ~CommonModeAnalyzer () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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
 
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::vector< ModuleDescription const * > &modules, 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
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void beginRun (const edm::Run &, const edm::EventSetup &) override
 
void endJob () override
 
void endRun (const edm::Run &, const edm::EventSetup &) override
 
void updateDetCabling (const edm::EventSetup &setup)
 

Private Attributes

edm::EDGetTokenT< APVCyclePhaseCollectionm_apvphasecollToken
 
uint32_t m_cacheIdDet
 DB cache ID used to establish if the cabling has changed during the run. More...
 
std::vector< TH1D * > m_cmdist
 
std::vector< TProfile ** > m_cmvsbxrun
 
std::vector< TProfile * > m_cmvsdbxincycle
 
std::vector< TProfile ** > m_cmvsorbitrun
 
const SiStripDetCablingm_detCabling
 The cabling object. More...
 
edm::EDGetTokenT< DetIdCollectionm_digibadmodulecollectionToken
 
edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > m_digicollectionToken
 
edm::EDGetTokenT< EventWithHistorym_historyProductToken
 
const bool m_ignorebadfedmod
 
const bool m_ignorenotconnected
 
std::vector< std::string > m_labels
 
std::vector< TH1D * > m_napvs
 
int m_nevents
 
std::vector< TH1D * > m_nmodules
 
const std::string m_phasepart
 
RunHistogramManager m_rhm
 
std::vector< DetIdSelectorm_selections
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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)
 

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 66 of file CommonModeAnalyzer.cc.

Constructor & Destructor Documentation

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

Definition at line 120 of file CommonModeAnalyzer.cc.

References edm::ParameterSet::getParameter(), diffTwoXMLs::label, m_cmdist, m_cmvsbxrun, m_cmvsdbxincycle, m_cmvsorbitrun, m_napvs, m_nmodules, m_rhm, m_selections, TFileService::make(), RunHistogramManager::makeTProfile(), corrVsCorr::selection, and AlCaHLTBitMon_QueryRunRegistry::string.

120  :
122  m_historyProductToken(consumes<EventWithHistory>(iConfig.getParameter<edm::InputTag>("historyProduct"))),
123  m_apvphasecollToken(consumes<APVCyclePhaseCollection>(iConfig.getParameter<edm::InputTag>("apvPhaseCollection"))),
124  m_digibadmodulecollectionToken(consumes<DetIdCollection>(iConfig.getParameter<edm::InputTag>("badModuleDigiCollection"))),
125  m_phasepart(iConfig.getUntrackedParameter<std::string>("phasePartition","None")),
126  m_ignorebadfedmod(iConfig.getParameter<bool>("ignoreBadFEDMod")),
127  m_ignorenotconnected(iConfig.getParameter<bool>("ignoreNotConnected")),
128  m_nevents(0),
129  m_selections(),
130  m_labels(),
131  m_cmdist(),
132  m_nmodules(),
133  m_napvs(),
135  m_cmvsbxrun(),
136  m_cmvsorbitrun(),
138  m_cacheIdDet(0),
139  m_detCabling(nullptr)
140 {
141  //now do what ever initialization is needed
142 
144 
145  std::vector<edm::ParameterSet> selconfigs = iConfig.getParameter<std::vector<edm::ParameterSet> >("selections");
146 
147  for(std::vector<edm::ParameterSet>::const_iterator selconfig=selconfigs.begin();selconfig!=selconfigs.end();++selconfig) {
148  std::string label = selconfig->getParameter<std::string>("label");
149  DetIdSelector selection(*selconfig);
150  m_selections.push_back(selection);
151 
152  {
153  std::string hname = label + "_CommonMode";
154  std::string htitle = label + " Common Mode";
155  m_cmdist.push_back(tfserv->make<TH1D>(hname.c_str(),htitle.c_str(),1024,-0.5,1024-0.5));
156  m_cmdist.back()->GetXaxis()->SetTitle("ADC");
157  }
158  {
159  std::string hname = label + "_nmodules";
160  std::string htitle = label + " Number of Modules with CM value";
161  m_nmodules.push_back(tfserv->make<TH1D>(hname.c_str(),htitle.c_str(),20000,-0.5,20000-0.5));
162  m_nmodules.back()->GetXaxis()->SetTitle("#modules");
163  }
164  {
165  std::string hname = label + "_napvs";
166  std::string htitle = label + " Number of APVs with CM value";
167  m_napvs.push_back(tfserv->make<TH1D>(hname.c_str(),htitle.c_str(),2000,-0.5,80000-0.5));
168  m_napvs.back()->GetXaxis()->SetTitle("#apvs");
169  }
170  {
171  std::string hname = label + "_CMvsDBXinCycle";
172  std::string htitle = label + " Common Mode vs DBX in Cycle";
173  m_cmvsdbxincycle.push_back(tfserv->make<TProfile>(hname.c_str(),htitle.c_str(),1000,-0.5,1000-0.5));
174  m_cmvsdbxincycle.back()->GetXaxis()->SetTitle("DBX in cycle"); m_cmvsdbxincycle.back()->GetYaxis()->SetTitle("CM (ADC counts)");
175  }
176  {
177  std::string hname = label + "_CMvsBX";
178  std::string htitle = label + " Common Mode vs BX";
179  m_cmvsbxrun.push_back(m_rhm.makeTProfile(hname.c_str(),htitle.c_str(),3565,-0.5,3565-0.5));
180  }
181  {
182  std::string hname = label + "_CMvsOrbit";
183  std::string htitle = label + " Common Mode vs Orbit";
184  m_cmvsorbitrun.push_back(m_rhm.makeTProfile(hname.c_str(),htitle.c_str(),4*500,0,500*262144));
185  }
186  }
187 
188 }
std::vector< TH1D * > m_nmodules
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::vector< TProfile ** > m_cmvsbxrun
std::vector< TH1D * > m_cmdist
selection
main part
Definition: corrVsCorr.py:98
const SiStripDetCabling * m_detCabling
The cabling object.
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
uint32_t m_cacheIdDet
DB cache ID used to establish if the cabling has changed during the run.
const std::string m_phasepart
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const bool m_ignorenotconnected
std::vector< TProfile ** > m_cmvsorbitrun
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
TProfile ** makeTProfile(const char *name, const char *title, const unsigned int nbinx, const double xmin, const double xmax)
edm::EDGetTokenT< EventWithHistory > m_historyProductToken
RunHistogramManager m_rhm
edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > m_digicollectionToken
std::vector< std::string > m_labels
std::vector< DetIdSelector > m_selections
std::vector< TProfile * > m_cmvsdbxincycle
edm::EDGetTokenT< DetIdCollection > m_digibadmodulecollectionToken
std::vector< TH1D * > m_napvs
edm::EDGetTokenT< APVCyclePhaseCollection > m_apvphasecollToken
CommonModeAnalyzer::~CommonModeAnalyzer ( )
override

Definition at line 191 of file CommonModeAnalyzer.cc.

192 {
193 
194  // do anything here that needs to be done at desctruction time
195  // (e.g. close files, deallocate resources etc.)
196 
197 
198 
199 
200 }

Member Function Documentation

void CommonModeAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 209 of file CommonModeAnalyzer.cc.

References edm::EDCollection< T >::begin(), edm::EventBase::bunchCrossing(), EventWithHistory::deltaBXinCycle(), edm::EDCollection< T >::end(), edm::HandleBase::failedToGet(), HcalObjRepresent::Fill(), spr::find(), edm::Event::getByToken(), SiStripDetCabling::getConnections(), APVCyclePhaseCollection::getPhase(), hcalSimParameters_cfi::he, APVCyclePhaseCollection::invalid, edm::HandleBase::isValid(), LogDebug, m_apvphasecollToken, m_cmdist, m_cmvsbxrun, m_cmvsdbxincycle, m_cmvsorbitrun, m_detCabling, m_digibadmodulecollectionToken, m_digicollectionToken, m_historyProductToken, m_ignorebadfedmod, m_ignorenotconnected, m_napvs, m_nevents, m_nmodules, m_phasepart, m_selections, mod(), APVCyclePhaseCollection::multiphase, APVCyclePhaseCollection::nopartition, edm::EventBase::orbitNumber(), digi_MixPreMix_cfi::strip, and updateDetCabling().

210 {
211  using namespace edm;
212 
213  updateDetCabling( iSetup );
214 
215  m_nevents++;
216 
219 
221  iEvent.getByToken(m_apvphasecollToken,apvphase);
222 
223  Handle<DetIdCollection > badmodules;
224  iEvent.getByToken(m_digibadmodulecollectionToken,badmodules);
225 
226  int thephase = APVCyclePhaseCollection::invalid;
227  if(apvphase.isValid() && !apvphase.failedToGet()) {
228  thephase = apvphase->getPhase(m_phasepart);
229  }
230  bool isphaseok = (thephase!=APVCyclePhaseCollection::invalid &&
233 
235  iEvent.getByToken(m_digicollectionToken,digis);
236 
237  // loop on detector with digis
238 
239  std::vector<int> nmodules(m_selections.size(),0);
240  std::vector<int> napvs(m_selections.size(),0);
241 
242  for(edm::DetSetVector<SiStripRawDigi>::const_iterator mod = digis->begin();mod!=digis->end();mod++) {
243 
244  std::vector<const FedChannelConnection*> conns = m_detCabling->getConnections(mod->detId());
245 
246  if(!m_ignorebadfedmod || std::find(badmodules->begin(),badmodules->end(),mod->detId())==badmodules->end()) {
247  for(unsigned int isel=0;isel< m_selections.size(); ++isel) {
248  if(m_selections[isel].isSelected(mod->detId())) {
249  unsigned int strip = 0;
250  ++nmodules[isel];
251  for(edm::DetSet<SiStripRawDigi>::const_iterator digi=mod->begin();digi!=mod->end();digi++,strip++) {
252  LogDebug("StripNumber") << "Strip number " << strip;
253  if(!m_ignorenotconnected ||
254  ((conns.size() > strip/2) && conns[strip/2] && conns[strip/2]->isConnected())) {
255  ++napvs[isel];
256  m_cmdist[isel]->Fill(digi->adc());
257  if(isphaseok) m_cmvsdbxincycle[isel]->Fill(he->deltaBXinCycle(thephase),digi->adc());
258  if(m_cmvsbxrun[isel] && *(m_cmvsbxrun[isel])) (*(m_cmvsbxrun[isel]))->Fill(iEvent.bunchCrossing(),digi->adc());
259  if(m_cmvsorbitrun[isel] && *(m_cmvsorbitrun[isel])) (*(m_cmvsorbitrun[isel]))->Fill(iEvent.orbitNumber(),digi->adc());
260  }
261  else if(digi->adc()>0) {
262  edm::LogWarning("NonZeroCMWhenDisconnected") << " Non zero CM in "
263  << mod->detId() << " APV " << strip
264  << " with " << conns.size()
265  << " connections and connection pointer" << conns[strip/2];
266  }
267  }
268  }
269  }
270  }
271  }
272  for(unsigned int isel=0;isel < m_selections.size(); ++isel) {
273  m_nmodules[isel]->Fill(nmodules[isel]);
274  m_napvs[isel]->Fill(napvs[isel]);
275  }
276 }
#define LogDebug(id)
std::vector< TH1D * > m_nmodules
void updateDetCabling(const edm::EventSetup &setup)
std::vector< TProfile ** > m_cmvsbxrun
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
std::vector< TH1D * > m_cmdist
const_iterator end() const
Definition: EDCollection.h:153
int bunchCrossing() const
Definition: EventBase.h:66
const SiStripDetCabling * m_detCabling
The cabling object.
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
const std::string m_phasepart
const std::vector< const FedChannelConnection * > & getConnections(uint32_t det_id) const
const bool m_ignorenotconnected
const int getPhase(const std::string partition) const
std::vector< TProfile ** > m_cmvsorbitrun
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
edm::EDGetTokenT< EventWithHistory > m_historyProductToken
int orbitNumber() const
Definition: EventBase.h:67
bool isValid() const
Definition: HandleBase.h:74
edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > m_digicollectionToken
bool failedToGet() const
Definition: HandleBase.h:78
const_iterator begin() const
Definition: EDCollection.h:146
std::vector< DetIdSelector > m_selections
long long deltaBXinCycle(const unsigned int ev2, const unsigned int ev1, const int bx0) const
HLT enums.
std::vector< TProfile * > m_cmvsdbxincycle
edm::EDGetTokenT< DetIdCollection > m_digibadmodulecollectionToken
collection_type::const_iterator const_iterator
Definition: DetSet.h:33
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:104
std::vector< TH1D * > m_napvs
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
edm::EDGetTokenT< APVCyclePhaseCollection > m_apvphasecollToken
void CommonModeAnalyzer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 307 of file CommonModeAnalyzer.cc.

308 {
309 
310 }
void CommonModeAnalyzer::beginRun ( const edm::Run iRun,
const edm::EventSetup  
)
overrideprivate

Definition at line 279 of file CommonModeAnalyzer.cc.

References RunHistogramManager::beginRun(), m_cmvsbxrun, m_cmvsorbitrun, and m_rhm.

280 {
281 
282 
283  m_rhm.beginRun(iRun);
284 
285  for(std::vector<TProfile**>::const_iterator cmvsbx=m_cmvsbxrun.begin();cmvsbx!=m_cmvsbxrun.end();++cmvsbx) {
286  if(*cmvsbx && *(*cmvsbx)) {
287  (*(*cmvsbx))->GetXaxis()->SetTitle("BX"); (*(*cmvsbx))->GetYaxis()->SetTitle("CM (ADC counts)");
288  }
289  }
290  for(std::vector<TProfile**>::const_iterator cmvsorbit=m_cmvsorbitrun.begin();cmvsorbit!=m_cmvsorbitrun.end();++cmvsorbit) {
291  if(*cmvsorbit && *(*cmvsorbit)) {
292  (*(*cmvsorbit))->GetXaxis()->SetTitle("orbit"); (*(*cmvsorbit))->GetYaxis()->SetTitle("CM (ADC counts)");
293  (*(*cmvsorbit))->SetCanExtend(TH1::kXaxis);
294  }
295  }
296 
297 }
std::vector< TProfile ** > m_cmvsbxrun
std::vector< TProfile ** > m_cmvsorbitrun
RunHistogramManager m_rhm
void beginRun(const edm::Run &iRun)
void CommonModeAnalyzer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 314 of file CommonModeAnalyzer.cc.

References m_nevents.

314  {
315 
316  edm::LogInfo("EndOfJob") << m_nevents << " analyzed events";
317 
318 }
void CommonModeAnalyzer::endRun ( const edm::Run iRun,
const edm::EventSetup  
)
overrideprivate

Definition at line 300 of file CommonModeAnalyzer.cc.

301 {
302 }
void CommonModeAnalyzer::updateDetCabling ( const edm::EventSetup setup)
private

Definition at line 319 of file CommonModeAnalyzer.cc.

References EnergyCorrector::c, DEFINE_FWK_MODULE, edm::EventSetup::get(), m_cacheIdDet, m_detCabling, and edm::ESHandle< T >::product().

Referenced by analyze().

320 {
321  uint32_t cache_id = setup.get<SiStripDetCablingRcd>().cacheIdentifier();//.get( cabling_ );
322 
323  if ( m_cacheIdDet != cache_id ) { // If the cache ID has changed since the last update...
324  // Update the cabling object
326  setup.get<SiStripDetCablingRcd>().get( c );
327  m_detCabling = c.product();
328  m_cacheIdDet = cache_id;
329  } // end of new cache ID check
330 }
const SiStripDetCabling * m_detCabling
The cabling object.
uint32_t m_cacheIdDet
DB cache ID used to establish if the cabling has changed during the run.
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86

Member Data Documentation

edm::EDGetTokenT<APVCyclePhaseCollection> CommonModeAnalyzer::m_apvphasecollToken
private

Definition at line 85 of file CommonModeAnalyzer.cc.

Referenced by analyze().

uint32_t CommonModeAnalyzer::m_cacheIdDet
private

DB cache ID used to establish if the cabling has changed during the run.

Definition at line 103 of file CommonModeAnalyzer.cc.

Referenced by updateDetCabling().

std::vector<TH1D*> CommonModeAnalyzer::m_cmdist
private

Definition at line 94 of file CommonModeAnalyzer.cc.

Referenced by analyze(), and CommonModeAnalyzer().

std::vector<TProfile**> CommonModeAnalyzer::m_cmvsbxrun
private

Definition at line 98 of file CommonModeAnalyzer.cc.

Referenced by analyze(), beginRun(), and CommonModeAnalyzer().

std::vector<TProfile*> CommonModeAnalyzer::m_cmvsdbxincycle
private

Definition at line 97 of file CommonModeAnalyzer.cc.

Referenced by analyze(), and CommonModeAnalyzer().

std::vector<TProfile**> CommonModeAnalyzer::m_cmvsorbitrun
private

Definition at line 99 of file CommonModeAnalyzer.cc.

Referenced by analyze(), beginRun(), and CommonModeAnalyzer().

const SiStripDetCabling* CommonModeAnalyzer::m_detCabling
private

The cabling object.

Definition at line 104 of file CommonModeAnalyzer.cc.

Referenced by analyze(), and updateDetCabling().

edm::EDGetTokenT<DetIdCollection> CommonModeAnalyzer::m_digibadmodulecollectionToken
private

Definition at line 86 of file CommonModeAnalyzer.cc.

Referenced by analyze().

edm::EDGetTokenT<edm::DetSetVector<SiStripRawDigi> > CommonModeAnalyzer::m_digicollectionToken
private

Definition at line 83 of file CommonModeAnalyzer.cc.

Referenced by analyze().

edm::EDGetTokenT<EventWithHistory> CommonModeAnalyzer::m_historyProductToken
private

Definition at line 84 of file CommonModeAnalyzer.cc.

Referenced by analyze().

const bool CommonModeAnalyzer::m_ignorebadfedmod
private

Definition at line 88 of file CommonModeAnalyzer.cc.

Referenced by analyze().

const bool CommonModeAnalyzer::m_ignorenotconnected
private

Definition at line 89 of file CommonModeAnalyzer.cc.

Referenced by analyze().

std::vector<std::string> CommonModeAnalyzer::m_labels
private

Definition at line 93 of file CommonModeAnalyzer.cc.

std::vector<TH1D*> CommonModeAnalyzer::m_napvs
private

Definition at line 96 of file CommonModeAnalyzer.cc.

Referenced by analyze(), and CommonModeAnalyzer().

int CommonModeAnalyzer::m_nevents
private

Definition at line 90 of file CommonModeAnalyzer.cc.

Referenced by analyze(), and endJob().

std::vector<TH1D*> CommonModeAnalyzer::m_nmodules
private

Definition at line 95 of file CommonModeAnalyzer.cc.

Referenced by analyze(), and CommonModeAnalyzer().

const std::string CommonModeAnalyzer::m_phasepart
private

Definition at line 87 of file CommonModeAnalyzer.cc.

Referenced by analyze().

RunHistogramManager CommonModeAnalyzer::m_rhm
private

Definition at line 101 of file CommonModeAnalyzer.cc.

Referenced by beginRun(), and CommonModeAnalyzer().

std::vector<DetIdSelector> CommonModeAnalyzer::m_selections
private

Definition at line 92 of file CommonModeAnalyzer.cc.

Referenced by analyze(), and CommonModeAnalyzer().