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 Member Functions | Private Attributes
EEBadScFilter Class Reference
Inheritance diagram for EEBadScFilter:
edm::EDFilter edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 EEBadScFilter (const edm::ParameterSet &iConfig)
 
 ~EEBadScFilter ()
 
- 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 ()
 

Private Member Functions

virtual bool filter (edm::Event &iEvent, const edm::EventSetup &iSetup)
 
virtual void scan5x5 (const DetId &det, const edm::Handle< EcalRecHitCollection > &hits, const edm::ESHandle< CaloTopology > &caloTopo, const edm::ESHandle< CaloGeometry > &geometry, int &nHits, float &totEt)
 

Private Attributes

const std::vector< int > badsc_
 
const bool debug_
 
const edm::InputTag eeRHSrc_
 
const double Emin_
 
const double EtminSC_
 
const int nBadHitsSC_
 
const int side_
 
const bool taggingMode_
 

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
 
- 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::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

Definition at line 36 of file EEBadScFilter.cc.

Constructor & Destructor Documentation

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

Definition at line 71 of file EEBadScFilter.cc.

72  : eeRHSrc_ (iConfig.getParameter<edm::InputTag>("EERecHitSource"))
73  , Emin_ (iConfig.getParameter<double>("EminHit"))
74  , EtminSC_ (iConfig.getParameter<double>("EtminSC"))
75  , side_ (iConfig.getParameter<int>("SCsize"))
76  , nBadHitsSC_ (iConfig.getParameter<int>("nBadHitsSC"))
77  , badsc_ (iConfig.getParameter<std::vector<int> >("badscEE"))
78  , taggingMode_ (iConfig.getParameter<bool>("taggingMode"))
79  , debug_ (iConfig.getParameter<bool>("debug"))
80 {
81  produces<bool>();
82 }
T getParameter(std::string const &) const
const double Emin_
const std::vector< int > badsc_
const bool debug_
const int nBadHitsSC_
const bool taggingMode_
const edm::InputTag eeRHSrc_
const int side_
const double EtminSC_
EEBadScFilter::~EEBadScFilter ( )
inline

Definition at line 41 of file EEBadScFilter.cc.

41 {}

Member Function Documentation

bool EEBadScFilter::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDFilter.

Definition at line 135 of file EEBadScFilter.cc.

References badsc_, gather_cfg::cout, debug_, eeRHSrc_, EtminSC_, edm::EventSetup::get(), edm::Event::getByLabel(), nBadHitsSC_, edm::Event::put(), scan5x5(), and taggingMode_.

135  {
136 
137 
138  // load required collections
139 
140 
141  // EE rechit collection
143  iEvent.getByLabel(eeRHSrc_, eeRHs);
144 
145  // Calo Geometry - needed for computing E_t
147  iSetup.get<CaloGeometryRecord>().get(pG);
148 
149  // Calo Toplology - needed for navigating the 5x5 xtal array around the centre of a SC
150  edm::ESHandle<CaloTopology> pTopology;
151  iSetup.get<CaloTopologyRecord>().get(pTopology);
152 
153  // by default the event is OK
154  bool pass = true;
155 
156 
157  // set discriminating variables to zero
158  int nhits=0;
159  float totEt=0.0;
160 
161 
162  // define detid variables and ix,iy,iz coordinates
163 
164  EEDetId scdet;
165  DetId det;
166 
167  int ix,iy,iz;
168 
169  ix=0,iy=0,iz=0;
170 
171 
172  // loop over the list of bad SCs (defined in the python file)
173 
174  for (std::vector<int>::const_iterator scit = badsc_.begin(); scit != badsc_.end(); ++ scit) {
175 
176 
177 
178  // unpack the SC coordinates from the python file into ix,iy,iz
179 
180  iz=int(*scit/1000000);
181  iy=*scit%100*iz;
182  ix=int((*scit-iy-1000000*iz)/1000)*iz;
183 
184  // make the DetId from these coordinates
185  scdet=EEDetId(ix,iy,iz);
186  det=scdet;
187 
188  // loop over the 5x5 SC centered on this DetId and fill discriminating variables
189 
190  scan5x5(det,eeRHs,pTopology,pG,nhits,totEt);
191 
192  // print some debug info
193 
194  if (debug_) {
195  std::cout << "EEBadScFilter.cc: SCID=" << *scit << std::endl;
196  std::cout << "EEBadScFilter.cc: ix=" << ix << " iy=" << iy << " iz=" << iz << std::endl;
197  std::cout << "EEBadScFilter.cc: Et(5x5)=" << totEt << " nbadhits=" << nhits << std::endl;
198  }
199 
200 
201  // if 5x5 transverse energy is above threshold and number of bad hits above threshold
202  // event is bad
203 
204  if (totEt>EtminSC_ && nhits>=nBadHitsSC_) pass=false;
205 
206 
207  }
208 
209  // print the decision if event is bad
210  if (pass==false && debug_) std::cout << "EEBadScFilter.cc: REJECT EVENT!!!" << std::endl;
211 
212 
213  iEvent.put( std::auto_ptr<bool>(new bool(pass)) );
214 
215  // return the decision
216 
217  return taggingMode_ || pass;
218 }
virtual void scan5x5(const DetId &det, const edm::Handle< EcalRecHitCollection > &hits, const edm::ESHandle< CaloTopology > &caloTopo, const edm::ESHandle< CaloGeometry > &geometry, int &nHits, float &totEt)
const std::vector< int > badsc_
const bool debug_
const int nBadHitsSC_
const bool taggingMode_
const edm::InputTag eeRHSrc_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
Definition: DetId.h:20
const T & get() const
Definition: EventSetup.h:55
const double EtminSC_
tuple cout
Definition: gather_cfg.py:121
void EEBadScFilter::scan5x5 ( const DetId det,
const edm::Handle< EcalRecHitCollection > &  hits,
const edm::ESHandle< CaloTopology > &  caloTopo,
const edm::ESHandle< CaloGeometry > &  geometry,
int &  nHits,
float &  totEt 
)
privatevirtual

Definition at line 85 of file EEBadScFilter.cc.

References EcalRecHit::checkFlag(), Emin_, CaloRecHit::energy(), CaloNavigator< T >::home(), i, j, EcalRecHit::kGood, CaloNavigator< T >::offsetBy(), AlCaHLTBitMon_ParallelJobs::p, and side_.

Referenced by filter().

86 {
87 
88  // function to compute: total transverse energy in a given supercrystal (totEt)
89  // number of hits with E>Emin_ and rechit flag != kGood (nHits)
90  // bad events have large totEt and many high energy hits with rechit flags !kGood
91 
92  nHits = 0;
93  totEt = 0;
94 
95  // navigator to define a 5x5 region around the input DetId
96 
97  CaloNavigator<DetId> cursor = CaloNavigator<DetId>(det,caloTopo->getSubdetectorTopology(det));
98 
99  // loop over a 5x5 array centered on the input DetId
100 
101  for(int j=side_/2; j>=-side_/2; --j)
102  {
103  for(int i=-side_/2; i<=side_/2; ++i)
104  {
105  cursor.home();
106  cursor.offsetBy(i,j);
107  if(hits->find(*cursor)!=hits->end()) // if hit exists in the rechit collection
108  {
109  EcalRecHit tmpHit = *hits->find(*cursor); // get rechit with detID at cursor
110 
111 
112  const GlobalPoint p ( geometry->getPosition(*cursor) ) ; // calculate Et of the rechit
113  TVector3 hitPos(p.x(),p.y(),p.z());
114  hitPos *= 1.0/hitPos.Mag();
115  hitPos *= tmpHit.energy();
116  float rechitEt = hitPos.Pt();
117 
118  //--- add rechit E_t to the total for this supercrystal
119  totEt += rechitEt;
120 
121  // increment nHits if E>Emin and rechit flag is not kGood
122  if(tmpHit.energy()>Emin_ && !tmpHit.checkFlag(EcalRecHit::kGood))nHits++;
123 
124  }
125  }
126  }
127 
128 
129 }
int i
Definition: DBlmapReader.cc:9
void home() const
move the navigator back to the starting point
const double Emin_
bool checkFlag(int flag) const
check if the flag is true
Definition: EcalRecHit.h:102
float energy() const
Definition: CaloRecHit.h:19
virtual T offsetBy(int deltaX, int deltaY) const
Free movement of arbitray steps.
const int side_
int j
Definition: DBlmapReader.cc:9

Member Data Documentation

const std::vector<int> EEBadScFilter::badsc_
private

Definition at line 63 of file EEBadScFilter.cc.

Referenced by filter().

const bool EEBadScFilter::debug_
private

Definition at line 66 of file EEBadScFilter.cc.

Referenced by filter().

const edm::InputTag EEBadScFilter::eeRHSrc_
private

Definition at line 56 of file EEBadScFilter.cc.

Referenced by filter().

const double EEBadScFilter::Emin_
private

Definition at line 59 of file EEBadScFilter.cc.

Referenced by scan5x5().

const double EEBadScFilter::EtminSC_
private

Definition at line 60 of file EEBadScFilter.cc.

Referenced by filter().

const int EEBadScFilter::nBadHitsSC_
private

Definition at line 62 of file EEBadScFilter.cc.

Referenced by filter().

const int EEBadScFilter::side_
private

Definition at line 61 of file EEBadScFilter.cc.

Referenced by scan5x5().

const bool EEBadScFilter::taggingMode_
private

Definition at line 65 of file EEBadScFilter.cc.

Referenced by filter().