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

std::string daqSource_
 
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)
 
static void prevalidate (ConfigurationDescriptions &)
 
- 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  daqSource_ = ps.getUntrackedParameter<string>("daqSource", "source");
16 
17  NumberOfFeds_ =FEDRange_.second - FEDRange_.first +1;
18 
19  NEvents_ = 0;
20  for(int i=0; i!=40; i++) FEDs_[i] = 0;
21 
22 }
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
std::pair< int, int > FEDRange_
std::string daqSource_
SiPixelDaqInfo::~SiPixelDaqInfo ( )

Definition at line 24 of file SiPixelDaqInfo.cc.

24 {}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 165 of file SiPixelDaqInfo.cc.

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

165  {
166  NEvents_++;
167  //cout<<"in SiPixelDaqInfo::analyze now!"<<endl;
168  if(NEvents_>=1 && NEvents_<=100){
169  // check if any Pixel FED is in readout:
170  edm::Handle<FEDRawDataCollection> rawDataHandle;
171  iEvent.getByLabel(daqSource_, rawDataHandle);
172  if(!rawDataHandle.isValid()){
173  edm::LogInfo("SiPixelDaqInfo") << daqSource_ << " is empty!";
174  return;
175  }
176  const FEDRawDataCollection& rawDataCollection = *rawDataHandle;
177  nFEDsBarrel_ = 0; nFEDsEndcap_ = 0;
178  for(int i = 0; i != 40; i++){
179  if(rawDataCollection.FEDData(i).size() > 208 ) FEDs_[i]++;
180  }
181  }
182 
183 }
int i
Definition: DBlmapReader.cc:9
std::string daqSource_
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:49
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:356
void SiPixelDaqInfo::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 147 of file SiPixelDaqInfo.cc.

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 26 of file SiPixelDaqInfo.cc.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 161 of file SiPixelDaqInfo.cc.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 29 of file SiPixelDaqInfo.cc.

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 84 of file SiPixelDaqInfo.cc.

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

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

Member Data Documentation

std::string SiPixelDaqInfo::daqSource_
private

Definition at line 52 of file SiPixelDaqInfo.h.

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 53 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.