CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
PythiaFilterIsolatedTrack Class Reference

#include <PythiaFilterIsolatedTrack.h>

Inheritance diagram for PythiaFilterIsolatedTrack:
edm::EDFilter edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

virtual bool filter (edm::Event &, const edm::EventSetup &)
 
 PythiaFilterIsolatedTrack (const edm::ParameterSet &)
 
 ~PythiaFilterIsolatedTrack ()
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Static Public Member Functions

static double getDistInCM (double eta1, double phi1, double eta2, double phi2)
 
static std::pair< double, double > GetEtaPhiAtEcal (double etaIP, double phiIP, double pT, int charge, double vtxZ)
 
- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Private Attributes

CLHEP::RandFlat * flatDistribution_
 
double IsolCone_
 
double MaxSeedEta_
 
double MinIsolTrackMom_
 
double MinSeedMom_
 
std::string ModuleLabel_
 
double PixelEfficiency_
 
edm::Service
< edm::RandomNumberGenerator
rng_
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
typedef WorkerT< EDFilterWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Protected Member Functions inherited from edm::EDFilter
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

PythiaFilterGammaJet filter implements generator-level preselections for ChargedHadron+jet like events to be used in jet energy calibration. Ported from fortran code written by V.Konoplianikov.

Author
O.Kodolova, SINP

Cleaned up code, and added pixel efficiency functionality

Author
J.P. Chou, Brown University

Definition at line 33 of file PythiaFilterIsolatedTrack.h.

Constructor & Destructor Documentation

PythiaFilterIsolatedTrack::PythiaFilterIsolatedTrack ( const edm::ParameterSet iConfig)
explicit

Definition at line 79 of file PythiaFilterIsolatedTrack.cc.

References edm::hlt::Exception, flatDistribution_, edm::RandomNumberGenerator::getEngine(), edm::Service< T >::isAvailable(), and rng_.

79  :
80  ModuleLabel_(iConfig.getUntrackedParameter("ModuleLabel",std::string("generator"))),
81  MaxSeedEta_(iConfig.getUntrackedParameter<double>("MaxSeedEta", 2.3)),
82  MinSeedMom_(iConfig.getUntrackedParameter<double>("MinSeedMom", 20.)),
83  MinIsolTrackMom_(iConfig.getUntrackedParameter<double>("MinIsolTrackMom",2.0)),
84  IsolCone_(iConfig.getUntrackedParameter<double>("IsolCone", 40.0)),
85  PixelEfficiency_(iConfig.getUntrackedParameter<double>("PixelEfficiency", 0.8))
86 {
87 
88  // initialize the random number generator service
89  if(!rng_.isAvailable()) {
90  throw cms::Exception("Configuration") << "PythiaFilterIsolatedTrack requires the RandomNumberGeneratorService\n";
91  }
92  CLHEP::HepRandomEngine& engine = rng_->getEngine();
93  flatDistribution_ = new CLHEP::RandFlat(engine, 0.0, 1.0);
94 }
T getUntrackedParameter(std::string const &, T const &) const
bool isAvailable() const
Definition: Service.h:47
virtual CLHEP::HepRandomEngine & getEngine() const =0
Use this to get the random number engine, this is the only function most users should call...
edm::Service< edm::RandomNumberGenerator > rng_
PythiaFilterIsolatedTrack::~PythiaFilterIsolatedTrack ( )

Definition at line 97 of file PythiaFilterIsolatedTrack.cc.

References flatDistribution_.

98 {
99  delete flatDistribution_;
100 }

Member Function Documentation

bool PythiaFilterIsolatedTrack::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDFilter.

Definition at line 104 of file PythiaFilterIsolatedTrack.cc.

References abs, MBUEandQCDValidation_cff::chargedParticles, flatDistribution_, configurableAnalysis::GenParticle, edm::Event::getByLabel(), edm::EventSetup::getData(), getDistInCM(), GetEtaPhiAtEcal(), IsolCone_, MaxSeedEta_, MinIsolTrackMom_, MinSeedMom_, ModuleLabel_, AlCaHLTBitMon_ParallelJobs::p, p1, p2, PixelEfficiency_, and ntuplemaker::status.

104  {
105 
107  iSetup.getData( pdt );
108 
110  iEvent.getByLabel(ModuleLabel_, evt);
111 
112  const HepMC::GenEvent* myGenEvent = evt->GetEvent();
113 
114  // all of the stable, charged particles with momentum>MinIsolTrackMom_ and |eta|<MaxSeedEta_+0.5
115  std::vector<const HepMC::GenParticle *> chargedParticles;
116 
117  // all of the stable, charged particles with momentum>MinSeedMom_ and |eta|<MaxSeedEta_
118  std::vector<const HepMC::GenParticle *> seeds;
119 
120  // fill the vector of charged particles and seeds in the event
121  for(HepMC::GenEvent::particle_const_iterator iter=myGenEvent->particles_begin(); iter!=myGenEvent->particles_end(); ++iter) {
122  const HepMC::GenParticle *p=*iter;
123  int charge3 = pdt->particle(p->pdg_id())->ID().threeCharge();
124  int status = p->status();
125  double momentum = p->momentum().rho();
126  double abseta = fabs(p->momentum().eta());
127 
128  // only consider stable, charged particles
129  if(abs(charge3)==3 && status==1 && momentum>MinIsolTrackMom_ && abseta<MaxSeedEta_+0.5) {
130  chargedParticles.push_back(p);
131  if(momentum>MinSeedMom_ && abseta<MaxSeedEta_) {
132  seeds.push_back(p);
133  }
134  }
135  }
136 
137  // loop over all the seeds and see if any of them are isolated
138  for(std::vector<const HepMC::GenParticle *>::const_iterator it1=seeds.begin(); it1!=seeds.end(); ++it1) {
139  const HepMC::GenParticle *p1=*it1;
140 
141  std::pair<double,double> EtaPhi1=GetEtaPhiAtEcal(p1->momentum().eta(),
142  p1->momentum().phi(),
143  p1->momentum().perp(),
144  (pdt->particle(p1->pdg_id()))->ID().threeCharge()/3,
145  0.0);
146 
147  // loop over all of the other charged particles in the event, and see if any are close by
148  bool failsIso=false;
149  for(std::vector<const HepMC::GenParticle *>::const_iterator it2=chargedParticles.begin(); it2!=chargedParticles.end(); ++it2) {
150  const HepMC::GenParticle *p2=*it2;
151 
152  // don't consider the seed particle among the other charge particles
153  if(p1==p2) continue;
154 
155  std::pair<double,double> EtaPhi2=GetEtaPhiAtEcal(p2->momentum().eta(),
156  p2->momentum().phi(),
157  p2->momentum().perp(),
158  (pdt->particle(p2->pdg_id()))->ID().threeCharge()/3,
159  0.0);
160 
161  // find out how far apart the particles are
162  // if the seed fails the isolation requirement, try a different seed
163  // occasionally allow a seed to pass to isolation requirement
164  if(getDistInCM(EtaPhi1.first, EtaPhi1.second, EtaPhi2.first, EtaPhi2.second) < IsolCone_ &&
166  failsIso=true;
167  break;
168  }
169  }
170 
171  if(!failsIso) return true;
172 
173  } //loop over seeds
174 
175  return false;
176 }
uint32_t ID
Definition: Definitions.h:26
#define abs(x)
Definition: mlp_lapack.h:159
void getData(T &iHolder) const
Definition: EventSetup.h:67
double p2[4]
Definition: TauolaWrapper.h:90
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
static double getDistInCM(double eta1, double phi1, double eta2, double phi2)
double p1[4]
Definition: TauolaWrapper.h:89
tuple status
Definition: ntuplemaker.py:245
static std::pair< double, double > GetEtaPhiAtEcal(double etaIP, double phiIP, double pT, int charge, double vtxZ)
double PythiaFilterIsolatedTrack::getDistInCM ( double  eta1,
double  phi1,
double  eta2,
double  phi2 
)
static

Definition at line 63 of file PythiaFilterIsolatedTrack.cc.

References funct::cos(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, mathSSE::sqrt(), and detailsBasic3DVector::z.

Referenced by filter().

64 {
65  double dR, Rec;
66  if (fabs(eta1)<1.479) Rec=129;
67  else Rec=317;
68  double ce1=cosh(eta1);
69  double ce2=cosh(eta2);
70  double te1=tanh(eta1);
71  double te2=tanh(eta2);
72 
73  double z=cos(phi1-phi2)/ce1/ce2+te1*te2;
74  if(z!=0) dR=fabs(Rec*ce1*sqrt(1./z/z-1.));
75  else dR=999999.;
76  return dR;
77 }
double double double z
T sqrt(T t)
Definition: SSEVec.h:46
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
std::pair< double, double > PythiaFilterIsolatedTrack::GetEtaPhiAtEcal ( double  etaIP,
double  phiIP,
double  pT,
int  charge,
double  vtxZ 
)
static

Definition at line 14 of file PythiaFilterIsolatedTrack.cc.

References alpha, DeDxDiscriminatorTools::charge(), SiPixelRawToDigiRegional_cfi::deltaPhi, create_public_lumi_plots::exp, create_public_lumi_plots::log, funct::sin(), funct::tan(), theta(), and detailsBasic3DVector::z.

Referenced by filter().

15 {
16  double deltaPhi;
17  double etaEC=100;
18  double phiEC=100;
19  double Rcurv=pT*33.3*100/38; //r(m)=pT(GeV)*33.3/B(kG)
20  double ecDist=317; //distance to ECAL andcap from IP (cm), 317 - ecal (not preshower), preshower -300
21  double ecRad=129; //radius of ECAL barrel (cm)
22  double theta=2*atan(exp(-etaIP));
23  double zNew;
24  if (theta>0.5*acos(-1)) theta=acos(-1)-theta;
25  if (fabs(etaIP)<1.479) {
26  deltaPhi=-charge*asin(0.5*ecRad/Rcurv);
27  double alpha1=2*asin(0.5*ecRad/Rcurv);
28  double z=ecRad/tan(theta);
29  if (etaIP>0) zNew=z*(Rcurv*alpha1)/ecRad+vtxZ; //new z-coordinate of track
30  else zNew=-z*(Rcurv*alpha1)/ecRad+vtxZ; //new z-coordinate of track
31  double zAbs=fabs(zNew);
32  if (zAbs<ecDist) {
33  etaEC=-log(tan(0.5*atan(ecRad/zAbs)));
34  deltaPhi=-charge*asin(0.5*ecRad/Rcurv);
35  }
36  if (zAbs>ecDist) {
37  zAbs=(fabs(etaIP)/etaIP)*ecDist;
38  double Zflight=fabs(zAbs-vtxZ);
39  double alpha=(Zflight*ecRad)/(z*Rcurv);
40  double Rec=2*Rcurv*sin(alpha/2);
41  deltaPhi=-charge*alpha/2;
42  etaEC=-log(tan(0.5*atan(Rec/ecDist)));
43  }
44  } else {
45  zNew=(fabs(etaIP)/etaIP)*ecDist;
46  double Zflight=fabs(zNew-vtxZ);
47  double Rvirt=fabs(Zflight*tan(theta));
48  double Rec=2*Rcurv*sin(Rvirt/(2*Rcurv));
49  deltaPhi=-(charge)*(Rvirt/(2*Rcurv));
50  etaEC=-log(tan(0.5*atan(Rec/ecDist)));
51  }
52 
53  if (zNew<0) etaEC=-etaEC;
54  phiEC=phiIP+deltaPhi;
55 
56  if (phiEC<-acos(-1)) phiEC=2*acos(-1)+phiEC;
57  if (phiEC>acos(-1)) phiEC=-2*acos(-1)+phiEC;
58 
59  std::pair<double,double> retVal(etaEC,phiEC);
60  return retVal;
61 }
float alpha
Definition: AMPTWrapper.h:95
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
double charge(const std::vector< uint8_t > &Ampls)
double double double z
Tan< T >::type tan(const T &t)
Definition: Tan.h:22

Member Data Documentation

CLHEP::RandFlat* PythiaFilterIsolatedTrack::flatDistribution_
private
double PythiaFilterIsolatedTrack::IsolCone_
private

Definition at line 52 of file PythiaFilterIsolatedTrack.h.

Referenced by filter().

double PythiaFilterIsolatedTrack::MaxSeedEta_
private

Definition at line 49 of file PythiaFilterIsolatedTrack.h.

Referenced by filter().

double PythiaFilterIsolatedTrack::MinIsolTrackMom_
private

Definition at line 51 of file PythiaFilterIsolatedTrack.h.

Referenced by filter().

double PythiaFilterIsolatedTrack::MinSeedMom_
private

Definition at line 50 of file PythiaFilterIsolatedTrack.h.

Referenced by filter().

std::string PythiaFilterIsolatedTrack::ModuleLabel_
private

Definition at line 48 of file PythiaFilterIsolatedTrack.h.

Referenced by filter().

double PythiaFilterIsolatedTrack::PixelEfficiency_
private

Definition at line 53 of file PythiaFilterIsolatedTrack.h.

Referenced by filter().

edm::Service<edm::RandomNumberGenerator> PythiaFilterIsolatedTrack::rng_
private

Definition at line 56 of file PythiaFilterIsolatedTrack.h.

Referenced by PythiaFilterIsolatedTrack().