CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Static Private Attributes

FineDelayTask Class Reference

#include <FineDelayTask.h>

Inheritance diagram for FineDelayTask:
CommissioningTask

List of all members.

Public Member Functions

 FineDelayTask (DQMStore *, const FedChannelConnection &)
virtual ~FineDelayTask ()

Private Member Functions

virtual void book ()
virtual void fill (const SiStripEventSummary &, const edm::DetSet< SiStripRawDigi > &)
virtual void update ()

Static Private Attributes

static MonitorElementmode_ = NULL
static HistoSet timing_

Detailed Description

Definition at line 11 of file FineDelayTask.h.


Constructor & Destructor Documentation

FineDelayTask::FineDelayTask ( DQMStore dqm,
const FedChannelConnection conn 
)

Definition at line 20 of file FineDelayTask.cc.

References LogDebug.

                                                                 :
  CommissioningTask( dqm, conn, "FineDelayTask" )
{
  LogDebug("Commissioning") << "[FineDelayTask::FineDelayTask] Constructing object...";
}
FineDelayTask::~FineDelayTask ( ) [virtual]

Definition at line 29 of file FineDelayTask.cc.

References LogDebug.

                              {
  LogDebug("Commissioning") << "[FineDelayTask::FineDelayTask] Destructing object...";
}

Member Function Documentation

void FineDelayTask::book ( ) [private, virtual]

Reimplemented from CommissioningTask.

Definition at line 35 of file FineDelayTask.cc.

References DQMStore::bookInt(), sistrip::extrainfo::clusterCharge_, sistrip::DET_KEY, CommissioningTask::dqm(), sistrip::EXPERT_HISTO, sistrip::FINE_DELAY, HIGHBIN, CommissioningTask::HistoSet::histo(), SiStripKey::key(), LogDebug, LOWBIN, mode_, NBINS, SiStripKey::path(), DQMStore::pwd(), alignCSCRings::pwd, sistrip::root_, DQMStore::setCurrentFolder(), timing_, indexGen::title, sistripsummary::TRACKER, CommissioningTask::HistoSet::vNumOfEntries_, CommissioningTask::HistoSet::vSumOfContents_, and CommissioningTask::HistoSet::vSumOfSquares_.

                         {
  LogDebug("Commissioning") << "[FineDelayTask::book]";

  std::string title;
  int nBins = NBINS;
  SiStripDetKey detkeytracker((uint32_t) 0);

  // see if the global timing histogram is already booked
  if (timing_.histo()) {
    // if already booked, use it
    LogDebug("Commissioning") << "[FineDelayTask::book] using existing histogram.";
  } else {
    // make a new histo on the tracker level if not existing yet
    LogDebug("Commissioning") << "[LatencyTask::book] booking a new histogram.";
    // construct the histo title
    title = SiStripHistoTitle( sistrip::EXPERT_HISTO,
                               sistrip::FINE_DELAY,
                               sistrip::DET_KEY,
                               detkeytracker.key(),
                               sistrip::TRACKER,
                               0,
                               sistrip::extrainfo::clusterCharge_ ).title();
    dqm()->setCurrentFolder( detkeytracker.path() );
    timing_.histo( dqm()->bookProfile( title, title,            // name and title
                                       nBins, LOWBIN, HIGHBIN,  // binning + range
                                       100, 0., -1., "s" ) );   // Y range : automatic
    timing_.vNumOfEntries_.resize(nBins,0);
    timing_.vSumOfContents_.resize(nBins,0);
    timing_.vSumOfSquares_.resize(nBins,0);
  }
  LogDebug("Commissioning") << "Binning is " << timing_.vNumOfEntries_.size();
  LogDebug("Commissioning") << "[FineDelayTask::book] done";
  if(!mode_) {
    std::string pwd = dqm()->pwd();
    std::string rootDir = pwd.substr(0,pwd.find(std::string(sistrip::root_) + "/")+(sizeof(sistrip::root_)));
    dqm()->setCurrentFolder( rootDir );
    mode_ = dqm()->bookInt("latencyCode");
  }

}
void FineDelayTask::fill ( const SiStripEventSummary summary,
const edm::DetSet< SiStripRawDigi > &  digis 
) [private, virtual]

Reimplemented from CommissioningTask.

Definition at line 78 of file FineDelayTask.cc.

References newFWLiteAna::bin, edm::DetSet< T >::data, MonitorElement::Fill(), HIGHBIN, LogDebug, LOWBIN, mode_, pileupCalc::nbins, NBINS, strip(), summarizeEdmComparisonLogfiles::summary, timing_, and CommissioningTask::updateHistoSet().

                                                                   {
  LogDebug("Commissioning") << "[FineDelayTask::fill]";
  // retrieve the delay from the EventSummary
  float delay = const_cast<SiStripEventSummary&>(summary).ttcrx();
  uint32_t latencyCode = (const_cast<SiStripEventSummary&>(summary).layerScanned()>>24)&0xff;
  LogDebug("Commissioning") << "[FineDelayTask::fill]: layerScanned() is " << const_cast<SiStripEventSummary&>(summary).layerScanned();
  int latencyShift = latencyCode & 0x3f;             // number of bunch crossings between current value and start of scan... must be positive
  if(latencyShift>32) latencyShift -=64;             // allow negative values: we cover [-32,32].. should not be needed.
  if((latencyCode>>6)==2) latencyShift -= 3;         // layer in deconv, rest in peak
  if((latencyCode>>6)==1) latencyShift += 3;         // layer in peak, rest in deconv
  float correctedDelay = delay - (latencyShift*25.); // shifts the delay so that 0 corresponds to the current settings.

  LogDebug("Commissioning") << "[FineDelayTask::fill]; the delay is " << delay;
  // loop on the strips to find the (maybe) non-zero digi
  for(unsigned int strip=0;strip<digis.data.size();strip++) {
    if(digis.data[strip].adc()!=0) {
      // apply the TOF correction
      float tof = (digis.data[strip].adc()>>8)/10.;
      correctedDelay = delay - (latencyShift*25.) - tof;
      if((digis.data[strip].adc()>>8)==255) continue; // skip hit if TOF is in overflow
      // compute the bin
      float nbins = NBINS;
      float lowbin = LOWBIN;
      float highbin = HIGHBIN;
      int bin = int((correctedDelay-lowbin)/((highbin-lowbin)/nbins));
      LogDebug("Commissioning") << "[FineDelayTask::fill]; using a hit with value " << ( digis.data[strip].adc()&0xff )
                                << " at corrected delay of " << correctedDelay
                                << " in bin " << bin << "  (tof is " << tof << "( since adc = " << digis.data[strip].adc() << "))";
      updateHistoSet( timing_,bin,digis.data[strip].adc()&0xff);
      if(mode_) mode_->Fill(latencyCode);
    }
  }
}
void FineDelayTask::update ( void  ) [private, virtual]

Reimplemented from CommissioningTask.

Definition at line 115 of file FineDelayTask.cc.

References LogDebug, timing_, and CommissioningTask::updateHistoSet().

                           {
  LogDebug("Commissioning") << "[FineDelayTask::update]";
  updateHistoSet( timing_ );
}

Member Data Documentation

MonitorElement * FineDelayTask::mode_ = NULL [static, private]

Definition at line 26 of file FineDelayTask.h.

Referenced by book(), and fill().

Definition at line 25 of file FineDelayTask.h.

Referenced by book(), fill(), and update().