CMS 3D CMS Logo

Public Types | Public Member Functions | Static Public Member Functions | Private Attributes

ecaldqm::LaserTask Class Reference

#include <LaserTask.h>

Inheritance diagram for ecaldqm::LaserTask:
ecaldqm::DQWorkerTask ecaldqm::DQWorker

List of all members.

Public Types

enum  Constants { nWL = 4, nPNGain = 2 }
enum  MESets {
  kAmplitudeSummary, kAmplitude = kAmplitudeSummary + nWL, kOccupancy = kAmplitude + nWL, kTiming = kOccupancy + nWL,
  kShape = kTiming + nWL, kAOverP = kShape + nWL, kPNAmplitude = kAOverP + nWL, kPNOccupancy = kPNAmplitude + nWL * nPNGain,
  nMESets
}

Public Member Functions

void analyze (const void *, Collections)
void beginRun (const edm::Run &, const edm::EventSetup &)
void bookMEs ()
void endEvent (const edm::Event &, const edm::EventSetup &)
bool filterRunType (const std::vector< short > &)
std::vector< int > const & getLaserWavelengths () const
std::vector< int > const & getMGPAGainsPN () const
 LaserTask (const edm::ParameterSet &, const edm::ParameterSet &)
void runOnDigis (const EcalDigiCollection &)
void runOnPnDigis (const EcalPnDiodeDigiCollection &)
void runOnRawData (const EcalRawDataCollection &)
void runOnUncalibRecHits (const EcalUncalibratedRecHitCollection &, Collections)
 ~LaserTask ()

Static Public Member Functions

static void setMEData (std::vector< MEData > &)

Private Attributes

bool enable_ [BinService::nDCC]
std::vector< int > laserWavelengths_
std::vector< int > MGPAGainsPN_
std::map< int, std::vector
< float > > 
pnAmp_
int wavelength_ [BinService::nDCC]

Detailed Description

Definition at line 12 of file LaserTask.h.


Member Enumeration Documentation

Enumerator:
nWL 
nPNGain 

Definition at line 34 of file LaserTask.h.

                   {
      nWL = 4,
      nPNGain = 2
    };
Enumerator:
kAmplitudeSummary 
kAmplitude 
kOccupancy 
kTiming 
kShape 
kAOverP 
kPNAmplitude 
kPNOccupancy 
nMESets 

Reimplemented from ecaldqm::DQWorker.

Definition at line 39 of file LaserTask.h.

                {
      kAmplitudeSummary, // profile2d
      kAmplitude = kAmplitudeSummary + nWL, // profile2d
      kOccupancy = kAmplitude + nWL,
      kTiming = kOccupancy + nWL, // profile2d
      kShape = kTiming + nWL,
      kAOverP = kShape + nWL, // profile2d
      kPNAmplitude = kAOverP + nWL, // profile2d
      kPNOccupancy = kPNAmplitude + nWL * nPNGain, // profile2d
      nMESets
    };

Constructor & Destructor Documentation

data refman pasoursint CMSSW_5_3_10_patch2 src DQM EcalBarrelMonitorTasks src LaserTask cc ecaldqm::LaserTask::LaserTask ( const edm::ParameterSet _params,
const edm::ParameterSet _paths 
)

Definition at line 14 of file LaserTask.cc.

References Exception, edm::ParameterSet::getUntrackedParameter(), edm::ParameterSet::getUntrackedParameterSet(), ecaldqm::kEBDigi, ecaldqm::kEBUncalibRecHit, ecaldqm::kEcalRawData, ecaldqm::kEEDigi, ecaldqm::kEEUncalibRecHit, ecaldqm::kPnDiodeDigi, and evf::evtn::offset().

  {
    using namespace std;

    collectionMask_ = 
      (0x1 << kEcalRawData) |
      (0x1 << kEBDigi) |
      (0x1 << kEEDigi) |
      (0x1 << kPnDiodeDigi) |
      (0x1 << kEBUncalibRecHit) |
      (0x1 << kEEUncalibRecHit);

    edm::ParameterSet const& commonParams(_params.getUntrackedParameterSet("Common"));
    MGPAGainsPN_ = commonParams.getUntrackedParameter<std::vector<int> >("MGPAGainsPN");

    edm::ParameterSet const& taskParams(_params.getUntrackedParameterSet(name_));
    laserWavelengths_ = taskParams.getUntrackedParameter<std::vector<int> >("laserWavelengths");

    for(std::vector<int>::iterator wlItr(laserWavelengths_.begin()); wlItr != laserWavelengths_.end(); ++wlItr)
      if(*wlItr <= 0 || *wlItr >= 5) throw cms::Exception("InvalidConfiguration") << "Laser Wavelength" << std::endl;

    for(std::vector<int>::iterator gainItr(MGPAGainsPN_.begin()); gainItr != MGPAGainsPN_.end(); ++gainItr)
      if(*gainItr != 1 && *gainItr != 16) throw cms::Exception("InvalidConfiguration") << "PN diode gain" << std::endl; 

    map<string, string> replacements;
    stringstream ss;

    for(vector<int>::iterator wlItr(laserWavelengths_.begin()); wlItr != laserWavelengths_.end(); ++wlItr){
      ss.str("");
      ss << *wlItr;
      replacements["wl"] = ss.str();

      unsigned offset(*wlItr - 1);

      MEs_[kAmplitudeSummary + offset]->name(replacements);
      MEs_[kAmplitude + offset]->name(replacements);
      MEs_[kOccupancy + offset]->name(replacements);
      MEs_[kTiming + offset]->name(replacements);
      MEs_[kShape + offset]->name(replacements);
      MEs_[kAOverP + offset]->name(replacements);

      for(vector<int>::iterator gainItr(MGPAGainsPN_.begin()); gainItr != MGPAGainsPN_.end(); ++gainItr){
        ss.str("");
        ss << *gainItr;
        replacements["pngain"] = ss.str();

        offset = (*wlItr - 1) * nPNGain + (*gainItr == 1 ? 0 : 1);

        MEs_[kPNAmplitude + offset]->name(replacements);
      }
    }
  }

ecaldqm::LaserTask::~LaserTask ( )

Definition at line 71 of file LaserTask.cc.

  {
  }


Member Function Documentation

void ecaldqm::LaserTask::analyze ( const void *  _p,
Collections  _collection 
) [inline, virtual]

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 62 of file LaserTask.h.

References ecaldqm::kEBDigi, ecaldqm::kEBUncalibRecHit, ecaldqm::kEcalRawData, ecaldqm::kEEDigi, ecaldqm::kEEUncalibRecHit, ecaldqm::kPnDiodeDigi, runOnDigis(), runOnPnDigis(), runOnRawData(), and runOnUncalibRecHits().

                                                                       {
    switch(_collection){
    case kEcalRawData:
      runOnRawData(*static_cast<const EcalRawDataCollection*>(_p));
      break;
    case kEBDigi:
    case kEEDigi:
      runOnDigis(*static_cast<const EcalDigiCollection*>(_p));
      break;
    case kPnDiodeDigi:
      runOnPnDigis(*static_cast<const EcalPnDiodeDigiCollection*>(_p));
      break;
    case kEBUncalibRecHit:
    case kEEUncalibRecHit:
      runOnUncalibRecHits(*static_cast<const EcalUncalibratedRecHitCollection*>(_p), _collection);
      break;
    default:
      break;
    }
  }
void ecaldqm::LaserTask::beginRun ( const edm::Run ,
const edm::EventSetup _es 
) [virtual]

Reimplemented from ecaldqm::DQWorker.

Definition at line 99 of file LaserTask.cc.

References enable_, EcalDQMBinningService::nDCC, pnAmp_, and wavelength_.

  {
    for(int iDCC(0); iDCC < BinService::nDCC; iDCC++){
      enable_[iDCC] = false;
      wavelength_[iDCC] = -1;
    }
    pnAmp_.clear();
  }

void ecaldqm::LaserTask::bookMEs ( ) [virtual]

Reimplemented from ecaldqm::DQWorker.

Definition at line 76 of file LaserTask.cc.

References kAmplitude, kAmplitudeSummary, kAOverP, kOccupancy, kPNAmplitude, kPNOccupancy, kShape, kTiming, laserWavelengths_, ecaldqm::DQWorker::MEs_, MGPAGainsPN_, nPNGain, and evf::evtn::offset().

  {
    for(std::vector<int>::iterator wlItr(laserWavelengths_.begin()); wlItr != laserWavelengths_.end(); ++wlItr){
      unsigned offset(*wlItr - 1);

      MEs_[kAmplitudeSummary + offset]->book();
      MEs_[kAmplitude + offset]->book();
      MEs_[kOccupancy + offset]->book();
      MEs_[kTiming + offset]->book();
      MEs_[kShape + offset]->book();
      MEs_[kAOverP + offset]->book();

      for(std::vector<int>::iterator gainItr(MGPAGainsPN_.begin()); gainItr != MGPAGainsPN_.end(); ++gainItr){
        offset = (*wlItr - 1) * nPNGain + (*gainItr == 1 ? 0 : 1);

        MEs_[kPNAmplitude + offset]->book();
      }
    }

    MEs_[kPNOccupancy]->book();
  }

void ecaldqm::LaserTask::endEvent ( const edm::Event ,
const edm::EventSetup  
) [virtual]

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 109 of file LaserTask.cc.

References enable_, EcalDQMBinningService::nDCC, pnAmp_, and wavelength_.

  {
    for(int iDCC(0); iDCC < BinService::nDCC; iDCC++){
      enable_[iDCC] = false;
      wavelength_[iDCC] = -1;
    }
    pnAmp_.clear();
  }

bool ecaldqm::LaserTask::filterRunType ( const std::vector< short > &  _runType) [virtual]

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 119 of file LaserTask.cc.

References enable_, EcalDCCHeaderBlock::LASER_GAP, EcalDCCHeaderBlock::LASER_STD, and EcalDQMBinningService::nDCC.

  {
    bool enable(false);

    for(int iDCC(0); iDCC < BinService::nDCC; iDCC++){
      if(_runType[iDCC] == EcalDCCHeaderBlock::LASER_STD ||
         _runType[iDCC] == EcalDCCHeaderBlock::LASER_GAP){
        enable = true;
        enable_[iDCC] = true;
      }
    }

    return enable;
  }

std::vector<int> const& ecaldqm::LaserTask::getLaserWavelengths ( ) const [inline]

Definition at line 31 of file LaserTask.h.

References laserWavelengths_.

{ return laserWavelengths_; }
std::vector<int> const& ecaldqm::LaserTask::getMGPAGainsPN ( ) const [inline]

Definition at line 32 of file LaserTask.h.

References MGPAGainsPN_.

{ return MGPAGainsPN_; }
void ecaldqm::LaserTask::runOnDigis ( const EcalDigiCollection _digis)

Definition at line 149 of file LaserTask.cc.

References EcalMGPASample::adc(), edm::DataFrameContainer::begin(), ecaldqm::dccId(), enable_, edm::DataFrameContainer::end(), lumiContext::fill, errorMatrix2Lands_multiChannel::id, kOccupancy, kShape, ecaldqm::DQWorker::MEs_, evf::evtn::offset(), EcalDataFrame::sample(), and wavelength_.

Referenced by analyze().

  {
    for(EcalDigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr){
      const DetId& id(digiItr->id());

      int iDCC(dccId(id) - 1);

      if(!enable_[iDCC]) continue;

      EcalDataFrame dataFrame(*digiItr);

      unsigned offset(wavelength_[iDCC] - 1);

      MEs_[kOccupancy + offset]->fill(id);

      for(int iSample(0); iSample < 10; iSample++)
        MEs_[kShape + offset]->fill(id, iSample + 0.5, float(dataFrame.sample(iSample).adc()));
    }
  }

void ecaldqm::LaserTask::runOnPnDigis ( const EcalPnDiodeDigiCollection _digis)

Definition at line 170 of file LaserTask.cc.

References edm::SortedCollection< T, SORT >::begin(), ecaldqm::dccId(), enable_, edm::SortedCollection< T, SORT >::end(), errorMatrix2Lands_multiChannel::id, kPNAmplitude, kPNOccupancy, max(), ecaldqm::DQWorker::MEs_, nPNGain, evf::evtn::offset(), pnAmp_, compare_using_db::sample, and wavelength_.

Referenced by analyze().

  {
    for(EcalPnDiodeDigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr){
      const EcalPnDiodeDetId& id(digiItr->id());

      int iDCC(dccId(id) - 1);

      if(!enable_[iDCC]) continue;

      MEs_[kPNOccupancy]->fill(id);

      float pedestal(0.);
      for(int iSample(0); iSample < 4; iSample++)
        pedestal += digiItr->sample(iSample).adc();
      pedestal /= 4.;

      float max(0.);
      for(int iSample(0); iSample < 50; iSample++){
        EcalFEMSample sample(digiItr->sample(iSample));

        float amp(digiItr->sample(iSample).adc() - pedestal);

        if(amp > max) max = amp;
      }

      int gain(digiItr->sample(0).gainId() == 0 ? 1 : 16);
      max *= (16. / gain);

      unsigned offset((wavelength_[iDCC] - 1) * nPNGain + (gain == 1 ? 0 : 1));

      MEs_[kPNAmplitude + offset]->fill(id, max);

      if(pnAmp_.find(iDCC) == pnAmp_.end()) pnAmp_[iDCC].resize(10);
      pnAmp_[iDCC][id.iPnId() - 1] = max;
    }
  }

void ecaldqm::LaserTask::runOnRawData ( const EcalRawDataCollection _dcchs)

Definition at line 135 of file LaserTask.cc.

References edm::SortedCollection< T, SORT >::begin(), enable_, edm::SortedCollection< T, SORT >::end(), spr::find(), laserWavelengths_, and wavelength_.

Referenced by analyze().

  {
    for(EcalRawDataCollection::const_iterator dcchItr(_dcchs.begin()); dcchItr != _dcchs.end(); ++dcchItr){
      int iDCC(dcchItr->id() - 1);

      if(!enable_[iDCC]) continue;

      wavelength_[iDCC] = dcchItr->getEventSettings().wavelength + 1;

      if(std::find(laserWavelengths_.begin(), laserWavelengths_.end(), wavelength_[iDCC]) == laserWavelengths_.end()) enable_[iDCC] = false;
    }
  }

void ecaldqm::LaserTask::runOnUncalibRecHits ( const EcalUncalibratedRecHitCollection _uhits,
Collections  _collection 
)

Definition at line 208 of file LaserTask.cc.

References edm::SortedCollection< T, SORT >::begin(), ecaldqm::dccId(), MEEEGeom::dee(), enable_, edm::SortedCollection< T, SORT >::end(), ecaldqm::getEEPnDCC(), errorMatrix2Lands_multiChannel::id, EBDetId::ieta(), EBDetId::iphi(), EcalScDetId::ix(), EcalScDetId::iy(), kAmplitude, kAmplitudeSummary, kAOverP, ecaldqm::kEBUncalibRecHit, ecaldqm::kEEUncalibRecHit, kTiming, MEEEGeom::lmmod(), MEEBGeom::lmmod(), max(), ecaldqm::DQWorker::MEs_, evf::evtn::offset(), MEEEGeom::pn(), MEEBGeom::pn(), pnAmp_, wavelength_, and EcalScDetId::zside().

Referenced by analyze().

  {
    using namespace std;

    for(EcalUncalibratedRecHitCollection::const_iterator uhitItr(_uhits.begin()); uhitItr != _uhits.end(); ++uhitItr){
      const DetId& id(uhitItr->id());

      int iDCC(dccId(id) - 1);

      if(!enable_[iDCC]) continue;

      unsigned offset(wavelength_[iDCC] - 1);

      float amp(max((double)uhitItr->amplitude(), 0.));
      float jitter(max((double)uhitItr->jitter() + 5.0, 0.));

      MEs_[kAmplitudeSummary + offset]->fill(id, amp);
      MEs_[kAmplitude + offset]->fill(id, amp);
      MEs_[kTiming + offset]->fill(id, jitter);

      if(pnAmp_.find(iDCC) == pnAmp_.end()) continue;

      float aop(0.);
      float pn0(0.), pn1(0.);
      if(_collection == kEBUncalibRecHit){
        EBDetId ebid(id);

        int lmmod(MEEBGeom::lmmod(ebid.ieta(), ebid.iphi()));
        pair<int, int> pnPair(MEEBGeom::pn(lmmod));

        pn0 = pnAmp_[iDCC][pnPair.first];
        pn1 = pnAmp_[iDCC][pnPair.second];
      }else if(_collection == kEEUncalibRecHit){
        EcalScDetId scid(EEDetId(id).sc());

        int dee(MEEEGeom::dee(scid.ix(), scid.iy(), scid.zside()));
        int lmmod(MEEEGeom::lmmod(scid.ix(), scid.iy()));
        pair<int, int> pnPair(MEEEGeom::pn(dee, lmmod));

        int pnAFED(getEEPnDCC(dee, 0)), pnBFED(getEEPnDCC(dee, 1));

        pn0 = pnAmp_[pnAFED][pnPair.first];
        pn1 = pnAmp_[pnBFED][pnPair.second];
      }

      if(pn0 < 10 && pn1 > 10){
        aop = amp / pn1;
      }else if(pn0 > 10 && pn1 < 10){
        aop = amp / pn0;
      }else if(pn0 + pn1 > 1){
        aop = amp / (0.5 * (pn0 + pn1));
      }else{
        aop = 1000.;
      }

      MEs_[kAOverP + offset]->fill(id, aop);
    }
  }

void ecaldqm::LaserTask::setMEData ( std::vector< MEData > &  _data) [static]

Reimplemented from ecaldqm::DQWorker.

Definition at line 269 of file LaserTask.cc.

References MonitorElement::DQM_KIND_TH2F, MonitorElement::DQM_KIND_TPROFILE, MonitorElement::DQM_KIND_TPROFILE2D, EcalDQMBinningService::AxisSpecs::high, kAmplitude, kAmplitudeSummary, kAOverP, EcalDQMBinningService::kCrystal, EcalDQMBinningService::kEcal2P, EcalDQMBinningService::kEcalMEM2P, kOccupancy, kPNAmplitude, kPNOccupancy, kShape, EcalDQMBinningService::kSM, EcalDQMBinningService::kSMMEM, EcalDQMBinningService::kSuperCrystal, kTiming, EcalDQMBinningService::AxisSpecs::low, EcalDQMBinningService::AxisSpecs::nbins, nPNGain, nWL, and evf::evtn::offset().

  {
    BinService::AxisSpecs axis;
    axis.nbins = 10;
    axis.low = 0.;
    axis.high = 10.;

    for(unsigned iWL(0); iWL < nWL; iWL++){
      _data[kAmplitudeSummary + iWL] = MEData("AmplitudeSummary", BinService::kEcal2P, BinService::kSuperCrystal, MonitorElement::DQM_KIND_TPROFILE2D);
      _data[kAmplitude + iWL] = MEData("Amplitude", BinService::kSM, BinService::kCrystal, MonitorElement::DQM_KIND_TPROFILE2D);
      _data[kOccupancy + iWL] = MEData("Occupancy", BinService::kEcal2P, BinService::kSuperCrystal, MonitorElement::DQM_KIND_TH2F);
      _data[kTiming + iWL] = MEData("Timing", BinService::kSM, BinService::kCrystal, MonitorElement::DQM_KIND_TPROFILE2D);
      _data[kShape + iWL] = MEData("Shape", BinService::kSM, BinService::kSuperCrystal, MonitorElement::DQM_KIND_TPROFILE2D, 0, &axis);
      _data[kAOverP + iWL] = MEData("AOverP", BinService::kSM, BinService::kCrystal, MonitorElement::DQM_KIND_TPROFILE2D);
      for(unsigned iPNGain(0); iPNGain < nPNGain; iPNGain++){
        unsigned offset(iWL * nPNGain + iPNGain);
        _data[kPNAmplitude + offset] = MEData("PNAmplitude", BinService::kSMMEM, BinService::kCrystal, MonitorElement::DQM_KIND_TPROFILE);
      }
    }
    _data[kPNOccupancy] = MEData("PNOccupancy", BinService::kEcalMEM2P, BinService::kCrystal, MonitorElement::DQM_KIND_TH2F);
  }


Member Data Documentation

bool ecaldqm::LaserTask::enable_[BinService::nDCC] [private]
std::vector<int> ecaldqm::LaserTask::laserWavelengths_ [private]

Definition at line 54 of file LaserTask.h.

Referenced by bookMEs(), getLaserWavelengths(), and runOnRawData().

std::vector<int> ecaldqm::LaserTask::MGPAGainsPN_ [private]

Definition at line 55 of file LaserTask.h.

Referenced by bookMEs(), and getMGPAGainsPN().

std::map<int, std::vector<float> > ecaldqm::LaserTask::pnAmp_ [private]

Definition at line 59 of file LaserTask.h.

Referenced by beginRun(), endEvent(), runOnPnDigis(), and runOnUncalibRecHits().

int ecaldqm::LaserTask::wavelength_[BinService::nDCC] [private]