CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
virtual ~BHFilter ()
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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
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 &)
 
- 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 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(), 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
int i
Definition: DBlmapReader.cc:9
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
tuple cout
Definition: gather_cfg.py:121
edm::ParameterSet conf_
Definition: BHFilter.h:30
virtual cms::BHFilter::~BHFilter ( )
inlinevirtual

Definition at line 24 of file BHFilter.h.

24 {}

Member Function Documentation

bool cms::BHFilter::BSC1 ( const HepMC::FourVector &  ,
const HepMC::FourVector &  ,
const HepMC::FourVector &   
)
bool cms::BHFilter::filter ( edm::Event iEvent,
edm::EventSetup const &  c 
)
virtual

Implements edm::EDFilter.

Definition at line 42 of file BHFilter.cc.

References HLT_25ns14e33_v1_cff::A, funct::C, circ_minus, circ_plus, edm::Event::getByLabel(), i, pad_minus, pad_plus, mathSSE::sqrt(), lumiQTWidget::t, trig2_, trig_, and x().

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 }
int i
Definition: DBlmapReader.cc:9
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:48
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:420
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:150
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:15

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().