/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 Attributes
DetLatency Class Reference

#include <DetLatency.h>

Collaboration diagram for DetLatency:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 DetLatency (const std::string &name, ISvcLocator *pSvcLocator)
virtual ~DetLatency ()
virtual StatusCode initialize ()
virtual StatusCode execute ()
virtual StatusCode finalize ()
void Fit ()
int InitPmtProp (const ServiceMode &svc)
int ResetPmtProp ()

Private Attributes

ICableSvcm_cableSvc
 Cable mapping service.
IRunDataSvcm_runDataSvc
TF1 * f1
TF1 * f2
TF1 * f3
TF1 * f4
TF1 * f5
TF1 * f6
TF1 * f7
TFile * m_rootfile
TTree * m_tree
FILE * m_masterfile
string m_fileName
int m_execNum
unsigned long m_NTrigger
int trigLatencyAD1Status
double trigLatencyAD1
double trigLatencyAD1Err
double trigLatencyAD1Sigma
double trigLatencyAD1SigmaErr
int trigLatencyAD2Status
double trigLatencyAD2
double trigLatencyAD2Err
double trigLatencyAD2Sigma
double trigLatencyAD2SigmaErr
int trigLatencyAD3Status
double trigLatencyAD3
double trigLatencyAD3Err
double trigLatencyAD3Sigma
double trigLatencyAD3SigmaErr
double trigLatencyAD4
int trigLatencyAD4Status
double trigLatencyAD4Err
double trigLatencyAD4Sigma
double trigLatencyAD4SigmaErr
int trigLatencyOWSStatus
double trigLatencyOWS
double trigLatencyOWSErr
double trigLatencyOWSSigma
double trigLatencyOWSSigmaErr
double trigLatencyIWS
int trigLatencyIWSStatus
double trigLatencyIWSErr
double trigLatencyIWSSigma
double trigLatencyIWSSigmaErr
int trigLatencyRPCStatus
double trigLatencyRPC
double trigLatencyRPCErr
double trigLatencyRPCSigma
double trigLatencyRPCSigmaErr
TH1F * h_TrigT_AD1
TH1F * h_TrigT_AD2
TH1F * h_TrigT_AD3
TH1F * h_TrigT_AD4
TH1F * h_TrigT_IWS
TH1F * h_TrigT_OWS
TH1F * h_TrigT_RPC
TH1F * h_TrigT_All
TH1F * h_CalibTrigT
TH1F * h_CalibTrigTErr
TH1F * h_CalibTrigTSigma
TH1F * h_CalibTrigTSigmaErr
IDataProviderSvc * p_archiveSvc
double m_Trig_Interval_Offset_ns
int m_AD_triger_time_sec
int m_AD_triger_time_nanosec
TimeStamp m_tagTimeStamp
TimeStamp m_tagTimeStamp_last
double m_StartTime
double m_EndTime
int m_Fix
int m_NStop
int m_FirstTrigSecond
int m_FirstTrigNanoSec
int m_LastTrigSecond
int m_LastTrigNanoSec
int m_startrun
int m_currentrun
int m_site
int m_simFlag
double m_currentTime
double m_prevTrigTime
double m_lastFitTime
double m_fitPeriod
list __all__ = [ "run" ]

Detailed Description

Definition at line 45 of file DetLatency.h.


Constructor & Destructor Documentation

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

Definition at line 28 of file DetLatency.cc.

                                                                     :
  GaudiAlgorithm(name, pSvcLocator)
{
  declareProperty("FileName", m_fileName = "AdcFit.root", "Root file name");
  declareProperty("FitPeriod", m_fitPeriod = 30*60, "Fit period in second, Default is 30 minutes");
  declareProperty("Fix", m_Fix = 0, "a temp fix for 40M noise");
  declareProperty("Offset",  m_Trig_Interval_Offset_ns=1000, "Muon trigger time calculate range for latency in ns");

  m_NTrigger=0;
  m_NStop = 1;
  m_startrun = -1;
  m_currentrun = -1;
  m_execNum=0;  
}
DetLatency::~DetLatency ( ) [virtual]

Definition at line 44 of file DetLatency.cc.

{
}

Member Function Documentation

StatusCode DetLatency::initialize ( ) [virtual]

Run data service

Cable service

Definition at line 346 of file DetLatency.cc.

{

  StatusCode sc;
  sc = this->GaudiAlgorithm::initialize();
  if( sc.isFailure() ) {
    error() << "Base class initialization error" << endreq;
    return sc;
  }

  sc = service("RunDataSvc",m_runDataSvc);
  if( sc.isFailure() ) {
    error() << "Can't get RunDataSvc" << endreq;
    return sc;
  }

  sc = service("CableSvc",m_cableSvc);
  if( sc.isFailure() ) {
    error() << "Can't get CableSvc" << endreq;
    return sc;
  }

  StatusCode status = service("EventDataArchiveSvc", p_archiveSvc);
  if (status.isFailure()) {
    Error("Service [EventDataArchiveSvc] not found", status);
  }

  f1 = new TF1("f1","gaus",-500,500);
  f2 = new TF1("f2","gaus",-500,500);

  f3 = new TF1("f3","gaus",-500,500);
  f4 = new TF1("f4","gaus",-500,500);
  f5 = new TF1("f5","gaus",-500,500);
  f6 = new TF1("f6","gaus",-500,500);
  f7 = new TF1("f7","gaus",-500,500);
  m_rootfile = new TFile(m_fileName.c_str(),"recreate");
  //m_tree = new TTree("t", "My Tree");
  //m_tree->SetMaxTreeSize(200000000);  // 200M

  m_masterfile = fopen("Master.trigLatencyCalibMap.txt", "a");
  fprintf(m_masterfile, "# [StartRun] [EndRun] [Sites] [SimFlag] [StartTimeSec] [StartTimeNanoSec] [EndTimeSec] [EndTimeNanoSec] [map file]\n");
  fclose(m_masterfile);

  return sc;

  return 1;
}
StatusCode DetLatency::execute ( ) [virtual]

Get run, event

Get ReadoutHeader

Get all information at that period.

check AD or water pool /if( !(daqCrate->detector().isAD() || //daqCrate->detector().isWaterShield()) ) { / return StatusCode::SUCCESS; /}

a temporary workaround for problematic all_esum trigger 7

Definition at line 397 of file DetLatency.cc.

{
  debug()<<"DetLatency executing ... "<<endreq;

  StatusCode sc;
  
  //RawEventHeader* reh = get<RawEventHeader>(RawEventHeader::defaultLocation());
  //if(!reh) {
  //  warning()<<"Failed to get raw event header"<<endreq;
  //}

  ReadoutHeader* readoutHdr = get<ReadoutHeader>( ReadoutHeader::defaultLocation() );
  if(!readoutHdr) {
    error()<<"Failed to get readout header"<<endreq;
    return StatusCode::FAILURE;
  }
  const DaqCrate* daqCrate = readoutHdr->daqCrate();
  if(!daqCrate) {
    error()<<"Failed to get daqCrate from header"<<endreq;
    return StatusCode::FAILURE;
  }

  TimeStamp trigTime = daqCrate->triggerTime();
  m_currentTime = trigTime.GetSec();

  static bool first = true;
  if( first ) {
    first = false;
    Context ctx = readoutHdr->context();
    m_site=ctx.GetSite();
    m_simFlag=ctx.GetSimFlag();
    ctx.SetSite(Site::kAll);
    ctx.SetDetId(DetectorId::kAll);
    ServiceMode svc(ctx,0);
    //
    InitPmtProp(svc);
    //
    m_prevTrigTime = trigTime.GetSec();
    m_lastFitTime = trigTime.GetSec();
  }

  if((daqCrate->detector().isAD()))
  {
    const DaqPmtCrate* pmtCrate = daqCrate->asPmtCrate();
    if (!pmtCrate) {
      error()<<"Failed to get DaqPmtCrate"<<endreq;
    return StatusCode::SUCCESS;
    }
    Detector det = pmtCrate->detector();
  }
  ServiceMode svcMode( readoutHdr->context(),0 );

  m_NTrigger++;
  // Keep tracking the first trigger time and 
  // the laster trigger for this group of fit
  m_LastTrigSecond = trigTime.GetSec();
  m_LastTrigNanoSec = trigTime.GetNanoSec();
 //m_LastTrigSecond= readoutHdr->timeStamp().GetSec();
  //m_LastTrigNanoSec= readoutHdr->timeStamp().GetNanoSec();

  if(m_NTrigger==1){
    m_FirstTrigSecond = trigTime.GetSec();
    m_FirstTrigNanoSec = trigTime.GetNanoSec();
  }


    bool Range_exceed_flag=false;
    double trig_interval=0;
     int AES_counter=0;
    TimeStamp tagTimeStamp;
    TimeStamp trigTime2;
    TimeStamp tagTimeStamp_begin;
    //SmartDataPtr<DybArchiveList>  muonlist(p_archiveSvc,"/Event/Tag/Muon/MuonAll");
    SmartDataPtr<DybArchiveList>  muonlist(p_archiveSvc,"/Event/Readout/ReadoutHeader");
    if(muonlist) {
      //info() << "Number of muon in the ArchiveList: " << muonlist->size() << endreq;
    DybArchiveList::const_iterator iter = muonlist->begin();
    HeaderObject* muonAll_begin=dynamic_cast<HeaderObject*>(*iter);
    vector<const IHeader*> ihs_begin = muonAll_begin->inputHeaders();
    IHeader* iHeader_begin = const_cast<IHeader*>(ihs_begin[0]);
    HeaderObject* header_begin = dynamic_cast<HeaderObject*>(iHeader_begin);
      tagTimeStamp_begin=header_begin->timeStamp();
     // //cout<<"muonlist->size()="<<muonlist->size()<<endl;
      bool Valid_flag = false;
      for(; iter != muonlist->end(); iter++){
      AES_counter++;
      HeaderObject* muonAll = dynamic_cast<HeaderObject*>(*iter);
      vector<const IHeader*> ihs = muonAll->inputHeaders();
      
       // //cout<<"header size="<<ihs.size()<<endl;
        int i;
       for(i = 0; i < ihs.size(); i++) {
          IHeader* iHeader = const_cast<IHeader*>(ihs[i]);
          HeaderObject* header = dynamic_cast<HeaderObject*>(iHeader);
          int loopDet = header->context().GetDetId();
          //string SiteName = Site::AsString(detector.site());
          //string DetName  = DetectorId::AsString(detector.detectorId());
          //if(daqCrate->detector().isAD())
          if(loopDet==DetectorId::kAD1)// all the time is related to AD1
          //if(DetName=="AD1")
          {
             tagTimeStamp = header->timeStamp();
            trig_interval=(tagTimeStamp_begin.GetSec()-tagTimeStamp.GetSec())*1000000000+(tagTimeStamp_begin.GetNanoSec()-tagTimeStamp.GetNanoSec());
              if(abs(trig_interval)>=m_Trig_Interval_Offset_ns)
              {
                  m_tagTimeStamp=tagTimeStamp;
                  if((m_tagTimeStamp.GetSec()-m_tagTimeStamp_last.GetSec())*1000000000+(m_tagTimeStamp.GetNanoSec()-m_tagTimeStamp_last.GetNanoSec())>0)
                  {
                     m_tagTimeStamp_last=tagTimeStamp;
                    Valid_flag=true;
                    m_execNum++;
                  }
                  else
                  {
                    Range_exceed_flag=true;
                    break;
                  }
               }
              if(Valid_flag)
                  break;
              if(Range_exceed_flag)
                  break;
            }
          }//for(unsigned int i = 0; i < ihs.size(); i++)
          if(Valid_flag)
            break;
          if(Range_exceed_flag)
            break;
      }//end of Muonlist at 1st time
      
      if(Valid_flag)
      {
      Range_exceed_flag=false;
      //DybArchiveList::const_iterator iter = muonlist->begin();
      DybArchiveList::const_iterator iter2 = muonlist->begin();
        AES_counter=0;
      for(; iter2 != muonlist->end(); iter2++){
      AES_counter++;
      HeaderObject* muonAll2 = dynamic_cast<HeaderObject*>(*iter2);
      vector<const IHeader*> ihs2 = muonAll2->inputHeaders();
      for(unsigned int i = 0; i < ihs2.size(); i++) {
          IHeader* iHeader2 = const_cast<IHeader*>(ihs2[i]);
          HeaderObject* header2 = dynamic_cast<HeaderObject*>(iHeader2);
          int loopDet = header2->context().GetDetId();

          trigTime2 =header2->timeStamp();
          //if(AES_counter==1)
          //{
           // //cout<<"begin="<<trigTime2.GetNanoSec()<<endl;
          //}
          trig_interval=(trigTime2.GetSec()-m_tagTimeStamp.GetSec())*1000000000+(trigTime2.GetNanoSec()-m_tagTimeStamp.GetNanoSec());
          if(abs(trig_interval)<=m_Trig_Interval_Offset_ns)
          {
          if(loopDet==DetectorId::kAD1)
          {
          
          // //cout<<"trig_interval="<<trig_interval<<endl;
            h_TrigT_AD1->Fill(trig_interval);
          }         
          if(loopDet==DetectorId::kAD2)
          {
            h_TrigT_AD2->Fill(trig_interval);
          }
          if(loopDet==DetectorId::kAD3)
          {
            h_TrigT_AD3->Fill(trig_interval);
          }
          if(loopDet==DetectorId::kAD4)
          {
            h_TrigT_AD4->Fill(trig_interval);
          }
          if(loopDet==DetectorId::kIWS)
          {
           // //cout<<"kIWS"<<endl;
                 // //cout<<"IWS find ="<<trigTime2.GetNanoSec()<<" zero="<<m_tagTimeStamp.GetNanoSec()<<"  trig_interval="<<trig_interval<<endl;
            h_TrigT_IWS->Fill(trig_interval);
          }
          if(loopDet==DetectorId::kOWS)
          {
           // //cout<<"kOWS"<<endl;
            h_TrigT_OWS->Fill(trig_interval);
          }
          if(loopDet==DetectorId::kRPC)
          {
            h_TrigT_RPC->Fill(trig_interval);
          }
          }
          else if(trig_interval<-1*m_Trig_Interval_Offset_ns)
          {
            Range_exceed_flag=true;
            break;
           }
      }//for(unsigned int i = 0; i < ihs.size(); i++)
        if(Range_exceed_flag)
          break;
     }// for(; iter != muonlist->end(); iter++)
   // //cout<<endl;
    }//if true
    }//end of if(muonlist)

  //  //cout << "run number:" << m_runDataSvc->runData(svcMode)->runNumber() << endl;
  
  //int TrigType = pmtCrate->triggerType();
  //if( TrigType != 7 ) {


  //-------------------------------------
  //fit the data
  if(m_currentTime - m_lastFitTime > m_fitPeriod) {
    //Fit
    Fit();
    //after fit
    ResetPmtProp();
    m_NStop++;
    m_lastFitTime = m_currentTime;
  }
  
  m_prevTrigTime = m_currentTime;


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

Definition at line 649 of file DetLatency.cc.

{
  //cout<<"DetLatency finalize...."<<endl;

  //Fit
  Fit();

      h_TrigT_All->Write();
      h_CalibTrigT->Write();
      h_CalibTrigTErr->Write();
      h_CalibTrigTSigma->Write();
      h_CalibTrigTSigmaErr->Write();

  m_rootfile->Write();
  m_rootfile->Close();


  delete f1;
  delete f2;
  delete f3;
  delete f4;
  delete f5;
  delete f6;
  delete f7;
  //delete m_tree;
  delete m_rootfile;

 // //cout<<"Test 3"<<endl;

  if (0 != p_archiveSvc) {
    p_archiveSvc->release();
  }

  delete h_TrigT_AD1;
   delete  h_TrigT_AD2;
  delete   h_TrigT_AD3;
  delete   h_TrigT_AD4;
  delete   h_TrigT_IWS;
    delete h_TrigT_OWS;
    delete h_TrigT_RPC;


 // //cout<<"Test 5"<<endl;

       delete h_TrigT_All;
       delete h_CalibTrigT;
       delete h_CalibTrigTErr;
       delete h_CalibTrigTSigma;
        delete h_CalibTrigTSigmaErr;


 //cout<<"Finished"<<endl;


  StatusCode sc;
  sc = this->GaudiAlgorithm::finalize();
  return sc;

  return 1;
}
void DetLatency::Fit ( )

Definition at line 49 of file DetLatency.cc.

                    {

  //cout<<"Fitting"<<endl;
  ostringstream tmp;
  tmp <<setw(2) <<setfill('0') << m_NStop;
  string filename = "trigLatencyTable_"+tmp.str()+".txt";
  FILE* outfile = fopen(filename.c_str(), "w+");
  
  fprintf(outfile, "# First Trigger time: (TrigSecond, TrigNanoSec) = (%d,%d).\n", m_FirstTrigSecond, m_FirstTrigNanoSec);
  fprintf(outfile, "# Last Trigger time: (TrigSecond, TrigNanoSec) = (%d,%d).\n", m_LastTrigSecond, m_LastTrigNanoSec);
  fprintf(outfile, "# [detId] [description] [status] [trigLat] [trigLatErr] [trigLatSigma] [trigLatSigmaErr]\n");

  m_rootfile->cd();
  string newdir = tmp.str();
  m_rootfile->mkdir(newdir.c_str());
  m_rootfile->cd(newdir.c_str());

  m_masterfile = fopen("Master.trigLatencyCalibMap.txt", "a");
  TimeStamp lastT1(m_LastTrigSecond,m_LastTrigNanoSec+1);
  fprintf(m_masterfile, "0000000 0000000 %4.0d %4.0d %10.0d %10.0d %10.0d %10.0d %s\n",
          m_site, m_simFlag, m_FirstTrigSecond,m_FirstTrigNanoSec,(int)lastT1.GetSec(),lastT1.GetNanoSec(),filename.c_str());
  fclose(m_masterfile);

  m_StartTime = m_FirstTrigSecond + m_FirstTrigNanoSec*1e-9;
  m_EndTime = m_LastTrigSecond + m_LastTrigNanoSec*1e-9;
  
  //cout<<"Test 0"<<endl;


      double pedarea=0;
      double pedmean=0;
      double pedsigm=0;
      int status1=0;
     int tester=0;
  //cout<<"Test 1"<<endl;
  //cout<<"h_TrigT_AD1->GetEntries()="<<h_TrigT_AD1->GetEntries()<<endl;
  if(h_TrigT_AD1->GetEntries()>0)
  {    
      pedarea = h_TrigT_AD1->GetEntries();
      pedmean = h_TrigT_AD1->GetMean();
      pedsigm = h_TrigT_AD1->GetRMS();
      f1->SetParameters(pedarea,pedmean,pedsigm);
      f1->SetRange(pedmean-3*pedsigm,pedmean+3*pedsigm);
      status1 = h_TrigT_AD1->Fit("f1","R");
      

      trigLatencyAD1Status=status1;
       trigLatencyAD1= f1->GetParameter(1);
      trigLatencyAD1Err= f1->GetParError(1);
      trigLatencyAD1Sigma = f1->GetParameter(2);
      trigLatencyAD1SigmaErr= f1->GetParError(2);

      //cout<<"1"<<tester++<<endl;
     fprintf(outfile, "%d %s %2d %8.3f %8.3f %8.3f %8.3f\n",DetectorId::kAD1, DetectorId::AsString(DetectorId::kAD1),trigLatencyAD1Status, trigLatencyAD1, trigLatencyAD1Err, trigLatencyAD1Sigma, trigLatencyAD1SigmaErr);

      //cout<<"2"<<tester++<<endl;   

      h_TrigT_AD1->Write();
      //cout<<"3"<<tester++<<endl;
      h_CalibTrigT->Fill(trigLatencyAD1);
      //cout<<"4"<<tester++<<endl;
      h_CalibTrigTErr->Fill(trigLatencyAD1Err);
      //cout<<"5"<<tester++<<endl;
      //cout<<"trigLatencyAD1Sigma="<<trigLatencyAD1Sigma<<endl;
      h_CalibTrigTSigma->Fill(trigLatencyAD1Sigma);
      //cout<<"6"<<tester++<<endl;
      h_CalibTrigTSigmaErr->Fill(trigLatencyAD1SigmaErr);
      //cout<<"7"<<tester++<<endl;
  }
  //cout<<"h_TrigT_AD2->GetEntries()="<<h_TrigT_AD2->GetEntries()<<endl;
  if(h_TrigT_AD2->GetEntries()>0)
  {
      pedarea = h_TrigT_AD2->GetEntries();
      pedmean = h_TrigT_AD2->GetMean();
      pedsigm = h_TrigT_AD2->GetRMS();
      f2->SetParameters(pedarea,pedmean,pedsigm);
      f2->SetRange(pedmean-3*pedsigm,pedmean+3*pedsigm);
      status1 = h_TrigT_AD2->Fit("f2","R");

      trigLatencyAD2Status=status1;
      h_TrigT_All->Fill(trigLatencyAD1);
      trigLatencyAD2= f2->GetParameter(1);
      trigLatencyAD2Err= f2->GetParError(1);
      trigLatencyAD2Sigma = f2->GetParameter(2);
      trigLatencyAD2SigmaErr= f2->GetParError(2);

      fprintf(outfile, "%d %s %2d %8.3f %8.3f %8.3f %8.3f\n", DetectorId::kAD2, DetectorId::AsString(DetectorId::kAD2), trigLatencyAD2Status, trigLatencyAD2, trigLatencyAD2Err, trigLatencyAD2Sigma, trigLatencyAD2SigmaErr);
      
      h_TrigT_AD2->Write();
      h_TrigT_All->Fill(trigLatencyAD2);
      h_CalibTrigT->Fill(trigLatencyAD2);
      h_CalibTrigTErr->Fill(trigLatencyAD2Err);
      h_CalibTrigTSigma->Fill(trigLatencyAD2Sigma);
      h_CalibTrigTSigmaErr->Fill(trigLatencyAD2SigmaErr);
  }
  
    //cout<<"h_TrigT_AD3->GetEntries()="<<h_TrigT_AD3->GetEntries()<<endl;
  if(h_TrigT_AD3->GetEntries()>0)
  {
      pedarea = h_TrigT_AD3->GetEntries();
      pedmean = h_TrigT_AD3->GetMean();
      pedsigm = h_TrigT_AD3->GetRMS();
      f3->SetParameters(pedarea,pedmean,pedsigm);
      f3->SetRange(pedmean-3*pedsigm,pedmean+3*pedsigm);
      status1 = h_TrigT_AD3->Fit("f3","R");

      trigLatencyAD3Status=status1;
       trigLatencyAD3= f3->GetParameter(1);
      trigLatencyAD3Err= f3->GetParError(1);
      trigLatencyAD3Sigma = f3->GetParameter(2);
      trigLatencyAD3SigmaErr= f3->GetParError(2);
      fprintf(outfile, "%d %s %2d %8.3f %8.3f %8.3f %8.3f\n", DetectorId::kAD3, DetectorId::AsString(DetectorId::kAD3),trigLatencyAD3Status, trigLatencyAD3, trigLatencyAD3Err, trigLatencyAD3Sigma, trigLatencyAD3SigmaErr);

      h_TrigT_AD3->Write();
      h_TrigT_All->Fill(trigLatencyAD3);
      h_CalibTrigT->Fill(trigLatencyAD3);
      h_CalibTrigTErr->Fill(trigLatencyAD3Err);
      h_CalibTrigTSigma->Fill(trigLatencyAD3Sigma);
      h_CalibTrigTSigmaErr->Fill(trigLatencyAD3SigmaErr);
  }
  if(h_TrigT_AD4->GetEntries()>0)
  {
      pedarea = h_TrigT_AD4->GetEntries();
      pedmean = h_TrigT_AD4->GetMean();
      pedsigm = h_TrigT_AD4->GetRMS();
      f4->SetParameters(pedarea,pedmean,pedsigm);
      f4->SetRange(pedmean-3*pedsigm,pedmean+3*pedsigm);
      status1 = h_TrigT_AD4->Fit("f4","R");

      trigLatencyAD4Status=status1;
       trigLatencyAD4= f4->GetParameter(1);
      trigLatencyAD4Err= f4->GetParError(1);
      trigLatencyAD4Sigma = f4->GetParameter(2);
      trigLatencyAD4SigmaErr= f4->GetParError(2);
      fprintf(outfile, "%d %s %2d %8.3f %8.3f %8.3f %8.3f\n", DetectorId::kAD4, DetectorId::AsString(DetectorId::kAD4),trigLatencyAD4Status, trigLatencyAD4, trigLatencyAD4Err, trigLatencyAD4Sigma, trigLatencyAD4SigmaErr);

      h_TrigT_AD4->Write();
      h_TrigT_All->Fill(trigLatencyAD4);
      h_CalibTrigT->Fill(trigLatencyAD4);
      h_CalibTrigTErr->Fill(trigLatencyAD4Err);
      h_CalibTrigTSigma->Fill(trigLatencyAD4Sigma);
      h_CalibTrigTSigmaErr->Fill(trigLatencyAD4SigmaErr);
  }
    //cout<<"h_TrigT_IWS->GetEntries()="<<h_TrigT_IWS->GetEntries()<<endl;
  if(h_TrigT_IWS->GetEntries()>0)
  {
      pedarea = h_TrigT_IWS->GetEntries();
      pedmean = h_TrigT_IWS->GetMean();
      pedsigm = h_TrigT_IWS->GetRMS();
      f5->SetParameters(pedarea,pedmean,pedsigm);
      f5->SetRange(pedmean-3*pedsigm,pedmean+3*pedsigm);
      status1 = h_TrigT_IWS->Fit("f5","R");

      trigLatencyIWSStatus=status1;
       trigLatencyIWS= f5->GetParameter(1);
      trigLatencyIWSErr= f5->GetParError(1);
      trigLatencyIWSSigma = f5->GetParameter(2);
      trigLatencyIWSSigmaErr= f5->GetParError(2);
      fprintf(outfile, "%d %s %2d %8.3f %8.3f %8.3f %8.3f\n", DetectorId::kIWS, DetectorId::AsString(DetectorId::kIWS), trigLatencyIWSStatus, trigLatencyIWS, trigLatencyIWSErr, trigLatencyIWSSigma, trigLatencyIWSSigmaErr);

      h_TrigT_IWS->Write();
      h_TrigT_All->Fill(trigLatencyIWS);
      h_CalibTrigT->Fill(trigLatencyIWS);
      h_CalibTrigTErr->Fill(trigLatencyIWSErr);
      h_CalibTrigTSigma->Fill(trigLatencyIWSSigma);
      h_CalibTrigTSigmaErr->Fill(trigLatencyIWSSigmaErr);
  }

 // //cout<<"h_TrigT_OWS->GetEntries()="<<h_TrigT_OWS->GetEntries()<<endl;
  if(h_TrigT_OWS->GetEntries()>0)
  {
      pedarea = h_TrigT_OWS->GetEntries();
      pedmean = h_TrigT_OWS->GetMean();
      pedsigm = h_TrigT_OWS->GetRMS();
      f6->SetParameters(pedarea,pedmean,pedsigm);
      f6->SetRange(pedmean-3*pedsigm,pedmean+3*pedsigm);
      status1 = h_TrigT_OWS->Fit("f6","R");

      trigLatencyOWSStatus=status1;
       trigLatencyOWS= f6->GetParameter(1);
      trigLatencyOWSErr= f6->GetParError(1);
      trigLatencyOWSSigma = f6->GetParameter(2);
      trigLatencyOWSSigmaErr= f6->GetParError(2);
      fprintf(outfile, "%d %s %2d %8.3f %8.3f %8.3f %8.3f\n", DetectorId::kOWS, DetectorId::AsString(DetectorId::kOWS), trigLatencyOWSStatus, trigLatencyOWS, trigLatencyOWSErr, trigLatencyOWSSigma, trigLatencyOWSSigmaErr);

      h_TrigT_OWS->Write();
      h_TrigT_All->Fill(trigLatencyOWS);
      h_CalibTrigT->Fill(trigLatencyOWS);
      h_CalibTrigTErr->Fill(trigLatencyOWSErr);
      h_CalibTrigTSigma->Fill(trigLatencyOWSSigma);
      h_CalibTrigTSigmaErr->Fill(trigLatencyOWSSigmaErr);
  }
  if(h_TrigT_RPC->GetEntries()>0)
  {
      pedarea = h_TrigT_RPC->GetEntries();
      pedmean = h_TrigT_RPC->GetMean();
      pedsigm = h_TrigT_RPC->GetRMS();
      f7->SetParameters(pedarea,pedmean,pedsigm);
      f7->SetRange(pedmean-3*pedsigm,pedmean+3*pedsigm);
      status1 = h_TrigT_RPC->Fit("f7","R");

      trigLatencyRPCStatus=status1;
       trigLatencyRPC= f7->GetParameter(1);
      trigLatencyRPCErr= f7->GetParError(1);
      trigLatencyRPCSigma = f7->GetParameter(2);
      trigLatencyRPCSigmaErr= f7->GetParError(2);
      fprintf(outfile, "%d %s %2d %8.3f %8.3f %8.3f %8.3f\n", DetectorId::kRPC, DetectorId::AsString(DetectorId::kRPC), trigLatencyRPCStatus, trigLatencyRPC, trigLatencyRPCErr, trigLatencyRPCSigma, trigLatencyRPCSigmaErr);

      h_TrigT_RPC->Write();
      h_TrigT_All->Fill(trigLatencyRPC);
      h_CalibTrigT->Fill(trigLatencyRPC);
      h_CalibTrigTErr->Fill(trigLatencyRPCErr);
      h_CalibTrigTSigma->Fill(trigLatencyRPCSigma);
      h_CalibTrigTSigmaErr->Fill(trigLatencyRPCSigmaErr);
  }


   //cout<<"fitting finished"<<endl;
  //m_tree->Fill();
  fclose(outfile);
}
int DetLatency::InitPmtProp ( const ServiceMode svc)

Definition at line 272 of file DetLatency.cc.

{

  string hname = "h_TrigT_AD1";
  h_TrigT_AD1=new TH1F(hname.c_str(),hname.c_str(),2000,-1000,1000);

  hname = "h_TrigT_AD2";
  h_TrigT_AD2=new TH1F(hname.c_str(),hname.c_str(),2000,-1000,1000);
 
  hname = "h_TrigT_AD3";
  h_TrigT_AD3=new TH1F(hname.c_str(),hname.c_str(),2000,-1000,1000);

  hname = "h_TrigT_AD4";
  h_TrigT_AD4=new TH1F(hname.c_str(),hname.c_str(),2000,-1000,1000);

  hname = "h_TrigT_IWS";
  h_TrigT_IWS=new TH1F(hname.c_str(),hname.c_str(),2000,-1000,1000);

  hname = "h_TrigT_OWS";
  h_TrigT_OWS=new TH1F(hname.c_str(),hname.c_str(),2000,-1000,1000);

  hname = "h_TrigT_RPC";
  h_TrigT_RPC=new TH1F(hname.c_str(),hname.c_str(),2000,-1000,1000);

  hname = "h_TrigT_All";
  h_TrigT_All=new TH1F(hname.c_str(),hname.c_str(),8000,-400,400);

  hname = "h_CalibTrigT";
  h_CalibTrigT=new TH1F(hname.c_str(),hname.c_str(),8000,-400,400);

  hname = "h_CalibTrigTErr";
  h_CalibTrigTErr=new TH1F(hname.c_str(),hname.c_str(),8000,-400,400);

  hname = "h_CalibTrigTSigma";
  h_CalibTrigTSigma=new TH1F(hname.c_str(),hname.c_str(),8000,-400,400);

  hname = "h_CalibTrigTSigmaErr";
  h_CalibTrigTSigmaErr=new TH1F(hname.c_str(),hname.c_str(),8000,-400,400);


  //map<int,PmtProp>::iterator it,idend=m_PmtPropMap.end(); //pmtID
  //for(it=m_PmtPropMap.begin(); it!=idend; it++) {
  //  PmtProp& curr = it->second;
  //}
  
  ResetPmtProp();//reset

  m_NStop = 1;
  m_startrun = -1;
  m_currentrun = -1;
  m_execNum=0;  
  m_NTrigger=0;

  return 1;
}
int DetLatency::ResetPmtProp ( )

Definition at line 328 of file DetLatency.cc.

{
  h_TrigT_AD1->Reset();
  h_TrigT_AD2->Reset();
  h_TrigT_AD3->Reset();
    h_TrigT_AD4->Reset();
  h_TrigT_IWS->Reset();
    h_TrigT_OWS->Reset();
    h_TrigT_RPC->Reset();


  m_NTrigger = 0;
  m_startrun = -1;

  m_execNum=0;
  return 1;
}

Member Data Documentation

Cable mapping service.

Definition at line 64 of file DetLatency.h.

Definition at line 65 of file DetLatency.h.

TF1* DetLatency::f1 [private]

Definition at line 67 of file DetLatency.h.

TF1* DetLatency::f2 [private]

Definition at line 68 of file DetLatency.h.

TF1* DetLatency::f3 [private]

Definition at line 69 of file DetLatency.h.

TF1* DetLatency::f4 [private]

Definition at line 70 of file DetLatency.h.

TF1* DetLatency::f5 [private]

Definition at line 71 of file DetLatency.h.

TF1* DetLatency::f6 [private]

Definition at line 72 of file DetLatency.h.

TF1* DetLatency::f7 [private]

Definition at line 73 of file DetLatency.h.

TFile* DetLatency::m_rootfile [private]

Definition at line 74 of file DetLatency.h.

TTree* DetLatency::m_tree [private]

Definition at line 75 of file DetLatency.h.

FILE* DetLatency::m_masterfile [private]

Definition at line 76 of file DetLatency.h.

string DetLatency::m_fileName [private]

Definition at line 77 of file DetLatency.h.

int DetLatency::m_execNum [private]

Definition at line 78 of file DetLatency.h.

unsigned long DetLatency::m_NTrigger [private]

Definition at line 80 of file DetLatency.h.

Definition at line 83 of file DetLatency.h.

double DetLatency::trigLatencyAD1 [private]

Definition at line 84 of file DetLatency.h.

Definition at line 85 of file DetLatency.h.

Definition at line 86 of file DetLatency.h.

Definition at line 87 of file DetLatency.h.

Definition at line 88 of file DetLatency.h.

double DetLatency::trigLatencyAD2 [private]

Definition at line 89 of file DetLatency.h.

Definition at line 90 of file DetLatency.h.

Definition at line 91 of file DetLatency.h.

Definition at line 92 of file DetLatency.h.

Definition at line 93 of file DetLatency.h.

double DetLatency::trigLatencyAD3 [private]

Definition at line 94 of file DetLatency.h.

Definition at line 95 of file DetLatency.h.

Definition at line 96 of file DetLatency.h.

Definition at line 97 of file DetLatency.h.

double DetLatency::trigLatencyAD4 [private]

Definition at line 98 of file DetLatency.h.

Definition at line 99 of file DetLatency.h.

Definition at line 100 of file DetLatency.h.

Definition at line 101 of file DetLatency.h.

Definition at line 102 of file DetLatency.h.

Definition at line 103 of file DetLatency.h.

double DetLatency::trigLatencyOWS [private]

Definition at line 104 of file DetLatency.h.

Definition at line 105 of file DetLatency.h.

Definition at line 106 of file DetLatency.h.

Definition at line 107 of file DetLatency.h.

double DetLatency::trigLatencyIWS [private]

Definition at line 108 of file DetLatency.h.

Definition at line 109 of file DetLatency.h.

Definition at line 110 of file DetLatency.h.

Definition at line 111 of file DetLatency.h.

Definition at line 112 of file DetLatency.h.

Definition at line 113 of file DetLatency.h.

double DetLatency::trigLatencyRPC [private]

Definition at line 114 of file DetLatency.h.

Definition at line 115 of file DetLatency.h.

Definition at line 116 of file DetLatency.h.

Definition at line 117 of file DetLatency.h.

TH1F* DetLatency::h_TrigT_AD1 [private]

Definition at line 119 of file DetLatency.h.

TH1F* DetLatency::h_TrigT_AD2 [private]

Definition at line 120 of file DetLatency.h.

TH1F* DetLatency::h_TrigT_AD3 [private]

Definition at line 121 of file DetLatency.h.

TH1F* DetLatency::h_TrigT_AD4 [private]

Definition at line 122 of file DetLatency.h.

TH1F* DetLatency::h_TrigT_IWS [private]

Definition at line 123 of file DetLatency.h.

TH1F* DetLatency::h_TrigT_OWS [private]

Definition at line 124 of file DetLatency.h.

TH1F* DetLatency::h_TrigT_RPC [private]

Definition at line 125 of file DetLatency.h.

TH1F* DetLatency::h_TrigT_All [private]

Definition at line 127 of file DetLatency.h.

TH1F* DetLatency::h_CalibTrigT [private]

Definition at line 128 of file DetLatency.h.

TH1F* DetLatency::h_CalibTrigTErr [private]

Definition at line 129 of file DetLatency.h.

Definition at line 130 of file DetLatency.h.

Definition at line 131 of file DetLatency.h.

IDataProviderSvc* DetLatency::p_archiveSvc [private]

Definition at line 133 of file DetLatency.h.

Definition at line 137 of file DetLatency.h.

Definition at line 138 of file DetLatency.h.

Definition at line 139 of file DetLatency.h.

Definition at line 141 of file DetLatency.h.

Definition at line 142 of file DetLatency.h.

double DetLatency::m_StartTime [private]

Definition at line 143 of file DetLatency.h.

double DetLatency::m_EndTime [private]

Definition at line 144 of file DetLatency.h.

int DetLatency::m_Fix [private]

Definition at line 147 of file DetLatency.h.

int DetLatency::m_NStop [private]

Definition at line 148 of file DetLatency.h.

Definition at line 149 of file DetLatency.h.

Definition at line 150 of file DetLatency.h.

Definition at line 151 of file DetLatency.h.

Definition at line 152 of file DetLatency.h.

int DetLatency::m_startrun [private]

Definition at line 153 of file DetLatency.h.

int DetLatency::m_currentrun [private]

Definition at line 154 of file DetLatency.h.

int DetLatency::m_site [private]

Definition at line 156 of file DetLatency.h.

int DetLatency::m_simFlag [private]

Definition at line 157 of file DetLatency.h.

double DetLatency::m_currentTime [private]

Definition at line 158 of file DetLatency.h.

double DetLatency::m_prevTrigTime [private]

Definition at line 159 of file DetLatency.h.

double DetLatency::m_lastFitTime [private]

Definition at line 160 of file DetLatency.h.

double DetLatency::m_fitPeriod [private]

Definition at line 161 of file DetLatency.h.

list DetLatency::__all__ = [ "run" ] [private]

Definition at line 3 of file __init__.py.


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:09:25 for DetLatency by doxygen 1.7.4