CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

SiStripPlotGain Class Reference

#include <DQM/SiStripMonitorSummary/plugins/SiStripPlotGain.cc>

Inheritance diagram for SiStripPlotGain:
edm::EDAnalyzer

List of all members.

Public Member Functions

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

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginRun (const edm::Run &run, const edm::EventSetup &es)
void DoAnalysis (const SiStripApvGain &)
virtual void endJob ()
unsigned long long getCache (const edm::EventSetup &eSetup)
TH1F * getHisto (const long unsigned int &index)
 Returns the histogram contained by the Monitor Element.
void getHistos (const uint32_t &detid, std::vector< TH1F * > &histos)

Private Attributes

unsigned long long cacheID
TFile * file
SiStripDetInfoFileReaderfr
edm::ESHandle< SiStripApvGainHandle_
TrackerMaptkmap
std::vector< TH1F * > vTH1

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 49 of file SiStripPlotGain.h.


Constructor & Destructor Documentation

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

Definition at line 10 of file SiStripPlotGain.cc.

References file, fr, cmsCodeRules::cppFunctionSkipper::operator, and tkmap.

                                                              :
  cacheID(0xFFFFFFFF)
{
  //now do what ever initialization is needed
  if(!edm::Service<SiStripDetInfoFileReader>().isAvailable()){
    edm::LogError("TkLayerMap") << 
      "\n------------------------------------------"
      "\nUnAvailable Service SiStripDetInfoFileReader: please insert in the configuration file an instance like"
      "\n\tprocess.SiStripDetInfoFileReader = cms.Service(\"SiStripDetInfoFileReader\")"
      "\n------------------------------------------";
  }
 
  fr=edm::Service<SiStripDetInfoFileReader>().operator->();
  file = new TFile("correlTest.root","RECREATE");
  tkmap = new TrackerMap();
}
SiStripPlotGain::~SiStripPlotGain ( )

Definition at line 28 of file SiStripPlotGain.cc.

{}

Member Function Documentation

virtual void SiStripPlotGain::analyze ( const edm::Event ,
const edm::EventSetup  
) [inline, private, virtual]

Implements edm::EDAnalyzer.

Definition at line 57 of file SiStripPlotGain.h.

{};
void SiStripPlotGain::beginRun ( const edm::Run run,
const edm::EventSetup es 
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 34 of file SiStripPlotGain.cc.

References cacheID, DoAnalysis(), edm::EventSetup::get(), getCache(), Handle_, and edm::ESHandle< T >::product().

                                                                   {

  if(getCache(es)==cacheID )
    return;
  cacheID=getCache(es);  
  
  edm::LogInfo("") << "[SiStripPlotGain::beginRun] cacheID " << cacheID << std::endl; 
  
  es.get<SiStripApvGainRcd>().get(Handle_);
  DoAnalysis(*Handle_.product());


}
void SiStripPlotGain::DoAnalysis ( const SiStripApvGain gain) [private]

Definition at line 49 of file SiStripPlotGain.cc.

References SiStripApvGain::RegistryPointers::detid_begin, SiStripApvGain::RegistryPointers::detid_end, HcalObjRepresent::Fill(), TrackerMap::fill(), SiStripApvGain::getApvGain(), SiStripApvGain::RegistryPointers::getFirstElement(), getHistos(), SiStripApvGain::RegistryPointers::getLastElement(), SiStripApvGain::getRegistryPointers(), mergeVDriftHistosByStation::histos, i, AlCaHLTBitMon_ParallelJobs::p, tkmap, and relativeConstraints::value.

Referenced by beginRun().

                                                     {

  edm::LogInfo("") << "[Doanalysis]";

  std::vector<TH1F *>histos;

  SiStripApvGain::RegistryPointers p=gain.getRegistryPointers();
  SiStripApvGain::RegistryConstIterator iter, iterE;
  iter=p.detid_begin;
  iterE=p.detid_end;

  float value;

  //Divide result by d
  for(;iter!=iterE;++iter){
    getHistos(*iter,histos);
    SiStripApvGain::Range range=SiStripApvGain::Range(p.getFirstElement(iter),p.getLastElement(iter));

    edm::LogInfo("") << "[Doanalysis] detid " << *iter << " range " << range.second-range.first;
    size_t apv=0, apvE= (range.second-range.first);
    for (;apv<apvE;apv+=2){       
      value=gain.getApvGain(apv,range);
      tkmap->fill(*iter,value);
      for(size_t i=0;i<histos.size();++i)
        histos[i]->Fill(value);
    }
    
  }
}
void SiStripPlotGain::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 125 of file SiStripPlotGain.cc.

References file, i, TrackerMap::save(), tkmap, and vTH1.

                        {
  for(size_t i=0;i<vTH1.size();i++)
    if(vTH1[i]!=0)
      vTH1[i]->Write();

  file->Write();
  file->Close();

  tkmap->save(false,0,0,"testTkMap.png");

}
unsigned long long SiStripPlotGain::getCache ( const edm::EventSetup eSetup) [inline, private]

Definition at line 64 of file SiStripPlotGain.h.

References edm::EventSetup::get().

Referenced by beginRun().

{ return eSetup.get<SiStripApvGainRcd>().cacheIdentifier();}
TH1F * SiStripPlotGain::getHisto ( const long unsigned int &  index) [private]

Returns the histogram contained by the Monitor Element.

Parameters:
meMonitor Element
clone(boolean) if true clone the histogram
retin case of clonation delete the histogram first
debugdump out debugging info

Definition at line 110 of file SiStripPlotGain.cc.

References getHLTprescales::index, mergeVDriftHistosByStation::name, and vTH1.

Referenced by getHistos().

                                                       {
  if(vTH1.size()<index+1)
    vTH1.resize(index+1,0);
  
  if(vTH1[index]==0){
    char name[128];
    sprintf(name,"%lu",index);
    edm::LogInfo("")<<"[getHisto] creating index " << index << std::endl;
    vTH1[index]=new TH1F(name,name,150,0.,5.);
  }
  
  return vTH1[index];
}
void SiStripPlotGain::getHistos ( const uint32_t &  detid,
std::vector< TH1F * > &  histos 
) [private]

Definition at line 81 of file SiStripPlotGain.cc.

References a, getHisto(), getHLTprescales::index, TIBDetId::layer(), TOBDetId::layer(), TIDDetId::side(), TECDetId::side(), DetId::subdetId(), TIDDetId::wheel(), and TECDetId::wheel().

Referenced by DoAnalysis().

                                                                        {
  
  histos.clear();
  
  int subdet=-999; int component=-999;
  SiStripDetId a(detid);
  if ( a.subdetId() == 3 ){
    subdet=0;
    component=TIBDetId(detid).layer();
  } else if ( a.subdetId() == 4 ) {
    subdet=1;
    component=TIDDetId(detid).side()==2?TIDDetId(detid).wheel():TIDDetId(detid).wheel()+3;
  } else if ( a.subdetId() == 5 ) {
    subdet=2;
    component=TOBDetId(detid).layer();
  } else if ( a.subdetId() == 6 ) {
    subdet=3;
    component=TECDetId(detid).side()==2?TECDetId(detid).wheel():TECDetId(detid).wheel()+9;
  } 
  
  int index=100+subdet*100+component;


  histos.push_back(getHisto(subdet+1));
  histos.push_back(getHisto(index));
  
}

Member Data Documentation

unsigned long long SiStripPlotGain::cacheID [private]

Definition at line 81 of file SiStripPlotGain.h.

Referenced by beginRun().

TFile* SiStripPlotGain::file [private]

Definition at line 75 of file SiStripPlotGain.h.

Referenced by endJob(), and SiStripPlotGain().

Definition at line 70 of file SiStripPlotGain.h.

Referenced by SiStripPlotGain().

Definition at line 72 of file SiStripPlotGain.h.

Referenced by beginRun().

Definition at line 78 of file SiStripPlotGain.h.

Referenced by DoAnalysis(), endJob(), and SiStripPlotGain().

std::vector<TH1F*> SiStripPlotGain::vTH1 [private]

Definition at line 76 of file SiStripPlotGain.h.

Referenced by endJob(), and getHisto().