CMS 3D CMS Logo

Public Member Functions | Private Attributes

CSCWireDigiValidation Class Reference

#include <CSCWireDigiValidation.h>

Inheritance diagram for CSCWireDigiValidation:
CSCBaseValidation

List of all members.

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &)
 CSCWireDigiValidation (DQMStore *dbe, const edm::InputTag &inputTag, bool doSim)
void plotResolution (const PSimHit &hit, const CSCWireDigi &digi, const CSCLayer *layer, int chamberType)
 ~CSCWireDigiValidation ()

Private Attributes

bool theDoSimFlag
MonitorElementtheNDigisPerEventPlot
MonitorElementtheNDigisPerLayerPlots [10]
MonitorElementtheResolutionPlots [10]
MonitorElementtheTimeBinPlots [10]

Detailed Description

Definition at line 9 of file CSCWireDigiValidation.h.


Constructor & Destructor Documentation

CSCWireDigiValidation::CSCWireDigiValidation ( DQMStore dbe,
const edm::InputTag inputTag,
bool  doSim 
)

Definition at line 12 of file CSCWireDigiValidation.cc.

References DQMStore::book1D(), CSCBaseValidation::dbe_, i, theNDigisPerLayerPlots, theResolutionPlots, and theTimeBinPlots.

: CSCBaseValidation(dbe, inputTag),
  theDoSimFlag(doSim),
  theTimeBinPlots(),
  theNDigisPerLayerPlots(),
  theNDigisPerEventPlot( dbe_->book1D("CSCWireDigisPerEvent", "CSC Wire Digis per event", 100, 0, 100) )
{
  for(int i = 0; i < 10; ++i)
  {
    char title1[200], title2[200], title3[200];
    sprintf(title1, "CSCWireDigiTimeType%d", i+1);
    sprintf(title2, "CSCWireDigisPerLayerType%d", i+1);
    sprintf(title3, "CSCWireDigiResolution%d", i+1);
    theTimeBinPlots[i] = dbe_->book1D(title1, title1, 9, 0, 8);
    theNDigisPerLayerPlots[i] = dbe_->book1D(title2, title2, 100, 0, 20);
    theResolutionPlots[i] = dbe_->book1D(title3, title3, 100, -10, 10);
  }
}
CSCWireDigiValidation::~CSCWireDigiValidation ( )

Definition at line 33 of file CSCWireDigiValidation.cc.

{
//   for(int i = 0; i < 10; ++i)
//   {
//     edm::LogInfo("CSCDigiValidation") << "Mean of " << theTimeBinPlots[i]->getName() 
//       << " is " << theTimeBinPlots[i]->getMean() 
//       << " +/- " << theTimeBinPlots[i]->getRMS();
//     edm::LogInfo("CSCDigiValidation") << "RMS of " << theResolutionPlots[i]->getName() 
//       << " is " << theResolutionPlots[i]->getRMS();
//   }
}

Member Function Documentation

void CSCWireDigiValidation::analyze ( const edm::Event e,
const edm::EventSetup  
) [virtual]

Implements CSCBaseValidation.

Definition at line 46 of file CSCWireDigiValidation.cc.

References CSCLayer::chamber(), CSCChamberSpecs::chamberType(), edm::InputTag::encode(), MonitorElement::Fill(), CSCBaseValidation::findLayer(), edm::Event::getByLabel(), PSimHitMap::hits(), edm::HandleBase::isValid(), j, plotResolution(), trackerHits::simHits, CSCChamber::specs(), theDoSimFlag, CSCBaseValidation::theInputTag, theNDigisPerEventPlot, theNDigisPerLayerPlots, CSCBaseValidation::theSimHitMap, and theTimeBinPlots.

Referenced by CSCDigiValidation::analyze().

{
  edm::Handle<CSCWireDigiCollection> wires;

  e.getByLabel(theInputTag, wires);
  if (!wires.isValid()) {
    edm::LogError("CSCDigiDump") << "Cannot get wires by label " << theInputTag.encode();
  }

  unsigned nDigisPerEvent = 0;

  for (CSCWireDigiCollection::DigiRangeIterator j=wires->begin(); j!=wires->end(); j++) {
    std::vector<CSCWireDigi>::const_iterator beginDigi = (*j).second.first;
    std::vector<CSCWireDigi>::const_iterator endDigi = (*j).second.second;
    int detId = (*j).first.rawId();
    
    const CSCLayer * layer = findLayer(detId);
    int chamberType = layer->chamber()->specs()->chamberType();
    int nDigis = endDigi-beginDigi;
    nDigisPerEvent += nDigis;
    theNDigisPerLayerPlots[chamberType-1]->Fill(nDigis);

    for( std::vector<CSCWireDigi>::const_iterator digiItr = beginDigi;
         digiItr != endDigi; ++digiItr) 
    {
      theTimeBinPlots[chamberType-1]->Fill(digiItr->getTimeBin());
    }

    if(theDoSimFlag) 
    {
      const edm::PSimHitContainer simHits = theSimHitMap->hits(detId);
      if(nDigis == 1 && simHits.size() == 1)
      {
        plotResolution(simHits[0], *beginDigi, layer, chamberType);
      }
    }
  }

  theNDigisPerEventPlot->Fill(nDigisPerEvent);
}
void CSCWireDigiValidation::plotResolution ( const PSimHit hit,
const CSCWireDigi digi,
const CSCLayer layer,
int  chamberType 
)

Member Data Documentation

Definition at line 22 of file CSCWireDigiValidation.h.

Referenced by analyze().

Definition at line 26 of file CSCWireDigiValidation.h.

Referenced by analyze().

Definition at line 24 of file CSCWireDigiValidation.h.

Referenced by analyze(), and CSCWireDigiValidation().

Definition at line 25 of file CSCWireDigiValidation.h.

Referenced by CSCWireDigiValidation(), and plotResolution().

Definition at line 23 of file CSCWireDigiValidation.h.

Referenced by analyze(), and CSCWireDigiValidation().