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
EcalBxOrbitNumberGrapher Class Reference

#include <EcalBxOrbitNumberGrapher.h>

Inheritance diagram for EcalBxOrbitNumberGrapher:
edm::EDAnalyzer

Public Member Functions

 EcalBxOrbitNumberGrapher (const edm::ParameterSet &)
 
 ~EcalBxOrbitNumberGrapher ()
 
- 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 endJob ()
 
void initHists (int)
 

Private Attributes

TH1F * bxnumberPlot_
 
std::string digiProducer_
 
TFile * file
 
std::string fileName_
 
TH1F * numberofOrbitDiffPlot_
 
TH1F * orbitErrorBxDiffPlot_
 
TH1F * orbitErrorPlot_
 
int runNum_
 

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

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

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

Definition at line 51 of file EcalBxOrbitNumberGrapher.h.

Constructor & Destructor Documentation

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

Definition at line 37 of file EcalBxOrbitNumberGrapher.cc.

37  :
38  digiProducer_(iConfig.getParameter<std::string>("RawDigis")),
39  runNum_(-1),
40  fileName_ (iConfig.getUntrackedParameter<std::string>("fileName", std::string("ecalURechHitHists")))
41 {
42 
43 
44 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
EcalBxOrbitNumberGrapher::~EcalBxOrbitNumberGrapher ( )

Definition at line 47 of file EcalBxOrbitNumberGrapher.cc.

48 {
49 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 58 of file EcalBxOrbitNumberGrapher.cc.

References bxnumberPlot_, gather_cfg::cout, digiProducer_, edm::Event::getByLabel(), edm::EventBase::id(), numberofOrbitDiffPlot_, orbitErrorBxDiffPlot_, orbitErrorPlot_, edm::EventID::run(), and runNum_.

59 {
60  using namespace edm;
61  using namespace cms;
62  //int ievt = iEvent.id().event();
63  int orbit = -100;
64  int bx = -100;
65  int numorbiterrors = 0;
66  bool orbiterror = false;
67 
68 
70  iEvent.getByLabel(digiProducer_, DCCHeaders);
71  if (!DCCHeaders.isValid()) {
72  edm::LogError("BxOrbitNumber") << "can't get the product for EcalRawDataCollection";
73  }
74 
75  //-----------------BX STuff here
76  for ( EcalRawDataCollection::const_iterator headerItr= DCCHeaders->begin();headerItr != DCCHeaders->end();
77  ++headerItr ) {
78  headerItr->getEventSettings();
79  int myorbit = headerItr->getOrbit();
80  int mybx = headerItr->getBX();
81 
82  if ( orbit == -100 )
83  {
84  orbit = myorbit;
85  }
86  else if (orbit != myorbit)
87  {
88  std::cout << " NOOOO This header has a conflicting orbit OTHER " << orbit << " new " << myorbit << std::endl;
89  orbiterror = true;
90  numorbiterrors++;
91  orbitErrorBxDiffPlot_->Fill(myorbit - orbit);
92  }
93 
94  if ( bx == -100 )
95  {
96  bx = mybx;
97  }
98  else if (bx != mybx)
99  {
100  std::cout << " NOOOO This header has a conflicting bx OTHER " << bx << " new " << mybx << std::endl;
101  }
102  //LogDebug("EcalTimingCosmic") << " Lambda " << lambda; //hmm... this isn't good, I should keep a record of the wavelength in the headers as an inactive SM might have a different wavelength for this field and make this not go through.
103  }
104 
105  if ( (bx != -100) & ( orbit != -100) )
106  {
107  std::cout << " Interesting event Orbit " << orbit << " BX " << bx << std::endl;
108  bxnumberPlot_->Fill(bx);
109  if (orbiterror)
110  {
111  orbitErrorPlot_->Fill(bx);
112  }
113  }
114  numberofOrbitDiffPlot_->Fill(numorbiterrors);
115 
116 
117  if(runNum_==-1)
118  {
119  runNum_ = iEvent.id().run();
120  }
121 }
RunNumber_t run() const
Definition: EventID.h:42
std::vector< T >::const_iterator const_iterator
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
edm::EventID id() const
Definition: EventBase.h:56
tuple cout
Definition: gather_cfg.py:121
void EcalBxOrbitNumberGrapher::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 133 of file EcalBxOrbitNumberGrapher.cc.

References bxnumberPlot_, numberofOrbitDiffPlot_, orbitErrorBxDiffPlot_, and orbitErrorPlot_.

134 {
135  bxnumberPlot_ = new TH1F("bxnumber", "BX number of interexting events",3600, 0., 3600.);
136  orbitErrorPlot_ = new TH1F("bxOfOrbitDiffs", "BX number of interexting events with orbit changes",3600, 0., 3600.);
137  orbitErrorBxDiffPlot_ = new TH1F("orbitErrorDiffPlot","Orbit Difference of those HEADERS that have a difference",20,-10.,10.);
138  numberofOrbitDiffPlot_ = new TH1F("numberOfOrbitDiffsPlot","Number of Orbit Differences",54,0., 54.);
139 }
void EcalBxOrbitNumberGrapher::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 143 of file EcalBxOrbitNumberGrapher.cc.

References bxnumberPlot_, fileName_, numberofOrbitDiffPlot_, orbitErrorBxDiffPlot_, and orbitErrorPlot_.

144 {
145  using namespace std;
146  fileName_ += ".bx.root";
147 
148  TFile root_file_(fileName_.c_str() , "RECREATE");
149 
150  bxnumberPlot_->Write();
151  orbitErrorPlot_->Write();
152  numberofOrbitDiffPlot_->Write();
153  orbitErrorBxDiffPlot_->Write();
154  root_file_.Close();
155 
156 }
void EcalBxOrbitNumberGrapher::initHists ( int  FED)
private

Definition at line 125 of file EcalBxOrbitNumberGrapher.cc.

126 {
127 
128 
129 }

Member Data Documentation

TH1F* EcalBxOrbitNumberGrapher::bxnumberPlot_
private

Definition at line 70 of file EcalBxOrbitNumberGrapher.h.

Referenced by analyze(), beginJob(), and endJob().

std::string EcalBxOrbitNumberGrapher::digiProducer_
private

Definition at line 66 of file EcalBxOrbitNumberGrapher.h.

Referenced by analyze().

TFile* EcalBxOrbitNumberGrapher::file
private

Definition at line 75 of file EcalBxOrbitNumberGrapher.h.

std::string EcalBxOrbitNumberGrapher::fileName_
private

Definition at line 68 of file EcalBxOrbitNumberGrapher.h.

Referenced by endJob().

TH1F* EcalBxOrbitNumberGrapher::numberofOrbitDiffPlot_
private

Definition at line 73 of file EcalBxOrbitNumberGrapher.h.

Referenced by analyze(), beginJob(), and endJob().

TH1F* EcalBxOrbitNumberGrapher::orbitErrorBxDiffPlot_
private

Definition at line 72 of file EcalBxOrbitNumberGrapher.h.

Referenced by analyze(), beginJob(), and endJob().

TH1F* EcalBxOrbitNumberGrapher::orbitErrorPlot_
private

Definition at line 71 of file EcalBxOrbitNumberGrapher.h.

Referenced by analyze(), beginJob(), and endJob().

int EcalBxOrbitNumberGrapher::runNum_
private

Definition at line 67 of file EcalBxOrbitNumberGrapher.h.

Referenced by analyze().