File indexing completed on 2026-10-15 08:17:24
0001 #include "corral_class.h"
0002 #include <fstream>
0003
0004
0005
0006 void DisplayHelp();
0007
0008 int main(int argc, char **argv) {
0009
0010 delete gRandom;
0011 gRandom = new TRandom3;
0012
0013 TTree *tree = 0;
0014 int ntd = 0;
0015
0016
0017
0018
0019
0020
0021
0022 TString runstr = TString("");
0023 TString outname = TString("");
0024 TString listname = TString("");
0025 TString dataset = TString("");
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056 for (int i=1; i<argc; i++) {
0057 TString a(argv[i]);
0058 if (a=="-h" || a=="--help"){ DisplayHelp(); exit(0); }
0059 }
0060 for (int i=1; i<argc; i++) {
0061
0062 if (argc>1){
0063 if (argv[i][0] == '-') {
0064 switch (argv[i][1]) {
0065 case 'n':
0066 ntd = atoi(argv[++i]);
0067
0068 break;
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078 case 'l':
0079 listname = TString(argv[++i]);
0080 break;
0081 case 'd':
0082 dataset = TString(argv[++i]);
0083 break;
0084 case 'o':
0085 outname = TString(argv[++i]);
0086 break;
0087 case 's':
0088 runstr = TString(argv[++i]);
0089
0090 break;
0091
0092
0093
0094
0095 }
0096 }
0097 }
0098 }
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111 if (listname!=""){
0112 TChain *chain = new TChain("outTree","Collect tree chain (job list)");
0113 std::ifstream fl(listname.Data());
0114 if (!fl.good()){ cout<<"main -- cannot open list "<<listname<<endl; exit(1); }
0115 std::string line; int nf=0;
0116 while (std::getline(fl,line)){ if (line.empty()) continue; chain->Add(line.c_str()); ++nf; }
0117 cout<<"main -- list "<<listname<<": "<<nf<<" files"<<endl;
0118 if (nf==0){ cout<<"main -- empty list, exit"<<endl; exit(1); }
0119 tree = chain;
0120 }
0121 cout<<"Instantiating corral..."<<endl;
0122 corral *read = new corral(tree, ntd, runstr, outname);
0123 read->Dataset = dataset;
0124 read->ListName = listname;
0125 if (runstr.BeginsWith("Finalize")) read->Finalize();
0126 else read->Loop();
0127
0128
0129
0130
0131
0132 }
0133
0134 void DisplayHelp(){
0135
0136 cout<<endl;
0137 cout<<"USAGE: ./corral [OPTIONS]"<<endl;
0138 cout<<" -h, --help display this help"<<endl;
0139 cout<<" -n [ntodo] do [ntodo] events (= tree entries: one crossing with a vertex), 0 for all"<<endl;
0140 cout<<" -l [listfile] read the Collect files listed in [listfile] (one path per line) instead of the whole"<<endl;
0141 cout<<" directory, e.g. lists/ana532/list_07.txt (see lists/make_lists.bash)"<<endl;
0142 cout<<" Without -l, all files matching $CORRAL_TREES are read (default: the 795xx runs of the WSU copy of"<<endl;
0143 cout<<" ana573, /rs/rs_grp_rhi/sPHENIX/ana573/795*/outputCollect_*.root)"<<endl;
0144 cout<<" -d [dataset] dataset for Finalize: reads lists/[dataset]/, root/[dataset]/chunks/corral_NN.root and"<<endl;
0145 cout<<" the reference root/[dataset]/corral.root (default: FINALIZE_SET in src/finalize_hists.h)"<<endl;
0146 cout<<" -o [name] output base name: root/[name].root, pdf/[name].pdf (NOT scanned for fragments)"<<endl;
0147 cout<<" -s [string] run string: appended to the output filenames (root/corral_<string>.root,"<<endl;
0148 cout<<" pdf/...pdf; none -> corral.root) AND scanned for the fragments below"<<endl;
0149 cout<<endl;
0150 cout<<"DEFAULTS (no fragments): LS split-track removal ON (SL<0.18 & SiSplitScore>=0.10, plus RadialGap>=0.45),"<<endl;
0151 cout<<" ULS opposite-charge veto ON (SiSplitScore>=0.05, any angle), cross-crossing duplicate cleaner ON (strict),"<<endl;
0152 cout<<" adjacent-trigger-frame mixing exclusion ON, crossing correction ON (pt-ordering), ntpc>=18, no Q cut, 32x36 (dy,dphi) binning;"<<endl;
0153 cout<<" overlapping-TF copies skipped (TFdup), looper veto ON (0.08), two-track cuts tsep and isep ON, ana573 vertex-phi mask ON,"<<endl;
0154 cout<<" KFP dE/dx PID (pi, then p, then K), p/pbar pairs above pT 0.4 GeV/c, V0 daughters out only for V0s in their mass peak."<<endl;
0155 cout<<endl;
0156 cout<<"RUNSTRING FRAGMENTS (substring match, case-insensitive unless marked [case]; NN = two digits):"<<endl;
0157 cout<<" MAIN TOKENS (most runs need only these)"<<endl;
0158 cout<<" (none) the defaults above, with the zero-bias crossing selection ZB:"<<endl;
0159 cout<<" -20<=crossing<=390 outside NearX0 (no trigger crossing, no trigger neighbours, no readout edges)"<<endl;
0160 cout<<" Raw every cleaner OFF = noLS_noulstest_noXTF_noTFdup_nolooper_notsep_noisep_nocross_nocmmask,"<<endl;
0161 cout<<" plus AllX unless Xing0 / NearX0 / ZB is given too (e.g. Raw_Xing0)"<<endl;
0162 cout<<" nocross turn OFF the crossing correction (pt-ordering at fill + (dy,dphi) bin correction)"<<endl;
0163 cout<<" Xing0 keep only crossing==0 events (the triggered collision, not zero bias)"<<endl;
0164 cout<<" NearX0 keep only -4<=crossing<=2 without 0 (neighbours of the trigger, for monitoring)"<<endl;
0165 cout<<" AllX keep all crossings (ZB, the default, is also accepted as a token)"<<endl;
0166 cout<<" EXPERT SWITCHES (individual split-track cleaners and cuts; README.md)"<<endl;
0167 cout<<" split tracks, like-sign (README_SplitTracks sec 13-17)"<<endl;
0168 cout<<" noLS turn OFF the whole LS split-track removal pre-pass (both paths)"<<endl;
0169 cout<<" noRG turn OFF only the RadialGap path (path 2); SL/SKF path stays on"<<endl;
0170 cout<<" removecutNN SL threshold = 0.NN (default 0.18; sane range 0.05-0.60)"<<endl;
0171 cout<<" skfNN pre-pass SiSplitScore gate = 0.NN (default 0.10; sane range 0.05-0.95)"<<endl;
0172 cout<<" radialgapNN RadialGap threshold = 0.NN (default 0.45; sane range 0.20-0.90)"<<endl;
0173 cout<<" split tracks, opposite-charge (sec 15, 18.10, 18.24)"<<endl;
0174 cout<<" noulstest turn OFF the ULS track-level veto"<<endl;
0175 cout<<" ulstestNN ULS veto ON at SiSplitScore threshold 0.NN (default 0.05; sane range 0.02-0.95)"<<endl;
0176 cout<<" V0-daughter split partners (README_CQcomparison sec 2.2)"<<endl;
0177 cout<<" nodau turn OFF the split-partner check of Lambda/Lbar daughters"<<endl;
0178 cout<<" loopers (README_SplitTracks573 sec 35): the returning half of a curling low-pt track, OS and back to back"<<endl;
0179 cout<<" nolooper turn OFF the looper veto"<<endl;
0180 cout<<" looperNN looper veto: relative momentum sum |p1+p2|/(|p1|+|p2|) < 0.NN (default 0.08; sane range 0.02-0.10)"<<endl;
0181 cout<<" cross-crossing / trigger-frame duplicates (sec 18.20-18.25)"<<endl;
0182 cout<<" noXTF turn OFF the duplicate cleaner AND the adjacent-TF mixing exclusion (old behavior)"<<endl;
0183 cout<<" XTFclean cleaner ON, NON-strict (the 'neither copy matches INTT' case keeps the better copy)"<<endl;
0184 cout<<" mixAdjTF turn OFF the adjacent-TF (|devt|==1) mixed-event-pair exclusion"<<endl;
0185 cout<<" noTFdup keep collisions copied into overlapping TFs (default: skip later copies,"<<endl;
0186 cout<<" key run+bco+crossing; needs the Collect bco branch, else no effect)"<<endl;
0187 cout<<" trigger-frame (TF) event selections (diagnostics, sec 18.21; they cost statistics)"<<endl;
0188 cout<<" onlyfirsttf keep only the first event of each TF (the lowest, often negative, crossing)"<<endl;
0189 cout<<" XingPos keep only the first crossing>0 event of each TF (streaming)"<<endl;
0190 cout<<" other"<<endl;
0191 cout<<" ntpcNN track cut ntpc>=NN (default 18; sane range 10-40)"<<endl;
0192 cout<<" nosiphimask turn OFF the ana573 vertex-phi mask (README_PID sec 10; default: [70,83) and [94,115) deg)"<<endl;
0193 cout<<" nocmmask turn OFF the central-membrane mask (default: w in [-0.07,0.10), README_SplitTracks573 sec 38)"<<endl;
0194 cout<<" cmmaskAABB central-membrane mask: drop tracks with w = (eta+0.018 vtxz) sign(-vtxz) in [-0.AA,0.BB) (README_SplitTracks573 sec 38)"<<endl;
0195 cout<<" siphimaskall vertex-phi mask with all eight windows (the two above + six small ones; a study option)"<<endl;
0196 cout<<" oldpid legacy PID (pi = dedx70s<400, no p or K); default: the KFP dE/dx gates (dedxGates_KFP.root)"<<endl;
0197 cout<<" LS split-track pregate and two-track cut (README_SplitTracks573 sec 14; defaults = the ana573 working point)"<<endl;
0198 cout<<" noMVTX turn off LS path 3 (flag in-gate pairs with >= 2 matched MVTX layers, whatever the SL)"<<endl;
0199 cout<<" dpsNN pregate centred on the split peak, abs(dphi) within NN/10 deg of dphi0 (default dps20; 1.0-4.0 deg)"<<endl;
0200 cout<<" tsepmYYPP two-track LS pair cut, sibling and mixed: reject |dy|<0.YY && min over R=0.30-0.78 m of |dphi*|<P.P deg (default tsepm0620; dy 0.02-0.10, dphi* 1.0-4.0); notsep: off"<<endl;
0201 cout<<" isepPPP near-vertex two-track pair cut (sec 29), sibling and mixed, LS and ULS: reject |dy|<1.0 && |dphi*(R=3 cm)|<P.P deg (default isep020 = 2.0 deg; 0.3-4.0); noisep: off"<<endl;
0202 cout<<" vzNN event |zvtx| < NN cm (default 16; 6-16)"<<endl;
0203 cout<<" nchLLHH multiplicity class: only events with LL <= N_ch <= HH (accepted tracks, hntrk) reach CalcRm (default all; LL 0-40, HH LL-99)"<<endl;
0204 cout<<" Finalize_fzNN Finalize only: average the Zvtx slices inside |zvtx| < NN cm (default 8; 2-16); the chunks keep all slices"<<endl;
0205 cout<<" qcut reject pairs with qinv < 0.150 GeV"<<endl;
0206 cout<<" 548 fine binning: 5 dy x 48 dphi bins"<<endl;
0207 cout<<endl;
0208 cout<<" Beware substring collisions when naming tags: e.g. 'notsep' contains 'tsep', 'XTFclean' is inside 'noXTFclean...'"<<endl;
0209 cout<<" contains 'XTFclean', 'noulstest' contains 'ulstest', 'nolooper' contains 'looper', and any word containing 'nocross' turns off the crossing correction."<<endl;
0210 cout<<endl;
0211 }