CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
QCDSingleJetFilter.cc
Go to the documentation of this file.
1 /* \class QCDSingleJetFilter
2  *
3  * QCDSingleJetFilter for CSA07 Excercise
4  *
5  * author: Andreas Oehler (andreas.oehler@cern.ch)
6  * see header
7  */
8 
9 //MyHeadeR:
11 
12 // User include files
13 
20 
21 
25 
26 //rand:
27 //#include <FWCore/ServiceRegistry/interface/Service.h>
28 //#include <FWCore/Utilities/interface/RandomNumberGenerator.h>
29 //#include <CLHEP/Random/RandFlat.h>
30 
31 // C++
32 #include <algorithm>
33 #include <iostream>
34 #include <vector>
35 #include <math.h>
36 
37 using namespace std;
38 using namespace edm;
39 //using namespace reco;
40 
41 //detruktor
43  //delete theFlatDistrib;
44 }
45 
46 // Constructor
47 //QCDSingleJetFilter::QCDSingleJetFilter(const edm::ParameterSet& pset):theFlatDistrib(0),theTriggerJetCollectionA(pset.getParameter<edm::InputTag>("TriggerJetCollectionA")),theTrigCollB(pset.getParameter<edm::InputTag>("TriggerJetCollectionB")){
48 QCDSingleJetFilter::QCDSingleJetFilter(const edm::ParameterSet& pset):theTriggerJetCollectionA(pset.getParameter<edm::InputTag>("TriggerJetCollectionA")),theTrigCollB(pset.getParameter<edm::InputTag>("TriggerJetCollectionB")){
49 
50  // Local Debug flag
51  //debug = pset.getParameter<bool>("DebugHiggsToZZ4LeptonsSkim");
52 
53  //getConfigParameter:
54  theMinPt = pset.getParameter<double>("MinPt");
55  //prescale taken out for convenience
56  //thePreScale = pset.getParameter<double>("PreScale");
57  //thePreScale=fabs(thePreScale);
58  //if (thePreScale<1) thePreScale=0;
59 
60  // Eventually, HLT objects:
61 
62  //get Random-Service running:
63  //edm::Service<edm::RandomNumberGenerator> rng;
64  //if (!rng.isAvailable()) {
65  // throw cms::Exception("QCDSingleJetFilter")<<"QCDSingleJetFilter requires RandomNumberGeneratorService\n"
66  // "--borked setup\n";
67  //}
68  //CLHEP::HepRandomEngine& engine = rng->getEngine();
69  //theFlatDistrib = new CLHEP::RandFlat(engine,0.0,1.0);
70 }
71 
72 
73 
74 
75 // Filter event
77  bool keepEvent = false;
78  using namespace edm;
79  using namespace std;
80 
81  //now get right Jet-Collection:
82  edm::Handle<reco::CaloJetCollection> theTriggerCollectionJetsA;
83  edm::Handle<reco::CaloJetCollection> theTrigCollJetsB;
84 
85  event.getByLabel(theTriggerJetCollectionA,theTriggerCollectionJetsA);
86  event.getByLabel(theTrigCollB,theTrigCollJetsB);
87 
88  for (reco::CaloJetCollection::const_iterator iter=theTriggerCollectionJetsA->begin();iter!=theTriggerCollectionJetsA->end();++iter){
89  if ((*iter).pt()>=theMinPt) {
90  keepEvent=true;
91  break;
92  }
93  }
94 
95  for (reco::CaloJetCollection::const_iterator iter=theTrigCollJetsB->begin();iter!=theTrigCollJetsB->end();++iter){
96  if ((*iter).pt()>=theMinPt) {
97  keepEvent=true;
98  break;
99  }
100  }
101 
102 
103  //double randval = theFlatDistrib->fire();
104  //if (thePreScale<1) keepEvent=false;
105  //else if ((randval>(1.0/thePreScale))&&keepEvent) keepEvent=false;
106 // cout<<"KeepEvent?: "<<keepEvent<<endl;
107 
108  return keepEvent;
109 
110 }
111 
T getParameter(std::string const &) const
edm::InputTag theTriggerJetCollectionA
virtual bool filter(edm::Event &, const edm::EventSetup &)
Get event properties to send to builder to fill seed collection.
edm::InputTag theTrigCollB
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
QCDSingleJetFilter(const edm::ParameterSet &)
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")