CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch1/src/DPGAnalysis/Skims/src/SelectHFMinBias.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:   BeamSplash
00004 // Class:     BeamSPlash
00005 //
00006 //
00007 // Original Author:  Luca Malgeri
00008 
00009 #include <memory>
00010 #include <vector>
00011 #include <map>
00012 #include <set>
00013 
00014 // user include files
00015 
00016 #include "FWCore/Utilities/interface/InputTag.h"
00017 #include "FWCore/Framework/interface/Frameworkfwd.h"
00018 #include "FWCore/Framework/interface/EDFilter.h"
00019 #include "FWCore/Framework/interface/Event.h"
00020 #include "FWCore/Framework/interface/MakerMacros.h"
00021 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00022 #include "FWCore/Framework/interface/ESHandle.h"
00023 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00024 
00025 #include "DPGAnalysis/Skims/interface/SelectHFMinBias.h"
00026 #include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
00027 #include "DataFormats/CaloTowers/interface/CaloTowerCollection.h"
00028 
00029 using namespace edm;
00030 using namespace std;
00031 
00032 SelectHFMinBias::SelectHFMinBias(const edm::ParameterSet& iConfig)
00033 {
00034 }
00035 
00036 SelectHFMinBias::~SelectHFMinBias()
00037 {
00038 }
00039 
00040 bool SelectHFMinBias::filter( edm::Event& iEvent, const edm::EventSetup& iSetup)
00041 {
00042 
00043 edm::Handle<CaloTowerCollection> towers;
00044 iEvent.getByLabel("towerMaker",towers);
00045 
00046 
00047 int negTowers = 0;
00048 int posTowers = 0;
00049 for(CaloTowerCollection::const_iterator cal = towers->begin(); cal != towers->end(); ++cal) {
00050    for(unsigned int i = 0; i < cal->constituentsSize(); i++) {
00051       const DetId id = cal->constituent(i);
00052       if(id.det() == DetId::Hcal) {
00053         HcalSubdetector subdet=(HcalSubdetector(id.subdetId()));
00054         if(subdet == HcalForward) {
00055           if(cal->energy()>3. && cal->eta()<-3.)
00056             negTowers++;
00057           if(cal->energy()>3. && cal->eta()>3.)
00058             posTowers++;
00059         }
00060      }
00061    }
00062 }
00063 if(negTowers>0 && posTowers>0)
00064   return true;
00065 
00066   return false;
00067 
00068 }
00069 
00070 //define this as a plug-in
00071 DEFINE_FWK_MODULE(SelectHFMinBias);