36 std::cout <<
"PurityAnalysis::initialise() " <<
name() << std::endl;
44 const int pTResBins = 100;
47 double tmp_maxEta = 3.;
48 double tmp_absResEta = 0.04;
51 double tmp_maxPhi = 3.142;
52 double tmp_absResPhi = 0.02;
56 const int etaResBins = 300;
58 const int phiBins = 36;
59 const int phiResBins = 100;
61 const int zBins = 100;
62 const double zMax = 400;
64 const int zresBins = 100;
65 const double zresMax = 10;
67 const int d0Bins = 100;
68 const double d0Max = 10;
70 const int d0resBins = 100;
71 const double d0resMax = 10;
75 const int a0Bins = 100;
76 const double a0Max = 10;
78 const int a0resBins = 100;
79 const double a0resMax = 5;
85 const int ptnbins = 20;
86 double ptbinlims[ptnbins+1];
87 for (
int i=0 ;
i<=ptnbins ;
i++ ) { ptbinlims[
i] =
std::pow(10, 3.0*
i/ptnbins+2)/1000; }
92 std::cout <<
"PurityAnalysis::initialize() Directory " <<
gDirectory->GetName() <<
" " <<
name() << std::endl;
100 std::cout <<
"PurityAnalysis::initialize() Directory " <<
gDirectory->GetName() <<
" package directory, " <<
name() << std::endl;
171 addHistogram(
new TH1F(
"phi_rec",
"phi_rec", phiBins, -tmp_maxPhi, tmp_maxPhi ) );
181 addHistogram(
new TH1F(
"eta_res",
"eta_res", etaResBins, -2*tmp_absResEta, 2*tmp_absResEta ) );
183 addHistogram(
new TH1F(
"phi_res",
"phi_res", 2*phiResBins, -2*tmp_absResPhi, 2*tmp_absResPhi ) );
184 addHistogram(
new TH1F(
"z0_res",
"z0_res", zresBins, -zresMax, zresMax ) );
185 addHistogram(
new TH1F(
"d0_res",
"d0_res", 4*d0resBins, -0.5*d0resMax, 0.5*d0resMax ) );
186 addHistogram(
new TH1F(
"a0_res",
"a0_res", 4*a0resBins, -a0resMax, a0resMax ) );
188 std::cout <<
"booked" << std::endl;
197 addHistogram(
new TH1F(
"nsct_rec",
"nsct_rec", NHits, -0.5,
float(NHits-0.5) ) );
200 addHistogram(
new TH1F(
"npix_rec",
"npix_rec", NHits, -0.5,
float(NHits-0.5) ) );
203 addHistogram(
new TH1F(
"ntrt_rec",
"ntrt_rec", NHits, -0.5,
float(NHits-0.5) ) );
205 addHistogram(
new TH1F(
"nstraw",
"nstraw", NHits*4, -0.5,
float(4*NHits-0.5) ) );
206 addHistogram(
new TH1F(
"nstraw_rec",
"nstraw_rec", NHits*4, -0.5,
float(4*NHits-0.5) ) );
208 addHistogram(
new TH1F(
"ntracks",
"ntracks", Ntracks, -0.5,
float(Ntracks+0.5) ) );
209 addHistogram(
new TH1F(
"ntracks_rec",
"ntracks_rec", Ntracks, -0.5,
float(Ntracks+0.5) ) );
229 std::cout <<
"PurityAnalysis::finalise() " <<
name()
264 for (
int i=6 ;
i-- ; ) { hpurity[
i]->
finalise(); }
272 int duff_counter = 0;
274 void duff(
const std::string&
label=
"") {
275 std::cout <<
"counter " << duff_counter <<
label << std::endl;
283 const std::vector<TIDA::Track*>& testtracks,
286 if (
m_print ) std::cout <<
"PurityAnalysis::execute() \t " <<
name()
287 <<
"\tref " << reftracks.size()
288 <<
"\ttest " << testtracks.size() << std::endl;
297 static std::string
varName[10] = {
"pT",
"eta",
"phi",
"z0",
"d0",
"a0",
"nsct",
"npix",
"ntrt",
"nstraw" };
302 if ( hmitr!=
m_histos.end() ) hmitr->second->Fill( reftracks.size() );
304 hmitr =
m_histos.find(
"ntracks_rec");
305 if ( hmitr!=
m_histos.end() ) hmitr->second->Fill( testtracks.size() );
310 m_Nref += reftracks.size();
315 for (
int i=reftracks.size() ;
i-- ; ) {
316 double phit = reftracks[
i]->phi();
323 for (
int i=reftracks.size() ;
i-- ; ) {
325 double pTt = reftracks[
i]->pT()/1000;
326 double etat = reftracks[
i]->eta();
327 double phit = reftracks[
i]->phi();
329 double d0t = reftracks[
i]->a0();
334 if ( std::fabs(a0t)>
a0 )
continue;
336 double chi2t = reftracks[
i]->chi2();
340 double nsctt = reftracks[
i]->sctHits();
341 double npixt = reftracks[
i]->pixelHits();
343 double ntrtt = reftracks[
i]->trHits();
344 double nstrawt = reftracks[
i]->strawHits();
355 double vpart[10] = { std::fabs(pTt), etat, phit, z0t, d0t, a0t, nsctt, npixt, ntrtt, nstrawt };
356 for (
int it=0 ;
it<10 ;
it++ ) {
362 else std::cerr <<
"hmmm histo " <<
varName[
it] <<
" not found" << std::endl;
384 double pTr = matchedreco->
pT()/1000;
385 double etar = matchedreco->
eta();
386 double phir = matchedreco->
phi();
388 double d0r = matchedreco->
a0();
399 if (
m_print ) std::cout <<
"PurityAnalysis::execute() \t\t" <<
i <<
" "
400 << *reftracks[
i] <<
" -> " << *matchedreco <<
"\t"
401 << pTr <<
" " << pTt <<
" " << d0r <<
" " << d0t << std::endl;
404 double vres[6] = { 1.0/std::fabs(pTr)-1.0/std::fabs(pTt), etar-etat, phir-phit, z0r-z0t, d0r-d0t, a0r-a0t };
405 for (
int it=0 ;
it<6 ;
it++ ) {
407 find(
"ipT_res")->Fill( vres[0] );
408 find(
"spT_res")->Fill( 1.0/pTr-1.0/pTt );
411 else std::cerr <<
"hmmm histo " <<
varName[
it]+
"_res" <<
" not found" << std::endl;
414 if (
TH1F* hptr =
find(
"etai_res") ) hptr->Fill( etat-etar );
417 double Delphi = phit-phir;
418 double Deleta = etat-etar;
423 double DeltaR = std::sqrt(Delphi*Delphi+Deleta*Deleta);
438 double vpart[10] = { std::fabs(pTr), etar, phir, z0r, d0r, a0r, nsctr, npixr, ntrtr, nstrawr };
439 for (
int it=0 ;
it<10 ;
it++ ) {
446 else std::cerr <<
"hmmm histo " <<
varName[
it]+
"_rec" <<
" not found" << std::endl;
468 if ( std::fabs(pTt)>4 ) {
472 std::cout << mname <<
"\tMISSING TRACK run " <<
r <<
"\tevent " <<
ev
473 <<
"\tlb " <<
lb <<
"\t" << *reftracks[
i];
475 if ( std::fabs(pTt)>=30 ) std::cout <<
"\tvery high pt";
476 if ( std::fabs(pTt)>4 &&
477 std::fabs(pTt)<30 ) std::cout <<
"\t high pt";
479 std::cout << std::endl;
496 static int icount = 0;
500 if (
m_print ) std::cout <<
"PurityAnalysis::execute() \t " <<
name() <<
"\t " << icount <<
" events\t " << testtracks.size() <<
" tracks (" <<
m_Nreco <<
")" <<
"\n---------------" << std::endl;
504 for (
int i=testtracks.size() ;
i-- ; ) {
509 double pTr = testtracks[
i]->pT()/1000;
510 double etar = testtracks[
i]->eta();
511 double phir = testtracks[
i]->phi();
512 double z0r = testtracks[
i]->z0();
513 double d0r = testtracks[
i]->a0();
519 double nsctr = testtracks[
i]->sctHits();
520 double npixr = testtracks[
i]->pixelHits();
522 double ntrtr = testtracks[
i]->trHits();
523 double nstrawr = testtracks[
i]->strawHits();
533 double vpart[10] = { std::fabs(pTr), etar, phir, z0r, d0r, a0r, nsctr, npixr, ntrtr, nstrawr };
534 for (
int it=0 ;
it<10 ;
it++ ) {
541 else std::cerr <<
"hmmm histo " <<
varName[
it]+
"_rec" <<
" not found" << std::endl;
575 std::cout <<
"PurityAnalysis::execute() missed a high pT track - dumping tracks" << std::endl;
577 for (
int i=reftracks.size() ;
i-- ; ) {
579 if ( std::fabs( reftracks[
i]->
pT() ) > 1000 ) {
580 std::cout <<
"\t dump " << *reftracks[
i];
582 if ( matchedreco ) std::cout <<
" <--> " << *matchedreco << std::endl;
583 else std::cout << std::endl;
588 for (
int i=testtracks.size() ;
i-- ; ) {
590 if ( matchedref==0 ) std::cout <<
"\t\t\t\t\t " << *testtracks[
i] << std::endl;
595 if (
m_print ) std::cout <<
"PurityAnalysis::execute() exiting" << std::endl;