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

Public Member Functions

 Vx3DHLTAnalyzer (const edm::ParameterSet &)
 
 ~Vx3DHLTAnalyzer ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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 beginRun ()
 
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
 
std::ofstream outputDebugFile
 
std::ofstream outputFile
 
edm::EDGetTokenT
< SiPixelRecHitCollection
pixelHitCollection
 
unsigned int prescaleHistory
 
MonitorElementreportSummary
 
MonitorElementreportSummaryMap
 
unsigned int runNumber
 
MonitorElementsXlumi
 
MonitorElementsYlumi
 
MonitorElementsZlumi
 
unsigned int totalHits
 
edm::EDGetTokenT
< reco::VertexCollection
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
 
- 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::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)
 

Detailed Description

Description: beam-spot monitor entirely based on pixel detector information Implementation: the monitoring is based on a 3D fit to the vertex cloud

Definition at line 75 of file Vx3DHLTAnalyzer.h.

Constructor & Destructor Documentation

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

Definition at line 35 of file Vx3DHLTAnalyzer.cc.

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

36 {
37  debugMode = true;
38  nLumiReset = 1; // Number of integrated lumis to perform the fit
39  dataFromFit = true; // The Beam Spot data can be either taken from the histograms or from the fit results
40  minNentries = 35; // Minimum number of good vertices to perform the fit
41  xRange = 2.; // [cm]
42  xStep = 0.001; // [cm]
43  yRange = 2.; // [cm]
44  yStep = 0.001; // [cm]
45  zRange = 30.; // [cm]
46  zStep = 0.05; // [cm]
47  VxErrCorr = 1.5;
48  fileName = "BeamPixelResults.txt";
49 
50 
51  vertexCollection = consumes<reco::VertexCollection>(iConfig.getUntrackedParameter<edm::InputTag>("vertexCollection", edm::InputTag("pixelVertices")));
52  pixelHitCollection = consumes<SiPixelRecHitCollection>(iConfig.getUntrackedParameter<edm::InputTag>("pixelHitCollection", edm::InputTag("siPixelRecHits")));
53 
54  debugMode = iConfig.getParameter<bool>("debugMode");
55  nLumiReset = iConfig.getParameter<unsigned int>("nLumiReset");
56  dataFromFit = iConfig.getParameter<bool>("dataFromFit");
57  minNentries = iConfig.getParameter<unsigned int>("minNentries");
58  xRange = iConfig.getParameter<double>("xRange");
59  xStep = iConfig.getParameter<double>("xStep");
60  yRange = iConfig.getParameter<double>("yRange");
61  yStep = iConfig.getParameter<double>("yStep");
62  zRange = iConfig.getParameter<double>("zRange");
63  zStep = iConfig.getParameter<double>("zStep");
64  VxErrCorr = iConfig.getParameter<double>("VxErrCorr");
65  fileName = iConfig.getParameter<string>("fileName");
66 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< reco::VertexCollection > vertexCollection
unsigned int minNentries
edm::EDGetTokenT< SiPixelRecHitCollection > pixelHitCollection
unsigned int nLumiReset
std::string fileName
double VxErrCorr
Vx3DHLTAnalyzer::~Vx3DHLTAnalyzer ( )

Definition at line 69 of file Vx3DHLTAnalyzer.cc.

70 {
71 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 74 of file Vx3DHLTAnalyzer.cc.

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

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

References considerVxCovariance, pi, and reset().

1061 {
1062  // ### Set internal variables ###
1063  reset("scratch");
1064  prescaleHistory = 1; // Set the number of lumis to update historical plot
1065  maxLumiIntegration = 15; // If failing fits, this is the maximum number of integrated lumis after which a reset is issued
1066  minVxDoF = 10.; // Good vertex selection cut
1067  // For vertex fitter without track-weight: d.o.f. = 2*NTracks - 3
1068  // For vertex fitter with track-weight: d.o.f. = sum_NTracks(2*track_weight) - 3
1069  internalDebug = false;
1070  considerVxCovariance = true; // Deconvolute vertex covariance matrix
1071  pi = 3.141592653589793238;
1072  // ##############################
1073 }
unsigned int maxLumiIntegration
bool considerVxCovariance
virtual void reset(std::string ResetType)
unsigned int prescaleHistory
double pi
void Vx3DHLTAnalyzer::beginLuminosityBlock ( const edm::LuminosityBlock lumiBlock,
const edm::EventSetup iSetup 
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 781 of file Vx3DHLTAnalyzer.cc.

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

783 {
784  if ((lumiCounter == 0) && (lumiBlock.luminosityBlock() > lastLumiOfFit))
785  {
786  beginTimeOfFit = lumiBlock.beginTime().value();
787  beginLumiOfFit = lumiBlock.luminosityBlock();
788  lumiCounter++;
790  }
791  else if ((lumiCounter != 0) && (lumiBlock.luminosityBlock() >= (beginLumiOfFit+lumiCounter))) { lumiCounter++; lumiCounterHisto++; }
792 }
unsigned int lumiCounter
unsigned int beginLumiOfFit
edm::TimeValue_t beginTimeOfFit
Timestamp const & beginTime() const
LuminosityBlockNumber_t luminosityBlock() const
unsigned int lastLumiOfFit
unsigned int lumiCounterHisto
TimeValue_t value() const
Definition: Timestamp.h:56
void Vx3DHLTAnalyzer::beginRun ( )
privatevirtual

Definition at line 1079 of file Vx3DHLTAnalyzer.cc.

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

1080 {
1081  DQMStore* dbe = 0;
1082  dbe = Service<DQMStore>().operator->();
1083 
1084  // ### Set internal variables ###
1085  nBinsHistoricalPlot = 80;
1086  nBinsWholeHistory = 3000; // Correspond to about 20h of data taking: 20h * 60min * 60s / 23s per lumi-block = 3130
1087  // ##############################
1088 
1089  if ( dbe )
1090  {
1091  dbe->setCurrentFolder("BeamPixel");
1092 
1093  Vx_X = dbe->book1D("vertex x", "Primary Vertex X Coordinate Distribution", int(rint(xRange/xStep)), -xRange/2., xRange/2.);
1094  Vx_Y = dbe->book1D("vertex y", "Primary Vertex Y Coordinate Distribution", int(rint(yRange/yStep)), -yRange/2., yRange/2.);
1095  Vx_Z = dbe->book1D("vertex z", "Primary Vertex Z Coordinate Distribution", int(rint(zRange/zStep)), -zRange/2., zRange/2.);
1096  Vx_X->setAxisTitle("Primary Vertices X [cm]",1);
1097  Vx_X->setAxisTitle("Entries [#]",2);
1098  Vx_Y->setAxisTitle("Primary Vertices Y [cm]",1);
1099  Vx_Y->setAxisTitle("Entries [#]",2);
1100  Vx_Z->setAxisTitle("Primary Vertices Z [cm]",1);
1101  Vx_Z->setAxisTitle("Entries [#]",2);
1102 
1103  mXlumi = dbe->book1D("muX vs lumi", "\\mu_{x} vs. Lumisection", nBinsHistoricalPlot, 0.5, (double)nBinsHistoricalPlot+0.5);
1104  mYlumi = dbe->book1D("muY vs lumi", "\\mu_{y} vs. Lumisection", nBinsHistoricalPlot, 0.5, (double)nBinsHistoricalPlot+0.5);
1105  mZlumi = dbe->book1D("muZ vs lumi", "\\mu_{z} vs. Lumisection", nBinsHistoricalPlot, 0.5, (double)nBinsHistoricalPlot+0.5);
1106  mXlumi->setAxisTitle("Lumisection [#]",1);
1107  mXlumi->setAxisTitle("\\mu_{x} [cm]",2);
1108  mXlumi->getTH1()->SetOption("E1");
1109  mYlumi->setAxisTitle("Lumisection [#]",1);
1110  mYlumi->setAxisTitle("\\mu_{y} [cm]",2);
1111  mYlumi->getTH1()->SetOption("E1");
1112  mZlumi->setAxisTitle("Lumisection [#]",1);
1113  mZlumi->setAxisTitle("\\mu_{z} [cm]",2);
1114  mZlumi->getTH1()->SetOption("E1");
1115 
1116  sXlumi = dbe->book1D("sigmaX vs lumi", "\\sigma_{x} vs. Lumisection", nBinsHistoricalPlot, 0.5, (double)nBinsHistoricalPlot+0.5);
1117  sYlumi = dbe->book1D("sigmaY vs lumi", "\\sigma_{y} vs. Lumisection", nBinsHistoricalPlot, 0.5, (double)nBinsHistoricalPlot+0.5);
1118  sZlumi = dbe->book1D("sigmaZ vs lumi", "\\sigma_{z} vs. Lumisection", nBinsHistoricalPlot, 0.5, (double)nBinsHistoricalPlot+0.5);
1119  sXlumi->setAxisTitle("Lumisection [#]",1);
1120  sXlumi->setAxisTitle("\\sigma_{x} [cm]",2);
1121  sXlumi->getTH1()->SetOption("E1");
1122  sYlumi->setAxisTitle("Lumisection [#]",1);
1123  sYlumi->setAxisTitle("\\sigma_{y} [cm]",2);
1124  sYlumi->getTH1()->SetOption("E1");
1125  sZlumi->setAxisTitle("Lumisection [#]",1);
1126  sZlumi->setAxisTitle("\\sigma_{z} [cm]",2);
1127  sZlumi->getTH1()->SetOption("E1");
1128 
1129  dxdzlumi = dbe->book1D("dxdz vs lumi", "dX/dZ vs. Lumisection", nBinsHistoricalPlot, 0.5, (double)nBinsHistoricalPlot+0.5);
1130  dydzlumi = dbe->book1D("dydz vs lumi", "dY/dZ vs. Lumisection", nBinsHistoricalPlot, 0.5, (double)nBinsHistoricalPlot+0.5);
1131  dxdzlumi->setAxisTitle("Lumisection [#]",1);
1132  dxdzlumi->setAxisTitle("dX/dZ [rad]",2);
1133  dxdzlumi->getTH1()->SetOption("E1");
1134  dydzlumi->setAxisTitle("Lumisection [#]",1);
1135  dydzlumi->setAxisTitle("dY/dZ [rad]",2);
1136  dydzlumi->getTH1()->SetOption("E1");
1137 
1138  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.);
1139  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.);
1140  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.);
1141  Vx_ZX->setAxisTitle("Primary Vertices Z [cm]",1);
1142  Vx_ZX->setAxisTitle("Primary Vertices X [cm]",2);
1143  Vx_ZX->setAxisTitle("Entries [#]",3);
1144  Vx_ZY->setAxisTitle("Primary Vertices Z [cm]",1);
1145  Vx_ZY->setAxisTitle("Primary Vertices Y [cm]",2);
1146  Vx_ZY->setAxisTitle("Entries [#]",3);
1147  Vx_XY->setAxisTitle("Primary Vertices X [cm]",1);
1148  Vx_XY->setAxisTitle("Primary Vertices Y [cm]",2);
1149  Vx_XY->setAxisTitle("Entries [#]",3);
1150 
1151  hitCounter = dbe->book1D("pixelHits vs lumi", "# Pixel-Hits vs. Lumisection", nBinsHistoricalPlot, 0.5, (double)nBinsHistoricalPlot+0.5);
1152  hitCounter->setAxisTitle("Lumisection [#]",1);
1153  hitCounter->setAxisTitle("Pixel-Hits [#]",2);
1154  hitCounter->getTH1()->SetOption("E1");
1155 
1156  hitCountHistory = dbe->book1D("hist pixelHits vs lumi", "History: # Pixel-Hits vs. Lumi", nBinsWholeHistory, 0.5, (double)nBinsWholeHistory+0.5);
1157  hitCountHistory->setAxisTitle("Lumisection [#]",1);
1158  hitCountHistory->setAxisTitle("Pixel-Hits [#]",2);
1159  hitCountHistory->getTH1()->SetOption("E1");
1160 
1161  goodVxCounter = dbe->book1D("good vertices vs lumi", "# Good vertices vs. Lumisection", nBinsHistoricalPlot, 0.5, (double)nBinsHistoricalPlot+0.5);
1162  goodVxCounter->setAxisTitle("Lumisection [#]",1);
1163  goodVxCounter->setAxisTitle("Good vertices [#]",2);
1164  goodVxCounter->getTH1()->SetOption("E1");
1165 
1166  goodVxCountHistory = dbe->book1D("hist good vx vs lumi", "History: # Good vx vs. Lumi", nBinsWholeHistory, 0.5, (double)nBinsWholeHistory+0.5);
1167  goodVxCountHistory->setAxisTitle("Lumisection [#]",1);
1168  goodVxCountHistory->setAxisTitle("Good vertices [#]",2);
1169  goodVxCountHistory->getTH1()->SetOption("E1");
1170 
1171  fitResults = dbe->book2D("fit results","Results of Beam Spot Fit", 2, 0., 2., 9, 0., 9.);
1172  fitResults->setAxisTitle("Fitted Beam Spot [cm]", 1);
1173  fitResults->setBinLabel(9, "X", 2);
1174  fitResults->setBinLabel(8, "Y", 2);
1175  fitResults->setBinLabel(7, "Z", 2);
1176  fitResults->setBinLabel(6, "\\sigma_{Z}", 2);
1177  fitResults->setBinLabel(5, "#frac{dX}{dZ}[rad]", 2);
1178  fitResults->setBinLabel(4, "#frac{dY}{dZ}[rad]", 2);
1179  fitResults->setBinLabel(3, "\\sigma_{X}", 2);
1180  fitResults->setBinLabel(2, "\\sigma_{Y}", 2);
1181  fitResults->setBinLabel(1, "Vertices", 2);
1182  fitResults->setBinLabel(1, "Value", 1);
1183  fitResults->setBinLabel(2, "Stat. Error", 1);
1184  fitResults->getTH1()->SetOption("text");
1185 
1186  dbe->setCurrentFolder("BeamPixel/EventInfo");
1187  reportSummary = dbe->bookFloat("reportSummary");
1188  reportSummary->Fill(0.);
1189  reportSummaryMap = dbe->book2D("reportSummaryMap","Pixel-Vertices Beam Spot: % Good Fits", 1, 0., 1., 1, 0., 1.);
1190  reportSummaryMap->Fill(0.5, 0.5, 0.);
1191  dbe->setCurrentFolder("BeamPixel/EventInfo/reportSummaryContents");
1192 
1193  // Convention for reportSummary and reportSummaryMap:
1194  // - 0% at the moment of creation of the histogram
1195  // - n% numberGoodFits / numberFits
1196  }
1197 }
MonitorElement * dxdzlumi
MonitorElement * Vx_ZX
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)
MonitorElement * Vx_XY
MonitorElement * sZlumi
MonitorElement * fitResults
MonitorElement * Vx_ZY
MonitorElement * reportSummary
MonitorElement * goodVxCounter
MonitorElement * dydzlumi
TH1 * getTH1(void) const
MonitorElement * Vx_Z
MonitorElement * mXlumi
MonitorElement * mZlumi
MonitorElement * sXlumi
unsigned int nBinsWholeHistory
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::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 1076 of file Vx3DHLTAnalyzer.cc.

References reset().

1076 { 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 795 of file Vx3DHLTAnalyzer.cc.

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

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

Definition at line 167 of file Vx3DHLTAnalyzer.cc.

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

Definition at line 153 of file Vx3DHLTAnalyzer.cc.

References counter, edm::Event::getByToken(), h, and j.

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

Definition at line 245 of file Vx3DHLTAnalyzer.cc.

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

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

Definition at line 551 of file Vx3DHLTAnalyzer.cc.

References convertSQLiteXML::runNumber, and Vertices.

552 {
553  if (ResetType.compare("scratch") == 0)
554  {
555  runNumber = 0;
556  numberGoodFits = 0;
557  numberFits = 0;
558  lastLumiOfFit = 0;
559 
560  Vx_X->Reset();
561  Vx_Y->Reset();
562  Vx_Z->Reset();
563 
564  Vx_ZX->Reset();
565  Vx_ZY->Reset();
566  Vx_XY->Reset();
567 
568  mXlumi->Reset();
569  mYlumi->Reset();
570  mZlumi->Reset();
571 
572  sXlumi->Reset();
573  sYlumi->Reset();
574  sZlumi->Reset();
575 
576  dxdzlumi->Reset();
577  dydzlumi->Reset();
578 
579  hitCounter->Reset();
581  goodVxCounter->Reset();
583  fitResults->Reset();
584 
585  reportSummary->Fill(0.);
586  reportSummaryMap->Fill(0.5, 0.5, 0.);
587 
588  Vertices.clear();
589 
590  lumiCounter = 0;
591  lumiCounterHisto = 0;
592  totalHits = 0;
593  beginTimeOfFit = 0;
594  endTimeOfFit = 0;
595  beginLumiOfFit = 0;
596  endLumiOfFit = 0;
597  }
598  else if (ResetType.compare("whole") == 0)
599  {
600  Vx_X->Reset();
601  Vx_Y->Reset();
602  Vx_Z->Reset();
603 
604  Vx_ZX->Reset();
605  Vx_ZY->Reset();
606  Vx_XY->Reset();
607 
608  Vertices.clear();
609 
610  lumiCounter = 0;
611  lumiCounterHisto = 0;
612  totalHits = 0;
613  beginTimeOfFit = 0;
614  endTimeOfFit = 0;
615  beginLumiOfFit = 0;
616  endLumiOfFit = 0;
617  }
618  else if (ResetType.compare("partial") == 0)
619  {
620  Vx_X->Reset();
621  Vx_Y->Reset();
622  Vx_Z->Reset();
623 
624  Vertices.clear();
625 
626  lumiCounter = 0;
627  totalHits = 0;
628  beginTimeOfFit = 0;
629  endTimeOfFit = 0;
630  beginLumiOfFit = 0;
631  endLumiOfFit = 0;
632  }
633  else if (ResetType.compare("nohisto") == 0)
634  {
635  Vertices.clear();
636 
637  lumiCounter = 0;
638  lumiCounterHisto = 0;
639  totalHits = 0;
640  beginTimeOfFit = 0;
641  endTimeOfFit = 0;
642  beginLumiOfFit = 0;
643  endLumiOfFit = 0;
644  }
645  else if (ResetType.compare("hitCounter") == 0)
646  totalHits = 0;
647 }
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 650 of file Vx3DHLTAnalyzer.cc.

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

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

Member Data Documentation

unsigned int Vx3DHLTAnalyzer::beginLumiOfFit
private

Definition at line 170 of file Vx3DHLTAnalyzer.h.

edm::TimeValue_t Vx3DHLTAnalyzer::beginTimeOfFit
private

Definition at line 158 of file Vx3DHLTAnalyzer.h.

bool Vx3DHLTAnalyzer::dataFromFit
private

Definition at line 109 of file Vx3DHLTAnalyzer.h.

bool Vx3DHLTAnalyzer::debugMode
private

Definition at line 107 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::dxdzlumi
private

Definition at line 131 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::dydzlumi
private

Definition at line 132 of file Vx3DHLTAnalyzer.h.

unsigned int Vx3DHLTAnalyzer::endLumiOfFit
private

Definition at line 171 of file Vx3DHLTAnalyzer.h.

edm::TimeValue_t Vx3DHLTAnalyzer::endTimeOfFit
private

Definition at line 159 of file Vx3DHLTAnalyzer.h.

std::string Vx3DHLTAnalyzer::fileName
private

Definition at line 117 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::fitResults
private

Definition at line 151 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::goodVxCounter
private

Definition at line 142 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::goodVxCountHistory
private

Definition at line 143 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::hitCounter
private

Definition at line 145 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::hitCountHistory
private

Definition at line 146 of file Vx3DHLTAnalyzer.h.

bool Vx3DHLTAnalyzer::internalDebug
private

Definition at line 174 of file Vx3DHLTAnalyzer.h.

unsigned int Vx3DHLTAnalyzer::lastLumiOfFit
private

Definition at line 172 of file Vx3DHLTAnalyzer.h.

unsigned int Vx3DHLTAnalyzer::lumiCounter
private

Definition at line 163 of file Vx3DHLTAnalyzer.h.

unsigned int Vx3DHLTAnalyzer::lumiCounterHisto
private

Definition at line 164 of file Vx3DHLTAnalyzer.h.

unsigned int Vx3DHLTAnalyzer::maxLumiIntegration
private

Definition at line 166 of file Vx3DHLTAnalyzer.h.

unsigned int Vx3DHLTAnalyzer::minNentries
private

Definition at line 110 of file Vx3DHLTAnalyzer.h.

double Vx3DHLTAnalyzer::minVxDoF
private

Definition at line 173 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::mXlumi
private

Definition at line 123 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::mYlumi
private

Definition at line 124 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::mZlumi
private

Definition at line 125 of file Vx3DHLTAnalyzer.h.

unsigned int Vx3DHLTAnalyzer::nBinsHistoricalPlot
private

Definition at line 160 of file Vx3DHLTAnalyzer.h.

unsigned int Vx3DHLTAnalyzer::nBinsWholeHistory
private

Definition at line 161 of file Vx3DHLTAnalyzer.h.

unsigned int Vx3DHLTAnalyzer::nLumiReset
private

Definition at line 108 of file Vx3DHLTAnalyzer.h.

unsigned int Vx3DHLTAnalyzer::numberFits
private

Definition at line 169 of file Vx3DHLTAnalyzer.h.

unsigned int Vx3DHLTAnalyzer::numberGoodFits
private

Definition at line 168 of file Vx3DHLTAnalyzer.h.

std::ofstream Vx3DHLTAnalyzer::outputDebugFile
private

Definition at line 157 of file Vx3DHLTAnalyzer.h.

std::ofstream Vx3DHLTAnalyzer::outputFile
private

Definition at line 156 of file Vx3DHLTAnalyzer.h.

edm::EDGetTokenT<SiPixelRecHitCollection> Vx3DHLTAnalyzer::pixelHitCollection
private

Definition at line 106 of file Vx3DHLTAnalyzer.h.

unsigned int Vx3DHLTAnalyzer::prescaleHistory
private

Definition at line 167 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::reportSummary
private

Definition at line 148 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::reportSummaryMap
private

Definition at line 149 of file Vx3DHLTAnalyzer.h.

unsigned int Vx3DHLTAnalyzer::runNumber
private

Definition at line 162 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::sXlumi
private

Definition at line 127 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::sYlumi
private

Definition at line 128 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::sZlumi
private

Definition at line 129 of file Vx3DHLTAnalyzer.h.

unsigned int Vx3DHLTAnalyzer::totalHits
private

Definition at line 165 of file Vx3DHLTAnalyzer.h.

edm::EDGetTokenT<reco::VertexCollection> Vx3DHLTAnalyzer::vertexCollection
private

Definition at line 105 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::Vx_X
private

Definition at line 134 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::Vx_XY
private

Definition at line 140 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::Vx_Y
private

Definition at line 135 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::Vx_Z
private

Definition at line 136 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::Vx_ZX
private

Definition at line 138 of file Vx3DHLTAnalyzer.h.

MonitorElement* Vx3DHLTAnalyzer::Vx_ZY
private

Definition at line 139 of file Vx3DHLTAnalyzer.h.

double Vx3DHLTAnalyzer::xRange
private

Definition at line 111 of file Vx3DHLTAnalyzer.h.

double Vx3DHLTAnalyzer::xStep
private

Definition at line 112 of file Vx3DHLTAnalyzer.h.

double Vx3DHLTAnalyzer::yRange
private

Definition at line 113 of file Vx3DHLTAnalyzer.h.

double Vx3DHLTAnalyzer::yStep
private

Definition at line 114 of file Vx3DHLTAnalyzer.h.

double Vx3DHLTAnalyzer::zRange
private

Definition at line 115 of file Vx3DHLTAnalyzer.h.

double Vx3DHLTAnalyzer::zStep
private

Definition at line 116 of file Vx3DHLTAnalyzer.h.