CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions | Variables
getMaxPt.h File Reference
#include <iomanip>
#include <vector>
#include <cstdlib>
#include <iostream>
#include <map>
#include <string>
#include "TFile.h"
#include "TTree.h"
#include "TString.h"
#include "TSystem.h"
#include "sstream"
#include "TNtuple.h"
#include "TGraphErrors.h"
#include "TH1F.h"
#include "TH1.h"
#include "TH2.h"
#include "TMatrixD.h"
#include "TGraph.h"
#include "TF1.h"
#include "TCanvas.h"
#include "TMath.h"
#include "TGraphAsymmErrors.h"
#include "TLegend.h"

Go to the source code of this file.

Functions

float getMaxPT (float ptHyp, Int_t eta, float dPhi12, float dPhi23, float dPhi34, int perCUT=100)
 
float getMaxPT_CLCT (float ptHyp, Int_t eta, float CLCT1, float CLCT2, float CLCT3, float CLCT4, int perCUT=100)
 
float getMaxPT_dEta (float ptHyp, Int_t eta, float dEta12, float dEta23, float dEta34, int perCUT=100)
 
void load (int perCUT=90)
 
float solve (float ptHyp, float val, TGraph *g)
 

Variables

TGraph * gCLCT1_Cut__ [32]
 
TGraph * gCLCT2_Cut__ [32]
 
TGraph * gCLCT3_Cut__ [32]
 
TGraph * gCLCT4_Cut__ [32]
 
TGraph * gdEta12_Cut__ [32]
 
TGraph * gdEta23_Cut__ [32]
 
TGraph * gdEta34_Cut__ [32]
 
TGraph * gdPhi12_Cut__ [32]
 
TGraph * gdPhi23_Cut__ [32]
 
TGraph * gdPhi34_Cut__ [32]
 
TH1F * hPT__
 
int loaded__ = false
 
int NETABINS = 1<<NETABITS
 
int NETABITS = 5
 
int NPTBins = 200
 

Function Documentation

float getMaxPT ( float  ptHyp,
Int_t  eta,
float  dPhi12,
float  dPhi23,
float  dPhi34,
int  perCUT = 100 
)

Definition at line 192 of file getMaxPt.h.

References gdPhi12_Cut__, gdPhi23_Cut__, gdPhi34_Cut__, load(), loaded__, NETABINS, and solve().

Referenced by getPt().

193 {
194  //cout << dPhi12 << " " << dPhi23 << " " << dPhi34 << endl;
195  if (!loaded__) // make sure the corridor TGraphs are loaded from the root files!
196  load(perCUT);
197 
198  if (eta>NETABINS) eta = NETABINS-1;
199 
200  float maxPt_dPhi12 = solve(ptHyp, dPhi12, gdPhi12_Cut__[eta]); // Get the best PT using dPhiAB corridors.
201  float maxPt_dPhi23 = solve(ptHyp, dPhi23, gdPhi23_Cut__[eta]); // Get the best PT using dPhiAB corridors.
202  float maxPt_dPhi34 = solve(ptHyp, dPhi34, gdPhi34_Cut__[eta]); // Get the best PT using dPhiAB corridors.
203 
204  // Now take the minimum of the four possible PT values.
205  float ptOut = ptHyp;
206 
207  if (maxPt_dPhi12 < ptOut)
208  ptOut = maxPt_dPhi12;
209  if (maxPt_dPhi23 < ptOut)
210  ptOut = maxPt_dPhi23;
211  if (maxPt_dPhi34 < ptOut)
212  ptOut = maxPt_dPhi34;
213 
214  //ptOut = (maxPt_dPhi12 + maxPt_dPhi23 + maxPt_dPhi34)/3;
215 
216  return ptOut;
217 }
float solve(float ptHyp, float val, TGraph *g)
Definition: getMaxPt.h:152
TGraph * gdPhi12_Cut__[32]
Definition: getMaxPt.h:42
TGraph * gdPhi23_Cut__[32]
Definition: getMaxPt.h:43
int loaded__
Definition: getMaxPt.h:53
TGraph * gdPhi34_Cut__[32]
Definition: getMaxPt.h:44
int NETABINS
Definition: getMaxPt.h:38
void load(int perCUT=90)
Definition: getMaxPt.h:59
float getMaxPT_CLCT ( float  ptHyp,
Int_t  eta,
float  CLCT1,
float  CLCT2,
float  CLCT3,
float  CLCT4,
int  perCUT = 100 
)

Definition at line 244 of file getMaxPt.h.

References gCLCT1_Cut__, gCLCT2_Cut__, gCLCT3_Cut__, gCLCT4_Cut__, load(), loaded__, NETABINS, and solve().

245 {
246  //cout << dPhi12 << " " << dPhi23 << " " << dPhi34 << endl;
247  if (!loaded__) // make sure the corridor TGraphs are loaded from the root files!
248  load();
249 
250  if (eta>NETABINS) eta = NETABINS-1;
251 
252  float maxPt_CLCT1 = solve(ptHyp, CLCT1, gCLCT1_Cut__[eta]); // Get the best PT using dPhiAB corridors.
253  float maxPt_CLCT2 = solve(ptHyp, CLCT2, gCLCT2_Cut__[eta]); // Get the best PT using dPhiAB corridors.
254  float maxPt_CLCT3 = solve(ptHyp, CLCT3, gCLCT3_Cut__[eta]); // Get the best PT using dPhiAB corridors.
255  float maxPt_CLCT4 = solve(ptHyp, CLCT4, gCLCT4_Cut__[eta]); // Get the best PT using dPhiAB corridors.
256 
257  // Now take the minimum of the four possible PT values.
258  float ptOut = ptHyp;
259 
260  if (maxPt_CLCT1 < ptOut)
261  ptOut = maxPt_CLCT1;
262  if (maxPt_CLCT2 < ptOut)
263  ptOut = maxPt_CLCT2;
264  if (maxPt_CLCT3 < ptOut)
265  ptOut = maxPt_CLCT3;
266  if (maxPt_CLCT4 < ptOut)
267  ptOut = maxPt_CLCT4;
268 
269  return ptOut;
270 }
TGraph * gCLCT1_Cut__[32]
Definition: getMaxPt.h:48
float solve(float ptHyp, float val, TGraph *g)
Definition: getMaxPt.h:152
TGraph * gCLCT2_Cut__[32]
Definition: getMaxPt.h:49
int loaded__
Definition: getMaxPt.h:53
TGraph * gCLCT3_Cut__[32]
Definition: getMaxPt.h:50
int NETABINS
Definition: getMaxPt.h:38
void load(int perCUT=90)
Definition: getMaxPt.h:59
TGraph * gCLCT4_Cut__[32]
Definition: getMaxPt.h:51
float getMaxPT_dEta ( float  ptHyp,
Int_t  eta,
float  dEta12,
float  dEta23,
float  dEta34,
int  perCUT = 100 
)

Definition at line 218 of file getMaxPt.h.

References gdEta12_Cut__, gdEta23_Cut__, gdEta34_Cut__, load(), loaded__, NETABINS, and solve().

219 {
220  //cout << dPhi12 << " " << dPhi23 << " " << dPhi34 << endl;
221  if (!loaded__) // make sure the corridor TGraphs are loaded from the root files!
222  load();
223 
224  if (eta>NETABINS) eta = NETABINS-1;
225 
226  float maxPt_dEta12 = solve(ptHyp, dEta12, gdEta12_Cut__[eta]); // Get the best PT using dPhiAB corridors.
227  float maxPt_dEta23 = solve(ptHyp, dEta23, gdEta23_Cut__[eta]); // Get the best PT using dPhiAB corridors.
228  float maxPt_dEta34 = solve(ptHyp, dEta34, gdEta34_Cut__[eta]); // Get the best PT using dPhiAB corridors.
229 
230  // Now take the minimum of the four possible PT values.
231  float ptOut = ptHyp;
232 
233  if (maxPt_dEta12 < ptOut)
234  ptOut = maxPt_dEta12;
235  if (maxPt_dEta23 < ptOut)
236  ptOut = maxPt_dEta23;
237  if (maxPt_dEta34 < ptOut)
238  ptOut = maxPt_dEta34;
239 
240 
241 
242  return ptOut;
243 }
TGraph * gdEta34_Cut__[32]
Definition: getMaxPt.h:47
float solve(float ptHyp, float val, TGraph *g)
Definition: getMaxPt.h:152
TGraph * gdEta23_Cut__[32]
Definition: getMaxPt.h:46
int loaded__
Definition: getMaxPt.h:53
TGraph * gdEta12_Cut__[32]
Definition: getMaxPt.h:45
int NETABINS
Definition: getMaxPt.h:38
void load(int perCUT=90)
Definition: getMaxPt.h:59
void load ( int  perCUT = 90)

Definition at line 59 of file getMaxPt.h.

References gather_cfg::cout, f, gCLCT1_Cut__, gCLCT2_Cut__, gCLCT3_Cut__, gCLCT4_Cut__, gdEta12_Cut__, gdEta23_Cut__, gdEta34_Cut__, gdPhi12_Cut__, gdPhi23_Cut__, gdPhi34_Cut__, hPT__, j, loaded__, mergeVDriftHistosByStation::name, NETABINS, and NPTBins.

Referenced by EcalDeadChannelRecoveryNN< DetIdT >::EcalDeadChannelRecoveryNN(), l1t::MP7BufferDumpToRaw::formatAMC(), FWPartialConfigLoadGUI::FWPartialConfigLoadGUI(), getMaxPT(), getMaxPT_CLCT(), getMaxPT_dEta(), ThePEGInterface::initRepository(), FedRawDataInputSource::nextEvent(), l1t::stage1::MissHtPacker::pack(), l1t::stage1::EtSumPacker::pack(), l1t::stage1::MissEtPacker::pack(), l1t::stage2::GlobalAlgBlkPacker::pack(), l1t::stage1::HFRingPacker::pack(), l1t::stage2::GlobalExtBlkPacker::pack(), l1t::stage1::CaloSpareHFPacker::pack(), l1t::stage2::CaloTowerPacker::pack(), l1t::stage2::EtSumPacker::pack(), l1t::stage1::RCTEmRegionPacker::pack(), evf::FastMonitoringService::preStreamEndLumi(), process(), l1t::L1TDigiToRaw::produce(), L1MuBMExtrapolationUnit::run(), L1MuDTExtrapolationUnit::run(), and utils.unpickler::run().

60 {
61  // "perCUT" is the fraction of events under the corridor curve.
62  // For DTs, you currently have three options: perCUT = 85, perCUT = 90, or perCUT = 98.
63  // You'll need to use "runBasicCuts.C" to generate other tail fraction scenarios.
64 
65 
66  hPT__ = new TH1F("hPT__","",NPTBins,0,200);
67 
68  TString name = "L1Trigger/L1TMuon/data/emtf_luts/dPhi_Cuts_";
69  name += perCUT; name += ".root";
70 
71  TFile f(name);
72 
73  for (int j=0;j<NETABINS;j++)
74  {
75  TString name = "gCut_dPhi12_eta_";
76  name += j;
77  gdPhi12_Cut__[j] = (TGraph *)f.Get(name);
78  cout << gdPhi12_Cut__[j]->GetName() << " loaded " << endl;
79  }
80  for (int j=0;j<NETABINS;j++)
81  {
82  TString name = "gCut_dPhi23_eta_";
83  name += j;
84  gdPhi23_Cut__[j] = (TGraph *)f.Get(name);
85  cout << gdPhi23_Cut__[j]->GetName() << " loaded " << endl;
86  }
87  for (int j=0;j<NETABINS;j++)
88  {
89  TString name = "gCut_dPhi34_eta_";
90  name+=j;
91  gdPhi34_Cut__[j] = (TGraph *)f.Get(name);
92  cout << gdPhi34_Cut__[j]->GetName() << " loaded " << endl;
93  }
94  for (int j=0;j<NETABINS;j++)
95  {
96  TString name = "gCut_dEta12_eta_";
97  name+=j;
98  gdEta12_Cut__[j] = (TGraph *)f.Get(name);
99  cout << gdEta12_Cut__[j]->GetName() << " loaded " << endl;
100  }
101  for (int j=0;j<NETABINS;j++)
102  {
103  TString name = "gCut_dEta23_eta_";
104  name+=j;
105  gdEta23_Cut__[j] = (TGraph *)f.Get(name);
106  cout << gdEta23_Cut__[j]->GetName() << " loaded " << endl;
107  }
108  for (int j=0;j<NETABINS;j++)
109  {
110  TString name = "gCut_dEta34_eta_";
111  name+=j;
112  gdEta34_Cut__[j] = (TGraph *)f.Get(name);
113  cout << gdEta34_Cut__[j]->GetName() << " loaded " << endl;
114  }
115  for (int j=0;j<NETABINS;j++)
116  {
117  TString name = "gCut_CLCT1_eta_";
118  name+=j;
119  gCLCT1_Cut__[j] = (TGraph *)f.Get(name);
120  cout << gCLCT1_Cut__[j]->GetName() << " loaded " << endl;
121  }
122 for (int j=0;j<NETABINS;j++)
123  {
124  TString name = "gCut_CLCT2_eta_";
125  name+=j;
126  gCLCT2_Cut__[j] = (TGraph *)f.Get(name);
127  cout << gCLCT2_Cut__[j]->GetName() << " loaded " << endl;
128  }
129 for (int j=0;j<NETABINS;j++)
130  {
131  TString name = "gCut_CLCT3_eta_";
132  name+=j;
133  gCLCT3_Cut__[j] = (TGraph *)f.Get(name);
134  cout << gCLCT3_Cut__[j]->GetName() << " loaded " << endl;
135  }
136 for (int j=0;j<NETABINS;j++)
137  {
138  TString name = "gCut_CLCT4_eta_";
139  name+=j;
140  gCLCT4_Cut__[j] = (TGraph *)f.Get(name);
141  cout << gCLCT4_Cut__[j]->GetName() << " loaded " << endl;
142  }
143  loaded__ = true;
144 
145 
146 }
TGraph * gCLCT1_Cut__[32]
Definition: getMaxPt.h:48
TGraph * gdEta34_Cut__[32]
Definition: getMaxPt.h:47
TGraph * gdPhi12_Cut__[32]
Definition: getMaxPt.h:42
TGraph * gdPhi23_Cut__[32]
Definition: getMaxPt.h:43
TGraph * gdEta23_Cut__[32]
Definition: getMaxPt.h:46
TGraph * gCLCT2_Cut__[32]
Definition: getMaxPt.h:49
int loaded__
Definition: getMaxPt.h:53
TGraph * gdEta12_Cut__[32]
Definition: getMaxPt.h:45
TGraph * gdPhi34_Cut__[32]
Definition: getMaxPt.h:44
TGraph * gCLCT3_Cut__[32]
Definition: getMaxPt.h:50
int j
Definition: DBlmapReader.cc:9
double f[11][100]
int NETABINS
Definition: getMaxPt.h:38
TGraph * gCLCT4_Cut__[32]
Definition: getMaxPt.h:51
int NPTBins
Definition: getMaxPt.h:39
tuple cout
Definition: gather_cfg.py:145
TH1F * hPT__
Definition: getMaxPt.h:56
float solve ( float  ptHyp,
float  val,
TGraph *  g 
)

Definition at line 152 of file getMaxPt.h.

References GOODCOLL_filter_cfg::cut, hPT__, convertSQLitetoXML_cfg::output, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by align::diffRot(), GlobalTrackerMuonAlignment::endJob(), getMaxPT(), getMaxPT_CLCT(), getMaxPT_dEta(), GlobalTrackerMuonAlignment::gradientGlobal(), GlobalTrackerMuonAlignment::gradientLocal(), npstat::LinInterpolatedTableND< Numeric, Axis >::invert1DResponse(), BlockSolver::operator()(), and IMACalibBlock::solve().

153 {
154  Int_t theBIN = hPT__->FindBin( ptHyp); // for the pt hypothesis get the bin
155  Float_t thePT = theBIN;
156 
157  float maxPt = 1e6;
158  float cut = g->Eval( theBIN ) ;
159 
160  // cout << "thePT = " << thePT << ", cut = " << cut << endl;
161 
162  if (cut>-1) // is a cut defined at this PT? Sometimes the training sample has too few events for a given PT bin.
163  if (fabs(val) > cut ) // check if the value is greater than the corridor cut
164  {
165  maxPt = 1;
166  for (float p=thePT-1; p>0; p=p-1) // The corridor TGraphs count PT bins by "0"...sorry.
167  {
168  float eval = g->Eval((float)p); // Get the maximum acceptable input value at this test-PT
169  // cout << eval << " " << val << endl;
170  if (eval>=0) // make sure there is corridor value defined here, or else we ignore this test-PT and move on
171  {
172  if (fabs(val) < eval) // Finally, is the input value below the corridor at the test-PT? If so, we can stop.
173  {
174  maxPt = p;
175  break;
176  }
177  }
178  }
179  }
180 
181  float output = ptHyp;
182  if (maxPt < output) // If the final test-PT is lower than the original hypothesis, we need to use the final test-PT.
183  output = maxPt;
184 
185  return output;
186 }
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
TH1F * hPT__
Definition: getMaxPt.h:56

Variable Documentation

TGraph* gCLCT1_Cut__[32]

Definition at line 48 of file getMaxPt.h.

Referenced by getMaxPT_CLCT(), and load().

TGraph* gCLCT2_Cut__[32]

Definition at line 49 of file getMaxPt.h.

Referenced by getMaxPT_CLCT(), and load().

TGraph* gCLCT3_Cut__[32]

Definition at line 50 of file getMaxPt.h.

Referenced by getMaxPT_CLCT(), and load().

TGraph* gCLCT4_Cut__[32]

Definition at line 51 of file getMaxPt.h.

Referenced by getMaxPT_CLCT(), and load().

TGraph* gdEta12_Cut__[32]

Definition at line 45 of file getMaxPt.h.

Referenced by getMaxPT_dEta(), and load().

TGraph* gdEta23_Cut__[32]

Definition at line 46 of file getMaxPt.h.

Referenced by getMaxPT_dEta(), and load().

TGraph* gdEta34_Cut__[32]

Definition at line 47 of file getMaxPt.h.

Referenced by getMaxPT_dEta(), and load().

TGraph* gdPhi12_Cut__[32]

Definition at line 42 of file getMaxPt.h.

Referenced by getMaxPT(), and load().

TGraph* gdPhi23_Cut__[32]

Definition at line 43 of file getMaxPt.h.

Referenced by getMaxPT(), and load().

TGraph* gdPhi34_Cut__[32]

Definition at line 44 of file getMaxPt.h.

Referenced by getMaxPT(), and load().

TH1F* hPT__

Definition at line 56 of file getMaxPt.h.

Referenced by load(), and solve().

int loaded__ = false

Definition at line 53 of file getMaxPt.h.

Referenced by getMaxPT(), getMaxPT_CLCT(), getMaxPT_dEta(), and load().

int NETABINS = 1<<NETABITS

Definition at line 38 of file getMaxPt.h.

Referenced by getMaxPT(), getMaxPT_CLCT(), getMaxPT_dEta(), and load().

int NETABITS = 5

Definition at line 37 of file getMaxPt.h.

int NPTBins = 200

Definition at line 39 of file getMaxPt.h.

Referenced by load().