CMS 3D CMS Logo

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