CMS 3D CMS Logo

FastSimDataFilter.cc
Go to the documentation of this file.
2 
14 
15 
16 using namespace std;
17 namespace cms
18 {
19 
20 FastSimDataFilter::FastSimDataFilter(const edm::ParameterSet& conf)
21 {
22  towercut= conf.getUntrackedParameter<double>("towercut", 1.4);
23 }
24 
25 FastSimDataFilter::~FastSimDataFilter() {}
26 
27 void FastSimDataFilter::beginJob() { ntotal = 0; npassed = 0; }
28 void FastSimDataFilter::endJob() {
29  cout << " FastSimDataFilter: accepted " << npassed << " out of total "
30  << ntotal << endl;
31 
32  }
33 
35 {
36  ntotal++;
37  bool result = false;
38 
40  event.getByLabel("towerMaker",towers);
42 
43 
44  int nplusP = 0;
45  int nminusP = 0;
46  int nplusR = 0;
47  int nminusR = 0;
48  double metx = 0.;
49  double mety = 0.;
50  double sumEt = 0.;
51 
52  for ( cal = towers->begin(); cal != towers->end(); ++cal ) {
53 
54  // double eE = cal->emEnergy();
55  // double eH = cal->hadEnergy();
56  // double eHO = cal->outerEnergy();
57  // double phi = cal->phi();
58 
59  double eta = cal->eta();
60  double en = cal->energy();
61  double et = cal->et();
62 
63  // cylindrical
64  math::RhoEtaPhiVector mom(cal->et(), cal->eta(), cal->phi());
65 
66  /*
67  // cell properties
68  CaloTowerDetId idT = cal->id();
69  int ieta = idT.ieta();
70  if(ieta > 0) ieta -= 1;
71  int iphi = idT.iphi();
72  */
73 
74  metx += mom.x();
75  mety += mom.y();
76  sumEt += et;
77 
78  // Towers approx. in the region of BSC Paddles and Rings
79  if( en > towercut && eta > 3.1 && eta < 3.5 ) nplusP++;
80  if( en > towercut && eta < -3.1 && eta > -3.5 ) nminusP++;
81  if( en > towercut && eta > 3.9 && eta < 4.6 ) nplusR++;
82  if( en > towercut && eta < -3.9 && eta > -4.6 ) nminusR++;
83 
84 
85  } // towers cycle
86 
87  if( (nplusP * nminusP >= 1 ) || (nplusR * nminusR >= 1 ) ||
88  (nplusP * nminusR >= 1 ) || (nplusR * nminusP >= 1 )) {
89  // std::cout << "... passed" << std::endl;
90  result = true;
91  npassed++;
92  }
93 
94  return result;
95 
96 }
97 } // namespace cms
98 
99 // define this class as a plugin
101 using namespace cms;
T getUntrackedParameter(std::string const &, T const &) const
std::vector< CaloTower >::const_iterator const_iterator
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:2
RhoEtaPhiVectorD RhoEtaPhiVector
spatial vector with cylindrical internal representation using pseudorapidity
Definition: Vector3D.h:32
void beginJob()
Definition: Breakpoints.cc:14
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Namespace of DDCMS conversion namespace.
const_iterator end() const
et
define resolution functions of each parameter
const_iterator begin() const
Definition: event.py:1