CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
PiZeroAnalyzer Class Reference

EgammaCoreTools. More...

#include <PiZeroAnalyzer.h>

Inheritance diagram for PiZeroAnalyzer:
DQMEDAnalyzer edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
 PiZeroAnalyzer (const edm::ParameterSet &)
 
 ~PiZeroAnalyzer () override
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &ev, edm::EventSetup const &es) final
 
virtual void analyze (edm::Event const &, edm::EventSetup const &)
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) override
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
 DQMEDAnalyzer (DQMEDAnalyzer const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer &&)=delete
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) override
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) override
 
 ~DQMEDAnalyzer () override=default
 
- Public Member Functions inherited from edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () 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 () 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
 
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)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void makePizero (const edm::EventSetup &es, const edm::Handle< EcalRecHitCollection > eb, const edm::Handle< EcalRecHitCollection > ee)
 

Private Attributes

edm::EDGetTokenT< edm::SortedCollection< EcalRecHit, edm::StrictWeakOrdering< EcalRecHit > > > barrelEcalHits_token_
 
int clusEtaSize_
 
int clusPhiSize_
 
double clusSeedThr_
 parameters needed for pizero finding More...
 
std::stringstream currentFolder_
 
double cutStep_
 
edm::EDGetTokenT< edm::SortedCollection< EcalRecHit, edm::StrictWeakOrdering< EcalRecHit > > > endcapEcalHits_token_
 
std::string fName_
 
MonitorElementhIsoPi0EB_
 
MonitorElementhMinvPi0EB_
 
MonitorElementhPt1Pi0EB_
 
MonitorElementhPt2Pi0EB_
 
MonitorElementhPtPi0EB_
 
double minPhoEtCut_
 
int nEvt_
 
int numberOfSteps_
 
bool ParameterLogWeighted_
 
double ParameterT0_barl_
 
double ParameterW0_
 
double ParameterX0_
 
edm::ParameterSet posCalcParameters_
 
unsigned int prescaleFactor_
 
double seleMinvMaxPi0_
 
double seleMinvMinPi0_
 
double selePi0BeltDeta_
 
double selePi0BeltDR_
 
double selePi0Iso_
 
double selePtGammaOne_
 
double selePtGammaTwo_
 
double selePtPi0_
 
double seleS4S9GammaOne_
 
double seleS4S9GammaTwo_
 
double seleXtalMinEnergy_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase 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::one::EDProducerBase
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 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)
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

EgammaCoreTools.

$Id: PiZeroAnalyzer authors: Nancy Marinelli, U. of Notre Dame, US Jamie Antonelli, U. of Notre Dame, US

Definition at line 76 of file PiZeroAnalyzer.h.

Constructor & Destructor Documentation

PiZeroAnalyzer::PiZeroAnalyzer ( const edm::ParameterSet pset)
explicit

Definition at line 20 of file PiZeroAnalyzer.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

21 {
23  prescaleFactor_ = pset.getUntrackedParameter<int>("prescaleFactor",1);
24 
25  barrelEcalHits_token_ = consumes<edm::SortedCollection<EcalRecHit,edm::StrictWeakOrdering<EcalRecHit> > >(pset.getParameter<edm::InputTag>("barrelEcalHits"));
26  endcapEcalHits_token_ = consumes<edm::SortedCollection<EcalRecHit,edm::StrictWeakOrdering<EcalRecHit> > >(pset.getParameter<edm::InputTag>("endcapEcalHits"));
27 
28  nEvt_=0;
29 
30  // parameters for Pizero finding
31  seleXtalMinEnergy_ = pset.getParameter<double> ("seleXtalMinEnergy");
32  clusSeedThr_ = pset.getParameter<double> ("clusSeedThr");
33  clusEtaSize_ = pset.getParameter<int> ("clusEtaSize");
34  clusPhiSize_ = pset.getParameter<int> ("clusPhiSize");
35  ParameterLogWeighted_ = pset.getParameter<bool> ("ParameterLogWeighted");
36  ParameterX0_ = pset.getParameter<double> ("ParameterX0");
37  ParameterT0_barl_ = pset.getParameter<double> ("ParameterT0_barl");
38  ParameterW0_ = pset.getParameter<double> ("ParameterW0");
39 
40  selePtGammaOne_ = pset.getParameter<double> ("selePtGammaOne");
41  selePtGammaTwo_ = pset.getParameter<double> ("selePtGammaTwo");
42  seleS4S9GammaOne_ = pset.getParameter<double> ("seleS4S9GammaOne");
43  seleS4S9GammaTwo_ = pset.getParameter<double> ("seleS4S9GammaTwo");
44  selePtPi0_ = pset.getParameter<double> ("selePtPi0");
45  selePi0Iso_ = pset.getParameter<double> ("selePi0Iso");
46  selePi0BeltDR_ = pset.getParameter<double> ("selePi0BeltDR");
47  selePi0BeltDeta_ = pset.getParameter<double> ("selePi0BeltDeta");
48  seleMinvMaxPi0_ = pset.getParameter<double> ("seleMinvMaxPi0");
49  seleMinvMinPi0_ = pset.getParameter<double> ("seleMinvMinPi0");
50 
51  posCalcParameters_ = pset.getParameter<edm::ParameterSet>("posCalcParameters");
52 }
T getParameter(std::string const &) const
double clusSeedThr_
parameters needed for pizero finding
T getUntrackedParameter(std::string const &, T const &) const
double selePi0BeltDeta_
edm::EDGetTokenT< edm::SortedCollection< EcalRecHit, edm::StrictWeakOrdering< EcalRecHit > > > barrelEcalHits_token_
bool ParameterLogWeighted_
edm::EDGetTokenT< edm::SortedCollection< EcalRecHit, edm::StrictWeakOrdering< EcalRecHit > > > endcapEcalHits_token_
double seleS4S9GammaOne_
double seleS4S9GammaTwo_
edm::ParameterSet posCalcParameters_
double ParameterT0_barl_
double seleMinvMaxPi0_
double selePtGammaOne_
double selePtGammaTwo_
unsigned int prescaleFactor_
std::string fName_
double seleXtalMinEnergy_
double seleMinvMinPi0_
PiZeroAnalyzer::~PiZeroAnalyzer ( )
override

Definition at line 54 of file PiZeroAnalyzer.cc.

54  {
55 }

Member Function Documentation

void PiZeroAnalyzer::analyze ( const edm::Event e,
const edm::EventSetup esup 
)
override

Definition at line 81 of file PiZeroAnalyzer.cc.

References particleFlowSuperClusterOOTECAL_cff::barrelRecHits, particleFlowSuperClusterOOTECAL_cff::endcapRecHits, edm::Event::getByToken(), edm::EventBase::id(), and edm::HandleBase::isValid().

82 {
83  using namespace edm;
84 
85  if (nEvt_% prescaleFactor_ ) return;
86  nEvt_++;
87  LogInfo("PiZeroAnalyzer") << "PiZeroAnalyzer Analyzing event number: " << e.id() << " Global Counter " << nEvt_ <<"\n";
88 
89  // Get EcalRecHits
90  bool validEcalRecHits=true;
91  Handle<EcalRecHitCollection> barrelHitHandle;
93  e.getByToken(barrelEcalHits_token_, barrelHitHandle);
94  if (!barrelHitHandle.isValid()) {
95  edm::LogError("PhotonProducer") << "Error! Can't get the product: barrelEcalHits_token_";
96  validEcalRecHits=false;
97  }
98 
99  Handle<EcalRecHitCollection> endcapHitHandle;
100  e.getByToken(endcapEcalHits_token_, endcapHitHandle);
102  if (!endcapHitHandle.isValid()) {
103  edm::LogError("PhotonProducer") << "Error! Can't get the product: endcapEcalHits_token_";
104  validEcalRecHits=false;
105  }
106 
107  if (validEcalRecHits) makePizero(esup, barrelHitHandle, endcapHitHandle);
108 }
edm::EDGetTokenT< edm::SortedCollection< EcalRecHit, edm::StrictWeakOrdering< EcalRecHit > > > barrelEcalHits_token_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
void makePizero(const edm::EventSetup &es, const edm::Handle< EcalRecHitCollection > eb, const edm::Handle< EcalRecHitCollection > ee)
edm::EDGetTokenT< edm::SortedCollection< EcalRecHit, edm::StrictWeakOrdering< EcalRecHit > > > endcapEcalHits_token_
bool isValid() const
Definition: HandleBase.h:74
unsigned int prescaleFactor_
edm::EventID id() const
Definition: EventBase.h:60
HLT enums.
void PiZeroAnalyzer::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  ,
edm::EventSetup const &   
)
overridevirtual

Implements DQMEDAnalyzer.

Definition at line 57 of file PiZeroAnalyzer.cc.

References DQMStore::IBooker::book1D(), MonitorElement::setAxisTitle(), and DQMStore::IBooker::setCurrentFolder().

60 {
61  currentFolder_.str("");
62  currentFolder_ << "Egamma/PiZeroAnalyzer/";
63  ibooker.setCurrentFolder(currentFolder_.str());
64 
65  hMinvPi0EB_ = ibooker.book1D("Pi0InvmassEB","Pi0 Invariant Mass in EB",100,0.,0.5);
66  hMinvPi0EB_->setAxisTitle("Inv Mass [GeV] ",1);
67 
68  hPt1Pi0EB_ = ibooker.book1D("Pt1Pi0EB","Pt 1st most energetic Pi0 photon in EB",100,0.,20.);
69  hPt1Pi0EB_->setAxisTitle("1st photon Pt [GeV] ",1);
70 
71  hPt2Pi0EB_ = ibooker.book1D("Pt2Pi0EB","Pt 2nd most energetic Pi0 photon in EB",100,0.,20.);
72  hPt2Pi0EB_->setAxisTitle("2nd photon Pt [GeV] ",1);
73 
74  hPtPi0EB_ = ibooker.book1D("PtPi0EB","Pi0 Pt in EB",100,0.,20.);
75  hPtPi0EB_->setAxisTitle("Pi0 Pt [GeV] ",1);
76 
77  hIsoPi0EB_ = ibooker.book1D("IsoPi0EB","Pi0 Iso in EB",50,0.,1.);
78  hIsoPi0EB_->setAxisTitle("Pi0 Iso",1);
79 }
MonitorElement * hIsoPi0EB_
MonitorElement * hPtPi0EB_
MonitorElement * hMinvPi0EB_
std::stringstream currentFolder_
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:118
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:279
MonitorElement * hPt2Pi0EB_
MonitorElement * hPt1Pi0EB_
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void PiZeroAnalyzer::makePizero ( const edm::EventSetup es,
const edm::Handle< EcalRecHitCollection eb,
const edm::Handle< EcalRecHitCollection ee 
)
private

Definition at line 110 of file PiZeroAnalyzer.cc.

References edm::SortedCollection< T, SORT >::begin(), PositionCalc::Calculate_Location(), funct::cos(), gather_cfg::cout, DetId::Ecal, EcalBarrel, EcalPreshower, edm::SortedCollection< T, SORT >::end(), JetChargeProducer_cfi::exp, edm::EventSetup::get(), CaloGeometry::getSubdetectorGeometry(), CaloTopology::getSubdetectorTopology(), CaloSubdetectorTopology::getWindow(), mps_fire::i, triggerObjects_cff::id, EBDetId::ieta(), EBDetId::iphi(), gen::k, edm::Handle< T >::product(), funct::sin(), and mathSSE::sqrt().

110  {
111  const EcalRecHitCollection *hitCollection_p = rhEB.product();
112 
113  edm::ESHandle<CaloGeometry> geoHandle;
114  es.get<CaloGeometryRecord>().get(geoHandle);
115 
116  edm::ESHandle<CaloTopology> theCaloTopology;
117  es.get<CaloTopologyRecord>().get(theCaloTopology);
118 
119  const CaloSubdetectorTopology *topology_p;
121  const CaloSubdetectorGeometry* geometryES_p = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
122 
123  // Parameters for the position calculation:
124  PositionCalc posCalculator_ = PositionCalc(posCalcParameters_);
125  //
126  std::map<DetId, EcalRecHit> recHitsEB_map;
127  //
128  std::vector<EcalRecHit> seeds;
129 
130  seeds.clear();
131  //
132  vector<EBDetId> usedXtals;
133  usedXtals.clear();
134  //
136  //
137  static const int MAXCLUS = 2000;
138  int nClus=0;
139  vector<float> eClus;
140  vector<float> etClus;
141  vector<float> etaClus;
142  vector<float> phiClus;
143  vector<EBDetId> max_hit;
144  vector< vector<EcalRecHit> > RecHitsCluster;
145  vector<float> s4s9Clus;
146 
147  // find cluster seeds in EB
148  for(itb=rhEB->begin(); itb!=rhEB->end(); ++itb){
149  EBDetId id(itb->id());
150  double energy = itb->energy();
151  if (energy > seleXtalMinEnergy_) {
152  std::pair<DetId, EcalRecHit> map_entry(itb->id(), *itb);
153  recHitsEB_map.insert(map_entry);
154  }
155  if (energy > clusSeedThr_) seeds.push_back(*itb);
156  } // Eb rechits
157 
158  sort(seeds.begin(), seeds.end(), ecalRecHitLess());
159  for (std::vector<EcalRecHit>::iterator itseed=seeds.begin(); itseed!=seeds.end(); itseed++) {
160  EBDetId seed_id = itseed->id();
161  std::vector<EBDetId>::const_iterator usedIds;
162 
163  bool seedAlreadyUsed=false;
164  for(usedIds=usedXtals.begin(); usedIds!=usedXtals.end(); usedIds++){
165  if(*usedIds==seed_id){
166  seedAlreadyUsed=true;
167  //cout<< " Seed with energy "<<itseed->energy()<<" was used !"<<endl;
168  break;
169  }
170  }
171  if(seedAlreadyUsed)continue;
172  topology_p = theCaloTopology->getSubdetectorTopology(DetId::Ecal,EcalBarrel);
173  std::vector<DetId> clus_v = topology_p->getWindow(seed_id,clusEtaSize_,clusPhiSize_);
174  //std::vector<DetId> clus_used;
175  std::vector<std::pair<DetId, float> > clus_used;
176 
177  vector<EcalRecHit> RecHitsInWindow;
178 
179  double simple_energy = 0;
180 
181  for (std::vector<DetId>::iterator det=clus_v.begin(); det!=clus_v.end(); det++) {
182  // EBDetId EBdet = *det;
183  // cout<<" det "<< EBdet<<" ieta "<<EBdet.ieta()<<" iphi "<<EBdet.iphi()<<endl;
184  bool HitAlreadyUsed=false;
185  for(usedIds=usedXtals.begin(); usedIds!=usedXtals.end(); usedIds++){
186  if(*usedIds==*det){
187  HitAlreadyUsed=true;
188  break;
189  }
190  }
191  if(HitAlreadyUsed)continue;
192  if (recHitsEB_map.find(*det) != recHitsEB_map.end()){
193  // cout<<" Used det "<< EBdet<<endl;
194  std::map<DetId, EcalRecHit>::iterator aHit;
195  aHit = recHitsEB_map.find(*det);
196  usedXtals.push_back(*det);
197  RecHitsInWindow.push_back(aHit->second);
198  clus_used.push_back( std::pair<DetId, float>(*det, 1.) );
199  simple_energy = simple_energy + aHit->second.energy();
200  }
201  }
202 
203  math::XYZPoint clus_pos = posCalculator_.Calculate_Location(clus_used,hitCollection_p,geometry_p,geometryES_p);
204  float theta_s = 2. * atan(exp(-clus_pos.eta()));
205  float p0x_s = simple_energy * sin(theta_s) * cos(clus_pos.phi());
206  float p0y_s = simple_energy * sin(theta_s) * sin(clus_pos.phi());
207  // float p0z_s = simple_energy * cos(theta_s);
208  float et_s = sqrt( p0x_s*p0x_s + p0y_s*p0y_s);
209 
210  //cout << " Simple Clustering: E,Et,px,py,pz: "<<simple_energy<<" "<<et_s<<" "<<p0x_s<<" "<<p0y_s<<" "<<endl;
211 
212  eClus.push_back(simple_energy);
213  etClus.push_back(et_s);
214  etaClus.push_back(clus_pos.eta());
215  phiClus.push_back(clus_pos.phi());
216  max_hit.push_back(seed_id);
217  RecHitsCluster.push_back(RecHitsInWindow);
218  //Compute S4/S9 variable
219  //We are not sure to have 9 RecHits so need to check eta and phi:
220  float s4s9_[4];
221  for(int i=0;i<4;i++)s4s9_[i]= itseed->energy();
222  for(unsigned int j=0; j<RecHitsInWindow.size();j++){
223  //cout << " Simple cluster rh, ieta, iphi : "<<((EBDetId)RecHitsInWindow[j].id()).ieta()<<" "<<((EBDetId)RecHitsInWindow[j].id()).iphi()<<endl;
224  if((((EBDetId)RecHitsInWindow[j].id()).ieta() == seed_id.ieta()-1 && seed_id.ieta()!=1 ) || ( seed_id.ieta()==1 && (((EBDetId)RecHitsInWindow[j].id()).ieta() == seed_id.ieta()-2))){
225  if(((EBDetId)RecHitsInWindow[j].id()).iphi() == seed_id.iphi()-1 ||((EBDetId)RecHitsInWindow[j].id()).iphi()-360 == seed_id.iphi()-1 ){
226  s4s9_[0]+=RecHitsInWindow[j].energy();
227  }else{
228  if(((EBDetId)RecHitsInWindow[j].id()).iphi() == seed_id.iphi()){
229  s4s9_[0]+=RecHitsInWindow[j].energy();
230  s4s9_[1]+=RecHitsInWindow[j].energy();
231  }else{
232  if(((EBDetId)RecHitsInWindow[j].id()).iphi() == seed_id.iphi()+1 ||((EBDetId)RecHitsInWindow[j].id()).iphi()-360 == seed_id.iphi()+1 ){
233  s4s9_[1]+=RecHitsInWindow[j].energy();
234  }
235  }
236  }
237  }else{
238  if(((EBDetId)RecHitsInWindow[j].id()).ieta() == seed_id.ieta()){
239  if(((EBDetId)RecHitsInWindow[j].id()).iphi() == seed_id.iphi()-1 ||((EBDetId)RecHitsInWindow[j].id()).iphi()-360 == seed_id.iphi()-1 ){
240  s4s9_[0]+=RecHitsInWindow[j].energy();
241  s4s9_[3]+=RecHitsInWindow[j].energy();
242  }else{
243  if(((EBDetId)RecHitsInWindow[j].id()).iphi() == seed_id.iphi()+1 ||((EBDetId)RecHitsInWindow[j].id()).iphi()-360 == seed_id.iphi()+1 ){
244  s4s9_[1]+=RecHitsInWindow[j].energy();
245  s4s9_[2]+=RecHitsInWindow[j].energy();
246  }
247  }
248  }else{
249  if((((EBDetId)RecHitsInWindow[j].id()).ieta() == seed_id.ieta()+1 && seed_id.ieta()!=-1 ) || ( seed_id.ieta()==-1 && (((EBDetId)RecHitsInWindow[j].id()).ieta() == seed_id.ieta()+2))){
250  if(((EBDetId)RecHitsInWindow[j].id()).iphi() == seed_id.iphi()-1 ||((EBDetId)RecHitsInWindow[j].id()).iphi()-360 == seed_id.iphi()-1 ){
251  s4s9_[3]+=RecHitsInWindow[j].energy();
252  }else{
253  if(((EBDetId)RecHitsInWindow[j].id()).iphi() == seed_id.iphi()){
254  s4s9_[2]+=RecHitsInWindow[j].energy();
255  s4s9_[3]+=RecHitsInWindow[j].energy();
256  }else{
257  if(((EBDetId)RecHitsInWindow[j].id()).iphi() == seed_id.iphi()+1 ||((EBDetId)RecHitsInWindow[j].id()).iphi()-360 == seed_id.iphi()+1 ){
258  s4s9_[2]+=RecHitsInWindow[j].energy();
259  }
260  }
261  }
262  }else{
263  cout<<" (EBDetId)RecHitsInWindow[j].id()).ieta() "<<((EBDetId)RecHitsInWindow[j].id()).ieta()<<" seed_id.ieta() "<<seed_id.ieta()<<endl;
264  cout<<" Problem with S4 calculation "<<endl;return;
265  }
266  }
267  }
268  }
269  s4s9Clus.push_back(*max_element( s4s9_,s4s9_+4)/simple_energy);
270  // cout<<" s4s9Clus[0] "<<s4s9_[0]/simple_energy<<" s4s9Clus[1] "<<s4s9_[1]/simple_energy<<" s4s9Clus[2] "<<s4s9_[2]/simple_energy<<" s4s9Clus[3] "<<s4s9_[3]/simple_energy<<endl;
271  // cout<<" Max "<<*max_element( s4s9_,s4s9_+4)/simple_energy<<endl;
272  nClus++;
273  if (nClus == MAXCLUS) return;
274  } // End loop over seed clusters
275 
276  // cout<< " Pi0 clusters: "<<nClus<<endl;
277 
278  // Selection, based on Simple clustering
279  //pi0 candidates
280  static const int MAXPI0S = 200;
281  int npi0_s=0;
282 
283  vector<EBDetId> scXtals;
284  scXtals.clear();
285 
286  if (nClus <= 1) return;
287  for(Int_t i=0 ; i<nClus ; i++){
288  for(Int_t j=i+1 ; j<nClus ; j++){
289  // cout<<" i "<<i<<" etClus[i] "<<etClus[i]<<" j "<<j<<" etClus[j] "<<etClus[j]<<endl;
290  if( etClus[i]>selePtGammaOne_ && etClus[j]>selePtGammaTwo_ && s4s9Clus[i]>seleS4S9GammaOne_ && s4s9Clus[j]>seleS4S9GammaTwo_){
291  float theta_0 = 2. * atan(exp(-etaClus[i]));
292  float theta_1 = 2. * atan(exp(-etaClus[j]));
293 
294  float p0x = eClus[i] * sin(theta_0) * cos(phiClus[i]);
295  float p1x = eClus[j] * sin(theta_1) * cos(phiClus[j]);
296  float p0y = eClus[i] * sin(theta_0) * sin(phiClus[i]);
297  float p1y = eClus[j] * sin(theta_1) * sin(phiClus[j]);
298  float p0z = eClus[i] * cos(theta_0);
299  float p1z = eClus[j] * cos(theta_1);
300 
301  float pt_pi0 = sqrt( (p0x+p1x)*(p0x+p1x) + (p0y+p1y)*(p0y+p1y));
302  // cout<<" pt_pi0 "<<pt_pi0<<endl;
303  if (pt_pi0 < selePtPi0_)continue;
304  float m_inv = sqrt ( (eClus[i] + eClus[j])*(eClus[i] + eClus[j]) - (p0x+p1x)*(p0x+p1x) - (p0y+p1y)*(p0y+p1y) - (p0z+p1z)*(p0z+p1z) );
305  if ( (m_inv<seleMinvMaxPi0_) && (m_inv>seleMinvMinPi0_) ){
306 
307  //New Loop on cluster to measure isolation:
308  vector<int> IsoClus;
309  IsoClus.clear();
310  float Iso = 0;
311  TVector3 pi0vect = TVector3((p0x+p1x), (p0y+p1y), (p0z+p1z));
312  for(Int_t k=0 ; k<nClus ; k++){
313  if(k==i || k==j)continue;
314  TVector3 Clusvect = TVector3(eClus[k] * sin(2. * atan(exp(-etaClus[k]))) * cos(phiClus[k]), eClus[k] * sin(2. * atan(exp(-etaClus[k]))) * sin(phiClus[k]) , eClus[k] * cos(2. * atan(exp(-etaClus[k]))));
315  float dretaclpi0 = fabs(etaClus[k] - pi0vect.Eta());
316  float drclpi0 = Clusvect.DeltaR(pi0vect);
317 
318  if((drclpi0<selePi0BeltDR_) && (dretaclpi0<selePi0BeltDeta_) ){
319 
320  Iso = Iso + etClus[k];
321  IsoClus.push_back(k);
322  }
323  }
324 
325 
326  if(Iso/pt_pi0<selePi0Iso_){
327 
328  hMinvPi0EB_->Fill(m_inv);
329  hPt1Pi0EB_->Fill(etClus[i]);
330  hPt2Pi0EB_->Fill(etClus[j]);
331  hPtPi0EB_->Fill(pt_pi0);
332  hIsoPi0EB_->Fill(Iso/pt_pi0);
333 
334 
335  npi0_s++;
336  }
337 
338  if(npi0_s == MAXPI0S) return;
339  }
340  }
341  }
342  }
343 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:44
double clusSeedThr_
parameters needed for pizero finding
double selePi0BeltDeta_
MonitorElement * hIsoPi0EB_
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
MonitorElement * hPtPi0EB_
MonitorElement * hMinvPi0EB_
std::vector< EcalRecHit >::const_iterator const_iterator
double seleS4S9GammaOne_
double seleS4S9GammaTwo_
edm::ParameterSet posCalcParameters_
void Fill(long long x)
int iphi() const
get the crystal iphi
Definition: EBDetId.h:53
double seleMinvMaxPi0_
T sqrt(T t)
Definition: SSEVec.h:18
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
double selePtGammaOne_
double selePtGammaTwo_
int ieta() const
get the crystal ieta
Definition: EBDetId.h:51
int k[5][pyjets_maxn]
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
const T & get() const
Definition: EventSetup.h:59
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:25
math::XYZPoint Calculate_Location(const HitsAndFractions &iDetIds, const edm::SortedCollection< HitType > *iRecHits, const CaloSubdetectorGeometry *iSubGeom, const CaloSubdetectorGeometry *iESGeom=0)
Definition: PositionCalc.h:68
MonitorElement * hPt2Pi0EB_
MonitorElement * hPt1Pi0EB_
double seleXtalMinEnergy_
double seleMinvMinPi0_

Member Data Documentation

edm::EDGetTokenT<edm::SortedCollection<EcalRecHit,edm::StrictWeakOrdering<EcalRecHit> > > PiZeroAnalyzer::barrelEcalHits_token_
private

Definition at line 95 of file PiZeroAnalyzer.h.

int PiZeroAnalyzer::clusEtaSize_
private

Definition at line 104 of file PiZeroAnalyzer.h.

int PiZeroAnalyzer::clusPhiSize_
private

Definition at line 105 of file PiZeroAnalyzer.h.

double PiZeroAnalyzer::clusSeedThr_
private

parameters needed for pizero finding

Definition at line 103 of file PiZeroAnalyzer.h.

std::stringstream PiZeroAnalyzer::currentFolder_
private

Definition at line 125 of file PiZeroAnalyzer.h.

double PiZeroAnalyzer::cutStep_
private

Definition at line 99 of file PiZeroAnalyzer.h.

edm::EDGetTokenT<edm::SortedCollection<EcalRecHit,edm::StrictWeakOrdering<EcalRecHit> > > PiZeroAnalyzer::endcapEcalHits_token_
private

Definition at line 96 of file PiZeroAnalyzer.h.

std::string PiZeroAnalyzer::fName_
private

Definition at line 88 of file PiZeroAnalyzer.h.

MonitorElement* PiZeroAnalyzer::hIsoPi0EB_
private

Definition at line 130 of file PiZeroAnalyzer.h.

MonitorElement* PiZeroAnalyzer::hMinvPi0EB_
private

Definition at line 127 of file PiZeroAnalyzer.h.

MonitorElement* PiZeroAnalyzer::hPt1Pi0EB_
private

Definition at line 128 of file PiZeroAnalyzer.h.

MonitorElement* PiZeroAnalyzer::hPt2Pi0EB_
private

Definition at line 129 of file PiZeroAnalyzer.h.

MonitorElement* PiZeroAnalyzer::hPtPi0EB_
private

Definition at line 131 of file PiZeroAnalyzer.h.

double PiZeroAnalyzer::minPhoEtCut_
private

Definition at line 97 of file PiZeroAnalyzer.h.

int PiZeroAnalyzer::nEvt_
private

Definition at line 91 of file PiZeroAnalyzer.h.

int PiZeroAnalyzer::numberOfSteps_
private

Definition at line 100 of file PiZeroAnalyzer.h.

bool PiZeroAnalyzer::ParameterLogWeighted_
private

Definition at line 109 of file PiZeroAnalyzer.h.

double PiZeroAnalyzer::ParameterT0_barl_
private

Definition at line 111 of file PiZeroAnalyzer.h.

double PiZeroAnalyzer::ParameterW0_
private

Definition at line 112 of file PiZeroAnalyzer.h.

double PiZeroAnalyzer::ParameterX0_
private

Definition at line 110 of file PiZeroAnalyzer.h.

edm::ParameterSet PiZeroAnalyzer::posCalcParameters_
private

Definition at line 93 of file PiZeroAnalyzer.h.

unsigned int PiZeroAnalyzer::prescaleFactor_
private

Definition at line 89 of file PiZeroAnalyzer.h.

double PiZeroAnalyzer::seleMinvMaxPi0_
private

Definition at line 122 of file PiZeroAnalyzer.h.

double PiZeroAnalyzer::seleMinvMinPi0_
private

Definition at line 123 of file PiZeroAnalyzer.h.

double PiZeroAnalyzer::selePi0BeltDeta_
private

Definition at line 120 of file PiZeroAnalyzer.h.

double PiZeroAnalyzer::selePi0BeltDR_
private

Definition at line 119 of file PiZeroAnalyzer.h.

double PiZeroAnalyzer::selePi0Iso_
private

Definition at line 121 of file PiZeroAnalyzer.h.

double PiZeroAnalyzer::selePtGammaOne_
private

Definition at line 114 of file PiZeroAnalyzer.h.

double PiZeroAnalyzer::selePtGammaTwo_
private

Definition at line 115 of file PiZeroAnalyzer.h.

double PiZeroAnalyzer::selePtPi0_
private

Definition at line 116 of file PiZeroAnalyzer.h.

double PiZeroAnalyzer::seleS4S9GammaOne_
private

Definition at line 117 of file PiZeroAnalyzer.h.

double PiZeroAnalyzer::seleS4S9GammaTwo_
private

Definition at line 118 of file PiZeroAnalyzer.h.

double PiZeroAnalyzer::seleXtalMinEnergy_
private

Definition at line 107 of file PiZeroAnalyzer.h.