CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
SiPixelDaqInfo Class Reference

#include <SiPixelDaqInfo.h>

Inheritance diagram for SiPixelDaqInfo:
edm::EDAnalyzer

Public Member Functions

 SiPixelDaqInfo (const edm::ParameterSet &)
 
 ~SiPixelDaqInfo ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void beginLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &)
 
virtual void endJob ()
 
virtual void endLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &)
 
virtual void endRun (const edm::Run &, const edm::EventSetup &)
 

Private Attributes

DQMStoredbe_
 
std::pair< int, int > FEDRange_
 
int FEDs_ [40]
 
MonitorElementFraction_
 
MonitorElementFractionBarrel_
 
MonitorElementFractionEndcap_
 
int NEvents_
 
int nFEDsBarrel_
 
int nFEDsEndcap_
 
int NumberOfFeds_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Definition at line 25 of file SiPixelDaqInfo.h.

Constructor & Destructor Documentation

SiPixelDaqInfo::SiPixelDaqInfo ( const edm::ParameterSet ps)
explicit

Definition at line 11 of file SiPixelDaqInfo.cc.

References edm::ParameterSet::getUntrackedParameter(), and i.

11  {
12 
13  FEDRange_.first = ps.getUntrackedParameter<unsigned int>("MinimumPixelFEDId", 0);
14  FEDRange_.second = ps.getUntrackedParameter<unsigned int>("MaximumPixelFEDId", 39);
15 
16  NumberOfFeds_ =FEDRange_.second - FEDRange_.first +1;
17 
18  NEvents_ = 0;
19  for(int i=0; i!=40; i++) FEDs_[i] = 0;
20 
21 }
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
std::pair< int, int > FEDRange_
SiPixelDaqInfo::~SiPixelDaqInfo ( )

Definition at line 23 of file SiPixelDaqInfo.cc.

23 {}

Member Function Documentation

void SiPixelDaqInfo::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 164 of file SiPixelDaqInfo.cc.

References FEDRawDataCollection::FEDData(), edm::Event::getByLabel(), i, edm::HandleBase::isValid(), and FEDRawData::size().

164  {
165  NEvents_++;
166  //cout<<"in SiPixelDaqInfo::analyze now!"<<endl;
167  if(NEvents_>=1 && NEvents_<=100){
168  // check if any Pixel FED is in readout:
169  edm::Handle<FEDRawDataCollection> rawDataHandle;
170  iEvent.getByLabel("source", rawDataHandle);
171  if(!rawDataHandle.isValid()){
172  edm::LogInfo("SiPixelDaqInfo") << "source" << " is empty!";
173  return;
174  }
175  const FEDRawDataCollection& rawDataCollection = *rawDataHandle;
176  nFEDsBarrel_ = 0; nFEDsEndcap_ = 0;
177  for(int i = 0; i != 40; i++){
178  if(rawDataCollection.FEDData(i).size() > 208 ) FEDs_[i]++;
179  }
180  }
181 
182 }
int i
Definition: DBlmapReader.cc:9
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
void SiPixelDaqInfo::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 146 of file SiPixelDaqInfo.cc.

References DQMStore::bookFloat(), dbe_, cmsCodeRules.cppFunctionSkipper::operator, and DQMStore::setCurrentFolder().

146  {
147 
148  dbe_ = 0;
150 
151 
152  dbe_->setCurrentFolder("Pixel/EventInfo");
153  Fraction_= dbe_->bookFloat("DAQSummary");
154  dbe_->setCurrentFolder("Pixel/EventInfo/DAQContents");
155  FractionBarrel_= dbe_->bookFloat("PixelBarrelFraction");
156  FractionEndcap_= dbe_->bookFloat("PixelEndcapFraction");
157 }
DQMStore * dbe_
MonitorElement * bookFloat(const char *name)
Book float.
Definition: DQMStore.cc:456
MonitorElement * Fraction_
MonitorElement * FractionBarrel_
MonitorElement * FractionEndcap_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:237
void SiPixelDaqInfo::beginLuminosityBlock ( const edm::LuminosityBlock lumiBlock,
const edm::EventSetup iSetup 
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 25 of file SiPixelDaqInfo.cc.

25 {}
void SiPixelDaqInfo::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 160 of file SiPixelDaqInfo.cc.

160 {}
void SiPixelDaqInfo::endLuminosityBlock ( const edm::LuminosityBlock lumiBlock,
const edm::EventSetup iSetup 
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 28 of file SiPixelDaqInfo.cc.

References edm::EventSetup::find(), edm::eventsetup::heterocontainer::HCTypeTag::findType(), edm::EventSetup::get(), and i.

28  {
30  if(0 != iSetup.find( recordKey ) ) {
31  // cout<<"record key found"<<endl;
32  //get fed summary information
33  ESHandle<RunInfo> sumFED;
34  iSetup.get<RunInfoRcd>().get(sumFED);
35  vector<int> FedsInIds= sumFED->m_fed_in;
36 
37  int FedCount=0;
38  int FedCountBarrel=0;
39  int FedCountEndcap=0;
40 
41  //loop on all active feds
42  for(unsigned int fedItr=0;fedItr<FedsInIds.size(); ++fedItr) {
43  int fedID=FedsInIds[fedItr];
44  //make sure fed id is in allowed range
45  //cout<<fedID<<endl;
46  if(fedID>=FEDRange_.first && fedID<=FEDRange_.second){
47  ++FedCount;
48  if(fedID>=0 && fedID<=31) ++FedCountBarrel;
49  else if(fedID>=32 && fedID<=39) ++FedCountEndcap;
50  }
51  }
52 
53  //Fill active fed fraction ME
54  if(FedCountBarrel<=32){
55  FedCountBarrel = 0; FedCountEndcap = 0; FedCount = 0; NumberOfFeds_ = 40;
56  for(int i=0; i!=40; i++){
57  if(i<=31 && FEDs_[i]>0) FedCountBarrel++;
58  if(i>=32 && FEDs_[i]>0) FedCountEndcap++;
59  if(FEDs_[i]>0) FedCount++;
60  }
61  }
62  if(NumberOfFeds_>0){
63  //all Pixel:
64  Fraction_->Fill( FedCount/NumberOfFeds_);
65  //Barrel:
66  FractionBarrel_->Fill( FedCountBarrel/32.);
67  //Endcap:
68  FractionEndcap_->Fill( FedCountEndcap/8.);
69  }else{
70  Fraction_->Fill(-1);
71  FractionBarrel_->Fill(-1);
72  FractionEndcap_->Fill(-1);
73  }
74 
75  }else{
76  Fraction_->Fill(-1);
77  FractionBarrel_->Fill(-1);
78  FractionEndcap_->Fill(-1);
79  return;
80  }
81 }
static HCTypeTag findType(const char *iTypeName)
find a type based on the types name, if not found will return default HCTypeTag
Definition: HCTypeTag.cc:126
int i
Definition: DBlmapReader.cc:9
std::pair< int, int > FEDRange_
const eventsetup::EventSetupRecord * find(const eventsetup::EventSetupRecordKey &) const
Definition: EventSetup.cc:82
void Fill(long long x)
MonitorElement * Fraction_
MonitorElement * FractionBarrel_
const T & get() const
Definition: EventSetup.h:55
MonitorElement * FractionEndcap_
void SiPixelDaqInfo::endRun ( const edm::Run r,
const edm::EventSetup iSetup 
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 83 of file SiPixelDaqInfo.cc.

References edm::EventSetup::find(), edm::eventsetup::heterocontainer::HCTypeTag::findType(), edm::EventSetup::get(), and i.

83  {
85  if(0 != iSetup.find( recordKey ) ) {
86  // cout<<"record key found"<<endl;
87  //get fed summary information
88  ESHandle<RunInfo> sumFED;
89  iSetup.get<RunInfoRcd>().get(sumFED);
90  vector<int> FedsInIds= sumFED->m_fed_in;
91 
92  int FedCount=0;
93  int FedCountBarrel=0;
94  int FedCountEndcap=0;
95 
96  //loop on all active feds
97  for(unsigned int fedItr=0;fedItr<FedsInIds.size(); ++fedItr) {
98  int fedID=FedsInIds[fedItr];
99  //make sure fed id is in allowed range
100  //cout<<fedID<<endl;
101  if(fedID>=FEDRange_.first && fedID<=FEDRange_.second){
102  ++FedCount;
103  if(fedID>=0 && fedID<=31) ++FedCountBarrel;
104  else if(fedID>=32 && fedID<=39) ++FedCountEndcap;
105  }
106  }
107 
108  if(FedCountBarrel>32){
109  FedCountBarrel = nFEDsBarrel_;
110  FedCountEndcap = nFEDsEndcap_;
111  FedCount = FedCountBarrel + FedCountEndcap;
112  NumberOfFeds_ = 40;
113  }
114 
115  //Fill active fed fraction ME
116  if(FedCountBarrel<=32){
117  FedCountBarrel = 0; FedCountEndcap = 0; FedCount = 0; NumberOfFeds_ = 40;
118  for(int i=0; i!=40; i++){
119  if(i<=31 && FEDs_[i]>0) FedCountBarrel++;
120  if(i>=32 && FEDs_[i]>0) FedCountEndcap++;
121  if(FEDs_[i]>0) FedCount++;
122  }
123  }
124  if(NumberOfFeds_>0){
125  //all Pixel:
126  Fraction_->Fill( FedCount/NumberOfFeds_);
127  //Barrel:
128  FractionBarrel_->Fill( FedCountBarrel/32.);
129  //Endcap:
130  FractionEndcap_->Fill( FedCountEndcap/8.);
131  }else{
132  Fraction_->Fill(-1);
133  FractionBarrel_->Fill(-1);
134  FractionEndcap_->Fill(-1);
135  }
136 
137  }else{
138  Fraction_->Fill(-1);
139  FractionBarrel_->Fill(-1);
140  FractionEndcap_->Fill(-1);
141  return;
142  }
143 }
static HCTypeTag findType(const char *iTypeName)
find a type based on the types name, if not found will return default HCTypeTag
Definition: HCTypeTag.cc:126
int i
Definition: DBlmapReader.cc:9
std::pair< int, int > FEDRange_
const eventsetup::EventSetupRecord * find(const eventsetup::EventSetupRecordKey &) const
Definition: EventSetup.cc:82
void Fill(long long x)
MonitorElement * Fraction_
MonitorElement * FractionBarrel_
const T & get() const
Definition: EventSetup.h:55
MonitorElement * FractionEndcap_

Member Data Documentation

DQMStore* SiPixelDaqInfo::dbe_
private

Definition at line 39 of file SiPixelDaqInfo.h.

std::pair<int,int> SiPixelDaqInfo::FEDRange_
private

Definition at line 45 of file SiPixelDaqInfo.h.

int SiPixelDaqInfo::FEDs_[40]
private

Definition at line 52 of file SiPixelDaqInfo.h.

MonitorElement* SiPixelDaqInfo::Fraction_
private

Definition at line 41 of file SiPixelDaqInfo.h.

MonitorElement* SiPixelDaqInfo::FractionBarrel_
private

Definition at line 42 of file SiPixelDaqInfo.h.

MonitorElement* SiPixelDaqInfo::FractionEndcap_
private

Definition at line 43 of file SiPixelDaqInfo.h.

int SiPixelDaqInfo::NEvents_
private

Definition at line 49 of file SiPixelDaqInfo.h.

int SiPixelDaqInfo::nFEDsBarrel_
private

Definition at line 50 of file SiPixelDaqInfo.h.

int SiPixelDaqInfo::nFEDsEndcap_
private

Definition at line 51 of file SiPixelDaqInfo.h.

int SiPixelDaqInfo::NumberOfFeds_
private

Definition at line 47 of file SiPixelDaqInfo.h.