45 #include "TBufferFile.h"
47 #include "TBufferXML.h"
75 virtual void endJob() ;
83 double etamin,
double etamax,
84 int nhitmin,
int nhitmax,
85 int npixelhitsmin,
int npixelhitsmax,
86 double cmin,
double cmax,
int withFirst)
118 if (createOnlyOne ==
true){
121 std::cout <<
" Writing only 2D calibrations"<<std::endl;
124 }
else if (whichCalib==3){
125 std::cout <<
" Writing only 3D calibrations"<<std::endl;
129 std::cout <<
" Dimension not found: "<<whichCalib<<
"; it must be either 2 or 3"<<std::endl;
146 using namespace reco;
150 const TrackIPTagInfoCollection & ip = *(ipHandle.product());
157 vector<TrackProbabilityCalibration::Entry>::iterator
found;
158 vector<TrackProbabilityCalibration::Entry>::iterator it_begin;
159 vector<TrackProbabilityCalibration::Entry>::iterator it_end;
162 TrackIPTagInfoCollection::const_iterator it = ip.begin();
163 for(; it != ip.end(); it++)
167 if(primaryVertex.product()->size() == 0)
169 std::cout <<
"No PV in the event!!" << std::endl;
172 const Vertex & pv = *(primaryVertex.product()->begin());
179 for(
unsigned int j=0;
j<selTracks.
size();
j++)
182 if (
i==0) ipsig = it->impactParameterData()[
j].ip3d.significance();
183 else ipsig = it->impactParameterData()[
j].ip2d.significance();
190 found->histogram.fill(-ipsig);
192 {
std::cout <<
"No category for this track!!" << std::endl;
193 std::cout <<
"p " <<(*selTracks[
j]).
p () << std::endl;
195 std::cout <<
"NHit " << (*selTracks[
j]).numberOfValidHits() << std::endl;
196 std::cout <<
"NPixHit " << (*selTracks[
j]).hitPattern().numberOfValidPixelHits() << std::endl;
197 std::cout <<
"FPIXHIT " << (*selTracks[
j]).hitPattern().hasValidHitInFirstPixelBarrel() << std::endl;}
225 ca[0] = calib3DHandle.product();
226 ca[1] = calib2DHandle.product();
228 for(
unsigned int j=0;
j<ca[
i]->data.size() ;
j++)
259 vector<TrackProbabilityCategoryData>
v;
263 v.push_back(
createCategory(0, 5000, 0 , 2.5, 8 , 50, 1, 1, 0 , 5 , 0));
264 v.push_back(
createCategory(0, 5000, 0 , 2.5, 8 , 50, 2, 8, 2.5, 5 , 0));
265 v.push_back(
createCategory(0, 8 , 0 , 0.8, 8 , 50, 3, 8, 0 , 2.5, 0));
266 v.push_back(
createCategory(0, 8 , 0.8, 1.6, 8 , 50, 3, 8, 0 , 2.5, 0));
267 v.push_back(
createCategory(0, 8 , 1.6, 2.5, 8 , 50, 3, 8, 0 , 2.5, 0));
268 v.push_back(
createCategory(0, 8 , 0 , 2.5, 8 , 50, 2, 8, 0 , 2.5, 0));
269 v.push_back(
createCategory(8, 5000, 0 , 0.8, 8 , 50, 3, 8, 0 , 2.5, 0));
270 v.push_back(
createCategory(8, 5000, 0.8, 1.6, 8 , 50, 3, 8, 0 , 2.5, 0));
271 v.push_back(
createCategory(8, 5000, 1.6, 2.5, 8 , 50, 3, 8, 0 , 2.5, 0));
272 v.push_back(
createCategory(8, 5000, 0 , 2.5, 8 , 50, 2 ,2, 0 , 2.5, 0));
274 for(
unsigned int j=0;
j<v.size() ;
j++)
291 for(
unsigned int j=0;
j<ca[
i]->data.size() ;
j++)
350 <<
"File \"" << xmlCalibration.
fullPath()
351 <<
"\" could not be opened for reading."
353 std::ostringstream ss;
356 TClass *classType = 0;
357 void *ptr = TBufferXML(TBuffer::kRead).ConvertFromXMLAny(
358 ss.str().c_str(), &classType, kTRUE, kFALSE);
361 <<
"Unknown error parsing XML serialization"
364 if (std::strcmp(classType->GetName(),
365 "TrackProbabilityCalibration")) {
366 classType->Destructor(ptr);
368 <<
"Serialized object has wrong C++ type."
394 std::ofstream of2(
"2d.xml");
395 TBufferXML b2(TBuffer::kWrite);
397 TClass::GetClass(
"TrackProbabilityCalibration"),
402 std::ofstream of3(
"3d.xml");
403 TBufferXML b3(TBuffer::kWrite);
405 TClass::GetClass(
"TrackProbabilityCalibration"),
416 std::ofstream
ofile(
"2d.dat");
417 TBufferFile buffer(TBuffer::kWrite);
419 TClass::GetClass(
"TrackProbabilityCalibration"));
420 Int_t
size = buffer.Length();
421 ofile.write(buffer.Buffer(),
size);
425 std::ofstream ofile3(
"3d.dat");
426 TBufferFile buffer3(TBuffer::kWrite);
428 TClass::GetClass(
"TrackProbabilityCalibration"));
429 Int_t size3 = buffer3.Length();
430 ofile3.write(buffer3.Buffer(),size3);
TrackProbabilityCalibration * fromXml(edm::FileInPath xmlCalibration)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
#define DEFINE_FWK_MODULE(type)
ImpactParameterCalibration(const edm::ParameterSet &)
TrackProbabilityCalibration * m_calibration[2]
static TrackProbabilityCategoryData createCategory(double pmin, double pmax, double etamin, double etamax, int nhitmin, int nhitmax, int npixelhitsmin, int npixelhitsmax, double cmin, double cmax, int withFirst)
~ImpactParameterCalibration()
TrackProbabilityCategoryData category
cond::Time_t beginOfTime() const
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
virtual void initFromFirstES(const edm::EventSetup &)
PhysicsTools::Calibration::HistogramF histogram
cond::Time_t endOfTime() const
virtual void analyze(const edm::Event &, const edm::EventSetup &)
bool xmlFile(const std::string fParam)
std::vector< Entry > data
size_type size() const
Size of the RefVector.
std::string fullPath() const
tuple size
Write out results.
edm::InputTag m_iptaginfo