CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
cms::BHFilter Class Reference

#include <BHFilter.h>

Inheritance diagram for cms::BHFilter:
edm::EDFilter edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 BHFilter (const edm::ParameterSet &conf)
 
bool BSC1 (const HepMC::FourVector &, const HepMC::FourVector &, const HepMC::FourVector &)
 
bool filter (edm::Event &iEvent, edm::EventSetup const &c) override
 
 ~BHFilter () override
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDFilter () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

std::vector< double > bFields
 
double bReduction
 
bool circ_minus
 
bool circ_plus
 
edm::ParameterSet conf_
 
bool inTK
 
bool pad_minus
 
bool pad_plus
 
std::vector< double > rBounds
 
int trig2_
 
int trig_
 
std::vector< double > zBounds
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 21 of file BHFilter.h.

Constructor & Destructor Documentation

cms::BHFilter::BHFilter ( const edm::ParameterSet conf)
explicit

Definition at line 10 of file BHFilter.cc.

References bFields, bReduction, conf_, gather_cfg::cout, edm::ParameterSet::getParameter(), mps_fire::i, rBounds, trig2_, trig_, and zBounds.

10  : conf_(conf)
11 {
12  rBounds = conf_.getParameter< vector<double> >("radii");
13  zBounds = conf_.getParameter< vector<double> >("zeds");
14  bFields = conf_.getParameter< vector<double> >("bfiel");
15  bReduction = conf_.getParameter< double >("factor");
16  trig_ = conf_.getParameter< int >("trig_type");
17  trig2_ = conf_.getParameter< int >("scintillators_type");
18 
19  for ( unsigned i=0; i<bFields.size(); ++i ) {
20  bFields[i] *= bReduction;
21  cout << "r/z/b = " << rBounds[i] << " " << zBounds[i] << " " << bFields[i] << endl;
22  }
23 
24  if(trig_==0){ cout <<endl << "trigger is both + and - BSC " << endl;}
25  if(trig_==1){ cout <<endl << "trigger is + side BSC " << endl;}
26  if(trig_==-1){ cout <<endl << "trigger is - side BSC " << endl;}
27 
28  cout << endl;
29 
30  if(trig2_==0){ cout <<endl << "trigger is both PADs and DISKs " << endl;}
31  if(trig2_==-1){ cout <<endl << "trigger is only PADs " << endl;}
32  if(trig2_==1){ cout <<endl << "trigger is only DISKs " << endl;}
33 
34  if(trig_!=0 && trig_!=-1 && trig_!=1 && trig2_!=0 && trig2_!=-1 && trig2_!=1)
35  {
36  cout <<endl << endl <<endl<< "WARNING!! BSC trigger/scintillator type not properly defined " << endl;
37  cout <<endl << endl <<endl<< "WARNING!! BSC trigger/scintillator type not properly defined " << endl << endl << endl;
38  }
39 
40 }
T getParameter(std::string const &) const
std::vector< double > bFields
Definition: BHFilter.h:35
double bReduction
Definition: BHFilter.h:36
std::vector< double > zBounds
Definition: BHFilter.h:33
std::vector< double > rBounds
Definition: BHFilter.h:34
edm::ParameterSet conf_
Definition: BHFilter.h:30
cms::BHFilter::~BHFilter ( )
inlineoverride

Definition at line 24 of file BHFilter.h.

References BSC1(), EnergyCorrector::c, filter(), and iEvent.

24 {}

Member Function Documentation

bool cms::BHFilter::BSC1 ( const HepMC::FourVector &  ,
const HepMC::FourVector &  ,
const HepMC::FourVector &   
)

Referenced by ~BHFilter().

bool cms::BHFilter::filter ( edm::Event iEvent,
edm::EventSetup const &  c 
)
overridevirtual

Implements edm::EDFilter.

Definition at line 42 of file BHFilter.cc.

References patCaloMETCorrections_cff::A, TtFullHadDaughter::B, patCaloMETCorrections_cff::C, circ_minus, circ_plus, edm::Event::getByLabel(), edm::HepMCProduct::GetEvent(), mps_fire::i, pad_minus, pad_plus, mathSSE::sqrt(), protons_cff::t, trig2_, and trig_.

Referenced by ~BHFilter().

43 {
44 
45 
47  iEvent.getByLabel("generator","unsmeared",HepMCEvt);
48  const HepMC::GenEvent* MCEvt = HepMCEvt->GetEvent();
49 
51  map<unsigned,XYZTLorentzVector> myHits;
52 
53 
54 
55  for(HepMC::GenEvent::particle_const_iterator i=MCEvt->particles_begin(); i != MCEvt->particles_end();++i)
56  {
57 
58 
59 
60  pad_plus = false;
61  pad_minus = false;
62  circ_plus = false;
63  circ_minus = false;
64 
65  int myId = (*i)->pdg_id();
66 
67 
68  const HepMC::GenVertex * vertex_=(*i)->production_vertex();
69  double xv = vertex_->position().x();
70  double yv = vertex_->position().y();
71  double zv = vertex_->position().z();
72  double tv = vertex_->position().t();
73  XYZTLorentzVector vertex = XYZTLorentzVector(xv,yv,zv,tv);
74 
75  //vertex_->position();
76 
77  // HepMC::FourVector
78  XYZTLorentzVector momentum = XYZTLorentzVector(((*i)->momentum()).x(), ((*i)->momentum()).y(), ((*i)->momentum()).z(), ((*i)->momentum()).t());
79 
80  RawParticle myMuon(-momentum, vertex/10.);
81 
82  if ( myId < 0 )
83  myMuon.setCharge(-1.);
84  else
85  myMuon.setCharge(+1.);
86 
87  BaseParticlePropagator PP(myMuon,0.,0.,0.);
88 
89 
90  float x0= vertex.x();
91  float y0= vertex.y();
92  float z0= vertex.z();
93  float px0=momentum.x();
94  float py0=momentum.y();
95  float pz0=momentum.z();
96 
97  // beam 1 or 2 ?
98  // propagator -> need to be implemented
99 
100 
101  // intersection point - particle/BSC1
102  float zs = 10860.;
103  float ys = (zs-z0)*(py0/pz0)+y0;
104  float xs = (ys-y0)*(px0/py0)+x0;
105 
106 
107  if(xs<0 && ys>0) {xs=-xs;}
108  if(xs>0 && ys<0) {ys=-ys;}
109  if(xs<0 && ys<0) {xs=-xs; ys=-ys;}
110 
111 
112  // scintillator pads
113  float A[2]={732.7, 24.7};
114  float B[2]={895.3, 187.3};
115  float C[2]={144.0, 850.2};
116  float D[2]={69.8, 776.0};
117  float m1=(B[1]-A[1])/(B[0]-A[0]);
118  float m2=(C[1]-B[1])/(C[0]-B[0]);
119  float m3=(D[1]-C[1])/(D[0]-C[0]);
120  float m4=(A[1]-D[1])/(A[0]-D[0]);
121  float y1=m1*(xs-A[0])+A[1];
122  float y2=m2*(xs-B[0])+B[1];
123  float y3=m3*(xs-C[0])+C[1];
124  float y4=m4*(xs-D[0])+D[1];
125 
126 
127 
128 
129  // trigger conditions
130 
131  if(ys>y1 && ys<y2 && ys<y3 && ys>y4)
132  {
133  pad_plus = true;
134  // cout << " trig1+" << endl;
135  }
136 
137  if((ys<sqrt(450*450-xs*xs) && ys>sqrt(208*208-xs*xs)) || (ys<sqrt(450*450-xs*xs) && xs>208))
138  {
139  circ_plus = true;
140  // cout << " trig2+" << endl;
141  }
142 
143 
144  // intersection point - particle/BSC2
145  zs = -10860.;
146  ys = (zs-z0)*(py0/pz0)+y0;
147  xs = (ys-y0)*(px0/py0)+x0;
148 
149  // cout << endl << " xs ys zs " << xs << " " << ys << " " << zs;
150 
151 
152  if(xs<0 && ys>0) {xs=-xs;}
153  if(xs>0 && ys<0) {ys=-ys;}
154  if(xs<0 && ys<0) {xs=-xs; ys=-ys;}
155 
156 
157  // scintillator pads
158  y1=m1*(xs-A[0])+A[1];
159  y2=m2*(xs-B[0])+B[1];
160  y3=m3*(xs-C[0])+C[1];
161  y4=m4*(xs-D[0])+D[1];
162 
163 
164 
165  // trigger conditions
166 
167  if(ys>y1 && ys<y2 && ys<y3 && ys>y4)
168  {
169  pad_minus = true;
170  // cout << " trig1-" << endl;
171  }
172 
173  if((ys<sqrt(450*450-xs*xs) && ys>sqrt(208*208-xs*xs)) || (ys<sqrt(450*450-xs*xs) && xs>208))
174  {
175  circ_minus = true;
176  // cout << " trig2-" << endl;
177  }
178 
179 
180  // final selection
181 
182  if(trig2_==-1)
183  {
184  pad_plus = false;
185  pad_minus = false;
186  }
187  if(trig2_==1)
188  {
189  circ_plus = false;
190  circ_minus = false;
191  }
192 
193  if(trig_==0 && (pad_plus || circ_plus) && (pad_minus || circ_minus) )
194  {
195  // cout << "triggg 0 " << endl;
196  return true;
197  }
198  if(trig_==1 && (pad_plus || circ_plus))
199  {
200  // cout << "triggg 1 " << endl;
201  return true;
202  }
203  if(trig_==-1 && (pad_minus || circ_minus))
204  {
205  // cout << "triggg -1 " << endl;
206  return true;
207  }
208 
209  }
210 
211  return false;
212 
213 }
bool circ_minus
Definition: BHFilter.h:44
bool pad_minus
Definition: BHFilter.h:42
bool circ_plus
Definition: BHFilter.h:43
bool pad_plus
Definition: BHFilter.h:41
T sqrt(T t)
Definition: SSEVec.h:18
static const std::string B
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:480
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:38
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:152
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:27

Member Data Documentation

std::vector<double> cms::BHFilter::bFields
private

Definition at line 35 of file BHFilter.h.

Referenced by BHFilter().

double cms::BHFilter::bReduction
private

Definition at line 36 of file BHFilter.h.

Referenced by BHFilter().

bool cms::BHFilter::circ_minus
private

Definition at line 44 of file BHFilter.h.

Referenced by filter().

bool cms::BHFilter::circ_plus
private

Definition at line 43 of file BHFilter.h.

Referenced by filter().

edm::ParameterSet cms::BHFilter::conf_
private

Definition at line 30 of file BHFilter.h.

Referenced by BHFilter().

bool cms::BHFilter::inTK
private

Definition at line 32 of file BHFilter.h.

bool cms::BHFilter::pad_minus
private

Definition at line 42 of file BHFilter.h.

Referenced by filter().

bool cms::BHFilter::pad_plus
private

Definition at line 41 of file BHFilter.h.

Referenced by filter().

std::vector<double> cms::BHFilter::rBounds
private

Definition at line 34 of file BHFilter.h.

Referenced by BHFilter().

int cms::BHFilter::trig2_
private

Definition at line 38 of file BHFilter.h.

Referenced by BHFilter(), and filter().

int cms::BHFilter::trig_
private

Definition at line 37 of file BHFilter.h.

Referenced by BHFilter(), and filter().

std::vector<double> cms::BHFilter::zBounds
private

Definition at line 33 of file BHFilter.h.

Referenced by BHFilter().