CMS 3D CMS Logo

Public Member Functions | Private Attributes

EcalTBValidation Class Reference

#include <EcalTBValidation.h>

Inheritance diagram for EcalTBValidation:
edm::EDAnalyzer

List of all members.

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob ()
 EcalTBValidation (const edm::ParameterSet &)
virtual void endJob ()
 ~EcalTBValidation ()

Private Attributes

int data_
DQMStoredbe_
std::string digiCollection_
std::string digiProducer_
std::string eventHeaderCollection_
std::string eventHeaderProducer_
std::string hitCollection_
std::string hitProducer_
std::string hodoRecInfoCollection_
std::string hodoRecInfoProducer_
MonitorElementmeETBampltdc_
MonitorElementmeETBe1e25_
MonitorElementmeETBe1e25vsX_
MonitorElementmeETBe1e25vsY_
MonitorElementmeETBe1e9_
MonitorElementmeETBe1e9vsX_
MonitorElementmeETBe1e9vsY_
MonitorElementmeETBe1vsX_
MonitorElementmeETBe1vsY_
MonitorElementmeETBe1x1_
MonitorElementmeETBe1x1_center_
MonitorElementmeETBe3x3_
MonitorElementmeETBe3x3_center_
MonitorElementmeETBe5x5_
MonitorElementmeETBe5x5_center_
MonitorElementmeETBe9e25_
MonitorElementmeETBe9e25vsX_
MonitorElementmeETBe9e25vsY_
MonitorElementmeETBhodoX_
MonitorElementmeETBhodoY_
MonitorElementmeETBShape_
MonitorElementmeETBxib_
std::string tdcRecInfoCollection_
std::string tdcRecInfoProducer_
bool verbose_
int xtalInBeam_

Detailed Description

Definition at line 21 of file EcalTBValidation.h.


Constructor & Destructor Documentation

EcalTBValidation::EcalTBValidation ( const edm::ParameterSet config) [explicit]

Definition at line 17 of file EcalTBValidation.cc.

References data_, dbe_, digiCollection_, digiProducer_, eventHeaderCollection_, eventHeaderProducer_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), hitCollection_, hitProducer_, hodoRecInfoCollection_, hodoRecInfoProducer_, meETBampltdc_, meETBe1e25_, meETBe1e25vsX_, meETBe1e25vsY_, meETBe1e9_, meETBe1e9vsX_, meETBe1e9vsY_, meETBe1vsX_, meETBe1vsY_, meETBe1x1_, meETBe1x1_center_, meETBe3x3_, meETBe3x3_center_, meETBe5x5_, meETBe5x5_center_, meETBe9e25_, meETBe9e25vsX_, meETBe9e25vsY_, meETBhodoX_, meETBhodoY_, meETBShape_, meETBxib_, cppFunctionSkipper::operator, tdcRecInfoCollection_, tdcRecInfoProducer_, verbose_, and xtalInBeam_.

                                                                  {  

  data_                  = config.getUntrackedParameter<int>("data",-1000);
  xtalInBeam_            = config.getUntrackedParameter<int>("xtalInBeam",-1000);

  digiCollection_        = config.getParameter<std::string>("digiCollection");
  digiProducer_          = config.getParameter<std::string>("digiProducer");
  hitCollection_         = config.getParameter<std::string>("hitCollection");
  hitProducer_           = config.getParameter<std::string>("hitProducer");
  hodoRecInfoCollection_ = config.getParameter<std::string>("hodoRecInfoCollection");
  hodoRecInfoProducer_   = config.getParameter<std::string>("hodoRecInfoProducer");
  tdcRecInfoCollection_  = config.getParameter<std::string>("tdcRecInfoCollection");
  tdcRecInfoProducer_    = config.getParameter<std::string>("tdcRecInfoProducer");
  eventHeaderCollection_ = config.getParameter<std::string>("eventHeaderCollection");
  eventHeaderProducer_   = config.getParameter<std::string>("eventHeaderProducer");

  //rootfile_              = config.getUntrackedParameter<std::string>("rootfile","EcalTBValidation.root");

  // verbosity...
  verbose_ = config.getUntrackedParameter<bool>("verbose", false);

  dbe_ = edm::Service<DQMStore>().operator->();
  if( dbe_ ) {
    if( verbose_ ) {
      dbe_->setVerbose(1);
      dbe_->showDirStructure();
    }
    else {
      dbe_->setVerbose(0);
    }
  }
    
  meETBxib_ = 0;
  meETBampltdc_ = 0;
  meETBShape_ = 0;
  meETBhodoX_ = 0;
  meETBhodoY_ = 0;
  meETBe1x1_ = 0;
  meETBe3x3_ = 0;
  meETBe5x5_ = 0;
  meETBe1e9_ = 0;
  meETBe1e25_ = 0;
  meETBe9e25_ = 0;
  meETBe1x1_center_ = 0;
  meETBe3x3_center_ = 0;
  meETBe5x5_center_ = 0;
  meETBe1vsX_ = 0;
  meETBe1vsY_ = 0;
  meETBe1e9vsX_ = 0;
  meETBe1e9vsY_ = 0;
  meETBe1e25vsX_ = 0;
  meETBe1e25vsY_ = 0;
  meETBe9e25vsX_ = 0;
  meETBe9e25vsY_ = 0;

  if( dbe_ ) {

    std::string hname;   
    dbe_->setCurrentFolder( "EcalRecHitsV/EcalTBValidationTask" );

    hname = "xtal in beam position";
    meETBxib_          = dbe_->book2D( hname, hname, 85, 0., 85., 20,0., 20. );
    hname = "Max Amplitude vs TDC offset";
    meETBampltdc_      = dbe_->book2D( hname, hname, 100, 0., 1., 1000, 0., 4000. );
    hname = "Beam Profile X";
    meETBhodoX_        = dbe_->book1D( hname, hname, 100, -20., 20. );
    hname = "Beam Profile Y";
    meETBhodoY_        = dbe_->book1D( hname, hname, 100, -20., 20. );
    hname = "E1x1 energy";
    meETBe1x1_         = dbe_->book1D( hname, hname, 1000, 0., 4000. );
    hname = "E3x3 energy";
    meETBe3x3_         = dbe_->book1D( hname, hname, 1000, 0., 4000. );
    hname = "E5x5 energy";
    meETBe5x5_         = dbe_->book1D( hname, hname, 1000, 0., 4000. );
    hname = "E1x1 energy center";
    meETBe1x1_center_  = dbe_->book1D( hname, hname, 1000, 0., 4000. );
    hname = "E3x3 energy center";
    meETBe3x3_center_  = dbe_->book1D( hname, hname, 1000, 0., 4000. );
    hname = "E5x5 energy center";
    meETBe5x5_center_  = dbe_->book1D( hname, hname, 1000, 0., 4000. );
    hname = "E1 over E9 ratio";
    meETBe1e9_         = dbe_->book1D( hname, hname, 600, 0., 1.2 );
    hname = "E1 over E25 ratio";
    meETBe1e25_        = dbe_->book1D( hname, hname, 600, 0., 1.2 );
    hname = "E9 over E25 ratio";
    meETBe9e25_        = dbe_->book1D( hname, hname, 600, 0., 1.2 );
    hname = "E1 vs X";
    meETBe1vsX_        = dbe_->book2D( hname, hname, 80, -20, 20, 1000, 0., 4000. );
    hname = "E1 vs Y";
    meETBe1vsY_        = dbe_->book2D( hname, hname, 80, -20, 20, 1000, 0., 4000. );  
    hname = "E1 over E9 vs X";
    meETBe1e9vsX_      = dbe_->book2D( hname, hname, 80, -20, 20, 600, 0., 1.2 );
    hname = "E1 over E9 vs Y";
    meETBe1e9vsY_      = dbe_->book2D( hname, hname, 80, -20, 20, 600, 0., 1.2 );
    hname = "E1 over E25 vs X";
    meETBe1e25vsX_     = dbe_->book2D( hname, hname, 80, -20, 20, 600, 0., 1.2 );
    hname = "E1 over E25 vs Y";
    meETBe1e25vsY_     = dbe_->book2D( hname, hname, 80, -20, 20, 600, 0., 1.2 );
    hname = "E9 over E25 vs X";
    meETBe9e25vsX_     = dbe_->book2D( hname, hname, 80, -20, 20, 600, 0., 1.2 );
    hname = "E9 over E25 vs Y";
    meETBe9e25vsY_     = dbe_->book2D( hname, hname, 80, -20, 20, 600, 0., 1.2 );
    hname = "Xtal in Beam Shape";
    meETBShape_        = dbe_->book2D( hname, hname, 250, 0, 10, 350, 0, 3500 );
  }

}
EcalTBValidation::~EcalTBValidation ( )

Definition at line 126 of file EcalTBValidation.cc.

{}

Member Function Documentation

void EcalTBValidation::analyze ( const edm::Event event,
const edm::EventSetup setup 
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 132 of file EcalTBValidation.cc.

References EcalMGPASample::adc(), dtNoiseDBValidation_cfg::cerr, data_, digiCollection_, digiProducer_, jptDQMConfig_cff::eMax, EBDetId::ETAPHIMODE, eventHeaderProducer_, MonitorElement::Fill(), HcalObjRepresent::Fill(), hitCollection_, hitProducer_, hodoRecInfoCollection_, hodoRecInfoProducer_, EBDetId::ieta(), EBDetId::iphi(), EBDetId::ism(), meETBampltdc_, meETBe1e25_, meETBe1e25vsX_, meETBe1e25vsY_, meETBe1e9_, meETBe1e9vsX_, meETBe1e9vsY_, meETBe1vsX_, meETBe1vsY_, meETBe1x1_, meETBe1x1_center_, meETBe3x3_, meETBe3x3_center_, meETBe5x5_, meETBe5x5_center_, meETBe9e25_, meETBe9e25vsX_, meETBe9e25vsY_, meETBhodoX_, meETBhodoY_, meETBShape_, meETBxib_, edm::Handle< T >::product(), compare_using_db::sample, EcalDataFrame::sample(), EcalDataFrame::size(), EBDetId::SMCRYSTALMODE, tdcRecInfoCollection_, tdcRecInfoProducer_, EBDetId::validDetId(), and xtalInBeam_.

                                                                                  {

  using namespace edm;
  using namespace cms;

  // digis
  const EBDigiCollection* theDigis=0;
  Handle<EBDigiCollection> pdigis;
  event.getByLabel(digiProducer_, digiCollection_, pdigis);
  if(pdigis.isValid()){
    theDigis = pdigis.product(); 
  } 
  else {    
    std::cerr << "Error! can't get the product " << digiCollection_.c_str() << std::endl;
    return;
  }

  // rechits
  const EBUncalibratedRecHitCollection* theHits=0;  
  Handle<EBUncalibratedRecHitCollection> phits;
  event.getByLabel(hitProducer_, hitCollection_, phits);
  if(phits.isValid()){
    theHits = phits.product(); 
  } 
  else {
    std::cerr << "Error! can't get the product " << hitCollection_.c_str() << std::endl;
    return;
  }

  // hodoscopes
  const EcalTBHodoscopeRecInfo* theHodo=0;  
  Handle<EcalTBHodoscopeRecInfo> pHodo;
  event.getByLabel(hodoRecInfoProducer_, hodoRecInfoCollection_, pHodo);
  if(pHodo.isValid()){ 
    theHodo = pHodo.product(); 
  }
  else{ 
    std::cerr << "Error! can't get the product " << hodoRecInfoCollection_.c_str() << std::endl;
    return;
  }
  
  // tdc
  const EcalTBTDCRecInfo* theTDC=0;
  Handle<EcalTBTDCRecInfo> pTDC;
  event.getByLabel(tdcRecInfoProducer_, tdcRecInfoCollection_, pTDC);
  if(pTDC.isValid()){
    theTDC = pTDC.product(); 
  }
  else{ 
    std::cerr << "Error! can't get the product " << tdcRecInfoCollection_.c_str() << std::endl;
    return;
  }

  // event header
  const EcalTBEventHeader* evtHeader=0;
  Handle<EcalTBEventHeader> pEventHeader;
  event.getByLabel(eventHeaderProducer_ , pEventHeader);
  if(pEventHeader.isValid()){
    evtHeader = pEventHeader.product(); 
  }
  else{ 
    std::cerr << "Error! can't get the product " << eventHeaderProducer_.c_str() << std::endl;
    return;
  }
  
 
  // -----------------------------------------------------------------------
  // xtal-in-beam
  EBDetId xtalInBeamId(1,xtalInBeam_, EBDetId::SMCRYSTALMODE);
  if (xtalInBeamId==EBDetId(0)){ return; }
  int xibEta = xtalInBeamId.ieta();
  int xibPhi = xtalInBeamId.iphi();

  // skipping events with moving table (in data)
  if (data_ && (evtHeader->tableIsMoving())) return;
  
  // amplitudes
  EBDetId Xtals5x5[25];
  for (unsigned int icry=0;icry<25;icry++){
    unsigned int row    = icry/5;
    unsigned int column = icry%5;
    int ieta = xtalInBeamId.ieta()+column-2;
    int iphi = xtalInBeamId.iphi()+row-2;
    if(EBDetId::validDetId(ieta, iphi)){ 
      EBDetId tempId(ieta, iphi,EBDetId::ETAPHIMODE);
      if (tempId.ism()==1) 
        Xtals5x5[icry] = tempId;
      else
        Xtals5x5[icry] = EBDetId(0);
    } else {
      Xtals5x5[icry] = EBDetId(0);   
    }
  } 
 
  // matrices
  double ampl1x1 = 0.;
  double ampl3x3 = 0.;
  double ampl5x5 = 0.;
  for (unsigned int icry=0;icry<25;icry++) {
    if (!Xtals5x5[icry].null()){
      double theAmpl = (theHits->find(Xtals5x5[icry]))->amplitude();
      ampl5x5 += theAmpl;
      if (icry==12){ampl1x1 = theAmpl;}
      if (icry==6 || icry==7 || icry==8 || icry==11 || icry==12 || icry==13 || icry==16 || icry==17 || icry==18){ampl3x3 += theAmpl;}
    }}


  // pulse shape
  double sampleSave[10];
  for(int ii=0; ii < 10; ++ii){ sampleSave[ii] = 0.0; }
  EBDigiCollection::const_iterator thisDigi = theDigis->find(xtalInBeamId);
  // int sMax = -1; // UNUSED
  double eMax = 0.;
  if (thisDigi != theDigis->end()){
    EBDataFrame myDigi = (*thisDigi);
    for (int sample=0; sample < myDigi.size(); ++sample){
      double analogSample = myDigi.sample(sample).adc();
      sampleSave[sample]  = analogSample;
      if ( eMax < analogSample ) {
        eMax = analogSample;
        // sMax = sample; // UNUSED
      }
    }
  }
  
  // beam profile
  double xBeam = theHodo->posX();
  double yBeam = theHodo->posY();

  // filling histos
  meETBxib_      -> Fill(xibEta, xibPhi);
  meETBhodoX_    -> Fill(xBeam);
  meETBhodoY_    -> Fill(yBeam);
  meETBampltdc_  -> Fill(theTDC->offset(),ampl1x1);
  meETBe1x1_     -> Fill(ampl1x1);
  meETBe3x3_     -> Fill(ampl3x3);
  meETBe5x5_     -> Fill(ampl5x5);
  meETBe1e9_     -> Fill(ampl1x1/ampl3x3);
  meETBe1e25_    -> Fill(ampl1x1/ampl5x5);
  meETBe9e25_    -> Fill(ampl3x3/ampl5x5);
  meETBe1vsX_    -> Fill(xBeam,ampl1x1);
  meETBe1vsY_    -> Fill(yBeam,ampl1x1);
  meETBe1e9vsX_  -> Fill(xBeam,ampl1x1/ampl3x3);
  meETBe1e9vsY_  -> Fill(yBeam,ampl1x1/ampl3x3);
  meETBe1e25vsX_ -> Fill(xBeam,ampl1x1/ampl5x5);
  meETBe1e25vsY_ -> Fill(yBeam,ampl1x1/ampl5x5);
  meETBe9e25vsX_ -> Fill(xBeam,ampl3x3/ampl5x5);
  meETBe9e25vsY_ -> Fill(yBeam,ampl3x3/ampl5x5);

  for(int ii=0; ii < 10; ++ii){ meETBShape_->Fill(double(ii)+theTDC->offset(),sampleSave[ii]); }

  if ( (fabs(xBeam)<2.5) && (fabs(yBeam)<2.5) ){ 
    meETBe1x1_center_  -> Fill(ampl1x1);
    meETBe3x3_center_  -> Fill(ampl3x3);
    meETBe5x5_center_  -> Fill(ampl5x5);
  }
}
void EcalTBValidation::beginJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 128 of file EcalTBValidation.cc.

{}
void EcalTBValidation::endJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 130 of file EcalTBValidation.cc.

{}

Member Data Documentation

int EcalTBValidation::data_ [private]

Definition at line 35 of file EcalTBValidation.h.

Referenced by analyze(), and EcalTBValidation().

Definition at line 33 of file EcalTBValidation.h.

Referenced by EcalTBValidation().

std::string EcalTBValidation::digiCollection_ [private]

Definition at line 38 of file EcalTBValidation.h.

Referenced by analyze(), and EcalTBValidation().

std::string EcalTBValidation::digiProducer_ [private]

Definition at line 39 of file EcalTBValidation.h.

Referenced by analyze(), and EcalTBValidation().

Definition at line 46 of file EcalTBValidation.h.

Referenced by EcalTBValidation().

Definition at line 47 of file EcalTBValidation.h.

Referenced by analyze(), and EcalTBValidation().

std::string EcalTBValidation::hitCollection_ [private]

Definition at line 40 of file EcalTBValidation.h.

Referenced by analyze(), and EcalTBValidation().

std::string EcalTBValidation::hitProducer_ [private]

Definition at line 41 of file EcalTBValidation.h.

Referenced by analyze(), and EcalTBValidation().

Definition at line 42 of file EcalTBValidation.h.

Referenced by analyze(), and EcalTBValidation().

Definition at line 43 of file EcalTBValidation.h.

Referenced by analyze(), and EcalTBValidation().

Definition at line 61 of file EcalTBValidation.h.

Referenced by analyze(), and EcalTBValidation().

Definition at line 69 of file EcalTBValidation.h.

Referenced by analyze(), and EcalTBValidation().

Definition at line 78 of file EcalTBValidation.h.

Referenced by analyze(), and EcalTBValidation().

Definition at line 79 of file EcalTBValidation.h.

Referenced by analyze(), and EcalTBValidation().

Definition at line 68 of file EcalTBValidation.h.

Referenced by analyze(), and EcalTBValidation().

Definition at line 76 of file EcalTBValidation.h.

Referenced by analyze(), and EcalTBValidation().

Definition at line 77 of file EcalTBValidation.h.

Referenced by analyze(), and EcalTBValidation().

Definition at line 74 of file EcalTBValidation.h.

Referenced by analyze(), and EcalTBValidation().

Definition at line 75 of file EcalTBValidation.h.

Referenced by analyze(), and EcalTBValidation().

Definition at line 65 of file EcalTBValidation.h.

Referenced by analyze(), and EcalTBValidation().

Definition at line 71 of file EcalTBValidation.h.

Referenced by analyze(), and EcalTBValidation().

Definition at line 66 of file EcalTBValidation.h.

Referenced by analyze(), and EcalTBValidation().

Definition at line 72 of file EcalTBValidation.h.

Referenced by analyze(), and EcalTBValidation().

Definition at line 67 of file EcalTBValidation.h.

Referenced by analyze(), and EcalTBValidation().

Definition at line 73 of file EcalTBValidation.h.

Referenced by analyze(), and EcalTBValidation().

Definition at line 70 of file EcalTBValidation.h.

Referenced by analyze(), and EcalTBValidation().

Definition at line 80 of file EcalTBValidation.h.

Referenced by analyze(), and EcalTBValidation().

Definition at line 81 of file EcalTBValidation.h.

Referenced by analyze(), and EcalTBValidation().

Definition at line 63 of file EcalTBValidation.h.

Referenced by analyze(), and EcalTBValidation().

Definition at line 64 of file EcalTBValidation.h.

Referenced by analyze(), and EcalTBValidation().

Definition at line 62 of file EcalTBValidation.h.

Referenced by analyze(), and EcalTBValidation().

Definition at line 60 of file EcalTBValidation.h.

Referenced by analyze(), and EcalTBValidation().

Definition at line 44 of file EcalTBValidation.h.

Referenced by analyze(), and EcalTBValidation().

Definition at line 45 of file EcalTBValidation.h.

Referenced by analyze(), and EcalTBValidation().

Definition at line 32 of file EcalTBValidation.h.

Referenced by EcalTBValidation().

Definition at line 36 of file EcalTBValidation.h.

Referenced by analyze(), and EcalTBValidation().