CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HLTPMDocaFilter.cc
Go to the documentation of this file.
1 
10 
12 
16 
19 
20 //
21 // constructors and destructor
22 //
24 {
25  candTag_ = iConfig.getParameter< edm::InputTag > ("candTag");
26  docaDiffPerpCutHigh_ = iConfig.getParameter<double> ("docaDiffPerpCutHigh");
27  docaDiffPerpCutLow_ = iConfig.getParameter<double> ("docaDiffPerpCutLow");
28  nZcandcut_ = iConfig.getParameter<int> ("nZcandcut");
29  candToken_ = consumes<trigger::TriggerFilterObjectWithRefs>(candTag_);
30 }
31 
33 
34 void
38  desc.add<edm::InputTag>("candTag",edm::InputTag("HltZeePMMassFilter"));
39  desc.add<double>("docaDiffPerpCutHigh",0.055691);
40  desc.add<double>("docaDiffPerpCutLow",0.0);
41  desc.add<int>("nZcandcut",1);
42  descriptions.add("hltPMDocaFilter",desc);
43 }
44 
45 // ------------ method called to produce the data ------------
46 bool
48 {
49  using namespace std;
50  using namespace edm;
51  using namespace reco;
52  using namespace trigger;
53 
54  // Ref to Candidate object to be recorded in filter object
56 
58  iEvent.getByToken (candToken_,PrevFilterOutput);
59 
60  std::vector<edm::Ref<reco::ElectronCollection> > electrons;
61  PrevFilterOutput->getObjects(TriggerElectron, electrons);
62 
63 
64  int n = 0;
65 
66  unsigned int size = electrons.size();
67  std::vector<double> vx(size);
68  std::vector<double> vy(size);
69 
70  for (unsigned int i=0; i< size; i++) {
71  ref = electrons[i];
72  vx[i]=ref->vx();
73  vy[i]=ref->vy();
74  }
75 
76  for(unsigned int jj=0;jj<size;jj++){
77  for(unsigned int ii=jj+1;ii<size;ii++){
78  double docaDiffPerp = sqrt( (vx[jj]-vx[ii])*(vx[jj]-vx[ii])+(vy[jj]-vy[ii])*(vy[jj]-vy[ii]));
79  // std::cout<<"docaDiffPerp= "<<docaDiffPerp<<std::endl;
80  if((docaDiffPerp>=docaDiffPerpCutLow_) && (docaDiffPerp<= docaDiffPerpCutHigh_)){
81  n++;
82  ref = electrons[ii];
83  filterproduct.addObject(TriggerElectron, ref);
84  ref = electrons[jj];
85  filterproduct.addObject(TriggerElectron, ref);
86 
87  }
88  }
89  }
90 
91 
92  // filter decision
93  bool accept(n>=nZcandcut_);
94 
95  return accept;
96 }
97 
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
int ii
Definition: cuy.py:588
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:24
void addObject(int id, const reco::RecoEcalCandidateRef &ref)
setters for L3 collections: (id=physics type, and Ref&lt;C&gt;)
int iEvent
Definition: GenABIO.cc:230
edm::InputTag candTag_
T sqrt(T t)
Definition: SSEVec.h:48
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > candToken_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
double docaDiffPerpCutHigh_
HLTPMDocaFilter(const edm::ParameterSet &)
static void makeHLTFilterDescription(edm::ParameterSetDescription &desc)
Definition: HLTFilter.cc:29
double docaDiffPerpCutLow_
virtual bool hltFilter(edm::Event &, const edm::EventSetup &, trigger::TriggerFilterObjectWithRefs &filterproduct) const override
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
tuple size
Write out results.