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 edm::EDConsumerBase

Public Member Functions

 SiPixelDaqInfo (const edm::ParameterSet &)
 
 ~SiPixelDaqInfo ()
 
- 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
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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_
 
edm::EDGetTokenT
< FEDRawDataCollection
daqSourceToken_
 
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
 
- 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

Definition at line 26 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  //set Token(-s)
23  daqSourceToken_ = consumes<FEDRawDataCollection>(ps.getUntrackedParameter<string>("daqSource", "source"));
24 }
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
std::pair< int, int > FEDRange_
std::string daqSource_
edm::EDGetTokenT< FEDRawDataCollection > daqSourceToken_
SiPixelDaqInfo::~SiPixelDaqInfo ( )

Definition at line 26 of file SiPixelDaqInfo.cc.

26 {}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 167 of file SiPixelDaqInfo.cc.

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

167  {
168  NEvents_++;
169  //cout<<"in SiPixelDaqInfo::analyze now!"<<endl;
170  if(NEvents_>=1 && NEvents_<=100){
171  // check if any Pixel FED is in readout:
172  edm::Handle<FEDRawDataCollection> rawDataHandle;
173  iEvent.getByToken(daqSourceToken_, rawDataHandle);
174  if(!rawDataHandle.isValid()){
175  edm::LogInfo("SiPixelDaqInfo") << daqSource_ << " is empty!";
176  return;
177  }
178  const FEDRawDataCollection& rawDataCollection = *rawDataHandle;
179  nFEDsBarrel_ = 0; nFEDsEndcap_ = 0;
180  for(int i = 0; i != 40; i++){
181  if(rawDataCollection.FEDData(i).size() > 208 ) FEDs_[i]++;
182  }
183  }
184 
185 }
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
std::string daqSource_
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
edm::EDGetTokenT< FEDRawDataCollection > daqSourceToken_
void SiPixelDaqInfo::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 149 of file SiPixelDaqInfo.cc.

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 28 of file SiPixelDaqInfo.cc.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 163 of file SiPixelDaqInfo.cc.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 31 of file SiPixelDaqInfo.cc.

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

31  {
33  if(0 != iSetup.find( recordKey ) ) {
34  // cout<<"record key found"<<endl;
35  //get fed summary information
36  ESHandle<RunInfo> sumFED;
37  iSetup.get<RunInfoRcd>().get(sumFED);
38  vector<int> FedsInIds= sumFED->m_fed_in;
39 
40  int FedCount=0;
41  int FedCountBarrel=0;
42  int FedCountEndcap=0;
43 
44  //loop on all active feds
45  for(unsigned int fedItr=0;fedItr<FedsInIds.size(); ++fedItr) {
46  int fedID=FedsInIds[fedItr];
47  //make sure fed id is in allowed range
48  //cout<<fedID<<endl;
49  if(fedID>=FEDRange_.first && fedID<=FEDRange_.second){
50  ++FedCount;
51  if(fedID>=0 && fedID<=31) ++FedCountBarrel;
52  else if(fedID>=32 && fedID<=39) ++FedCountEndcap;
53  }
54  }
55 
56  //Fill active fed fraction ME
57  if(FedCountBarrel<=32){
58  FedCountBarrel = 0; FedCountEndcap = 0; FedCount = 0; NumberOfFeds_ = 40;
59  for(int i=0; i!=40; i++){
60  if(i<=31 && FEDs_[i]>0) FedCountBarrel++;
61  if(i>=32 && FEDs_[i]>0) FedCountEndcap++;
62  if(FEDs_[i]>0) FedCount++;
63  }
64  }
65  if(NumberOfFeds_>0){
66  //all Pixel:
67  Fraction_->Fill( FedCount/NumberOfFeds_);
68  //Barrel:
69  FractionBarrel_->Fill( FedCountBarrel/32.);
70  //Endcap:
71  FractionEndcap_->Fill( FedCountEndcap/8.);
72  }else{
73  Fraction_->Fill(-1);
74  FractionBarrel_->Fill(-1);
75  FractionEndcap_->Fill(-1);
76  }
77 
78  }else{
79  Fraction_->Fill(-1);
80  FractionBarrel_->Fill(-1);
81  FractionEndcap_->Fill(-1);
82  return;
83  }
84 }
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:125
void SiPixelDaqInfo::endRun ( const edm::Run r,
const edm::EventSetup iSetup 
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 86 of file SiPixelDaqInfo.cc.

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

86  {
88  if(0 != iSetup.find( recordKey ) ) {
89  // cout<<"record key found"<<endl;
90  //get fed summary information
91  ESHandle<RunInfo> sumFED;
92  iSetup.get<RunInfoRcd>().get(sumFED);
93  vector<int> FedsInIds= sumFED->m_fed_in;
94 
95  int FedCount=0;
96  int FedCountBarrel=0;
97  int FedCountEndcap=0;
98 
99  //loop on all active feds
100  for(unsigned int fedItr=0;fedItr<FedsInIds.size(); ++fedItr) {
101  int fedID=FedsInIds[fedItr];
102  //make sure fed id is in allowed range
103  //cout<<fedID<<endl;
104  if(fedID>=FEDRange_.first && fedID<=FEDRange_.second){
105  ++FedCount;
106  if(fedID>=0 && fedID<=31) ++FedCountBarrel;
107  else if(fedID>=32 && fedID<=39) ++FedCountEndcap;
108  }
109  }
110 
111  if(FedCountBarrel>32){
112  FedCountBarrel = nFEDsBarrel_;
113  FedCountEndcap = nFEDsEndcap_;
114  FedCount = FedCountBarrel + FedCountEndcap;
115  NumberOfFeds_ = 40;
116  }
117 
118  //Fill active fed fraction ME
119  if(FedCountBarrel<=32){
120  FedCountBarrel = 0; FedCountEndcap = 0; FedCount = 0; NumberOfFeds_ = 40;
121  for(int i=0; i!=40; i++){
122  if(i<=31 && FEDs_[i]>0) FedCountBarrel++;
123  if(i>=32 && FEDs_[i]>0) FedCountEndcap++;
124  if(FEDs_[i]>0) FedCount++;
125  }
126  }
127  if(NumberOfFeds_>0){
128  //all Pixel:
129  Fraction_->Fill( FedCount/NumberOfFeds_);
130  //Barrel:
131  FractionBarrel_->Fill( FedCountBarrel/32.);
132  //Endcap:
133  FractionEndcap_->Fill( FedCountEndcap/8.);
134  }else{
135  Fraction_->Fill(-1);
136  FractionBarrel_->Fill(-1);
137  FractionEndcap_->Fill(-1);
138  }
139 
140  }else{
141  Fraction_->Fill(-1);
142  FractionBarrel_->Fill(-1);
143  FractionEndcap_->Fill(-1);
144  return;
145  }
146 }
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:125

Member Data Documentation

std::string SiPixelDaqInfo::daqSource_
private

Definition at line 53 of file SiPixelDaqInfo.h.

edm::EDGetTokenT<FEDRawDataCollection> SiPixelDaqInfo::daqSourceToken_
private

Definition at line 57 of file SiPixelDaqInfo.h.

DQMStore* SiPixelDaqInfo::dbe_
private

Definition at line 40 of file SiPixelDaqInfo.h.

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

Definition at line 46 of file SiPixelDaqInfo.h.

int SiPixelDaqInfo::FEDs_[40]
private

Definition at line 54 of file SiPixelDaqInfo.h.

MonitorElement* SiPixelDaqInfo::Fraction_
private

Definition at line 42 of file SiPixelDaqInfo.h.

MonitorElement* SiPixelDaqInfo::FractionBarrel_
private

Definition at line 43 of file SiPixelDaqInfo.h.

MonitorElement* SiPixelDaqInfo::FractionEndcap_
private

Definition at line 44 of file SiPixelDaqInfo.h.

int SiPixelDaqInfo::NEvents_
private

Definition at line 50 of file SiPixelDaqInfo.h.

int SiPixelDaqInfo::nFEDsBarrel_
private

Definition at line 51 of file SiPixelDaqInfo.h.

int SiPixelDaqInfo::nFEDsEndcap_
private

Definition at line 52 of file SiPixelDaqInfo.h.

int SiPixelDaqInfo::NumberOfFeds_
private

Definition at line 48 of file SiPixelDaqInfo.h.