00001 #include "Validation/MuonCSCDigis/src/CSCDigiValidation.h"
00002 #include "FWCore/ServiceRegistry/interface/Service.h"
00003 #include "Geometry/CSCGeometry/interface/CSCGeometry.h"
00004 #include "Geometry/Records/interface/MuonGeometryRecord.h"
00005 #include "Validation/MuonCSCDigis/src/CSCStripDigiValidation.h"
00006 #include "Validation/MuonCSCDigis/src/CSCWireDigiValidation.h"
00007 #include "Validation/MuonCSCDigis/src/CSCComparatorDigiValidation.h"
00008
00009
00010 #include <iostream>
00011 #include "DQMServices/Core/interface/DQMStore.h"
00012
00013 CSCDigiValidation::CSCDigiValidation(const edm::ParameterSet & ps)
00014 : dbe_( edm::Service<DQMStore>().operator->() ),
00015 outputFile_( ps.getParameter<std::string>("outputFile") ),
00016 theSimHitMap(ps.getParameter<edm::InputTag>("simHitsTag")),
00017 theCSCGeometry(0),
00018 theStripDigiValidation(0),
00019 theWireDigiValidation(0),
00020 theComparatorDigiValidation(0)
00021 {
00022 dbe_->setCurrentFolder("MuonCSCDigisV/CSCDigiTask");
00023 bool doSim = ps.getParameter<bool>("doSim");
00024
00025 theStripDigiValidation = new CSCStripDigiValidation(dbe_, ps.getParameter<edm::InputTag>("stripDigiTag"), doSim);
00026 theWireDigiValidation = new CSCWireDigiValidation(dbe_, ps.getParameter<edm::InputTag>("wireDigiTag"), doSim);
00027 theComparatorDigiValidation = new CSCComparatorDigiValidation(dbe_,
00028 ps.getParameter<edm::InputTag>("comparatorDigiTag"),
00029 ps.getParameter<edm::InputTag>("stripDigiTag"));
00030
00031
00032 if(doSim)
00033 {
00034 theStripDigiValidation->setSimHitMap(&theSimHitMap);
00035 theWireDigiValidation->setSimHitMap(&theSimHitMap);
00036 theComparatorDigiValidation->setSimHitMap(&theSimHitMap);
00037 }
00038
00039 }
00040
00041
00042 CSCDigiValidation::~CSCDigiValidation()
00043 {
00044 if ( outputFile_.size() != 0 && dbe_ ) dbe_->save(outputFile_);
00045 delete theStripDigiValidation;
00046 delete theWireDigiValidation;
00047 delete theComparatorDigiValidation;
00048 }
00049
00050
00051 void CSCDigiValidation::endJob() {
00052 if ( outputFile_.size() != 0 && dbe_ ) dbe_->save(outputFile_);
00053 }
00054
00055
00056 void CSCDigiValidation::analyze(const edm::Event&e, const edm::EventSetup& eventSetup)
00057 {
00058 theSimHitMap.fill(e);
00059
00060
00061 edm::ESHandle<CSCGeometry> hGeom;
00062 eventSetup.get<MuonGeometryRecord>().get( hGeom );
00063 const CSCGeometry *pGeom = &*hGeom;
00064
00065 theStripDigiValidation->setGeometry( pGeom );
00066 theWireDigiValidation->setGeometry( pGeom );
00067 theComparatorDigiValidation->setGeometry( pGeom );
00068
00069 theStripDigiValidation->analyze(e,eventSetup);
00070 theWireDigiValidation->analyze(e,eventSetup);
00071 theComparatorDigiValidation->analyze(e,eventSetup);
00072 }
00073
00074
00075