CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CMS_2011_I930319.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 #include "Rivet/Analysis.hh"
4 #include "Rivet/RivetAIDA.hh"
5 #include "Rivet/Tools/Logging.hh"
6 #include "Rivet/Projections/FinalState.hh"
7 #include "Rivet/Projections/ChargedFinalState.hh"
8 #include "Rivet/Projections/FastJets.hh"
9 #include "Rivet/Projections/Beam.hh"
10 #include "Rivet/Projections/VetoedFinalState.hh"
11 
12 namespace Rivet
13 {
14  class CMS_2011_I930319 : public Analysis
15  {
16 
17  public:
18 
19 
22  : Analysis("CMS_2011_I930319")
23 
24  {
25  setBeams(PROTON,PROTON);
26  }
27 
28  //counters
29  double evcounter_mb;
31 
32 
33  void init() override {
34  const FinalState fs(-6.0,6.0,0.0*GeV);
35  addProjection(fs, "FS");
36  addProjection(FastJets(fs, FastJets::ANTIKT, 0.5), "Jets");
37 
38  VetoedFinalState fsv(fs);
39  fsv.vetoNeutrinos();
40  fsv.addVetoPairDetail(MUON, 0.0*GeV, 99999.9*GeV);
41  addProjection(fsv, "fsv");
42 
43  // for the MB ND selection
44  const ChargedFinalState fschrgd(-6.0,6.0,0.0*GeV);
45  addProjection(fschrgd, "fschrgd");
46  VetoedFinalState fschrgdv(fschrgd);
47  fschrgdv.vetoNeutrinos();
48  addProjection(fschrgdv, "fschrgdv");
49 
50  evcounter_mb = 0;
51  evcounter_dijet = 0;
52 
53  if(fuzzyEquals(sqrtS()/GeV, 900, 1E-3)){
54  _hist_mb_09 = bookHistogram1D(1,1,1); // energy flow in MB, 0.9 TeV
55  _hist_dijet_09 = bookHistogram1D(2,1,1); // energy flow in dijet events, 0.9 TeV
56  }
57 
58  if(fuzzyEquals(sqrtS()/GeV, 7000, 1E-3)){
59  _hist_mb_7 = bookHistogram1D(3,1,1); // energy flow in MB, 7 TeV
60  _hist_dijet_7 = bookHistogram1D(4,1,1); // energy flow in dijet events, 7 TeV
61  }
62 
63  }
64 
65  void analyze(const Event& event) override {
66  const double weight = event.weight();
67 
68  // Skip if the event is empty
69  const FinalState& fsv = applyProjection<FinalState>(event, "fsv");
70  if (fsv.empty()) vetoEvent;
71 
72 
73 
74  // Veto diffraction according to defined hadron level.
75  double count_chrg_forward = 0;
76  double count_chrg_backward = 0;
77  const FinalState& fschrgdv = applyProjection<FinalState>(event, "fschrgdv");
78 
79  foreach (const Particle& p, fschrgdv.particles()) {
80  if( 3.9 < p.momentum().pseudorapidity() &&
81  p.momentum().pseudorapidity() < 4.4){count_chrg_forward++;}
82  if(-4.4 < p.momentum().pseudorapidity() &&
83  p.momentum().pseudorapidity() < -3.9){count_chrg_backward++;}
84 
85  }
86 
87  if(count_chrg_forward*count_chrg_backward==0) {
88  vetoEvent;
89  }
90 
91  const FastJets& jetpro = applyProjection<FastJets>(event, "Jets");
92  const Jets& jets = jetpro.jetsByPt(7.0*GeV);
93 
94 
95  // ============================== MINIMUM BIAS EVENTS
96 
97  //loop over particles to calculate the energy
99  foreach (const Particle& p, fsv.particles()) {
100 
101  if(fuzzyEquals(sqrtS()/GeV, 900, 1E-3)) {_hist_mb_09 ->
102  fill(fabs(p.momentum().pseudorapidity()), weight * p.momentum().E()/GeV );}
103 
104  if(fuzzyEquals(sqrtS()/GeV, 7000, 1E-3)) {_hist_mb_7 ->
105  fill(fabs(p.momentum().pseudorapidity()), weight * p.momentum().E()/GeV );}
106 
107  }
108 
109 
110  // ============================== DIJET EVENTS
111 
112  if(jets.size()>1){
113 
114  signed int index_1 = -1; //for the jet with the 1.highest pT
115  signed int index_2 = -1; //for the jet with the 2.highest pT
116 
117  double tempmax_1 = -100;
118  double tempmax_2 = -100;
119 
120  //jet with the 1.highest pt
121  for(signed int ijets = 0; ijets < (int)jets.size(); ijets++){
122  if(tempmax_1 == -100 || tempmax_1 < jets[ijets].momentum().pT()/GeV)
123  {
124  tempmax_1 = jets[ijets].momentum().pT()/GeV;
125  index_1 = ijets;
126  }
127  }
128 
129 
130  //jet with the 2. highest pt
131  for(signed int ijets = 0; ijets < (int)jets.size(); ijets++){
132  if(tempmax_2 == -100 || tempmax_2 < jets[ijets].momentum().pT()/GeV){
133  if(jets[ijets].momentum().pT()/GeV < tempmax_1){
134  tempmax_2 = jets[ijets].momentum().pT()/GeV;
135  index_2 = ijets;
136  }
137  }
138  }
139 
140 
141  if(index_1 != -1 && index_2 != -1){
142 
143  double diffphi = jets[index_2].momentum().phi() - jets[index_1].momentum().phi();
144  if(diffphi < -PI){ diffphi += 2.0*PI; }
145  if(diffphi > PI){ diffphi -= 2.0*PI; }
146  diffphi = fabs(diffphi);
147 
148 
149  // *******
150  // 900 GeV
151  // *******
152 
153  if(fuzzyEquals(sqrtS()/GeV, 900, 1E-3)){
154 
155  //pt cut
156  if(jets[index_1].momentum().pT()/GeV > 8.0 && jets[index_2].momentum().pT()/GeV >8.0){
157 
158  //eta cut for the central jets
159  if(fabs(jets[index_1].momentum().pseudorapidity()) < 2.5 &&
160  fabs(jets[index_2].momentum().pseudorapidity()) < 2.5){
161 
162  //back to back condition of the jets
163  if(fabs(diffphi-PI) < 1.0){
165 
166  // E-flow
167  foreach (const Particle& p, fsv.particles()){
169  fill(fabs(p.momentum().pseudorapidity()), weight*p.momentum().E()/GeV);
170 
171  }//foreach particle
172  }//if(dphi)
173  }// else (eta cut central region)
174  }//pt cut
175  }// energy
176 
177 
178 
179  // ********
180  // 7000 GeV
181  // ********
182 
183  if(fuzzyEquals(sqrtS()/GeV, 7000, 1E-3)){
184 
185  //pt cut
186  if(jets[index_1].momentum().pT()/GeV > 20.0 && jets[index_2].momentum().pT()/GeV > 20.0){
187 
188  //eta cut for the central jets
189  if(fabs(jets[index_1].momentum().pseudorapidity()) < 2.5 &&
190  fabs(jets[index_2].momentum().pseudorapidity()) < 2.5){
191 
192  //back to back condition of the jets
193  if(fabs(diffphi-PI) < 1.0){
195 
196  //E-flow
197  foreach (const Particle& p, fsv.particles()){
198  _hist_dijet_7->
199  fill(fabs(p.momentum().pseudorapidity()), weight*p.momentum().E()/GeV);
200 
201  }//foreach particle
202  }//if(dphi)
203  }// else (eta cut central region)
204  }//pt cut
205  }// energy
206 
207  }// if index
208  }// analysis
209  }
210 
211 
212  void finalize() override {
213 
214  const double norm_dijet = evcounter_dijet*2.0 ; //AK norm factor 2 for the +/- region
215  const double norm_mb = evcounter_mb*2.0 ;
216 
217  if(fuzzyEquals(sqrtS()/GeV, 900, 1E-3)){
218  scale(_hist_mb_09, 1.0/norm_mb);
219  scale(_hist_dijet_09, 1.0/norm_dijet);
220  }
221 
222  if(fuzzyEquals(sqrtS()/GeV, 7000, 1E-3)){
223  scale(_hist_dijet_7, 1.0/norm_dijet);
224  scale(_hist_mb_7, 1.0/norm_mb);
225  }
226 
227  getLog() << Log::INFO << " " << endl;
228  getLog() << Log::INFO << "Number of MB events: " << norm_mb << endl;
229  getLog() << Log::INFO << "Number of di-jet events : " << norm_dijet <<endl;
230 
231  }
232 
233 
234  private:
235 
236  AIDA::IHistogram1D *_hist_mb_09;
237  AIDA::IHistogram1D *_hist_dijet_09;
238  AIDA::IHistogram1D *_hist_mb_7;
239  AIDA::IHistogram1D *_hist_dijet_7;
240 
241 
242  };
243 
244 
245 
246  // This global object acts as a hook for the plugin system
247  AnalysisBuilder<CMS_2011_I930319> plugin_CMS_2011_I930319;
248 
249 
250 
251 }
const double GeV
Definition: MathUtil.h:16
string fill
Definition: lumiContext.py:319
#define PI
AIDA::IHistogram1D * _hist_dijet_7
AIDA::IHistogram1D * _hist_mb_09
AIDA::IHistogram1D * _hist_dijet_09
vector< PseudoJet > jets
tuple Jets
Definition: METSkim_cff.py:17
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
CMS_2011_I930319()
Constructor.
void analyze(const Event &event) override
AIDA::IHistogram1D * _hist_mb_7
AnalysisBuilder< CMS_2011_I930319 > plugin_CMS_2011_I930319
int weight
Definition: histoStyle.py:50
double E() const
Definition: Particle.h:65