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
Vx3DHLTAnalyzer Class Reference

#include <interface/Vx3DHLTAnalyzer.h>

Inheritance diagram for Vx3DHLTAnalyzer:
edm::EDAnalyzer

Public Member Functions

 Vx3DHLTAnalyzer (const edm::ParameterSet &)
 
 ~Vx3DHLTAnalyzer ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void beginLuminosityBlock (const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &iSetup)
 
virtual void endJob ()
 
virtual void endLuminosityBlock (const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &iSetup)
 
virtual char * formatTime (const time_t &t)
 
virtual unsigned int HitCounter (const edm::Event &iEvent)
 
virtual int MyFit (std::vector< double > *vals)
 
virtual void reset (std::string ResetType)
 
virtual void writeToFile (std::vector< double > *vals, edm::TimeValue_t BeginTimeOfFit, edm::TimeValue_t EndTimeOfFit, unsigned int BeginLumiOfFit, unsigned int EndLumiOfFit, int dataType)
 

Private Attributes

unsigned int beginLumiOfFit
 
edm::TimeValue_t beginTimeOfFit
 
bool dataFromFit
 
bool debugMode
 
MonitorElementdxdzlumi
 
MonitorElementdydzlumi
 
unsigned int endLumiOfFit
 
edm::TimeValue_t endTimeOfFit
 
std::string fileName
 
MonitorElementfitResults
 
MonitorElementgoodVxCounter
 
MonitorElementgoodVxCountHistory
 
MonitorElementhitCounter
 
MonitorElementhitCountHistory
 
bool internalDebug
 
unsigned int lastLumiOfFit
 
unsigned int lumiCounter
 
unsigned int lumiCounterHisto
 
unsigned int maxLumiIntegration
 
unsigned int minNentries
 
double minVxDoF
 
MonitorElementmXlumi
 
MonitorElementmYlumi
 
MonitorElementmZlumi
 
unsigned int nBinsHistoricalPlot
 
unsigned int nBinsWholeHistory
 
unsigned int nLumiReset
 
unsigned int numberFits
 
unsigned int numberGoodFits
 
ofstream outputDebugFile
 
ofstream outputFile
 
unsigned int prescaleHistory
 
MonitorElementreportSummary
 
MonitorElementreportSummaryMap
 
unsigned int runNumber
 
MonitorElementsXlumi
 
MonitorElementsYlumi
 
MonitorElementsZlumi
 
unsigned int totalHits
 
edm::InputTag vertexCollection
 
MonitorElementVx_X
 
MonitorElementVx_XY
 
MonitorElementVx_Y
 
MonitorElementVx_Z
 
MonitorElementVx_ZX
 
MonitorElementVx_ZY
 
double xRange
 
double xStep
 
double yRange
 
double yStep
 
double zRange
 
double zStep
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 70 of file Vx3DHLTAnalyzer.h.

Constructor & Destructor Documentation

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

Definition at line 38 of file Vx3DHLTAnalyzer.cc.

References convertXMLtoSQLite_cfg::fileName, edm::ParameterSet::getParameter(), GoodVertex_cfg::vertexCollection, and VxErrCorr.

39 {
40  vertexCollection = edm::InputTag("pixelVertices");
41  debugMode = true;
42  nLumiReset = 1;
43  dataFromFit = true;
44  minNentries = 35;
45  xRange = 2.;
46  xStep = 0.001;
47  yRange = 2.;
48  yStep = 0.001;
49  zRange = 30.;
50  zStep = 0.05;
51  VxErrCorr = 1.5;
52  fileName = "BeamPixelResults.txt";
53 
54  vertexCollection = iConfig.getParameter<InputTag>("vertexCollection");
55  debugMode = iConfig.getParameter<bool>("debugMode");
56  nLumiReset = iConfig.getParameter<unsigned int>("nLumiReset");
57  dataFromFit = iConfig.getParameter<bool>("dataFromFit");
58  minNentries = iConfig.getParameter<unsigned int>("minNentries");
59  xRange = iConfig.getParameter<double>("xRange");
60  xStep = iConfig.getParameter<double>("xStep");
61  yRange = iConfig.getParameter<double>("yRange");
62  yStep = iConfig.getParameter<double>("yStep");
63  zRange = iConfig.getParameter<double>("zRange");
64  zStep = iConfig.getParameter<double>("zStep");
65  VxErrCorr = iConfig.getParameter<double>("VxErrCorr");
66  fileName = iConfig.getParameter<string>("fileName");
67 }
T getParameter(std::string const &) const
unsigned int minNentries
unsigned int nLumiReset
edm::InputTag vertexCollection
std::string fileName
double VxErrCorr
Vx3DHLTAnalyzer::~Vx3DHLTAnalyzer ( )

Definition at line 70 of file Vx3DHLTAnalyzer.cc.

71 {
72 }

Member Function Documentation

void Vx3DHLTAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 75 of file Vx3DHLTAnalyzer.cc.

References gather_cfg::cout, VertexType::Covariance, DIM, convertXMLtoSQLite_cfg::fileName, edm::Event::getByLabel(), edm::Event::getLuminosityBlock(), i, edm::EventBase::id(), edm::detail::isnan(), j, dbtoconf::out, reset(), edm::EventID::run(), convertSQLiteXML::runNumber, tmp, GoodVertex_cfg::vertexCollection, Vertices, VertexType::x, VertexType::y, and VertexType::z.

76 {
77  Handle<VertexCollection> Vx3DCollection;
78  iEvent.getByLabel(vertexCollection,Vx3DCollection);
79 
80  unsigned int i,j;
81  double det;
82  VertexType MyVertex;
83 
84  if (runNumber != iEvent.id().run())
85  {
86  reset("scratch");
87  runNumber = iEvent.id().run();
88 
89  if (debugMode == true)
90  {
91  stringstream debugFile;
92  string tmp(fileName);
93 
94  if (outputDebugFile.is_open() == true) outputDebugFile.close();
95  tmp.erase(strlen(fileName.c_str())-4,4);
96  debugFile << tmp.c_str() << "_Run" << iEvent.id().run() << ".txt";
97  outputDebugFile.open(debugFile.str().c_str(), ios::out);
98  outputDebugFile.close();
99  outputDebugFile.open(debugFile.str().c_str(), ios::app);
100  }
101 
102  beginLuminosityBlock(iEvent.getLuminosityBlock(),iSetup);
103  }
104  else if (beginTimeOfFit != 0)
105  {
106  totalHits += HitCounter(iEvent);
107 
108  for (vector<Vertex>::const_iterator it3DVx = Vx3DCollection->begin(); it3DVx != Vx3DCollection->end(); it3DVx++)
109  {
110  if ((it3DVx->isValid() == true) &&
111  (it3DVx->isFake() == false) &&
112  (it3DVx->ndof() >= minVxDoF))
113  {
114  for (i = 0; i < DIM; i++)
115  {
116  for (j = 0; j < DIM; j++)
117  {
118  MyVertex.Covariance[i][j] = it3DVx->covariance(i,j);
119  if (std::isnan(MyVertex.Covariance[i][j]) == true) break;
120  }
121  if (j != DIM) break;
122  }
123  det = std::fabs(MyVertex.Covariance[0][0])*(std::fabs(MyVertex.Covariance[1][1])*std::fabs(MyVertex.Covariance[2][2]) - MyVertex.Covariance[1][2]*MyVertex.Covariance[1][2]) -
124  MyVertex.Covariance[0][1]*(MyVertex.Covariance[0][1]*std::fabs(MyVertex.Covariance[2][2]) - MyVertex.Covariance[0][2]*MyVertex.Covariance[1][2]) +
125  MyVertex.Covariance[0][2]*(MyVertex.Covariance[0][1]*MyVertex.Covariance[1][2] - MyVertex.Covariance[0][2]*std::fabs(MyVertex.Covariance[1][1]));
126  if ((i == DIM) && (det > 0.))
127  {
128  MyVertex.x = it3DVx->x();
129  MyVertex.y = it3DVx->y();
130  MyVertex.z = it3DVx->z();
131  Vertices.push_back(MyVertex);
132  }
133  else if (internalDebug == true)
134  {
135  cout << "Vertex discarded !" << endl;
136  for (i = 0; i < DIM; i++)
137  for (j = 0; j < DIM; j++)
138  cout << "(i,j) --> " << i << "," << j << " --> " << MyVertex.Covariance[i][j] << endl;
139  }
140 
141  Vx_X->Fill(it3DVx->x());
142  Vx_Y->Fill(it3DVx->y());
143  Vx_Z->Fill(it3DVx->z());
144 
145  Vx_ZX->Fill(it3DVx->z(), it3DVx->x());
146  Vx_ZY->Fill(it3DVx->z(), it3DVx->y());
147  Vx_XY->Fill(it3DVx->x(), it3DVx->y());
148  }
149  }
150  }
151 }
RunNumber_t run() const
Definition: EventID.h:42
int i
Definition: DBlmapReader.cc:9
MonitorElement * Vx_ZX
unsigned int totalHits
MonitorElement * Vx_X
edm::TimeValue_t beginTimeOfFit
edm::InputTag vertexCollection
virtual unsigned int HitCounter(const edm::Event &iEvent)
void Fill(long long x)
MonitorElement * Vx_XY
double Covariance[3][3]
MonitorElement * Vx_ZY
std::string fileName
bool isnan(float x)
Definition: math.h:13
int j
Definition: DBlmapReader.cc:9
LuminosityBlock const & getLuminosityBlock() const
Definition: Event.h:59
MonitorElement * Vx_Z
virtual void reset(std::string ResetType)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
virtual void beginLuminosityBlock(const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &iSetup)
tuple out
Definition: dbtoconf.py:99
ofstream outputDebugFile
#define DIM
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
edm::EventID id() const
Definition: EventBase.h:56
unsigned int runNumber
std::vector< VertexType > Vertices
tuple cout
Definition: gather_cfg.py:121
MonitorElement * Vx_Y
void Vx3DHLTAnalyzer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 1066 of file Vx3DHLTAnalyzer.cc.

References DQMStore::book1D(), DQMStore::book2D(), DQMStore::bookFloat(), considerVxCovariance, MonitorElement::Fill(), cppFunctionSkipper::operator, pi, reset(), MonitorElement::setAxisTitle(), and DQMStore::setCurrentFolder().

1067 {
1068  DQMStore* dbe = 0;
1069  dbe = Service<DQMStore>().operator->();
1070 
1071  // ### Set internal variables ###
1072  nBinsHistoricalPlot = 80;
1073  nBinsWholeHistory = 3000; // Corresponds to about 20h of data taking: 20h * 60min * 60s / 23s per lumi-block = 3130
1074  // ##############################
1075 
1076  if ( dbe )
1077  {
1078  dbe->setCurrentFolder("BeamPixel");
1079 
1080  Vx_X = dbe->book1D("vertex x", "Primary Vertex X Coordinate Distribution", int(rint(xRange/xStep)), -xRange/2., xRange/2.);
1081  Vx_Y = dbe->book1D("vertex y", "Primary Vertex Y Coordinate Distribution", int(rint(yRange/yStep)), -yRange/2., yRange/2.);
1082  Vx_Z = dbe->book1D("vertex z", "Primary Vertex Z Coordinate Distribution", int(rint(zRange/zStep)), -zRange/2., zRange/2.);
1083  Vx_X->setAxisTitle("Primary Vertices X [cm]",1);
1084  Vx_X->setAxisTitle("Entries [#]",2);
1085  Vx_Y->setAxisTitle("Primary Vertices Y [cm]",1);
1086  Vx_Y->setAxisTitle("Entries [#]",2);
1087  Vx_Z->setAxisTitle("Primary Vertices Z [cm]",1);
1088  Vx_Z->setAxisTitle("Entries [#]",2);
1089 
1090  mXlumi = dbe->book1D("muX vs lumi", "\\mu_{x} vs. Lumisection", nBinsHistoricalPlot, 0.5, (double)nBinsHistoricalPlot+0.5);
1091  mYlumi = dbe->book1D("muY vs lumi", "\\mu_{y} vs. Lumisection", nBinsHistoricalPlot, 0.5, (double)nBinsHistoricalPlot+0.5);
1092  mZlumi = dbe->book1D("muZ vs lumi", "\\mu_{z} vs. Lumisection", nBinsHistoricalPlot, 0.5, (double)nBinsHistoricalPlot+0.5);
1093  mXlumi->setAxisTitle("Lumisection [#]",1);
1094  mXlumi->setAxisTitle("\\mu_{x} [cm]",2);
1095  mXlumi->getTH1()->SetOption("E1");
1096  mYlumi->setAxisTitle("Lumisection [#]",1);
1097  mYlumi->setAxisTitle("\\mu_{y} [cm]",2);
1098  mYlumi->getTH1()->SetOption("E1");
1099  mZlumi->setAxisTitle("Lumisection [#]",1);
1100  mZlumi->setAxisTitle("\\mu_{z} [cm]",2);
1101  mZlumi->getTH1()->SetOption("E1");
1102 
1103  sXlumi = dbe->book1D("sigmaX vs lumi", "\\sigma_{x} vs. Lumisection", nBinsHistoricalPlot, 0.5, (double)nBinsHistoricalPlot+0.5);
1104  sYlumi = dbe->book1D("sigmaY vs lumi", "\\sigma_{y} vs. Lumisection", nBinsHistoricalPlot, 0.5, (double)nBinsHistoricalPlot+0.5);
1105  sZlumi = dbe->book1D("sigmaZ vs lumi", "\\sigma_{z} vs. Lumisection", nBinsHistoricalPlot, 0.5, (double)nBinsHistoricalPlot+0.5);
1106  sXlumi->setAxisTitle("Lumisection [#]",1);
1107  sXlumi->setAxisTitle("\\sigma_{x} [cm]",2);
1108  sXlumi->getTH1()->SetOption("E1");
1109  sYlumi->setAxisTitle("Lumisection [#]",1);
1110  sYlumi->setAxisTitle("\\sigma_{y} [cm]",2);
1111  sYlumi->getTH1()->SetOption("E1");
1112  sZlumi->setAxisTitle("Lumisection [#]",1);
1113  sZlumi->setAxisTitle("\\sigma_{z} [cm]",2);
1114  sZlumi->getTH1()->SetOption("E1");
1115 
1116  dxdzlumi = dbe->book1D("dxdz vs lumi", "dX/dZ vs. Lumisection", nBinsHistoricalPlot, 0.5, (double)nBinsHistoricalPlot+0.5);
1117  dydzlumi = dbe->book1D("dydz vs lumi", "dY/dZ vs. Lumisection", nBinsHistoricalPlot, 0.5, (double)nBinsHistoricalPlot+0.5);
1118  dxdzlumi->setAxisTitle("Lumisection [#]",1);
1119  dxdzlumi->setAxisTitle("dX/dZ [rad]",2);
1120  dxdzlumi->getTH1()->SetOption("E1");
1121  dydzlumi->setAxisTitle("Lumisection [#]",1);
1122  dydzlumi->setAxisTitle("dY/dZ [rad]",2);
1123  dydzlumi->getTH1()->SetOption("E1");
1124 
1125  Vx_ZX = dbe->book2D("vertex zx", "Primary Vertex ZX Coordinate Distribution", int(rint(zRange/zStep/5.)), -zRange/2., zRange/2., int(rint(xRange/xStep/5.)), -xRange/2., xRange/2.);
1126  Vx_ZY = dbe->book2D("vertex zy", "Primary Vertex ZY Coordinate Distribution", int(rint(zRange/zStep/5.)), -zRange/2., zRange/2., int(rint(yRange/yStep/5.)), -yRange/2., yRange/2.);
1127  Vx_XY = dbe->book2D("vertex xy", "Primary Vertex XY Coordinate Distribution", int(rint(xRange/xStep/5.)), -xRange/2., xRange/2., int(rint(yRange/yStep/5.)), -yRange/2., yRange/2.);
1128  Vx_ZX->setAxisTitle("Primary Vertices Z [cm]",1);
1129  Vx_ZX->setAxisTitle("Primary Vertices X [cm]",2);
1130  Vx_ZX->setAxisTitle("Entries [#]",3);
1131  Vx_ZY->setAxisTitle("Primary Vertices Z [cm]",1);
1132  Vx_ZY->setAxisTitle("Primary Vertices Y [cm]",2);
1133  Vx_ZY->setAxisTitle("Entries [#]",3);
1134  Vx_XY->setAxisTitle("Primary Vertices X [cm]",1);
1135  Vx_XY->setAxisTitle("Primary Vertices Y [cm]",2);
1136  Vx_XY->setAxisTitle("Entries [#]",3);
1137 
1138  hitCounter = dbe->book1D("pixelHits vs lumi", "# Pixel-Hits vs. Lumisection", nBinsHistoricalPlot, 0.5, (double)nBinsHistoricalPlot+0.5);
1139  hitCounter->setAxisTitle("Lumisection [#]",1);
1140  hitCounter->setAxisTitle("Pixel-Hits [#]",2);
1141  hitCounter->getTH1()->SetOption("E1");
1142 
1143  hitCountHistory = dbe->book1D("hist pixelHits vs lumi", "History: # Pixel-Hits vs. Lumi", nBinsWholeHistory, 0.5, (double)nBinsWholeHistory+0.5);
1144  hitCountHistory->setAxisTitle("Lumisection [#]",1);
1145  hitCountHistory->setAxisTitle("Pixel-Hits [#]",2);
1146  hitCountHistory->getTH1()->SetOption("E1");
1147 
1148  goodVxCounter = dbe->book1D("good vertices vs lumi", "# Good vertices vs. Lumisection", nBinsHistoricalPlot, 0.5, (double)nBinsHistoricalPlot+0.5);
1149  goodVxCounter->setAxisTitle("Lumisection [#]",1);
1150  goodVxCounter->setAxisTitle("Good vertices [#]",2);
1151  goodVxCounter->getTH1()->SetOption("E1");
1152 
1153  goodVxCountHistory = dbe->book1D("hist good vx vs lumi", "History: # Good vx vs. Lumi", nBinsWholeHistory, 0.5, (double)nBinsWholeHistory+0.5);
1154  goodVxCountHistory->setAxisTitle("Lumisection [#]",1);
1155  goodVxCountHistory->setAxisTitle("Good vertices [#]",2);
1156  goodVxCountHistory->getTH1()->SetOption("E1");
1157 
1158  fitResults = dbe->book2D("fit results","Results of Beam Spot Fit", 2, 0., 2., 9, 0., 9.);
1159  fitResults->setAxisTitle("Fitted Beam Spot [cm]", 1);
1160  fitResults->setBinLabel(9, "X", 2);
1161  fitResults->setBinLabel(8, "Y", 2);
1162  fitResults->setBinLabel(7, "Z", 2);
1163  fitResults->setBinLabel(6, "\\sigma_{Z}", 2);
1164  fitResults->setBinLabel(5, "#frac{dX}{dZ}[rad]", 2);
1165  fitResults->setBinLabel(4, "#frac{dY}{dZ}[rad]", 2);
1166  fitResults->setBinLabel(3, "\\sigma_{X}", 2);
1167  fitResults->setBinLabel(2, "\\sigma_{Y}", 2);
1168  fitResults->setBinLabel(1, "Vertices", 2);
1169  fitResults->setBinLabel(1, "Value", 1);
1170  fitResults->setBinLabel(2, "Stat. Error", 1);
1171  fitResults->getTH1()->SetOption("text");
1172 
1173  dbe->setCurrentFolder("BeamPixel/EventInfo");
1174  reportSummary = dbe->bookFloat("reportSummary");
1175  reportSummary->Fill(0.);
1176  reportSummaryMap = dbe->book2D("reportSummaryMap","Pixel-Vertices Beam Spot: % Good Fits", 1, 0., 1., 1, 0., 1.);
1177  reportSummaryMap->Fill(0.5, 0.5, 0.);
1178  dbe->setCurrentFolder("BeamPixel/EventInfo/reportSummaryContents");
1179 
1180  // Convention for reportSummary and reportSummaryMap:
1181  // - 0% at the moment of creation of the histogram
1182  // - n% numberGoodFits / numberFits
1183  }
1184 
1185  // ### Set internal variables ###
1186  reset("scratch");
1187  prescaleHistory = 1;
1188  maxLumiIntegration = 15;
1189  minVxDoF = 4.;
1190  // For vertex fitter without track-weight: d.o.f. = 2*NTracks - 3
1191  // For vertex fitter with track-weight: d.o.f. = sum_NTracks(2*track_weight) - 3
1192  internalDebug = false;
1193  considerVxCovariance = true;
1194  pi = 3.141592653589793238;
1195  // ##############################
1196 }
MonitorElement * dxdzlumi
MonitorElement * Vx_ZX
unsigned int maxLumiIntegration
MonitorElement * hitCountHistory
MonitorElement * Vx_X
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
MonitorElement * mYlumi
MonitorElement * sYlumi
MonitorElement * reportSummaryMap
unsigned int nBinsHistoricalPlot
void Fill(long long x)
const Double_t pi
MonitorElement * Vx_XY
MonitorElement * sZlumi
bool considerVxCovariance
MonitorElement * fitResults
MonitorElement * Vx_ZY
MonitorElement * reportSummary
MonitorElement * goodVxCounter
MonitorElement * dydzlumi
TH1 * getTH1(void) const
MonitorElement * Vx_Z
MonitorElement * mXlumi
virtual void reset(std::string ResetType)
MonitorElement * mZlumi
MonitorElement * sXlumi
unsigned int nBinsWholeHistory
unsigned int prescaleHistory
MonitorElement * goodVxCountHistory
MonitorElement * hitCounter
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
MonitorElement * Vx_Y
void Vx3DHLTAnalyzer::beginLuminosityBlock ( const edm::LuminosityBlock lumiBlock,
const edm::EventSetup iSetup 
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 787 of file Vx3DHLTAnalyzer.cc.

References edm::LuminosityBlockBase::beginTime(), edm::LuminosityBlockBase::luminosityBlock(), and edm::Timestamp::value().

789 {
790  if ((lumiCounter == 0) && (lumiBlock.luminosityBlock() > lastLumiOfFit))
791  {
792  beginTimeOfFit = lumiBlock.beginTime().value();
793  beginLumiOfFit = lumiBlock.luminosityBlock();
794  lumiCounter++;
796  }
797  else if ((lumiCounter != 0) && (lumiBlock.luminosityBlock() >= (beginLumiOfFit+lumiCounter))) { lumiCounter++; lumiCounterHisto++; }
798 }
unsigned int lumiCounter
unsigned int beginLumiOfFit
edm::TimeValue_t beginTimeOfFit
Timestamp const & beginTime() const
LuminosityBlockNumber_t luminosityBlock() const
TimeValue_t value() const
Definition: Timestamp.cc:72
unsigned int lastLumiOfFit
unsigned int lumiCounterHisto
void Vx3DHLTAnalyzer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 1199 of file Vx3DHLTAnalyzer.cc.

References reset().

1199 { reset("scratch"); }
virtual void reset(std::string ResetType)
void Vx3DHLTAnalyzer::endLuminosityBlock ( const edm::LuminosityBlock lumiBlock,
const edm::EventSetup iSetup 
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 801 of file Vx3DHLTAnalyzer.cc.

References counterVx, gather_cfg::cout, edm::LuminosityBlockBase::endTime(), i, edm::LuminosityBlockBase::luminosityBlock(), reset(), convertSQLiteXML::runNumber, mathSSE::sqrt(), create_public_pileup_plots::vals, and edm::Timestamp::value().

803 {
804  stringstream histTitle;
805  int goodData;
806  unsigned int nParams = 9;
807 
808  if ((lumiCounter%nLumiReset == 0) && (nLumiReset != 0) && (beginTimeOfFit != 0) && (runNumber != 0))
809  {
810  endTimeOfFit = lumiBlock.endTime().value();
811  endLumiOfFit = lumiBlock.luminosityBlock();
813  vector<double> vals;
814 
815  hitCounter->ShiftFillLast((double)totalHits, std::sqrt((double)totalHits), nLumiReset);
816 
817  if (lastLumiOfFit % prescaleHistory == 0)
818  {
819  hitCountHistory->getTH1()->SetBinContent(lastLumiOfFit, (double)totalHits);
820  hitCountHistory->getTH1()->SetBinError(lastLumiOfFit, std::sqrt((double)totalHits));
821  }
822 
823  if (dataFromFit == true)
824  {
825  vector<double> fitResults;
826 
827  fitResults.push_back(Vx_X->getTH1()->GetRMS()*Vx_X->getTH1()->GetRMS());
828  fitResults.push_back(Vx_Y->getTH1()->GetRMS()*Vx_Y->getTH1()->GetRMS());
829  fitResults.push_back(Vx_Z->getTH1()->GetRMS()*Vx_Z->getTH1()->GetRMS());
830  fitResults.push_back(0.0);
831  fitResults.push_back(0.0);
832  fitResults.push_back(0.0);
833  fitResults.push_back(Vx_X->getTH1()->GetMean());
834  fitResults.push_back(Vx_Y->getTH1()->GetMean());
835  fitResults.push_back(Vx_Z->getTH1()->GetMean());
836  for (unsigned int i = 0; i < nParams; i++) fitResults.push_back(0.0);
837 
838  goodData = MyFit(&fitResults);
839 
840  if (internalDebug == true)
841  {
842  cout << "goodData --> " << goodData << endl;
843  cout << "Used vertices --> " << counterVx << endl;
844  cout << "var x --> " << fitResults[0] << " +/- " << fitResults[0+nParams] << endl;
845  cout << "var y --> " << fitResults[1] << " +/- " << fitResults[1+nParams] << endl;
846  cout << "var z --> " << fitResults[2] << " +/- " << fitResults[2+nParams] << endl;
847  cout << "cov xy --> " << fitResults[3] << " +/- " << fitResults[3+nParams] << endl;
848  cout << "dydz --> " << fitResults[4] << " +/- " << fitResults[4+nParams] << endl;
849  cout << "dxdz --> " << fitResults[5] << " +/- " << fitResults[5+nParams] << endl;
850  cout << "mean x --> " << fitResults[6] << " +/- " << fitResults[6+nParams] << endl;
851  cout << "mean y --> " << fitResults[7] << " +/- " << fitResults[7+nParams] << endl;
852  cout << "mean z --> " << fitResults[8] << " +/- " << fitResults[8+nParams] << endl;
853  }
854 
855  if (goodData == 0)
856  {
857  vals.push_back(fitResults[6]);
858  vals.push_back(fitResults[7]);
859  vals.push_back(fitResults[8]);
860  vals.push_back(std::sqrt(std::fabs(fitResults[2])));
861  vals.push_back(fitResults[5]);
862  vals.push_back(fitResults[4]);
863  vals.push_back(std::sqrt(std::fabs(fitResults[0])));
864  vals.push_back(std::sqrt(std::fabs(fitResults[1])));
865 
866  vals.push_back(powf(fitResults[6+nParams],2.));
867  vals.push_back(powf(fitResults[7+nParams],2.));
868  vals.push_back(powf(fitResults[8+nParams],2.));
869  vals.push_back(powf(std::fabs(fitResults[2+nParams]) / (2.*std::sqrt(std::fabs(fitResults[2]))),2.));
870  vals.push_back(powf(fitResults[5+nParams],2.));
871  vals.push_back(powf(fitResults[4+nParams],2.));
872  vals.push_back(powf(std::fabs(fitResults[0+nParams]) / (2.*std::sqrt(std::fabs(fitResults[0]))),2.));
873  vals.push_back(powf(std::fabs(fitResults[1+nParams]) / (2.*std::sqrt(std::fabs(fitResults[1]))),2.));
874  }
875  else for (unsigned int i = 0; i < 8*2; i++) vals.push_back(0.0);
876 
877  fitResults.clear();
878  }
879  else
880  {
881  counterVx = Vx_X->getTH1F()->GetEntries();
882 
883  if (Vx_X->getTH1F()->GetEntries() >= minNentries)
884  {
885  goodData = 0;
886 
887  vals.push_back(Vx_X->getTH1F()->GetMean());
888  vals.push_back(Vx_Y->getTH1F()->GetMean());
889  vals.push_back(Vx_Z->getTH1F()->GetMean());
890  vals.push_back(Vx_Z->getTH1F()->GetRMS());
891  vals.push_back(0.0);
892  vals.push_back(0.0);
893  vals.push_back(Vx_X->getTH1F()->GetRMS());
894  vals.push_back(Vx_Y->getTH1F()->GetRMS());
895 
896  vals.push_back(powf(Vx_X->getTH1F()->GetMeanError(),2.));
897  vals.push_back(powf(Vx_Y->getTH1F()->GetMeanError(),2.));
898  vals.push_back(powf(Vx_Z->getTH1F()->GetMeanError(),2.));
899  vals.push_back(powf(Vx_Z->getTH1F()->GetRMSError(),2.));
900  vals.push_back(0.0);
901  vals.push_back(0.0);
902  vals.push_back(powf(Vx_X->getTH1F()->GetRMSError(),2.));
903  vals.push_back(powf(Vx_Y->getTH1F()->GetRMSError(),2.));
904  }
905  else
906  {
907  goodData = -2;
908  for (unsigned int i = 0; i < 8*2; i++) vals.push_back(0.0);
909  }
910  }
911 
912  // vals[0] = X0
913  // vals[1] = Y0
914  // vals[2] = Z0
915  // vals[3] = sigmaZ0
916  // vals[4] = dxdz
917  // vals[5] = dydz
918  // vals[6] = BeamWidthX
919  // vals[7] = BeamWidthY
920 
921  // vals[8] = err^2 X0
922  // vals[9] = err^2 Y0
923  // vals[10] = err^2 Z0
924  // vals[11] = err^2 sigmaZ0
925  // vals[12] = err^2 dxdz
926  // vals[13] = err^2 dydz
927  // vals[14] = err^2 BeamWidthX
928  // vals[15] = err^2 BeamWidthY
929 
930  // "goodData" CODE:
931  // 0 == OK --> Reset
932  // -2 == NO OK - not enough "minNentries" --> Wait for more lumisections
933  // Any other number == NO OK --> Reset
934 
935  numberFits++;
936  if (goodData == 0)
937  {
939  if ((internalDebug == true) && (outputDebugFile.is_open() == true)) outputDebugFile << "Used vertices: " << counterVx << endl;
940 
941  numberGoodFits++;
942 
943  histTitle << "Fitted Beam Spot [cm] (Lumi start: " << beginLumiOfFit << " - Lumi end: " << endLumiOfFit << ")";
944  if (lumiCounterHisto >= maxLumiIntegration) reset("whole");
945  else reset("partial");
946  }
947  else
948  {
949  writeToFile(&vals, beginTimeOfFit, endTimeOfFit, beginLumiOfFit, endLumiOfFit, -1);
950  if ((internalDebug == true) && (outputDebugFile.is_open() == true)) outputDebugFile << "Used vertices: " << counterVx << endl;
951 
952  if (goodData == -2)
953  {
954  histTitle << "Fitted Beam Spot [cm] (not enough statistics)";
955  if (lumiCounter >= maxLumiIntegration) reset("whole");
956  else reset("hitCounter");
957  }
958  else
959  {
960  histTitle << "Fitted Beam Spot [cm] (problems)";
961  if (lumiCounterHisto >= maxLumiIntegration) reset("whole");
962  else reset("partial");
963 
964  counterVx = 0;
965  }
966  }
967 
968  reportSummary->Fill(numberFits != 0 ? (double)numberGoodFits/(double)numberFits : 0.0);
969  reportSummaryMap->Fill(0.5, 0.5, numberFits != 0 ? (double)numberGoodFits/(double)numberFits : 0.0);
970 
971  fitResults->setAxisTitle(histTitle.str().c_str(), 1);
972 
973  fitResults->setBinContent(1, 9, vals[0]);
974  fitResults->setBinContent(1, 8, vals[1]);
975  fitResults->setBinContent(1, 7, vals[2]);
976  fitResults->setBinContent(1, 6, vals[3]);
977  fitResults->setBinContent(1, 5, vals[4]);
978  fitResults->setBinContent(1, 4, vals[5]);
979  fitResults->setBinContent(1, 3, vals[6]);
980  fitResults->setBinContent(1, 2, vals[7]);
981  fitResults->setBinContent(1, 1, counterVx);
982 
983  fitResults->setBinContent(2, 9, std::sqrt(vals[8]));
984  fitResults->setBinContent(2, 8, std::sqrt(vals[9]));
985  fitResults->setBinContent(2, 7, std::sqrt(vals[10]));
986  fitResults->setBinContent(2, 6, std::sqrt(vals[11]));
987  fitResults->setBinContent(2, 5, std::sqrt(vals[12]));
988  fitResults->setBinContent(2, 4, std::sqrt(vals[13]));
989  fitResults->setBinContent(2, 3, std::sqrt(vals[14]));
990  fitResults->setBinContent(2, 2, std::sqrt(vals[15]));
991  fitResults->setBinContent(2, 1, std::sqrt(counterVx));
992 
993  // Linear fit to the historical plots
994  TF1* myLinFit = new TF1("myLinFit", "[0] + [1]*x", mXlumi->getTH1()->GetXaxis()->GetXmin(), mXlumi->getTH1()->GetXaxis()->GetXmax());
995  myLinFit->SetLineColor(2);
996  myLinFit->SetLineWidth(2);
997  myLinFit->SetParName(0,"Intercept");
998  myLinFit->SetParName(1,"Slope");
999 
1000  mXlumi->ShiftFillLast(vals[0], std::sqrt(vals[8]), nLumiReset);
1001  myLinFit->SetParameter(0, mXlumi->getTH1()->GetMean(2));
1002  myLinFit->SetParameter(1, 0.0);
1003  mXlumi->getTH1()->Fit("myLinFit","QR");
1004 
1005  mYlumi->ShiftFillLast(vals[1], std::sqrt(vals[9]), nLumiReset);
1006  myLinFit->SetParameter(0, mYlumi->getTH1()->GetMean(2));
1007  myLinFit->SetParameter(1, 0.0);
1008  mYlumi->getTH1()->Fit("myLinFit","QR");
1009 
1010  mZlumi->ShiftFillLast(vals[2], std::sqrt(vals[10]), nLumiReset);
1011  myLinFit->SetParameter(0, mZlumi->getTH1()->GetMean(2));
1012  myLinFit->SetParameter(1, 0.0);
1013  mZlumi->getTH1()->Fit("myLinFit","QR");
1014 
1015  sXlumi->ShiftFillLast(vals[6], std::sqrt(vals[14]), nLumiReset);
1016  myLinFit->SetParameter(0, sXlumi->getTH1()->GetMean(2));
1017  myLinFit->SetParameter(1, 0.0);
1018  sXlumi->getTH1()->Fit("myLinFit","QR");
1019 
1020  sYlumi->ShiftFillLast(vals[7], std::sqrt(vals[15]), nLumiReset);
1021  myLinFit->SetParameter(0, sYlumi->getTH1()->GetMean(2));
1022  myLinFit->SetParameter(1, 0.0);
1023  sYlumi->getTH1()->Fit("myLinFit","QR");
1024 
1025  sZlumi->ShiftFillLast(vals[3], std::sqrt(vals[11]), nLumiReset);
1026  myLinFit->SetParameter(0, sZlumi->getTH1()->GetMean(2));
1027  myLinFit->SetParameter(1, 0.0);
1028  sZlumi->getTH1()->Fit("myLinFit","QR");
1029 
1030  dxdzlumi->ShiftFillLast(vals[4], std::sqrt(vals[12]), nLumiReset);
1031  myLinFit->SetParameter(0, dxdzlumi->getTH1()->GetMean(2));
1032  myLinFit->SetParameter(1, 0.0);
1033  dxdzlumi->getTH1()->Fit("myLinFit","QR");
1034 
1035  dydzlumi->ShiftFillLast(vals[5], std::sqrt(vals[13]), nLumiReset);
1036  myLinFit->SetParameter(0, dydzlumi->getTH1()->GetMean(2));
1037  myLinFit->SetParameter(1, 0.0);
1038  dydzlumi->getTH1()->Fit("myLinFit","QR");
1039 
1040  goodVxCounter->ShiftFillLast((double)counterVx, std::sqrt((double)counterVx), nLumiReset);
1041  myLinFit->SetParameter(0, goodVxCounter->getTH1()->GetMean(2));
1042  myLinFit->SetParameter(1, 0.0);
1043  goodVxCounter->getTH1()->Fit("myLinFit","QR");
1044 
1045  if (lastLumiOfFit % prescaleHistory == 0)
1046  {
1047  goodVxCountHistory->getTH1()->SetBinContent(lastLumiOfFit, (double)counterVx);
1048  goodVxCountHistory->getTH1()->SetBinError(lastLumiOfFit, std::sqrt((double)counterVx));
1049  }
1050 
1051  delete myLinFit;
1052 
1053  vals.clear();
1054  }
1055  else if (nLumiReset == 0)
1056  {
1057  histTitle << "Fitted Beam Spot [cm] (no ongoing fits)";
1058  fitResults->setAxisTitle(histTitle.str().c_str(), 1);
1059  reportSummaryMap->Fill(0.5, 0.5, 1.0);
1060  hitCounter->ShiftFillLast(totalHits, std::sqrt(totalHits), 1);
1061  reset("nohisto");
1062  }
1063 }
unsigned int lumiCounter
int i
Definition: DBlmapReader.cc:9
MonitorElement * dxdzlumi
unsigned int totalHits
unsigned int maxLumiIntegration
unsigned int numberFits
unsigned int beginLumiOfFit
virtual int MyFit(std::vector< double > *vals)
MonitorElement * hitCountHistory
unsigned int minNentries
MonitorElement * Vx_X
unsigned int nLumiReset
MonitorElement * mYlumi
edm::TimeValue_t beginTimeOfFit
edm::TimeValue_t endTimeOfFit
MonitorElement * sYlumi
MonitorElement * reportSummaryMap
virtual void writeToFile(std::vector< double > *vals, edm::TimeValue_t BeginTimeOfFit, edm::TimeValue_t EndTimeOfFit, unsigned int BeginLumiOfFit, unsigned int EndLumiOfFit, int dataType)
void Fill(long long x)
MonitorElement * sZlumi
LuminosityBlockNumber_t luminosityBlock() const
void ShiftFillLast(double y, double ye=0., int32_t xscale=1)
MonitorElement * fitResults
unsigned int endLumiOfFit
unsigned int numberGoodFits
T sqrt(T t)
Definition: SSEVec.h:46
MonitorElement * reportSummary
Timestamp const & endTime() const
MonitorElement * goodVxCounter
MonitorElement * dydzlumi
TH1 * getTH1(void) const
MonitorElement * Vx_Z
MonitorElement * mXlumi
virtual void reset(std::string ResetType)
MonitorElement * mZlumi
MonitorElement * sXlumi
TimeValue_t value() const
Definition: Timestamp.cc:72
unsigned int lastLumiOfFit
ofstream outputDebugFile
unsigned int lumiCounterHisto
TH1F * getTH1F(void) const
unsigned int runNumber
unsigned int counterVx
tuple cout
Definition: gather_cfg.py:121
unsigned int prescaleHistory
MonitorElement * goodVxCountHistory
MonitorElement * hitCounter
MonitorElement * Vx_Y
char * Vx3DHLTAnalyzer::formatTime ( const time_t &  t)
privatevirtual

Definition at line 168 of file Vx3DHLTAnalyzer.cc.

169 {
170  static char ts[25];
171  strftime(ts, sizeof(ts), "%Y.%m.%d %H:%M:%S %Z", gmtime(&t));
172 
173  return ts;
174 }
unsigned int Vx3DHLTAnalyzer::HitCounter ( const edm::Event iEvent)
privatevirtual

Definition at line 154 of file Vx3DHLTAnalyzer.cc.

References edm::Event::getByLabel(), h, and j.

155 {
157  iEvent.getByLabel("siPixelRecHits",rechitspixel);
158 
159  unsigned int counter = 0;
160 
161  for (SiPixelRecHitCollection::const_iterator j = rechitspixel->begin(); j != rechitspixel->end(); j++)
162  for (edmNew::DetSet<SiPixelRecHit>::const_iterator h = j->begin(); h != j->end(); h++) counter += h->cluster()->size();
163 
164  return counter;
165 }
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
data_type const * const_iterator
Definition: DetSetNew.h:25
int j
Definition: DBlmapReader.cc:9
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
int Vx3DHLTAnalyzer::MyFit ( std::vector< double > *  vals)
privatevirtual

Definition at line 246 of file Vx3DHLTAnalyzer.cc.

References fitWZ::arglist, counterVx, gather_cfg::cout, alignCSCRings::e, Gauss3DFunc(), i, edm::detail::isnan(), j, maxLongLength, maxTransRadius, NULL, mathSSE::sqrt(), xPos, yPos, and zPos.

247 {
248  // RETURN CODE:
249  // 0 == OK
250  // -2 == NO OK - not enough "minNentries"
251  // Any other number == NO OK
252  unsigned int nParams = 9;
253 
254  if ((vals != NULL) && (vals->size() == nParams*2))
255  {
256  double nSigmaXY = 100.;
257  double nSigmaZ = 100.;
258  double varFactor = 4./25.; // Take into account the difference between the RMS and sigma (RMS usually greater than sigma)
259  double parDistanceXY = 0.005; // Unit: [cm]
260  double parDistanceZ = 0.5; // Unit: [cm]
261  double parDistanceddZ = 1e-3; // Unit: [rad]
262  double parDistanceCxy = 1e-5; // Unit: [cm^2]
263  double bestEdm = 1e-1;
264 
265  const unsigned int trials = 4;
266  double largerDist[trials] = {0.1, 5., 10., 100.};
267 
268  double covxz,covyz,det;
269  double deltaMean;
270  int bestMovementX = 1;
271  int bestMovementY = 1;
272  int bestMovementZ = 1;
273  int goodData;
274 
275  double arglist[2];
276  double amin,errdef,edm;
277  int nvpar,nparx;
278 
279  vector<double>::const_iterator it = vals->begin();
280 
281  TFitterMinuit* Gauss3D = new TFitterMinuit(nParams);
282  if (internalDebug == true) Gauss3D->SetPrintLevel(3);
283  else Gauss3D->SetPrintLevel(0);
284  Gauss3D->SetFCN(Gauss3DFunc);
285  arglist[0] = 10000; // Max number of function calls
286  arglist[1] = 1e-9; // Tolerance on likelihood
287 
288  if (internalDebug == true) cout << "\n@@@ START FITTING @@@" << endl;
289 
290  // @@@ Fit at X-deltaMean | X | X+deltaMean @@@
291  bestEdm = 1.;
292  for (int i = 0; i < 3; i++)
293  {
294  deltaMean = (double(i)-1.)*std::sqrt((*(it+0))*varFactor);
295  if (internalDebug == true) cout << "deltaMean --> " << deltaMean << endl;
296 
297  Gauss3D->Clear();
298 
299  // arg3 - first guess of parameter value
300  // arg4 - step of the parameter
301  Gauss3D->SetParameter(0,"var x ", *(it+0)*varFactor, parDistanceXY*parDistanceXY, 0., 0.);
302  Gauss3D->SetParameter(1,"var y ", *(it+1)*varFactor, parDistanceXY*parDistanceXY, 0., 0.);
303  Gauss3D->SetParameter(2,"var z ", *(it+2), parDistanceZ*parDistanceZ, 0., 0.);
304  Gauss3D->SetParameter(3,"cov xy", *(it+3), parDistanceCxy, 0., 0.);
305  Gauss3D->SetParameter(4,"dydz ", *(it+4), parDistanceddZ, 0., 0.);
306  Gauss3D->SetParameter(5,"dxdz ", *(it+5), parDistanceddZ, 0., 0.);
307  Gauss3D->SetParameter(6,"mean x", *(it+6)+deltaMean, parDistanceXY, 0., 0.);
308  Gauss3D->SetParameter(7,"mean y", *(it+7), parDistanceXY, 0., 0.);
309  Gauss3D->SetParameter(8,"mean z", *(it+8), parDistanceZ, 0., 0.);
310 
311  // Set the central positions of the centroid for vertex rejection
312  xPos = Gauss3D->GetParameter(6);
313  yPos = Gauss3D->GetParameter(7);
314  zPos = Gauss3D->GetParameter(8);
315 
316  // Set dimensions of the centroid for vertex rejection
317  maxTransRadius = nSigmaXY * std::sqrt(std::fabs(Gauss3D->GetParameter(0)) + std::fabs(Gauss3D->GetParameter(1))) / 2.;
318  maxLongLength = nSigmaZ * std::sqrt(std::fabs(Gauss3D->GetParameter(2)));
319 
320  goodData = Gauss3D->ExecuteCommand("MIGRAD",arglist,2);
321  Gauss3D->GetStats(amin, edm, errdef, nvpar, nparx);
322 
323  if (counterVx < minNentries) goodData = -2;
324  else if (std::isnan(edm) == true) goodData = -1;
325  else for (unsigned int j = 0; j < nParams; j++) if (std::isnan(Gauss3D->GetParError(j)) == true) { goodData = -1; break; }
326  if (goodData == 0)
327  {
328  covyz = Gauss3D->GetParameter(4)*(std::fabs(Gauss3D->GetParameter(2))-std::fabs(Gauss3D->GetParameter(1))) - Gauss3D->GetParameter(5)*Gauss3D->GetParameter(3);
329  covxz = Gauss3D->GetParameter(5)*(std::fabs(Gauss3D->GetParameter(2))-std::fabs(Gauss3D->GetParameter(0))) - Gauss3D->GetParameter(4)*Gauss3D->GetParameter(3);
330 
331  det = std::fabs(Gauss3D->GetParameter(0)) * (std::fabs(Gauss3D->GetParameter(1))*std::fabs(Gauss3D->GetParameter(2)) - covyz*covyz) -
332  Gauss3D->GetParameter(3) * (Gauss3D->GetParameter(3)*std::fabs(Gauss3D->GetParameter(2)) - covxz*covyz) +
333  covxz * (Gauss3D->GetParameter(3)*covyz - covxz*std::fabs(Gauss3D->GetParameter(1)));
334  if (det < 0.) { goodData = -1; if (internalDebug == true) cout << "Negative determinant !" << endl; }
335  }
336 
337  if ((goodData == 0) && (std::fabs(edm) < bestEdm)) { bestEdm = edm; bestMovementX = i; }
338  }
339  if (internalDebug == true) cout << "Found bestMovementX --> " << bestMovementX << endl;
340 
341  // @@@ Fit at Y-deltaMean | Y | Y+deltaMean @@@
342  bestEdm = 1.;
343  for (int i = 0; i < 3; i++)
344  {
345  deltaMean = (double(i)-1.)*std::sqrt((*(it+1))*varFactor);
346  if (internalDebug == true)
347  {
348  cout << "deltaMean --> " << deltaMean << endl;
349  cout << "deltaMean X --> " << (double(bestMovementX)-1.)*std::sqrt((*(it+0))*varFactor) << endl;
350  }
351 
352  Gauss3D->Clear();
353 
354  // arg3 - first guess of parameter value
355  // arg4 - step of the parameter
356  Gauss3D->SetParameter(0,"var x ", *(it+0)*varFactor, parDistanceXY*parDistanceXY, 0., 0.);
357  Gauss3D->SetParameter(1,"var y ", *(it+1)*varFactor, parDistanceXY*parDistanceXY, 0., 0.);
358  Gauss3D->SetParameter(2,"var z ", *(it+2), parDistanceZ*parDistanceZ, 0., 0.);
359  Gauss3D->SetParameter(3,"cov xy", *(it+3), parDistanceCxy, 0., 0.);
360  Gauss3D->SetParameter(4,"dydz ", *(it+4), parDistanceddZ, 0., 0.);
361  Gauss3D->SetParameter(5,"dxdz ", *(it+5), parDistanceddZ, 0., 0.);
362  Gauss3D->SetParameter(6,"mean x", *(it+6)+(double(bestMovementX)-1.)*std::sqrt((*(it+0))*varFactor), parDistanceXY, 0., 0.);
363  Gauss3D->SetParameter(7,"mean y", *(it+7)+deltaMean, parDistanceXY, 0., 0.);
364  Gauss3D->SetParameter(8,"mean z", *(it+8), parDistanceZ, 0., 0.);
365 
366  // Set the central positions of the centroid for vertex rejection
367  xPos = Gauss3D->GetParameter(6);
368  yPos = Gauss3D->GetParameter(7);
369  zPos = Gauss3D->GetParameter(8);
370 
371  // Set dimensions of the centroid for vertex rejection
372  maxTransRadius = nSigmaXY * std::sqrt(std::fabs(Gauss3D->GetParameter(0)) + std::fabs(Gauss3D->GetParameter(1))) / 2.;
373  maxLongLength = nSigmaZ * std::sqrt(std::fabs(Gauss3D->GetParameter(2)));
374 
375  goodData = Gauss3D->ExecuteCommand("MIGRAD",arglist,2);
376  Gauss3D->GetStats(amin, edm, errdef, nvpar, nparx);
377 
378  if (counterVx < minNentries) goodData = -2;
379  else if (std::isnan(edm) == true) goodData = -1;
380  else for (unsigned int j = 0; j < nParams; j++) if (std::isnan(Gauss3D->GetParError(j)) == true) { goodData = -1; break; }
381  if (goodData == 0)
382  {
383  covyz = Gauss3D->GetParameter(4)*(std::fabs(Gauss3D->GetParameter(2))-std::fabs(Gauss3D->GetParameter(1))) - Gauss3D->GetParameter(5)*Gauss3D->GetParameter(3);
384  covxz = Gauss3D->GetParameter(5)*(std::fabs(Gauss3D->GetParameter(2))-std::fabs(Gauss3D->GetParameter(0))) - Gauss3D->GetParameter(4)*Gauss3D->GetParameter(3);
385 
386  det = std::fabs(Gauss3D->GetParameter(0)) * (std::fabs(Gauss3D->GetParameter(1))*std::fabs(Gauss3D->GetParameter(2)) - covyz*covyz) -
387  Gauss3D->GetParameter(3) * (Gauss3D->GetParameter(3)*std::fabs(Gauss3D->GetParameter(2)) - covxz*covyz) +
388  covxz * (Gauss3D->GetParameter(3)*covyz - covxz*std::fabs(Gauss3D->GetParameter(1)));
389  if (det < 0.) { goodData = -1; if (internalDebug == true) cout << "Negative determinant !" << endl; }
390  }
391 
392  if ((goodData == 0) && (std::fabs(edm) < bestEdm)) { bestEdm = edm; bestMovementY = i; }
393  }
394  if (internalDebug == true) cout << "Found bestMovementY --> " << bestMovementY << endl;
395 
396  // @@@ Fit at Z-deltaMean | Z | Z+deltaMean @@@
397  bestEdm = 1.;
398  for (int i = 0; i < 3; i++)
399  {
400  deltaMean = (double(i)-1.)*std::sqrt(*(it+2));
401  if (internalDebug == true)
402  {
403  cout << "deltaMean --> " << deltaMean << endl;
404  cout << "deltaMean X --> " << (double(bestMovementX)-1.)*std::sqrt((*(it+0))*varFactor) << endl;
405  cout << "deltaMean Y --> " << (double(bestMovementY)-1.)*std::sqrt((*(it+1))*varFactor) << endl;
406  }
407 
408  Gauss3D->Clear();
409 
410  // arg3 - first guess of parameter value
411  // arg4 - step of the parameter
412  Gauss3D->SetParameter(0,"var x ", *(it+0)*varFactor, parDistanceXY*parDistanceXY, 0., 0.);
413  Gauss3D->SetParameter(1,"var y ", *(it+1)*varFactor, parDistanceXY*parDistanceXY, 0., 0.);
414  Gauss3D->SetParameter(2,"var z ", *(it+2), parDistanceZ*parDistanceZ, 0., 0.);
415  Gauss3D->SetParameter(3,"cov xy", *(it+3), parDistanceCxy, 0., 0.);
416  Gauss3D->SetParameter(4,"dydz ", *(it+4), parDistanceddZ, 0., 0.);
417  Gauss3D->SetParameter(5,"dxdz ", *(it+5), parDistanceddZ, 0., 0.);
418  Gauss3D->SetParameter(6,"mean x", *(it+6)+(double(bestMovementX)-1.)*std::sqrt((*(it+0))*varFactor), parDistanceXY, 0., 0.);
419  Gauss3D->SetParameter(7,"mean y", *(it+7)+(double(bestMovementY)-1.)*std::sqrt((*(it+1))*varFactor), parDistanceXY, 0., 0.);
420  Gauss3D->SetParameter(8,"mean z", *(it+8)+deltaMean, parDistanceZ, 0., 0.);
421 
422  // Set the central positions of the centroid for vertex rejection
423  xPos = Gauss3D->GetParameter(6);
424  yPos = Gauss3D->GetParameter(7);
425  zPos = Gauss3D->GetParameter(8);
426 
427  // Set dimensions of the centroid for vertex rejection
428  maxTransRadius = nSigmaXY * std::sqrt(std::fabs(Gauss3D->GetParameter(0)) + std::fabs(Gauss3D->GetParameter(1))) / 2.;
429  maxLongLength = nSigmaZ * std::sqrt(std::fabs(Gauss3D->GetParameter(2)));
430 
431  goodData = Gauss3D->ExecuteCommand("MIGRAD",arglist,2);
432  Gauss3D->GetStats(amin, edm, errdef, nvpar, nparx);
433 
434  if (counterVx < minNentries) goodData = -2;
435  else if (std::isnan(edm) == true) goodData = -1;
436  else for (unsigned int j = 0; j < nParams; j++) if (std::isnan(Gauss3D->GetParError(j)) == true) { goodData = -1; break; }
437  if (goodData == 0)
438  {
439  covyz = Gauss3D->GetParameter(4)*(std::fabs(Gauss3D->GetParameter(2))-std::fabs(Gauss3D->GetParameter(1))) - Gauss3D->GetParameter(5)*Gauss3D->GetParameter(3);
440  covxz = Gauss3D->GetParameter(5)*(std::fabs(Gauss3D->GetParameter(2))-std::fabs(Gauss3D->GetParameter(0))) - Gauss3D->GetParameter(4)*Gauss3D->GetParameter(3);
441 
442  det = std::fabs(Gauss3D->GetParameter(0)) * (std::fabs(Gauss3D->GetParameter(1))*std::fabs(Gauss3D->GetParameter(2)) - covyz*covyz) -
443  Gauss3D->GetParameter(3) * (Gauss3D->GetParameter(3)*std::fabs(Gauss3D->GetParameter(2)) - covxz*covyz) +
444  covxz * (Gauss3D->GetParameter(3)*covyz - covxz*std::fabs(Gauss3D->GetParameter(1)));
445  if (det < 0.) { goodData = -1; if (internalDebug == true) cout << "Negative determinant !" << endl; }
446  }
447 
448  if ((goodData == 0) && (std::fabs(edm) < bestEdm)) { bestEdm = edm; bestMovementZ = i; }
449  }
450  if (internalDebug == true) cout << "Found bestMovementZ --> " << bestMovementZ << endl;
451 
452  Gauss3D->Clear();
453 
454  // @@@ FINAL FIT @@@
455  // arg3 - first guess of parameter value
456  // arg4 - step of the parameter
457  Gauss3D->SetParameter(0,"var x ", *(it+0)*varFactor, parDistanceXY*parDistanceXY, 0., 0.);
458  Gauss3D->SetParameter(1,"var y ", *(it+1)*varFactor, parDistanceXY*parDistanceXY, 0., 0.);
459  Gauss3D->SetParameter(2,"var z ", *(it+2), parDistanceZ*parDistanceZ, 0., 0.);
460  Gauss3D->SetParameter(3,"cov xy", *(it+3), parDistanceCxy, 0., 0.);
461  Gauss3D->SetParameter(4,"dydz ", *(it+4), parDistanceddZ, 0., 0.);
462  Gauss3D->SetParameter(5,"dxdz ", *(it+5), parDistanceddZ, 0., 0.);
463  Gauss3D->SetParameter(6,"mean x", *(it+6)+(double(bestMovementX)-1.)*std::sqrt((*(it+0))*varFactor), parDistanceXY, 0., 0.);
464  Gauss3D->SetParameter(7,"mean y", *(it+7)+(double(bestMovementY)-1.)*std::sqrt((*(it+1))*varFactor), parDistanceXY, 0., 0.);
465  Gauss3D->SetParameter(8,"mean z", *(it+8)+(double(bestMovementZ)-1.)*std::sqrt(*(it+2)), parDistanceZ, 0., 0.);
466 
467  // Set the central positions of the centroid for vertex rejection
468  xPos = Gauss3D->GetParameter(6);
469  yPos = Gauss3D->GetParameter(7);
470  zPos = Gauss3D->GetParameter(8);
471 
472  // Set dimensions of the centroid for vertex rejection
473  maxTransRadius = nSigmaXY * std::sqrt(std::fabs(Gauss3D->GetParameter(0)) + std::fabs(Gauss3D->GetParameter(1))) / 2.;
474  maxLongLength = nSigmaZ * std::sqrt(std::fabs(Gauss3D->GetParameter(2)));
475 
476  goodData = Gauss3D->ExecuteCommand("MIGRAD",arglist,2);
477  Gauss3D->GetStats(amin, edm, errdef, nvpar, nparx);
478 
479  if (counterVx < minNentries) goodData = -2;
480  else if (std::isnan(edm) == true) goodData = -1;
481  else for (unsigned int j = 0; j < nParams; j++) if (std::isnan(Gauss3D->GetParError(j)) == true) { goodData = -1; break; }
482  if (goodData == 0)
483  {
484  covyz = Gauss3D->GetParameter(4)*(std::fabs(Gauss3D->GetParameter(2))-std::fabs(Gauss3D->GetParameter(1))) - Gauss3D->GetParameter(5)*Gauss3D->GetParameter(3);
485  covxz = Gauss3D->GetParameter(5)*(std::fabs(Gauss3D->GetParameter(2))-std::fabs(Gauss3D->GetParameter(0))) - Gauss3D->GetParameter(4)*Gauss3D->GetParameter(3);
486 
487  det = std::fabs(Gauss3D->GetParameter(0)) * (std::fabs(Gauss3D->GetParameter(1))*std::fabs(Gauss3D->GetParameter(2)) - covyz*covyz) -
488  Gauss3D->GetParameter(3) * (Gauss3D->GetParameter(3)*std::fabs(Gauss3D->GetParameter(2)) - covxz*covyz) +
489  covxz * (Gauss3D->GetParameter(3)*covyz - covxz*std::fabs(Gauss3D->GetParameter(1)));
490  if (det < 0.) { goodData = -1; if (internalDebug == true) cout << "Negative determinant !" << endl; }
491  }
492 
493  // @@@ FIT WITH DIFFERENT PARAMETER DISTANCES@@@
494  // arg3 - first guess of parameter value
495  // arg4 - step of the parameter
496  for (unsigned int i = 0; i < trials; i++)
497  {
498  if ((goodData != 0) && (goodData != -2))
499  {
500  Gauss3D->Clear();
501 
502  if (internalDebug == true) cout << "FIT WITH DIFFERENT PARAMETER DISTANCES - STEP " << i+1 << endl;
503 
504  Gauss3D->SetParameter(0,"var x ", *(it+0)*varFactor, parDistanceXY*parDistanceXY * largerDist[i], 0, 0);
505  Gauss3D->SetParameter(1,"var y ", *(it+1)*varFactor, parDistanceXY*parDistanceXY * largerDist[i], 0, 0);
506  Gauss3D->SetParameter(2,"var z ", *(it+2), parDistanceZ*parDistanceZ * largerDist[i], 0, 0);
507  Gauss3D->SetParameter(3,"cov xy", *(it+3), parDistanceCxy * largerDist[i], 0, 0);
508  Gauss3D->SetParameter(4,"dydz ", *(it+4), parDistanceddZ * largerDist[i], 0, 0);
509  Gauss3D->SetParameter(5,"dxdz ", *(it+5), parDistanceddZ * largerDist[i], 0, 0);
510  Gauss3D->SetParameter(6,"mean x", *(it+6)+(double(bestMovementX)-1.)*std::sqrt((*(it+0))*varFactor), parDistanceXY * largerDist[i], 0, 0);
511  Gauss3D->SetParameter(7,"mean y", *(it+7)+(double(bestMovementY)-1.)*std::sqrt((*(it+1))*varFactor), parDistanceXY * largerDist[i], 0, 0);
512  Gauss3D->SetParameter(8,"mean z", *(it+8)+(double(bestMovementZ)-1.)*std::sqrt(*(it+2)), parDistanceZ * largerDist[i], 0, 0);
513 
514  // Set the central positions of the centroid for vertex rejection
515  xPos = Gauss3D->GetParameter(6);
516  yPos = Gauss3D->GetParameter(7);
517  zPos = Gauss3D->GetParameter(8);
518 
519  // Set dimensions of the centroid for vertex rejection
520  maxTransRadius = nSigmaXY * std::sqrt(std::fabs(Gauss3D->GetParameter(0)) + std::fabs(Gauss3D->GetParameter(1))) / 2.;
521  maxLongLength = nSigmaZ * std::sqrt(std::fabs(Gauss3D->GetParameter(2)));
522 
523  goodData = Gauss3D->ExecuteCommand("MIGRAD",arglist,2);
524  Gauss3D->GetStats(amin, edm, errdef, nvpar, nparx);
525 
526  if (counterVx < minNentries) goodData = -2;
527  else if (std::isnan(edm) == true) goodData = -1;
528  else for (unsigned int j = 0; j < nParams; j++) if (std::isnan(Gauss3D->GetParError(j)) == true) { goodData = -1; break; }
529  if (goodData == 0)
530  {
531  covyz = Gauss3D->GetParameter(4)*(std::fabs(Gauss3D->GetParameter(2))-std::fabs(Gauss3D->GetParameter(1))) - Gauss3D->GetParameter(5)*Gauss3D->GetParameter(3);
532  covxz = Gauss3D->GetParameter(5)*(std::fabs(Gauss3D->GetParameter(2))-std::fabs(Gauss3D->GetParameter(0))) - Gauss3D->GetParameter(4)*Gauss3D->GetParameter(3);
533 
534  det = std::fabs(Gauss3D->GetParameter(0)) * (std::fabs(Gauss3D->GetParameter(1))*std::fabs(Gauss3D->GetParameter(2)) - covyz*covyz) -
535  Gauss3D->GetParameter(3) * (Gauss3D->GetParameter(3)*std::fabs(Gauss3D->GetParameter(2)) - covxz*covyz) +
536  covxz * (Gauss3D->GetParameter(3)*covyz - covxz*std::fabs(Gauss3D->GetParameter(1)));
537  if (det < 0.) { goodData = -1; if (internalDebug == true) cout << "Negative determinant !" << endl; }
538  }
539  } else break;
540  }
541 
542  if (goodData == 0)
543  for (unsigned int i = 0; i < nParams; i++)
544  {
545  vals->operator[](i) = Gauss3D->GetParameter(i);
546  vals->operator[](i+nParams) = Gauss3D->GetParError(i);
547  }
548 
549  delete Gauss3D;
550  return goodData;
551  }
552 
553  return -1;
554 }
tuple arglist
Definition: fitWZ.py:38
int i
Definition: DBlmapReader.cc:9
double maxLongLength
double zPos
unsigned int minNentries
#define NULL
Definition: scimark2.h:8
double maxTransRadius
double xPos
bool isnan(float x)
Definition: math.h:13
T sqrt(T t)
Definition: SSEVec.h:46
int j
Definition: DBlmapReader.cc:9
double yPos
void Gauss3DFunc(int &, double *, double &fval, double *par, int)
unsigned int counterVx
tuple cout
Definition: gather_cfg.py:121
void Vx3DHLTAnalyzer::reset ( std::string  ResetType)
privatevirtual

Definition at line 557 of file Vx3DHLTAnalyzer.cc.

References convertSQLiteXML::runNumber, and Vertices.

558 {
559  if (ResetType.compare("scratch") == 0)
560  {
561  runNumber = 0;
562  numberGoodFits = 0;
563  numberFits = 0;
564  lastLumiOfFit = 0;
565 
566  Vx_X->Reset();
567  Vx_Y->Reset();
568  Vx_Z->Reset();
569 
570  Vx_ZX->Reset();
571  Vx_ZY->Reset();
572  Vx_XY->Reset();
573 
574  mXlumi->Reset();
575  mYlumi->Reset();
576  mZlumi->Reset();
577 
578  sXlumi->Reset();
579  sYlumi->Reset();
580  sZlumi->Reset();
581 
582  dxdzlumi->Reset();
583  dydzlumi->Reset();
584 
585  hitCounter->Reset();
587  goodVxCounter->Reset();
589  fitResults->Reset();
590 
591  reportSummary->Fill(0.);
592  reportSummaryMap->Fill(0.5, 0.5, 0.);
593 
594  Vertices.clear();
595 
596  lumiCounter = 0;
597  lumiCounterHisto = 0;
598  totalHits = 0;
599  beginTimeOfFit = 0;
600  endTimeOfFit = 0;
601  beginLumiOfFit = 0;
602  endLumiOfFit = 0;
603  }
604  else if (ResetType.compare("whole") == 0)
605  {
606  Vx_X->Reset();
607  Vx_Y->Reset();
608  Vx_Z->Reset();
609 
610  Vx_ZX->Reset();
611  Vx_ZY->Reset();
612  Vx_XY->Reset();
613 
614  Vertices.clear();
615 
616  lumiCounter = 0;
617  lumiCounterHisto = 0;
618  totalHits = 0;
619  beginTimeOfFit = 0;
620  endTimeOfFit = 0;
621  beginLumiOfFit = 0;
622  endLumiOfFit = 0;
623  }
624  else if (ResetType.compare("partial") == 0)
625  {
626  Vx_X->Reset();
627  Vx_Y->Reset();
628  Vx_Z->Reset();
629 
630  Vertices.clear();
631 
632  lumiCounter = 0;
633  totalHits = 0;
634  beginTimeOfFit = 0;
635  endTimeOfFit = 0;
636  beginLumiOfFit = 0;
637  endLumiOfFit = 0;
638  }
639  else if (ResetType.compare("nohisto") == 0)
640  {
641  Vertices.clear();
642 
643  lumiCounter = 0;
644  lumiCounterHisto = 0;
645  totalHits = 0;
646  beginTimeOfFit = 0;
647  endTimeOfFit = 0;
648  beginLumiOfFit = 0;
649  endLumiOfFit = 0;
650  }
651  else if (ResetType.compare("hitCounter") == 0)
652  totalHits = 0;
653 }
unsigned int lumiCounter
MonitorElement * dxdzlumi
MonitorElement * Vx_ZX
unsigned int totalHits
unsigned int numberFits
unsigned int beginLumiOfFit
MonitorElement * hitCountHistory
MonitorElement * Vx_X
MonitorElement * mYlumi
edm::TimeValue_t beginTimeOfFit
edm::TimeValue_t endTimeOfFit
MonitorElement * sYlumi
MonitorElement * reportSummaryMap
void Fill(long long x)
MonitorElement * Vx_XY
MonitorElement * sZlumi
MonitorElement * fitResults
MonitorElement * Vx_ZY
unsigned int endLumiOfFit
unsigned int numberGoodFits
MonitorElement * reportSummary
MonitorElement * goodVxCounter
MonitorElement * dydzlumi
MonitorElement * Vx_Z
MonitorElement * mXlumi
MonitorElement * mZlumi
MonitorElement * sXlumi
unsigned int lastLumiOfFit
unsigned int lumiCounterHisto
unsigned int runNumber
std::vector< VertexType > Vertices
MonitorElement * goodVxCountHistory
MonitorElement * hitCounter
void Reset(void)
reset ME (ie. contents, errors, etc)
MonitorElement * Vx_Y
void Vx3DHLTAnalyzer::writeToFile ( std::vector< double > *  vals,
edm::TimeValue_t  BeginTimeOfFit,
edm::TimeValue_t  EndTimeOfFit,
unsigned int  BeginLumiOfFit,
unsigned int  EndLumiOfFit,
int  dataType 
)
privatevirtual

Definition at line 656 of file Vx3DHLTAnalyzer.cc.

References convertXMLtoSQLite_cfg::fileName, edm::formatTime(), NULL, dbtoconf::out, download_sqlite_cfg::outputFile, convertSQLiteXML::runNumber, and mathSSE::sqrt().

662 {
663  stringstream BufferString;
664  BufferString.precision(5);
665 
666  outputFile.open(fileName.c_str(), ios::out);
667 
668  if ((outputFile.is_open() == true) && (vals != NULL) && (vals->size() == 8*2))
669  {
670  vector<double>::const_iterator it = vals->begin();
671 
672  outputFile << "Runnumber " << runNumber << endl;
673  outputFile << "BeginTimeOfFit " << formatTime(beginTimeOfFit >> 32) << " " << (beginTimeOfFit >> 32) << endl;
674  outputFile << "EndTimeOfFit " << formatTime(endTimeOfFit >> 32) << " " << (endTimeOfFit >> 32) << endl;
675  outputFile << "LumiRange " << beginLumiOfFit << " - " << endLumiOfFit << endl;
676  outputFile << "Type " << dataType << endl;
677  // 3D Vertexing with Pixel Tracks:
678  // Good data = Type 3
679  // Bad data = Type -1
680 
681  BufferString << *(it+0);
682  outputFile << "X0 " << BufferString.str().c_str() << endl;
683  BufferString.str("");
684 
685  BufferString << *(it+1);
686  outputFile << "Y0 " << BufferString.str().c_str() << endl;
687  BufferString.str("");
688 
689  BufferString << *(it+2);
690  outputFile << "Z0 " << BufferString.str().c_str() << endl;
691  BufferString.str("");
692 
693  BufferString << *(it+3);
694  outputFile << "sigmaZ0 " << BufferString.str().c_str() << endl;
695  BufferString.str("");
696 
697  BufferString << *(it+4);
698  outputFile << "dxdz " << BufferString.str().c_str() << endl;
699  BufferString.str("");
700 
701  BufferString << *(it+5);
702  outputFile << "dydz " << BufferString.str().c_str() << endl;
703  BufferString.str("");
704 
705  BufferString << *(it+6);
706  outputFile << "BeamWidthX " << BufferString.str().c_str() << endl;
707  BufferString.str("");
708 
709  BufferString << *(it+7);
710  outputFile << "BeamWidthY " << BufferString.str().c_str() << endl;
711  BufferString.str("");
712 
713  outputFile << "Cov(0,j) " << *(it+8) << " 0.0 0.0 0.0 0.0 0.0 0.0" << endl;
714  outputFile << "Cov(1,j) 0.0 " << *(it+9) << " 0.0 0.0 0.0 0.0 0.0" << endl;
715  outputFile << "Cov(2,j) 0.0 0.0 " << *(it+10) << " 0.0 0.0 0.0 0.0" << endl;
716  outputFile << "Cov(3,j) 0.0 0.0 0.0 " << *(it+11) << " 0.0 0.0 0.0" << endl;
717  outputFile << "Cov(4,j) 0.0 0.0 0.0 0.0 " << *(it+12) << " 0.0 0.0" << endl;
718  outputFile << "Cov(5,j) 0.0 0.0 0.0 0.0 0.0 " << *(it+13) << " 0.0" << endl;
719  outputFile << "Cov(6,j) 0.0 0.0 0.0 0.0 0.0 0.0 " << ((*(it+14)) + (*(it+15)) + 2.*std::sqrt((*(it+14))*(*(it+15)))) / 4. << endl;
720 
721  outputFile << "EmittanceX 0.0" << endl;
722  outputFile << "EmittanceY 0.0" << endl;
723  outputFile << "BetaStar 0.0" << endl;
724  }
725  outputFile.close();
726 
727  if ((debugMode == true) && (outputDebugFile.is_open() == true) && (vals != NULL) && (vals->size() == 8*2))
728  {
729  vector<double>::const_iterator it = vals->begin();
730 
731  outputDebugFile << "Runnumber " << runNumber << endl;
732  outputDebugFile << "BeginTimeOfFit " << formatTime(beginTimeOfFit >> 32) << " " << (beginTimeOfFit >> 32) << endl;
733  outputDebugFile << "EndTimeOfFit " << formatTime(endTimeOfFit >> 32) << " " << (endTimeOfFit >> 32) << endl;
734  outputDebugFile << "LumiRange " << beginLumiOfFit << " - " << endLumiOfFit << endl;
735  outputDebugFile << "Type " << dataType << endl;
736  // 3D Vertexing with Pixel Tracks:
737  // Good data = Type 3
738  // Bad data = Type -1
739 
740  BufferString << *(it+0);
741  outputDebugFile << "X0 " << BufferString.str().c_str() << endl;
742  BufferString.str("");
743 
744  BufferString << *(it+1);
745  outputDebugFile << "Y0 " << BufferString.str().c_str() << endl;
746  BufferString.str("");
747 
748  BufferString << *(it+2);
749  outputDebugFile << "Z0 " << BufferString.str().c_str() << endl;
750  BufferString.str("");
751 
752  BufferString << *(it+3);
753  outputDebugFile << "sigmaZ0 " << BufferString.str().c_str() << endl;
754  BufferString.str("");
755 
756  BufferString << *(it+4);
757  outputDebugFile << "dxdz " << BufferString.str().c_str() << endl;
758  BufferString.str("");
759 
760  BufferString << *(it+5);
761  outputDebugFile << "dydz " << BufferString.str().c_str() << endl;
762  BufferString.str("");
763 
764  BufferString << *(it+6);
765  outputDebugFile << "BeamWidthX " << BufferString.str().c_str() << endl;
766  BufferString.str("");
767 
768  BufferString << *(it+7);
769  outputDebugFile << "BeamWidthY " << BufferString.str().c_str() << endl;
770  BufferString.str("");
771 
772  outputDebugFile << "Cov(0,j) " << *(it+8) << " 0.0 0.0 0.0 0.0 0.0 0.0" << endl;
773  outputDebugFile << "Cov(1,j) 0.0 " << *(it+9) << " 0.0 0.0 0.0 0.0 0.0" << endl;
774  outputDebugFile << "Cov(2,j) 0.0 0.0 " << *(it+10) << " 0.0 0.0 0.0 0.0" << endl;
775  outputDebugFile << "Cov(3,j) 0.0 0.0 0.0 " << *(it+11) << " 0.0 0.0 0.0" << endl;
776  outputDebugFile << "Cov(4,j) 0.0 0.0 0.0 0.0 " << *(it+12) << " 0.0 0.0" << endl;
777  outputDebugFile << "Cov(5,j) 0.0 0.0 0.0 0.0 0.0 " << *(it+13) << " 0.0" << endl;
778  outputDebugFile << "Cov(6,j) 0.0 0.0 0.0 0.0 0.0 0.0 " << ((*(it+14)) + (*(it+15)) + 2.*std::sqrt((*(it+14))*(*(it+15)))) / 4. << endl;
779 
780  outputDebugFile << "EmittanceX 0.0" << endl;
781  outputDebugFile << "EmittanceY 0.0" << endl;
782  outputDebugFile << "BetaStar 0.0" << endl;
783  }
784 }
virtual char * formatTime(const time_t &t)
unsigned int beginLumiOfFit
#define NULL
Definition: scimark2.h:8
edm::TimeValue_t beginTimeOfFit
edm::TimeValue_t endTimeOfFit
std::string fileName
unsigned int endLumiOfFit
T sqrt(T t)
Definition: SSEVec.h:46
tuple out
Definition: dbtoconf.py:99
ofstream outputDebugFile
unsigned int runNumber

Member Data Documentation

unsigned int Vx3DHLTAnalyzer::beginLumiOfFit
private

Definition at line 163 of file Vx3DHLTAnalyzer.h.

edm::TimeValue_t Vx3DHLTAnalyzer::beginTimeOfFit
private

Definition at line 151 of file Vx3DHLTAnalyzer.h.

bool Vx3DHLTAnalyzer::dataFromFit
private

Definition at line 102 of file Vx3DHLTAnalyzer.h.

bool Vx3DHLTAnalyzer::debugMode
private

Definition at line 100 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::dxdzlumi
private

Definition at line 124 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::dydzlumi
private

Definition at line 125 of file Vx3DHLTAnalyzer.h.

unsigned int Vx3DHLTAnalyzer::endLumiOfFit
private

Definition at line 164 of file Vx3DHLTAnalyzer.h.

edm::TimeValue_t Vx3DHLTAnalyzer::endTimeOfFit
private

Definition at line 152 of file Vx3DHLTAnalyzer.h.

std::string Vx3DHLTAnalyzer::fileName
private

Definition at line 110 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::fitResults
private

Definition at line 144 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::goodVxCounter
private

Definition at line 135 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::goodVxCountHistory
private

Definition at line 136 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::hitCounter
private

Definition at line 138 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::hitCountHistory
private

Definition at line 139 of file Vx3DHLTAnalyzer.h.

bool Vx3DHLTAnalyzer::internalDebug
private

Definition at line 167 of file Vx3DHLTAnalyzer.h.

unsigned int Vx3DHLTAnalyzer::lastLumiOfFit
private

Definition at line 165 of file Vx3DHLTAnalyzer.h.

unsigned int Vx3DHLTAnalyzer::lumiCounter
private

Definition at line 156 of file Vx3DHLTAnalyzer.h.

unsigned int Vx3DHLTAnalyzer::lumiCounterHisto
private

Definition at line 157 of file Vx3DHLTAnalyzer.h.

unsigned int Vx3DHLTAnalyzer::maxLumiIntegration
private

Definition at line 159 of file Vx3DHLTAnalyzer.h.

unsigned int Vx3DHLTAnalyzer::minNentries
private

Definition at line 103 of file Vx3DHLTAnalyzer.h.

double Vx3DHLTAnalyzer::minVxDoF
private

Definition at line 166 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::mXlumi
private

Definition at line 116 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::mYlumi
private

Definition at line 117 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::mZlumi
private

Definition at line 118 of file Vx3DHLTAnalyzer.h.

unsigned int Vx3DHLTAnalyzer::nBinsHistoricalPlot
private

Definition at line 153 of file Vx3DHLTAnalyzer.h.

unsigned int Vx3DHLTAnalyzer::nBinsWholeHistory
private

Definition at line 154 of file Vx3DHLTAnalyzer.h.

unsigned int Vx3DHLTAnalyzer::nLumiReset
private

Definition at line 101 of file Vx3DHLTAnalyzer.h.

unsigned int Vx3DHLTAnalyzer::numberFits
private

Definition at line 162 of file Vx3DHLTAnalyzer.h.

unsigned int Vx3DHLTAnalyzer::numberGoodFits
private

Definition at line 161 of file Vx3DHLTAnalyzer.h.

ofstream Vx3DHLTAnalyzer::outputDebugFile
private

Definition at line 150 of file Vx3DHLTAnalyzer.h.

ofstream Vx3DHLTAnalyzer::outputFile
private

Definition at line 149 of file Vx3DHLTAnalyzer.h.

unsigned int Vx3DHLTAnalyzer::prescaleHistory
private

Definition at line 160 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::reportSummary
private

Definition at line 141 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::reportSummaryMap
private

Definition at line 142 of file Vx3DHLTAnalyzer.h.

unsigned int Vx3DHLTAnalyzer::runNumber
private

Definition at line 155 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::sXlumi
private

Definition at line 120 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::sYlumi
private

Definition at line 121 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::sZlumi
private

Definition at line 122 of file Vx3DHLTAnalyzer.h.

unsigned int Vx3DHLTAnalyzer::totalHits
private

Definition at line 158 of file Vx3DHLTAnalyzer.h.

edm::InputTag Vx3DHLTAnalyzer::vertexCollection
private

Definition at line 99 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::Vx_X
private

Definition at line 127 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::Vx_XY
private

Definition at line 133 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::Vx_Y
private

Definition at line 128 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::Vx_Z
private

Definition at line 129 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::Vx_ZX
private

Definition at line 131 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::Vx_ZY
private

Definition at line 132 of file Vx3DHLTAnalyzer.h.

double Vx3DHLTAnalyzer::xRange
private

Definition at line 104 of file Vx3DHLTAnalyzer.h.

double Vx3DHLTAnalyzer::xStep
private

Definition at line 105 of file Vx3DHLTAnalyzer.h.

double Vx3DHLTAnalyzer::yRange
private

Definition at line 106 of file Vx3DHLTAnalyzer.h.

double Vx3DHLTAnalyzer::yStep
private

Definition at line 107 of file Vx3DHLTAnalyzer.h.

double Vx3DHLTAnalyzer::zRange
private

Definition at line 108 of file Vx3DHLTAnalyzer.h.

double Vx3DHLTAnalyzer::zStep
private

Definition at line 109 of file Vx3DHLTAnalyzer.h.