20 "TRACKLOOPERDIR is not set! Did you run $ source setup.sh from TrackLooper/ main repository directory?");
28 for (
auto &
str : allArgs) {
42 "\n **********************\n * *\n * " 43 "Looper *\n * *\n **********************\n");
46 options.add_options()(
"m,mode",
"Run mode (NOT DEFINED)", cxxopts::value<int>()->default_value(
"5"))(
48 "Comma separated input file list OR if just a directory is provided it will glob all in the directory BUT must " 49 "end with '/' for the path",
50 cxxopts::value<std::string>()->default_value(
"muonGun"))(
52 "Name of the tree in the root file to open and loop over",
53 cxxopts::value<std::string>()->default_value(
"trackingNtuple/tree"))(
54 "o,output",
"Output file name", cxxopts::value<std::string>())(
55 "N,nmatch",
"N match for MTV-like matching", cxxopts::value<int>()->default_value(
"9"))(
56 "n,nevents",
"N events to loop over", cxxopts::value<int>()->default_value(
"-1"))(
57 "x,event_index",
"specific event index to process", cxxopts::value<int>()->default_value(
"-1"))(
58 "g,pdg_id",
"The simhit pdgId match option", cxxopts::value<int>()->default_value(
"0"))(
60 "Verbose mode (0: no print, 1: only final timing, 2: object multiplitcity",
61 cxxopts::value<int>()->default_value(
"0"))(
62 "w,write_ntuple",
"Write Ntuple", cxxopts::value<int>()->default_value(
"1"))(
63 "s,streams",
"Set number of streams", cxxopts::value<int>()->default_value(
"1"))(
64 "d,debug",
"Run debug job. i.e. overrides output option to 'debug.root' and 'recreate's the file.")(
65 "l,lower_level",
"write lower level objects ntuple results")(
"G,gnn_ntuple",
"write gnn input variable ntuple")(
66 "j,nsplit_jobs",
"Enable splitting jobs by N blocks (--job_index must be set)", cxxopts::value<int>())(
68 "job_index of split jobs (--nsplit_jobs must be set. index starts from 0. i.e. 0, 1, 2, 3, etc...)",
69 cxxopts::value<int>())(
"3,tc_pls_triplets",
"Allow triplet pLSs in TC collection")(
70 "2,no_pls_dupclean",
"Disable pLS duplicate cleaning (both steps)")(
"h,help",
"Print help");
80 if (
result.count(
"help")) {
90 TString TrackingNtupleDir = gSystem->Getenv(
"TRACKINGNTUPLEDIR");
97 TString::Format(
"%s/trackingNtuple_6pion_1k_pt_0p5_50.root", TrackingNtupleDir.Data());
102 "%s/RelValTTbar_14TeV_CMSSW_12_5_0_pre3/",
103 (TrackingNtupleDir.Replace(31, 1,
"5").Replace(38, 1,
"3"))
107 TString::Format(
"%s/trackingNtuple_10mu_10k_pt_0p5_2_5cm_cube.root", TrackingNtupleDir.Data());
110 TString::Format(
"%s/trackingNtuple_10mu_10k_pt_0p5_50_5cm_cube.root", TrackingNtupleDir.Data());
113 TString::Format(
"%s/trackingNtuple_10mu_10k_pt_0p5_2_50cm_cube.root", TrackingNtupleDir.Data());
116 TString::Format(
"%s/trackingNtuple_10mu_10k_pt_0p5_50_50cm_cube.root", TrackingNtupleDir.Data());
127 if (
result.count(
"debug")) {
132 if (
result.count(
"output")) {
136 std::cout <<
"ERROR: output already exists! provide new output name or delete old file. OUTPUTFILE=" 142 <<
"Warning: Output file name is not provided! Check your arguments. Output file will be set to 'debug.root'" 163 if (
result.count(
"nsplit_jobs")) {
169 std::cout <<
"I am not sure what this means..." << std::endl;
178 if (
result.count(
"job_index")) {
182 std::cout <<
"ERROR: option string --job_index" <<
ana.
job_index <<
" has negative value!" << std::endl;
183 std::cout <<
"I am not sure what this means..." << std::endl;
193 if (not(
result.count(
"job_index") and
result.count(
"nsplit_jobs"))) {
195 std::cout <<
"ERROR: option string --job_index and --nsplit_jobs must be set at the same time!" << std::endl;
202 std::cout <<
"ERROR: --job_index >= --nsplit_jobs ! This does not make sense..." << std::endl;
229 if (
result.count(
"lower_level")) {
237 if (
result.count(
"gnn_ntuple")) {
242 std::cout <<
"ERROR: option string --write_ntuple 1 and --gnn_ntuple must be set at the same time!" << std::endl;
258 std::cout <<
"=========================================================" << std::endl;
259 std::cout <<
" Running for Acc = " << alpaka::getAccName<ALPAKA_ACCELERATOR_NAMESPACE::Acc3D>() << std::endl;
260 std::cout <<
" Setting of the analysis job based on provided arguments " << std::endl;
261 std::cout <<
"---------------------------------------------------------" << std::endl;
275 std::cout <<
"=========================================================" << std::endl;
303 std::vector<ALPAKA_ACCELERATOR_NAMESPACE::Queue> queues;
309 TStopwatch full_timer;
314 float timeForMapLoading = full_timer.RealTime() * 1000;
323 std::vector<std::vector<float>> out_trkX;
324 std::vector<std::vector<float>> out_trkY;
325 std::vector<std::vector<float>> out_trkZ;
326 std::vector<std::vector<unsigned int>> out_hitId;
327 std::vector<std::vector<unsigned int>> out_hitIdxs;
328 std::vector<std::vector<unsigned int>> out_hitIndices_vec0;
329 std::vector<std::vector<unsigned int>> out_hitIndices_vec1;
330 std::vector<std::vector<unsigned int>> out_hitIndices_vec2;
331 std::vector<std::vector<unsigned int>> out_hitIndices_vec3;
332 std::vector<std::vector<float>> out_deltaPhi_vec;
333 std::vector<std::vector<float>> out_ptIn_vec;
334 std::vector<std::vector<float>> out_ptErr_vec;
335 std::vector<std::vector<float>> out_px_vec;
336 std::vector<std::vector<float>> out_py_vec;
337 std::vector<std::vector<float>> out_pz_vec;
338 std::vector<std::vector<float>> out_eta_vec;
339 std::vector<std::vector<float>> out_etaErr_vec;
340 std::vector<std::vector<float>> out_phi_vec;
341 std::vector<std::vector<int>> out_charge_vec;
342 std::vector<std::vector<unsigned int>> out_seedIdx_vec;
343 std::vector<std::vector<int>> out_superbin_vec;
344 std::vector<std::vector<PixelType>> out_pixelType_vec;
345 std::vector<std::vector<char>> out_isQuad_vec;
346 std::vector<int> evt_num;
385 float timeForInputLoading = full_timer.RealTime() * 1000;
389 std::vector<LSTEvent *>
events;
394 float timeForEventCreation = full_timer.RealTime() * 1000;
396 std::vector<std::vector<float>> timevec;
399 float full_elapsed = 0;
400 #pragma omp parallel num_threads(ana.streams) // private(event) 402 std::vector<std::vector<float>> timing_information;
403 float timing_input_loading;
413 #pragma omp for // nowait// private(event) 414 for (
int evt = 0; evt < static_cast<int>(out_trkX.size()); evt++) {
416 std::cout <<
"Running Event number = " << evt <<
" " << omp_get_thread_num() << std::endl;
418 events.at(omp_get_thread_num())->initSync();
426 out_hitIndices_vec0.at(evt),
427 out_hitIndices_vec1.at(evt),
428 out_hitIndices_vec2.at(evt),
429 out_hitIndices_vec3.at(evt),
430 out_deltaPhi_vec.at(evt),
431 out_ptIn_vec.at(evt),
432 out_ptErr_vec.at(evt),
437 out_etaErr_vec.at(evt),
439 out_charge_vec.at(evt),
440 out_seedIdx_vec.at(evt),
441 out_superbin_vec.at(evt),
442 out_pixelType_vec.at(evt),
443 out_isQuad_vec.at(evt));
447 timing_T3 =
runT3(
events.at(omp_get_thread_num()));
472 unsigned int trkev = evt_num.at(evt);
474 TFile *
f = TFile::Open(
fname.Data(),
"open");
486 events.at(omp_get_thread_num())->resetEventSync();
487 float timing_resetEvent = my_timer.RealTime();
489 timing_information.push_back({timing_input_loading,
502 full_timer.RealTime() *
505 timevec.insert(timevec.end(), timing_information.begin(), timing_information.end());
508 float avg_elapsed = full_elapsed / out_trkX.size();
510 std::cout <<
"Time for map loading = " << timeForMapLoading <<
" ms\n";
511 std::cout <<
"Time for input loading = " << timeForInputLoading <<
" ms\n";
512 std::cout <<
"Time for event creation = " << timeForEventCreation <<
" ms\n";
void GetEntry(unsigned int idx)
void printTimingInformation(std::vector< std::vector< float >> &timing_information, float fullTime, float fullavg)
void print(TString msg="", const char *fname="", int flush_before=0, int flush_after=0)
int main(int argc, char **argv)
void init(TChain *chain, TREECLASS *treeclass, int nEventsToProcess)
ALPAKA_ACCELERATOR_NAMESPACE::lst::LSTEvent LSTEvent
float runTrackCandidate(LSTEvent *event, bool no_pls_dupclean, bool tc_pls_triplets)
ALPAKA_ACCELERATOR_NAMESPACE::Device Device
void error(TString msg, const char *fname="", int is_error=1)
float runT3(LSTEvent *event)
float runQuintuplet(LSTEvent *event)
void addInputsToLineSegmentTrackingPreLoad(std::vector< std::vector< float >> &out_trkX, std::vector< std::vector< float >> &out_trkY, std::vector< std::vector< float >> &out_trkZ, std::vector< std::vector< unsigned int >> &out_hitId, std::vector< std::vector< unsigned int >> &out_hitIdxs, std::vector< std::vector< unsigned int >> &out_hitIndices_vec0, std::vector< std::vector< unsigned int >> &out_hitIndices_vec1, std::vector< std::vector< unsigned int >> &out_hitIndices_vec2, std::vector< std::vector< unsigned int >> &out_hitIndices_vec3, std::vector< std::vector< float >> &out_deltaPhi_vec, std::vector< std::vector< float >> &out_ptIn_vec, std::vector< std::vector< float >> &out_ptErr_vec, std::vector< std::vector< float >> &out_px_vec, std::vector< std::vector< float >> &out_py_vec, std::vector< std::vector< float >> &out_pz_vec, std::vector< std::vector< float >> &out_eta_vec, std::vector< std::vector< float >> &out_etaErr_vec, std::vector< std::vector< float >> &out_phi_vec, std::vector< std::vector< int >> &out_charge_vec, std::vector< std::vector< unsigned int >> &out_seedIdx_vec, std::vector< std::vector< int >> &out_superbin_vec, std::vector< std::vector< PixelType >> &out_pixelType_vec, std::vector< std::vector< char >> &out_isQuad_vec)
ALPAKA_ACCELERATOR_NAMESPACE::Queue Queue
std::unique_ptr< LSTESData< alpaka_common::DevHost > > loadAndFillESHost()
void fillOutputBranches(LSTEvent *event)
void createOutputBranches()
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
RooUtil::Looper< Trktree > looper
float runPixelQuintuplet(LSTEvent *event)
TString track_looper_dir_path
void copyAsync(device::unique_ptr< T > &dst, const host::unique_ptr< T > &src, cudaStream_t stream)
TString input_file_list_tstring
float runpT3(LSTEvent *event)
void createGnnNtupleBranches()
TChain * createTChain(TString, TString)
float runSegment(LSTEvent *event)
float addInputsToEventPreLoad(LSTEvent *event, bool useOMP, std::vector< float > trkX, std::vector< float > trkY, std::vector< float > trkZ, std::vector< unsigned int > hitId, std::vector< unsigned int > hitIdxs, std::vector< unsigned int > hitIndices_vec0, std::vector< unsigned int > hitIndices_vec1, std::vector< unsigned int > hitIndices_vec2, std::vector< unsigned int > hitIndices_vec3, std::vector< float > deltaPhi_vec, std::vector< float > ptIn_vec, std::vector< float > ptErr_vec, std::vector< float > px_vec, std::vector< float > py_vec, std::vector< float > pz_vec, std::vector< float > eta_vec, std::vector< float > etaErr_vec, std::vector< float > phi_vec, std::vector< int > charge_vec, std::vector< unsigned int > seedIdx_vec, std::vector< int > superbin_vec, std::vector< PixelType > pixelType_vec, std::vector< char > isQuad_vec)
void setSilent(bool s=true)
float runMiniDoublet(LSTEvent *event, int evt)
float runPixelLineSegment(LSTEvent *event, bool no_pls_dupclean)
TString getCurrentFileName()
unsigned int getCurrentEventIndex()