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 edm::EDConsumerBase

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 edm::EventSetup &es, 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, const TrackerTopology *tTopo, 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 50 of file SiStripPlotGain.h.


Constructor & Destructor Documentation

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

Definition at line 8 of file SiStripPlotGain.cc.

References file, fr, 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 26 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 58 of file SiStripPlotGain.h.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 32 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(es, *Handle_.product());


}
void SiStripPlotGain::DoAnalysis ( const edm::EventSetup es,
const SiStripApvGain gain 
) [private]

Definition at line 47 of file SiStripPlotGain.cc.

References SiStripApvGain::RegistryPointers::detid_begin, SiStripApvGain::RegistryPointers::detid_end, HcalObjRepresent::Fill(), TrackerMap::fill(), edm::EventSetup::get(), SiStripApvGain::getApvGain(), SiStripApvGain::RegistryPointers::getFirstElement(), getHistos(), SiStripApvGain::RegistryPointers::getLastElement(), SiStripApvGain::getRegistryPointers(), mergeVDriftHistosByStation::histos, i, AlCaHLTBitMon_ParallelJobs::p, edm::ESHandle< T >::product(), tkmap, and relativeConstraints::value.

Referenced by beginRun().

                                                                              {

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

  //Retrieve tracker topology from geometry
  edm::ESHandle<TrackerTopology> tTopoHandle;
  es.get<IdealGeometryRecord>().get(tTopoHandle);
  const TrackerTopology* const tTopo = tTopoHandle.product();

  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,tTopo,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 128 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 65 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 113 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,
const TrackerTopology tTopo,
std::vector< TH1F * > &  histos 
) [private]

Definition at line 84 of file SiStripPlotGain.cc.

References a, getHisto(), getHLTprescales::index, DetId::subdetId(), TrackerTopology::tecSide(), TrackerTopology::tecWheel(), TrackerTopology::tibLayer(), TrackerTopology::tidSide(), TrackerTopology::tidWheel(), and TrackerTopology::tobLayer().

Referenced by DoAnalysis().

                                                                                                       {
  
  histos.clear();
  
  int subdet=-999; int component=-999;
  SiStripDetId a(detid);
  if ( a.subdetId() == 3 ){
    subdet=0;
    component=tTopo->tibLayer(detid);
  } else if ( a.subdetId() == 4 ) {
    subdet=1;
    component=tTopo->tidSide(detid)==2?tTopo->tidWheel(detid):tTopo->tidWheel(detid)+3;
  } else if ( a.subdetId() == 5 ) {
    subdet=2;
    component=tTopo->tobLayer(detid);
  } else if ( a.subdetId() == 6 ) {
    subdet=3;
    component=tTopo->tecSide(detid)==2?tTopo->tecWheel(detid):tTopo->tecWheel(detid)+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 82 of file SiStripPlotGain.h.

Referenced by beginRun().

TFile* SiStripPlotGain::file [private]

Definition at line 76 of file SiStripPlotGain.h.

Referenced by endJob(), and SiStripPlotGain().

Definition at line 71 of file SiStripPlotGain.h.

Referenced by SiStripPlotGain().

Definition at line 73 of file SiStripPlotGain.h.

Referenced by beginRun().

Definition at line 79 of file SiStripPlotGain.h.

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

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

Definition at line 77 of file SiStripPlotGain.h.

Referenced by endJob(), and getHisto().