00001
00004
00005
00006
00008
00009 #include <fstream>
00010
00011 #include "Conventions/Detector.h"
00012
00013
00014 #include "Mad/MadAbID.h"
00015 #include "Mad/MadDpID.h"
00016 #include "MessageService/MsgService.h"
00017 #include "NtupleUtils/NuEvent.h"
00018 #include "NtupleUtils/NuLibrary.h"
00019
00020
00021 #include "Registry/Registry.h"
00022 #include "Conventions/ReleaseType.h"
00023
00024 #include "NuMuBar/NuMadAnalysis.h"
00025 #include "NuMuBar/NuPIDInterface.h"
00026
00027 using std::endl;
00028 using std::cout;
00029
00030 CVSID("$Id: NuPIDInterface.cxx,v 1.31 2009/12/08 18:13:00 ahimmel Exp $");
00031
00032
00033
00034 NuPIDInterface::NuPIDInterface()
00035 {
00036 MSG("NuPIDInterface",Msg::kDebug)
00037 <<"Running NuPIDInterface Constructor..."<<endl;
00038
00039
00040 poLoadPDF=0;
00041 poLoadPDFKin=0;
00042 poPIDCalculator=0;
00043 poPIDCalculatorKin=0;
00044 abID=0;
00045 dpID=0;
00046 mad=0;
00047 roInterface=0;
00048 jmInterface=0;
00049 roRegistry=0;
00050
00051 MSG("NuPIDInterface",Msg::kDebug)
00052 <<"Finished NuPIDInterface Constructor"<<endl;
00053 }
00054
00055
00056
00057 NuPIDInterface::~NuPIDInterface()
00058 {
00059 MSG("NuPIDInterface",Msg::kDebug)
00060 <<"Running NuPIDInterface Destructor..."<<endl;
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072 MSG("NuPIDInterface",Msg::kDebug)
00073 <<"Finished NuPIDInterface Destructor"<<endl;
00074 }
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184 std::string NuPIDInterface::GetFileNameAbID(const NuEvent& nu) const
00185 {
00186
00187 const NuLibrary& lib=NuLibrary::Instance();
00188
00189 string sBase=lib.general.GetReleaseDirToUse("Mad");
00190 string sFileName=sBase+"/Mad/data/ab_pdf_near_le_cedar_daikon.root";
00191 Bool_t badVersions=false;
00192
00193
00194
00195 string sVegetable = "Aubergine";
00196 string sTree = "Bonsai";
00197 string sBeam = "LHC";
00198 string sDetector = "Nova";
00199
00200
00201 sTree = "cedar";
00202 if (!ReleaseType::IsCedar(nu.recoVersion)){
00203 MAXMSG("NuPIDInterface",Msg::kInfo,1) << "Assuming cedar reco version in AbID initialization (changed from "
00204 << NuUtilities::PrintRelease(nu.releaseType) << ") since those are the only available training files" << endl;
00205 }
00206
00207 if (ReleaseType::IsDaikon(nu.mcVersion)){
00208 sVegetable = "daikon";
00209 }
00210 else{
00211 badVersions=true;
00212 }
00213
00214 if (nu.detector == Detector::kNear){
00215 sDetector = "near";
00216 if (nu.beamType==BeamType::kL010z185i ||
00217 nu.beamType==BeamType::kL010z185i_rev) {
00218 sBeam = "le";
00219 }
00220 else if (nu.beamType==BeamType::kL010z170i) {
00221 sBeam = "le170";
00222 }
00223 else if (nu.beamType==BeamType::kL010z200i) {
00224 sBeam = "le200";
00225 }
00226 else if (nu.beamType==BeamType::kL010z000i) {
00227 sBeam = "le0";
00228 }
00229 else if (nu.beamType==BeamType::kL100z200i ||
00230 nu.beamType==BeamType::kL150z200i ||
00231 nu.beamType==BeamType::kL200z200i) {
00232
00233 sBeam = "pme";
00234 }
00235 else if (nu.beamType==BeamType::kL250z200i) {
00236 sBeam = "phe";
00237 }
00238 else {
00239 MSG("NuPIDInterface",Msg::kError)
00240 <<"Ahhh, BeamType not recognised: "<<nu.beamType<<endl;
00241 assert(false);
00242 }
00243 }
00244 else if (nu.detector==Detector::kFar) {
00245 sDetector = "far";
00246
00247 if (nu.beamType==BeamType::kL250z200i) {
00248 sBeam = "phe";
00249 }
00250 else {
00251 sBeam = "le";
00252 }
00253 }
00254 else {
00255 cout<<"Ahhh, detector="<<nu.detector<<" not recognised"<<endl;
00256 }
00257
00258 sFileName = sBase
00259 + "/Mad/data/ab_pdf_"
00260 + sDetector + "_"
00261 + sBeam + "_"
00262 + sTree + "_"
00263 + sVegetable + ".root";
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324 if (badVersions) {
00325 MSG("NuPIDInterface",Msg::kError)
00326 <<"Ahhh, ReleaseType not recognised:"<<endl;
00327 this->PrintReleaseTypeEtc(nu);
00328 MSG("NuPIDInterface",Msg::kError)<<"Will abort here..."<<endl;
00329 assert(false);
00330 }
00331
00332 return sFileName;
00333 }
00334
00335
00336 std::string NuPIDInterface::GetFileNameRoID(const NuEvent& nu) const
00337 {
00338 return GetFileNamekNNID(nu,1);
00339 }
00340 std::string NuPIDInterface::GetFileNameJmID(const NuEvent& nu) const
00341 {
00342 return GetFileNamekNNID(nu,3);
00343 }
00344 std::string NuPIDInterface::GetFileNamekNNID(const NuEvent& nu, int type=1) const
00345 {
00346
00347
00348 const NuLibrary& lib=NuLibrary::Instance();
00349
00351
00352
00353
00354
00356
00357 string sBase=lib.general.GetReleaseDirToUse("NuMuBar");
00358
00359 string sFileName=sBase+"/NuMuBar/data/knn.physics.near.daikon_04.dogwood1.L010z185i.root";
00360 if(type ==2) sFileName=sBase+"/NuMuBar/data/knn.physics.20p3GeV.near.daikon_04.dogwood1.L010z185i.root";
00361 if(type ==3) sFileName=sBase+"/NuMuBar/data/knn.physics.Alt.near.daikon_04.dogwood1.L010z185i.root";
00362
00363 Bool_t badVersions=false;
00364
00365
00366
00367 string sVegetable = "Aubergine";
00368 string sTree = "Bonsai";
00369 string sBeam = "LHC";
00370 string sDetector = "Nova";
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385 sTree = "dogwood1";
00386 if (!ReleaseType::IsDogwood(nu.recoVersion)){
00387 MAXMSG("NuPIDInterface",Msg::kInfo,1) << "Assuming dogwood1 reco version in RoID initialization (changed from "
00388 << NuUtilities::PrintRelease(nu.releaseType) << ") since those are the only available training files" << endl;
00389 }
00390
00391
00392 if (ReleaseType::IsDaikon(nu.mcVersion)){
00393 sVegetable = "daikon_04";
00394 }
00395 else{
00396 badVersions=true;
00397 }
00398
00399 if (nu.detector==Detector::kNear) {
00400 sDetector = "near";
00401 }
00402 else if (nu.detector==Detector::kFar) {
00403 sDetector = "far";
00404 }
00405 else {
00406 cout<<"Ahhh, detector="<<nu.detector<<" not recognised"<<endl;
00407 }
00408
00409
00410 sBeam = "L010z185i";
00411 if(type==1)
00412 {
00413 sFileName = sBase + "/NuMuBar/data/knn.physics.";
00414 }
00415 else if(type==2)
00416 {
00417 sFileName = sBase + "/NuMuBar/data/knn.physics.20p3GeV.";
00418 }
00419 else if(type==3)
00420 {
00421 sFileName = sBase + "/NuMuBar/data/knn.physics.Alt.";
00422 }
00423 else{
00424 cerr<<"NuPIDInterface::GetFileNamekNNID -- invalid type "<<type<<endl;
00425 assert(false);
00426 }
00427 sFileName+= sDetector + "."
00428 + sVegetable + "."
00429 + sTree + "."
00430 + sBeam + ".root";
00431
00432 if (badVersions) {
00433 MSG("NuPIDInterface",Msg::kError)
00434 <<"Ahhh, ReleaseType not recognised:"<<endl;
00435 this->PrintReleaseTypeEtc(nu);
00436 MSG("NuPIDInterface",Msg::kError)<<"Will abort here..."<<endl;
00437 assert(false);
00438 }
00439
00440
00441 ifstream file(sFileName.c_str());
00442
00443
00444 if(!file){
00445
00446 MSG("NuPIDInterface",Msg::kError)
00447 <<endl<<endl
00448 <<"GetFileNameRoID: file does not exist, filename="
00449 <<sFileName<<endl<<endl;
00450 MSG("NuPIDInterface",Msg::kError)
00451 <<endl<<endl
00452 <<"The RO PID input files are no longer distributed so they"
00453 <<endl
00454 <<"have to be copied to the local site. The NuMuBar/data"
00455 <<endl
00456 <<"directory is the place to copy or soft link the files to"
00457 <<endl
00458 <<"The Cedar/Daikon files are documented here:"
00459 <<endl
00460 <<" http://home.fnal.gov/~rustem/PhysicsNtuple/"
00461 <<endl
00462 <<"and possibly located here:"
00463 <<endl
00464 <<" /afs/fnal.gov/files/home/room1/rustem/data/muon-knn"
00465 <<endl<<endl;
00466 MSG("NuPIDInterface",Msg::kError)
00467 <<endl<<endl<<"Asserting here..."<<endl<<endl;
00468 assert(false);
00469 }
00470 else {
00471
00472 MSG("NuPIDInterface",Msg::kDebug)
00473 <<"File exists with name="<<sFileName<<endl;
00474 file.close();
00475 }
00476
00477 return sFileName;
00478 }
00479
00480
00481
00482 std::string NuPIDInterface::GetFileNameJeID(const NuEvent& nu) const
00483 {
00484
00485 const NuLibrary& lib=NuLibrary::Instance();
00486
00487 string sBase=lib.general.GetReleaseDirToUse("NuMuBar");
00488 string sFileName=sBase+"/NuMuBar/data/pid_evans_cedar_daikon_LE185.root";
00489 Bool_t badVersions=false;
00490
00491 if (nu.detector==Detector::kNear) {
00492 if (ReleaseType::IsCedar(nu.recoVersion) &&
00493 ReleaseType::IsDaikon(nu.mcVersion)) {
00494 sFileName=sBase+"/NuMuBar/data/pid_evans_cedar_daikon_LE185.root";
00495 }
00496 else {
00497 badVersions=true;
00498 }
00499 }
00500 else if (nu.detector==Detector::kFar) {
00501 badVersions=true;
00502 }
00503 else {
00504 cout<<"Ahhh, detector="<<nu.detector<<" not recognised"<<endl;
00505 }
00506
00507 if (badVersions) {
00508 MSG("NuPIDInterface",Msg::kError)
00509 <<"Ahhh, ReleaseType not recognised:"<<endl;
00510 this->PrintReleaseTypeEtc(nu);
00511 MSG("NuPIDInterface",Msg::kError)<<"Will abort here..."<<endl;
00512 assert(false);
00513 }
00514
00515 return sFileName;
00516 }
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557
00558
00559
00560
00561
00562
00563
00564
00565
00566
00567
00568
00569
00570
00571 void NuPIDInterface::InitialiseAbID(const NuEvent& nu)
00572 {
00573 MSG("NuPIDInterface",Msg::kInfo)
00574 <<"InitialiseAbID..."<<endl;
00575
00576 TDirectory* tmpd = gDirectory;
00577 MSG("NuPIDInterface",Msg::kDebug)
00578 <<"TDirectory before InitialiseAbID is:"<<endl;
00579
00580
00581 string sFileName=this->GetFileNameAbID(nu);
00582 MSG("NuPIDInterface",Msg::kInfo)
00583 <<"InitialiseAbID with:"<<endl
00584 <<" sFileName="<<sFileName<<endl;
00585 this->PrintReleaseTypeEtc(nu);
00586
00587
00588 abID=new MadAbID();
00589
00590
00591 abID->ReadPDFs(sFileName.c_str());
00592
00593 MSG("NuPIDInterface",Msg::kDebug)
00594 <<"TDirectory after InitialiseAbID is:"<<endl;
00595
00596 MSG("NuPIDInterface",Msg::kDebug)
00597 <<"After reseting gDirectory its location is:"<<endl;
00598 gDirectory=tmpd;
00599
00600 }
00601
00602
00603
00604 void NuPIDInterface::InitialiseDpID(const NuEvent& nu)
00605 {
00606 MSG("NuPIDInterface",Msg::kInfo)
00607 <<"InitialiseDpID..."<<endl;
00608
00609 TDirectory* tmpd = gDirectory;
00610 MSG("NuPIDInterface",Msg::kDebug)
00611 <<"TDirectory before InitialiseDpID is:"<<endl;
00612
00613
00614
00615
00616
00617 mad=new NuMadAnalysis();
00618
00619
00620 dpID=new MadDpID();
00621
00622 BeamType::BeamType_t btype = static_cast<BeamType::BeamType_t>(nu.beamType);
00623 MAXMSG("NuPIDInterface",Msg::kInfo,1) << "Initializing DpID for btype = " << BeamType::AsString(btype)
00624 << " (" << btype << ") and " << endl;
00625 this->PrintReleaseTypeEtc(nu);
00626
00627
00628 if (btype == BeamType::kL010z185i_rev) {
00629 btype = BeamType::kL010z185i;
00630 }
00631 MAXMSG("NuPIDInterface",Msg::kInfo,1) << "Initializing DpID for btype = " << BeamType::AsString(btype)
00632 << " (" << btype << ") and " << endl;
00633 this->PrintReleaseTypeEtc(nu);
00634
00635
00636
00637 int rtype = nu.releaseType;
00638 rtype -= ReleaseType::GetRecoInfo(rtype);
00639 rtype += ReleaseType::kCedar;
00640
00641 dpID->ChoosePDFs(static_cast<Detector::Detector_t>(nu.detector),
00642 btype,
00643 ReleaseType::AsString(rtype),
00644 ReleaseType::AsString(nu.mcVersion));
00645
00646 MSG("NuPIDInterface",Msg::kDebug)
00647 <<"TDirectory after InitialiseDpID is:"<<endl;
00648
00649 MSG("NuPIDInterface",Msg::kDebug)
00650 <<"After reseting gDirectory its location is:"<<endl;
00651 gDirectory=tmpd;
00652
00653 }
00654
00655
00656
00657 void NuPIDInterface::InitialiseRoID2007(const NuEvent& nu)
00658 {
00659 MSG("NuPIDInterface",Msg::kInfo)
00660 <<"InitialiseRoID..."<<endl;
00661
00662 TDirectory* tmpd = gDirectory;
00663 MSG("NuPIDInterface",Msg::kDebug)
00664 <<"TDirectory before InitialiseRoID is:"<<endl;
00665
00666
00667 string sFileName=this->GetFileNameRoID(nu);
00668 MSG("NuPIDInterface",Msg::kInfo)
00669 <<"InitialiseRoID with:"<<endl
00670 <<" sFileName="<<sFileName<<endl;
00671 this->PrintReleaseTypeEtc(nu);
00672
00673
00674 roInterface=new Anp::Interface();
00675
00676
00677 roRegistry=new Registry();
00678
00679 roRegistry->UnLockValues();
00680 roRegistry->Set("FillkNNKNeighbor", int(41));
00681 roRegistry->Set("FillkNNKeyList", "7001, 7010, 7020, 7040");
00682 roRegistry->Set("FillkNNMinViewNPlane", int(5));
00683
00684 roRegistry->Set("FillkNNFilePath", sFileName.c_str());
00685 roRegistry->Set("FillkNNKeyBase", int(5200));
00686 roRegistry->Set("QuietInterface", "yes");
00687 roRegistry->Set("FillMuonIdStudy","no");
00688 roRegistry->Set("RunAlgEventErase","no");
00689
00690 roRegistry->Set("AlgStoreList", "FillHeader FillShower FillTrack FillStrip FillEvent");
00691 roRegistry->Set("AlgSnarlList", "FillMuonId FillTrackGeom FillkNN RunAlgEvent");
00692 roRegistry->Set("AlgEventList","SelectAntiNeutrino");
00693 roRegistry ->Set("PrintConfig","yes");
00694 roRegistry->LockValues();
00695
00696
00697 roInterface->Config(*roRegistry);
00698
00699 MSG("NuPIDInterface",Msg::kDebug)
00700 <<"TDirectory after InitialiseRoID is:"<<endl;
00701
00702 MSG("NuPIDInterface",Msg::kDebug)
00703 <<"After reseting gDirectory its location is:"<<endl;
00704 gDirectory=tmpd;
00705
00706 }
00707
00708
00709
00710 void NuPIDInterface::InitialiseRoID(const NuEvent& nu)
00711 {
00712 MSG("NuPIDInterface",Msg::kInfo)
00713 <<"InitialiseRoID..."<<endl;
00714
00715 TDirectory* tmpd = gDirectory;
00716 MSG("NuPIDInterface",Msg::kInfo)
00717 <<"TDirectory before InitialiseRoID is:"<<endl;
00718 tmpd->pwd();
00719
00720 const string sFileName=this->GetFileNameRoID(nu);
00721 MSG("NuPIDInterface",Msg::kInfo)
00722 <<"InitialiseRoID with:"<<endl
00723 <<" sFileName="<<sFileName<<endl;
00724 this->PrintReleaseTypeEtc(nu);
00725
00726
00727 roInterface=new Anp::Interface();
00728
00729
00730 const NuLibrary& lib=NuLibrary::Instance();
00731
00732
00733 const string sBase=lib.general.GetReleaseDirToUse("PhysicsNtuple");
00734 const string sConfigFileName=sBase+ "/PhysicsNtuple/Config/Config2008Test.txt";
00735
00736
00737 roRegistry=new Registry(false);
00738 roRegistry->Set("InterfaceConfigPath",sConfigFileName.c_str());
00739 roRegistry->Set("FillkNNFilePath",sFileName.c_str());
00740 roRegistry ->Set("PrintConfig","yes");
00741 cout<<" inside initialise roInterace"<<endl;
00742
00743 roInterface->Config(*roRegistry);
00744
00745 MSG("NuPIDInterface",Msg::kInfo)
00746 <<"TDirectory after InitialiseRoID is:"<<endl;
00747 gDirectory->pwd();
00748 MSG("NuPIDInterface",Msg::kInfo)
00749 <<"After reseting gDirectory its location is:"<<endl;
00750 gDirectory=tmpd;
00751 gDirectory->pwd();
00752 }
00753
00754 void NuPIDInterface::InitialiseJmID(const NuEvent& nu)
00755 {
00756 MSG("NuPIDInterface",Msg::kInfo)
00757 <<"InitialiseRoID..."<<endl;
00758
00759 TDirectory* tmpd = gDirectory;
00760 MSG("NuPIDInterface",Msg::kInfo)
00761 <<"TDirectory before InitialiseJmID is:"<<endl;
00762 tmpd->pwd();
00763
00764 const string sFileName=this->GetFileNameJmID(nu);
00765 MSG("NuPIDInterface",Msg::kInfo)
00766 <<"InitialiseJmID with:"<<endl
00767 <<" sFileName="<<sFileName<<endl;
00768 this->PrintReleaseTypeEtc(nu);
00769
00770
00771 jmInterface=new Anp::Interface();
00772
00773
00774 const NuLibrary& lib=NuLibrary::Instance();
00775
00776
00777 const string sBase=lib.general.GetReleaseDirToUse("PhysicsNtuple");
00778 const string sConfigFileName=sBase+ "/PhysicsNtuple/Config/ShortConfig2009.txt";
00779
00780
00781
00782 cout<<" inside initialise jmInterface "<<sConfigFileName<<endl;
00783
00784 jmRegistry=new Registry(false);
00785 string knn_name2;
00786 const string sBaseE=lib.general.GetReleaseDirToUse("NuMuBar");
00787 if(!(sFileName.find("near") ==string::npos))
00788 knn_name2 = "/NuMuBar/data/knn.physics.notrack.near.daikon_04.dogwood1.L010z185i.root";
00789 else if(!(sFileName.find("far") ==string::npos))
00790 knn_name2 = "/NuMuBar/data/knn.physics.notrack.far.daikon_04.dogwood1.L010z185i.root";
00791
00792 const string knn2 = sBaseE+ knn_name2;
00793
00794 jmRegistry->Set("EventkNN",*SubReg_FillkNN(99,19400,19000, "19008 19007 19004",knn2,"no"));
00795
00796 jmRegistry->Set("InterfaceConfigPath",sConfigFileName.c_str());
00797 jmRegistry->Set("FillkNNFilePath",sFileName.c_str());
00798 jmRegistry ->Set("PrintConfig","yes");
00799
00800
00801 jmInterface->Config(*jmRegistry);
00802
00803 MSG("NuPIDInterface",Msg::kInfo)
00804 <<"TDirectory after InitialiseJmID is:"<<endl;
00805 gDirectory->pwd();
00806 MSG("NuPIDInterface",Msg::kInfo)
00807 <<"After reseting gDirectory its location is:"<<endl;
00808 gDirectory=tmpd;
00809 gDirectory->pwd();
00810 }
00811
00812
00813
00814 void NuPIDInterface::InitialiseRoIDNuMuBar(const NuEvent& nu)
00815 {
00816 MSG("NuPIDInterface",Msg::kInfo)
00817 <<"InitialiseRoIDNuMuBar..."<<endl;
00818
00819 TDirectory* tmpd = gDirectory;
00820 MSG("NuPIDInterface",Msg::kDebug)
00821 <<"TDirectory before InitialiseRoIDNuMuBar is:"<<endl;
00822
00823
00824
00825
00826
00827
00828 this->PrintReleaseTypeEtc(nu);
00829
00830
00831 roInterface=new Anp::Interface();
00832
00833
00834 roRegistry=new Registry();
00835
00836 roRegistry->UnLockValues();
00837 roRegistry->Set("FillMuonIdStudy","no");
00838 roRegistry->Set("QuietInterface","yes");
00839 roRegistry->Set("RunAlgEventErase","no");
00840 roRegistry->Set("AlgStoreList","FillHeader FillShower FillTrack FillStrip FillEvent");
00841 roRegistry->Set("AlgSnarlList","FillMuonId FillTrackGeom RunAlgEvent");
00842 roRegistry->Set("AlgEventList","SelectAntiNeutrino");
00843 roRegistry ->Set("PrintConfig","yes");
00844 roRegistry->LockValues();
00845
00846
00847 roInterface->Config(*roRegistry);
00848
00849 MSG("NuPIDInterface",Msg::kDebug)
00850 <<"TDirectory after InitialiseRoIDNuMuBar is:"<<endl;
00851
00852 MSG("NuPIDInterface",Msg::kDebug)
00853 <<"After reseting gDirectory its location is:"<<endl;
00854 gDirectory=tmpd;
00855
00856 }
00857
00858
00859
00860 void NuPIDInterface::InitialiseJeID(const NuEvent& nu)
00861 {
00862 MSG("NuPIDInterface",Msg::kInfo)
00863 <<"InitialiseJeID..."<<endl;
00864
00865 TDirectory* tmpd = gDirectory;
00866 MSG("NuPIDInterface",Msg::kDebug)
00867 <<"TDirectory before InitialiseJeID is:"<<endl;
00868
00869
00870 string sFileName=this->GetFileNameJeID(nu);
00871 MSG("NuPIDInterface",Msg::kInfo)
00872 <<"InitialiseJeID with:"<<endl
00873 <<" sFileName="<<sFileName<<endl
00874 <<" recoVersion="<<nu.recoVersion
00875 <<", mcVersion="<<nu.mcVersion<<endl;
00876
00877
00878
00879 MSG("NuPIDInterface",Msg::kDebug)
00880 <<"TDirectory after InitialiseJeID is:"<<endl;
00881
00882 MSG("NuPIDInterface",Msg::kDebug)
00883 <<"After reseting gDirectory its location is:"<<endl;
00884 gDirectory=tmpd;
00885
00886 }
00887
00888
00889
00890
00891
00892
00893
00894
00895
00896
00897
00898
00899
00900
00901
00902
00903
00904
00905
00906
00907
00908
00909
00910
00911
00912
00913
00914
00915
00916
00917
00918
00919
00920
00921
00922
00923
00924 void NuPIDInterface::GetAbID(const NtpStRecord& ntp,
00925 const NtpSREvent& evt,NuEvent& nu)
00926 {
00927
00928 if (!abID) this->InitialiseAbID(nu);
00929
00930
00931 nu.abID=abID->CalcPID(&evt,&ntp);
00932 }
00933
00934
00935
00936 void NuPIDInterface::GetRoID2007(const NtpStRecord& ntp,
00937 const NtpSREvent& evt,NuEvent& nu)
00938 {
00939
00940 if (!roInterface) this->InitialiseRoID(nu);
00941
00942
00943 static Bool_t ro_pass=false;
00944 static Int_t lastSnarl=-999;
00945 MAXMSG("NuPIDInterface",Msg::kDebug,200)
00946 <<"lastSnarl="<<lastSnarl<<", nu.entry="<<nu.entry<<endl;
00947 if (nu.entry!=lastSnarl) {
00948 MAXMSG("NuPIDInterface",Msg::kDebug,200)
00949 <<"NuPIDInterface::GetRoID FillSnarl..."<<endl;
00950 ro_pass=roInterface->FillSnarl(const_cast<NtpStRecord*>(&ntp));
00951 }
00952 lastSnarl=nu.entry;
00953
00954 Float_t roID=-999;
00955 Float_t roIDNuMuBar=0;
00956 Float_t relativeAngle=-999;
00957
00958
00959 Bool_t got5240=false;
00960 Bool_t got5524=false;
00961 Bool_t got5533=false;
00962
00963 if (ro_pass) {
00964 map<short, float> romap=roInterface->GetData
00965 (const_cast<NtpSREvent*>(&evt));
00966
00967
00968
00969
00970
00971
00972
00973 for (map<short,float>::const_iterator rit=romap.begin();
00974 rit!=romap.end(); ++rit) {
00975 Int_t key=0;
00976 Float_t val=0;
00977 key=rit->first;
00978 val=rit->second;
00979
00980 MAXMSG("NuPIDInterface",Msg::kDebug,1000)
00981 <<"key="<<key<<", val="<<val<<endl;
00982
00983 if (key==5240) {
00984 roID=val;
00985 got5240=true;
00986 }
00987
00988 if (key==5524) {
00989 roIDNuMuBar=val;
00990 got5524=true;
00991 }
00992
00993 if (key==5533) {
00994 relativeAngle=val;
00995 got5533=true;
00996 }
00997
00998 if (got5240 && got5524 && got5533) {
00999 MAXMSG("NuPIDInterface",Msg::kDebug,50)
01000 <<"Jumping out of loop over ROID map..."<<endl;
01001 break;
01002 }
01003
01004
01005
01006
01007
01008 }
01009 }
01010 else {
01011 MAXMSG("NuPIDInterface",Msg::kInfo,100)
01012 <<"Event did not pass RO ID FillSnarl"<<endl;
01013 }
01014
01015
01016 nu.roID=roID;
01017 nu.roIDNuMuBar=roIDNuMuBar;
01018 nu.relativeAngle=relativeAngle;
01019
01020 MAXMSG("NuPIDInterface",Msg::kDebug,100)
01021 <<"GetRoID: roID="<<nu.roID
01022 <<", roIDNuMuBar"<<nu.roIDNuMuBar
01023 <<", relativeAngle"<<nu.relativeAngle
01024 <<endl;
01025 }
01026
01027
01028
01029 void NuPIDInterface::GetRoID(const NtpStRecord& ntp,
01030 const NtpSREvent& evt,NuEvent& nu)
01031 {
01032
01033 if (!roInterface) this->InitialiseRoID(nu);
01034
01035
01036 Msg::LogLevel_t logLevel=Msg::kDebug;
01037
01038
01039 TDirectory* tmpd = gDirectory;
01040 MSG("NuPIDInterface",Msg::kDebug)
01041 <<"TDirectory before GetRoID is:"<<endl;
01042
01043
01044
01045 static Bool_t ro_pass=false;
01046 static Int_t lastSnarl=-999;
01047 MAXMSG("NuPIDInterface",logLevel,100)
01048 <<"lastSnarl="<<lastSnarl<<", nu.entry="<<nu.entry<<endl;
01049 if (nu.entry!=lastSnarl) {
01050 MAXMSG("NuPIDInterface",logLevel,50)
01051 <<"NuPIDInterface::GetRoID FillSnarl..."<<endl;
01052 ro_pass=roInterface->FillSnarl(const_cast<NtpStRecord*>(&ntp));
01053 }
01054 lastSnarl=nu.entry;
01055
01056
01057 if (ro_pass) {
01058
01059 this->GetRoIDEvt(evt,nu);
01060 this->GetRoIDPrimaryTrk(ntp,evt,nu);
01061 this->GetRoIDSecondTrk(ntp,evt,nu);
01062 this->GetRoIDThirdTrk(ntp,evt,nu);
01063 }
01064 else {
01065 MAXMSG("NuPIDInterface",Msg::kWarning,100)
01066 <<"Event did not pass RO ID FillSnarl"<<endl;
01067 }
01068
01069
01070
01071
01072 if (nu.roIDNuMuBarEvt<0 &&
01073 nu.roIDNuMuBarEvt!=-999) nu.roIDNuMuBarEvt=0;
01074 if (nu.roIDNuMuBar1<0 && nu.roIDNuMuBar1!=-999) nu.roIDNuMuBar1=0;
01075 if (nu.roIDNuMuBar2<0 && nu.roIDNuMuBar2!=-999) nu.roIDNuMuBar2=0;
01076 if (nu.roIDNuMuBar3<0 && nu.roIDNuMuBar3!=-999) nu.roIDNuMuBar3=0;
01077
01078
01079
01080
01081
01082
01083 nu.roID=nu.roIDEvt;
01084 nu.knn01TrkActivePlanes=nu.knn01TrkActivePlanesEvt;
01085 nu.knn10TrkMeanPh=nu.knn10TrkMeanPhEvt;
01086 nu.knn20LowHighPh=nu.knn20LowHighPhEvt;
01087 nu.knn40TrkPhFrac=nu.knn40TrkPhFracEvt;
01088 nu.roIDNuMuBar=nu.roIDNuMuBarEvt;
01089 nu.relativeAngle=nu.relativeAngleEvt;
01090
01091 MAXMSG("NuPIDInterface",logLevel,100)
01092 <<"GetRoIDEvt: roID="<<nu.roIDEvt
01093 <<", roIDNuMuBar="<<nu.roIDNuMuBarEvt
01094 <<", relativeAngle="<<nu.relativeAngleEvt
01095 <<endl
01096 <<" knn: TrkActivePlanes="<<nu.knn01TrkActivePlanesEvt
01097 <<", TrkMeanPh="<<nu.knn10TrkMeanPhEvt
01098 <<", LowHighPh="<<nu.knn20LowHighPhEvt
01099 <<", TrkPhFrac="<<nu.knn40TrkPhFracEvt
01100 <<endl;
01101 MAXMSG("NuPIDInterface",logLevel,100)
01102 <<"GetRoIDTrk1: roID="<<nu.roID1
01103 <<", roIDNuMuBar="<<nu.roIDNuMuBar1
01104 <<", relativeAngle="<<nu.relativeAngle1
01105 <<endl
01106 <<" knn: TrkActivePlanes="<<nu.knn01TrkActivePlanes1
01107 <<", TrkMeanPh="<<nu.knn10TrkMeanPh1
01108 <<", LowHighPh="<<nu.knn20LowHighPh1
01109 <<", TrkPhFrac="<<nu.knn40TrkPhFrac1
01110 <<endl;
01111 MAXMSG("NuPIDInterface",logLevel,100)
01112 <<"GetRoIDTrk2: roID="<<nu.roID2
01113 <<", roIDNuMuBar="<<nu.roIDNuMuBar2
01114 <<", relativeAngle="<<nu.relativeAngle2
01115 <<endl
01116 <<" knn: TrkActivePlanes="<<nu.knn01TrkActivePlanes2
01117 <<", TrkMeanPh="<<nu.knn10TrkMeanPh2
01118 <<", LowHighPh="<<nu.knn20LowHighPh2
01119 <<", TrkPhFrac="<<nu.knn40TrkPhFrac2
01120 <<endl;
01121 MAXMSG("NuPIDInterface",logLevel,100)
01122 <<"GetRoIDTrk3: roID="<<nu.roID3
01123 <<", roIDNuMuBar="<<nu.roIDNuMuBar3
01124 <<", relativeAngle="<<nu.relativeAngle3
01125 <<endl
01126 <<" knn: TrkActivePlanes="<<nu.knn01TrkActivePlanes3
01127 <<", TrkMeanPh="<<nu.knn10TrkMeanPh3
01128 <<", LowHighPh="<<nu.knn20LowHighPh3
01129 <<", TrkPhFrac="<<nu.knn40TrkPhFrac3
01130 <<endl<<endl;
01131
01132 MSG("NuPIDInterface",Msg::kDebug)
01133 <<endl<<endl<<endl<<"TDirectory after GetRoID is:"<<endl;
01134
01135 MSG("NuPIDInterface",Msg::kDebug)
01136 <<endl<<endl<<endl<<"After reseting gDirectory it is:"<<endl;
01137 gDirectory=tmpd;
01138
01139 }
01140
01141
01142
01143 void NuPIDInterface::GetRoIDEvt(const NtpSREvent& evt,
01144 NuEvent& nu) const
01145 {
01146 if (!roInterface) {
01147 MSG("NuPIDInterface",Msg::kError)
01148 <<"NuPIDInterface: roInterface not initialised = "<<roInterface
01149 <<endl<<"Will assert here..."<<endl;
01150 assert(false);
01151 }
01152
01153 NtpSREvent* pevt=const_cast<NtpSREvent*>(&evt);
01154
01155
01156 nu.roIDEvt=roInterface->GetVar("knn_pid",pevt);
01157 nu.knn01TrkActivePlanesEvt=roInterface->GetVar("knn_01",pevt);
01158 nu.knn10TrkMeanPhEvt=roInterface->GetVar("knn_10",pevt);
01159 nu.knn20LowHighPhEvt=roInterface->GetVar("knn_20",pevt);
01160 nu.knn40TrkPhFracEvt=roInterface->GetVar("knn_40",pevt);
01161 nu.roIDNuMuBarEvt=roInterface->GetVar("numubar",pevt);
01162 nu.relativeAngleEvt=roInterface->GetVar("rel_ang",pevt);
01163
01164 }
01165
01166
01167
01168 void NuPIDInterface::GetRoIDPrimaryTrk(const NtpStRecord& ntp,
01169 const NtpSREvent& evt,
01170 NuEvent& nu) const
01171 {
01172 if (!roInterface) {
01173 MSG("NuPIDInterface",Msg::kError)
01174 <<"NuPIDInterface: roInterface not initialised = "<<roInterface
01175 <<endl<<"Will assert here..."<<endl;
01176 assert(false);
01177 }
01178
01179 const NuLibrary& lib=NuLibrary::Instance();
01180
01181
01182 const NtpSRTrack* ptrk=lib.reco.GetTrackWithIndexX(ntp,evt,0);
01183
01184
01185 if (ptrk) {
01186
01187 NtpSRTrack* ptrkb=const_cast<NtpSRTrack*>(ptrk);
01188
01189 nu.roID1=roInterface->GetVar("knn_pid",ptrkb);
01190 nu.knn01TrkActivePlanes1=roInterface->GetVar("knn_01",ptrkb);
01191 nu.knn10TrkMeanPh1=roInterface->GetVar("knn_10",ptrkb);
01192 nu.knn20LowHighPh1=roInterface->GetVar("knn_20",ptrkb);
01193 nu.knn40TrkPhFrac1=roInterface->GetVar("knn_40",ptrkb);
01194 nu.roIDNuMuBar1=roInterface->GetVar("numubar",ptrkb);
01195 nu.relativeAngle1=roInterface->GetVar("rel_ang",ptrkb);
01196 }
01197 }
01198
01199
01200
01201 void NuPIDInterface::GetRoIDSecondTrk(const NtpStRecord& ntp,
01202 const NtpSREvent& evt,
01203 NuEvent& nu) const
01204 {
01205 if (!roInterface) {
01206 MSG("NuPIDInterface",Msg::kError)
01207 <<"NuPIDInterface: roInterface not initialised = "<<roInterface
01208 <<endl<<"Will assert here..."<<endl;
01209 assert(false);
01210 }
01211
01212
01213 const NuLibrary& lib=NuLibrary::Instance();
01214
01215
01216 const NtpSRTrack* ptrk=lib.reco.GetTrackWithIndexX(ntp,evt,1);
01217
01218
01219 if (ptrk) {
01220
01221 NtpSRTrack* ptrkb=const_cast<NtpSRTrack*>(ptrk);
01222
01223 nu.roID2=roInterface->GetVar("knn_pid",ptrkb);
01224 nu.knn01TrkActivePlanes2=roInterface->GetVar("knn_01",ptrkb);
01225 nu.knn10TrkMeanPh2=roInterface->GetVar("knn_10",ptrkb);
01226 nu.knn20LowHighPh2=roInterface->GetVar("knn_20",ptrkb);
01227 nu.knn40TrkPhFrac2=roInterface->GetVar("knn_40",ptrkb);
01228 nu.roIDNuMuBar2=roInterface->GetVar("numubar",ptrkb);
01229 nu.relativeAngle2=roInterface->GetVar("rel_ang",ptrkb);
01230 }
01231 }
01232
01233
01234
01235 void NuPIDInterface::GetRoIDThirdTrk(const NtpStRecord& ntp,
01236 const NtpSREvent& evt,
01237 NuEvent& nu) const
01238 {
01239 if (!roInterface) {
01240 MSG("NuPIDInterface",Msg::kError)
01241 <<"NuPIDInterface: roInterface not initialised = "<<roInterface
01242 <<endl<<"Will assert here..."<<endl;
01243 assert(false);
01244 }
01245
01246
01247 const NuLibrary& lib=NuLibrary::Instance();
01248
01249
01250 const NtpSRTrack* ptrk=lib.reco.GetTrackWithIndexX(ntp,evt,2);
01251
01252
01253 if (ptrk) {
01254
01255 NtpSRTrack* ptrkb=const_cast<NtpSRTrack*>(ptrk);
01256
01257 nu.roID3=roInterface->GetVar("knn_pid",ptrkb);
01258 nu.knn01TrkActivePlanes3=roInterface->GetVar("knn_01",ptrkb);
01259 nu.knn10TrkMeanPh3=roInterface->GetVar("knn_10",ptrkb);
01260 nu.knn20LowHighPh3=roInterface->GetVar("knn_20",ptrkb);
01261 nu.knn40TrkPhFrac3=roInterface->GetVar("knn_40",ptrkb);
01262 nu.roIDNuMuBar3=roInterface->GetVar("numubar",ptrkb);
01263 nu.relativeAngle3=roInterface->GetVar("rel_ang",ptrkb);
01264 }
01265 }
01266
01267
01268
01269
01270 void NuPIDInterface::GetJmID(const NtpStRecord& ntp,
01271 const NtpSREvent& evt,NuEvent& nu)
01272 {
01273
01274
01275 if (!jmInterface) this->InitialiseJmID(nu);
01276
01277
01278 Msg::LogLevel_t logLevel=Msg::kDebug;
01279
01280
01281 TDirectory* tmpd = gDirectory;
01282 MSG("NuPIDInterface",Msg::kDebug)
01283 <<"TDirectory before GetJmID is:"<<endl;
01284
01285
01286
01287 static Bool_t jm_pass=false;
01288 static Int_t lastSnarl=-999;
01289 MAXMSG("NuPIDInterface",logLevel,100)
01290 <<"lastSnarl="<<lastSnarl<<", nu.entry="<<nu.entry<<endl;
01291 if (nu.entry!=lastSnarl) {
01292 MAXMSG("NuPIDInterface",logLevel,50)
01293 <<"NuPIDInterface::GetJmID FillSnarl..."<<endl;
01294 jm_pass=jmInterface->FillSnarl(const_cast<NtpStRecord*>(&ntp));
01295 }
01296 lastSnarl=nu.entry;
01297
01298 if (jm_pass) {
01299
01300 this->GetJmIDEvt(evt,nu);
01301 this->GetJmIDPrimaryTrk(ntp,evt,nu);
01302 this->GetJmIDSecondTrk(ntp,evt,nu);
01303 this->GetJmIDThirdTrk(ntp,evt,nu);
01304 }
01305 else {
01306 MAXMSG("NuPIDInterface",Msg::kWarning,100)
01307 <<"Event did not pass JM ID FillSnarl"<<endl;
01308 }
01309
01310
01311
01312
01313
01314
01315 nu.jmID=nu.jmIDEvt;
01316 nu.jmTrackPlane=nu.jmTrackPlaneEvt;
01317 nu.jmMeanPh=nu.jmMeanPhEvt;
01318 nu.jmEndPh=nu.jmEndPhEvt;
01319 nu.jmScatteringU=nu.jmScatteringUEvt;
01320 nu.jmScatteringV=nu.jmScatteringVEvt;
01321 nu.jmScatteringUV=nu.jmScatteringUVEvt;
01322 nu.jmEventknnID=nu.jmEventknnIDEvt;
01323 nu.jmEventknn208=nu.jmEventknn208Evt;
01324 nu.jmEventknn207=nu.jmEventknn207Evt;
01325 nu.jmEventknn206=nu.jmEventknn206Evt;
01326 nu.jmEventknn205=nu.jmEventknn205Evt;
01327 nu.jmEventknn204=nu.jmEventknn204Evt;
01328
01329 gDirectory=tmpd;
01330
01331
01332 }
01333
01334
01335
01336 void NuPIDInterface::GetJmIDEvt(const NtpSREvent& evt,
01337 NuEvent& nu) const
01338 {
01339 if (!jmInterface) {
01340 MSG("NuPIDInterface",Msg::kError)
01341 <<"NuPIDInterface: jmInterface not initialised = "<<jmInterface
01342 <<endl<<"Will assert here..."<<endl;
01343 assert(false);
01344 }
01345
01346 NtpSREvent* pevt=const_cast<NtpSREvent*>(&evt);
01347
01348
01349 nu.jmIDEvt= jmInterface->GetVar("shortid",pevt);
01350 nu.jmTrackPlaneEvt= jmInterface->GetVar("ntrkpl" ,pevt);
01351 nu.jmMeanPhEvt= jmInterface->GetVar("meanph" ,pevt);
01352 nu.jmEndPhEvt= jmInterface->GetVar("endph" ,pevt);
01353 nu.jmScatteringUEvt= jmInterface->GetVar("scatu" ,pevt);
01354 nu.jmScatteringVEvt= jmInterface->GetVar("scatv" ,pevt);
01355 nu.jmScatteringUVEvt= jmInterface->GetVar("scatuv" ,pevt);
01356 nu.jmEventknnIDEvt= jmInterface->GetVar("evtid" ,pevt);
01357 nu.jmEventknn208Evt=jmInterface->GetVar("evt208" ,pevt);
01358 nu.jmEventknn207Evt=jmInterface->GetVar("evt207" ,pevt);
01359 nu.jmEventknn206Evt=jmInterface->GetVar("evt206" ,pevt);
01360 nu.jmEventknn205Evt=jmInterface->GetVar("evt205" ,pevt);
01361 nu.jmEventknn204Evt=jmInterface->GetVar("evt204" ,pevt);
01362
01363 }
01364
01365
01366
01367 void NuPIDInterface::GetJmIDPrimaryTrk(const NtpStRecord& ntp,
01368 const NtpSREvent& evt,
01369 NuEvent& nu) const
01370 {
01371 if (!jmInterface) {
01372 MSG("NuPIDInterface",Msg::kError)
01373 <<"NuPIDInterface: jmInterface not initialised = "<<jmInterface
01374 <<endl<<"Will assert here..."<<endl;
01375 assert(false);
01376 }
01377
01378 const NuLibrary& lib=NuLibrary::Instance();
01379
01380
01381 const NtpSRTrack* ptrk=lib.reco.GetTrackWithIndexX(ntp,evt,0);
01382
01383
01384 if (ptrk) {
01385
01386 NtpSRTrack* ptrkb=const_cast<NtpSRTrack*>(ptrk);
01387
01388 nu.jmID1=jmInterface->GetVar("shortid",ptrkb);
01389 nu.jmTrackPlane1=jmInterface->GetVar("ntrkpl",ptrkb);
01390 nu.jmMeanPh1=jmInterface->GetVar("meanph",ptrkb);
01391 nu.jmEndPh1=jmInterface->GetVar("endph",ptrkb);
01392 nu.jmScatteringU1=jmInterface->GetVar("scatu",ptrkb);
01393 nu.jmScatteringV1=jmInterface->GetVar("scatv",ptrkb);
01394 }
01395 }
01396
01397
01398
01399 void NuPIDInterface::GetJmIDSecondTrk(const NtpStRecord& ntp,
01400 const NtpSREvent& evt,
01401 NuEvent& nu) const
01402 {
01403 if (!jmInterface) {
01404 MSG("NuPIDInterface",Msg::kError)
01405 <<"NuPIDInterface: jmInterface not initialised = "<<jmInterface
01406 <<endl<<"Will assert here..."<<endl;
01407 assert(false);
01408 }
01409
01410
01411 const NuLibrary& lib=NuLibrary::Instance();
01412
01413
01414 const NtpSRTrack* ptrk=lib.reco.GetTrackWithIndexX(ntp,evt,1);
01415
01416
01417 if (ptrk) {
01418
01419 NtpSRTrack* ptrkb=const_cast<NtpSRTrack*>(ptrk);
01420
01421 nu.jmID2=jmInterface->GetVar("shortid",ptrkb);
01422 nu.jmTrackPlane2=jmInterface->GetVar("ntrkpl",ptrkb);
01423 nu.jmMeanPh2=jmInterface->GetVar("meanph",ptrkb);
01424 nu.jmEndPh2=jmInterface->GetVar("endph",ptrkb);
01425 nu.jmScatteringU2=jmInterface->GetVar("scatu",ptrkb);
01426 nu.jmScatteringV2=jmInterface->GetVar("scatv",ptrkb);
01427 }
01428 }
01429
01430
01431
01432 void NuPIDInterface::GetJmIDThirdTrk(const NtpStRecord& ntp,
01433 const NtpSREvent& evt,
01434 NuEvent& nu) const
01435 {
01436 if (!jmInterface) {
01437 MSG("NuPIDInterface",Msg::kError)
01438 <<"NuPIDInterface: jmInterface not initialised = "<<jmInterface
01439 <<endl<<"Will assert here..."<<endl;
01440 assert(false);
01441 }
01442
01443
01444 const NuLibrary& lib=NuLibrary::Instance();
01445
01446
01447 const NtpSRTrack* ptrk=lib.reco.GetTrackWithIndexX(ntp,evt,2);
01448
01449
01450 if (ptrk) {
01451
01452 NtpSRTrack* ptrkb=const_cast<NtpSRTrack*>(ptrk);
01453 nu.jmID3=jmInterface->GetVar("shortid",ptrkb);
01454 nu.jmTrackPlane3=jmInterface->GetVar("ntrkpl",ptrkb);
01455 nu.jmMeanPh3=jmInterface->GetVar("meanph",ptrkb);
01456 nu.jmEndPh3=jmInterface->GetVar("endph",ptrkb);
01457 nu.jmScatteringU3=jmInterface->GetVar("scatu",ptrkb);
01458 nu.jmScatteringV3=jmInterface->GetVar("scatv",ptrkb);
01459
01460 }
01461 }
01462
01463 Registry* NuPIDInterface::SubReg_FillkNN(int k, int keybase, int keytrue, string keylist, string shortknn, string usetrack)
01464 {
01465 Registry *kreg = new Registry(false);
01466
01467 kreg -> Set("PrintConfig", "yes");
01468 kreg -> Set("AlgSnarlName", "FillkNN");
01469 kreg -> Set("FillkNNKeySignal", int(1));
01470 kreg -> Set("FillkNNKNeighbor", k);
01471 kreg -> Set("FillkNNKNeighborMod", int(5));
01472 kreg -> Set("FillkNNAddEvent", "no");
01473 kreg -> Set("FillkNNUseTrack", usetrack.c_str());
01474 kreg -> Set("FillkNNTrim", "yes");
01475 kreg -> Set("FillkNNTrimDelta", int(1000));
01476 kreg -> Set("FillkNNFilePath", shortknn.c_str());
01477 kreg -> Set("FillkNNKeyTruth", keytrue);
01478 kreg -> Set("FillkNNKeyBase", keybase);
01479 kreg -> Set("FillkNNKeyList", keylist.c_str());
01480 kreg -> Set("FillShortEventKeyPass",14001);
01481 kreg -> Set("FillShortEventKeyPass2",14001);
01482 kreg -> Set("FillkNN", "no");
01483
01484 return kreg;
01485 }
01486
01487
01488
01489 void NuPIDInterface::GetRoIDNuMuBar(const NtpStRecord& ntp,
01490 const NtpSREvent& evt,NuEvent& nu)
01491 {
01492
01493 if (!roInterface) this->InitialiseRoIDNuMuBar(nu);
01494
01495
01496 static Bool_t ro_pass=false;
01497 static Int_t lastSnarl=-999;
01498 MAXMSG("NuPIDInterface",Msg::kDebug,200)
01499 <<"lastSnarl="<<lastSnarl<<", nu.entry="<<nu.entry<<endl;
01500 if (nu.entry!=lastSnarl) {
01501 MAXMSG("NuPIDInterface",Msg::kDebug,200)
01502 <<"NuPIDInterface::GetRoID FillSnarl..."<<endl;
01503 ro_pass=roInterface->FillSnarl(const_cast<NtpStRecord*>(&ntp));
01504 }
01505 lastSnarl=nu.entry;
01506
01507 Float_t roIDNuMuBar=0;
01508 Float_t relativeAngle=-999;
01509
01510 Bool_t got5524=false;
01511 Bool_t got5533=false;
01512
01513 if (ro_pass) {
01514 map<short, float> romap=roInterface->GetData
01515 (const_cast<NtpSREvent*>(&evt));
01516
01517 MAXMSG("NuPIDInterface",Msg::kDebug,200)
01518 <<"NuPIDInterface: Looping over key/value pairs..."<<endl;
01519
01520
01521 for (map<short,float>::const_iterator rit=romap.begin();
01522 rit!=romap.end(); ++rit) {
01523 Int_t key=0;
01524 Float_t val=0;
01525 key=rit->first;
01526 val=rit->second;
01527
01528 MAXMSG("NuPIDInterface",Msg::kDebug,100)
01529 <<"key="<<key<<", val="<<val<<endl;
01530
01531 if (key==5524) {
01532 roIDNuMuBar=val;
01533 got5524=true;
01534 }
01535
01536 if (key==5533) {
01537 relativeAngle=val;
01538 got5533=true;
01539 }
01540
01541 if (got5524 && got5533) {
01542 break;
01543 }
01544
01545 }
01546 }
01547 else {
01548 MAXMSG("NuPIDInterface",Msg::kWarning,100)
01549 <<"Event did not pass RO ID"<<endl;
01550 }
01551
01552 nu.roIDNuMuBar=roIDNuMuBar;
01553 nu.relativeAngle=relativeAngle;
01554 }
01555
01556
01557
01558 void NuPIDInterface::GetDpID(const NtpStRecord& ntp,
01559 const NtpSREvent& ,NuEvent& nu)
01560 {
01561
01562 if (!dpID) this->InitialiseDpID(nu);
01563
01564
01565 mad->SetEntry(&ntp);
01566
01567
01568 nu.dpID=dpID->CalcPID(mad,nu.evt,0);
01569 }
01570
01571
01572
01573 void NuPIDInterface::PrintReleaseTypeEtc(const NuEvent& nu) const
01574 {
01575 MSG("NuPIDInterface",Msg::kInfo)
01576 <<"ReleaseType="
01577 <<NuUtilities::PrintRelease(nu.releaseType)
01578 <<", detector="<<Detector::AsString
01579 (static_cast<Detector::Detector_t>(nu.detector))<<endl;
01580 }
01581
01582
01583