CMS 3D CMS Logo

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

#include <CosmicTIFTrigFilter.h>

Inheritance diagram for cms::CosmicTIFTrigFilter:
edm::stream::EDFilter<> edm::stream::EDFilterBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 CosmicTIFTrigFilter (const edm::ParameterSet &conf)
 
bool filter (edm::Event &iEvent, edm::EventSetup const &c) override
 
bool Sci_trig (const HepMC::FourVector &, const HepMC::FourVector &, const HepMC::FourVector &)
 
 ~CosmicTIFTrigFilter () override
 
- Public Member Functions inherited from edm::stream::EDFilter<>
 EDFilter ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
- Public Member Functions inherited from edm::stream::EDFilterBase
 EDFilterBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDFilterBase () 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

edm::ParameterSet conf_
 
bool inTK
 
edm::EDGetTokenT< edm::HepMCProductm_Token
 
int tottrig
 
int trig1
 
int trig2
 
int trig3
 
int trigconf
 
std::vector< double > trigS1
 
std::vector< double > trigS2
 
std::vector< double > trigS3
 
std::vector< double > trigS4
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDFilter<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDFilterBase
typedef EDFilterAdaptorBase 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::stream::EDFilterBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 14 of file CosmicTIFTrigFilter.h.

Constructor & Destructor Documentation

cms::CosmicTIFTrigFilter::CosmicTIFTrigFilter ( const edm::ParameterSet conf)

Definition at line 17 of file CosmicTIFTrigFilter.cc.

References edm::ParameterSet::getParameter(), trigconf, trigS1, trigS2, trigS3, and trigS4.

18  : m_Token(consumes<edm::HepMCProduct>(
19  conf.getParameter<edm::ParameterSet>("Generator").getParameter<std::string>("HepMCProductLabel"))) {
20  trigconf = conf.getParameter<int>("trig_conf");
21  trigS1 = conf.getParameter<std::vector<double>>("PosScint1");
22  trigS2 = conf.getParameter<std::vector<double>>("PosScint2");
23  trigS3 = conf.getParameter<std::vector<double>>("PosScint3");
24  trigS4 = conf.getParameter<std::vector<double>>("PosScint4");
25 
26  /*
27  std::cout << "S1 = " << trigS1[0] << ", " << trigS1[1] << ", " <<trigS1[2]
28  << "\nS2 = " << trigS2[0] << ", " << trigS2[1] << ", " <<trigS2[2]
29  << "\nS3 = " << trigS3[0] << ", " << trigS3[1] << ", " <<trigS3[2]
30  << "\nS4 = " << trigS4[0] << ", " << trigS4[1] << ", " <<trigS4[2]
31  << std::endl;
32  */
33  }
T getParameter(std::string const &) const
std::vector< double > trigS2
std::vector< double > trigS3
std::vector< double > trigS1
std::vector< double > trigS4
edm::EDGetTokenT< edm::HepMCProduct > m_Token
cms::CosmicTIFTrigFilter::~CosmicTIFTrigFilter ( )
inlineoverride

Definition at line 17 of file CosmicTIFTrigFilter.h.

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

17 {}

Member Function Documentation

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

Implements edm::stream::EDFilterBase.

Definition at line 35 of file CosmicTIFTrigFilter.cc.

References funct::abs(), edm::Event::getByToken(), edm::HepMCProduct::GetEvent(), mps_fire::i, m_Token, MetAnalyzer::pv(), Sci_trig(), trig1, trig2, trig3, trigconf, trigS1, trigS2, trigS3, and trigS4.

Referenced by ~CosmicTIFTrigFilter().

35  {
37  iEvent.getByToken(m_Token, HepMCEvt);
38 
39  const HepMC::GenEvent *MCEvt = HepMCEvt->GetEvent();
40 
41  bool hit1 = false;
42  bool hit2 = false;
43  bool hit3 = false;
44  bool hit4 = false;
45 
46  for (HepMC::GenEvent::particle_const_iterator i = MCEvt->particles_begin(); i != MCEvt->particles_end(); ++i) {
47  int myId = (*i)->pdg_id();
48  if (abs(myId) == 13) {
49  // Get the muon position and momentum
50  HepMC::GenVertex *pv = (*i)->production_vertex();
51  const HepMC::FourVector &vertex = pv->position();
52 
53  HepMC::FourVector momentum = (*i)->momentum();
54 
55  // std::cout << "\t vertex for cut = " << vertex << std::endl;
56  // std::cout << "\t momentum = " << momentum << std::endl;
57 
58  if (trigconf == 1) {
59  HepMC::FourVector S1(trigS1[0], trigS1[1], trigS1[2], 0.);
60  HepMC::FourVector S2(trigS2[0], trigS2[1], trigS2[2], 0.);
61  HepMC::FourVector S3(trigS3[0], trigS3[1], trigS3[2], 0.);
62 
63  hit1 = Sci_trig(vertex, momentum, S1);
64  hit2 = Sci_trig(vertex, momentum, S2);
65  hit3 = Sci_trig(vertex, momentum, S3);
66 
67  // trigger conditions
68 
69  if ((hit1 && hit2) || (hit3 && hit2)) {
70  /*
71  cout << "\tGot a trigger in configuration A " << endl;
72  if(hit1)cout << "hit1 " << endl;
73  if(hit2)cout << "hit2 " << endl;
74  if(hit3)cout << "hit3 " << endl;
75  */
76  trig1++;
77  return true;
78  }
79  } else if (trigconf == 2) {
80  HepMC::FourVector S1(trigS1[0], trigS1[1], trigS1[2], 0.);
81  HepMC::FourVector S2(trigS2[0], trigS2[1], trigS2[2], 0.);
82  HepMC::FourVector S3(trigS3[0], trigS3[1], trigS3[2], 0.);
83 
84  hit1 = Sci_trig(vertex, momentum, S1);
85  hit2 = Sci_trig(vertex, momentum, S2);
86  hit3 = Sci_trig(vertex, momentum, S3);
87 
88  // trigger conditions
89 
90  if ((hit1 && hit2) || (hit3 && hit2)) {
91  /*
92  cout << "\tGot a trigger in configuration B " << endl;
93  if(hit1)cout << "hit1 " << endl;
94  if(hit2)cout << "hit2 " << endl;
95  if(hit3)cout << "hit3 " << endl;
96  */
97  trig2++;
98  return true;
99  }
100 
101  } else if (trigconf == 3) {
102  HepMC::FourVector S1(trigS1[0], trigS1[1], trigS1[2], 0.);
103  HepMC::FourVector S2(trigS2[0], trigS2[1], trigS2[2], 0.);
104  HepMC::FourVector S3(trigS3[0], trigS3[1], trigS3[2], 0.);
105  HepMC::FourVector S4(trigS4[0], trigS4[1], trigS4[2], 0.);
106 
107  /* std::cout << "S1 = " << S1.x() << "," << S1.y() << ", " <<
108  S1.z()
109  << "\nS2 = " << S2.x() << "," << S2.y() << ", " << S2.z()
110  << "\nS3 = " << S3.x() << "," << S3.y() << ", " << S3.z()
111  << "\nS4 = " << S4.x() << "," << S4.y() << ", " << S4.z()
112  << std::endl;
113  */
114 
115  hit1 = Sci_trig(vertex, momentum, S1);
116  hit2 = Sci_trig(vertex, momentum, S2);
117  hit3 = Sci_trig(vertex, momentum, S3);
118  hit4 = Sci_trig(vertex, momentum, S4);
119 
120  // trigger conditions
121  if ((hit1 && hit2) || (hit3 && hit2) || (hit1 && hit4) || (hit3 && hit4)) {
122  /*
123  cout << "\tGot a trigger in configuration C " << endl;
124  if(hit1)cout << "hit1 " << endl;
125  if(hit2)cout << "hit2 " << endl;
126  if(hit3)cout << "hit3 " << endl;
127  if(hit4)cout << "hit4 " << endl;
128  */
129 
130  trig3++;
131  return true;
132  }
133  }
134  }
135  }
136 
137  return false;
138  }
std::vector< double > trigS2
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
std::vector< double > trigS3
std::vector< double > trigS1
std::vector< double > trigS4
def pv(vc)
Definition: MetAnalyzer.py:7
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:38
bool Sci_trig(const HepMC::FourVector &, const HepMC::FourVector &, const HepMC::FourVector &)
edm::EDGetTokenT< edm::HepMCProduct > m_Token
bool cms::CosmicTIFTrigFilter::Sci_trig ( const HepMC::FourVector &  vertex,
const HepMC::FourVector &  momentum,
const HepMC::FourVector &  S 
)

Definition at line 140 of file CosmicTIFTrigFilter.cc.

Referenced by filter(), and ~CosmicTIFTrigFilter().

142  {
143  float x0 = vertex.x();
144  float y0 = vertex.y();
145  float z0 = vertex.z();
146  float px0 = momentum.x();
147  float py0 = momentum.y();
148  float pz0 = momentum.z();
149  float Sx = S.x();
150  float Sy = S.y();
151  float Sz = S.z();
152 
153  float zs = (Sy - y0) * (pz0 / py0) + z0;
154  float xs = (Sy - y0) * (px0 / py0) + x0;
155 
156  // std::cout << Sx << " " << Sz << " " << xs << " " << zs << std::endl;
157  // std::cout << x0 << " " << z0 << " " << px0 << " " << py0 << " " << pz0 <<
158  // endl;
159 
160  if ((xs < Sx + 500 && xs > Sx - 500) && (zs < Sz + 500 && zs > Sz - 500)) {
161  // std::cout << "PASSED" << std::endl;
162  return true;
163  } else {
164  return false;
165  }
166  }

Member Data Documentation

edm::ParameterSet cms::CosmicTIFTrigFilter::conf_
private

Definition at line 22 of file CosmicTIFTrigFilter.h.

bool cms::CosmicTIFTrigFilter::inTK
private

Definition at line 24 of file CosmicTIFTrigFilter.h.

edm::EDGetTokenT<edm::HepMCProduct> cms::CosmicTIFTrigFilter::m_Token
private

Definition at line 29 of file CosmicTIFTrigFilter.h.

Referenced by filter().

int cms::CosmicTIFTrigFilter::tottrig
private

Definition at line 26 of file CosmicTIFTrigFilter.h.

int cms::CosmicTIFTrigFilter::trig1
private

Definition at line 27 of file CosmicTIFTrigFilter.h.

Referenced by filter().

int cms::CosmicTIFTrigFilter::trig2
private

Definition at line 27 of file CosmicTIFTrigFilter.h.

Referenced by filter().

int cms::CosmicTIFTrigFilter::trig3
private

Definition at line 27 of file CosmicTIFTrigFilter.h.

Referenced by filter().

int cms::CosmicTIFTrigFilter::trigconf
private

Definition at line 25 of file CosmicTIFTrigFilter.h.

Referenced by CosmicTIFTrigFilter(), and filter().

std::vector<double> cms::CosmicTIFTrigFilter::trigS1
private

Definition at line 28 of file CosmicTIFTrigFilter.h.

Referenced by CosmicTIFTrigFilter(), and filter().

std::vector<double> cms::CosmicTIFTrigFilter::trigS2
private

Definition at line 28 of file CosmicTIFTrigFilter.h.

Referenced by CosmicTIFTrigFilter(), and filter().

std::vector<double> cms::CosmicTIFTrigFilter::trigS3
private

Definition at line 28 of file CosmicTIFTrigFilter.h.

Referenced by CosmicTIFTrigFilter(), and filter().

std::vector<double> cms::CosmicTIFTrigFilter::trigS4
private

Definition at line 28 of file CosmicTIFTrigFilter.h.

Referenced by CosmicTIFTrigFilter(), and filter().