CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

MultiplicityTimeCorrelations Class Reference

#include <DPGAnalysis/SiStripTools/src/MultiplicityTimeCorrelations.cc>

Inheritance diagram for MultiplicityTimeCorrelations:
edm::EDAnalyzer

List of all members.

Public Member Functions

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

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob ()
virtual void beginRun (const edm::Run &, const edm::EventSetup &)
virtual void endJob ()
virtual void endRun (const edm::Run &, const edm::EventSetup &)

Private Attributes

edm::InputTag _apvphasecoll
std::map< unsigned int, int > _binmax
std::vector< int > _dbxbins
std::map< int, std::map
< unsigned int, TH1F * > > 
_dbxhistos
DigiBXCorrHistogramMaker
< EventWithHistory
_digibxcorrhmevent
EventWithHistoryFilter _evfilter
edm::InputTag _hecollection
int _highorbit
int _loworbit
int _mindbx
int _mintrpltdbx
edm::InputTag _multiplicityMap
std::map< unsigned int,
std::string > 
_subdets
SiStripTKNumbers _trnumb

Detailed Description

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

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

Definition at line 61 of file MultiplicityTimeCorrelations.cc.


Constructor & Destructor Documentation

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

Definition at line 117 of file MultiplicityTimeCorrelations.cc.

References _binmax, _dbxbins, _dbxhistos, _digibxcorrhmevent, _evfilter, _hecollection, _mindbx, _mintrpltdbx, _subdets, _trnumb, edm::ParameterSet::addUntrackedParameter(), newFWLiteAna::bin, DigiBXCorrHistogramMaker< T >::book(), edm::ParameterSet::getUntrackedParameter(), reco_calib_source_client_cfg::labels, LogDebug, TFileDirectory::make(), SiStripTKNumbers::nstrips(), and EventWithHistoryFilter::set().

                                                                                        :
  _digibxcorrhmevent(iConfig),
  _evfilter(),
  _hecollection(iConfig.getParameter<edm::InputTag>("historyProduct")),
  _apvphasecoll(iConfig.getParameter<edm::InputTag>("apvPhaseCollection")),
  _multiplicityMap(iConfig.getParameter<edm::InputTag>("multiplicityMap")),
  _subdets(),
  _binmax(),
  _loworbit(iConfig.getUntrackedParameter<int>("lowedgeOrbit")),
  _highorbit(iConfig.getUntrackedParameter<int>("highedgeOrbit")),
  _mindbx(iConfig.getUntrackedParameter<int>("minDBX")),
  _mintrpltdbx(iConfig.getUntrackedParameter<int>("minTripletDBX")),
  _trnumb(),
  _dbxbins(iConfig.getUntrackedParameter<std::vector<int> >("dbxBins"))
{
   //now do what ever initialization is needed

  // configure the filter

  edm::ParameterSet filterConfig;
  filterConfig.addUntrackedParameter<edm::InputTag>("historyProduct",_hecollection);
  if(_mindbx>0) {
    std::vector<int> dbxrange;
    dbxrange.push_back(_mindbx+1);
    dbxrange.push_back(-1);
    filterConfig.addUntrackedParameter<std::vector<int> >("dbxRange",dbxrange);
  }
  if(_mintrpltdbx>0) {
    std::vector<int> dbxtrpltrange;
    dbxtrpltrange.push_back(_mintrpltdbx+1);
    dbxtrpltrange.push_back(-1);
    filterConfig.addUntrackedParameter<std::vector<int> >("dbxTripletRange",dbxtrpltrange);
  }

  _evfilter.set(filterConfig);

  //

  edm::Service<TFileService> tfserv;

  // create map of labels

  std::vector<edm::ParameterSet> wantedsubds(iConfig.getUntrackedParameter<std::vector<edm::ParameterSet> >("wantedSubDets"));
                                             
  for(std::vector<edm::ParameterSet>::iterator ps=wantedsubds.begin();ps!=wantedsubds.end();++ps) {
    _subdets[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<std::string>("detLabel");
    _binmax[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<int>("binMax");
  }
  std::map<int,std::string> labels;

  for(std::map<unsigned int,std::string>::const_iterator subd=_subdets.begin();subd!=_subdets.end();++subd) {
    labels[int(subd->first)] = subd->second;
  }

  //

  _digibxcorrhmevent.book("EventProcs",labels);

  TFileDirectory subdbxbin = tfserv->mkdir("DBXDebugging");

  for(std::vector<int>::const_iterator bin=_dbxbins.begin();bin!=_dbxbins.end();bin++) {
    char hname[200]; char htitle[200];

    edm::LogInfo("DBXHistosBinMaxValue") << "Setting bin max values";

    for(std::map<unsigned int, std::string>::const_iterator subd=_subdets.begin();subd!=_subdets.end();++subd) {
      if(_binmax.find(subd->first)==_binmax.end()) {
        edm::LogVerbatim("DBXHistosNotConfiguredBinMax") << "Bin max for " << subd->second 
                                                     << " not configured: " << _trnumb.nstrips(int(subd->first)) << " used";
        _binmax[subd->first] = _trnumb.nstrips(int(subd->first));
      }
 
      edm::LogVerbatim("DBXHistosBinMaxValue") << "Bin max for " << subd->second << " is " << _binmax[subd->first];



      sprintf(hname,"sumn%sdigi_%d",subd->second.c_str(),*bin);
      sprintf(htitle,"%s digi multiplicity at DBX = %d",subd->second.c_str(),*bin);
      LogDebug("DBXDebug") << "creating histogram " << hname << " " << htitle;
      _dbxhistos[*bin][subd->first]= subdbxbin.make<TH1F>(hname,htitle,1000,0.,_binmax[subd->first]/(20*1000)*1000);
      _dbxhistos[*bin][subd->first]->GetXaxis()->SetTitle("Number of Digis");
    }
    /*
    sprintf(hname,"sumntkdigi_%d",*bin);
    sprintf(htitle,"TK digi multiplicity at DBX = %d",*bin);
    LogDebug("DBXDebug") << "creating histogram " << hname << " " << htitle;
    _dbxtkhistos[*bin]= subdbxbin.make<TH1F>(hname,htitle,1000,0.,_trnumb.nstrips(0)/(20*1000)*1000);
    _dbxtkhistos[*bin]->GetXaxis()->SetTitle("Number of Digis");

    sprintf(hname,"sumntibdigi_%d",*bin);
    sprintf(htitle,"TIB digi multiplicity at DBX = %d",*bin);
    LogDebug("DBXDebug") << "creating histogram " << hname << " " << htitle;
    _dbxtibhistos[*bin]= subdbxbin.make<TH1F>(hname,htitle,1000,0.,_trnumb.nstrips(SiStripDetId::TIB)/(20*1000)*1000);
    _dbxtibhistos[*bin]->GetXaxis()->SetTitle("Number of Digis");

    sprintf(hname,"sumntiddigi_%d",*bin);
    sprintf(htitle,"TID digi multiplicity at DBX = %d",*bin);
    LogDebug("DBXDebug") << "creating histogram " << hname << " " << htitle;
    _dbxtidhistos[*bin]= subdbxbin.make<TH1F>(hname,htitle,1000,0.,_trnumb.nstrips(SiStripDetId::TID)/(20*1000)*1000);
    _dbxtidhistos[*bin]->GetXaxis()->SetTitle("Number of Digis");

    sprintf(hname,"sumntobdigi_%d",*bin);
    sprintf(htitle,"TOB digi multiplicity at DBX = %d",*bin);
    LogDebug("DBXDebug") << "creating histogram " << hname << " " << htitle;
    _dbxtobhistos[*bin]= subdbxbin.make<TH1F>(hname,htitle,1000,0.,_trnumb.nstrips(SiStripDetId::TOB)/(20*1000)*1000);
    _dbxtobhistos[*bin]->GetXaxis()->SetTitle("Number of Digis");

    sprintf(hname,"sumntecdigi_%d",*bin);
    sprintf(htitle,"TEC digi multiplicity at DBX = %d",*bin);
    LogDebug("DBXDebug") << "creating histogram " << hname << " " << htitle;
    _dbxtechistos[*bin]= subdbxbin.make<TH1F>(hname,htitle,1000,0.,_trnumb.nstrips(SiStripDetId::TEC)/(20*1000)*1000);
    _dbxtechistos[*bin]->GetXaxis()->SetTitle("Number of Digis");
    */
  }

}
MultiplicityTimeCorrelations::~MultiplicityTimeCorrelations ( )

Definition at line 235 of file MultiplicityTimeCorrelations.cc.

{
 
   // do anything here that needs to be done at desctruction time
   // (e.g. close files, deallocate resources etc.)

}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 250 of file MultiplicityTimeCorrelations.cc.

References _apvphasecoll, _dbxhistos, _digibxcorrhmevent, _evfilter, _hecollection, _highorbit, _loworbit, _multiplicityMap, _subdets, DigiBXCorrHistogramMaker< T >::fill(), edm::Event::getByLabel(), VarParsing::mult, edm::EventBase::orbitNumber(), and EventWithHistoryFilter::selected().

{
  using namespace edm;
  
  // get Phase

  Handle<APVCyclePhaseCollection> apvphase;
  iEvent.getByLabel(_apvphasecoll,apvphase);

  // get HE

  Handle<EventWithHistory> he;
  iEvent.getByLabel(_hecollection,he);

  // check if the event is selected

  if((_loworbit < 0 || iEvent.orbitNumber() >= _loworbit) && 
     (_highorbit < 0 || iEvent.orbitNumber() <= _highorbit)) {

    if(_evfilter.selected(iEvent,iSetup)) {
      
      
      //Compute digi multiplicity
      /*      
      int ntkdigi=0;
      int ntibdigi=0;
      int ntiddigi=0;
      int ntobdigi=0;
      int ntecdigi=0;
      */
      Handle<std::map<unsigned int, int> > mults;
      iEvent.getByLabel(_multiplicityMap,mults);

      // create map of digi multiplicity
      
      std::map<int,int> digimap;
      for(std::map<unsigned int, int>::const_iterator mult=mults->begin();mult!=mults->end();++mult) {
        if(_subdets.find(mult->first)!=_subdets.end()) digimap[int(mult->first)] = mult->second;
      }
      
      _digibxcorrhmevent.fill(*he,digimap,apvphase);
      
      // fill debug histos

      if(he->depth()!=0) {

        long long dbx = he->deltaBX();
            
        if(_dbxhistos.find(dbx)!=_dbxhistos.end()) {
          for(std::map<unsigned int,int>::const_iterator ndigi=mults->begin();ndigi!=mults->end();++ndigi) {
          _dbxhistos[dbx][ndigi->first]->Fill(ndigi->second);
          }
        }
        if(_dbxhistos.find(-1)!=_dbxhistos.end()) {
          for(std::map<unsigned int,int>::const_iterator ndigi=mults->begin();ndigi!=mults->end();++ndigi) {
          _dbxhistos[-1][ndigi->first]->Fill(ndigi->second);
          }
        }
        /*
        if(_dbxtkhistos.find(dbx)!=_dbxtkhistos.end()) {
          _dbxtkhistos[dbx]->Fill(ntkdigi);
        }
        if(_dbxtkhistos.find(-1)!=_dbxtkhistos.end()) {
          _dbxtkhistos[-1]->Fill(ntkdigi);
        }
        
        if(_dbxtibhistos.find(dbx)!=_dbxtibhistos.end()) {
          _dbxtibhistos[dbx]->Fill(ntibdigi);
        }
        if(_dbxtibhistos.find(-1)!=_dbxtibhistos.end()) {
          _dbxtibhistos[-1]->Fill(ntibdigi);
        }
        
        if(_dbxtidhistos.find(dbx)!=_dbxtidhistos.end()) {
          _dbxtidhistos[dbx]->Fill(ntiddigi);
        }
        if(_dbxtidhistos.find(-1)!=_dbxtidhistos.end()) {
          _dbxtidhistos[-1]->Fill(ntiddigi);
        }
        if(_dbxtobhistos.find(dbx)!=_dbxtobhistos.end()) {
          _dbxtobhistos[dbx]->Fill(ntobdigi);
        }
        if(_dbxtobhistos.find(-1)!=_dbxtobhistos.end()) {
          _dbxtobhistos[-1]->Fill(ntobdigi);
        }
        if(_dbxtechistos.find(dbx)!=_dbxtechistos.end()) {
          _dbxtechistos[dbx]->Fill(ntecdigi);
        }
        if(_dbxtechistos.find(-1)!=_dbxtechistos.end()) {
          _dbxtechistos[-1]->Fill(ntecdigi);
        }
        */      
      }
    }
  }
}
void MultiplicityTimeCorrelations::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 350 of file MultiplicityTimeCorrelations.cc.

References _highorbit, _loworbit, and LogDebug.

{

  LogDebug("IntegerDebug") << " int max and min " << INT_MIN << " " << INT_MAX;
  LogDebug("IntegerDebug") << " uint max and min " << UINT_MAX;
  LogDebug("IntegerDebug") << " long max and min " << LONG_MIN << " " << LONG_MAX;
  LogDebug("IntegerDebug") << " ulong max and min " << ULONG_MAX;
  LogDebug("IntegerDebug") << " long long max and min " << LLONG_MIN << " " << LLONG_MAX;
  LogDebug("IntegerDebug") << " u long long max and min " << ULLONG_MAX;


  edm::LogInfo("MultiplicityTimeCorrelations") << " Correlation studies performed only in the orbit # range " << _loworbit << " " << _highorbit ;

}
void MultiplicityTimeCorrelations::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
) [private, virtual]
void MultiplicityTimeCorrelations::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 377 of file MultiplicityTimeCorrelations.cc.

                                     {
}
void MultiplicityTimeCorrelations::endRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 373 of file MultiplicityTimeCorrelations.cc.

                                                                                    {
}

Member Data Documentation

Definition at line 89 of file MultiplicityTimeCorrelations.cc.

Referenced by analyze().

std::map<unsigned int, int> MultiplicityTimeCorrelations::_binmax [private]

Definition at line 92 of file MultiplicityTimeCorrelations.cc.

Referenced by MultiplicityTimeCorrelations().

std::vector<int> MultiplicityTimeCorrelations::_dbxbins [private]

Definition at line 102 of file MultiplicityTimeCorrelations.cc.

Referenced by MultiplicityTimeCorrelations().

std::map<int,std::map<unsigned int,TH1F*> > MultiplicityTimeCorrelations::_dbxhistos [private]

Definition at line 79 of file MultiplicityTimeCorrelations.cc.

Referenced by analyze(), and MultiplicityTimeCorrelations().

Definition at line 76 of file MultiplicityTimeCorrelations.cc.

Referenced by analyze(), beginRun(), and MultiplicityTimeCorrelations().

Definition at line 77 of file MultiplicityTimeCorrelations.cc.

Referenced by analyze(), and MultiplicityTimeCorrelations().

Definition at line 88 of file MultiplicityTimeCorrelations.cc.

Referenced by analyze(), and MultiplicityTimeCorrelations().

Definition at line 95 of file MultiplicityTimeCorrelations.cc.

Referenced by analyze(), and beginJob().

Definition at line 94 of file MultiplicityTimeCorrelations.cc.

Referenced by analyze(), and beginJob().

Definition at line 97 of file MultiplicityTimeCorrelations.cc.

Referenced by MultiplicityTimeCorrelations().

Definition at line 98 of file MultiplicityTimeCorrelations.cc.

Referenced by MultiplicityTimeCorrelations().

Definition at line 90 of file MultiplicityTimeCorrelations.cc.

Referenced by analyze().

std::map<unsigned int, std::string> MultiplicityTimeCorrelations::_subdets [private]

Definition at line 91 of file MultiplicityTimeCorrelations.cc.

Referenced by analyze(), and MultiplicityTimeCorrelations().

Definition at line 100 of file MultiplicityTimeCorrelations.cc.

Referenced by MultiplicityTimeCorrelations().