Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:30:30

0001 // system include files
0002 #include <memory>
0003 
0004 // user include files
0005 #include "CommonTools/UtilAlgos/interface/TFileService.h"
0006 #include "FWCore/Framework/interface/EDAnalyzer.h"
0007 #include "FWCore/Framework/interface/Frameworkfwd.h"
0008 
0009 #include "FWCore/Framework/interface/Event.h"
0010 #include "FWCore/Framework/interface/MakerMacros.h"
0011 
0012 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0013 #include "FWCore/ServiceRegistry/interface/Service.h"
0014 
0015 #include "DataFormats/L1CaloTrigger/interface/L1CaloCollections.h"
0016 
0017 #include "L1Trigger/RegionalCaloTrigger/interface/L1RCTRelValAnalyzer.h"
0018 
0019 using std::cout;
0020 using std::endl;
0021 using std::string;
0022 
0023 //
0024 // constructors and destructor
0025 //
0026 L1RCTRelValAnalyzer::L1RCTRelValAnalyzer(const edm::ParameterSet &iConfig)
0027     : rctEmCandsLabel(iConfig.getParameter<edm::InputTag>("rctEmCandsLabel")),
0028       rctRegionsLabel(iConfig.getParameter<edm::InputTag>("rctRegionsLabel")) {
0029   // now do what ever initialization is needed
0030 
0031   edm::Service<TFileService> fs;
0032   h_emRank = fs->make<TH1F>("emRank", "emRank", 64, 0., 64.);
0033   h_emIeta = fs->make<TH1F>("emOccupancyIeta", "emOccupancyIeta", 22, 0., 22.);
0034   h_emIphi = fs->make<TH1F>("emOccupancyIphi", "emOccupancyIphi", 18, 0., 18.);
0035   h_emIsoOccIetaIphi = fs->make<TH2F>("emIsoOccupancy2D", "emIsoOccupancy2D", 22, 0., 22., 18, 0., 18.);
0036   h_emNonIsoOccIetaIphi = fs->make<TH2F>("emNonIsoOccupancy2D", "emNonIsoOccupancy2D", 22, 0., 22., 18, 0., 18.);
0037 
0038   h_regionSum = fs->make<TH1F>("regionSum", "regionSum", 100, 0., 100.);
0039   h_regionSumIetaIphi = fs->make<TH2F>("regionSumEtWeighted2D", "regionSumEtWeighted2D", 22, 0., 22., 18, 0., 18.);
0040   h_regionOccIetaIphi = fs->make<TH2F>("regionOccupancy2D", "regionOccupancy2D", 22, 0., 22., 18, 0., 18.);
0041 }
0042 
0043 L1RCTRelValAnalyzer::~L1RCTRelValAnalyzer() {
0044   // do anything here that needs to be done at destruction time
0045   // (e.g. close files, deallocate resources etc.)
0046 }
0047 
0048 //
0049 // member functions
0050 //
0051 
0052 // ------------ method called to produce the data  ------------
0053 void L1RCTRelValAnalyzer::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) {
0054   using namespace edm;
0055 #ifdef THIS_IS_AN_EVENT_EXAMPLE
0056   Handle<ExampleData> pIn;
0057   iEvent.getByLabel("example", pIn);
0058 #endif
0059 
0060 #ifdef THIS_IS_AN_EVENTSETUP_EXAMPLE
0061   ESHandle<SetupData> pSetup;
0062   iSetup.get<SetupRecord>().get(pSetup);
0063 #endif
0064 
0065   // as in L1GctTestAnalyzer.cc
0066   Handle<L1CaloEmCollection> rctEmCands;
0067   Handle<L1CaloRegionCollection> rctRegions;
0068 
0069   L1CaloEmCollection::const_iterator em;
0070   L1CaloRegionCollection::const_iterator rgn;
0071 
0072   iEvent.getByLabel(rctEmCandsLabel, rctEmCands);
0073   iEvent.getByLabel(rctRegionsLabel, rctRegions);
0074 
0075   for (em = rctEmCands->begin(); em != rctEmCands->end(); em++) {
0076     if ((*em).rank() > 0) {
0077       h_emRank->Fill((*em).rank());
0078       h_emIeta->Fill((*em).regionId().ieta());
0079       h_emIphi->Fill((*em).regionId().iphi());
0080       if ((*em).isolated()) {
0081         h_emIsoOccIetaIphi->Fill((*em).regionId().ieta(), (*em).regionId().iphi());
0082       } else {
0083         h_emNonIsoOccIetaIphi->Fill((*em).regionId().ieta(), (*em).regionId().iphi());
0084       }
0085     }
0086   }
0087 
0088   for (rgn = rctRegions->begin(); rgn != rctRegions->end(); rgn++) {
0089     if ((*rgn).et() > 0) {
0090       h_regionSum->Fill((*rgn).et());
0091       h_regionSumIetaIphi->Fill((*rgn).gctEta(), (*rgn).gctPhi(), (*rgn).et());
0092       h_regionOccIetaIphi->Fill((*rgn).gctEta(), (*rgn).gctPhi());
0093     }
0094   }
0095 }