CMS 3D CMS Logo

L1RCTRelValAnalyzer.cc

Go to the documentation of this file.
00001 // system include files
00002 #include <memory>
00003 
00004 // user include files
00005 #include "FWCore/Framework/interface/Frameworkfwd.h"
00006 #include "FWCore/Framework/interface/EDAnalyzer.h"
00007 
00008 #include "FWCore/Framework/interface/Event.h"
00009 #include "FWCore/Framework/interface/MakerMacros.h"
00010 
00011 #include "FWCore/ServiceRegistry/interface/Service.h"
00012 #include "PhysicsTools/UtilAlgos/interface/TFileService.h"
00013 
00014 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00015 
00016 #include "DataFormats/L1CaloTrigger/interface/L1CaloCollections.h"
00017 
00018 #include "L1Trigger/RegionalCaloTrigger/interface/L1RCTRelValAnalyzer.h"
00019 
00020 using std::string;
00021 using std::cout;
00022 using std::endl;
00023 
00024 //
00025 // constructors and destructor
00026 //
00027 L1RCTRelValAnalyzer::L1RCTRelValAnalyzer(const edm::ParameterSet& iConfig) :
00028   rctEmCandsLabel(iConfig.getParameter<edm::InputTag>("rctEmCandsLabel")),
00029   rctRegionsLabel(iConfig.getParameter<edm::InputTag>("rctRegionsLabel"))
00030 {
00031    //now do what ever initialization is needed
00032 
00033   edm::Service<TFileService> fs;
00034   h_emRank = fs->make<TH1F>( "emRank", "emRank", 64, 0., 64. );
00035   h_emIeta = fs->make<TH1F>( "emOccupancyIeta", "emOccupancyIeta", 22, 0., 22. );
00036   h_emIphi = fs->make<TH1F>( "emOccupancyIphi", "emOccupancyIphi", 18, 0., 18. );
00037   h_emIsoOccIetaIphi = fs->make<TH2F>( "emIsoOccupancy2D", "emIsoOccupancy2D", 22, 0., 22.,
00038                                        18, 0., 18. );
00039   h_emNonIsoOccIetaIphi = fs->make<TH2F>( "emNonIsoOccupancy2D", "emNonIsoOccupancy2D", 22, 0., 
00040                                           22., 18, 0., 18. );
00041   
00042   h_regionSum = fs->make<TH1F>( "regionSum", "regionSum", 100, 0., 100. );
00043   h_regionSumIetaIphi = fs->make<TH2F>( "regionSumEtWeighted2D", "regionSumEtWeighted2D", 22, 
00044                                           0., 22., 18, 0., 18. );
00045   h_regionOccIetaIphi = fs->make<TH2F>( "regionOccupancy2D", "regionOccupancy2D", 
00046                                         22, 0., 22., 18, 0., 18. );
00047 }
00048 
00049 
00050 L1RCTRelValAnalyzer::~L1RCTRelValAnalyzer()
00051 {
00052 
00053    // do anything here that needs to be done at destruction time
00054    // (e.g. close files, deallocate resources etc.)
00055 
00056 }
00057 
00058 
00059 //
00060 // member functions
00061 //
00062 
00063 // ------------ method called to produce the data  ------------
00064 void
00065 L1RCTRelValAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
00066 {
00067    using namespace edm;
00068 #ifdef THIS_IS_AN_EVENT_EXAMPLE
00069    Handle<ExampleData> pIn;
00070    iEvent.getByLabel("example",pIn);
00071 #endif
00072 
00073 #ifdef THIS_IS_AN_EVENTSETUP_EXAMPLE
00074    ESHandle<SetupData> pSetup;
00075    iSetup.get<SetupRecord>().get(pSetup);
00076 #endif
00077 
00078    // as in L1GctTestAnalyzer.cc
00079    Handle<L1CaloEmCollection> rctEmCands;
00080    Handle<L1CaloRegionCollection> rctRegions;
00081 
00082    L1CaloEmCollection::const_iterator em;
00083    L1CaloRegionCollection::const_iterator rgn;
00084 
00085    iEvent.getByLabel(rctEmCandsLabel, rctEmCands);
00086    iEvent.getByLabel(rctRegionsLabel, rctRegions);
00087 
00088    for (em=rctEmCands->begin(); em!=rctEmCands->end(); em++)
00089      {
00090        if ((*em).rank() > 0)
00091          {
00092            h_emRank->Fill( (*em).rank() );
00093            h_emIeta->Fill( (*em).regionId().ieta() );
00094            h_emIphi->Fill( (*em).regionId().iphi() );
00095            if ((*em).isolated())
00096              {
00097                h_emIsoOccIetaIphi->Fill( (*em).regionId().ieta(),
00098                                         (*em).regionId().iphi() );
00099              }
00100            else
00101              {
00102                h_emNonIsoOccIetaIphi->Fill( (*em).regionId().ieta(),
00103                                            (*em).regionId().iphi() );
00104              }
00105          }
00106      }
00107    
00108    for (rgn=rctRegions->begin(); rgn!=rctRegions->end(); rgn++){
00109      if ( (*rgn).et() > 0 )
00110        {
00111          h_regionSum->Fill( (*rgn).et() );
00112          h_regionSumIetaIphi->Fill( (*rgn).gctEta(), (*rgn).gctPhi(),
00113                                       (*rgn).et() );
00114          h_regionOccIetaIphi->Fill( (*rgn).gctEta(), (*rgn).gctPhi() );
00115        }
00116    }
00117 }

Generated on Tue Jun 9 17:40:19 2009 for CMSSW by  doxygen 1.5.4