/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Private Member Functions | Private Attributes
AdReadoutFigs Class Reference

#include <AdReadoutFigs.h>

Collaboration diagram for AdReadoutFigs:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 AdReadoutFigs (const std::string &name, ISvcLocator *pSvcLocator)
virtual ~AdReadoutFigs ()
virtual StatusCode initialize ()
virtual StatusCode execute ()
virtual StatusCode finalize ()

Private Member Functions

TH1 * getOrMakeHist (int run, const DayaBay::Detector &detector, int board, int connector, int histogram)
std::string getPath (int run, const char *detectorName, int board, int connector, const char *histName)

Private Attributes

IStatisticsSvcm_statsSvc
TimeStampm_firstTriggerTime
std::map< DayaBay::Detector,
TimeStamp
m_lastTriggerTime
std::map< int, TH1 ** > m_shortCuts
std::vector< TH1 * > m_normalize
IFloatingFeePedestalSvcm_pedesSvc
 Average Pedestal.

Detailed Description

Definition at line 60 of file AdReadoutFigs.h.


Constructor & Destructor Documentation

AdReadoutFigs::AdReadoutFigs ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 26 of file AdReadoutFigs.cc.

  : GaudiAlgorithm(name,pSvcLocator),
    m_statsSvc(0),
    m_firstTriggerTime(0)
{
}
AdReadoutFigs::~AdReadoutFigs ( ) [virtual]

Definition at line 34 of file AdReadoutFigs.cc.

{
}

Member Function Documentation

StatusCode AdReadoutFigs::initialize ( ) [virtual]

FloatingFeePedestalSvc

Definition at line 38 of file AdReadoutFigs.cc.

{
  // Initialize the necessary services
  StatusCode sc = this->service("StatisticsSvc",m_statsSvc,true);
  if(sc.isFailure()){
    error() << "Failed to get StatisticsSvc" << endreq;
    return sc;
  }
  
  sc = service("FloatingDaqFeePedestalSvc",m_pedesSvc);
  if( sc.isFailure() ) {
    error() << "Can't get FloatingDaqFeePedestalSvc" << endreq;
    return sc;
  }

  return sc;
}
StatusCode AdReadoutFigs::execute ( ) [virtual]

----++++---- Select dark noise hit for PMT RollingGain calibration ----++++----

for a pedestal reference

Cut: Block ESum-only trigger, always noisy

Cut: Delta T cut (Save time. Singles rate may be wrong. But that needs to decoupled from this later.)

Loop over channel data

The first loop over channel data; calculate NoiseMulti (Multiplicity in noise window) first.

get the first tdc

Loop over channel data again; hit filling

Loop over each hit

1. Including NHit trigger

Excluding Random trigger

Out of main event trigger window

Noise Mulitiplicity <3. Remove below trigger events

2. Just for random trigger

Other cuts: Only one hit per channel

High Gain i.e. Fine Range

Remove irregular hits with nonstandard peak cycle (DocDB 6819 & 6973)

Remove events with bad baseline

Remove 40MHz noise (DocDB 5527)

The Fill

----++++---- End of dark noise hit selection ----++++----

Definition at line 57 of file AdReadoutFigs.cc.

{
  // Add the current event into histograms
  DayaBay::ReadoutHeader* readoutHeader = 
    get<DayaBay::ReadoutHeader>("/Event/Readout/ReadoutHeader");
  if(!readoutHeader){
    error() << "Failed to get readout header." << endreq;
    return StatusCode::FAILURE;
  }

  const DayaBay::DaqCrate* daqCrate = readoutHeader->daqCrate();
  if(!daqCrate){
    error() << "Failed to get DAQ crate from header" << endreq;
    return StatusCode::FAILURE;
  }
  
  // Convert to PMT crate readout
  const DayaBay::DaqPmtCrate* pmtCrate
      = daqCrate->asPmtCrate();
  if(!pmtCrate){
    // Not an AD, continue
    return StatusCode::SUCCESS;
  }

  if(!m_firstTriggerTime){
    m_firstTriggerTime = new TimeStamp(pmtCrate->triggerTime());
  }

  //  Get the number of blocked triggers due to FEE/LTB buffer full
  const DayaBay::DaqLtb&  pmtLtb = pmtCrate->localTriggerBoard() ;
  const DayaBay::DaqLtb::LtbFramePtrList&   pmtLtbFramesPtrs = pmtLtb.frames();
  const DayaBay::DaqLtbFrame* firstTriggerFrame = pmtLtbFramesPtrs.front();

  if(!firstTriggerFrame){
     error() << "Failed to get first trigger frame." << endreq;
     return StatusCode::FAILURE;
  }
  unsigned int nBlocked  = firstTriggerFrame->blockedTriggerCount();


  // Find histograms
  int runNumber = pmtCrate->runNumber();
  const DayaBay::Detector& detector = pmtCrate->detector();
  TH1F* triggerRate = dynamic_cast<TH1F*>(this->getOrMakeHist(runNumber,
                                                            detector,
                                                            0, 0, TRIGGERRATE));
  TH1F* dtTrigger = dynamic_cast<TH1F*>(this->getOrMakeHist(runNumber,
                                                            detector,
                                                            0, 0, DTTRIGGER));
  TH1F* logDtTrigger = dynamic_cast<TH1F*>(this->getOrMakeHist(runNumber,
                                                               detector,
                                                               0, 0, 
                                                               LOGDTTRIGGER));
  TH1F* nChannels = dynamic_cast<TH1F*>(this->getOrMakeHist(runNumber,
                                                            detector,
                                                            0, 0, 
                                                            NCHANNELS));
  TH2F* nChannelsVsTime =  dynamic_cast<TH2F*>(this->getOrMakeHist(runNumber,
                                                            detector,
                                                            0, 0, 
                                                            NCHANNELSVSTIME));
  TH2F* channelHits = dynamic_cast<TH2F*>(this->getOrMakeHist(runNumber,
                                                              detector,
                                                              0, 0, 
                                                              CHANNELHITS));
  TH2F* channelDadcFine = dynamic_cast<TH2F*>(this->getOrMakeHist(runNumber,
                                                            detector,
                                                            0, 0, 
                                                            CHANNELDADCFINE));
  TH2F* channelDadcCoarse = dynamic_cast<TH2F*>(this->getOrMakeHist(runNumber,
                                                            detector,
                                                            0, 0, 
                                                            CHANNELDADCCOARSE));
  TH2F* tdcVsBoard = dynamic_cast<TH2F*>(this->getOrMakeHist(runNumber,
                                                             detector,
                                                             0, 0, 
                                                             TDCVSBOARD));

  TH1F* triggerBlocked = dynamic_cast<TH1F*>(this->getOrMakeHist(runNumber, detector,
                                                            0,0, TRIGGERBLOCKED));

  TH1F* triggerBits = dynamic_cast<TH1F*>(this->getOrMakeHist(runNumber, 
                                                              detector, 0, 0,
                                                              TRIGGERBITS));
  
  if(pmtCrate->triggerTime().GetSeconds()-triggerRate->GetXaxis()->GetXmax() > 1800)
  {
    // Catch large gaps in data, and fail
    error() << "An invalid gap of " 
            << pmtCrate->triggerTime().GetSeconds()-triggerRate->GetXaxis()->GetXmax() 
            << " seconds has been found in the data.  Bailing..." << endreq;
    return  StatusCode::FAILURE;
  }

  while(pmtCrate->triggerTime().GetSeconds() >= 
        triggerRate->GetXaxis()->GetXmax()){
    StatusCode sc = HistogramTools::extendRange(msgSvc(), triggerRate, 60);
    if(!sc.isSuccess()) return sc;
  }
  while(pmtCrate->triggerTime().GetSeconds() >= 
        nChannelsVsTime->GetXaxis()->GetXmax()){
    StatusCode sc = HistogramTools::extendRange(msgSvc(), nChannelsVsTime, 60);
    if(!sc.isSuccess()) return sc;
  }

  while(pmtCrate->triggerTime().GetSeconds() >=
        triggerBlocked->GetXaxis()->GetXmax()){
    StatusCode sc = HistogramTools::extendRange(msgSvc(), triggerBlocked, 60);
    if(!sc.isSuccess()) return sc;
   }


  const DayaBay::DaqPmtCrate::PmtChannelPtrList& channels
    = pmtCrate->channelReadouts();
    
  DayaBay::DaqPmtCrate::PmtChannelPtrList::const_iterator channelIter, 
    channelEnd = channels.end();

  triggerRate->Fill(pmtCrate->triggerTime().GetSeconds());
  if (channels.size() >= nChannelsVsTime->GetYaxis()->GetXmin() 
      && channels.size() < nChannelsVsTime->GetYaxis()->GetXmax()) {
    nChannelsVsTime->Fill(pmtCrate->triggerTime().GetSeconds(), channels.size() );
  }
  triggerBlocked->Fill(pmtCrate->triggerTime().GetSeconds(), nBlocked);

  double dttriggertime = 0;
  if(m_lastTriggerTime.find(pmtCrate->detector()) != m_lastTriggerTime.end()){
    TimeStamp dtTriggerTime = pmtCrate->triggerTime();
    dtTriggerTime.Subtract(m_lastTriggerTime[pmtCrate->detector()]);
    dtTrigger->Fill(dtTriggerTime.GetSeconds());
    logDtTrigger->Fill(TMath::Log10(dtTriggerTime.GetSeconds()));
    dttriggertime = dtTriggerTime.GetSeconds();
  }

  nChannels->Fill( channels.size() );

  for(channelIter = channels.begin(); channelIter!=channelEnd; channelIter++) { 
    const DayaBay::DaqPmtChannel& channel = *(*channelIter);

    int board = channel.channelId().board();
    int connector = channel.channelId().connector();
    TH1F* tdc = dynamic_cast<TH1F*>(this->getOrMakeHist(runNumber,
                                                        detector,
                                                        board, connector, 
                                                        TDC));

    TH1F* adcFine = dynamic_cast<TH1F*>(this->getOrMakeHist(runNumber,
                                                            detector,
                                                            board, connector, 
                                                            ADCFINE));
    TH1F* adcCoarse = dynamic_cast<TH1F*>(this->getOrMakeHist(runNumber,
                                                              detector,
                                                              board, connector, 
                                                              ADCCOARSE));
    TH2S* dadcVsTimeFine = dynamic_cast<TH2S*>(this->getOrMakeHist(runNumber,
                                                              detector,
                                                              board, 
                                                              connector, 
                                                              DADCVSTIMEFINE));
    TH2F* dadcVsPedFine = dynamic_cast<TH2F*>(this->getOrMakeHist(runNumber,
                                                              detector,
                                                              board, 
                                                              connector, 
                                                              DADCVSPEDFINE));
    TH2F* dadcFineVsTdc = dynamic_cast<TH2F*>(this->getOrMakeHist(runNumber,
                                                              detector,
                                                              board, 
                                                              connector, 
                                                              DADCFINEVSTDC));
    TH2F* pedFineVsTdc = dynamic_cast<TH2F*>(this->getOrMakeHist(runNumber,
                                                              detector,
                                                              board, 
                                                              connector, 
                                                              PEDFINEVSTDC));

    while(pmtCrate->triggerTime().GetSeconds() >= 
          dadcVsTimeFine->GetXaxis()->GetXmax()){
      StatusCode sc = HistogramTools::extendRange(msgSvc(), dadcVsTimeFine, 60);
      if(!sc.isSuccess()) return sc;
    }

    // Channel Hit Map
    channelHits->Fill(board, connector);

    // First hit histograms
    if(channel.hitCount()>0){
        if(channel.isHighGainAdc(0)){
        channelDadcFine->Fill(board, connector,
                              channel.deltaAdc(0));
        channelDadcFine->SetNormFactor( channelDadcFine->GetNormFactor()+1 );
      }else{
        channelDadcCoarse->Fill(board, connector,
                                channel.deltaAdc(0));
        channelDadcCoarse->SetNormFactor(channelDadcCoarse->GetNormFactor()+1);
      }
    }
    
    // All hits
    for(unsigned int hitIdx=0; hitIdx<channel.hitCount(); hitIdx++){
      double epsilon = 0.01;
      tdcVsBoard->Fill(board + connector/double(NCONNECTORS) + epsilon,
                       channel.tdc(hitIdx));
      tdc->Fill(channel.tdc(hitIdx));
      float deltaAdc = channel.deltaAdc(hitIdx);
      if(channel.isHighGainAdc(hitIdx)){
        adcFine->Fill(channel.adc(hitIdx));
        if(dadcVsTimeFine->GetYaxis()->GetXmin()<=deltaAdc
           && dadcVsTimeFine->GetYaxis()->GetXmax()>deltaAdc){
          dadcVsTimeFine->Fill(pmtCrate->triggerTime().GetSeconds(), deltaAdc);
        }
        dadcVsPedFine->Fill(channel.preAdcAvg(hitIdx), deltaAdc);
        dadcFineVsTdc->Fill(channel.tdc(hitIdx), deltaAdc);
        pedFineVsTdc->Fill(channel.tdc(hitIdx), channel.preAdcAvg(hitIdx));

      }else{
        adcCoarse->Fill(channel.adc(hitIdx));
      }
    }
  }
   
  {
    StatusCode sc;
    sc = m_pedesSvc->cumulate( readoutHeader );
    
    DayaBay::Trigger::TriggerType_t trigType = daqCrate->triggerType();
    if( trigType == DayaBay::Trigger::kESumAll )   goto EndofHitCollection;
    
    if( dttriggertime < 20e-6 )  goto EndofHitCollection;
    
    DayaBay::DaqPmtCrate::PmtChannelPtrList::const_iterator ci, ci_end = channels.end();

    int NoiseMulti=0;
    for(ci = channels.begin(); ci!=ci_end; ci++) {
      const DayaBay::DaqPmtChannel* channel = *ci;
      // number of hits in this channel
      unsigned int multi = channel->hitCount();
      int tdc;
      if(multi>=1)  {
        tdc = channel->tdc(0);
        if(tdc>1070)  NoiseMulti += 1;
      }
    }

    for(ci = channels.begin(); ci!=ci_end; ci++) {

      const DayaBay::DaqPmtChannel* channel = *ci;
      DayaBay::FeeChannelId channelId = channel->channelId();
      int board = channelId.board();
      int connector = channelId.connector();
      TH2F* dndadcVsTimeFine = dynamic_cast<TH2F*>(this->getOrMakeHist(runNumber,
                                                                       detector,
                                                                       board,
                                                                       connector,
                                                                       DNDADCVSTIMEFINE));
      
      while(pmtCrate->triggerTime().GetSeconds() >=
            dndadcVsTimeFine->GetXaxis()->GetXmax()){
        StatusCode sc = HistogramTools::extendRange(msgSvc(), dndadcVsTimeFine,
                                                    1);
        if(!sc.isSuccess())  goto EndofHitCollection;
      }
      
      // number of hits in this channel
      unsigned int multi = channel->hitCount();
      for(unsigned int nr = 0; nr<multi; ++nr) {
        int tdc = channel->tdc(nr);
        int adc = channel->adc(nr);
        float preAdc = channel->preAdcAvg(nr);
        int gain = channel->isHighGainAdc(nr) ? DayaBay::FeeGain::kHigh : DayaBay::FeeGain::kLow ;
        int peakCycle = channel->peakCycle(nr);
        double avePed = m_pedesSvc->pedestal( channelId, gain );

        // Accumulate hits for gain fitting
        // Incorporate regular triggers and random triggers
        if( ( ((trigType & DayaBay::Trigger::kMult) == DayaBay::Trigger::kMult) &&            
              ((trigType & DayaBay::Trigger::kRandom) != DayaBay::Trigger::kRandom) &&        
              (tdc>1070) &&                                                                   
              (NoiseMulti<3) ) ||                                                             
            
            ( ((trigType & DayaBay::Trigger::kRandom) == DayaBay::Trigger::kRandom) ) ) {     
          
          int residue = (tdc-15)%16;
          
          if( multi==1 &&                               
              gain==DayaBay::FeeGain::kHigh &&          
              peakCycle>=4 && peakCycle<=6 &&           
              fabs( preAdc-avePed ) <20 &&              
              residue>=4 )   {                          

            if( adc-preAdc>-5 && adc-preAdc<115 ) 
              dndadcVsTimeFine->Fill(pmtCrate->triggerTime().GetSeconds(), adc-preAdc);
          }
        }
      }
    }
  } // end of channels 
  
  EndofHitCollection:

 
    unsigned int trigType = pmtCrate->triggerType();
    //int trigType = daqTrigType(pmtCrate->triggerType());
    //std::cout << trigType << std::endl;
    for(unsigned i=0; i<16; i++) {
      if(trigType & 1<<i) {
        triggerBits->Fill(i);
      }
    }

    bool forced = 0;
    const int mask = 0x0fffffff; //remove leading 1
    //both "random" and periodic triggers are forced triggers
    int ran = mask & (trigType & DayaBay::Trigger::kRandom);
    int peri = mask & (trigType & DayaBay::Trigger::kPeriodic);
    if(ran||peri) forced = 1;
    //printf("trigtype\t%x\tforced\t%d\tran\t%d\tperi\t%d\n",trigType,forced,ran,peri);
    //now try to fill random TDC histogram
    //need four levels of cuts. See G. Cao's DocDB 6820
    //-nhits < 15
    //-rmsTDC > 50
    //-TDC mult = 1 for hit channel
    //-maxADC/totalADC < 0.8  
    //-ADC > 0
    
    if(forced == 1){
    //temporary histogram to obtain TDCRMS
      TH1F* h1 = new TH1F("h1","h1",108,360,1220);
      float maxAdc = 0;
      float TotalAdc = 0;
      float tdcRMS = 0;
      int   nhit = 0;

      for(channelIter = channels.begin(); channelIter!=channelEnd; 
          channelIter++) {
        const DayaBay::DaqPmtChannel& channel = *(*channelIter);
        for(unsigned int i=0; i<channel.hitCount(); i++) {
          int tdc = channel.tdc(i);
          int adc = channel.adc(i);
          float preAdc = channel.preAdcAvg(i);
          float deltaAdc = adc - preAdc;
          if(maxAdc < deltaAdc) {
            maxAdc = deltaAdc;
          }
          TotalAdc += deltaAdc;
          if(i == 0)  h1->Fill(tdc); //fill first hit in each channel
        }//loop over hits in a channel
        nhit += channel.hitCount();
      }//loop over all channels
      tdcRMS = h1->GetRMS();
      //cout << " eventNo: " << pmtCrate->eventNumber() << " RMS: " << tdcRMS << " maxAdc: " << maxAdc << " TotalAdc: " << TotalAdc << " nhit: " << nhit << endl;
      //now loop over all channel again. fill TDC spectra for forced triggers
      for(channelIter = channels.begin(); channelIter!=channelEnd; channelIter++) {
        const DayaBay::DaqPmtChannel& channel = *(*channelIter);
        int board = channel.channelId().board();
        int connector = channel.channelId().connector();
        TH1F* tdcForced = dynamic_cast<TH1F*>(this->getOrMakeHist(runNumber,
                                                                  detector,
                                                                  board,
                                                                  connector,
                                                                  TDCFORCED));

        if(nhit<15 && tdcRMS>50 && channel.hitCount()==1 
           //commented by jliu, 9/23/2011.  the cut below would remove nhit = 1
           //events, which will bias the dark rate
           //&& Float_t(maxAdc)/Float_t(TotalAdc) < 0.8
           && channel.adc(0) > channel.preAdcAvg(0)
           ) 
          tdcForced->Fill(channel.tdc(0));
      }
      delete h1;
      h1 = 0;
    }//forced trigger only
    
  channelHits->SetNormFactor( channelHits->GetNormFactor()+1 );

  m_lastTriggerTime[pmtCrate->detector()] = pmtCrate->triggerTime();

  return StatusCode::SUCCESS;
}
StatusCode AdReadoutFigs::finalize ( ) [virtual]

Definition at line 447 of file AdReadoutFigs.cc.

{
  // Handle Normalized histograms
  for(unsigned int normIdx=0; normIdx<m_normalize.size(); normIdx++){
    TH1* hist = m_normalize[normIdx];
    hist->Sumw2();
    if(hist->GetNormFactor()>0){
      double scale = 1./hist->GetNormFactor();
      hist->SetNormFactor(1);
      hist->Scale( scale );
    }
    hist->SetBit(TH1::kIsAverage);
  }
  m_normalize.clear();
  // Clean-up histogram shortcuts
  std::map<int,TH1**>::iterator histIter, histEnd = m_shortCuts.end();
  for(histIter = m_shortCuts.begin(); histIter!=histEnd; histIter++){
    delete [] (histIter->second);
    histIter->second = 0;
  }
  if( m_statsSvc ) m_statsSvc->release();
  if(m_firstTriggerTime){
    delete m_firstTriggerTime;
    m_firstTriggerTime = 0;
  }
  return StatusCode::SUCCESS;
}
TH1 * AdReadoutFigs::getOrMakeHist ( int  run,
const DayaBay::Detector detector,
int  board,
int  connector,
int  histogram 
) [private]

Definition at line 477 of file AdReadoutFigs.cc.

{
  int siteInt = 0;
  switch(detector.site()){
  case Site::kUnknown:
    siteInt = 0; break;
  case Site::kDayaBay:
    siteInt = 1; break;
  case Site::kLingAo:
    siteInt = 2; break;
  case Site::kFar:
    siteInt = 3; break;
  case Site::kSAB:
    siteInt = 4; break;
  default:
    error() << "Unknown site: " << detector.detName() << endreq;
    return 0;
  }
  int detectorInt = int(detector.detectorId());
  std::map<int,TH1**>::iterator histIter = m_shortCuts.find(run);
  TH1** histograms = 0;
  if( histIter == m_shortCuts.end() ){
    // Initialize histogram shortcuts
    histograms = new TH1*[MAXHISTS];
    for(int i=0; i<MAXHISTS; i++) histograms[i] = 0;
    m_shortCuts[run] = histograms;
  }else{
    // Found run
    histograms = histIter->second;
  }
  
  TH1* hist = 
    histograms[siteInt * NDETECTORS * NBOARDS * NCONNECTORS * NHISTOGRAMS
               + detectorInt * NBOARDS * NCONNECTORS * NHISTOGRAMS
               + board * NCONNECTORS * NHISTOGRAMS
               + connector * NHISTOGRAMS
               + histogram];
  if(!hist){
    // Make this histogram
    std::string histName;
    if(detector.detectorId()){
      if(board){
        // Make channel histograms
        switch(histogram){
        case TDC:
          // TDC Values
          histName = "tdc";
          hist = new TH1F(histName.c_str(),
                          "TDC",
                          1000,300,1300);
          hist->GetXaxis()->SetTitle("TDC");
          hist->GetYaxis()->SetTitle("Entries");
          break;
        case TDCFORCED:
          // TDC Values (Forced Triggers)
          histName = "tdcForced";
          hist = new TH1F(histName.c_str(),
                          "TDC (Forced Trigger)",
                          1000, 300, 1300);
          hist->GetXaxis()->SetTitle("TDC");
          hist->GetYaxis()->SetTitle("Entries");
          break;
        case ADCFINE:
          // ADC Values (Fine Range)
          histName = "adcFine";
          hist = new TH1F(histName.c_str(),
                          "ADC (Fine Range)",
                          4096,0,4096);
          hist->GetXaxis()->SetTitle("ADC");
          hist->GetYaxis()->SetTitle("Entries");
          break;
        case ADCCOARSE:
          // ADC Values (Coarse Range)
          histName = "adcCoarse";
          hist = new TH1F(histName.c_str(),
                          "ADC (Coarse Range)",
                          4096,0,4096);
          hist->GetXaxis()->SetTitle("ADC");
          hist->GetYaxis()->SetTitle("Entries");
          break;
        case DADCVSTIMEFINE:
          // DeltaADC Values Vs Time (Fine Range)
          histName = "dadcVsTimeFine";
          hist = new TH2S(histName.c_str(),
                          "#DeltaADC vs Time (Fine Range)",
                          60,m_firstTriggerTime->GetSec(),
                          m_firstTriggerTime->GetSec()+60,
                          80,-20,60);
          hist->GetXaxis()->SetTitle("Run Time [Beijing]");
          hist->GetYaxis()->SetTitle("#DeltaADC");
          hist->GetXaxis()->SetTimeDisplay(1);
          hist->GetXaxis()->SetTimeFormat(timeFormat);
          hist->GetXaxis()->SetTimeOffset(0,"gmt");
          hist->GetXaxis()->SetNdivisions(505);
          break;
        case DADCVSPEDFINE:
          // DeltaADC Values Vs. PreADC (Fine Range)
          histName = "dadcVsPedFine";
          hist = new TH2F(histName.c_str(),
                          "#DeltaADC vs. PreADC (Fine Range)",
                          200,0,200,200,-100,100);
          hist->GetXaxis()->SetTitle("PreADC");
          hist->GetYaxis()->SetTitle("#DeltaADC");
          break;
        case DADCFINEVSTDC:
          // DeltaADC Values Vs. TDC (Fine Range)
          histName = "dadcFineVsTdc";
          hist = new TH2F(histName.c_str(),
                          "#DeltaADC vs. TDC (Fine Range)",
                          100,300,1300,200,-100,100);
          hist->GetXaxis()->SetTitle("TDC");
          hist->GetYaxis()->SetTitle("#DeltaADC");
          break;
        case PEDFINEVSTDC:
          // PreADC Values Vs. TDC (Fine Range)
          histName = "pedFineVsTdc";
          hist = new TH2F(histName.c_str(),
                          "PreADC vs. TDC (Fine Range)",
                          100,300,1300,200,0,200);
          hist->GetXaxis()->SetTitle("TDC");
          hist->GetYaxis()->SetTitle("PreADC");
          break;
        case DNDADCVSTIMEFINE:
          // Selected dark noise delta-ADC vs Time histogram for RollingGain automation
          histName = "dndadcVsTimeFine";
          hist = new TH2F(histName.c_str(),
                          "Dark Noise DeltaADC vs. Time",
                          1, 
                          (m_firstTriggerTime->GetSec() - m_firstTriggerTime->GetSec() % (60*15)),
                          (m_firstTriggerTime->GetSec() - m_firstTriggerTime->GetSec() % (60*15)) + 60*15,
                          480,-5,115);
          hist->GetXaxis()->SetTitle("Run Time [Beijing]");
          hist->GetYaxis()->SetTitle("Dark Noise DeltaADC");
          hist->GetXaxis()->SetTimeDisplay(1);
          hist->GetXaxis()->SetTimeFormat(timeFormat);
          hist->GetXaxis()->SetTimeOffset(0,"gmt");
          hist->GetXaxis()->SetNdivisions(505);
          break;
        default:
          error() << "Unknown Histogram: " << histogram << endreq;
          return 0;
        }
      }else{
        // Make detector histogram
        switch(histogram){
        case TRIGGERRATE:
          // Trigger rate
          histName = "triggerRate";
          hist = new TH1F(histName.c_str(),"Trigger Rate",
                          60,m_firstTriggerTime->GetSec(),
                          m_firstTriggerTime->GetSec()+60);
          hist->GetXaxis()->SetTitle("Run Time [Beijing]");
          hist->GetYaxis()->SetTitle("Rate [Hz]");
          hist->GetXaxis()->SetTimeDisplay(1);
          hist->GetXaxis()->SetTimeFormat(timeFormat);
          hist->GetXaxis()->SetTimeOffset(0,"gmt");
          hist->GetXaxis()->SetNdivisions(505);
          break;
        case DTTRIGGER:
          // Time Between triggers
          histName = "dtTrigger";
          //hist = new TH1F(histName.c_str(),"Time Between Triggers",
          //              1000,0,0.015);
          //lower the minimum to -12.5ns to save number of dt<-12.5 events in bin 0.
          hist = new TH1F(histName.c_str(),"Time Between Triggers",
                          1000,-12.5e-9,0.015);
          hist->GetXaxis()->SetTitle("#Deltat [s]");
          break;
        case LOGDTTRIGGER:
          // Logarithm of Time Between triggers
          histName = "logDtTrigger";
          hist = new TH1F(histName.c_str(),"Time Between Triggers",
                          900,-8,1);
          hist->GetXaxis()->SetTitle("log_{10}(#Deltat / 1s)");
          break;
        case NCHANNELS:
          // Number of channels in event
          histName = "nChannels";
          hist = new TH1F(histName.c_str(),
                          "Number of Channels in Event",200,0,200);
          hist->GetXaxis()->SetTitle("Number of Channels");
          break;
        case NCHANNELSVSTIME:
          // Number of channels in event vs. time
          histName = "nChannelsVsTime";
          hist = new TH2F(histName.c_str(),
                          "Number of Channels in Event vs. Time",
                          60,m_firstTriggerTime->GetSec(),
                          m_firstTriggerTime->GetSec()+60,200,0,200);
          hist->GetXaxis()->SetTitle("Run Time [Beijing]");
          hist->GetYaxis()->SetTitle("Number of Channels");
          hist->GetXaxis()->SetTimeDisplay(1);
          hist->GetXaxis()->SetTimeFormat(timeFormat);
          hist->GetXaxis()->SetTimeOffset(0,"gmt");
          hist->GetXaxis()->SetNdivisions(505);
          break;
        case CHANNELHITS:
          // Channel hit rates
          histName = "channelHits";
          hist = new TH2F(histName.c_str(),"Occupancy of FEE Channels",
                          20,0.5,20.5,16,0.5,16.5);
          hist->GetXaxis()->SetTitle("FEE Board");
          hist->GetYaxis()->SetTitle("FEE Connector");
          m_normalize.push_back(hist);
          hist->SetNormFactor(0);
          hist->SetStats(0);
          break;
        case CHANNELDADCFINE:
          // Channel dADC (Fine ADC)
          histName = "channelDadcFine";
          hist = new TH2F(histName.c_str(),
                          "Mean Fine #DeltaADC on FEE Channels",
                          20,0.5,20.5,16,0.5,16.5);
          hist->GetXaxis()->SetTitle("FEE Board");
          hist->GetYaxis()->SetTitle("FEE Connector");
          m_normalize.push_back(hist);
          hist->SetNormFactor(0);
          hist->SetStats(0);
          break;
        case CHANNELDADCCOARSE:
          // Channel charge (Coarse ADC)
          histName = "channelDadcCoarse";
          hist = new TH2F(histName.c_str(),
                          "Mean Coarse #DeltaADC on FEE Channels",
                          20,0.5,20.5,16,0.5,16.5);
          hist->GetXaxis()->SetTitle("FEE Board");
          hist->GetYaxis()->SetTitle("FEE Connector");
          m_normalize.push_back(hist);
          hist->SetNormFactor(0);
          hist->SetStats(0);
          break;
        case TDCVSBOARD:
          // TDC values vs board
          histName = "tdcVsBoard";
          hist = new TH2F(histName.c_str(),
                          "TDC vs. Board",
                          NBOARDS*NCONNECTORS,0,NBOARDS,1000,300,1300);
          hist->GetXaxis()->SetTitle("FEE Board");
          hist->GetYaxis()->SetTitle("TDC");
          break;
        case  TRIGGERBLOCKED:
          histName = "triggerBlocked";
          hist = new TH1F(histName.c_str(), "triggerBlocked",
                          60, m_firstTriggerTime->GetSec(),
                          m_firstTriggerTime->GetSec()+60 ) ;
          hist->GetXaxis()->SetTitle("Run Time [Beijing]");
          hist->GetYaxis()->SetTitle("nBlocked Triggers");
          
          hist->GetXaxis()->SetTimeDisplay(1);
          hist->GetXaxis()->SetTimeFormat(timeFormat);
          hist->GetXaxis()->SetTimeOffset(0,"gmt");
          hist->GetXaxis()->SetNdivisions(505);
          break;
        case TRIGGERBITS:
          // trigger bit
          histName = "triggerBits";
          hist = new TH1F(histName.c_str(),"Trigger bits",
                          16,-0.5,15.5);
          hist->GetXaxis()->SetTitle("Trigger bits");
          hist->GetYaxis()->SetTitle("Events");
          break;
        default:
          error() << "Unknown Histogram: " << histogram << endreq;
          return 0;
        }
      }
    }
    debug() << "Making histogram: " << histName << endreq;
    m_statsSvc->put( this->getPath(run, detector.detName().c_str(), board, 
                                   connector, histName.c_str()), 
                     hist );
    histograms[siteInt * NDETECTORS * NBOARDS * NCONNECTORS * NHISTOGRAMS
               + detectorInt * NBOARDS * NCONNECTORS * NHISTOGRAMS
               + board * NCONNECTORS * NHISTOGRAMS
               + connector * NHISTOGRAMS
               + histogram] = hist;
  }

  return hist;
}
std::string AdReadoutFigs::getPath ( int  run,
const char *  detectorName,
int  board,
int  connector,
const char *  histName 
) [private]

Definition at line 759 of file AdReadoutFigs.cc.

{
  // Construct histogram path in statistics service
  std::stringstream path;
  path << "/file1/diagnostics/run_" << std::setfill('0') << std::setw(7) 
       << run;
  if(detectorName){
    path << "/detector_" << detectorName;
    if(board){
      path << "/channel_board" << std::setfill('0') << std::setw(2) 
           << board << "_connector" << std::setfill('0') << std::setw(2)
           << connector;
    }
  }
  path << "/" << histName;
  return path.str();
}

Member Data Documentation

Definition at line 79 of file AdReadoutFigs.h.

Definition at line 81 of file AdReadoutFigs.h.

Definition at line 82 of file AdReadoutFigs.h.

std::map<int,TH1**> AdReadoutFigs::m_shortCuts [private]

Definition at line 83 of file AdReadoutFigs.h.

std::vector<TH1*> AdReadoutFigs::m_normalize [private]

Definition at line 84 of file AdReadoutFigs.h.

Average Pedestal.

Definition at line 87 of file AdReadoutFigs.h.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 10:04:10 for AdBasicFigs by doxygen 1.7.4