CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

EcalBxOrbitNumberGrapher Class Reference

#include <EcalBxOrbitNumberGrapher.h>

Inheritance diagram for EcalBxOrbitNumberGrapher:
edm::EDAnalyzer

List of all members.

Public Member Functions

 EcalBxOrbitNumberGrapher (const edm::ParameterSet &)
 ~EcalBxOrbitNumberGrapher ()

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_

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.

                                                                                 :
  digiProducer_(iConfig.getParameter<std::string>("RawDigis")),
  runNum_(-1),
  fileName_ (iConfig.getUntrackedParameter<std::string>("fileName", std::string("ecalURechHitHists")))
{
  
  
}
EcalBxOrbitNumberGrapher::~EcalBxOrbitNumberGrapher ( )

Definition at line 47 of file EcalBxOrbitNumberGrapher.cc.

{
}

Member Function Documentation

void EcalBxOrbitNumberGrapher::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

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

{
  using namespace edm;
   using namespace cms;
  //int ievt = iEvent.id().event();
  int orbit = -100;
  int bx = -100;
  int numorbiterrors = 0;
  bool orbiterror = false;

  
  edm::Handle<EcalRawDataCollection> DCCHeaders;
  iEvent.getByLabel(digiProducer_, DCCHeaders);
  if (!DCCHeaders.isValid()) {
        edm::LogError("BxOrbitNumber") << "can't get the product for EcalRawDataCollection";
  }

  //-----------------BX STuff here
   for ( EcalRawDataCollection::const_iterator headerItr= DCCHeaders->begin();headerItr != DCCHeaders->end(); 
          ++headerItr ) {
    headerItr->getEventSettings();
    int myorbit = headerItr->getOrbit();
    int mybx = headerItr->getBX();
    
    if ( orbit == -100 )
    {
      orbit = myorbit;
    }
    else if (orbit != myorbit)
    {
       std::cout << " NOOOO This header has a conflicting orbit OTHER " << orbit << " new " << myorbit  << std::endl;
       orbiterror = true; 
       numorbiterrors++;
       orbitErrorBxDiffPlot_->Fill(myorbit - orbit);
    }
    
    if ( bx == -100 )
    {
      bx = mybx;
    }
    else if (bx != mybx)
    {
       std::cout << " NOOOO This header has a conflicting bx OTHER " << bx << " new " << mybx  << std::endl; 
    }
    //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.
  }
  
  if ( (bx != -100) & ( orbit != -100) )
  {
     std::cout << " Interesting event Orbit " << orbit << " BX " << bx << std::endl;
     bxnumberPlot_->Fill(bx);
     if (orbiterror) 
     {
        orbitErrorPlot_->Fill(bx);      
     }
  }
  numberofOrbitDiffPlot_->Fill(numorbiterrors);
  
  
  if(runNum_==-1)
  {
    runNum_ = iEvent.id().run();
  }
}
void EcalBxOrbitNumberGrapher::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 133 of file EcalBxOrbitNumberGrapher.cc.

References bxnumberPlot_, numberofOrbitDiffPlot_, orbitErrorBxDiffPlot_, and orbitErrorPlot_.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 143 of file EcalBxOrbitNumberGrapher.cc.

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

{
  using namespace std;
  fileName_ += ".bx.root";

  TFile root_file_(fileName_.c_str() , "RECREATE");

  bxnumberPlot_->Write();
  orbitErrorPlot_->Write();
  numberofOrbitDiffPlot_->Write();
  orbitErrorBxDiffPlot_->Write();
  root_file_.Close();

}
void EcalBxOrbitNumberGrapher::initHists ( int  FED) [private]

Definition at line 125 of file EcalBxOrbitNumberGrapher.cc.

{
 
  
}

Member Data Documentation

Definition at line 70 of file EcalBxOrbitNumberGrapher.h.

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

Definition at line 66 of file EcalBxOrbitNumberGrapher.h.

Referenced by analyze().

Definition at line 75 of file EcalBxOrbitNumberGrapher.h.

std::string EcalBxOrbitNumberGrapher::fileName_ [private]

Definition at line 68 of file EcalBxOrbitNumberGrapher.h.

Referenced by endJob().

Definition at line 73 of file EcalBxOrbitNumberGrapher.h.

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

Definition at line 72 of file EcalBxOrbitNumberGrapher.h.

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

Definition at line 71 of file EcalBxOrbitNumberGrapher.h.

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

Definition at line 67 of file EcalBxOrbitNumberGrapher.h.

Referenced by analyze().