CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

HcalDetDiagLaserMonitor Class Reference

#include <DQM/HcalDetDiagLaserMonitor/src/HcalDetDiagLaserMonitor.cc>

Inheritance diagram for HcalDetDiagLaserMonitor:
HcalBaseDQMonitor edm::EDAnalyzer

List of all members.

Public Member Functions

 HcalDetDiagLaserMonitor (const edm::ParameterSet &)
 ~HcalDetDiagLaserMonitor ()

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &)
void beginLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
void beginRun (const edm::Run &run, const edm::EventSetup &c)
void endLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
void endRun (const edm::Run &run, const edm::EventSetup &c)
void fillHistos (int sd)
void fillProblems (int sd)
bool get_ave_rbx (int sd, int side, int rbx, float *ave, float *rms)
bool get_ave_subdet (int sd, float *ave_t, float *ave_e, float *ave_t_r, float *ave_e_r)
void LoadReference ()
void SaveReference ()

Private Attributes

std::string baseFolder_
int dataset_seq_number
const HcalElectronicsMapemap
MonitorElementEnergy2Dhbhehf
MonitorElementEnergy2Dho
HcalDetDiagLaserData hb_data [85][72][4]
MonitorElementhb_time_rbx
MonitorElementhbheEnergy
MonitorElementhbheEnergyRMS
MonitorElementhbheTime
MonitorElementhbheTimeRMS
HcalDetDiagLaserData he_data [85][72][4]
MonitorElementhe_time_rbx
HcalDetDiagLaserData hf_data [85][72][4]
MonitorElementhf_time_rbx
MonitorElementhfEnergy
MonitorElementhfEnergyRMS
MonitorElementhfTime
MonitorElementhfTimeRMS
HcalDetDiagLaserData ho_data [85][72][4]
MonitorElementho_time_rbx
MonitorElementhoEnergy
MonitorElementhoEnergyRMS
MonitorElementhoTime
MonitorElementhoTimeRMS
int ievt_
edm::InputTag inputLabelDigi_
bool IsReference
double LaserEnergyThreshold
double LaserTimingThreshold
bool LocalRun
MonitorElementmeEVT_
MonitorElementmeRUN_
int nHBHEchecks
int nHFchecks
int nHOchecks
bool Online_
std::string OutputFilePath
bool Overwrite
std::string prefixME_
EtaPhiHistsProblemCellsByDepth_energy
EtaPhiHistsProblemCellsByDepth_energy_val
EtaPhiHistsProblemCellsByDepth_timing
EtaPhiHistsProblemCellsByDepth_timing_val
std::vector< std::string > problemnames_
MonitorElementRaddam [56]
edm::InputTag rawdatalabel_
MonitorElementrefEnergy2Dhbhehf
MonitorElementrefEnergy2Dho
std::string ReferenceData
std::string ReferenceRun
MonitorElementRefRun_
MonitorElementrefTime2Dhbhehf
MonitorElementrefTime2Dho
int run_number
MonitorElementTime2Dhbhehf
MonitorElementTime2Dho
std::string XmlFilePath

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 200 of file HcalDetDiagLaserMonitor.cc.


Constructor & Destructor Documentation

HcalDetDiagLaserMonitor::HcalDetDiagLaserMonitor ( const edm::ParameterSet iConfig) [explicit]

Definition at line 284 of file HcalDetDiagLaserMonitor.cc.

References dataset_seq_number, HcalBaseDQMonitor::debug_, emap, edm::ParameterSet::getUntrackedParameter(), ievt_, inputLabelDigi_, IsReference, LaserEnergyThreshold, LaserTimingThreshold, LocalRun, nHBHEchecks, nHFchecks, nHOchecks, Online_, OutputFilePath, Overwrite, prefixME_, rawdatalabel_, ReferenceData, run_number, HcalBaseDQMonitor::subdir_, and XmlFilePath.

                                                                              {
  ievt_=-1;
  emap=0;
  dataset_seq_number=1;
  run_number=-1;
  IsReference=false;
  LocalRun=false;
  nHBHEchecks=nHOchecks=nHFchecks=0;

  inputLabelDigi_  = iConfig.getUntrackedParameter<edm::InputTag>("digiLabel");
  ReferenceData    = iConfig.getUntrackedParameter<std::string>("LaserReferenceData" ,"");
  OutputFilePath   = iConfig.getUntrackedParameter<std::string>("OutputFilePath", "");
  XmlFilePath      = iConfig.getUntrackedParameter<std::string>("XmlFilePath", "");
  Online_          = iConfig.getUntrackedParameter<bool>  ("online",false);
  Overwrite        = iConfig.getUntrackedParameter<bool>  ("Overwrite",true);
  prefixME_        = iConfig.getUntrackedParameter<std::string>("subSystemFolder","Hcal/");
  if (prefixME_.size()>0 && prefixME_.substr(prefixME_.size()-1,prefixME_.size())!="/")
    prefixME_.append("/");
  subdir_          = iConfig.getUntrackedParameter<std::string>("TaskFolder","DetDiagPedestalMonitor_Hcal/");
  if (subdir_.size()>0 && subdir_.substr(subdir_.size()-1,subdir_.size())!="/")
    subdir_.append("/");
  subdir_=prefixME_+subdir_;
  debug_           = iConfig.getUntrackedParameter<int>("debug",0);
  rawdatalabel_    = iConfig.getUntrackedParameter<edm::InputTag>("RawDataLabel");


  LaserTimingThreshold = iConfig.getUntrackedParameter<double>("LaserTimingThreshold",0.2);
  LaserEnergyThreshold = iConfig.getUntrackedParameter<double>("LaserEnergyThreshold",0.1);
}
HcalDetDiagLaserMonitor::~HcalDetDiagLaserMonitor ( )

Definition at line 418 of file HcalDetDiagLaserMonitor.cc.

                                                 {

}

Member Function Documentation

void HcalDetDiagLaserMonitor::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Reimplemented from HcalBaseDQMonitor.

Definition at line 423 of file HcalDetDiagLaserMonitor.cc.

References adc2fC, HcalDetDiagLaserData::add_statistics(), FEDRawData::data(), runTheMatrix::data, HcalBaseDQMonitor::dbe_, eta(), MonitorElement::Fill(), fillHistos(), fillProblems(), edm::Event::getByLabel(), edm::Event::getByType(), hb_data, hc_HBHEHPD, hc_HFPMT, hc_HOHPD, hc_RADDAM, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, he_data, hf_data, ho_data, i, edm::EventBase::id(), ievt_, inputLabelDigi_, edm::HandleBase::isValid(), j, gen::k, LocalRun, FEDNumbering::MAXHCALFEDID, meEVT_, meRUN_, FEDNumbering::MINHCALFEDID, MultiGaussianStateTransform::N, Online_, edm::EventBase::orbitNumber(), phi, Raddam, rawdatalabel_, HcalBaseDQMonitor::reset(), edm::EventID::run(), run_number, SaveReference(), FEDRawData::size(), and relativeConstraints::value.

                                                                                        {
  HcalBaseDQMonitor::analyze(iEvent,iSetup); // base class increments ievt_, etc. counters

int  eta,phi,depth,nTS;
static bool HBHEseq,HOseq,HFseq;
static int  lastHBHEorbit,lastHOorbit,lastHForbit,nChecksHBHE,nChecksHO,nChecksHF,ievt_hbhe,ievt_ho,ievt_hf;
   if(ievt_==-1){ 
       ievt_=0;HBHEseq=HOseq=HFseq=false; lastHBHEorbit=lastHOorbit=lastHForbit=-1;nChecksHBHE=nChecksHO=nChecksHF=0; 
       ievt_hbhe=0,ievt_ho=0,ievt_hf=0;
   }

   if(!dbe_) return; 
   bool LaserEvent=false;
   bool LaserRaddam=false;
   int orbit=iEvent.orbitNumber();
   meRUN_->Fill(iEvent.id().run());
   // for local runs 
   edm::Handle<HcalTBTriggerData> trigger_data;
   iEvent.getByType(trigger_data);
   if(trigger_data.isValid()){
       if(trigger_data->wasLaserTrigger()) LaserEvent=true;
       LocalRun=true;
   }
   if(!LocalRun && Online_){
      if(HBHEseq && (orbit-lastHBHEorbit)>(11223*10) && ievt_hbhe>40){
         HBHEseq=false;
         fillHistos(HcalBarrel);
         fillProblems(HcalBarrel);
         fillProblems(HcalEndcap);
         nChecksHBHE++;
         ievt_hbhe=0;
         for(int i=0;i<85;i++)for(int j=0;j<72;j++)for(int k=0;k<4;k++) hb_data[i][j][k].reset();
         for(int i=0;i<85;i++)for(int j=0;j<72;j++)for(int k=0;k<4;k++) he_data[i][j][k].reset();
      }
      if(HOseq && (orbit-lastHOorbit)>(11223*10) && ievt_ho>40){
         HOseq=false;
         fillHistos(HcalOuter);
         fillProblems(HcalOuter);
         nChecksHO++; 
         ievt_ho=0;
         for(int i=0;i<85;i++)for(int j=0;j<72;j++)for(int k=0;k<4;k++) ho_data[i][j][k].reset();
      }
      if(HFseq && (orbit-lastHForbit)>(11223*10) && ievt_hf>40){
         HFseq=false;
         fillHistos(HcalForward);
         fillProblems(HcalForward);
         nChecksHF++; 
         ievt_hf=0;
         if(nChecksHF==1 || (nChecksHF>1 && ((nChecksHF-1)%12)==0)){
             SaveReference();
         }
         for(int i=0;i<85;i++)for(int j=0;j<72;j++)for(int k=0;k<4;k++) hf_data[i][j][k].reset();
      }
   }

   // Abort Gap laser 
   if(LocalRun==false || LaserEvent==false){
       edm::Handle<FEDRawDataCollection> rawdata;
       iEvent.getByLabel(rawdatalabel_,rawdata);
       //checking FEDs for calibration information
       for (int i=FEDNumbering::MINHCALFEDID;i<=FEDNumbering::MAXHCALFEDID; i++) {
          const FEDRawData& fedData = rawdata->FEDData(i) ;
          if ( fedData.size() < 24 ) continue ;
          int value = ((const HcalDCCHeader*)(fedData.data()))->getCalibType() ;
          if(value==hc_HBHEHPD){ HBHEseq=true; HOseq=HFseq=false; lastHBHEorbit=orbit; ievt_hbhe++; }
          if(value==hc_HOHPD){   HOseq=true; HBHEseq=HFseq=false; lastHOorbit=orbit;   ievt_ho++;   }
          if(value==hc_HFPMT){   HFseq=true; HBHEseq=HOseq=false; lastHForbit=orbit;   ievt_hf++;   }
          
          if(value==hc_HBHEHPD || value==hc_HOHPD || value==hc_HFPMT){ LaserEvent=true; break;}
          if(value==hc_RADDAM){ LaserEvent=true; LaserRaddam=true; break;} 
       }
   }   
   if(!LaserEvent) return;

   meEVT_->Fill(++ievt_);
   run_number=iEvent.id().run();
   double data[20];
   if(!LaserRaddam){
      edm::Handle<HBHEDigiCollection> hbhe; 
      iEvent.getByLabel(inputLabelDigi_,hbhe);
      if(hbhe.isValid()){
         for(HBHEDigiCollection::const_iterator digi=hbhe->begin();digi!=hbhe->end();digi++){
             eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size();
             if(digi->id().subdet()==HcalBarrel){
                for(int i=0;i<nTS;i++) data[i]=adc2fC[digi->sample(i).adc()&0xff]-2.5;
                hb_data[eta+42][phi-1][depth-1].add_statistics(data,nTS);
             }   
             if(digi->id().subdet()==HcalEndcap){
                for(int i=0;i<nTS;i++) data[i]=adc2fC[digi->sample(i).adc()&0xff]-2.5;
                he_data[eta+42][phi-1][depth-1].add_statistics(data,nTS);
             }
         }
      }
      edm::Handle<HODigiCollection> ho; 
      iEvent.getByLabel(inputLabelDigi_,ho);
      if(ho.isValid()){
         for(HODigiCollection::const_iterator digi=ho->begin();digi!=ho->end();digi++){
             eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size();
             if((eta>=11 && eta<=15 && phi>=59 && phi<=70) || (eta>=5 && eta<=10 && phi>=47 && phi<=58)){
                for(int i=0;i<nTS;i++) data[i]=adc2fC[digi->sample(i).adc()&0xff]-11.0;
             }else{
                for(int i=0;i<nTS;i++) data[i]=adc2fC[digi->sample(i).adc()&0xff]-2.5;
             }
             ho_data[eta+42][phi-1][depth-1].add_statistics(data,nTS);
         }
      }
      edm::Handle<HFDigiCollection> hf;
      iEvent.getByLabel(inputLabelDigi_,hf);
      if(hf.isValid()){
         for(HFDigiCollection::const_iterator digi=hf->begin();digi!=hf->end();digi++){
             eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size();
             for(int i=0;i<nTS;i++) data[i]=adc2fC[digi->sample(i).adc()&0xff]-2.5;
             hf_data[eta+42][phi-1][depth-1].add_statistics(data,nTS);
         }   
      }
   }else{ //Raddam
      edm::Handle<HFDigiCollection> hf;
      iEvent.getByLabel(inputLabelDigi_,hf);
      if(hf.isValid()){
         for(HFDigiCollection::const_iterator digi=hf->begin();digi!=hf->end();digi++){
             eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size();
             int N;
             for(N=0;N<56;N++)if(eta==RADDAM_CH[N].eta && phi==RADDAM_CH[N].phi) break;
             if(N==56) continue;      
             for(int i=0;i<nTS;i++) Raddam[N]->Fill(i,adc2fC[digi->sample(i).adc()&0xff]-2.5);
             
         }   
      }
   }
}
void HcalDetDiagLaserMonitor::beginLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup c 
) [private, virtual]

Reimplemented from HcalBaseDQMonitor.

Definition at line 1483 of file HcalDetDiagLaserMonitor.cc.

{}
void HcalDetDiagLaserMonitor::beginRun ( const edm::Run run,
const edm::EventSetup c 
) [private, virtual]

Reimplemented from HcalBaseDQMonitor.

Definition at line 313 of file HcalDetDiagLaserMonitor.cc.

References DQMStore::book1D(), DQMStore::book2D(), DQMStore::bookInt(), DQMStore::bookString(), HcalBaseDQMonitor::dbe_, EtaPhiHists::depth, emap, Energy2Dhbhehf, Energy2Dho, eta(), edm::EventSetup::get(), hb_time_rbx, hbheEnergy, hbheEnergyRMS, hbheTime, hbheTimeRMS, he_time_rbx, hf_time_rbx, hfEnergy, hfEnergyRMS, hfTime, hfTimeRMS, ho_time_rbx, hoEnergy, hoEnergyRMS, hoTime, hoTimeRMS, i, LoadReference(), meEVT_, meRUN_, AlCaRecoCosmics_cfg::name, phi, ProblemCellsByDepth_energy, ProblemCellsByDepth_energy_val, ProblemCellsByDepth_timing, ProblemCellsByDepth_timing_val, problemnames_, Raddam, refEnergy2Dhbhehf, refEnergy2Dho, ReferenceRun, RefRun_, refTime2Dhbhehf, refTime2Dho, MonitorElement::setAxisRange(), MonitorElement::setAxisTitle(), MonitorElement::setBinLabel(), DQMStore::setCurrentFolder(), EtaPhiHists::setup(), HcalBaseDQMonitor::setup(), HcalBaseDQMonitor::subdir_, Time2Dhbhehf, and Time2Dho.

                                                                               {

  edm::ESHandle<HcalDbService> conditions_;
  c.get<HcalDbRecord>().get(conditions_);
  emap=conditions_->getHcalMapping();
  
  HcalBaseDQMonitor::setup();
  if (!dbe_) return;
    std::string name;
 
  dbe_->setCurrentFolder(subdir_);   
  meEVT_ = dbe_->bookInt("HcalDetDiagLaserMonitor Event Number");
  meRUN_ = dbe_->bookInt("HcalDetDiagLaserMonitor Run Number");

  ProblemCellsByDepth_timing = new EtaPhiHists();
  ProblemCellsByDepth_timing->setup(dbe_," Problem Bad Laser Timing");
  for(unsigned int i=0;i<ProblemCellsByDepth_timing->depth.size();i++)
          problemnames_.push_back(ProblemCellsByDepth_timing->depth[i]->getName());
  ProblemCellsByDepth_energy = new EtaPhiHists();
  ProblemCellsByDepth_energy->setup(dbe_," Problem Bad Laser Energy");
  for(unsigned int i=0;i<ProblemCellsByDepth_energy->depth.size();i++)
          problemnames_.push_back(ProblemCellsByDepth_energy->depth[i]->getName());

  dbe_->setCurrentFolder(subdir_+"Summary Plots");
     
  name="HBHE Laser Energy Distribution";                hbheEnergy        = dbe_->book1D(name,name,200,0,3000);
  name="HBHE Laser Timing Distribution";                hbheTime          = dbe_->book1D(name,name,200,0,10);
  name="HBHE Laser Energy RMS_div_Energy Distribution"; hbheEnergyRMS     = dbe_->book1D(name,name,200,0,0.5);
  name="HBHE Laser Timing RMS Distribution";            hbheTimeRMS       = dbe_->book1D(name,name,200,0,1);
  name="HO Laser Energy Distribution";                  hoEnergy          = dbe_->book1D(name,name,200,0,3000);
  name="HO Laser Timing Distribution";                  hoTime            = dbe_->book1D(name,name,200,0,10);
  name="HO Laser Energy RMS_div_Energy Distribution";   hoEnergyRMS       = dbe_->book1D(name,name,200,0,0.5);
  name="HO Laser Timing RMS Distribution";              hoTimeRMS         = dbe_->book1D(name,name,200,0,1);
  name="HF Laser Energy Distribution";                  hfEnergy          = dbe_->book1D(name,name,200,0,3000);
  name="HF Laser Timing Distribution";                  hfTime            = dbe_->book1D(name,name,200,0,10);
  name="HF Laser Energy RMS_div_Energy Distribution";   hfEnergyRMS       = dbe_->book1D(name,name,200,0,0.7);
  name="HF Laser Timing RMS Distribution";              hfTimeRMS         = dbe_->book1D(name,name,200,0,1);
     
  name="Laser Timing HBHEHF";                           Time2Dhbhehf      = dbe_->book2D(name,name,87,-43,43,74,0,73);
  name="Laser Timing HO";                               Time2Dho          = dbe_->book2D(name,name,33,-16,16,74,0,73);
  name="Laser Energy HBHEHF";                           Energy2Dhbhehf    = dbe_->book2D(name,name,87,-43,43,74,0,73);
  name="Laser Energy HO";                               Energy2Dho        = dbe_->book2D(name,name,33,-16,16,74,0,73);
  name="HBHEHF Laser (Timing-Ref)+1";                   refTime2Dhbhehf   = dbe_->book2D(name,name,87,-43,43,74,0,73);
  name="HO Laser (Timing-Ref)+1";                       refTime2Dho       = dbe_->book2D(name,name,33,-16,16,74,0,73);
  name="HBHEHF Laser Energy_div_Ref";                   refEnergy2Dhbhehf = dbe_->book2D(name,name,87,-43,43,74,0,73);
  name="HO Laser Energy_div_Ref";                       refEnergy2Dho     = dbe_->book2D(name,name,33,-16,16,74,0,73);
     
  name="HB RBX average Time-Ref";                       hb_time_rbx       = dbe_->book1D(name,name,36,0.5,36.5);
  name="HE RBX average Time-Ref";                       he_time_rbx       = dbe_->book1D(name,name,36,0.5,36.5);
  name="HO RBX average Time-Ref";                       ho_time_rbx       = dbe_->book1D(name,name,36,0.5,36.5);
  name="HF RoBox average Time-Ref";                     hf_time_rbx       = dbe_->book1D(name,name,24,0.5,24.5);
  
  char str[200];
  for(int i=1;i<=18;i++){ sprintf(str,"HBM%02i",i);     hb_time_rbx->setBinLabel(i,str);    }
  for(int i=1;i<=18;i++){ sprintf(str,"HBP%02i",i);     hb_time_rbx->setBinLabel(i+18,str); }
  for(int i=1;i<=18;i++){ sprintf(str,"HEM%02i",i);     he_time_rbx->setBinLabel(i,str);    }
  for(int i=1;i<=18;i++){ sprintf(str,"HEP%02i",i);     he_time_rbx->setBinLabel(i+18,str); }
  for(int i=1;i<=12;i++){ sprintf(str,"HFM%02i",i);     hf_time_rbx->setBinLabel(i,str);    }
  for(int i=1;i<=12;i++){ sprintf(str,"HFP%02i",i);     hf_time_rbx->setBinLabel(i+12,str); }
  for(int i=1;i<=6;i++){  sprintf(str,"HO2M%02i",i*2);  ho_time_rbx->setBinLabel(i,str);    }
  for(int i=1;i<=6;i++){  sprintf(str,"HO1M%02i",i*2);  ho_time_rbx->setBinLabel(i+6,str);  }
  for(int i=1;i<=12;i++){ sprintf(str,"HO0%02i",i);     ho_time_rbx->setBinLabel(i+12,str); }
  for(int i=1;i<=6;i++){  sprintf(str,"HO1P%02i",i*2);  ho_time_rbx->setBinLabel(i+24,str); }
  for(int i=1;i<=6;i++){  sprintf(str,"HO2P%02i",i*2);  ho_time_rbx->setBinLabel(i+30,str); }

  Time2Dhbhehf->setAxisTitle("i#eta",1);
  Time2Dhbhehf->setAxisTitle("i#phi",2);
  Time2Dho->setAxisTitle("i#eta",1);
  Time2Dho->setAxisTitle("i#phi",2);
  Energy2Dhbhehf->setAxisTitle("i#eta",1);
  Energy2Dhbhehf->setAxisTitle("i#phi",2);
  Energy2Dho->setAxisTitle("i#eta",1);
  Energy2Dho->setAxisTitle("i#phi",2);
  refTime2Dhbhehf->setAxisTitle("i#eta",1);
  refTime2Dhbhehf->setAxisTitle("i#phi",2);
  refTime2Dho->setAxisTitle("i#eta",1);
  refTime2Dho->setAxisTitle("i#phi",2);
  refEnergy2Dhbhehf->setAxisTitle("i#eta",1);
  refEnergy2Dhbhehf->setAxisTitle("i#phi",2);
  refEnergy2Dho->setAxisTitle("i#eta",1);
  refEnergy2Dho->setAxisTitle("i#phi",2);

  refTime2Dhbhehf->setAxisRange(0,2,3);
  refTime2Dho->setAxisRange(0,2,3);
  refEnergy2Dhbhehf->setAxisRange(0.5,1.5,3);
  refEnergy2Dho->setAxisRange(0.5,1.5,3);

  ReferenceRun="UNKNOWN";
  LoadReference();
  dbe_->setCurrentFolder(subdir_);
  RefRun_= dbe_->bookString("HcalDetDiagLaserMonitor Reference Run",ReferenceRun);

  dbe_->setCurrentFolder(subdir_+"Raddam Plots");
  for(int i=0;i<56;i++){
     sprintf(str,"RADDAM (%i %i)",RADDAM_CH[i].eta,RADDAM_CH[i].phi);                                             
     Raddam[i] = dbe_->book1D(str,str,10,-0.5,9.5);  
  }
  dbe_->setCurrentFolder(subdir_+"Plots for client");
  ProblemCellsByDepth_timing_val = new EtaPhiHists();
  ProblemCellsByDepth_timing_val->setup(dbe_," Laser Timing difference");
  ProblemCellsByDepth_energy_val = new EtaPhiHists();
  ProblemCellsByDepth_energy_val->setup(dbe_," Laser Energy difference");
}
void HcalDetDiagLaserMonitor::endLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup c 
) [private, virtual]

Reimplemented from HcalBaseDQMonitor.

Definition at line 1484 of file HcalDetDiagLaserMonitor.cc.

{}
void HcalDetDiagLaserMonitor::endRun ( const edm::Run run,
const edm::EventSetup c 
) [private, virtual]
void HcalDetDiagLaserMonitor::fillHistos ( int  sd) [private]

Definition at line 928 of file HcalDetDiagLaserMonitor.cc.

References abs, Energy2Dhbhehf, Energy2Dho, eta(), MonitorElement::Fill(), get_ave_rbx(), HcalDetDiagLaserData::get_average_amp(), HcalDetDiagLaserData::get_average_time(), hb_data, hb_time_rbx, hbheEnergy, hbheEnergyRMS, hbheTime, hbheTimeRMS, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, he_data, he_time_rbx, hf_data, hf_time_rbx, hfEnergy, hfEnergyRMS, hfTime, hfTimeRMS, ho_data, ho_time_rbx, hoEnergy, hoEnergyRMS, hoTime, hoTimeRMS, i, max(), min, phi, refEnergy2Dhbhehf, refEnergy2Dho, refTime2Dhbhehf, refTime2Dho, MonitorElement::Reset(), plotscripts::rms(), MonitorElement::setAxisRange(), MonitorElement::setBinContent(), MonitorElement::setBinError(), cond::rpcobgas::time, Time2Dhbhehf, and Time2Dho.

Referenced by analyze(), and endRun().

                                              {
   if(sd==HcalBarrel || sd==HcalEndcap){
      hbheEnergy->Reset();
      hbheTime->Reset();
      hbheEnergyRMS->Reset();
      hbheTimeRMS->Reset();
      hb_time_rbx->Reset();
      he_time_rbx->Reset();
   }
   if(sd==HcalOuter){
      hoEnergy->Reset();
      hoTime->Reset();
      hoEnergyRMS->Reset();
      hoTimeRMS->Reset();
      Time2Dho->Reset();
      Energy2Dho->Reset();
      refTime2Dho->Reset(); 
      refEnergy2Dho->Reset();
      ho_time_rbx->Reset();
   }
   if(sd==HcalForward){
      hfEnergy->Reset();
      hfTime->Reset();
      hfEnergyRMS->Reset();
      hfTimeRMS->Reset();
      hf_time_rbx->Reset();
   }
   if(sd==HcalBarrel || sd==HcalEndcap){
     // HB histograms
     for(int eta=-16;eta<=16;eta++) for(int phi=1;phi<=72;phi++){ 
        double T=0,nT=0,E=0,nE=0;
        for(int depth=1;depth<=2;depth++){
           if(hb_data[eta+42][phi-1][depth-1].get_statistics()>10){
              double ave=0;
              double rms=0;
              double time=0; 
              double time_rms=0;
              hb_data[eta+42][phi-1][depth-1].get_average_amp(&ave,&rms);
              hb_data[eta+42][phi-1][depth-1].get_average_time(&time,&time_rms);
              hbheEnergy->Fill(ave);
              if(ave>0)hbheEnergyRMS->Fill(rms/ave);
              hbheTime->Fill(time);
              hbheTimeRMS->Fill(time_rms);
              T+=time; nT++; E+=ave; nE++;
           }
        } 
        if(nT>0){Time2Dhbhehf->setBinContent(eta+44,phi+1,T/nT);Energy2Dhbhehf->setBinContent(eta+44,phi+1,E/nE); }
     } 
     // HE histograms
     for(int eta=-29;eta<=29;eta++) for(int phi=1;phi<=72;phi++){
        double T=0,nT=0,E=0,nE=0;
        for(int depth=1;depth<=3;depth++){
           if(he_data[eta+42][phi-1][depth-1].get_statistics()>10){
              double ave=0; double rms=0; double time=0; double time_rms=0;
              he_data[eta+42][phi-1][depth-1].get_average_amp(&ave,&rms);
              he_data[eta+42][phi-1][depth-1].get_average_time(&time,&time_rms);
              hbheEnergy->Fill(ave);
              if(ave>0)hbheEnergyRMS->Fill(rms/ave);
              hbheTime->Fill(time);
              hbheTimeRMS->Fill(time_rms);
              T+=time; nT++; E+=ave; nE++;
           }
        }
        if(nT>0 && abs(eta)>16 ){Time2Dhbhehf->setBinContent(eta+44,phi+1,T/nT); Energy2Dhbhehf->setBinContent(eta+44,phi+1,E/nE); }     
        if(nT>0 && abs(eta)>20 ){Time2Dhbhehf->setBinContent(eta+44,phi+2,T/nT); Energy2Dhbhehf->setBinContent(eta+44,phi+2,E/nE);}      
     } 
   }
   if(sd==HcalForward){
     // HF histograms
     for(int eta=-42;eta<=42;eta++) for(int phi=1;phi<=72;phi++){
        double T=0,nT=0,E=0,nE=0;
        for(int depth=1;depth<=2;depth++){
           if(hf_data[eta+42][phi-1][depth-1].get_statistics()>10){
              double ave=0; double rms=0; double time=0; double time_rms=0;
              hf_data[eta+42][phi-1][depth-1].get_average_amp(&ave,&rms);
              hf_data[eta+42][phi-1][depth-1].get_average_time(&time,&time_rms);
              hfEnergy->Fill(ave);
              if(ave>0)hfEnergyRMS->Fill(rms/ave);
              hfTime->Fill(time);
              T+=time; nT++; E+=ave; nE++;
              hfTimeRMS->Fill(time_rms);
           }
        }       
        if(nT>0 && abs(eta)>29 ){ Time2Dhbhehf->setBinContent(eta+44,phi+1,T/nT);   Time2Dhbhehf->setBinContent(eta+44,phi+2,T/nT);}     
        if(nT>0 && abs(eta)>29 ){ Energy2Dhbhehf->setBinContent(eta+44,phi+1,E/nE); Energy2Dhbhehf->setBinContent(eta+44,phi+2,E/nE);}   
     }
   } 
   if(sd==HcalOuter){
     // HO histograms
     for(int eta=-15;eta<=15;eta++) for(int phi=1;phi<=72;phi++){
        double T=0,nT=0,E=0,nE=0;
        for(int depth=4;depth<=4;depth++){
           if(ho_data[eta+42][phi-1][depth-1].get_statistics()>10){
              double ave=0; double rms=0; double time=0; double time_rms=0;
              ho_data[eta+42][phi-1][depth-1].get_average_amp(&ave,&rms);
              ho_data[eta+42][phi-1][depth-1].get_average_time(&time,&time_rms);
              hoEnergy->Fill(ave);
              if(ave>0)hoEnergyRMS->Fill(rms/ave);
              hoTime->Fill(time);
              T+=time; nT++; E+=ave; nE++;
              hoTimeRMS->Fill(time_rms);
           }
        }
        if(nT>0){ Time2Dho->Fill(eta,phi,T/nT); Energy2Dho->Fill(eta,phi+1,E/nE) ;}
     } 
   }

   // compare with reference...
   if(sd==HcalBarrel || sd==HcalEndcap){
     for(int eta=-16;eta<=16;eta++) for(int phi=1;phi<=72;phi++){ 
        double T=0,nT=0,E=0,nE=0;
        for(int depth=1;depth<=2;depth++){
           if(hb_data[eta+42][phi-1][depth-1].get_statistics()>10){
             double val=0,rms=0,time=0,time_rms=0;
             double VAL=0,RMS=0,TIME=0,TIME_RMS=0;
             if(!hb_data[eta+42][phi-1][depth-1].get_reference(&val,&rms,&time,&time_rms)) continue;
             if(!hb_data[eta+42][phi-1][depth-1].get_average_amp(&VAL,&RMS)) continue;
             if(!hb_data[eta+42][phi-1][depth-1].get_average_time(&TIME,&TIME_RMS)) continue;
             E+=VAL/val; nE++;
             T+=TIME-time; nT++;
           }  
        }
        if(nE>0) refEnergy2Dhbhehf->setBinContent(eta+44,phi+1,E/nE);  
        if(nT>0){ double TTT=T/nT+1; if(TTT<0.01) TTT=0.01;  refTime2Dhbhehf->setBinContent(eta+44,phi+1,TTT); } 
     } 
     for(int eta=-29;eta<=29;eta++) for(int phi=1;phi<=72;phi++){
        double T=0,nT=0,E=0,nE=0;
        for(int depth=1;depth<=3;depth++){
           if(he_data[eta+42][phi-1][depth-1].get_statistics()>10){
             double val=0,rms=0,time=0,time_rms=0;
             double VAL=0,RMS=0,TIME=0,TIME_RMS=0;
             if(!he_data[eta+42][phi-1][depth-1].get_reference(&val,&rms,&time,&time_rms)) continue;
             if(!he_data[eta+42][phi-1][depth-1].get_average_amp(&VAL,&RMS)) continue;
             if(!he_data[eta+42][phi-1][depth-1].get_average_time(&TIME,&TIME_RMS)) continue;
             E+=VAL/val; nE++;
             T+=TIME-time; nT++;
           }  
        }
        if(nE>0 && abs(eta)>16) refEnergy2Dhbhehf->setBinContent(eta+44,phi+1,E/nE);  
        if(nT>0 && abs(eta)>16){ double TTT=T/nT+1; if(TTT<0.01) TTT=0.01;  refTime2Dhbhehf->setBinContent(eta+44,phi+1,TTT); } 
        if(nE>0 && abs(eta)>20) refEnergy2Dhbhehf->setBinContent(eta+44,phi+2,E/nE);  
        if(nT>0 && abs(eta)>20){ double TTT=T/nT+1; if(TTT<0.01) TTT=0.01;  refTime2Dhbhehf->setBinContent(eta+44,phi+2,TTT); }  
     } 
   }
   if(sd==HcalForward){
     for(int eta=-42;eta<=42;eta++) for(int phi=1;phi<=72;phi++){
        double T=0,nT=0,E=0,nE=0;
        for(int depth=1;depth<=2;depth++){
           if(hf_data[eta+42][phi-1][depth-1].get_statistics()>10){
             double val=0,rms=0,time=0,time_rms=0;
             double VAL=0,RMS=0,TIME=0,TIME_RMS=0;
             if(!hf_data[eta+42][phi-1][depth-1].get_reference(&val,&rms,&time,&time_rms)) continue;
             if(!hf_data[eta+42][phi-1][depth-1].get_average_amp(&VAL,&RMS)) continue;
             if(!hf_data[eta+42][phi-1][depth-1].get_average_time(&TIME,&TIME_RMS)) continue;
             E+=VAL/val; nE++;
             T+=TIME-time; nT++;
           }  
        }
        if(nE>0 && abs(eta)>29) refEnergy2Dhbhehf->setBinContent(eta+44,phi+1,E/nE);  
        if(nT>0 && abs(eta)>29){ double TTT=T/nT+1; if(TTT<0.01) TTT=0.01; refTime2Dhbhehf->setBinContent(eta+44,phi+1,TTT); }
        if(nE>0 && abs(eta)>29) refEnergy2Dhbhehf->setBinContent(eta+44,phi+2,E/nE);  
        if(nT>0 && abs(eta)>29){ double TTT=T/nT+1; if(TTT<0.01) TTT=0.01; refTime2Dhbhehf->setBinContent(eta+44,phi+2,TTT); } 
     }
   } 
   if(sd==HcalOuter){
     for(int eta=-15;eta<=15;eta++) for(int phi=1;phi<=72;phi++){
        double T=0,nT=0,E=0,nE=0;
        for(int depth=4;depth<=4;depth++){
           if(ho_data[eta+42][phi-1][depth-1].get_statistics()>10){
             double val=0,rms=0,time=0,time_rms=0;
             double VAL=0,RMS=0,TIME=0,TIME_RMS=0;
             if(!ho_data[eta+42][phi-1][depth-1].get_reference(&val,&rms,&time,&time_rms)) continue;
             if(!ho_data[eta+42][phi-1][depth-1].get_average_amp(&VAL,&RMS)) continue;
             if(!ho_data[eta+42][phi-1][depth-1].get_average_time(&TIME,&TIME_RMS)) continue;
             E+=VAL/val; nE++;
             T+=TIME-time; nT++;
           }  
         }
        if(nE>0) refEnergy2Dho->Fill(eta,phi,E/nE);  
        if(nT>0){ double TTT=T/nT+1; if(TTT<0.01) TTT=0.01; refTime2Dho->Fill(eta,phi,TTT);}  
     } 
   }
  float min,max;
  if(sd==HcalBarrel || sd==HcalEndcap){
    min=100;max=-100;
    for(int i=1;i<=18;i++){
      float ave=-10,rms=-10;
      if(get_ave_rbx(HcalBarrel,-1,i,&ave,&rms)){
        hb_time_rbx->setBinContent(i,ave);
        hb_time_rbx->setBinError(i,rms);
        if(ave<min) min=ave;
        if(ave>max) max=ave;
      }
    }
    for(int i=1;i<=18;i++){
      float ave=-10,rms=-10;
      if(get_ave_rbx(HcalBarrel,1,i,&ave,&rms)){
        hb_time_rbx->setBinContent(i+18,ave);
        hb_time_rbx->setBinError(i+18,rms);
        if(ave<min) min=ave;
        if(ave>max) max=ave;
      }
    }
    if(max>-100)hb_time_rbx->setAxisRange(min-1,max+1,2);
    min=100;max=-100;
    for(int i=1;i<=18;i++){
      float ave=-10,rms=-10;
      if(get_ave_rbx(HcalEndcap,-1,i,&ave,&rms)){
        he_time_rbx->setBinContent(i,ave);
        he_time_rbx->setBinError(i,rms);
        if(ave<min) min=ave;
        if(ave>max) max=ave;
      }
    }
    for(int i=1;i<=18;i++){
      float ave=-10,rms=-10;
      if(get_ave_rbx(HcalEndcap,1,i,&ave,&rms)){
        he_time_rbx->setBinContent(i+18,ave);
        he_time_rbx->setBinError(i+18,rms);
        if(ave<min) min=ave;
        if(ave>max) max=ave;
      }
    }
    if(max>-100)he_time_rbx->setAxisRange(min-1,max+1,2);
  }
  if(sd==HcalOuter){
    min=100;max=-100;
    for(int i=1;i<=6;i++){
      float ave=-10,rms=-10;
      if(get_ave_rbx(HcalOuter,-2,i,&ave,&rms)){
        ho_time_rbx->setBinContent(i,ave);
        ho_time_rbx->setBinError(i,rms);
        if(ave<min) min=ave;
        if(ave>max) max=ave;
      }
    }
    for(int i=1;i<=6;i++){
      float ave=-10,rms=-10;
      if(get_ave_rbx(HcalOuter,-1,i,&ave,&rms)){
        ho_time_rbx->setBinContent(i+6,ave);
        ho_time_rbx->setBinError(i+6,rms);
        if(ave<min) min=ave;
        if(ave>max) max=ave;
      }
    }
    for(int i=1;i<=12;i++){
      float ave=-10,rms=-10;
      if(get_ave_rbx(HcalOuter,0,i,&ave,&rms)){
        ho_time_rbx->setBinContent(i+12,ave);
        ho_time_rbx->setBinError(i+12,rms);
        if(ave<min) min=ave;
        if(ave>max) max=ave;
      }
    }
    for(int i=1;i<=6;i++){
      float ave=-10,rms=-10;
      if(get_ave_rbx(HcalOuter,1,i,&ave,&rms)){
        ho_time_rbx->setBinContent(i+24,ave);
        ho_time_rbx->setBinError(i+24,rms);
        if(ave<min) min=ave;
        if(ave>max) max=ave;
      }
    }
    for(int i=1;i<=6;i++){
      float ave=-10,rms=-10;
      if(get_ave_rbx(HcalOuter,2,i,&ave,&rms)){
        ho_time_rbx->setBinContent(i+30,ave);
        ho_time_rbx->setBinError(i+30,rms);
        if(ave<min) min=ave;
        if(ave>max) max=ave;
      }
    }
    if(max>-100)ho_time_rbx->setAxisRange(min-1,max+1,2);
  }
  if(sd==HcalForward){
    min=100;max=-100;
    for(int i=1;i<=12;i++){
      float ave=-10,rms=-10;
      if(get_ave_rbx(HcalForward,-1,i,&ave,&rms)){
        hf_time_rbx->setBinContent(i,ave);
        hf_time_rbx->setBinError(i,rms);
        if(ave<min) min=ave;
        if(ave>max) max=ave;
      }
    }
    for(int i=1;i<=12;i++){
      float ave=-10,rms=-10;
      if(get_ave_rbx(HcalForward,1,i,&ave,&rms)){
        hf_time_rbx->setBinContent(i+12,ave);
        hf_time_rbx->setBinError(i+12,rms);
        if(ave<min) min=ave;
        if(ave>max) max=ave;
      }
    }
    if(max>-100)hf_time_rbx->setAxisRange(min-1,max+1,2);
  }
} 
void HcalDetDiagLaserMonitor::fillProblems ( int  sd) [private]

Definition at line 614 of file HcalDetDiagLaserMonitor.cc.

References HcalElectronicsMap::allElectronicsIdPrecision(), CalcEtaBin(), EtaPhiHists::depth, HcalDetId::depth(), DetId::det(), cond::rpcobgas::detid, ExpressReco_HICollisions_FallBack::e, emap, eta(), get_ave_subdet(), hb_data, DetId::Hcal, HcalBarrel, HcalEndcap, HcalForward, HcalGenericDetId::HcalGenBarrel, HcalGenericDetId::HcalGenEndcap, HcalGenericDetId::HcalGenForward, HcalGenericDetId::HcalGenOuter, HcalOuter, he_data, hf_data, ho_data, i, HcalDetId::ieta(), HcalDetId::iphi(), LaserEnergyThreshold, LaserTimingThreshold, HcalElectronicsMap::lookup(), HcalDetDiagLaserData::nBadEnergy, HcalDetDiagLaserData::nBadTime, HcalDetDiagLaserData::nChecks, phi, ProblemCellsByDepth_energy, ProblemCellsByDepth_energy_val, ProblemCellsByDepth_timing, ProblemCellsByDepth_timing_val, plotscripts::rms(), DetId::subdetId(), and cond::rpcobgas::time.

Referenced by analyze(), and endRun().

                                                {
float ave_t,ave_e,ave_t_r,ave_e_r;
   if(!get_ave_subdet(sd,&ave_t,&ave_e,&ave_t_r,&ave_e_r)) return;

   for(int i=0;i<4;i++){
      ProblemCellsByDepth_energy->depth[i]->Reset();
      ProblemCellsByDepth_timing->depth[i]->Reset();
   }

   std::vector <HcalElectronicsId> AllElIds = emap->allElectronicsIdPrecision();
   for (std::vector <HcalElectronicsId>::iterator eid = AllElIds.begin(); eid != AllElIds.end(); eid++){
     DetId detid=emap->lookup(*eid);
     if (detid.det()!=DetId::Hcal) continue;
     HcalGenericDetId gid(emap->lookup(*eid));
     if (gid.null()) 
       continue;
     if (gid.genericSubdet()!=HcalGenericDetId::HcalGenBarrel &&
         gid.genericSubdet()!=HcalGenericDetId::HcalGenEndcap  &&
         gid.genericSubdet()!=HcalGenericDetId::HcalGenForward &&
         gid.genericSubdet()!=HcalGenericDetId::HcalGenOuter)
       continue;
     int eta=0,phi=0,depth=0;
     HcalDetId hid(detid);
     eta=hid.ieta();
     phi=hid.iphi();
     depth=hid.depth();

     int e=CalcEtaBin(sd,eta,depth)+1;
     if(detid.subdetId()==HcalBarrel && sd==HcalBarrel){
        double val=0,rms=0,time=0,time_rms=0,VAL=0,RMS=0,TIME=0,TIME_RMS=0;
        if(!hb_data[eta+42][phi-1][depth-1].get_reference(&val,&rms,&time,&time_rms)) continue;
        if(!hb_data[eta+42][phi-1][depth-1].get_average_amp(&VAL,&RMS)) continue;
        if(!hb_data[eta+42][phi-1][depth-1].get_average_time(&TIME,&TIME_RMS)) continue;
        hb_data[eta+42][phi-1][depth-1].nChecks++;
        float diff_t=(TIME-ave_t)-(time-ave_t_r); if(diff_t<0) diff_t=-diff_t;
        if(diff_t>LaserTimingThreshold){
             hb_data[eta+42][phi-1][depth-1].nBadTime++; 
             ProblemCellsByDepth_timing_val->depth[depth-1]->setBinContent(e,phi,(TIME-ave_t)-(time-ave_t_r));
        }else ProblemCellsByDepth_timing_val->depth[depth-1]->setBinContent(e,phi,0); 
        if(VAL!=0 && val!=0 && ave_e!=0 && ave_e_r!=0){
          float diff_e=((VAL/ave_e))/(val/ave_e_r);
          if(diff_e>(1+LaserEnergyThreshold) ||diff_e<(1-LaserEnergyThreshold) ){
               hb_data[eta+42][phi-1][depth-1].nBadEnergy++;
               ProblemCellsByDepth_energy_val->depth[depth-1]->setBinContent(e,phi,((VAL/ave_e))/(val/ave_e_r));
          }else ProblemCellsByDepth_energy_val->depth[depth-1]->setBinContent(e,phi,0);
        }
     }
     if(detid.subdetId()==HcalEndcap && sd==HcalEndcap){
        double val=0,rms=0,time=0,time_rms=0,VAL=0,RMS=0,TIME=0,TIME_RMS=0;
        if(!he_data[eta+42][phi-1][depth-1].get_reference(&val,&rms,&time,&time_rms)) continue;
        if(!he_data[eta+42][phi-1][depth-1].get_average_amp(&VAL,&RMS)) continue;
        if(!he_data[eta+42][phi-1][depth-1].get_average_time(&TIME,&TIME_RMS)) continue;
        he_data[eta+42][phi-1][depth-1].nChecks++;
        float diff_t=(TIME-ave_t)-(time-ave_t_r); if(diff_t<0) diff_t=-diff_t;
        if(diff_t>LaserTimingThreshold){
          he_data[eta+42][phi-1][depth-1].nBadTime++;
          ProblemCellsByDepth_timing_val->depth[depth-1]->setBinContent(e,phi,(TIME-ave_t)-(time-ave_t_r));
        }else ProblemCellsByDepth_timing_val->depth[depth-1]->setBinContent(e,phi,0); 
        if(VAL!=0 && val!=0 && ave_e!=0 && ave_e_r!=0){
          float diff_e=((VAL/ave_e))/(val/ave_e_r);
          if(diff_e>(1+LaserEnergyThreshold) ||diff_e<(1-LaserEnergyThreshold) ){
            he_data[eta+42][phi-1][depth-1].nBadEnergy++;
            ProblemCellsByDepth_energy_val->depth[depth-1]->setBinContent(e,phi,((VAL/ave_e))/(val/ave_e_r));
          }else ProblemCellsByDepth_energy_val->depth[depth-1]->setBinContent(e,phi,0);
        }
     }
     if(detid.subdetId()==HcalOuter && sd==HcalOuter){
        double val=0,rms=0,time=0,time_rms=0,VAL=0,RMS=0,TIME=0,TIME_RMS=0;
        if(!ho_data[eta+42][phi-1][depth-1].get_reference(&val,&rms,&time,&time_rms)) continue;
        if(!ho_data[eta+42][phi-1][depth-1].get_average_amp(&VAL,&RMS)) continue;
        if(!ho_data[eta+42][phi-1][depth-1].get_average_time(&TIME,&TIME_RMS)) continue;
        ho_data[eta+42][phi-1][depth-1].nChecks++;
        float diff_t=(TIME-ave_t)-(time-ave_t_r); if(diff_t<0) diff_t=-diff_t;
        if(diff_t>LaserTimingThreshold){
           ho_data[eta+42][phi-1][depth-1].nBadTime++;
           ProblemCellsByDepth_timing_val->depth[depth-1]->setBinContent(e,phi,(TIME-ave_t)-(time-ave_t_r));
        }else ProblemCellsByDepth_timing_val->depth[depth-1]->setBinContent(e,phi,0); 
        if(VAL!=0 && val!=0 && ave_e!=0 && ave_e_r!=0){
          float diff_e=((VAL/ave_e))/(val/ave_e_r);
          if(diff_e>(1+LaserEnergyThreshold) ||diff_e<(1-LaserEnergyThreshold) ){
            ho_data[eta+42][phi-1][depth-1].nBadEnergy++;
            ProblemCellsByDepth_energy_val->depth[depth-1]->setBinContent(e,phi,((VAL/ave_e))/(val/ave_e_r));
          }else ProblemCellsByDepth_energy_val->depth[depth-1]->setBinContent(e,phi,0);
        }
     }
     if(detid.subdetId()==HcalForward && sd==HcalForward){
        double val=0,rms=0,time=0,time_rms=0,VAL=0,RMS=0,TIME=0,TIME_RMS=0;
        if(!hf_data[eta+42][phi-1][depth-1].get_reference(&val,&rms,&time,&time_rms)) continue;
        if(!hf_data[eta+42][phi-1][depth-1].get_average_amp(&VAL,&RMS)) continue;
        if(!hf_data[eta+42][phi-1][depth-1].get_average_time(&TIME,&TIME_RMS)) continue;
        hf_data[eta+42][phi-1][depth-1].nChecks++;
        float diff_t=(TIME-ave_t)-(time-ave_t_r); if(diff_t<0) diff_t=-diff_t;
        if(diff_t>LaserTimingThreshold){
           hf_data[eta+42][phi-1][depth-1].nBadTime++;
           ProblemCellsByDepth_timing_val->depth[depth-1]->setBinContent(e,phi,(TIME-ave_t)-(time-ave_t_r));
        }else ProblemCellsByDepth_timing_val->depth[depth-1]->setBinContent(e,phi,0); 
        if(VAL!=0 && val!=0 && ave_e!=0 && ave_e_r!=0){
          float diff_e=((VAL/ave_e))/(val/ave_e_r);
          if(diff_e>(1+LaserEnergyThreshold) ||diff_e<(1-LaserEnergyThreshold) ){
            hf_data[eta+42][phi-1][depth-1].nBadEnergy++;
            ProblemCellsByDepth_energy_val->depth[depth-1]->setBinContent(e,phi,((VAL/ave_e))/(val/ave_e_r));
          }else ProblemCellsByDepth_energy_val->depth[depth-1]->setBinContent(e,phi,0);
        }
     }
   }
   for (std::vector <HcalElectronicsId>::iterator eid = AllElIds.begin(); eid != AllElIds.end(); eid++){
     DetId detid=emap->lookup(*eid);
     if (detid.det()!=DetId::Hcal) continue;
     HcalGenericDetId gid(emap->lookup(*eid));
     if (gid.null()) 
       continue;
     if (gid.genericSubdet()!=HcalGenericDetId::HcalGenBarrel &&
         gid.genericSubdet()!=HcalGenericDetId::HcalGenEndcap  &&
         gid.genericSubdet()!=HcalGenericDetId::HcalGenForward &&
         gid.genericSubdet()!=HcalGenericDetId::HcalGenOuter)
       continue;

     int eta=0,phi=0,depth=0;
     HcalDetId hid(detid);
     eta=hid.ieta();
     phi=hid.iphi();
     depth=hid.depth();
   
     if(detid.subdetId()==HcalBarrel){
        if(hb_data[eta+42][phi-1][depth-1].nBadTime>0){
           int e=CalcEtaBin(HcalBarrel,eta,depth)+1; 
           double val=hb_data[eta+42][phi-1][depth-1].nBadTime/hb_data[eta+42][phi-1][depth-1].nChecks;
           ProblemCellsByDepth_timing->depth[depth-1]->setBinContent(e,phi,val);
        } 
        if(hb_data[eta+42][phi-1][depth-1].nBadEnergy>0){
           int e=CalcEtaBin(HcalBarrel,eta,depth)+1; 
           double val=hb_data[eta+42][phi-1][depth-1].nBadEnergy/hb_data[eta+42][phi-1][depth-1].nChecks;
           ProblemCellsByDepth_energy->depth[depth-1]->setBinContent(e,phi,val);
        } 
     }
     if(detid.subdetId()==HcalEndcap){
        if(he_data[eta+42][phi-1][depth-1].nBadTime>0){
           int e=CalcEtaBin(HcalEndcap,eta,depth)+1; 
           double val=he_data[eta+42][phi-1][depth-1].nBadTime/he_data[eta+42][phi-1][depth-1].nChecks;
           ProblemCellsByDepth_timing->depth[depth-1]->setBinContent(e,phi,val);
        } 
        if(he_data[eta+42][phi-1][depth-1].nBadEnergy>0){
           int e=CalcEtaBin(HcalEndcap,eta,depth)+1; 
           double val=he_data[eta+42][phi-1][depth-1].nBadEnergy/he_data[eta+42][phi-1][depth-1].nChecks;
           ProblemCellsByDepth_energy->depth[depth-1]->setBinContent(e,phi,val);
        } 
     }
     if(detid.subdetId()==HcalOuter){
        if(ho_data[eta+42][phi-1][depth-1].nBadTime>0){
           int e=CalcEtaBin(HcalOuter,eta,depth)+1; 
           double val=ho_data[eta+42][phi-1][depth-1].nBadTime/ho_data[eta+42][phi-1][depth-1].nChecks;
           ProblemCellsByDepth_timing->depth[depth-1]->setBinContent(e,phi,val);
        } 
        if(ho_data[eta+42][phi-1][depth-1].nBadEnergy>0){
           int e=CalcEtaBin(HcalOuter,eta,depth)+1; 
           double val=ho_data[eta+42][phi-1][depth-1].nBadEnergy/ho_data[eta+42][phi-1][depth-1].nChecks;
           ProblemCellsByDepth_energy->depth[depth-1]->setBinContent(e,phi,val); 
        } 
     }
     if(detid.subdetId()==HcalForward){
        if(hf_data[eta+42][phi-1][depth-1].nBadTime>0){
           int e=CalcEtaBin(HcalForward,eta,depth)+1; 
           double val=hf_data[eta+42][phi-1][depth-1].nBadTime/hf_data[eta+42][phi-1][depth-1].nChecks;
           ProblemCellsByDepth_timing->depth[depth-1]->setBinContent(e,phi,val);
        } 
        if(hf_data[eta+42][phi-1][depth-1].nBadEnergy>0){
           int e=CalcEtaBin(HcalForward,eta,depth)+1; 
           double val=hf_data[eta+42][phi-1][depth-1].nBadEnergy/hf_data[eta+42][phi-1][depth-1].nChecks;
           ProblemCellsByDepth_energy->depth[depth-1]->setBinContent(e,phi,val);
        } 
     }
   }
}
bool HcalDetDiagLaserMonitor::get_ave_rbx ( int  sd,
int  side,
int  rbx,
float *  ave,
float *  rms 
) [private]

Definition at line 788 of file HcalDetDiagLaserMonitor.cc.

References hb_data, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, he_data, hf_data, ho_data, i, j, gen::k, n, plotscripts::rms(), mathSSE::sqrt(), and cond::rpcobgas::time.

Referenced by fillHistos().

                                                                                      {
   double xt=0,xxt=0; 
   int eta_min=0,eta_max=0,n=0;
   if(sd==HcalBarrel){
      if(side>0){eta_min=1; eta_max=29;}
      if(side<0){eta_min=-29; eta_max=-1;}
      if(rbx==1){
         for(int i=eta_min;i<=eta_max;i++) for(int j=71;j<=72;j++)for(int k=1;k<=3;k++){
           double val,rms,time,time_rms;
           double TIME,TIME_RMS;
           if(!hb_data[i+42][j-1][k-1].get_reference(&val,&rms,&time,&time_rms)) continue;
           if(!hb_data[i+42][j-1][k-1].get_average_time(&TIME,&TIME_RMS)) continue;
           xt+=TIME-time; xxt+=(TIME-time)*(TIME-time); n++;
         }
         for(int i=eta_min;i<=eta_max;i++) for(int j=1;j<=2;j++)for(int k=1;k<=3;k++){
           double val,rms,time,time_rms;
           double TIME,TIME_RMS;
           if(!hb_data[i+42][j-1][k-1].get_reference(&val,&rms,&time,&time_rms)) continue;
           if(!hb_data[i+42][j-1][k-1].get_average_time(&TIME,&TIME_RMS)) continue;
           xt+=TIME-time; xxt+=(TIME-time)*(TIME-time); n++;
         }
      
      }else{
         for(int i=eta_min;i<=eta_max;i++) for(int j=((rbx-1)*4-1);j<=((rbx-1)*4+2);j++)for(int k=1;k<=3;k++){
           double val,rms,time,time_rms;
           double TIME,TIME_RMS;
           if(!hb_data[i+42][j-1][k-1].get_reference(&val,&rms,&time,&time_rms)) continue;
           if(!hb_data[i+42][j-1][k-1].get_average_time(&TIME,&TIME_RMS)) continue;
           xt+=TIME-time; xxt+=(TIME-time)*(TIME-time); n++;
         }
      }
   }
   if(sd==HcalEndcap){
      if(side>0){eta_min=1; eta_max=29;}
      if(side<0){eta_min=-29; eta_max=-1;}
      if(rbx==1){
         for(int i=eta_min;i<=eta_max;i++) for(int j=71;j<=72;j++)for(int k=1;k<=3;k++){
           double val,rms,time,time_rms;
           double TIME,TIME_RMS;
           if(!he_data[i+42][j-1][k-1].get_reference(&val,&rms,&time,&time_rms)) continue;
           if(!he_data[i+42][j-1][k-1].get_average_time(&TIME,&TIME_RMS)) continue;
           xt+=TIME-time; xxt+=(TIME-time)*(TIME-time); n++;
         }
         for(int i=eta_min;i<=eta_max;i++) for(int j=1;j<=2;j++)for(int k=1;k<=3;k++){
           double val,rms,time,time_rms;
           double TIME,TIME_RMS;
           if(!he_data[i+42][j-1][k-1].get_reference(&val,&rms,&time,&time_rms)) continue;
           if(!he_data[i+42][j-1][k-1].get_average_time(&TIME,&TIME_RMS)) continue;
           xt+=TIME-time; xxt+=(TIME-time)*(TIME-time); n++;
         }
      
      }else{
         for(int i=eta_min;i<=eta_max;i++) for(int j=((rbx-1)*4-1);j<=((rbx-1)*4+2);j++)for(int k=1;k<=3;k++){
           double val,rms,time,time_rms;
           double TIME,TIME_RMS;
           if(!he_data[i+42][j-1][k-1].get_reference(&val,&rms,&time,&time_rms)) continue;
           if(!he_data[i+42][j-1][k-1].get_average_time(&TIME,&TIME_RMS)) continue;
           xt+=TIME-time; xxt+=(TIME-time)*(TIME-time); n++;
         }
      }
   }  
   if(sd==HcalForward){
      if(side>0){eta_min=29; eta_max=40;}
      if(side<0){eta_min=-40; eta_max=-29;}
      for(int i=eta_min;i<=eta_max;i++) for(int j=((rbx-1)*6+1);j<=((rbx-1)*6+6);j++)for(int k=1;k<=2;k++){
           double val,rms,time,time_rms;
           double TIME,TIME_RMS;
           if(!hf_data[i+42][j-1][k-1].get_reference(&val,&rms,&time,&time_rms)) continue;
           if(!hf_data[i+42][j-1][k-1].get_average_time(&TIME,&TIME_RMS)) continue;
           xt+=TIME-time; xxt+=(TIME-time)*(TIME-time); n++;
      }
   }   
   if(sd==HcalOuter){
      if(side==0){
        eta_min=-4,eta_max=4;
        if(rbx==1){
          for(int i=eta_min;i<=eta_max;i++) for(int j=71;j<=72;j++){
           double val,rms,time,time_rms;
           double TIME,TIME_RMS;
           if(!ho_data[i+42][j-1][4-1].get_reference(&val,&rms,&time,&time_rms)) continue;
           if(!ho_data[i+42][j-1][4-1].get_average_time(&TIME,&TIME_RMS)) continue;
           xt+=TIME-time; xxt+=(TIME-time)*(TIME-time); n++;
          }
          for(int i=eta_min;i<=eta_max;i++) for(int j=1;j<=4;j++){
           double val,rms,time,time_rms;
           double TIME,TIME_RMS;
           if(!ho_data[i+42][j-1][4-1].get_reference(&val,&rms,&time,&time_rms)) continue;
           if(!ho_data[i+42][j-1][4-1].get_average_time(&TIME,&TIME_RMS)) continue;
           xt+=TIME-time; xxt+=(TIME-time)*(TIME-time); n++;
          }
        
        }else{
          for(int i=eta_min;i<=eta_max;i++) for(int j=((rbx-1)*6-1);j<=((rbx-1)*6+4);j++){
           double val,rms,time,time_rms;
           double TIME,TIME_RMS;
           if(!ho_data[i+42][j-1][4-1].get_reference(&val,&rms,&time,&time_rms)) continue;
           if(!ho_data[i+42][j-1][4-1].get_average_time(&TIME,&TIME_RMS)) continue;
           xt+=TIME-time; xxt+=(TIME-time)*(TIME-time); n++;
          }
        }
      }
      if(side==-1){ eta_min=-10,eta_max=-5;} 
      if(side==-2){ eta_min=-15,eta_max=-11;} 
      if(side==1) { eta_min=5,  eta_max=10;} 
      if(side==2) { eta_min=11, eta_max=15;}
      if(side!=0){
        if(rbx==1){
          for(int i=eta_min;i<=eta_max;i++) for(int j=71;j<=72;j++){
           double val,rms,time,time_rms;
           double TIME,TIME_RMS;
           if(!ho_data[i+42][j-1][4-1].get_reference(&val,&rms,&time,&time_rms)) continue;
           if(!ho_data[i+42][j-1][4-1].get_average_time(&TIME,&TIME_RMS)) continue;
           xt+=TIME-time; xxt+=(TIME-time)*(TIME-time); n++;
          }
          for(int i=eta_min;i<=eta_max;i++) for(int j=1;j<=10;j++){
           double val,rms,time,time_rms;
           double TIME,TIME_RMS;
           if(!ho_data[i+42][j-1][4-1].get_reference(&val,&rms,&time,&time_rms)) continue;
           if(!ho_data[i+42][j-1][4-1].get_average_time(&TIME,&TIME_RMS)) continue;
           xt+=TIME-time; xxt+=(TIME-time)*(TIME-time); n++;
          }
        
        }else{
          for(int i=eta_min;i<=eta_max;i++) for(int j=((rbx-1)*12-1);j<=((rbx-1)*12+10);j++){
           double val,rms,time,time_rms;
           double TIME,TIME_RMS;
           if(!ho_data[i+42][j-1][4-1].get_reference(&val,&rms,&time,&time_rms)) continue;
           if(!ho_data[i+42][j-1][4-1].get_average_time(&TIME,&TIME_RMS)) continue;
           xt+=TIME-time; xxt+=(TIME-time)*(TIME-time); n++;
          }
        }      
      } 
   }
   if(n<10) return false;
   *ave=xt/n;
   *rms=sqrt(xxt/n-(xt*xt)/(n*n));
   return true; 
}
bool HcalDetDiagLaserMonitor::get_ave_subdet ( int  sd,
float *  ave_t,
float *  ave_e,
float *  ave_t_r,
float *  ave_e_r 
) [private]

Definition at line 553 of file HcalDetDiagLaserMonitor.cc.

References eta(), HcalDetDiagLaserData::get_average_amp(), HcalDetDiagLaserData::get_average_time(), hb_data, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, he_data, hf_data, ho_data, phi, plotscripts::rms(), and cond::rpcobgas::time.

Referenced by fillProblems().

                                                                                                          {
double T=0,nT=0,E=0,nE=0,Tr=0,nTr=0,Er=0,nEr=0;
   if(sd==HcalBarrel) for(int eta=-16;eta<=16;eta++) for(int phi=1;phi<=72;phi++){ 
      for(int depth=1;depth<=2;depth++){
         if(hb_data[eta+42][phi-1][depth-1].get_statistics()>10){
            double ave=0,rms=0,time=0,time_rms=0;
            hb_data[eta+42][phi-1][depth-1].get_average_amp(&ave,&rms);
            hb_data[eta+42][phi-1][depth-1].get_average_time(&time,&time_rms);
            T+=time; nT++; E+=ave; nE++;
            if(hb_data[eta+42][phi-1][depth-1].get_reference(&ave,&rms,&time,&time_rms)){
              Tr+=time; nTr++; Er+=ave; nEr++;}
         }
      } 
   } 
   // HE histograms
   if(sd==HcalEndcap) for(int eta=-29;eta<=29;eta++) for(int phi=1;phi<=72;phi++){
      for(int depth=1;depth<=3;depth++){
         if(he_data[eta+42][phi-1][depth-1].get_statistics()>10){
            double ave=0; double rms=0; double time=0; double time_rms=0;
            he_data[eta+42][phi-1][depth-1].get_average_amp(&ave,&rms);
            he_data[eta+42][phi-1][depth-1].get_average_time(&time,&time_rms);
            T+=time; nT++; E+=ave; nE++;
            if(he_data[eta+42][phi-1][depth-1].get_reference(&ave,&rms,&time,&time_rms)){
              Tr+=time; nTr++; Er+=ave; nEr++;}
        }
      }
   } 
   // HF histograms
   if(sd==HcalForward) for(int eta=-42;eta<=42;eta++) for(int phi=1;phi<=72;phi++){
      for(int depth=1;depth<=2;depth++){
         if(hf_data[eta+42][phi-1][depth-1].get_statistics()>10){
            double ave=0; double rms=0; double time=0; double time_rms=0;
            hf_data[eta+42][phi-1][depth-1].get_average_amp(&ave,&rms);
            hf_data[eta+42][phi-1][depth-1].get_average_time(&time,&time_rms);
            T+=time; nT++; E+=ave; nE++;
            if(hf_data[eta+42][phi-1][depth-1].get_reference(&ave,&rms,&time,&time_rms)){
              Tr+=time; nTr++; Er+=ave; nEr++;}
         }
      } 
   } 
   // HO histograms
   if(sd==HcalOuter) for(int eta=-15;eta<=15;eta++) for(int phi=1;phi<=72;phi++){
      for(int depth=4;depth<=4;depth++){
         if(ho_data[eta+42][phi-1][depth-1].get_statistics()>10){
            double ave=0; double rms=0; double time=0; double time_rms=0;
            ho_data[eta+42][phi-1][depth-1].get_average_amp(&ave,&rms);
            ho_data[eta+42][phi-1][depth-1].get_average_time(&time,&time_rms);
            T+=time; nT++; E+=ave; nE++;
            if(ho_data[eta+42][phi-1][depth-1].get_reference(&ave,&rms,&time,&time_rms)){
              Tr+=time; nTr++; Er+=ave; nEr++;}
         }
      }
   } 
   if(nT<200 || nE<200 || nTr<200 || nEr<200) return false;
   *ave_t=T/nT;
   *ave_e=E/nE;
   *ave_t_r=Tr/nTr;
   *ave_e_r=Er/nEr;
   return true;
}
void HcalDetDiagLaserMonitor::LoadReference ( ) [private]

Definition at line 1435 of file HcalDetDiagLaserMonitor.cc.

References reco::tau::disc::Eta(), f, hb_data, he_data, hf_data, ho_data, IsReference, colinearityKinematic::Phi, ReferenceData, ReferenceRun, plotscripts::rms(), HcalDetDiagLaserData::set_reference(), matplotRender::t, and cond::rpcobgas::time.

Referenced by beginRun().

                                           {
double amp,rms,time,time_rms;
int Eta,Phi,Depth;
char subdet[10];
TFile *f;
 if(gSystem->AccessPathName(ReferenceData.c_str())) return;
 f = new TFile(ReferenceData.c_str(),"READ");
 
 if(!f->IsOpen()) return ;
 TObjString *STR=(TObjString *)f->Get("run number");
 
 if(STR){ std::string Ref(STR->String()); ReferenceRun=Ref;}
 
      TTree*  t=(TTree*)f->Get("HCAL Laser data");
      if(!t) return;
      t->SetBranchAddress("Subdet",   subdet);
      t->SetBranchAddress("eta",      &Eta);
      t->SetBranchAddress("phi",      &Phi);
      t->SetBranchAddress("depth",    &Depth);
      t->SetBranchAddress("amp",      &amp);
      t->SetBranchAddress("rms",      &rms);
      t->SetBranchAddress("time",     &time);
      t->SetBranchAddress("time_rms", &time_rms);
     
      for(int ievt=0;ievt<t->GetEntries();ievt++){
         t->GetEntry(ievt);
         if(strcmp(subdet,"HB")==0) hb_data[Eta+42][Phi-1][Depth-1].set_reference(amp,rms,time,time_rms);
         if(strcmp(subdet,"HE")==0) he_data[Eta+42][Phi-1][Depth-1].set_reference(amp,rms,time,time_rms);
         if(strcmp(subdet,"HO")==0) ho_data[Eta+42][Phi-1][Depth-1].set_reference(amp,rms,time,time_rms);
         if(strcmp(subdet,"HF")==0) hf_data[Eta+42][Phi-1][Depth-1].set_reference(amp,rms,time,time_rms);
      }
      f->Close();
      IsReference=true;
} 
void HcalDetDiagLaserMonitor::SaveReference ( ) [private]

Definition at line 1229 of file HcalDetDiagLaserMonitor.cc.

References HcalElectronicsMap::allElectronicsIdPrecision(), dataset_seq_number, HcalDetId::depth(), DetId::det(), cond::rpcobgas::detid, ExpressReco_HICollisions_FallBack::e, emap, eta(), reco::tau::disc::Eta(), patZpeak::events, HcalDetDiagLaserData::get_average_amp1(), HcalDetDiagLaserData::get_average_time1(), HcalDetDiagLaserData::get_statistics1(), HcalDetDiagLaserData::get_status(), hb_data, DetId::Hcal, HcalBarrel, HcalEndcap, HcalForward, HcalGenericDetId::HcalGenBarrel, HcalGenericDetId::HcalGenEndcap, HcalGenericDetId::HcalGenForward, HcalGenericDetId::HcalGenOuter, HcalOuter, he_data, hf_data, ho_data, i, HcalDetId::ieta(), ievt_, HcalDetId::iphi(), j, gen::k, HcalElectronicsMap::lookup(), OutputFilePath, Overwrite, phi, colinearityKinematic::Phi, plotscripts::rms(), CrabTask::run, run_number, step1_ZMM_7Tev::Status, DetId::subdetId(), matplotRender::t, interactiveExample::theFile, cond::rpcobgas::time, diffTreeTool::tree, xmlFile(), and XmlFilePath.

Referenced by analyze(), and endRun().

                                           {
double amp,rms,Time,time_rms;
int    Eta,Phi,Depth,Statistic,Status=0;
char   Subdet[10],str[500];
   if(OutputFilePath.size()>0){
       if(!Overwrite){
          sprintf(str,"%sHcalDetDiagLaserData_run%06i_%i.root",OutputFilePath.c_str(),run_number,dataset_seq_number);
       }else{
          sprintf(str,"%sHcalDetDiagLaserData.root",OutputFilePath.c_str());
       }
       TFile *theFile = new TFile(str, "RECREATE");
       if(!theFile->IsOpen()) return;
       theFile->cd();
       sprintf(str,"%d",run_number); TObjString run(str);    run.Write("run number");
       sprintf(str,"%d",ievt_);      TObjString events(str); events.Write("Total events processed");
       sprintf(str,"%d",dataset_seq_number);      TObjString dsnum(str);  dsnum.Write("Dataset number");
       Long_t t; t=time(0); strftime(str,30,"%F %T",localtime(&t)); TObjString tm(str);  tm.Write("Dataset creation time");

       TTree *tree   =new TTree("HCAL Laser data","HCAL Laser data");
       if(tree==0)   return;
       tree->Branch("Subdet",   &Subdet,         "Subdet/C");
       tree->Branch("eta",      &Eta,            "Eta/I");
       tree->Branch("phi",      &Phi,            "Phi/I");
       tree->Branch("depth",    &Depth,          "Depth/I");
       tree->Branch("statistic",&Statistic,      "Statistic/I");
       tree->Branch("status",   &Status,         "Status/I");
       tree->Branch("amp",      &amp,            "amp/D");
       tree->Branch("rms",      &rms,            "rms/D");
       tree->Branch("time",     &Time,           "time/D");
       tree->Branch("time_rms", &time_rms,       "time_rms/D");
       sprintf(Subdet,"HB");
       for(int eta=-16;eta<=16;eta++) for(int phi=1;phi<=72;phi++) for(int depth=1;depth<=2;depth++){
          if((Statistic=hb_data[eta+42][phi-1][depth-1].get_statistics1())>10){
             Eta=eta; Phi=phi; Depth=depth;
             Status=hb_data[eta+42][phi-1][depth-1].get_status();
             hb_data[eta+42][phi-1][depth-1].get_average_amp1(&amp,&rms);
             hb_data[eta+42][phi-1][depth-1].get_average_time1(&Time,&time_rms);
             tree->Fill();
          }
       } 
       sprintf(Subdet,"HE");
       for(int eta=-29;eta<=29;eta++) for(int phi=1;phi<=72;phi++) for(int depth=1;depth<=3;depth++){
         if((Statistic=he_data[eta+42][phi-1][depth-1].get_statistics1())>10){
            Eta=eta; Phi=phi; Depth=depth;
            Status=he_data[eta+42][phi-1][depth-1].get_status();
            he_data[eta+42][phi-1][depth-1].get_average_amp1(&amp,&rms);
            he_data[eta+42][phi-1][depth-1].get_average_time1(&Time,&time_rms);
            tree->Fill();
         }
       } 
       sprintf(Subdet,"HO");
       for(int eta=-15;eta<=15;eta++) for(int phi=1;phi<=72;phi++) for(int depth=4;depth<=4;depth++){
         if((Statistic=ho_data[eta+42][phi-1][depth-1].get_statistics1())>10){
             Eta=eta; Phi=phi; Depth=depth;
             Status=ho_data[eta+42][phi-1][depth-1].get_status();
             ho_data[eta+42][phi-1][depth-1].get_average_amp1(&amp,&rms);
             ho_data[eta+42][phi-1][depth-1].get_average_time1(&Time,&time_rms);
             tree->Fill();
         }
       } 
       sprintf(Subdet,"HF");
       for(int eta=-42;eta<=42;eta++) for(int phi=1;phi<=72;phi++) for(int depth=1;depth<=2;depth++){
         if((Statistic=hf_data[eta+42][phi-1][depth-1].get_statistics1())>10){
             Eta=eta; Phi=phi; Depth=depth;
             Status=hf_data[eta+42][phi-1][depth-1].get_status();
             hf_data[eta+42][phi-1][depth-1].get_average_amp1(&amp,&rms);
             hf_data[eta+42][phi-1][depth-1].get_average_time1(&Time,&time_rms);
             tree->Fill();
         }
       }
       theFile->Write();
       theFile->Close();
   }
   if(XmlFilePath.size()>0){
      //create XML file
      if(!Overwrite){
         sprintf(str,"HcalDetDiagLaser_%i_%i.xml",run_number,dataset_seq_number);
      }else{
         sprintf(str,"HcalDetDiagLaser.xml");
      }
      std::string xmlName=str;
      ofstream xmlFile;
      xmlFile.open(xmlName.c_str());

      xmlFile<<"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n";
      xmlFile<<"<ROOT>\n";
      xmlFile<<"  <HEADER>\n";
      xmlFile<<"    <HINTS mode='only-det-root'/>\n";
      xmlFile<<"    <TYPE>\n";
      xmlFile<<"      <EXTENSION_TABLE_NAME>HCAL_DETMON_LED_LASER_V1</EXTENSION_TABLE_NAME>\n";
      xmlFile<<"      <NAME>HCAL Laser HBHE HPD [abort gap global]</NAME>\n";
      xmlFile<<"    </TYPE>\n";
      xmlFile<<"    <!-- run details -->\n";
      xmlFile<<"    <RUN>\n";
      xmlFile<<"      <RUN_TYPE>GLOBAL-RUN</RUN_TYPE>\n";
      xmlFile<<"      <RUN_NUMBER>"<<run_number<<"</RUN_NUMBER>\n";
      xmlFile<<"      <RUN_BEGIN_TIMESTAMP>2009-01-01 00:00:00</RUN_BEGIN_TIMESTAMP>\n";
      xmlFile<<"      <COMMENT_DESCRIPTION>hcal laser data</COMMENT_DESCRIPTION>\n";
      xmlFile<<"      <LOCATION>P5</LOCATION>\n";
      xmlFile<<"      <INITIATED_BY_USER>dma</INITIATED_BY_USER>\n";
      xmlFile<<"    </RUN>\n";
      xmlFile<<"  </HEADER>\n";
      xmlFile<<"  <DATA_SET>\n";
      xmlFile<<"     <!-- optional dataset metadata -->\n\n";
      xmlFile<<"     <SET_NUMBER>"<<dataset_seq_number<<"</SET_NUMBER>\n";
      xmlFile<<"     <SET_BEGIN_TIMESTAMP>2009-01-01 00:00:00</SET_BEGIN_TIMESTAMP>\n";
      xmlFile<<"     <SET_END_TIMESTAMP>2009-01-01 00:00:00</SET_END_TIMESTAMP>\n";
      xmlFile<<"     <NUMBER_OF_EVENTS_IN_SET>"<<ievt_<<"</NUMBER_OF_EVENTS_IN_SET>\n";
      xmlFile<<"     <COMMENT_DESCRIPTION>Automatic DQM output</COMMENT_DESCRIPTION>\n";
      xmlFile<<"     <DATA_FILE_NAME>"<< xmlName <<"</DATA_FILE_NAME>\n";
      xmlFile<<"     <IMAGE_FILE_NAME>data plot url or file path</IMAGE_FILE_NAME>\n";
      xmlFile<<"     <!-- who and when created this dataset-->\n\n";
      Long_t t; t=time(0); strftime(str,30,"%F %T",localtime(&t));
      xmlFile<<"     <CREATE_TIMESTAMP>"<<str<<"</CREATE_TIMESTAMP>\n";
      xmlFile<<"     <CREATED_BY_USER>dma</CREATED_BY_USER>\n";
      xmlFile<<"     <!-- version (string) and subversion (number) -->\n";
      xmlFile<<"     <!-- fields are used to read data back from the database -->\n\n";
      xmlFile<<"     <VERSION>"<<run_number<<dataset_seq_number<<"</VERSION>\n";
      xmlFile<<"     <SUBVERSION>1</SUBVERSION>\n";
      xmlFile<<"     <!--  Assign predefined dataset attributes -->\n\n";
      xmlFile<<"     <PREDEFINED_ATTRIBUTES>\n";
      xmlFile<<"        <ATTRIBUTE>\n";
      xmlFile<<"           <NAME>HCAL Dataset Status</NAME>\n";
      xmlFile<<"           <VALUE>VALID</VALUE>\n";
      xmlFile<<"        </ATTRIBUTE>\n";
      xmlFile<<"     </PREDEFINED_ATTRIBUTES>\n";
      xmlFile<<"     <!-- multiple data block records -->\n\n";

      std::vector <HcalElectronicsId> AllElIds = emap->allElectronicsIdPrecision();
      for(std::vector <HcalElectronicsId>::iterator eid = AllElIds.begin(); eid != AllElIds.end(); eid++){
         DetId detid=emap->lookup(*eid);
         if (detid.det()!=DetId::Hcal) continue;
         HcalGenericDetId gid(emap->lookup(*eid));
         if (gid.null()) 
           continue;
         if (gid.genericSubdet()!=HcalGenericDetId::HcalGenBarrel &&
             gid.genericSubdet()!=HcalGenericDetId::HcalGenEndcap  &&
             gid.genericSubdet()!=HcalGenericDetId::HcalGenForward &&
             gid.genericSubdet()!=HcalGenericDetId::HcalGenOuter)
           continue;
         int eta,phi,depth; 
         std::string subdet="";
         HcalDetId hid(detid);
         eta=hid.ieta();
         phi=hid.iphi();
         depth=hid.depth(); 
         
         double e=0,e_rms=0,t=0,t_rms=0;
         if(detid.subdetId()==HcalBarrel){
             subdet="HB";
             Statistic=hb_data[eta+42][phi-1][depth-1].get_statistics1();
             Status   =hb_data[eta+42][phi-1][depth-1].get_status();
             hb_data[eta+42][phi-1][depth-1].get_average_amp1(&e,&e_rms);
             hb_data[eta+42][phi-1][depth-1].get_average_time1(&t,&t_rms);
         }else if(detid.subdetId()==HcalEndcap){
             subdet="HE";
             Statistic=he_data[eta+42][phi-1][depth-1].get_statistics1();
             Status   =he_data[eta+42][phi-1][depth-1].get_status();
             he_data[eta+42][phi-1][depth-1].get_average_amp1(&e,&e_rms);
             he_data[eta+42][phi-1][depth-1].get_average_time1(&t,&t_rms);
         }else if(detid.subdetId()==HcalForward){
             subdet="HF";
             Statistic=hf_data[eta+42][phi-1][depth-1].get_statistics1();
             Status   =hf_data[eta+42][phi-1][depth-1].get_status();
             hf_data[eta+42][phi-1][depth-1].get_average_amp1(&e,&e_rms);
             hf_data[eta+42][phi-1][depth-1].get_average_time1(&t,&t_rms);
         }else if(detid.subdetId()==HcalOuter){
             subdet="HO";
             Statistic=ho_data[eta+42][phi-1][depth-1].get_statistics1();
             Status   =ho_data[eta+42][phi-1][depth-1].get_status();
             ho_data[eta+42][phi-1][depth-1].get_average_amp1(&e,&e_rms);
             ho_data[eta+42][phi-1][depth-1].get_average_time1(&t,&t_rms);
         }else continue;
         xmlFile<<"       <DATA>\n";
         xmlFile<<"          <NUMBER_OF_EVENTS_USED>"<<Statistic<<"</NUMBER_OF_EVENTS_USED>\n";
         xmlFile<<"          <SIGNAL_MEAN>"<<e<<"</SIGNAL_MEAN>\n";
         xmlFile<<"          <SIGNAL_RMS>"<<e_rms<<"</SIGNAL_RMS>\n";
         xmlFile<<"          <TIME_MEAN>"<<t<<"</TIME_MEAN>\n";
         xmlFile<<"          <TIME_RMS>"<<t_rms<<"</TIME_RMS>\n";
         xmlFile<<"          <CHANNEL_STATUS_WORD>"<<Status<<"</CHANNEL_STATUS_WORD>\n";
         xmlFile<<"          <CHANNEL_OBJECTNAME>HcalDetId</CHANNEL_OBJECTNAME>\n";
         xmlFile<<"             <SUBDET>"<<subdet<<"</SUBDET>\n";
         xmlFile<<"             <IETA>"<<eta<<"</IETA>\n";
         xmlFile<<"             <IPHI>"<<phi<<"</IPHI>\n";
         xmlFile<<"             <DEPTH>"<<depth<<"</DEPTH>\n";
         xmlFile<<"             <TYPE>0</TYPE>\n";
         xmlFile<<"       </DATA>\n";
      }
      xmlFile<<"  </DATA_SET>\n";
      xmlFile<<"</ROOT>\n";
      xmlFile.close();
      sprintf(str,"zip %s.zip %s",xmlName.c_str(),xmlName.c_str());
      system(str);
      sprintf(str,"rm -f %s",xmlName.c_str());
      system(str);
      sprintf(str,"mv -f %s.zip %s",xmlName.c_str(),XmlFilePath.c_str());
      system(str);
   }
   for(int i=0;i<85;i++)for(int j=0;j<72;j++)for(int k=0;k<4;k++) hb_data[i][j][k].reset1();
   for(int i=0;i<85;i++)for(int j=0;j<72;j++)for(int k=0;k<4;k++) he_data[i][j][k].reset1();
   for(int i=0;i<85;i++)for(int j=0;j<72;j++)for(int k=0;k<4;k++) ho_data[i][j][k].reset1();
   for(int i=0;i<85;i++)for(int j=0;j<72;j++)for(int k=0;k<4;k++) hf_data[i][j][k].reset1();
   ievt_=0;
   dataset_seq_number++;
}

Member Data Documentation

std::string HcalDetDiagLaserMonitor::baseFolder_ [private]

Definition at line 234 of file HcalDetDiagLaserMonitor.cc.

Definition at line 226 of file HcalDetDiagLaserMonitor.cc.

Referenced by HcalDetDiagLaserMonitor(), and SaveReference().

Definition at line 257 of file HcalDetDiagLaserMonitor.cc.

Referenced by beginRun(), and fillHistos().

Definition at line 258 of file HcalDetDiagLaserMonitor.cc.

Referenced by beginRun(), and fillHistos().

Definition at line 264 of file HcalDetDiagLaserMonitor.cc.

Referenced by beginRun(), and fillHistos().

Definition at line 242 of file HcalDetDiagLaserMonitor.cc.

Referenced by beginRun(), and fillHistos().

Definition at line 244 of file HcalDetDiagLaserMonitor.cc.

Referenced by beginRun(), and fillHistos().

Definition at line 243 of file HcalDetDiagLaserMonitor.cc.

Referenced by beginRun(), and fillHistos().

Definition at line 245 of file HcalDetDiagLaserMonitor.cc.

Referenced by beginRun(), and fillHistos().

Definition at line 265 of file HcalDetDiagLaserMonitor.cc.

Referenced by beginRun(), and fillHistos().

Definition at line 267 of file HcalDetDiagLaserMonitor.cc.

Referenced by beginRun(), and fillHistos().

Definition at line 250 of file HcalDetDiagLaserMonitor.cc.

Referenced by beginRun(), and fillHistos().

Definition at line 252 of file HcalDetDiagLaserMonitor.cc.

Referenced by beginRun(), and fillHistos().

Definition at line 251 of file HcalDetDiagLaserMonitor.cc.

Referenced by beginRun(), and fillHistos().

Definition at line 253 of file HcalDetDiagLaserMonitor.cc.

Referenced by beginRun(), and fillHistos().

Definition at line 266 of file HcalDetDiagLaserMonitor.cc.

Referenced by beginRun(), and fillHistos().

Definition at line 246 of file HcalDetDiagLaserMonitor.cc.

Referenced by beginRun(), and fillHistos().

Definition at line 248 of file HcalDetDiagLaserMonitor.cc.

Referenced by beginRun(), and fillHistos().

Definition at line 247 of file HcalDetDiagLaserMonitor.cc.

Referenced by beginRun(), and fillHistos().

Definition at line 249 of file HcalDetDiagLaserMonitor.cc.

Referenced by beginRun(), and fillHistos().

Reimplemented from HcalBaseDQMonitor.

Definition at line 224 of file HcalDetDiagLaserMonitor.cc.

Referenced by analyze(), endRun(), HcalDetDiagLaserMonitor(), and SaveReference().

Definition at line 213 of file HcalDetDiagLaserMonitor.cc.

Referenced by analyze(), and HcalDetDiagLaserMonitor().

Definition at line 227 of file HcalDetDiagLaserMonitor.cc.

Referenced by HcalDetDiagLaserMonitor(), and LoadReference().

Definition at line 222 of file HcalDetDiagLaserMonitor.cc.

Referenced by fillProblems(), and HcalDetDiagLaserMonitor().

Definition at line 222 of file HcalDetDiagLaserMonitor.cc.

Referenced by fillProblems(), and HcalDetDiagLaserMonitor().

Definition at line 228 of file HcalDetDiagLaserMonitor.cc.

Referenced by analyze(), endRun(), and HcalDetDiagLaserMonitor().

Definition at line 240 of file HcalDetDiagLaserMonitor.cc.

Referenced by analyze(), and beginRun().

Definition at line 240 of file HcalDetDiagLaserMonitor.cc.

Referenced by analyze(), and beginRun().

Definition at line 221 of file HcalDetDiagLaserMonitor.cc.

Referenced by HcalDetDiagLaserMonitor().

Definition at line 221 of file HcalDetDiagLaserMonitor.cc.

Referenced by HcalDetDiagLaserMonitor().

Definition at line 221 of file HcalDetDiagLaserMonitor.cc.

Referenced by HcalDetDiagLaserMonitor().

Reimplemented from HcalBaseDQMonitor.

Definition at line 237 of file HcalDetDiagLaserMonitor.cc.

Referenced by analyze(), endRun(), and HcalDetDiagLaserMonitor().

Definition at line 232 of file HcalDetDiagLaserMonitor.cc.

Referenced by HcalDetDiagLaserMonitor(), and SaveReference().

Definition at line 238 of file HcalDetDiagLaserMonitor.cc.

Referenced by HcalDetDiagLaserMonitor(), and SaveReference().

std::string HcalDetDiagLaserMonitor::prefixME_ [private]

Reimplemented from HcalBaseDQMonitor.

Definition at line 235 of file HcalDetDiagLaserMonitor.cc.

Referenced by HcalDetDiagLaserMonitor().

Definition at line 272 of file HcalDetDiagLaserMonitor.cc.

Referenced by beginRun(), and fillProblems().

Definition at line 276 of file HcalDetDiagLaserMonitor.cc.

Referenced by beginRun(), and fillProblems().

Definition at line 271 of file HcalDetDiagLaserMonitor.cc.

Referenced by beginRun(), and fillProblems().

Definition at line 275 of file HcalDetDiagLaserMonitor.cc.

Referenced by beginRun(), and fillProblems().

std::vector<std::string> HcalDetDiagLaserMonitor::problemnames_ [private]

Definition at line 273 of file HcalDetDiagLaserMonitor.cc.

Referenced by beginRun().

Definition at line 269 of file HcalDetDiagLaserMonitor.cc.

Referenced by analyze(), and beginRun().

Definition at line 236 of file HcalDetDiagLaserMonitor.cc.

Referenced by analyze(), and HcalDetDiagLaserMonitor().

Definition at line 261 of file HcalDetDiagLaserMonitor.cc.

Referenced by beginRun(), and fillHistos().

Definition at line 262 of file HcalDetDiagLaserMonitor.cc.

Referenced by beginRun(), and fillHistos().

Definition at line 230 of file HcalDetDiagLaserMonitor.cc.

Referenced by HcalDetDiagLaserMonitor(), and LoadReference().

Definition at line 231 of file HcalDetDiagLaserMonitor.cc.

Referenced by beginRun(), and LoadReference().

Definition at line 241 of file HcalDetDiagLaserMonitor.cc.

Referenced by beginRun().

Definition at line 259 of file HcalDetDiagLaserMonitor.cc.

Referenced by beginRun(), and fillHistos().

Definition at line 260 of file HcalDetDiagLaserMonitor.cc.

Referenced by beginRun(), and fillHistos().

Definition at line 225 of file HcalDetDiagLaserMonitor.cc.

Referenced by analyze(), HcalDetDiagLaserMonitor(), and SaveReference().

Definition at line 255 of file HcalDetDiagLaserMonitor.cc.

Referenced by beginRun(), and fillHistos().

Definition at line 256 of file HcalDetDiagLaserMonitor.cc.

Referenced by beginRun(), and fillHistos().

std::string HcalDetDiagLaserMonitor::XmlFilePath [private]

Definition at line 233 of file HcalDetDiagLaserMonitor.cc.

Referenced by HcalDetDiagLaserMonitor(), and SaveReference().