CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DigiCollectionProfiler.cc
Go to the documentation of this file.
1 //#include <vector>
3 #include "TH2F.h"
4 #include "TProfile.h"
11 
13 
15  m_nevent(0),
16  m_tibprof(0),m_tobprof(0),m_tecpprof(0),m_tecmprof(0),
17  m_tib2d(0),m_tob2d(0),m_tecp2d(0),m_tecm2d(0),m_maskedmod() { }
18 
20  TProfile* tobprof,
21  TProfile* tecpprof,
22  TProfile* tecmprof,
23  TH2F* tib2d,
24  TH2F* tob2d,
25  TH2F* tecp2d,
26  TH2F* tecm2d):
27  m_nevent(0),
28  m_tibprof(tibprof),m_tobprof(tobprof),m_tecpprof(tecpprof),m_tecmprof(tecmprof),
29  m_tib2d(tib2d),m_tob2d(tob2d),m_tecp2d(tecp2d),m_tecm2d(tecm2d),m_maskedmod() { }
30 
32 
33  m_nevent++;
34 
35  for(edm::DetSetVector<SiStripDigi>::const_iterator mod = digis->begin();mod!=digis->end();mod++) {
36 
37  const SiStripDetId detid(mod->detId());
38 
39  if(!ismasked(detid)) {
40  TProfile* tobefilledprof=0;
41  TH2F* tobefilled2d=0;
42  if(detid.subDetector()==SiStripDetId::TIB || detid.subDetector()==SiStripDetId::TID) {
43  tobefilledprof=m_tibprof;
44  tobefilled2d=m_tib2d;
45  }
46  else if(detid.subDetector()==SiStripDetId::TOB) {
47  tobefilledprof=m_tobprof;
48  tobefilled2d=m_tob2d;
49  }
50  else if(detid.subDetector()==SiStripDetId::TEC) {
51  const TECDetId tecid(detid);
52  if(tecid.side()==1) {
53  tobefilledprof=m_tecpprof;
54  tobefilled2d=m_tecp2d;
55  }
56  else if(tecid.side()==2) {
57  tobefilledprof=m_tecmprof;
58  tobefilled2d=m_tecm2d;
59  }
60  }
61 
62  for(edm::DetSet<SiStripDigi>::const_iterator digi=mod->begin();digi!=mod->end();digi++) {
63 
64  if(digi->adc()>0) {
65  if(tobefilledprof) tobefilledprof->Fill(digi->strip()%256,digi->adc());
66  if(tobefilled2d) tobefilled2d->Fill(digi->strip()%256,digi->adc());
67  }
68  }
69  }
70  }
71 }
72 
73 void DigiCollectionProfiler::setMaskedModules(std::vector<unsigned int> maskedmod) {
74 
75  m_maskedmod = maskedmod;
76  sort(m_maskedmod.begin(),m_maskedmod.end());
77 
78 }
79 
80 
82 
83  int masked=0;
84  for(std::vector<unsigned int>::const_iterator it=m_maskedmod.begin();it!=m_maskedmod.end()&&masked==0&&mod>=(*it);it++) {
85  if(mod.rawId() == (*it)) masked = 1;
86  }
87  return masked;
88 
89 }
std::vector< unsigned int > m_maskedmod
void setMaskedModules(std::vector< unsigned int > maskedmod)
unsigned int side() const
positive or negative id
Definition: TECDetId.h:47
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
list mod
Load physics model.
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
Definition: DetId.h:20
collection_type::const_iterator const_iterator
Definition: DetSet.h:34
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:106
int ismasked(const DetId &mod) const
void analyze(edm::Handle< edm::DetSetVector< SiStripDigi > > digis)