ATLAS Offline Software
Classes | Functions | Variables
rmain.cxx File Reference
#include <cstdio>
#include <cmath>
#include <fstream>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <sstream>
#include <execinfo.h>
#include <signal.h>
#include <unistd.h>
#include "TChain.h"
#include "TFile.h"
#include "TTree.h"
#include "TDirectory.h"
#include "TrigInDetAnalysis/Track.h"
#include "TrigInDetAnalysis/TIDAEvent.h"
#include "TrigInDetAnalysis/TrackSelector.h"
#include "TrigInDetAnalysis/TIDAVertex.h"
#include "TrigInDetAnalysisUtils/Associator_BestMatch.h"
#include "TrigInDetAnalysisUtils/Filters.h"
#include "TrigInDetAnalysisUtils/Filter_Offline2017.h"
#include "TrigInDetAnalysisUtils/Filter_OfflineR22.h"
#include "TrigInDetAnalysisExample/NtupleTrackSelector.h"
#include "TrigInDetAnalysisExample/ChainString.h"
#include "TrigInDetAnalysisUtils/Associator_TruthMatch.h"
#include "TrigInDetAnalysis/Efficiency1D.h"
#include "TrigInDetAnalysis/TIDARoiDescriptor.h"
#include "TrigInDetAnalysis/TrigObjectMatcher.h"
#include "ReadCards.h"
#include "utils.h"
#include "RoiFilter.h"
#include "ConfAnalysis.h"
#include "PurityAnalysis.h"
#include "ConfVtxAnalysis.h"
#include "TIDAReference.h"
#include "lumiList.h"
#include "lumiParser.h"
#include "dataset.h"
#include "event_selector.h"
#include "BinConfig.h"
#include "zbeam.h"
#include "computils.h"
#include "globals.h"
#include "TrigInDetAnalysisUtils/TagNProbe.h"

Go to the source code of this file.

Classes

struct  event_list
 

Functions

void copyReleaseInfo (TTree *tree, TFile *foutdir)
 
void handler (int sig)
 signal handler More...
 
std::string time_str ()
 
int atoi_check (const std::string &s)
 convert string to integer with check if successful More...
 
int GetChainAuthor (std::string chainName)
 Return selected author, expects format L2_e20_medium:TrigL2SiTrackFinder:3 where 3 is the track author NB: this isn't actually needed at all. More...
 
TIDARoiDescriptor makeCustomRefRoi (const TIDARoiDescriptor &roi, double etaHalfWidth=-999, double phiHalfWidth=-999, double zedHalfWidth=-999)
 
bool trackPtGrtr (TIDA::Track *trackA, TIDA::Track *trackB)
 
template<typename T >
std::ostream & operator<< (std::ostream &s, const std::vector< T * > &v)
 
template<typename T >
std::ostream & operator<< (std::ostream &s, const std::vector< T > &v)
 
const std::vector< TIDA::Trackibl_filter (const std::vector< TIDA::Track > &tv)
 
const std::vector< TIDA::Trackreplaceauthor (const std::vector< TIDA::Track > &tv, int a0=5, int a1=4)
 
int usage (const std::string &name, int status)
 
template<typename T >
std::vector< T * > pointers (std::vector< T > &v)
 
bool SelectObjectET (const TrackTrigObject &t)
 
bool SelectObjectETovPT (const TrackTrigObject &tobj, TIDA::Track *t=0)
 
TrackFiltergetFilter (const std::string &refname, int pdgId, TrackFilter *foff, TrackFilter *fmu, TrackFilter *ftruth)
 This is awful code, passing in lots of filter pointers just so that they can be assigned neatly ? This section of the code needs a bit of a rethink getFilter( refname, &filter_off, &filter_muon, &filter_truth ); Fixme: maybe use a switch statement or something in the future. More...
 
bool GetRefTracks (const std::string &rc, const std::string &exclude, const std::vector< TIDA::Chain > &chains, NtupleTrackSelector &refTracks, TrackAssociator *ex_matcher, TrigObjectMatcher &tom)
 
int main (int argc, char **argv)
 

Variables

bool PRINT_BRESIDUALS
 stack trace headers More...
 
BinConfig g_binConfig
 
BinConfig electronBinConfig
 
BinConfig muonBinConfig
 
BinConfig tauBinConfig
 
BinConfig bjetBinConfig
 
BinConfig cosmicBinConfig
 
bool debugPrintout = false
 
double ETmin = 0
 
double ETovPTmin = 0
 this is a swiss knife function - by default if ET/PT > 0 such that fabs(ET/PT) > 0 is always true and we can always call this function - PT can never be 0 for a particle in the detector so can use this for both ET/PT selection and raw ET selection
More...
 

Detailed Description

Author
mark sutton
Date
Fri 11 Jan 2019 07:41:26 CET

Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration

Definition in file rmain.cxx.

Function Documentation

◆ atoi_check()

int atoi_check ( const std::string &  s)

convert string to integer with check if successful

Definition at line 129 of file rmain.cxx.

129  {
130  int i = std::atoi( s.c_str() );
131  char check[128];
132  std::sprintf( check, "%d", i );
133  if ( std::string(check)!=s ) return -1;
134  else return i;
135 }

◆ copyReleaseInfo()

void copyReleaseInfo ( TTree *  tree,
TFile *  foutdir 
)

◆ GetChainAuthor()

int GetChainAuthor ( std::string  chainName)

Return selected author, expects format L2_e20_medium:TrigL2SiTrackFinder:3 where 3 is the track author NB: this isn't actually needed at all.

can parse the entire name properly with this technique - NB: should move to some meaningful name for strategies "A", "B", etc

chops tokens off the front, up to the ":"

Definition at line 144 of file rmain.cxx.

144  {
145 
148  std::string s1 = chop(chainName,":");
149  std::string s2 = chop(chainName,":");
150  std::string s3 = chop(chainName,":");
151 
152  // if only s3=="" then no third token, if s2=="", no second token etc
153  // return atoi(s3.c_str());
154 
155  // std::cout << ">" << s1 << "< >" << s2 << "< >" << s3 << "<" << std::endl;
156  if ( s3=="0" ) return 0;
157  if ( s3=="1" ) return 1;
158  if ( s3=="2" ) return 2;
159  // }
160  return -1;
161 
162 }

◆ getFilter()

TrackFilter* getFilter ( const std::string &  refname,
int  pdgId,
TrackFilter foff,
TrackFilter fmu,
TrackFilter ftruth 
)

This is awful code, passing in lots of filter pointers just so that they can be assigned neatly ? This section of the code needs a bit of a rethink getFilter( refname, &filter_off, &filter_muon, &filter_truth ); Fixme: maybe use a switch statement or something in the future.

Definition at line 404 of file rmain.cxx.

407  {
408 
409  std::cout << "getFilter(): refname " << refname << std::endl;
410 
411  if ( refname=="Offline" ) return foff;
412  else if ( refname=="InDetLargeD0TrackParticles" ) return foff;
413  else if ( contains( refname, "Electrons") ) return foff;
414  else if ( contains( refname, "LRTElectrons") ) return foff;
415  else if ( contains( refname, "Muons" ) ) return fmu;
416  else if ( contains( refname, "MuonsLRT" ) ) return fmu;
417  else if ( contains( refname, "Taus" ) ) return foff; // tau ref chains
418  else if ( contains( refname, "1Prong" ) ) return foff; // tau ref chains
419  else if ( contains( refname, "3Prong" ) ) return foff; // tau ref chains
420  else if ( refname=="Truth" && pdgId!=0 ) return ftruth;
421  else if ( refname=="Truth" && pdgId==0 ) return foff;
422  else {
423  std::cerr << "unknown reference chain defined" << std::endl;
424  return 0;
425  }
426 }

◆ GetRefTracks()

bool GetRefTracks ( const std::string &  rc,
const std::string &  exclude,
const std::vector< TIDA::Chain > &  chains,
NtupleTrackSelector refTracks,
TrackAssociator ex_matcher,
TrigObjectMatcher tom 
)

get any objects to exclude matched from the reference selection

match between the reference tracks and the objects to be excluded, and rebuild the reference tracks without the matches

if no match then add back to the standard reefrence

get objects if requested

Definition at line 429 of file rmain.cxx.

433  {
434 
435  bool foundReference = false;
436 
437  for ( size_t ic=chains.size() ; ic-- ; ) {
438 
439  if ( chains[ic].name()==rc ) {
440 
441  foundReference = true;
442 
443  //Get tracks from within reference roi
444 
446 
447  if ( exclude.empty() ) {
448  refTracks.selectTracks( chains[ic].rois()[0].tracks() );
449  }
450  else {
451 
452  std::vector<TIDA::Track> tmptracks = chains[ic][0].tracks();
453 
454  for ( size_t ix=chains.size() ; ix-- ; ) {
455 
456  if ( chains[ix].name()==exclude ) {
457 
458  std::vector<TIDA::Track> extracks = chains[ix][0].tracks();
459 
460  std::vector<TIDA::Track*> refp;
461  std::vector<TIDA::Track*> refx;
462 
463  for ( size_t it=tmptracks.size() ; it-- ; ) refp.push_back( &tmptracks[it] );
464  for ( size_t it=extracks.size() ; it-- ; ) refx.push_back( &extracks[it] );
465 
468 
469  ex_matcher->match( refp, refx );
470 
471  std::vector<TIDA::Track*> refp_ex;
472 
473  for ( size_t it=refp.size() ; it-- ; ) {
475  if ( ex_matcher->matched(refp[it])==0 ) refp_ex.push_back(refp[it]);
476  }
477 
478  refTracks.clear();
479  refTracks.selectTracks( refp_ex );
480 
481  if ( debugPrintout ) {
482 
483  std::cout << "\nexclude: " << refp.size() << "\t" << refp_ex.size() << std::endl;
484  std::cout << "exclude:\n" << extracks << std::endl;
485  std::cout << "reference tracks: " << std::endl;
486 
487  size_t it0 = refp_ex.size();
488 
489  for ( size_t it=0 ; it<refp.size() && it0>0 ; it++ ) {
490  if ( refp[it]==refp_ex[it0-1] ) std::cout << it << "\t" << *refp[it] << "\t" << *refp_ex[--it0] << std::endl;
491  else std::cout << "\n" << it << "\t" << *refp[it] << "\t----\n" << std::endl;
492  }
493 
494  }
495 
496  break;
497  }
498 
499  }
500  }
501 
503 
504  if ( chains[ic].rois()[0].objects().size()>0 ) {
505  tom = TrigObjectMatcher( &refTracks, chains[ic].rois()[0].objects(), SelectObjectETovPT );
506  }
507 
508  break;
509  }
510  }
511 
512  return foundReference;
513 
514 }

◆ handler()

void handler ( int  sig)

signal handler

Definition at line 99 of file rmain.cxx.

99  {
100  void *array[10];
101 
102  // get void*'s for all entries on the stack
103  size_t size = backtrace(array, 10);
104 
105  // print out all the frames to stderr
106  std::cout << "Error: signal %d:\n" << sig << std::endl;
107  backtrace_symbols_fd(array, size, STDERR_FILENO);
108  std::exit(1);
109 }

◆ ibl_filter()

const std::vector<TIDA::Track> ibl_filter ( const std::vector< TIDA::Track > &  tv)

Definition at line 223 of file rmain.cxx.

223  {
224 
225  static TH2D* h = 0;
226  static TH2D* h2 = 0;
227 
228  static int ic = 0;
229 
230 
231  if ( h==0 ) {
232  h = new TH2D( "hzvphi", "hzvphi", 150, -300, 300, 150, -M_PI, M_PI );
233  h2 = new TH2D( "hzvphi2", "hzvphi", 150, -300, 300, 150, -M_PI, M_PI );
234  }
235 
236  for ( size_t i=tv.size() ; i-- ; ) {
237 
238  if ( tv[i].author()!=5 ) break;
239 
240  double eta = tv[i].eta();
241 
242  double theta = 2*std::atan(-std::exp(eta));
243 
244  double ribl = 34.2; // actually 32.26 - 36.21 mm
245 
246  double z = tv[i].z0() + ribl/std::tan(theta);
247 
248  if ( !tv[i].expectBL() ) {
249  std::cout << "missing IBL: phi: " << tv[i].phi() << "\tz: " << z << " (" << eta << " " << theta*180/M_PI << ")" << std::endl;
250  if ( h ) h->Fill( z, tv[i].phi() );
251  }
252  else {
253  if ( h2 ) h2->Fill( z, tv[i].phi() );
254  }
255  }
256 
257  if ( ic>=500 ) {
258  ic = 0;
259  if ( h ) {
260  h->DrawCopy();
261  gPad->Print("zphimap.pdf");
262  h2->DrawCopy();
263  gPad->Print("zphimap2.pdf");
264  }
265  }
266 
267  ic++;
268 
269  return tv;
270 }

◆ main()

int main ( int  argc,
char **  argv 
)

set some configuration parameters that can be set from the command line - these over-ride those from the configuration file Fixme: which is best? set them from the command line first, and then ignore them in the config file, or set from the config file, and then override them with command line arguments later? Theres only one way to find out...

get a filename from the command line if present

unknown option

true by default - command line options sets to false so should override what is in the config file

open output file

set up the filters etc

essentially no limit

essentially no limit

here we set a pTMax value less than pT, then only set the max pT in the filter if we read a pTMax value greater than pT

only if not set from the command line

only if not set from the command line

get the test chains

NB: don't override command line args

new code - can extract vtx name, pt, any extra options that we want, but also chop off everythiung after :post

now any additional config parameters for the chain are available

print soime debugging output

select only tracks within the roi?

read the (xml?) GRL

else get the list from the dat file directly

reference vertex selection

test vertex selection

option to use updated vertex matching with tracks

is this option needed any longer ???

read the binning config from a separate file if required

set the tags in front of the histogram stuff

clean up

track filters

truth articles

reminder: this is the new constructor - it now has too many parameters

filters for true selection for efficiency

include chi2 probability cut

track selectors so we can select multiple times with different filters if we want (simpler then looping over vectors each time

strings for which chains to analyse

create a map of the name to analysis string for selecting the correct analysis from the chain name

create the analyses and initialise them - this will create a root directory and book all the histograms

now we know that there is a corresponding tag, we can add the probe ...

if matching tag found then initialise tag and probe object and store tag and probe chains in there this will be passed into the ConfAnalysis, which will delete it when necessary
could perhaps be done with a unique_ptr

useful debug - leave this here ...

don't use the vertex name as the directory, since then we cannot easily plot on the same plot

hooray !! Set any additional aspects to the analysis up here so should be able to set individual, chain related variables eg set individual pt limits, different selection of reference objects, whether to run a vertex analysis ...

When setting different pt cuts, then an additional track selector will need to be created, this can then be added to the TIDA::FeatireStore of the analysis, and retrieved each time it is required

still needed for the moment ...

track selectors for efficiencies

do we want to filter the RoIs ?

Determine what sort of matching is required ...

default to deltaR matcher track matcher for best fit deltaR matcher

extra matcher for additionally matching reference to truth

default to deltaR matcher track matcher for best fit deltaR matcher

track selectors for purities

copy the release data to the output file

so we can specify the number of entries

we like, rather than run on all of them

check whether in good lumi block range

check whether it's in the event selector list

get the reference tracks (or perhaps even the true tracks !!!

I don't prefer range based for loops ...

select the reference offline vertices

always push back the vector - if required there will be only one vertex on it

calculate number of "vertex tracks"

do we really want this cut ???

get the tracks from the reference chain - shouldn't be one of the test chains, since there will be a 1-to-1 mapping but might be a useful check

get reference tracks and the revference TrigObjectMatcher if one is found in the reference chain

leave this in for the moment ...

reset the tom for this event

if expecting an Electron or a Tau and we don't have the TrigObjectMatcher then we don't have any actual offline electrons or taus so skip this event - code needs to be expanded a bit before being used ...

find the analysis for this chain - is there a matching analysis?

if no matching analysis then continue

these are the rois to process

both legs have the same reference ...

different references for each leg ...

tag leg reference ...

debug printout

get the rois and filter on them if required

trigger tracks already restricted by roi - so no roi filtering required

do we want to filter on the RoI properties? If so, if the RoI fails the cuts, then skip this roi

select the test sample (trigger) vertices

here we set the roi for the filter so we can request only those tracks inside the roi

what is all this logic doing ? It looks needlessly convoluted, and should at the very least have some proper explanation of what it is supposed to be doing

get the truth particles ...

truth_matcher match against current reference selection

which truth tracks have a matching reference track ?

check configuration is provided ...

remove any tracks below the pt threshold if one is specifed for the analysis

remove any tracks outside the d0 region if one is specifed for the analysis

if requesting an object match, remove any tracks which correspond to an object below the object PT threshold

only bother is objects actual exists

now found all the tracks within the RoI - now if required find the the count how many of these reference tracks are on each of the offline vertices

do for all vertices now ...

select the reference offline vertices

don't add vertices with no matching tracks - remember the tracks are filtered by Roi already so some vertices may have no tracks in the Roi - ntracks set to 0 by default

NB: because ntracks = 0 by default, this second clause should always be true unless ntracks has been set to some value

AAAAAARGH!!! because you cannot cast vector<T> to const vector<const T> we first need to copy the actual elements from the const vector, to a normal vector. This is because if we take the address of elements of a const vector<T> they will by of type const T*, so we can only add them to a vector<const T*> and all our functions are using const vector<T>&, so we would need to duplicate all the functions to allow over riding with vector<T*> and vector<const T*> to get this nonsense to work

so we now use a handy wrapper function to do the conversion for us ...

run the analysis for this chain

???

Definition at line 521 of file rmain.cxx.

522 {
523  signal( SIGABRT, handler );
524  signal( SIGFPE, handler );
525  signal( SIGILL, handler );
526  signal( SIGSEGV, handler );
527  signal( SIGTERM, handler );
528 
529  // ROOT::Cintex::Cintex::Enable();
530 
531  if ( argc<2 ) {
532  std::cerr << "Error: no config file specified\n" << std::endl;
533  return usage(argv[0], -1);
534  }
535 
536  // event_list elist("events.txt");
537 
545 
546  std::cout << "$0 :: compiled " << __DATE__ << " " << __TIME__ << std::endl;
547 
549 
550  std::string histofilename("");
551 
552  std::string datafile = "";
553 
554  std::vector<std::string> refChains(0);
555 
556  std::vector<TrackFilter*> refFilters(0);
557 
558  TrackFilter* refFilter = 0;
559  TrackFilter* truthFilter = 0;
560 
561  std::string refChain = "";
562 
563  int pdgId = 0;
564 
565  std::vector<std::string> testChains;
566 
567  std::string binningConfigFile = "";
568 
569  bool useoldrms = true;
570  bool nofit = false;
571 
572  std::string vertexSelection = "";
573  std::string vertexSelection_rec = "";
574 
575  unsigned Nentries = 0;
576 
577  for ( int i=1 ; i<argc ; i++ ) {
578  if ( std::string(argv[i])=="-h" || std::string(argv[i])=="--help" ) {
579  return usage(argv[0], 0);
580  }
581  else if ( std::string(argv[i])=="-e" || std::string(argv[i])=="--entries" ) {
582  if ( ++i>=argc ) return usage(argv[0], -1);
583  Nentries = std::atoi(argv[i]);
584  }
585  else if ( std::string(argv[i])=="-o" || std::string(argv[i])=="-f" || std::string(argv[i])=="--file" ) {
586  if ( ++i>=argc ) return usage(argv[0], -1);
587  histofilename = argv[i];
588  if ( histofilename.find(".root")==std::string::npos ) histofilename += ".root";
589  }
590  else if ( std::string(argv[i])=="-r" || std::string(argv[i])=="--refChain" ) {
591  if ( ++i>=argc ) return usage(argv[0], -1);
592  refChain = argv[i];
593 
594  // Merge multiple references
595  if (refChain.find("+") != string::npos){
596  std::istringstream iss(refChain);
597  std::string token;
598  while (std::getline(iss, token, '+')){ // tokenize string based on '+' delimeter
599  refChains.push_back(token);
600  refFilters.push_back(0);
601  }
602  }
603  else {
604  refChains.push_back(argv[i]); // standard single reference
605  refFilters.push_back(0);
606  }
607  }
608  else if ( std::string(argv[i])=="--rms" ) useoldrms = false;
609  else if ( std::string(argv[i])=="-n" || std::string(argv[i])=="--nofit" ) nofit = true;
610  else if ( std::string(argv[i])=="-t" || std::string(argv[i])=="--testChain" ) {
611  if ( ++i>=argc ) return usage(argv[0], -1);
612  testChains.push_back(argv[i]);
613  }
614  else if ( std::string(argv[i])=="-p" || std::string(argv[i])=="--pdgId" ) {
615  if ( ++i>=argc ) return usage(argv[0], -1);
616  pdgId = atoi(argv[i]);
617  }
618  else if ( std::string(argv[i])=="--vr" ) {
619  if ( ++i>=argc ) return usage(argv[0], -1);
620  vertexSelection = argv[i];
621  }
622  else if ( std::string(argv[i])=="--vt" ) {
623  if ( ++i>=argc ) return usage(argv[0], -1);
624  vertexSelection_rec = argv[i];
625  }
626  else if ( std::string(argv[i])=="-b" || std::string(argv[i])=="--binConfig" ) {
627  if ( ++i>=argc ) return usage(argv[0], -1);
628  binningConfigFile = std::string(argv[i]);
629  }
630  else if ( std::string(argv[i]).find('-')==0 ) {
632  std::cerr << "unknown option " << argv[i] << std::endl;
633  return usage(argv[0], -1);
634  }
635  else {
636  datafile = argv[i];
637  }
638  }
639 
640 
641 
642  if ( datafile=="" ) {
643  std::cerr << "no config file specifed\n" << endl;
644  return usage(argv[0], -1);
645  }
646 
647  std::cout << time_str() << std::endl;
648 
649  ReadCards inputdata(datafile);
650 
651  inputdata.print();
652 
655  if ( useoldrms ) {
656  bool oldrms95 = true;
657  inputdata.declareProperty( "OldRMS95", oldrms95 );
658  std::cout << "setting Resplot old rms95 " << oldrms95 << std::endl;
659  Resplot::setoldrms95( oldrms95 );
660  }
661  else {
662  std::cout << "setting Resplot old rms95 " << useoldrms << std::endl;
663  Resplot::setoldrms95( useoldrms );
664  }
665 
666 
667  if ( nofit ) {
668  std::cout << "Not fitting resplots " << std::endl;
669  Resplot::setnofit( nofit );
670  }
671 
672 
673  unsigned nfiles = 0;
674  inputdata.declareProperty( "NFiles", nfiles );
675 
676 
677  if ( histofilename=="" ){
678  if ( inputdata.isTagDefined("outputFile") ) histofilename = inputdata.GetString("outputFile");
679  else {
680  std::cerr << "Error: no output file defined\n" << std::endl;
681  return usage(argv[0], -1);
682  }
683  }
684 
686  TFile foutput( histofilename.c_str(), "recreate" );
687  if (!foutput.IsOpen()) {
688  std::cerr << "Error: could not open output file\n" << std::endl;
689  return -1;
690  }
691 
692  TDirectory* foutdir = gDirectory;
693 
694  std::cout << "writing output to " << histofilename << std::endl;
695 
696  TH1D* hevent = new TH1D( "event", "event", 1000, 10000, 80000 );
697  Resplot* hcorr = new Resplot( "correlation", 21, -0.5, 20.5, 75, 0, 600);
698 
700 
701  double pT = 1000;
702  double eta = 2.5;
703  double zed = 2000;
704 
705  double a0min=0.;
706 
707  int npix = 1;
708  int nsct = 6;
709  int nbl = -1;
710 
711  int nsiholes = 2;
712  int npixholes = 20;
713  int nsctholes = 20;
714 
715  bool expectBL = false;
716 
717  double chi2prob = 0;
718 
719  int npix_rec = -2;
720  int nsct_rec = -2;
721 
722  double pT_rec = 0;
723  double eta_rec = 5;
724 
725  double Rmatch = 0.1;
726 
727  int ntracks = 0;
728 
729  double massMax = 130; // default invariant mass window for Tag and Probe Analyses only
730  double massMin = 50;
731 
732  //bool printflag = false; // JK removed (unused)
733 
734  bool rotate_testtracks = false;
735 
736  if ( inputdata.isTagDefined("RotateTestTracks") ) rotate_testtracks = ( inputdata.GetValue("RotateTestTracks") ? true : false );
737 
738  bool truthMatch = false;
739 
740  if ( inputdata.isTagDefined("TruthMatch") ) truthMatch = ( inputdata.GetValue("TruthMatch") ? true : false );
741 
742  // CK: Option to specify which ref tracks to use from ref track vector, ordered by pT
743  // User parameter is a vector of ref track vector indices
744  // e.g. specifyPtOrderedRefTracks = {0, 1, 5} will use the first leading, second leading, and sixth leading track
745  std::vector<size_t> refPtOrd_indices;
746  bool use_pt_ordered_ref = false;
747 
748  if ( inputdata.isTagDefined("UsePtOrderedRefTracks") ) {
749  std::vector<double> refPtOrd_indices_tmp;
750 
751  use_pt_ordered_ref = true;
752  refPtOrd_indices_tmp = ( inputdata.GetVector("UsePtOrderedRefTracks") );
753 
754  std::cout << "using PT ordered reference tracks: " << refPtOrd_indices_tmp << std::endl;
755 
756  for ( size_t i=refPtOrd_indices_tmp.size(); i-- ; ) {
757  refPtOrd_indices.push_back( refPtOrd_indices_tmp.at(i) );
758  }
759  }
760 
761  if ( inputdata.isTagDefined("pT") ) pT = inputdata.GetValue("pT");
762  if ( inputdata.isTagDefined("ET") ) ETmin = inputdata.GetValue("ET");
763  if ( inputdata.isTagDefined("ETovPT") ) ETovPTmin = inputdata.GetValue("ETovPT");
764 
767  double pTMax = pT-1;
768  if ( inputdata.isTagDefined("pTMax") ) pTMax = inputdata.GetValue("pTMax");
769 
770 
771  if ( inputdata.isTagDefined("NMod") ) NMod = inputdata.GetValue("NMod");
772 
773 
774  if ( inputdata.isTagDefined("eta") ) eta = inputdata.GetValue("eta");
775  if ( inputdata.isTagDefined("zed") ) zed = inputdata.GetValue("zed");
776  else if ( inputdata.isTagDefined("z0") ) zed = inputdata.GetValue("z0");
777  if ( inputdata.isTagDefined("npix") ) npix = inputdata.GetValue("npix");
778  if ( inputdata.isTagDefined("nsiholes") ) nsiholes = inputdata.GetValue("nsiholes");
779  if ( inputdata.isTagDefined("npixholes") ) npixholes = inputdata.GetValue("npixholes");
780  if ( inputdata.isTagDefined("nsctholes") ) nsctholes = inputdata.GetValue("nsctholes");
781  if ( inputdata.isTagDefined("expectBL") ) expectBL = ( inputdata.GetValue("expectBL") > 0.5 ? true : false );
782  if ( inputdata.isTagDefined("nsct") ) nsct = inputdata.GetValue("nsct");
783  if ( inputdata.isTagDefined("nbl") ) nbl = inputdata.GetValue("nbl");
784  if ( inputdata.isTagDefined("chi2prob") ) chi2prob = inputdata.GetValue("chi2prob");
785 
786  if ( inputdata.isTagDefined("ntracks") ) ntracks = inputdata.GetValue("ntracks")+0.5; // rounding necessary ?
787 
788 
789  if ( inputdata.isTagDefined("chi2prob") ) chi2prob = inputdata.GetValue("chi2prob");
790 
792  if ( pdgId==0 && inputdata.isTagDefined("pdgId") ) pdgId = inputdata.GetValue("pdgId");
793 
794  if ( inputdata.isTagDefined("InvMassMax") ) massMax = inputdata.GetValue("InvMassMax");
795  if ( inputdata.isTagDefined("InvMassMin") ) massMin = inputdata.GetValue("InvMassMin");
796 
797  if ( inputdata.isTagDefined("npix_rec") ) npix_rec = inputdata.GetValue("npix_rec");
798  if ( inputdata.isTagDefined("nsct_rec") ) nsct_rec = inputdata.GetValue("nsct_rec");
799 
800  if ( inputdata.isTagDefined("pT_rec") ) pT_rec = inputdata.GetValue("pT_rec");
801  if ( inputdata.isTagDefined("eta_rec") ) eta_rec = inputdata.GetValue("eta_rec");
802 
803  if ( inputdata.isTagDefined("a0") ) a0 = inputdata.GetValue("a0");
804  if ( inputdata.isTagDefined("a0min") ) a0min = inputdata.GetValue("a0min");
805 
806  if ( inputdata.isTagDefined("Rmatch") ) Rmatch = inputdata.GetValue("Rmatch");
807 
808  std::string useMatcher = "DeltaR";
809  if ( inputdata.isTagDefined("UseMatcher") ) useMatcher = inputdata.GetString("UseMatcher");
810 
811 
813  if ( refChain=="" ) {
814  if ( inputdata.isTagDefined("refChain") ) {
815  refChain = inputdata.GetString("refChain");
816  refChains.push_back(refChain);
817  refFilters.push_back(0);
818  }
819  else {
820  std::cerr << "Error: no reference chain defined\n" << std::endl;
821  // return usage(argv[0], -1);
822  return -1;
823  }
824  }
825 
826  std::string exclude = "";
827 
828  TrackAssociator* ex_matcher = 0;
829 
830  if ( inputdata.isTagDefined("Exclude") ) {
831  exclude = inputdata.GetString("Exclude");
832  ex_matcher = new Associator_BestDeltaRZSinThetaMatcher( "deltaRZ", 0.01, 0.01, 2 );
833  }
834 
835  if (refChains.size() == 0){
836  std::cerr << "Error: refChains is empty\n" <<std::endl;
837  return -1;
838  }
839 
841  if ( testChains.size()==0 ) {
842  if ( inputdata.isTagDefined("testChains") ) testChains = inputdata.GetStringVector("testChains");
843  else if ( inputdata.isTagDefined("testChain") ) testChains.push_back( inputdata.GetString("testChain") );
844  }
845 
848 
849  std::vector<ChainString> chainConfig;
850 
851  for ( size_t ic=0 ; ic<testChains.size() ; ic++ ) {
852  chainConfig.push_back( ChainString( testChains[ic] ) );
853  testChains[ic] = chainConfig.back().pre();
854  }
855 
856 
858 
859 
861  //if ( inputdata.isTagDefined("printflag") ) printflag = ( inputdata.GetValue("printflag") ? 1 : 0 ); // JK removed (unused)
862 
864  bool select_roi = true;
865 
866 
867  // CK: use a custom filter RoI for ref tracks using refFilter?
868  // Note that if the reference chain uses a non-full-scan RoI, the custom filter RoI could be wider than the
869  // ref chain RoI
870  bool use_custom_ref_roi = false;
871  const int custRefRoi_nParams = 3;
872 
873  double custRefRoi_params[custRefRoi_nParams] = {-999., -999., -999.};
874  std::vector<std::string> custRefRoi_chainList; // Vector of chain names to apply the custom roi to
875  std::set<std::string> customRoi_chains;
876 
877  if ( inputdata.isTagDefined("customRefRoi_etaHalfWidth") ) custRefRoi_params[0] = inputdata.GetValue("customRefRoi_etaHalfWidth");
878  if ( inputdata.isTagDefined("customRefRoi_phiHalfWidth") ) custRefRoi_params[1] = inputdata.GetValue("customRefRoi_phiHalfWidth");
879  if ( inputdata.isTagDefined("customRefRoi_zedHalfWidth") ) custRefRoi_params[2] = inputdata.GetValue("customRefRoi_zedHalfWidth");
880 
881  if ( inputdata.isTagDefined("customRefRoi_chainList") ) custRefRoi_chainList = inputdata.GetStringVector("customRefRoi_chainList");
882 
883  for ( unsigned ic=0 ; ic<custRefRoi_chainList.size() ; ic++ ) customRoi_chains.insert( custRefRoi_chainList[ic] );
884 
885  for ( int param_idx=0 ; param_idx<custRefRoi_nParams ; param_idx++ ) {
886  if ( custRefRoi_params[param_idx] != -999 ) {
887  select_roi = true; // In case select_roi is ever set to default to false
888  use_custom_ref_roi = true;
889  }
890  }
891 
892  if ( use_custom_ref_roi ) {
893  std::cout << "**** \t****" << std::endl;
894  std::cout << "**** Custom RoI will be used to filter ref. tracks\t****" << std::endl;
895 
896  if ( custRefRoi_params[0] != -999. ) std::cout << "**** etaHalfWidth = " << custRefRoi_params[0] << "\t\t\t\t****" << std::endl;
897  else std::cout << "**** etaHalfWidth = value used in trigger RoI\t****" << std::endl;
898 
899  if ( custRefRoi_params[1] != -999. ) std::cout << "**** phiHalfWidth = " << custRefRoi_params[1] << "\t\t\t\t****" << std::endl;
900  else std::cout << "**** phiHalfWidth = value used in trigger RoI\t****" << std::endl;
901 
902  if ( custRefRoi_params[2] != -999. ) std::cout << "**** zedHalfWidth = " << custRefRoi_params[2] << "\t\t\t\t****" << std::endl;
903  else std::cout << "**** zedHalfWidth = value used in trigger RoI\t****" << std::endl;
904 
905  if ( !custRefRoi_chainList.empty() ) {
906  std::cout << "**** \t****" << std::endl;
907  std::cout << "**** Applying custom RoI only to specified chains\t****" << std::endl;
908  }
909  std::cout << "**** \t****" << std::endl;
910  }
911 
912  // Checking for SelectRoi after any other options that will set select_roi, to ensure that the value set
913  // here will be used
914  if ( inputdata.isTagDefined("SelectRoi") ) {
915  select_roi = ( inputdata.GetValue("SelectRoi")!=0 ? true : false );
916  }
917 
918  if ( !select_roi ) {
919  std::cout << "**** ****" << std::endl;
920  std::cout << "**** RoI filtering of reference tracks is disabled ****" << std::endl;
921  std::cout << "**** ****" << std::endl;
922  }
923 
924  // bool selectfake_roi = false; // JK removed (unused)
925  // if ( inputdata.isTagDefined("SelectFakeRoi") ) {
926  // selectfake_roi = ( inputdata.GetValue("SelectFakeRoi")!=0 ? true : false ); // JK removed (unused)
927  // }
928 
929 
930  std::vector<double> lumiblocks;
932 
933 
934  if ( inputdata.isTagDefined("GRL") ) {
936  std::vector<std::string> grlvector = inputdata.GetStringVector("GRL");
937  std::cout << "Reading GRL from: " << grlvector << std::endl;
938  for ( size_t igrl=0 ; igrl<grlvector.size() ; igrl++ ) goodrunslist.read( grlvector[igrl] );
939  // std::cout << goodrunslist << std::endl;
940  }
941  else if ( inputdata.isTagDefined("LumiBlocks") ) {
943  lumiblocks = inputdata.GetVector("LumiBlocks");
944 
945  for (unsigned int i=0 ; i<lumiblocks.size()-2 ; i+=3 ){
946  goodrunslist.addRange( lumiblocks[i], lumiblocks[i+1], lumiblocks[i+2] );
947  }
948  }
949 
950 
952 
953 
954  if ( vertexSelection == "" ) {
955  if ( inputdata.isTagDefined("VertexSelection") ) vertexSelection = inputdata.GetString("VertexSelection");
956  }
957 
958  bool bestPTVtx = false;
959  bool bestPT2Vtx = false;
960  int vtxind = -1;
961 
962  if ( vertexSelection!="" ) {
963  if ( vertexSelection=="BestPT" ) bestPTVtx = true;
964  else if ( vertexSelection=="BestPT2" ) bestPT2Vtx = true;
965  else vtxind = atoi_check( vertexSelection );
966  }
967 
968 
969 
970 
972 
973  if ( vertexSelection_rec == "" ) {
974  if ( inputdata.isTagDefined("VertexSelectionRec") ) vertexSelection_rec = inputdata.GetString("VertexSelectionRec");
975  }
976 
977  bool bestPTVtx_rec = false;
978  bool bestPT2Vtx_rec = false;
979  int vtxind_rec = -1;
980 
981  if ( vertexSelection_rec!="" ) {
982  if ( vertexSelection_rec=="BestPT" ) bestPTVtx_rec = true;
983  else if ( vertexSelection_rec=="BestPT2" ) bestPT2Vtx_rec = true;
984  else vtxind_rec = atoi_check( vertexSelection_rec );
985  }
986 
987  std::cout << "vertexSelection: " << vertexSelection << std::endl;
988  std::cout << "vertexSelection_rec: " << vertexSelection_rec << std::endl;
989 
990 
991 #if 0
992 
995 
996  bool useBestVertex = false;
997  if ( inputdata.isTagDefined("useBestVertex") ) useBestVertex = ( inputdata.GetValue("useBestVertex") ? 1 : 0 );
998 
999  bool useSumPtVertex = true;
1000  if ( inputdata.isTagDefined("useSumPtVertex") ) useSumPtVertex = ( inputdata.GetValue("useSumPtVertex") ? 1 : 0 );
1001 
1002  int MinVertices = 1;
1003  if ( inputdata.isTagDefined("MinVertices") ) MinVertices = inputdata.GetValue("MinVertices");
1004 
1006 
1007 #endif
1008 
1010  bool useVertexTracks = false;
1011  if ( inputdata.isTagDefined("UseVertexTracks") ) useVertexTracks = ( inputdata.GetValue("UseVertexTracks") > 0 );
1012 
1013  // option to vary default "PrimaryVertices" offline reference collection
1014  std::string vertex_refname = "Vertex";
1015  if ( inputdata.isTagDefined("VertexReference") ) vertex_refname += ":" + inputdata.GetString("VertexReference");
1016 
1018  int NVtxTrackCut = 2;
1019  if ( inputdata.isTagDefined("NVtxTrackCut") ) NVtxTrackCut = inputdata.GetValue("NVtxTrackCut");
1020 
1021 
1022  std::vector<double> event_list;
1023  bool event_selector_flag = false;
1024 
1025  if ( inputdata.isTagDefined("EventSelector") ) event_list = inputdata.GetVector("EventSelector");
1026 
1028 
1029  if ( es.size() ) event_selector_flag = true;
1030 
1031 
1032  std::vector<double> beamTest;
1033  std::vector<double> beamRef;
1034 
1035 
1036  bool correctBeamlineRef = false;
1037  bool correctBeamlineTest = false;
1038 
1039  if ( inputdata.isTagDefined("CorrectBeamlineRef") ) correctBeamlineRef = ( inputdata.GetValue("CorrectBeamlineRef") == 0 ? false : true );
1040  if ( inputdata.isTagDefined("CorrectBeamlineTest") ) correctBeamlineTest = ( inputdata.GetValue("CorrectBeamlineTest") == 0 ? false : true );
1041 
1042 
1043  if ( inputdata.isTagDefined("BeamTest") ) beamTest = inputdata.GetVector("BeamTest");
1044  else {
1045  if ( inputdata.isTagDefined("BeamTestx") ) beamTest.push_back(inputdata.GetValue("BeamTestx"));
1046  if ( inputdata.isTagDefined("BeamTesty") ) beamTest.push_back(inputdata.GetValue("BeamTesty"));
1047  }
1048 
1049 
1050  if ( inputdata.isTagDefined("BeamRef") ) beamRef = inputdata.GetVector("BeamRef");
1051  else {
1052  if ( inputdata.isTagDefined("BeamRefx") ) beamRef.push_back(inputdata.GetValue("BeamRefx"));
1053  if ( inputdata.isTagDefined("BeamRefy") ) beamRef.push_back(inputdata.GetValue("BeamRefy"));
1054  }
1055 
1056 
1057 
1058  if ( ( beamTest.size()!=0 && beamTest.size()!=2 && beamTest.size()!=3 ) ||
1059  ( beamRef.size()!=0 && beamRef.size()!=2 && beamRef.size()!=3 ) ) {
1060  std::cerr << "incorrectly specified beamline position" << std::endl;
1061  return (-1);
1062  }
1063 
1064  if ( beamTest.size()>0 ) correctBeamlineTest = true;
1065  if ( beamRef.size()>0 ) correctBeamlineRef = true;
1066 
1067  if ( correctBeamlineRef ) std::cout << "main() correcting beamline for reference tracks" << std::endl;
1068  if ( correctBeamlineTest ) std::cout << "main() correcting beamline for test tracks" << std::endl;
1069 
1070 
1071 
1072  if ( beamRef.size()>0 ) std::cout << "beamref " << beamRef << std::endl;
1073  if ( beamTest.size()>0 ) std::cout << "beamtest " << beamTest << std::endl;
1074 
1075  double a0v = 1000;
1076  double z0v = 2000;
1077 
1078  if ( inputdata.isTagDefined("a0v") ) a0v = inputdata.GetValue("a0v");
1079  if ( inputdata.isTagDefined("z0v") ) z0v = inputdata.GetValue("z0v");
1080 
1081 
1082  double a0vrec = 1000;
1083  double z0vrec = 2000;
1084 
1085  if ( inputdata.isTagDefined("a0vrec") ) a0vrec = inputdata.GetValue("a0vrec");
1086  if ( inputdata.isTagDefined("z0vrec") ) z0vrec = inputdata.GetValue("z0vrec");
1087 
1088  bool initialiseFirstEvent = false;
1089  if ( inputdata.isTagDefined("InitialiseFirstEvent") ) initialiseFirstEvent = inputdata.GetValue("InitialiseFirstEvent");
1090 
1091 
1092  // set the flag to prinout the missing track list in ConfAnalysis
1093  if ( inputdata.isTagDefined("dumpflag") ) dumpflag = ( inputdata.GetValue("dumpflag")==0 ? false : true );
1094 
1095 
1096  bool doPurity = false;
1097  if ( inputdata.isTagDefined("doPurity") ) doPurity = ( inputdata.GetValue("doPurity")==0 ? false : true );
1098 
1099  if ( inputdata.isTagDefined("DebugPrintout") ) debugPrintout = ( inputdata.GetValue("DebugPrintout")==0 ? false : true );
1100 
1101 
1102  bool monitorZBeam = false;
1103  if ( inputdata.isTagDefined("MonitorinZBeam") ) monitorZBeam = ( inputdata.GetValue("MonitorZBeam")==0 ? false : true );
1104 
1105  std::cout << "dbg " << __LINE__ << std::endl;
1106 
1107  ReadCards* binningConfig = &inputdata;
1108 
1110 
1111  if ( binningConfigFile!="" ) binningConfig = new ReadCards( binningConfigFile );
1112 
1114  g_binConfig.set( *binningConfig, "" );
1115  electronBinConfig.set( *binningConfig, "e_" );
1116  muonBinConfig.set( *binningConfig, "mu_" );
1117  tauBinConfig.set( *binningConfig, "tau_" );
1118  bjetBinConfig.set( *binningConfig, "bjet_" );
1119  cosmicBinConfig.set( *binningConfig, "cosmic_" );
1120 
1121 
1123  if ( binningConfig!=&inputdata ) delete binningConfig; // cppcheck-suppress autovarInvalidDeallocation; false positive
1124 
1125 
1126  if ( inputdata.isTagDefined("PRINT_BRESIDUALS") ) PRINT_BRESIDUALS = ( inputdata.GetValue("PRINT_BRESIDUALS")==0 ? false : true );
1127 
1128  int selectcharge = 0;
1129  if ( inputdata.isTagDefined("Charge") ) selectcharge = inputdata.GetValue("Charge");
1130 
1131 
1132  std::cout << "using reference " << refChain << std::endl;
1133  if ( refChain.find("Truth") != string::npos ) std::cout << "using pdgId " << pdgId << std::endl;
1134  if ( refChains.size() > 1 ) std::cout<<"Multiple reference chains split to: " << refChains <<std::endl;
1135 
1137 
1139 
1141  // Filter_Track( double etaMax, double d0Max, double z0Max, double pTMin,
1142  // int minPixelHits, int minSctHits, int minSiHits, int minBlayerHits,
1143  // int minStrawHits, int minTrHits, double prob=0 ) :
1144 
1146 
1147  std::cout << "a0v: " << a0v << std::endl;
1148  std::cout << "z0v: " << z0v << std::endl;
1149 
1150  Filter_Vertex filter_vertex( a0v, z0v );
1151 
1152  Filter_Track filter_offline( eta, 1000, a0min, zed, pT,
1153  npix, nsct, -1, nbl,
1154  -2, -2, chi2prob,
1155  npixholes, nsctholes, nsiholes, expectBL );
1156 
1157  if ( selectcharge!=0 ) filter_offline.chargeSelection( selectcharge );
1158  if ( pTMax>pT ) filter_offline.maxpT( pTMax );
1159 
1160  Filter_etaPT filter_etaPT(eta,pT);
1161 
1162 
1163  // std::cout << "pdgId " << pdgId << std::endl;
1164  //Select only true particles matching pdgId
1165  Filter_pdgId filter_pdgtruth(pdgId); //BP
1166 
1167  // select inside-out offline tracking
1168 
1169  // Filter_TruthParticle filter_passthrough(&filter_offline);
1170  // Filter_Track filter_track( eta, 1000, 2000, pT, npix, nsct, -1, -1, -2, -2);
1171 
1172  Filter_Author filter_inout(0);
1173 
1174  int author = 0;
1175 
1176  Filter_Author filter_auth(author);
1177 
1178  Filter_TrackQuality filter_q(0.01);
1179  Filter_Combined filter_off(&filter_offline, &filter_vertex);
1180 
1181  Filter_Combined filter_truth( &filter_pdgtruth, &filter_etaPT);
1182 
1183  Filter_Combined filter_muon( &filter_offline, &filter_vertex);
1184 
1185  Filter_Track filter_onlinekine( eta_rec, 1000, 0., 2000, pT, -1, npix, nsct, -1, -2, -2);
1186  Filter_Vertex filter_onlinevertex( a0vrec, z0vrec);
1187  Filter_Combined filter_online( &filter_onlinekine, &filter_onlinevertex );
1188 
1189  Filter_Track filter_offkinetight( 5, 1000, 0., 2000, pT, -1, 0, 0, -1, -2, -2);
1190  Filter_Combined filter_offtight( &filter_offkinetight, &filter_inout );
1191 
1192  Filter_Offline2017* filter_offline2017 = 0;
1193  Filter_OfflineR22* filter_offlineR22 = 0;
1194  Filter_Combined* filter_offCP = 0;
1197 
1198 
1199  if ( inputdata.isTagDefined("Filter" ) ) {
1200  ChainString filter = inputdata.GetString("Filter");
1201  std::cout << "Filter: " << inputdata.GetString("Filter") << " : " << filter << std::endl;
1202  if ( filter.head()=="Offline2017" ) {
1203  std::string filter_type = filter.tail();
1204  filter_offline2017 = new Filter_Offline2017( pT, filter_type, zed, a0 );
1205  filter_offCP = new Filter_Combined ( filter_offline2017, &filter_vertex);
1206  refFilter = filter_offCP;
1207  }
1208  else if ( filter.head()=="OfflineR22" ) {
1209  std::string filter_type = filter.tail();
1210  filter_offlineR22 = new Filter_OfflineR22( pT, filter_type, zed, a0 );
1211  filter_offCP = new Filter_Combined ( filter_offlineR22, &filter_vertex);
1212  refFilter = filter_offCP;
1213  }
1214  else {
1215  std::cerr << "unimplemented Filter requested: " << filter.head() << std::endl;
1216  return -1;
1217  }
1218  }
1219  else {
1220  if ( !(refFilter = getFilter( refChains[0], pdgId, &filter_off, &filter_muon, &filter_truth ) ) ) {
1221  std::cerr << "unknown reference chain defined" << std::endl;
1222  return (-1);
1223  }
1224  }
1225 
1226  refFilters.push_back(refFilter);
1227 
1228 
1229  std::map<std::string,TIDA::Reference> ref;
1230 
1231  std::vector<NtupleTrackSelector*> refSelectors;
1232 
1233 #if 0
1234 
1238  for ( size_t ic=0 ; ic<refChains.size() ; ic++ ) {
1239 
1240  if ( refFilter==0 ) {
1241  if ( !(refFilters[ic] = getFilter( refChains[ic], pdgId, &filter_off, &filter_muon, &filter_truth ) ) ) {
1242  std::cerr << "unknown reference chain defined" << std::endl;
1243  return (-1);
1244  }
1245  refFilter = refFilters[ic];
1246  }
1247  else refFilters[ic] = refFilter;
1248 
1249  ref.insert( TIDA::ReferenceMap::value_type( refChains[ic], TIDA::Reference( refChains[ic], new NtupleTrackSelector(refFilter), refFilter, new TrigObjectMatcher ) ) );
1250 
1251  }
1252 
1253 # endif
1254 
1255  if (pdgId==0) truthFilter = &filter_off;
1256  else truthFilter = &filter_truth;
1257 
1258 
1259  // use an actual filter requiring at least 1 silicon hit
1260  // to get rid of the EF trt only tracks
1261 
1262  std::cout << "filter_passthrough" << std::endl;
1263 
1264  Filter_Track filter_passthrough( 10, 1000, 0., 2000, pT_rec, npix_rec, nsct_rec, 1, -2, -2, -2);
1265 
1266  TrackFilter* testFilter = &filter_passthrough;
1267 
1268 
1269  std::cout << "using tracks: " << refChain << " for reference sample" << std::endl;
1270 
1271 
1273  // std::vector<std::string> chains;
1274 
1275  std::vector<std::string>& test_chains = testChains;
1276 
1279  //smh: TrackAnalysis is purely abstract, analysis will contain ConfAnalysis
1280  std::map<std::string,TrackAnalysis*> analysis;
1281 
1285 
1286  std::vector<TrackAnalysis*> analyses;
1287  analyses.reserve(test_chains.size());
1288 
1289  std::cout << "booking " << test_chains.size() << " analyses" << std::endl;
1290 
1291  for ( unsigned i=0 ; i<test_chains.size() ; i++ ) {
1292 
1293  std::string chainname = ChainString(test_chains[i]);
1294 
1295  std::vector<std::string> chainnames;
1296 
1297  chainnames.push_back(chainname);
1298 
1299 
1300  // tag and probe object creation and configuration
1301 
1302  TagNProbe* TnP_tool = 0;
1303  ChainString probe = chainConfig[i];
1304 
1305  std::string probe_extra = probe.extra();
1306 
1307  if ( probe_extra.empty() ) probe_extra = probe.postvalue("extra");
1308 
1309  if ( probe_extra.find("_tag")!=std::string::npos || probe.extra().find("_tag")!=std::string::npos ) {
1310  std::cout << "rejecting tag chain " << probe << std::endl;
1311  continue;
1312  }
1313 
1314  // probe can be the .head() so convert m_chainNames to a ChainString and search the .extra() specifically
1315  size_t p = probe_extra.find("_probe");
1316 
1317  if ( p!=std::string::npos ) {
1318 
1319  std::string probe_ref = refChains[0];
1320 
1321  if ( !probe.postvalue("ref").empty() ) {
1322 
1323  probe_ref = probe.postvalue("ref");
1324 
1325  if ( refChains[0] != probe_ref ) {
1326  std::cerr << "default and probe chain references do not match: probe ref: " << probe_ref << " ref: " << refChains[0] << std::endl;
1327  return -1;
1328  }
1329 
1330  }
1331 
1332 
1333  std::string probe_key = probe_extra.erase(p, 6);
1334 
1335  for ( unsigned j=0 ; j<test_chains.size(); ++j) {
1336 
1337  if ( i==j ) continue;
1338 
1339  ChainString tag = chainConfig[j];
1340 
1341  if ( tag.head() != probe.head() ) continue;
1342 
1343  // if ( tag.tail() != probe.tail() ) continue; // should not enforce this for mu + tau tnp chains
1344 
1345  std::string tag_extra = tag.extra();
1346 
1347  if ( tag_extra.empty() ) tag_extra = tag.postvalue("extra");
1348  if ( tag_extra.find("_tag")==std::string::npos ) continue;
1349 
1350  // need to compare just the 'el1' part of of .extra() so create variables without '_probe/_tag' part
1351  std::string tag_key = tag_extra.erase( tag_extra.find("_tag"), 4) ;
1352 
1353  // tag chain must be the same as probe chain but with te=0 and extra=*_tag
1354  if ( tag_key != probe_key ) continue;
1355 
1356  if ( tag.element() == probe.element() ) continue;
1357 
1358  std::string tag_ref = refChains[0];
1359 
1361 
1362  TrackFilter* filter = getFilter( probe_ref, pdgId, &filter_off, &filter_muon, &filter_truth );
1363 
1364  ref.insert( TIDA::ReferenceMap::value_type( probe_ref, TIDA::Reference( probe_ref, new NtupleTrackSelector(filter), filter, new TrigObjectMatcher ) ) );
1365 
1366  if ( !tag.postvalue("ref").empty() ) {
1367 
1368  tag_ref = tag.postvalue("ref");
1369  // refChains.push_back( tag_ref);
1370 
1371  std::cout << "tag ref: " << tag_ref << std::endl;
1372 
1373  if ( ref.find(tag_ref)==ref.end() ) {
1374  TrackFilter* filter = getFilter( tag_ref, pdgId, &filter_off, &filter_muon, &filter_truth );
1375  // ref.insert( std::map<std::string,TIDA::Reference>::value_type( tag_ref, TIDA::Reference( tag_ref, new NtupleTrackSelector(filter) ) ) );
1377  }
1378  }
1379 
1383  // TnP_tool = new TagNProbe( refChains[0], refChains[0], massMin, massMax);
1384  TnP_tool = new TagNProbe( tag_ref, probe_ref, massMin, massMax);
1385  TnP_tool->tag(tag);
1386  TnP_tool->probe(probe);
1387  std::cout << "Tag and probe pair found! \n\t Tag : " << tag << "\n\t Probe : " << probe
1388  << "\n\t tag ref: " << tag_ref
1389  << "\n\tprobe ref: " << probe_ref
1390  << "\n-------------------" << std::endl;
1391 
1393  // std::cout << *TnP_tool << std::endl;
1394 
1395  break ;
1396  }
1397 
1398  }
1399 
1400  // Replace "/" with "_" in chain names, for Tag&Probe analysis
1401  if ( TnP_tool ) replace( chainname, "/", "_" );
1402  ConfAnalysis* analy_conf = new ConfAnalysis( chainname, chainConfig[i], TnP_tool );
1403 
1404  analy_conf->initialiseFirstEvent(initialiseFirstEvent);
1405  analy_conf->initialise();
1406  analy_conf->setprint(false);
1407 
1408  std::string vtxTool = chainConfig[i].postvalue("rvtx");
1409 
1410  if ( vtxTool!="" ) {
1413  ConfVtxAnalysis* anal_confvtx = new ConfVtxAnalysis( vtxTool, (vertex_refname!="Vertex") );
1414  // ConfVtxAnalysis* anal_confvtx = new ConfVtxAnalysis( "vertex" );
1415  analy_conf->store().insert( anal_confvtx, "rvtx" );
1416  }
1417 
1418 
1419  // analy_conf->setprint(true);
1420 
1425 
1430 
1431  if ( chainConfig[i].values().size()>0 ) {
1432  std::cout << "chain:: " << chainname << " : size " << chainConfig[i].values().size() << std::endl;
1433  for ( unsigned ik=chainConfig[i].values().size() ; ik-- ; ) {
1434  std::cout << "\tchainconfig: " << ik << "\tkey " << chainConfig[i].keys()[ik] << " " << chainConfig[i].values()[ik] << std::endl;
1435  }
1436  }
1437 
1439  // for (unsigned int ic=0 ; ic<chainnames.size() ; ic++ ) analysis[chainnames[ic]] = analy_conf;
1440 
1441  if ( analysis.find( chainname )==analysis.end() ) {
1442  analysis.insert( std::map<std::string,TrackAnalysis*>::value_type( chainname, analy_conf ) );
1443  analyses.push_back(analy_conf);
1444  }
1445  else {
1446  std::cerr << "WARNING: Duplicated chain"
1447  << "\n"
1448  << "---------------------------------"
1449  << "---------------------------------"
1450  << "---------------------------------" << std::endl;
1451  continue;
1452  }
1453 
1454  std::cout << "analysis: " << chainname << "\t" << analy_conf
1455  << "\n"
1456  << "---------------------------------"
1457  << "---------------------------------"
1458  << "---------------------------------" << std::endl;
1459 
1460  if ( doPurity ) {
1461  PurityAnalysis* analp = new PurityAnalysis(chainnames[0]+"-purity");
1462  std::cout << "purity " << (chainnames[0]+"-purity") << std::endl;
1463  analp->initialise();
1464  analp->setprint(false);
1465  // analp->setprint(true);
1466  analysis[chainnames[0]+"-purity"] = analp;
1467  analyses.push_back(analp);
1468  }
1469 
1470  }
1471 
1472  std::cout << "main() finished looping" << std::endl;
1473 
1475 
1476  bool fullyContainTracks = false;
1477 
1478  if ( inputdata.isTagDefined("FullyContainTracks") ) {
1479  fullyContainTracks = ( inputdata.GetValue("FullyContainTracks")==0 ? false : true );
1480  }
1481 
1482  bool containTracksPhi = true;
1483 
1484  if ( inputdata.isTagDefined("ContainTracksPhi") ) {
1485  containTracksPhi = ( inputdata.GetValue("ContainTracksPhi")==0 ? false : true );
1486  }
1487 
1488  if ( dynamic_cast<Filter_Combined*>(refFilter) ) {
1489  dynamic_cast<Filter_Combined*>(refFilter)->setDebug(debugPrintout);
1490  dynamic_cast<Filter_Combined*>(refFilter)->containtracks(fullyContainTracks);
1491  dynamic_cast<Filter_Combined*>(refFilter)->containtracksPhi(containTracksPhi);
1492  }
1493 
1494  NtupleTrackSelector refTracks( refFilter );
1495  NtupleTrackSelector offTracks( testFilter );
1496  NtupleTrackSelector testTracks( testFilter);
1497 
1498  NtupleTrackSelector truthTracks( truthFilter );
1499 
1500  // NtupleTrackSelector refTracks( &filter_passthrough );
1501  // NtupleTrackSelector testTracks( refFilter );
1502  // NtupleTrackSelector refTracks( &filter_pdgtruth);
1503  // NtupleTrackSelector testTracks( &filter_off );
1504  // NtupleTrackSelector testTracks(&filter_roi);
1505 
1507 
1508  bool filterRoi = false;
1509 
1510  double roieta = 0;
1511  bool roicomposite = false;
1512  size_t roimult = 1;
1513 
1514  if ( inputdata.isTagDefined( "FilterRoi" ) ) {
1515 
1516  filterRoi = true;
1517 
1518  std::vector<double> filter_values = inputdata.GetVector( "FilterRoi" );
1519 
1520  if ( filter_values.size()>0 ) roieta = filter_values[0];
1521  if ( filter_values.size()>1 ) roicomposite = ( filter_values[1]==0 ? false : true );
1522  if ( filter_values.size()>2 ) roimult = int(filter_values[2]+0.5);
1523 
1524  }
1525 
1526  RoiFilter roiFilter( roieta, roicomposite, roimult );
1527 
1529 
1530  TrackAssociator* matcher = 0;
1531 
1532  if ( useMatcher == "Sigma" ) matcher = new Associator_BestSigmaMatcher("sigma", Rmatch);
1533  else if ( useMatcher == "DeltaRZ" || useMatcher == "DeltaRZSinTheta" ) {
1534  double deta = 0.05;
1535  double dphi = 0.05;
1536  double dzed = 25;
1537  if ( inputdata.isTagDefined("Matcher_deta" ) ) deta = inputdata.GetValue("Matcher_deta");
1538  if ( inputdata.isTagDefined("Matcher_dphi" ) ) dphi = inputdata.GetValue("Matcher_dphi");
1539  if ( inputdata.isTagDefined("Matcher_dzed" ) ) dzed = inputdata.GetValue("Matcher_dzed");
1540 
1541  if ( useMatcher == "DeltaRZ" ) matcher = new Associator_BestDeltaRZMatcher( "deltaRZ", deta, dphi, dzed );
1542  else matcher = new Associator_BestDeltaRZSinThetaMatcher( "deltaRZ", deta, dphi, dzed );
1543  }
1544  else if ( useMatcher == "pT_2" ) {
1545  double pTmatchLim_2 = 1.0;
1546  if ( inputdata.isTagDefined("Matcher_pTLim_2") ) pTmatchLim_2 = inputdata.GetValue("Matcher_pTLim_2");
1547  matcher = new Associator_SecondBestpTMatcher("SecpT", pTmatchLim_2);
1548  }
1549  else if ( useMatcher == "Truth" ) {
1550  matcher = new Associator_TruthMatcher();
1551  }
1552  else {
1555  matcher = new Associator_BestDeltaRMatcher("deltaR", Rmatch);
1556  }
1557 
1559  TrackAssociator* truth_matcher = 0;
1560  if ( truthMatch ) {
1561  if ( useMatcher == "Sigma" ) truth_matcher = new Associator_BestSigmaMatcher("sigma_truth", Rmatch);
1562  else if ( useMatcher == "DeltaRZ" || useMatcher == "DeltaRZSinTheta" ) {
1563  double deta = 0.05;
1564  double dphi = 0.05;
1565  double dzed = 25;
1566  if ( inputdata.isTagDefined("Matcher_deta" ) ) deta = inputdata.GetValue("Matcher_deta");
1567  if ( inputdata.isTagDefined("Matcher_dphi" ) ) dphi = inputdata.GetValue("Matcher_dphi");
1568  if ( inputdata.isTagDefined("Matcher_dzed" ) ) dzed = inputdata.GetValue("Matcher_dzed");
1569 
1570  if ( useMatcher == "DeltaRZ" ) truth_matcher = new Associator_BestDeltaRZMatcher( "deltaRZ_truth", deta, dphi, dzed );
1571  else truth_matcher = new Associator_BestDeltaRZSinThetaMatcher( "deltaRZ_truth", deta, dphi, dzed );
1572  }
1573  else if ( useMatcher == "pT_2" ) {
1574  double pTmatchLim_2 = 1.0;
1575  if ( inputdata.isTagDefined("Matcher_pTLim_2") ) pTmatchLim_2 = inputdata.GetValue("Matcher_pTLim_2");
1576  truth_matcher = new Associator_SecondBestpTMatcher("SecpT_truth", pTmatchLim_2);
1577  }
1578  else if ( useMatcher == "Truth" ) {
1579  truth_matcher = new Associator_TruthMatcher();
1580  }
1581  else {
1584  truth_matcher = new Associator_BestDeltaRMatcher("deltaR_truth", Rmatch);
1585  }
1586  }
1587 
1588 
1589  // NtupleTrackSelector roiTracks( refFilter );
1590 
1591 
1593 
1594  NtupleTrackSelector refPurityTracks( &filter_inout );
1595  NtupleTrackSelector testPurityTracks( &filter_online );
1596 
1597  // get the list of input files
1598 
1599  std::vector<std::string> filenames;
1600 
1601 
1602  if ( inputdata.isTagDefined("DataSets") ) {
1603 
1604  std::cout << "fetching dataset details" << std::endl;
1605  std::vector<std::string> datasets = inputdata.GetStringVector("DataSets");
1606  for (unsigned int ids=0 ; ids<datasets.size() ; ids++ ) {
1607  std::cout << "\tdataset " << datasets[ids] << std::endl;
1608  dataset d( datasets[ids] );
1609  std::vector<std::string> filenames_ = d.datafiles();
1610  std::cout << "\tdataset contains " << filenames_.size() << " files" << std::endl;
1611  filenames.insert(filenames.end(), filenames_.begin(),filenames_.end());
1612  }
1613  }
1614  else if ( inputdata.isTagDefined("DataFiles") ) filenames = inputdata.GetStringVector("DataFiles");
1615  else {
1616  std::cerr << "no input data specified" << std::endl;
1617  return (-1);
1618  }
1619 
1620 
1622 
1623  // TString* releaseMetaData = 0;
1624  // data->SetBranchAddress("ReleaseMetaData",&releaseMetaData);
1625 
1626  bool show_release = true;
1627 
1628  std::vector<std::string> release_data;
1629 
1630  std::string release_data_save = "";
1631 
1632  if ( show_release ){
1633 
1634  bool first = true;
1635 
1636  for ( unsigned i=0 ; first && i<filenames.size() ; i++ ) {
1637 
1638  TFile* finput = TFile::Open( filenames[i].c_str() );
1639 
1640 
1641  if ( finput==0 || !finput->IsOpen() || finput->IsZombie() ) {
1642  std::cerr << "Error: could not open input file: " << filenames[i] << std::endl;
1643  exit(-1);
1644  }
1645 
1646  TTree* dataTree = (TTree*)finput->Get("dataTree");
1647  TString* releaseData = new TString("");
1648 
1649  if ( dataTree ) {
1650  dataTree->SetBranchAddress( "ReleaseMetaData", &releaseData);
1651 
1652  for (unsigned int i=0; i<dataTree->GetEntries() ; i++ ) {
1653  dataTree->GetEntry(i);
1654  release_data.push_back( releaseData->Data() );
1655  if ( release_data_save != release_data.back() ) {
1656  std::cout << "main() release data: " << release_data.back() << " : " << *releaseData << std::endl;
1657  }
1658  first = false;
1659  release_data_save = release_data.back();
1660  }
1661  }
1662 
1663  if ( finput ) delete finput;
1664  }
1665 
1666  // for ( unsigned ird=0 ; ird<release_data.size() ; ird++ ) std::cout << "presort " << ird << " " << release_data[ird] << std::endl;
1667 
1668  if ( !release_data.empty() ) {
1669  std::sort(release_data.begin(), release_data.end());
1670  release_data.erase(std::unique(release_data.begin(), release_data.end()), release_data.end());
1671 
1672  // for ( unsigned ird=0 ; ird<release_data.size() ; ird++ ) std::cout << "postsort " << ird << " " << release_data[ird] << std::endl;
1673 
1674  foutdir->cd();
1675 
1676  TTree* dataTree = new TTree("dataTree", "dataTree");
1677  TString* releaseData = new TString("");
1678 
1679  if ( dataTree ) {
1680  dataTree->Branch( "ReleaseMetaData", "TString", &releaseData);
1681 
1682  for ( unsigned ird=0 ; ird<release_data.size() ; ird++ ) {
1683  *releaseData = release_data[ird];
1684  dataTree->Fill();
1685  }
1686 
1687  dataTree->Write("", TObject::kOverwrite);
1688  delete dataTree;
1689  }
1690  }
1691 
1692  }
1693 
1694  // foutput.Write();
1695  // foutput.Close();
1696 
1697  // exit(0);
1698 
1699 
1700 
1701 
1702 
1703 
1704 
1705  if ( Nentries==0 && inputdata.isTagDefined("Nentries") ) {
1706  Nentries = unsigned(inputdata.GetValue("Nentries"));
1707  }
1708 
1709  unsigned event_counter = 0;
1710 
1711  typedef std::pair<int,double> zpair;
1712  std::vector<zpair> refz;
1713  std::vector<zpair> testz;
1714 
1715  std::vector<double> beamline_ref;
1716  std::vector<double> beamline_test;
1717 
1718  int maxtime = 0;
1719  int mintime = 0;
1720 
1721  std::cout << "opening files" << std::endl;
1722 
1723  bool run = true;
1724 
1725  int pregrl_events = 0;
1726  int grl_counter = 0;
1727 
1728 
1729  std::cout << "starting event loop " << time_str() << std::endl;
1730 
1731 
1732  size_t max_files = filenames.size();
1733  if ( nfiles!=0 && nfiles<max_files ) max_files = nfiles;
1734 
1735  for ( size_t ifile=0 ; run && ifile<max_files; ifile++ ) {
1736 
1737  bool newfile = true;
1738 
1739 
1740  TFile* finput = TFile::Open( filenames[ifile].c_str() );
1741 
1742  if ( finput==0 || !finput->IsOpen() || finput->IsZombie() ) {
1743  std::cerr << "Error: could not open output file " << filenames[ifile] << std::endl;
1744  continue;
1745  }
1746 
1747  TTree* data = (TTree*)finput->Get("tree");
1748 
1749  if ( !data ) {
1750  std::cerr << "Error: cannot open TTree: " << filenames[ifile] << std::endl;
1751  continue;
1752  }
1753 
1754  TIDA::Event* track_ev = new TIDA::Event();
1755 
1756  gevent = track_ev;
1757 
1758  data->SetBranchAddress("TIDA::Event",&track_ev);
1759 
1760 
1761  maxtime = track_ev->time_stamp();
1762  mintime = track_ev->time_stamp();
1763 
1764  unsigned cNentries = data->GetEntries();
1765 
1766  bool skip = true;
1767 
1770  for (unsigned int i=0; skip && run && i<cNentries ; i++ ) {
1771 
1772  data->GetEntry(i);
1773 
1774  r = track_ev->run_number();
1775  ev = track_ev->event_number();
1776  lb = track_ev->lumi_block();
1777  ts = track_ev->time_stamp();
1778 
1779  int event = track_ev->event_number();
1780  //int bc = track_ev->bunch_crossing_id();
1781 
1782 
1783  hipt = false;
1784 
1785 
1786 
1787  bool ingrl = goodrunslist.inRange( r, lb );
1788 
1789  pregrl_events++;
1790 
1792  if ( !ingrl ) continue;
1793 
1794  grl_counter++;
1795 
1796 
1798  if ( event_selector_flag && !es.in( event ) ) continue;
1799 
1800  if ( mintime>ts ) mintime = ts;
1801  if ( maxtime<ts ) maxtime = ts;
1802 
1803  if ( Nentries>0 && event_counter>Nentries ) {
1804  run = false;
1805  std::cout << "breaking out " << run << std::endl;
1806  break;
1807  }
1808 
1809  event_counter++;
1810 
1811  // if ( !elist.find(event) ) continue;
1812 
1813  // std::cout << "run " << r << "\tevent " << event << "\tlb " << lb << std::endl;
1814 
1815  hevent->Fill( event );
1816 
1817  if ( filenames.size()<2 ) {
1818  if ( (cNentries<10) || i%(cNentries/10)==0 || i%1000==0 || debugPrintout ) {
1819  std::cout << "run " << track_ev->run_number()
1820  << "\tevent " << track_ev->event_number()
1821  << "\tlb " << track_ev->lumi_block()
1822  << "\tchains " << track_ev->chains().size()
1823  << "\ttime " << track_ev->time_stamp();
1824  std::cout << "\t : processed " << i << " events so far (" << int((1000*i)/cNentries)*0.1 << "%)\t" << time_str() << std::endl;
1825  // std::cerr << "\tprocessed " << i << " events so far \t" << time_str() << std::endl;
1826  }
1827  }
1828  else if ( newfile ) {
1829 
1830  int pfiles = filenames.size();
1831  if ( nfiles>0 ) pfiles = nfiles;
1832 
1833 
1834  std::cout << "file entries=" << data->GetEntries();
1835 
1836  if ( data->GetEntries()<100 ) std::cout << " ";
1837  if ( data->GetEntries()<1000 ) std::cout << " ";
1838  if ( data->GetEntries()<10000 ) std::cout << " ";
1839 
1840  std::cout << "\t";
1841 
1842 
1843  std::cout << "run " << track_ev->run_number()
1844  << "\tevent " << track_ev->event_number()
1845  << "\tlb " << track_ev->lumi_block()
1846  << "\tchains " << track_ev->chains().size()
1847  << "\ttime " << track_ev->time_stamp();
1848 
1849  std::cout << "\t : processed " << ifile << " files so far (" << int((1e3*ifile)/pfiles)*0.1 << "%)\t" << time_str() << std::endl;
1850 
1851  newfile = false;
1852  }
1853 
1854  // if ( printflag ) std::cout << *track_ev << std::endl;
1855 
1856  r = track_ev->run_number();
1857 
1859 
1860  offTracks.clear();
1861  refTracks.clear();
1862  truthTracks.clear();
1863  refPurityTracks.clear();
1864 
1866  for ( TIDA::ReferenceMap::iterator mit=ref.begin() ; mit!=ref.end() ; ++mit ) {
1867  mit->second.selector()->clear();
1868  dynamic_cast<Filter_Combined*>(mit->second.filter())->setRoi(0);
1869  }
1870 
1871  Nvtxtracks = 0;
1872 
1873  const std::vector<TIDA::Chain>& chains = track_ev->chains();
1874 
1875  dynamic_cast<Filter_Combined*>(truthFilter)->setRoi(0);
1877  if ( truthMatch ) {
1878  for (unsigned int ic=0 ; ic<chains.size() ; ic++ ) {
1879  if ( chains[ic].name()=="Truth" ) {
1880  truthTracks.selectTracks( chains[ic][0].tracks() );
1881  break;
1882  }
1883  }
1884  }
1885 
1887  for (const std::string& rc : refChains){
1888  for (unsigned int ic=0 ; ic<chains.size() ; ic++ ) {
1889  if ( chains[ic].name()==rc ) {
1890  offTracks.selectTracks( chains[ic][0].tracks() );
1891  //extract beamline position values from rois
1892  beamline_ref = chains[ic][0].user();
1893  // std::cout << "beamline: " << chains[ic].name() << " " << beamline_ref << std::endl;
1894  break;
1895  }
1896  }
1897  }
1898 
1900 
1901  std::vector<TIDA::Vertex> vertices; // keep for now as will be needed later ...
1902 
1903  const TIDA::Chain* vtxchain = track_ev->chain(vertex_refname);
1904 
1905  if ( vtxchain && vtxchain->size()>0 ) {
1906 
1907  const std::vector<TIDA::Vertex>& mv = vtxchain->at(0).vertices();
1908 
1909  int selectvtx = -1;
1910  double selection = 0;
1911 
1912  if ( debugPrintout ) std::cout << "vertices:\n" << mv << std::endl;
1913 
1914  if ( bestPTVtx || bestPT2Vtx ) {
1915  for ( size_t iv=0 ; iv<mv.size() ; iv++ ) {
1916  if ( mv[iv].Ntracks()==0 ) continue;
1917  double selection_ = 0.0;
1918  TIDA::Vertex vtx_temp( mv[iv] );
1919  vtx_temp.selectTracks( offTracks.tracks() );
1920  for (unsigned itr=0; itr<vtx_temp.tracks().size(); itr++) {
1921  TIDA::Track* tr = vtx_temp.tracks().at(itr);
1922  if ( bestPTVtx ) selection_ += std::fabs(tr->pT());
1923  else if ( bestPT2Vtx ) selection_ += std::fabs(tr->pT())*std::fabs(tr->pT());
1924  }
1925  if( selection_>selection ) {
1926  selection = selection_;
1927  selectvtx = iv;
1928  }
1929  }
1930  if ( selectvtx!=-1 ) {
1931  vertices.push_back( mv[selectvtx] );
1932  }
1933  }
1934  else if ( vtxind>=0 ) {
1935  if ( size_t(vtxind)<mv.size() ) {
1936  vertices.push_back( mv[vtxind] );
1937  }
1938  }
1939  else {
1940  for ( size_t iv=0 ; iv<mv.size() ; iv++ ) {
1941  vertices.push_back( mv[iv] );
1942  }
1943  }
1944 
1946  filter_vertex.setVertex( vertices );
1947 
1949 
1950  NvtxCount = 0;
1951 
1952  for ( unsigned iv=0 ; iv<mv.size() ; iv++ ) {
1953  int Ntracks = mv[iv].Ntracks();
1954  if ( Ntracks>NVtxTrackCut ) {
1955  Nvtxtracks += Ntracks;
1956  // vertices.push_back( mv[iv] );
1957  NvtxCount++;
1958  }
1959  }
1960  }
1961 
1962  // filter_vertex.setVertex( vvtx ) ;
1963 
1964  hcorr->Fill( vertices.size(), Nvtxtracks );
1965 
1966  dynamic_cast<Filter_Combined*>(refFilter)->setRoi(0);
1967 
1971  bool foundReference = false;
1972 
1973  const TIDA::Chain* refchain = 0;
1974 
1977 
1978  TrigObjectMatcher tom;
1979 
1980  for ( const std::string& rc : refChains ) {
1981  foundReference |= GetRefTracks( rc, exclude, chains, refTracks, ex_matcher, tom );
1982  }
1983 
1985  // bool skip_tnp = false;
1986 
1987  for ( TIDA::ReferenceMap::iterator mitr=ref.begin() ; mitr!=ref.end() ; ++mitr ) {
1988 
1989  std::string refname = mitr->first;
1990 
1991  NtupleTrackSelector& selector = *dynamic_cast<NtupleTrackSelector*>( mitr->second.selector() );
1992 
1994  TrigObjectMatcher rtom;
1995 
1996  foundReference |= GetRefTracks( refname, exclude, chains, selector, ex_matcher, rtom );
1997 
1998  *mitr->second.tom() = rtom;
1999 
2003  // if ( refname.find("Tau")!=std::string::npos || refname.find("Electron")!=std::string::npos ) {
2004  // if ( rtom.status()==0 ) skip_tnp = true; /// maybe don't use this at the moment
2005  // }
2006 
2007  }
2008 
2009 
2010 
2011 
2012  if ( !foundReference ) continue;
2013 
2014  if ( debugPrintout ) {
2015  std::cout << "reference chain:\n" << *refchain << std::endl;
2016  }
2017 
2018  for ( unsigned ic=0 ; ic<track_ev->chains().size() ; ic++ ) {
2019 
2020  TIDA::Chain& chain = track_ev->chains()[ic];
2021 
2022  // std::cout << ic << " chain " << chain.name() << " size " << chain.size() << std::endl;
2023 
2025  std::map<std::string,TrackAnalysis*>::iterator analitr = analysis.find(chain.name());
2026 
2028 
2029  if ( analitr==analysis.end() ) continue;
2030 
2031  if ( debugPrintout ) {
2032  std::cout << "test chain:\n" << chain << std::endl;
2033  }
2034 
2035  ConfAnalysis* cf = dynamic_cast<ConfAnalysis*>(analitr->second);
2036 
2037  std::vector<TIDA::Roi*> rois;
2038 
2039  // tag and probe object retreival and filling of the roi vector
2040  TagNProbe* TnP_tool = cf->getTnPtool();
2041 
2042  if ( TnP_tool ) {
2043 
2044  foutdir->cd();
2045  cf->initialiseInternal();
2046  // changes to output directory and books the invariant mass histograms
2047  TH1F* invmass = cf->getHist_invmass();
2048  TH1F* invmass_obj = cf->getHist_invmassObj();
2049 
2051 
2052  TrackSelector* selector0 = mit0->second.selector();
2053  TrackFilter* filter0 = mit0->second.filter();
2054 
2055  TrigObjectMatcher* rtom = mit0->second.tom();
2056 
2057  if ( TnP_tool->type0() == TnP_tool->type1() ) {
2059  rois = TnP_tool->GetRois( track_ev->chains(), selector0, filter0, invmass, invmass_obj, rtom );
2060  }
2061  else {
2063 
2066 
2067  TrackSelector* selector1 = mit1->second.selector();
2068  TrackFilter* filter1 = mit1->second.filter();
2069 
2070  TrigObjectMatcher* rtom1 = mit1->second.tom();
2071 
2072 #if 0
2073  for ( size_t ia=0 ; ia<selector1->tracks().size() ; ia++ ) {
2074  const TIDA::Track* track = selector1->tracks()[ia];
2075  std::cout << ia << "\t" << *track << std::endl;
2076  std::cout << "\t" << rtom1->object(track->id()) << std::endl;
2077  }
2078 
2079  std::cout << *TnP_tool << std::endl;
2080 #endif
2081 
2082  rois = TnP_tool->GetRois( track_ev->chains(), selector0, filter0, selector1, filter1, invmass, invmass_obj, rtom, rtom1 );
2083  }
2084  }
2085  else {
2086  // if not a tnp analysis then fill rois in the normal way
2087  rois.reserve( chain.size() );
2088  for ( size_t ir=0 ; ir<chain.size() ; ir++ ) rois.push_back( &(chain.rois()[ir]) );
2089  }
2090 
2092  if ( false ) std::cout << "++++++++++++ rois size = " << rois.size() << " +++++++++++" << std::endl;
2093 
2094  //for (unsigned int ir=0 ; ir<chain.size() ; ir++ ) {
2095  for (unsigned int ir=0 ; ir<rois.size() ; ir++ ) { // changed for tagNprobe
2096 
2098 
2099  //TIDA::Roi& troi = chain.rois()[ir];
2100  TIDA::Roi& troi = *rois[ir]; // changed for tagNprobe
2101  TIDARoiDescriptor roi( troi.roi() );
2102 
2103  testTracks.clear();
2104 
2105  testTracks.selectTracks( troi.tracks() );
2106 
2108  std::vector<TIDA::Track*> testp = testTracks.tracks();
2109 
2112 
2113  if ( filterRoi && !roiFilter.filter( roi ) ) continue;
2114 
2116  const std::vector<TIDA::Vertex>& mvt = troi.vertices();
2117 
2118  std::vector<TIDA::Vertex> vertices_test;
2119 
2120  int selectvtx = -1;
2121  double selection = 0;
2122 
2123  if ( bestPTVtx_rec || bestPT2Vtx_rec ) {
2124 
2125  // const std::vector<TIDA::Track>& recTracks = troi.tracks();
2126 
2127  for ( unsigned iv=0 ; iv<mvt.size() ; iv++ ) {
2128  double selection_ = 0.0;
2129  TIDA::Vertex vtx_temp( mvt[iv] );
2130  vtx_temp.selectTracks( testp );
2131  for (unsigned itr=0; itr<vtx_temp.tracks().size(); itr++) {
2132  TIDA::Track* tr = vtx_temp.tracks().at(itr);
2133  if ( bestPTVtx ) selection_ += std::fabs(tr->pT());
2134  else if ( bestPT2Vtx ) selection_ += std::fabs(tr->pT())*std::fabs(tr->pT());
2135  }
2136  if( selection_>selection){
2137  selection = selection_;
2138  selectvtx = iv;
2139  }
2140  }
2141  if ( selectvtx!=-1 ) {
2142  TIDA::Vertex selected( mvt[selectvtx] );
2143  if ( useVertexTracks ) selected.selectTracks( testp );
2144  vertices_test.push_back(selected);
2145  }
2146  }
2147  else if ( vtxind_rec!=-1 ) {
2148  if ( unsigned(vtxind_rec)<mvt.size() ) {
2149  TIDA::Vertex selected( mvt[vtxind] );
2150  if ( useVertexTracks ) selected.selectTracks( testp );
2151  vertices_test.push_back( selected );
2152  }
2153  }
2154  else {
2155  for ( unsigned iv=0 ; iv<mvt.size() ; iv++ ) {
2156  TIDA::Vertex selected( mvt[iv] );
2157  if ( useVertexTracks ) selected.selectTracks( testp );
2158  vertices_test.push_back( selected );
2159  }
2160  }
2161 
2162  //extract beamline position values from rois
2163  beamline_test = rois[ir]->user(); // changed for tagNprobe
2164 
2165  //set values of track analysis to these so can access elsewhere
2166  for ( size_t i=analyses.size() ; i-- ; ) {
2167 
2168  TrackAnalysis* analy_track = analyses[i];
2169 
2170  if ( correctBeamlineTest ) {
2171  if ( beamTest.size()==2 ) analy_track->setBeamTest( beamTest[0], beamTest[1] );
2172  // else if ( beamTest.size()==3 ) analy_track->setBeamTest( beamTest[0], beamTest[1], beamTest[2] );
2173  else {
2174  if ( !inputdata.isTagDefined("BeamTest") ) {
2175  if ( beamline_test.size()==2 ) analy_track->setBeamTest( beamline_test[0], beamline_test[1] );
2176  // else if ( beamline_test.size()==3 ) analy_track->setBeamTest( beamline_test[0], beamline_test[1], beamline_test[2] );
2177  }
2178  }
2179  }
2180 
2181  if ( correctBeamlineRef ) {
2182  if ( beamRef.size()==2 ) analy_track->setBeamRef( beamRef[0], beamRef[1] );
2183  // else if ( beamRef.size()==3 ) analy_track->setBeamRef( beamRef[0], beamRef[1], beamRef[2] );
2184  else {
2185  if ( !inputdata.isTagDefined("BeamRef") ) {
2186  if ( beamline_ref.size()==2 ) analy_track->setBeamRef( beamline_ref[0], beamline_ref[1] );
2187  // else if ( beamline_ref.size()==3 ) analy_track->setBeamRef( beamline_ref[0], beamline_ref[1], beamline_ref[2] );
2188  }
2189  }
2190  }
2191 
2192  }
2193 
2196 
2197  TIDARoiDescriptor refRoi;
2198 
2199  if ( select_roi ) {
2200 
2204 
2205  bool customRefRoi_thisChain = false;
2206 
2207  if ( use_custom_ref_roi ) { // Ideally just want to say ( use_custom_ref_roi && (chain.name() in custRefRoi_chain]sist) )
2208  if ( customRoi_chains.size() ) {
2209  if ( customRoi_chains.find( chain.name() )!=customRoi_chains.end() ) customRefRoi_thisChain = true;
2210  }
2211  else customRefRoi_thisChain = true; // Apply custom ref roi to all chains
2212  }
2213 
2214  if ( use_custom_ref_roi && customRefRoi_thisChain ) {
2215  refRoi = makeCustomRefRoi( roi, custRefRoi_params[0], custRefRoi_params[1], custRefRoi_params[2] );
2216  }
2217  else refRoi = roi;
2218 
2219  dynamic_cast<Filter_Combined*>(refFilter)->setRoi(&refRoi);
2220  }
2221 
2222  // if ( debugPrintout ) {
2223  // std::cout << "refTracks.size() " << refTracks.size() << " before roi filtering" << std::endl;
2224  // std::cout << "filter with roi " << roi << std::endl;
2225  // }
2226 
2227 
2228  // Now filterng ref tracks by refFilter, and performing any further filtering and selecting,
2229  // before finally creating the const reference object refp
2230 
2231  std::vector<TIDA::Track*> refp_vec = refTracks.tracks( refFilter );
2232 
2233  // Selecting only truth matched reference tracks
2234  if ( truthMatch ) {
2236  if ( select_roi ) dynamic_cast<Filter_Combined*>(truthFilter)->setRoi(&roi);
2237  const std::vector<TIDA::Track*>& truth = truthTracks.tracks(truthFilter);
2238  const std::vector<TIDA::Track*>& refp_tmp = refp_vec;
2239 
2241  truth_matcher->match( refp_tmp, truth );
2242 
2243  std::vector<TIDA::Track*> refp_matched;
2244 
2246  for ( unsigned i=0 ; i<refp_vec.size() ; i++ ) {
2247  if ( truth_matcher->matched( refp_vec[i] ) ) refp_matched.push_back( refp_vec[i] );
2248  }
2249 
2250  refp_vec.clear();
2251  refp_vec = refp_matched;
2252  }
2253 
2254  // Choose the pT ordered refp tracks that have been asked for by the user
2255  if ( use_pt_ordered_ref ) {
2256  std::sort( refp_vec.begin(), refp_vec.end(), trackPtGrtr ); // Should this sorting be done to a temporary copied object, instead of the object itself?
2257 
2258  size_t nRefTracks = refp_vec.size();
2259 
2260  std::vector<TIDA::Track*> refp_chosenPtOrd;
2261 
2262  if ( debugPrintout ) {
2263  // Checking if any user specifed track indices are out of bounds for this event
2264  for ( size_t sidx=refPtOrd_indices.size() ; sidx-- ; ) {
2265  if ( refPtOrd_indices.at(sidx)>nRefTracks ) {
2266  std::cout << "WARNING: for event " << event
2267  << ", pT ordered reference track at vector position " << refPtOrd_indices.at(sidx)
2268  << " requested but not found" << std::endl;
2269  break;
2270  }
2271  }
2272  }
2273 
2274  for ( size_t sidx=refPtOrd_indices.size() ; sidx-- ; ) {
2275  for ( size_t idx=0 ; idx<refp_vec.size() ; idx++ ) {
2276  if ( idx == refPtOrd_indices.at(sidx) ) {
2277  refp_chosenPtOrd.push_back(refp_vec.at(idx));
2278  break;
2279  }
2280  }
2281  }
2282 
2283  refp_vec.clear();
2284  refp_vec = refp_chosenPtOrd; // Note: not necessarily pT ordered.
2285  // Ordered by order of indices the user has passed
2286  // (which is ideally pT ordered e.g. 0, 1, 3)
2287  }
2288 
2290  if ( cf ) {
2291 
2293 
2294  std::string ptconfig = cf->config().postvalue("pt");
2295  if ( ptconfig!="" ) {
2296  double pt = std::atof( ptconfig.c_str() );
2297  if ( pt>0 ) {
2298  std::vector<TIDA::Track*> reft; reft.reserve(refp_vec.size());
2299  for ( std::vector<TIDA::Track*>::const_iterator itr=refp_vec.begin() ; itr!=refp_vec.end() ; ++itr ) {
2300  if ( std::fabs((*itr)->pT())>=pt ) reft.push_back( *itr );
2301  }
2302  refp_vec = reft;
2303  }
2304  }
2305 
2307 
2308  std::string d0config = cf->config().postvalue("d0");
2309  if ( d0config!="" ) {
2310  double d0 = std::atof( d0config.c_str() );
2311  if ( d0>0 ) {
2312  std::vector<TIDA::Track*> reft; reft.reserve(refp_vec.size());
2313  for ( std::vector<TIDA::Track*>::const_iterator itr=refp_vec.begin() ; itr!=refp_vec.end() ; ++itr ) {
2314  if ( std::fabs((*itr)->a0())<=d0 ) reft.push_back( *itr );
2315  }
2316  refp_vec = reft;
2317  }
2318  }
2319 
2320  }
2321 
2324 
2326 
2327  if ( tom.status() ) {
2328 
2329  std::string objectET = cf->config().postvalue("ET");
2330 
2331  if ( objectET != "" ) {
2332 
2333  double ETconfig = std::atof( objectET.c_str() );
2334 
2335  if ( ETconfig>0 ) {
2336 
2337  std::vector<TIDA::Track*>::iterator itr=refp_vec.begin() ;
2338 
2339  while ( itr!=refp_vec.end() ) {
2340  const TrackTrigObject* tobj = tom.object( (*itr)->id() );
2341 
2342  if ( tobj==0 || tobj->pt()<ETconfig )
2343  itr=refp_vec.erase( itr );
2344  else
2345  ++itr;
2346  }
2347  }
2348  }
2349  }
2350 
2351  const std::vector<TIDA::Track*>& refp = refp_vec;
2352 
2353  // if ( debugPrintout ) {
2354  // std::cout << "refp.size() " << refp.size() << " after roi filtering" << std::endl;
2355  // }
2356 
2357 
2358  // std::cout << "ref tracks refp.size() " << refp.size() << "\n" << refp << std::endl;
2359  // std::cout << "test tracks testp.size() " << testp.size() << "\n" << testp << std::endl;
2360 
2361  groi = &roi;
2362 
2366 
2367  // new vertex class containing tracks, offline
2368  std::vector<TIDA::Vertex> vertices_roi;
2369 
2371  // if ( chain.name().find("SuperRoi") ) {
2372  {
2373 
2375 
2376  vertices_roi.clear();
2377 
2378  const std::vector<TIDA::Vertex>& mv = vertices;
2379 
2380  // std::cout << "vertex filtering " << mv.size() << std::endl;
2381 
2382 
2383  for ( unsigned iv=0 ; iv<mv.size() ; iv++ ) {
2384 
2385  const TIDA::Vertex& vx = mv[iv];
2386 
2387  // reject all vertices that are not in the roi
2388 
2389  bool accept_vertex = false;
2390  if ( roi.composite() ) {
2391  for ( size_t ir=0 ; ir<roi.size() ; ir++ ) {
2392  if ( roi[ir]->zedMinus()<=vx.z() && roi[ir]->zedPlus()>=vx.z() ) accept_vertex = true;
2393  }
2394  }
2395  else {
2396  if ( roi.zedMinus()<=vx.z() && roi.zedPlus()>=vx.z() ) accept_vertex = true;
2397  }
2398 
2399  if ( !accept_vertex ) continue;
2400 
2401  // std::cout << "\t" << iv << "\t" << vx << std::endl;
2402 
2403  int trackcount = 0;
2404 
2405  if ( useVertexTracks ) {
2406  // refp contains roi filtered tracks, vx contains ids of tracks belonging to vertex
2407  TIDA::Vertex vertex_roi( vx );
2408  vertex_roi.selectTracks( refp );
2409  trackcount = vertex_roi.Ntracks();
2410  if ( trackcount>=ntracks && trackcount>0 ) {
2411  vertices_roi.push_back( vertex_roi );
2412  }
2413  }
2414  else {
2415  // old track count method still in use?
2416  for (unsigned itr=0; itr<refp.size(); itr++){
2417  TIDA::Track* tr = refp[itr];
2418  double theta_ = 2*std::atan(std::exp(-tr->eta()));
2419  double dzsintheta = std::fabs( (vx.z()-tr->z0()) * std::sin(theta_) );
2420  if( dzsintheta < 1.5 ) trackcount++;
2421  }
2425  if ( trackcount>=ntracks && trackcount>0 ) {
2426  const TIDA::Vertex& vertex_roi( vx );
2427  vertices_roi.push_back( vertex_roi );
2428  }
2429  }
2430 
2431  }
2432  }
2433  // else vertices_roi = vertices;
2434 
2435  if ( rotate_testtracks ) for ( size_t i=testp.size() ; i-- ; ) testp[i]->rotate();
2436 
2437  foutdir->cd();
2438 
2439  // do analysing
2440 
2441  if ( monitorZBeam ) {
2442  if ( beamline_ref.size()>2 && beamline_test.size()>2 ) {
2443  refz.push_back( zpair( lb, beamline_ref[2]) );
2444  testz.push_back( zpair( lb, beamline_test[2]) );
2445  }
2446  }
2447 
2448  matcher->match( refp, testp);
2449 
2450  if ( tom.status() ) analitr->second->execute( refp, testp, matcher, &tom );
2451  else analitr->second->execute( refp, testp, matcher );
2452 
2453  ConfVtxAnalysis* vtxanal = 0;
2454  analitr->second->store().find( vtxanal, "rvtx" );
2455 
2458  if ( vtxanal && ( refp.size() >= size_t(ntracks) ) ) {
2459 
2467 
2469 
2470  if ( vertices_roi.size()>0 ) vtxanal->execute( pointers(vertices_roi), pointers(vertices_test), track_ev );
2471 
2472  }
2473 
2474 
2475  if ( debugPrintout ) {
2476  // std::cout << "-----------------------------------\n\nselected tracks:" << chain.name() << std::endl;
2477  std::cout << "\nselected tracks:" << chain.name() << std::endl;
2478  std::cout << "ref tracks refp.size() " << refp.size() << "\n" << refp << std::endl;
2479  std::cout << "test tracks testp.size() " << testp.size() << "\n" << testp << std::endl;
2480 
2481  TrackAssociator::map_type::const_iterator titr = matcher->TrackAssociator::matched().begin();
2482  TrackAssociator::map_type::const_iterator tend = matcher->TrackAssociator::matched().end();
2483  int im=0;
2484  std::cout << "track matches:\n";
2485  while (titr!=tend) {
2486  std::cout << "\t" << im++ << "\t" << *titr->first << " ->\n\t\t" << *titr->second << std::endl;
2487  ++titr;
2488  }
2489 
2490 
2491  std::cout << "completed : " << chain.name() << "\n";
2492  std::cout << "-----------------------------------" << std::endl;
2493 
2494  }
2495 
2496 #if 0
2497  if ( _matcher->size()<refp.size() ) {
2498 
2499  if ( refp.size()==1 && testp.size()==0 ) {
2500  std::cout << track_ev->chains()[ic] <<std::endl;
2501  std::cout << "roi\n" << track_ev->chains()[ic].rois()[ir] << endl;
2502  }
2503 
2504  }
2505 #endif
2506 
2508 
2509  if ( doPurity ) {
2510 
2511  const std::vector<TIDA::Track*>& refpp = refPurityTracks.tracks( refFilter );
2512 
2513  testPurityTracks.clear();
2514 
2515  testPurityTracks.selectTracks( troi.tracks() );
2516  std::vector<TIDA::Track*> testpp = testPurityTracks.tracks();
2517 
2518  matcher->match(refpp, testpp);
2519 
2520 
2521  std::map<std::string,TrackAnalysis*>::iterator analitrp = analysis.find(chain.name()+"-purity");
2522 
2523  if ( analitrp == analysis.end() ) continue;
2524 
2525 
2526  analitrp->second->execute( refpp, testpp, matcher );
2527 
2528 
2529 
2530  }
2531 
2532  } // loop through rois
2533 
2534  } // loop through chanines - this block is indented incorrectly
2535 
2536  } // loop through nentries
2537 
2538  delete track_ev;
2539  delete data;
2540  delete finput;
2541 
2542  // std::cout << "run: " << run << std::endl;
2543 
2544  }// loop through files
2545 
2546  std::cout << "done " << time_str() << "\tprocessed " << event_counter << " events"
2547  << "\ttimes " << mintime << " " << maxtime
2548  << "\t( grl: " << grl_counter << " / " << pregrl_events << " )" << std::endl;
2549 
2550  if ( monitorZBeam ) zbeam zb( refz, testz );
2551 
2552  foutdir->cd();
2553 
2554  // hcorr->Finalise(Resplot::FitPoisson);
2555 
2556  hcorr->Finalise(Resplot::FitNull95);
2557  hcorr->Write();
2558 
2559  for ( int i=analyses.size() ; i-- ; ) {
2560  // std::cout << "finalise analysis chain " << analyses[i]->name() << std::endl;
2561  analyses[i]->finalise();
2562 
2563  ConfVtxAnalysis* vtxanal = 0;
2564  analyses[i]->store().find( vtxanal, "rvtx" );
2565  if ( vtxanal ) vtxanal->finalise();
2566 
2567  delete analyses[i];
2568  }
2569 
2570  foutput.Write();
2571  foutput.Close();
2572 
2573 
2574  // for ( std::map<std::string,TIDA::Reference>::iterator mit=ref.begin() ; mit!=ref.end() ; ++mit++ ) {
2575  for ( TIDA::ReferenceMap::iterator mit=ref.begin() ; mit!=ref.end() ; ++mit++ ) {
2576  mit->second.Clean();
2577  }
2578 
2579 
2580  if ( ex_matcher ) delete ex_matcher;
2581 
2582  std::cout << "done" << std::endl;
2583 
2584  return 0;
2585 }

◆ makeCustomRefRoi()

TIDARoiDescriptor makeCustomRefRoi ( const TIDARoiDescriptor roi,
double  etaHalfWidth = -999,
double  phiHalfWidth = -999,
double  zedHalfWidth = -999 
)

Definition at line 165 of file rmain.cxx.

168  {
169 
170  double roi_eta = roi.eta();
171  double roi_phi = roi.phi();
172  double roi_zed = roi.zed();
173 
174  double etaMinus = roi.etaMinus();
175  double etaPlus = roi.etaPlus();
176 
177  double zedMinus = roi.zedMinus();
178  double zedPlus = roi.zedPlus();
179 
180  double phiMinus = roi.phiMinus();
181  double phiPlus = roi.phiPlus();
182 
183  if ( etaHalfWidth != -999 ) {
184  etaMinus = roi_eta - etaHalfWidth;
185  etaPlus = roi_eta + etaHalfWidth;
186  }
187 
188  if ( phiHalfWidth != -999 ) {
189  phiMinus = roi_phi - phiHalfWidth; // !!! careful! will this always wrap correctly?
190  phiPlus = roi_phi + phiHalfWidth; // !!! careful! will this always wrap correctly?
191  }
192 
193  if ( zedHalfWidth != -999 ) {
194  zedMinus = roi_zed - zedHalfWidth;
195  zedPlus = roi_zed + zedHalfWidth;
196  }
197 
198  return TIDARoiDescriptor( roi_eta, etaMinus, etaPlus,
199  roi_phi, phiMinus, phiPlus, // do wrap phi here (done within TIDARoiDescriptor already)
200  roi_zed, zedMinus, zedPlus );
201 }

◆ operator<<() [1/2]

template<typename T >
std::ostream& operator<< ( std::ostream &  s,
const std::vector< T * > &  v 
)

Definition at line 209 of file rmain.cxx.

209  {
210  for ( size_t i=0 ; i<v.size() ; i++ ) s << "\t" << *v[i] << "\n";
211  return s;
212 }

◆ operator<<() [2/2]

template<typename T >
std::ostream& operator<< ( std::ostream &  s,
const std::vector< T > &  v 
)

Definition at line 216 of file rmain.cxx.

216  {
217  if ( v.size()<5 ) for ( unsigned i=0 ; i<v.size() ; i++ ) s << "\t" << v[i];
218  else for ( unsigned i=0 ; i<v.size() ; i++ ) s << "\n\t" << v[i];
219  return s;
220 }

◆ pointers()

template<typename T >
std::vector<T*> pointers ( std::vector< T > &  v)

this is slow - all this copying

Definition at line 367 of file rmain.cxx.

367  {
369  std::vector<T*> vp(v.size(),0);
370  for ( unsigned i=v.size() ; i-- ; ) vp[i] = &v[i];
371  return vp;
372 }

◆ replaceauthor()

const std::vector<TIDA::Track> replaceauthor ( const std::vector< TIDA::Track > &  tv,
int  a0 = 5,
int  a1 = 4 
)

Definition at line 273 of file rmain.cxx.

273  {
274 
275  if ( a0==a1 ) return tv;
276 
277  std::vector<TIDA::Track> tr;
278  tr.reserve(tv.size());
279 
280  for ( size_t i=0 ; i<tv.size() ; i++ ) {
281  const TIDA::Track& t = tv[i];
282  int a = t.author();
283  if ( a==a0 ) a=a1;
284  tr.push_back( TIDA::Track( t.eta(), t.phi(), t.z0(), t.a0(), t.pT(), t.chi2(), t.dof(),
285  t.deta(), t.dphi(), t.dz0(), t.da0(), t.dpT(),
286  t.bLayerHits(), t.pixelHits(), t.sctHits(), t.siHits(),
287  t.strawHits(), t.trHits(),
288  t.hitPattern(), t.multiPattern(), a, t.hasTruth(),
289  t.barcode(), t.match_barcode(), t.expectBL(), t.id() ) );
290 
291  }
292 
293  return tr;
294 
295 }

◆ SelectObjectET()

bool SelectObjectET ( const TrackTrigObject t)

Definition at line 377 of file rmain.cxx.

377 { return std::fabs(t.pt())>ETmin; }

◆ SelectObjectETovPT()

bool SelectObjectETovPT ( const TrackTrigObject tobj,
TIDA::Track t = 0 
)

Definition at line 388 of file rmain.cxx.

388  {
389  bool ETselection = std::fabs(tobj.pt())>=ETmin;
390  bool ETovPTselection = true;
391  if ( t ) ETovPTselection = std::fabs(tobj.pt()/t->pT())>=ETovPTmin;
392  return ETselection&ETovPTselection;
393 }

◆ time_str()

std::string time_str ( )

Definition at line 116 of file rmain.cxx.

116  {
117  time_t t;
118  time(&t);
119  std::string s(ctime(&t));
120  // std::string::size_type pos = s.find("\n");
121  // if ( pos != std::string::npos )
122  return s.substr(0,s.find('\n'));
123  // return s;
124 }

◆ trackPtGrtr()

bool trackPtGrtr ( TIDA::Track trackA,
TIDA::Track trackB 
)

Definition at line 205 of file rmain.cxx.

205 { return ( std::fabs(trackA->pT()) > std::fabs(trackB->pT()) ); }

◆ usage()

int usage ( const std::string &  name,
int  status 
)

Definition at line 332 of file rmain.cxx.

332  {
333  std::ostream& s = std::cout;
334 
335  s << "Usage: " << name << " <config filename> [OPTIONS]" << std::endl;
336  s << "\nOptions: \n";
337  s << " -o, -f, --file value\toutput filename, \n";
338  s << " -b, --binConfig value\tconfig file for histogram configuration, \n";
339  s << " -r, --refChain value\treference chain. + separated keys will be merged, \n";
340  s << " -t, --testChain value\ttest chain, \n";
341  s << " -p, --pdgId value\tpdg ID of truth particle if requiring truth particle processing,\n";
342  s << " --vt value\tuse value as the test vertex selector - overrides value in the config file,\n";
343  s << " --vr value\tuse value as the reference vertex selector - overrides value in the config file,\n";
344  s << " -n, --nofit \ttest do not fit resplots, \n";
345  s << " --rms \ttest force new rms95 errors, \n";
346  s << " -e, --entries value\ttest only run over value entries, \n";
347  // s << " -a, --all \tadd all grids (default)\n";
348  s << " -h, --help \tthis help\n";
349  // s << "\nSee " << PACKAGE_URL << " for more details\n";
350  s << "\nReport bugs to sutt@cern.ch";
351  s << std::endl;
352 
353  return status;
354 }

Variable Documentation

◆ bjetBinConfig

BinConfig bjetBinConfig

◆ cosmicBinConfig

BinConfig cosmicBinConfig

◆ debugPrintout

bool debugPrintout = false

Definition at line 95 of file rmain.cxx.

◆ electronBinConfig

BinConfig electronBinConfig

◆ ETmin

double ETmin = 0

Definition at line 375 of file rmain.cxx.

◆ ETovPTmin

double ETovPTmin = 0

this is a swiss knife function - by default if ET/PT > 0 such that fabs(ET/PT) > 0 is always true and we can always call this function - PT can never be 0 for a particle in the detector so can use this for both ET/PT selection and raw ET selection

Definition at line 386 of file rmain.cxx.

◆ g_binConfig

BinConfig g_binConfig

◆ muonBinConfig

BinConfig muonBinConfig

◆ PRINT_BRESIDUALS

bool PRINT_BRESIDUALS

stack trace headers

globals for communicating with *Analyses TagNProbe class

Definition at line 29 of file ConfAnalysis.cxx.

◆ tauBinConfig

BinConfig tauBinConfig
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
NtupleTrackSelector::selectTracks
void selectTracks(const std::vector< TIDA::Track > &tracks)
extract all the tracks from a vector of Tracks
Definition: NtupleTrackSelector.h:48
TIDA::Roi::roi
const TIDARoiDescriptor & roi() const
access the roi information
Definition: TIDARoi.h:42
Resplot::setnofit
static bool setnofit(bool b)
Definition: Resplot.h:555
TrackAnalysis::setBeamTest
void setBeamTest(double x, double y, double z=0)
Definition: TrackAnalysis.h:110
replace
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition: hcg.cxx:307
debugPrintout
bool debugPrintout
Definition: rmain.cxx:95
beamspotman.r
def r
Definition: beamspotman.py:676
TIDA::Associator
Definition: TIDAAssociator.h:24
bjetBinConfig
BinConfig bjetBinConfig
CalculateHighPtTerm.pT
pT
Definition: ICHEP2016/CalculateHighPtTerm.py:57
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
TIDA::Reference
Definition: TIDAReference.h:28
ReadCellNoiseFromCoolCompare.s1
s1
Definition: ReadCellNoiseFromCoolCompare.py:378
python.utility.LHE.event_counter
def event_counter(input_file_pattern)
Count total number of events in input files.
Definition: LHE.py:89
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
Filter_OfflineR22
Definition: Filter_OfflineR22.h:28
TIDARoiDescriptor::phi
double phi() const
Definition: TIDARoiDescriptor.h:133
SelectObjectETovPT
bool SelectObjectETovPT(const TrackTrigObject &tobj, TIDA::Track *t=0)
Definition: rmain.cxx:388
Associator_BestDeltaRZSinThetaMatcher
Definition: Associator_BestMatch.h:152
runLayerRecalibration.chain
chain
Definition: runLayerRecalibration.py:175
Resplot::Fill
int Fill(double x, double y, double w=1)
Definition: Resplot.h:279
Filter_Vertex
Definition: Filters.h:155
ConfAnalysis::initialiseInternal
virtual void initialiseInternal()
Definition: ConfAnalysis.cxx:66
LArConditions2Ntuple.objects
objects
Definition: LArConditions2Ntuple.py:63
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
IDTrig_MC23a_preInclude.zedHalfWidth
zedHalfWidth
Definition: IDTrig_MC23a_preInclude.py:10
ConfAnalysis::getHist_invmassObj
virtual TH1F * getHist_invmassObj()
Definition: ConfAnalysis.h:128
TIDARoiDescriptor::zedMinus
double zedMinus() const
Definition: TIDARoiDescriptor.h:143
RoiFilter
Definition: RoiFilter.h:21
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
TrackFilter
Definition: TrackFilter.h:26
hist_file_dump.d
d
Definition: hist_file_dump.py:137
TIDA::Event::chain
const TIDA::Chain * chain(const std::string &s) const
Definition: TIDAEvent.cxx:57
Filter_etaPT
Definition: Filter_etaPT.h:27
lumiParser
Definition: lumiParser.h:28
ChainString::postvalue
std::string postvalue(const std::string &key) const
same here regarding returning a reference
Definition: ChainString.h:54
theta
Scalar theta() const
theta method
Definition: AmgMatrixBasePlugin.h:75
JiveXML::Event
struct Event_t Event
Definition: ONCRPCServer.h:65
ETovPTmin
double ETovPTmin
this is a swiss knife function - by default if ET/PT > 0 such that fabs(ET/PT) > 0 is always true and...
Definition: rmain.cxx:386
TIDARoiDescriptor::etaPlus
double etaPlus() const
Definition: TIDARoiDescriptor.h:138
TIDARoiDescriptor::etaMinus
double etaMinus() const
Definition: TIDARoiDescriptor.h:137
skel.it
it
Definition: skel.GENtoEVGEN.py:401
PRINT_BRESIDUALS
bool PRINT_BRESIDUALS
stack trace headers
Definition: ConfAnalysis.cxx:29
test_pyathena.pt
pt
Definition: test_pyathena.py:11
TIDA::Chain::size
unsigned size() const
number of rois
Definition: TIDAChain.h:54
Resplot::setoldrms95
static bool setoldrms95(bool b)
Definition: Resplot.h:553
ConfAnalysis::config
const ChainString & config() const
Definition: ConfAnalysis.h:118
M_PI
#define M_PI
Definition: ActiveFraction.h:11
ConfVtxAnalysis
Definition: ConfVtxAnalysis.h:24
python.atlas_oh.im
im
Definition: atlas_oh.py:167
chop
std::string chop(std::string &s1, const std::string &s2)
Definition: hcg.cxx:158
TIDARoiDescriptor
Describes the Region of Ineterest geometry It has basically 8 parameters.
Definition: TIDARoiDescriptor.h:42
TIDA::Track::pT
double pT() const
Definition: Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/Track.h:50
TIDARoiDescriptor::zedPlus
double zedPlus() const
Definition: TIDARoiDescriptor.h:144
ConfAnalysis::initialise
virtual void initialise()
book all the histograms
Definition: ConfAnalysis.cxx:59
ChainString
Definition: ChainString.h:23
NvtxCount
int NvtxCount
Definition: globals.cxx:18
exclude
std::set< std::string > exclude
list of directories to be excluded
Definition: hcg.cxx:95
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
Associator_TruthMatcher
Definition: Associator_TruthMatch.h:44
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
TIDA::Event
Definition: TIDAEvent.h:33
TIDA::Track::z0
double z0() const
Definition: Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/Track.h:48
NtupleTrackSelector::clear
virtual void clear() override
the ntple selector manages the tracks itself, so we have to do an explicit delete for each one to pre...
Definition: NtupleTrackSelector.h:71
TIDA::Event::lumi_block
void lumi_block(unsigned lb)
Definition: TIDAEvent.h:44
TIDA::Associator::matched
virtual const S * matched(T *t)
Definition: TIDAAssociator.h:45
xAOD::unsigned
unsigned
Definition: RingSetConf_v1.cxx:662
ConfAnalysis::setprint
void setprint(bool p)
Definition: ConfAnalysis.h:112
TrackTrigObject::pt
double pt() const
Definition: TrackTrigObject.h:36
TrackSelector
Definition: Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/TrackSelector.h:24
drawFromPickle.atan
atan
Definition: drawFromPickle.py:36
TIDA::ReferenceMap::value_type
std::map< std::string, Reference >::value_type value_type
Definition: TIDAReference.h:74
TIDARoiDescriptor::phiPlus
double phiPlus() const
Definition: TIDARoiDescriptor.h:141
python.Bindings.values
values
Definition: Control/AthenaPython/python/Bindings.py:805
TIDA::Event::chains
const std::vector< TIDA::Chain > & chains() const
Definition: TIDAEvent.h:76
handler
void handler(int sig)
signal handler
Definition: rmain.cxx:99
covarianceTool.filter
filter
Definition: covarianceTool.py:514
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
beamspotman.inputdata
inputdata
Definition: beamspotman.py:1109
Cut::signal
@ signal
Definition: SUSYToolsAlg.cxx:67
TagNProbe
Definition: TagNProbe.h:28
python.TriggerHandler.tend
string tend
Definition: TriggerHandler.py:300
TIDA::ReferenceMap::iterator
std::map< std::string, Reference >::iterator iterator
Definition: TIDAReference.h:72
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
ev
int ev
Definition: globals.cxx:25
dumpflag
bool dumpflag
Definition: globals.cxx:30
TrigObjectMatcher
Definition: TrigObjectMatcher.h:22
TIDA::Event::time_stamp
void time_stamp(unsigned t)
Definition: TIDAEvent.h:45
ConfAnalysis
Definition: ConfAnalysis.h:48
python.BunchSpacingUtils.lb
lb
Definition: BunchSpacingUtils.py:88
CheckAppliedSFs.e3
e3
Definition: CheckAppliedSFs.py:264
TagNProbe::type0
const std::string & type0() const
Definition: TagNProbe.h:51
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
Associator_SecondBestpTMatcher
Definition: Associator_BestMatch.h:58
makeCustomRefRoi
TIDARoiDescriptor makeCustomRefRoi(const TIDARoiDescriptor &roi, double etaHalfWidth=-999, double phiHalfWidth=-999, double zedHalfWidth=-999)
Definition: rmain.cxx:165
ReadCards
Get tag-value pairs from a file.
Definition: ReadCards.h:50
ParseInputs.gDirectory
gDirectory
Definition: Final2012/ParseInputs.py:133
lumiFormat.i
int i
Definition: lumiFormat.py:85
z
#define z
Associator_BestSigmaMatcher
Definition: Associator_BestMatch.h:197
LArCellNtuple.argv
argv
Definition: LArCellNtuple.py:152
TIDA::Roi::tracks
const std::vector< TIDA::Track > & tracks() const
Definition: TIDARoi.h:52
event_selector
Definition: event_selector.h:20
TIDA::Event::event_number
void event_number(unsigned long long e)
Definition: TIDAEvent.h:43
gevent
TIDA::Event * gevent
Definition: globals.cxx:13
TagNProbe::tag
void tag(const std::string &chainName)
getters and setters
Definition: TagNProbe.h:45
Resplot::FitNull95
static TF1 * FitNull95(TH1D *s, double a=0, double b=0)
Definition: Resplot.cxx:1673
python.LArMinBiasAlgConfig.int
int
Definition: LArMinBiasAlgConfig.py:59
TIDA::Chain::at
TIDA::Roi & at(int i)
Definition: TIDAChain.h:63
contains
bool contains(const std::string &s, const std::string &regx)
does a string contain the substring
Definition: hcg.cxx:111
TrackAnalysis
Definition: TrackAnalysis.h:32
TrigObjectMatcher::status
bool status() const
Definition: TrigObjectMatcher.h:65
TRT::Track::d0
@ d0
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:62
python.BuildSignatureFlags.sig
sig
Definition: BuildSignatureFlags.py:219
ETmin
double ETmin
Definition: rmain.cxx:375
Associator_BestDeltaRMatcher
Definition: Associator_BestMatch.h:80
ConfAnalysis::getTnPtool
virtual TagNProbe * getTnPtool()
Definition: ConfAnalysis.h:124
TIDA::Roi::vertices
const std::vector< TIDA::Vertex > & vertices() const
access the vertices
Definition: TIDARoi.h:56
run
Definition: run.py:1
dataset
Definition: dataset.h:27
Filter_Offline2017
Definition: Filter_Offline2017.h:28
Resplot
Definition: Resplot.h:50
PurityAnalysis::initialise
virtual void initialise()
book all the histograms
Definition: PurityAnalysis.cxx:34
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
DQHistogramMergeRegExp.argc
argc
Definition: DQHistogramMergeRegExp.py:20
BinConfig::set
void set(ReadCards &r, const std::string &n)
Definition: BinConfig.h:50
ConfVtxAnalysis::finalise
void finalise()
Definition: ConfVtxAnalysis.cxx:353
GetRefTracks
bool GetRefTracks(const std::string &rc, const std::string &exclude, const std::vector< TIDA::Chain > &chains, NtupleTrackSelector &refTracks, TrackAssociator *ex_matcher, TrigObjectMatcher &tom)
Definition: rmain.cxx:429
TrackAnalysis::setBeamRef
void setBeamRef(double x, double y, double z=0)
set the beamline positions
Definition: TrackAnalysis.h:109
a0
double a0
Definition: globals.cxx:27
RivetAnalysis_JO.analyses
string analyses
Definition: RivetAnalysis_JO.py:30
TIDA::FeatureStore::insert
void insert(T *t, const std::string &key)
Definition: TIDAFeatureStore.h:44
calibdata.exit
exit
Definition: calibdata.py:236
ChainString::extra
const std::string & extra() const
Definition: ChainString.h:38
atoi_check
int atoi_check(const std::string &s)
convert string to integer with check if successful
Definition: rmain.cxx:129
muonBinConfig
BinConfig muonBinConfig
TIDA::Vertex
Definition: TIDAVertex.h:23
CxxUtils::atof
double atof(std::string_view str)
Converts a string into a double / float.
Definition: Control/CxxUtils/Root/StringUtils.cxx:91
ConfAnalysis::getHist_invmass
virtual TH1F * getHist_invmass()
Definition: ConfAnalysis.h:126
TagNProbe::type1
const std::string & type1() const
Definition: TagNProbe.h:52
grepfile.ic
int ic
Definition: grepfile.py:33
lumiFormat.array
array
Definition: lumiFormat.py:91
Resplot::Write
Int_t Write(const char *=0, Int_t=0, Int_t=0) const
Hooray, this stupidity is to overwride both the const and non-const TObject Write methods Fixme: shou...
Definition: Resplot.h:452
ConfVtxAnalysis::execute
void execute(const std::vector< TIDA::Vertex * > &vtx0, const std::vector< TIDA::Vertex * > &vtx1, const TIDA::Event *tevt=0)
Definition: ConfVtxAnalysis.cxx:181
selection
const std::string selection
Definition: fbtTestBasics.cxx:74
ReadCellNoiseFromCoolCompare.s3
s3
Definition: ReadCellNoiseFromCoolCompare.py:380
TrackSelector::tracks
const std::vector< TIDA::Track * > & tracks() const
Definition: Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/TrackSelector.h:53
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
python.subdetectors.mmg.ids
ids
Definition: mmg.py:8
PurityAnalysis::setprint
void setprint(bool p)
Definition: PurityAnalysis.h:73
TIDA::Track::eta
double eta() const
Definition: Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/Track.h:46
event_list
Definition: rmain.cxx:299
Associator_BestDeltaRZMatcher
Definition: Associator_BestMatch.h:109
Filter_Combined
Definition: Filters.h:225
TIDA::Chain
Definition: TIDAChain.h:28
TIDA::Roi
Definition: TIDARoi.h:31
trackPtGrtr
bool trackPtGrtr(TIDA::Track *trackA, TIDA::Track *trackB)
Definition: rmain.cxx:205
time_str
std::string time_str()
Definition: rmain.cxx:116
TIDARoiDescriptor::eta
double eta() const
Definition: TIDARoiDescriptor.h:134
Resplot::Finalise
int Finalise(double a=-999, double b=-999, TF1 *(*func)(TH1D *s, double a, double b)=Resplot::FitGaussian)
Definition: Resplot.cxx:388
example.goodrunslist
goodrunslist
Definition: example.py:26
LArNewCalib_Delay_OFC_Cali.check
check
Definition: LArNewCalib_Delay_OFC_Cali.py:267
PowhegPythia8EvtGen_H2a4X_ctauY.newfile
string newfile
Definition: PowhegPythia8EvtGen_H2a4X_ctauY.py:13
NMod
int NMod
Definition: globals.cxx:20
grepfile.filenames
list filenames
Definition: grepfile.py:34
TIDA::Vertex::z
double z() const
Definition: TIDAVertex.h:53
python.copyTCTOutput.chains
chains
Definition: copyTCTOutput.py:81
ir
int ir
counter of the current depth
Definition: fastadd.cxx:49
python.PyAthena.v
v
Definition: PyAthena.py:154
ConfAnalysis::initialiseFirstEvent
void initialiseFirstEvent(bool b=true)
Definition: ConfAnalysis.h:116
ChainString::head
const std::string & head() const
Definition: ChainString.h:33
TagNProbe::GetRois
std::vector< TIDA::Roi * > GetRois(std::vector< TIDA::Chain > &chains, const TrackSelector *selector, TrackFilter *filter, T *hmass, T *hmass_obj, TrigObjectMatcher *tom=0) const
Definition: TagNProbe.h:60
TrackTrigObject
Definition: TrackTrigObject.h:21
a
TList * a
Definition: liststreamerinfos.cxx:10
python.selector.AtlRunQuerySelectorLhcOlc.selector
selector
Definition: AtlRunQuerySelectorLhcOlc.py:611
h
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
std::sort
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
Definition: DVL_algorithms.h:623
ref
const boost::regex ref(r_ef)
Filter_pdgId
Definition: Filters.h:53
Filter_Track
sadly need to include a root dependency, but no matter - the TIDA::Track class itself inherets from T...
Definition: Filter_Track.h:41
groi
TIDARoiDescriptor * groi
all these externals initialised in globals.cxx
Definition: globals.cxx:14
DeMoScan.first
bool first
Definition: DeMoScan.py:536
ReadCellNoiseFromCoolCompare.s2
s2
Definition: ReadCellNoiseFromCoolCompare.py:379
python.TriggerAPI.TriggerAPISession.chainName
chainName
Definition: TriggerAPISession.py:426
pointers
std::vector< T * > pointers(std::vector< T > &v)
Definition: rmain.cxx:367
CaloCondBlobAlgs_fillNoiseFromASCII.author
string author
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:26
TriggerTest.rois
rois
Definition: TriggerTest.py:23
g_binConfig
BinConfig g_binConfig
Filter_Author
Definition: Filters.h:32
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
usage
int usage(const std::string &name, int status)
Definition: rmain.cxx:332
TIDA::Track
Definition: Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/Track.h:26
CxxUtils::atoi
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
Definition: Control/CxxUtils/Root/StringUtils.cxx:85
merge.status
status
Definition: merge.py:17
electronBinConfig
BinConfig electronBinConfig
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24
LArCellNtuple.ifile
string ifile
Definition: LArCellNtuple.py:133
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
ChainString::element
const std::string & element() const
Definition: ChainString.h:37
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
TIDA::Associator::match
virtual void match(const std::vector< T * > &s1, const std::vector< S * > &s2)=0
Nvtxtracks
int Nvtxtracks
Definition: globals.cxx:17
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
skip
bool skip
Definition: TrigGlobEffCorrValidation.cxx:190
python.CaloScaleNoiseConfig.ts
ts
Definition: CaloScaleNoiseConfig.py:87
TIDA::Event::run_number
void run_number(unsigned r)
accessors
Definition: TIDAEvent.h:42
getFilter
TrackFilter * getFilter(const std::string &refname, int pdgId, TrackFilter *foff, TrackFilter *fmu, TrackFilter *ftruth)
This is awful code, passing in lots of filter pointers just so that they can be assigned neatly ?...
Definition: rmain.cxx:404
TrigObjectMatcher::object
const TrackTrigObject * object(unsigned long track_id)
Definition: TrigObjectMatcher.h:59
ExtractEBRunDetails.lumiblocks
lumiblocks
Definition: ExtractEBRunDetails.py:225
check_log.backtrace
backtrace
Definition: check_log.py:58
Filter_TrackQuality
Definition: Filter_TrackQuality.h:27
PurityAnalysis
Definition: PurityAnalysis.h:34
TrackAnalysis::store
TIDA::FeatureStore & store()
Definition: TrackAnalysis.h:133
TIDARoiDescriptor::phiMinus
double phiMinus() const
Definition: TIDARoiDescriptor.h:140
python.trfValidateRootFile.rc
rc
Definition: trfValidateRootFile.py:361
TIDARoiDescriptor::zed
double zed() const
Definition: TIDARoiDescriptor.h:135
TagNProbe::probe
void probe(const std::string &chainName)
Definition: TagNProbe.h:46
NtupleTrackSelector
Definition: NtupleTrackSelector.h:20
zbeam
Definition: zbeam.h:24
tauBinConfig
BinConfig tauBinConfig
hipt
bool hipt
Definition: globals.cxx:29
cosmicBinConfig
BinConfig cosmicBinConfig