00001
00018 #include "TMath.h"
00019 #include "NueAna/NuePrint.h"
00020 #include "NueAna/NueRecord.h"
00021 #include "MessageService/MsgService.h"
00022 #include "MinosObjectMap/MomNavigator.h"
00023 #include "MessageService/MsgService.h"
00024 #include "JobControl/JobCModuleRegistry.h"
00025 #include "TClass.h"
00026 #include "TDataType.h"
00027 #include "TDataMember.h"
00028 #include "TRealData.h"
00029 #include "ClassType.h"
00030 #include "AnalysisNtuples/ANtpDefaultValue.h"
00031 #include "Util/UtilString.h"
00032 #include "NueAna/NueRWHelpers.h"
00033
00034 JOBMODULE(NuePrint, "NuePrint",
00035 "Prints ana_nue ntuples for weka/sas analysis");
00036 CVSID("$Id:");
00037
00038 NuePrint::NuePrint():
00039 counter(0),
00040 passcounter(0),
00041 outFilename(""),
00042 outFormat(""),
00043 excludeVars(""),
00044 kHiPlaneTrackCut(25),
00045 kPhProngCut(-1),
00046 kMeuEnergyCut(-1),
00047 kLoPlaneEventCut(-1),
00048 kHiTrackLikeCut(-1),
00049 kLoPhNStripCut(-1),
00050 kLoPhNPlaneCut(-1),
00051 kHiEnergyCut(-1),
00052 kLoEnergyCut(-1),
00053 kHiEnergyShowerCut(-1),
00054 kLoEnergyShowerCut(-1),
00055 kSigClass(2),
00056 kBgNCClass(0),
00057 kBgNumuClass(1),
00058 kBgNutauClass(3),
00059 kBgBnueClass(4),
00060 kSigResCode(1004),
00061 kEmFrac(-1),
00062 outAll(0),
00063 training(0),
00064 recalc(0),
00065 deftrk(0),
00066 kDM2(0.0025),
00067 kTheta23(TMath::Pi()/4.0),
00068 kUE32(0.01),
00069 incFile("")
00070 {
00071
00072 }
00073
00074 NuePrint::~NuePrint()
00075 {
00076
00077 }
00078 JobCResult NuePrint::Ana(const MomNavigator* mom)
00079 {
00080
00081
00082 TObject *obj=0;
00083 TIter objiter = mom->FragmentIter();
00084
00085 TList *varList;
00086 string sepVal, defVal="";
00087 if(outFormat=="WEKA"){ sepVal=","; defVal="?";}
00088 else if(outFormat=="SAS"){ sepVal=" "; defVal="-9999.99";}
00089 else if(outFormat=="SPR"){ sepVal=" "; defVal="-9999.99";}
00090
00091 while((obj=objiter.Next())){
00092
00093
00094 NueRecord *nr = static_cast<NueRecord *>(obj);
00095
00096
00097 if(nr){
00098 MSG("NuePrint",Msg::kDebug)<<"Found a NueRecord in MOM"<<endl;
00099 }
00100 else{
00101 MSG("NuePrint",Msg::kError)<<"Didn't find a NueRecord in MOM"<<endl;
00102 counter++;
00103 continue;
00104 }
00105 MSG("NuePrint",Msg::kDebug)<<"Found a NueRecord "<<nr<<endl;
00106
00107 if(!counter){
00108 varList=GetVarList(nr);
00109 PrintHeader(varList);
00110
00111 }
00112 counter++;
00113
00114 MSG("NuePrint",Msg::kDebug) << nr->GetHeader().GetRun() << " "
00115 << nr->GetHeader().GetSnarl() << " "
00116 << nr->GetHeader().GetEventNo() << " "
00117 << nr->GetHeader().GetEvents()
00118 << " " << outAll << endl;
00119
00120
00121
00122
00123 if (nr->GetHeader().GetEventNo()<0&&!outAll) continue;
00124
00125 if (nr->anainfo.inFiducialVolume != 1&&!outAll) continue;
00126
00127 if (nr->GetHeader().GetVldContext().GetDetector()== Detector::kFar
00128 && nr->anainfo.isFullyContained != 1&&!outAll) continue;
00129 if (nr->GetHeader().GetVldContext().GetDetector()== Detector::kNear
00130 && nr->anainfo.isFullyContained != 1
00131 && nr->anainfo.isFullyContained != -2&&!outAll) continue;
00132
00133 if (nr->srtrack.planes>=kHiPlaneTrackCut&&kHiPlaneTrackCut>=0
00134 &&!outAll) continue;
00135
00136 if(nr->srevent.phMeu>kMeuEnergyCut&&kMeuEnergyCut>=0&&!outAll) continue;
00137
00138 if(TMath::Max(nr->srtrack.pulseHeight,nr->srshower.pulseHeight)
00139 <kPhProngCut&&kPhProngCut>=0&&!outAll) continue;
00140
00141 if (nr->srtrack.trklikePlanes>=kHiTrackLikeCut&&kHiTrackLikeCut>=0
00142 &&!outAll) continue;
00143
00144 if (nr->srevent.planes<kLoPlaneEventCut&&kLoPlaneEventCut>=0
00145 &&!outAll) continue;
00146
00147 if (nr->srevent.phMeu>=kHiEnergyCut
00148 &&kHiEnergyCut>=0&&!outAll) continue;
00149
00150 if (nr->srevent.phMeu<kLoEnergyCut
00151 &&kLoEnergyCut>=0&&!outAll) continue;
00152
00153 if (nr->srevent.phNueGeV>=kHiEnergyShowerCut
00154 &&kHiEnergyShowerCut>=0&&!outAll) continue;
00155
00156 if (nr->srevent.phNueGeV<kLoEnergyShowerCut
00157 &&kLoEnergyShowerCut>=0&&!outAll) continue;
00158
00159 if (nr->shwfit.hiPhStripCount<kLoPhNStripCut
00160 &&kLoPhNStripCut>=0&&!outAll) continue;
00161
00162 if (nr->shwfit.hiPhPlaneCount<kLoPhNPlaneCut
00163 &&kLoPhNPlaneCut>=0&&!outAll) continue;
00164
00165 if(training==1&&(nr->mctrue.fNueClass==kSigClass
00166 ||nr->mctrue.fNueClass==kBgNCClass
00167 ||nr->mctrue.fNueClass==kBgNumuClass
00168 ||nr->mctrue.fNueClass==kBgNutauClass
00169 ||nr->mctrue.fNueClass==kBgBnueClass)) {
00170 MSG("NuePrint",Msg::kDebug) << "matched class" <<endl;}
00171 else if (training==0) {
00172 MSG("NuePrint",Msg::kDebug) << "training = 0, nothing to do " <<endl;}
00173 else{ continue;}
00174 if(nr->mctrue.fNueClass==kSigClass
00175 &&nr->mctrue.resonanceCode>kSigResCode) continue;
00176 if(nr->mctrue.fNueClass==kSigClass
00177 &&nr->mctrue.emShowerFraction<=kEmFrac) continue;
00178
00179
00180 PrintValues(nr,sepVal,defVal);
00181
00182
00183
00184
00185
00186 passcounter++;
00187
00188 }
00189 return JobCResult::kPassed;
00190
00191
00192 }
00193 void NuePrint::BeginJob()
00194 {
00195 MSG("NuePrint",Msg::kDebug)<<"In NuePrint::BeginJob"<<endl;
00196 MSG("NuePrint",Msg::kInfo)<<"Writing out to file: "
00197 << outFilename << endl;
00198
00199 fileOut = new ofstream (outFilename.c_str());
00200
00201 string str=",";
00202
00203 MSG("NuePrint",Msg::kInfo) << "Excluding Vars: " << excludeVars <<endl;
00204 if(excludeVars.find(",")==string::npos) {
00205 excludeVec.push_back(excludeVars);
00206 } else { UtilString::StringTok(excludeVec,excludeVars,str);}
00207
00208 MSG("NuePrint",Msg::kInfo) << excludeVec.size()
00209 << " var: " ;
00210 for(int ivar=0; ivar < (int) excludeVec.size(); ivar++){
00211 MSG("NuePrint",Msg::kInfo) << excludeVec[ivar] << " " ;
00212 }
00213 MSG("NuePrint",Msg::kInfo) << endl;
00214
00215 if(incFile.size()) FillIncludeVec();
00216
00217 MSG("NuePrint",Msg::kInfo) << "Printing all events: " << outAll << endl;
00218 MSG("NuePrint",Msg::kInfo) << "Hiding dummy vars: " << training << endl;
00219 MSG("NuePrint",Msg::kInfo) << "Using Cuts " << endl;
00220 if(kHiPlaneTrackCut>=0)
00221 MSG("NuePrint",Msg::kInfo) << "HiPlaneTrackCut: " << kHiPlaneTrackCut << endl;
00222 if(kPhProngCut>=0)
00223 MSG("NuePrint",Msg::kInfo) << "PhProngCut: " << kPhProngCut << endl;
00224 if(kMeuEnergyCut>=0)
00225 MSG("NuePrint",Msg::kInfo) << "MeuEnergyCut: " << kMeuEnergyCut << endl;
00226 if(kHiTrackLikeCut>=0)
00227 MSG("NuePrint",Msg::kInfo) << "HiTrackLikeCut: " << kHiTrackLikeCut << endl;
00228 if(kLoPlaneEventCut>=0)
00229 MSG("NuePrint",Msg::kInfo) << "LoPlaneEventCut: " << kLoPlaneEventCut << endl;
00230 if(kHiEnergyCut>=0)
00231 MSG("NuePrint",Msg::kInfo) << "HiEnergyCut: " << kHiEnergyCut << endl;
00232 if(kLoEnergyCut>=0)
00233 MSG("NuePrint",Msg::kInfo) << "LoEnergyCut: " << kLoEnergyCut << endl;
00234 if(kHiEnergyShowerCut>=0)
00235 MSG("NuePrint",Msg::kInfo) << "HiEnergyShowerCut: " << kHiEnergyShowerCut << endl;
00236 if(kLoEnergyShowerCut>=0)
00237 MSG("NuePrint",Msg::kInfo) << "LoEnergyShowerCut: " << kLoEnergyShowerCut << endl;
00238 if(kLoPhNStripCut>=0)
00239 MSG("NuePrint",Msg::kInfo) << "LoPhNStripCut: " << kLoPhNStripCut << endl;
00240 if(kLoPhNPlaneCut>=0)
00241 MSG("NuePrint",Msg::kInfo) << "LoPhNPlaneCut: " << kLoPhNPlaneCut << endl;
00242
00243
00244
00245
00246 }
00247 void NuePrint::FillIncludeVec()
00248 {
00249 std::string dumName, dumtype;
00250 Float_t dumstart, dumend;
00251 Int_t dumbins, ivar;
00252 ifstream ins;
00253 ins.open(incFile.c_str());
00254
00255 ivar = 0;
00256
00257
00258 while(!ins.eof()) {
00259 ins>>dumName>>dumstart>>dumend>>dumbins>>dumtype;
00260 if(!ins.eof()){
00261 includeVec.push_back(dumName);
00262
00263
00264 ivar++;
00265 }
00266 }
00267
00268 MSG("NuePrint",Msg::kInfo) << "Using include file: "<< incFile << endl;
00269 MSG("NuePrint",Msg::kInfo) << ivar<<" variables read in"<<endl;
00270
00271 }
00272 void NuePrint::EndJob()
00273 {
00274 MSG("NuePrint",Msg::kInfo)<<"Counter "<<counter<<" passcounter "<<passcounter<<endl;
00275
00276 }
00277 TList * NuePrint::GetVarList(NueRecord *nr){
00278 TClass *cl;
00279 TList *vlist;
00280
00281 cl=nr->IsA();
00282 if (!cl->GetListOfRealData()) cl->BuildRealData(nr);
00283
00284 vlist=cl->GetListOfRealData();
00285 MSG("NuePrint",Msg::kInfo)<<"Total Variables being in NueRecord "
00286 << vlist->GetSize() << endl;
00287
00288 return vlist;
00289 }
00290
00291 void NuePrint::PrintHeader(TList * vlist){
00292 string varName;
00293 TRealData *rd;
00294
00295 TIter next(vlist);
00296 Int_t counter=0;
00297 MSG("NuePrint",Msg::kDebug)<< "Attributes list: ";
00298
00299 if(outFormat=="WEKA")
00300 *fileOut << "@relation nue_output" << endl << endl;
00301
00302 if(outFormat=="SPR"){
00303 *fileOut << "# SPR file definition" << endl;
00304 *fileOut << "nvar"<< endl;
00305 }
00306 while((rd =dynamic_cast<TRealData*>(next()))){
00307 varName=rd->GetName();
00308 if(!IsVarExcluded(varName)){
00309 MSG("NuePrint",Msg::kDebug)<< varName << ",";
00310 if(outFormat=="WEKA"){
00311 *fileOut << "@attribute " << varName << " real" << endl;
00312 }else if(outFormat=="SAS"){
00313 *fileOut << varName << ",";
00314 }else if(outFormat=="SPR"){
00315 *fileOut << varName << " ";
00316 }
00317 counter++;
00318 }
00319 }
00320
00321
00322 if(outFormat=="WEKA"){
00323 *fileOut << "@attribute fHeader.fRun real" <<endl;
00324 *fileOut << "@attribute fHeader.fSubRun real" <<endl;
00325 *fileOut << "@attribute fHeader.fSnarl real" <<endl;
00326 *fileOut << "@attribute fHeader.fEvtNo real" <<endl;
00327 }
00328 else if(outFormat=="SAS"){
00329 *fileOut << "fHeader.fRun,fHeader.fSubRun,fHeader.fSnarl,fHeader.fEvtNo,";
00330 }
00331 else if(outFormat=="SPR"){
00332 *fileOut << "fHeader.fRun fHeader.fSubRun fHeader.fSnarl fHeader.fEvtNo ";
00333 }
00334
00335 if(outFormat=="WEKA"){
00336 *fileOut << "@attribute class {nc,numu,nue,nutau,bnue,empty}" << endl;
00337 }else if(outFormat=="SAS"){
00338 *fileOut << "fHeader.fFileNo" << "," << "weight" << ","<< "class" << endl;
00339 }else if(outFormat=="SPR"){
00340 *fileOut << "fHeader.fFileNo" << endl;
00341 }
00342 MSG("NuePrint",Msg::kDebug)<< "class" << endl;
00343
00344 if(outFormat=="WEKA"){ counter=counter+5; nvar=counter;}
00345 if(outFormat=="SAS"){ counter=counter+7; nvar=counter;}
00346 if(outFormat=="SPR"){ counter=counter+7; nvar=counter;}
00347
00348 MSG("NuePrint",Msg::kInfo)<< "Total vars being used: " << nvar << endl;
00349 if(outFormat=="WEKA")
00350 *fileOut << endl << "@data" << endl;
00351 }
00352
00353 Bool_t NuePrint::IsVarExcluded(std::string &sr){
00354
00355 if(sr=="mctrue.fNueClass") return true;
00356 if(sr=="fHeader.fRun") return true;
00357 if(sr=="fHeader.fSubRun") return true;
00358 if(sr=="fHeader.fSnarl") return true;
00359 if(sr=="fHeader.fEvtNo") return true;
00360
00361 if(sr.find(".")==string::npos) return true;
00362
00363 for(int ivar=0; ivar < (int) excludeVec.size(); ivar++){
00364
00365 if(sr.find(excludeVec[ivar])!=string::npos) return true;
00366 }
00367
00368 if(sr.find("*")!=string::npos) return true;
00369 if(sr.find("fUniqueID")!=string::npos) return true;
00370 if(sr.find("fBits")!=string::npos) return true;
00371 if(sr.find("fTempTags")!=string::npos) return true;
00372 if(sr.find("fData")!=string::npos) return true;
00373 if(sr.find("fVldContext")!=string::npos) return true;
00374 if(sr.find("found")!=string::npos) return true;
00375
00376 if(includeVec.size()>0){
00377 if(IsVarIncluded(sr)) return false;
00378 else return true;
00379 }
00380
00381 return false;
00382 }
00383 Bool_t NuePrint::IsVarIncluded(std::string &sr){
00384
00385
00386
00387
00388 for(int ivar=0; ivar < (int) includeVec.size(); ivar++){
00389
00390 if(sr == includeVec[ivar]) return true;
00391 }
00392 return false;
00393 }
00394 void NuePrint::PrintValues(NueRecord *nr, std::string &sr, std::string &defval){
00395 TClass *cl;
00396 TRealData *rd;
00397 string varName;
00398 TDataMember *member;
00399 TDataType *membertype;
00400 Float_t value;
00401 Int_t fileNo=0;
00402 string classStr;
00403 const char *buffer;
00404 Int_t valrun=0,valsub=0,valsnr=0,valevt=0;
00405 Float_t valweight = 0.;
00406 Int_t ivar=0;
00407 Int_t pvar=0;
00408
00409 cl=nr->IsA();
00410 TIter next(cl->GetListOfRealData());
00411
00412 while ((rd =dynamic_cast<TRealData*>(next()))) {
00413 member = rd->GetDataMember();
00414 membertype = member->GetDataType();
00415 varName=rd->GetName();
00416
00417 Int_t offset = rd->GetThisOffset();
00418 char *pointer = (char*)nr + offset;
00419
00420 if (!IsVarExcluded(varName)) {
00421
00422
00423
00424 value=atof(membertype->AsString(pointer));
00425 ivar++;
00426 MSG("NuePrint",Msg::kDebug)<<member->GetFullTypeName() << " " << varName << " " << value << endl;
00427
00428 if(strcmp(member->GetTypeName(),"Float_t")==0
00429 || strcmp(member->GetTypeName(),"float")==0
00430 || strcmp(member->GetTypeName(),"Double_t")==0
00431 || strcmp(member->GetTypeName(),"double")==0){
00432 if ((ANtpDefVal::IsDefault(value)
00433 || ANtpDefVal::IsDefault(static_cast<Double_t> (value))
00434 || !TMath::Finite(value) || TMath::IsNaN(value) || value>1e+8 )
00435 &&!defval.empty()){
00436 MSG("NuePrint",Msg::kDebug) << "Found default value" << endl;
00437 if(deftrk&&varName.find("srtrack")!=string::npos
00438 &&varName!="srtrack.rangeMomentum"
00439 &&varName!="srtrack.sigmaQoverP"){
00440 *fileOut << deftrk << sr ; pvar++;
00441 }
00442 else{*fileOut << defval << sr ; pvar++;}
00443 }
00444 else if((value>-1e-8&&value<1e-8)&&!varName.find("timeLength")){
00445 value=0.0;
00446 *fileOut << value << sr ; pvar++;
00447 } else {
00448 valweight=1;
00449 if(recalc==1
00450 && varName.find("mctrue.fOscProb")!=string::npos){
00451 MSG("NuePrint",Msg::kDebug)<<" Value in ntuple "
00452 << value << endl;
00453 value=NueRWHelpers::Oscillate(nr->mctrue.nuFlavor
00454 ,nr->mctrue.nonOscNuFlavor
00455 ,nr->mctrue.nonOscNuEnergy
00456 ,735, kDM2, kTheta23
00457 , kUE32);
00458 valweight=value;
00459 MSG("NuePrint",Msg::kDebug)<<" Value of " << varName
00460 <<" after recalc " << value
00461 <<" from "
00462 << nr->mctrue.nuFlavor
00463 << " "
00464 << nr->mctrue.nonOscNuFlavor
00465 << " "
00466 << nr->mctrue.nonOscNuEnergy
00467 << " "
00468 << endl;
00469
00470 }
00471 if(deftrk&&varName.find("srtrack")!=string::npos
00472 &&varName!="srtrack.rangeMomentum"
00473 &&varName!="srtrack.sigmaQoverP"){
00474 *fileOut << deftrk << sr ; pvar++;
00475 }
00476 else{*fileOut << value << sr ; pvar++;}
00477 }
00478 } else if(strcmp(member->GetTypeName(),"Int_t")==0
00479 || strcmp(member->GetTypeName(),"int")==0){
00480 if ((ANtpDefVal::IsDefault(static_cast<Int_t> (value))
00481 || ANtpDefVal::IsDefault(static_cast<Int_t> (value))
00482 || !TMath::Finite(value) || TMath::IsNaN(value))
00483 &&!defval.empty()){
00484 MSG("NuePrint",Msg::kDebug) << "Found default value" << endl;
00485 *fileOut << defval << sr ; pvar++;
00486 }
00487 else {
00488 *fileOut << value << sr ; pvar++;
00489 }
00490 }
00491 else{
00492 MSG("NuePrint",Msg::kError)
00493 << "Problem: you are not taking into account this type: "
00494 <<"Membertype "<< member->GetFullTypeName()
00495 << " VarName " << varName
00496 << " Value " << membertype->AsString(pointer) << endl;
00497
00498 }
00499 MSG("NuePrint",Msg::kDebug)
00500 <<"Membertype "<< member->GetFullTypeName()
00501 << " VarName " << varName
00502 << " Value " << membertype->AsString(pointer) << endl;
00503 }
00504 else if(varName.find("NueClass")!=string::npos){
00505 ivar++;
00506 buffer=membertype->AsString(pointer);
00507 classStr=GetClassLabel(*buffer);
00508 }
00509 else if(varName.find("fHeader.fRun")!=string::npos){
00510 ivar++;
00511 valrun=atoi(membertype->AsString(pointer));
00512 if (outFormat=="SAS" || outFormat=="SPR"){
00513 fileNo=valrun%1000;
00514 ivar++;
00515 }
00516 }
00517 else if(varName.find("fHeader.fSubRun")!=string::npos){
00518 ivar++;
00519 valsub=atoi(membertype->AsString(pointer));
00520 }
00521 else if(varName.find("fHeader.fSnarl")!=string::npos){
00522 ivar++;
00523 valsnr=atoi(membertype->AsString(pointer));
00524 }
00525 else if(varName.find("fHeader.fEvtNo")!=string::npos){
00526 ivar++;
00527 valevt=atoi(membertype->AsString(pointer));
00528 }
00529 }
00530
00531 if(training){
00532 *fileOut << "99999999" << sr << "9" << sr << "9999" << sr << "9" << sr;
00533 pvar=pvar+4;
00534 }
00535 else{
00536 *fileOut << valrun << sr << valsub << sr << valsnr << sr << valevt << sr;
00537 pvar=pvar+4;
00538 }
00539 if (outFormat=="SAS" || outFormat=="SPR"){
00540 if(!training) {*fileOut << fileNo << sr; pvar++;}
00541 else {*fileOut << 9 << sr; pvar++;}
00542 if(recalc==1){*fileOut << valweight << sr; pvar++; ivar++;}
00543 else{*fileOut << 1 << sr; pvar++; ivar++;}
00544 }
00545
00546 *fileOut << classStr; pvar++;
00547 *fileOut << endl;
00548
00549 if(ivar!=nvar||pvar!=nvar) {
00550
00551 MSG("NuePrint",Msg::kError) << " printing less vars than in header"
00552 <<endl;
00553
00554 MSG("NuePrint",Msg::kError) << "Header: " << nvar
00555 << " Not excluded: " << ivar
00556 << " Printed: " << pvar << endl;
00557
00558 }
00559
00560 }
00561 std::string NuePrint::GetClassLabel(const char &str){
00562 string cl;
00563 if(outFormat=="WEKA"){
00564 if(atoi(&str)==ClassType::NC) cl="nc";
00565 else if(atoi(&str)==ClassType::numu) cl="numu";
00566 else if(atoi(&str)==ClassType::nue) cl="nue";
00567 else if(atoi(&str)==ClassType::nutau) cl="nutau";
00568 else if(atoi(&str)==ClassType::bnue) cl="bnue";
00569 else {
00570 MSG("NuePrint",Msg::kWarning) << "Event with no class" << endl;
00571 cl="empty";
00572 }
00573 }else if(outFormat=="SAS"){
00574 if(atoi(&str)==ClassType::NC) cl="ncu";
00575 else if(atoi(&str)==ClassType::numu) cl="num";
00576 else if(atoi(&str)==ClassType::nue) cl="nue";
00577 else if(atoi(&str)==ClassType::nutau) cl="nut";
00578 else if(atoi(&str)==ClassType::bnue) cl="bnu";
00579 else {
00580 MSG("NuePrint",Msg::kWarning) << "Event with no class" << endl;
00581 cl="non";
00582 }
00583 }else if(outFormat=="SPR"&&training){
00584 if(atoi(&str)==ClassType::NC) cl="0";
00585 else if(atoi(&str)==ClassType::numu) cl="0";
00586 else if(atoi(&str)==ClassType::nue) cl="1";
00587 else if(atoi(&str)==ClassType::nutau) cl="0";
00588 else if(atoi(&str)==ClassType::bnue) cl="0";
00589 else {
00590 MSG("NuePrint",Msg::kWarning) << "Event with no class" << endl;
00591 cl="0";
00592 }
00593 }else if(outFormat=="SPR"&&!training){
00594 if(atoi(&str)==ClassType::NC) cl="0";
00595 else if(atoi(&str)==ClassType::numu) cl="1";
00596 else if(atoi(&str)==ClassType::nue) cl="2";
00597 else if(atoi(&str)==ClassType::nutau) cl="3";
00598 else if(atoi(&str)==ClassType::bnue) cl="4";
00599 else {
00600 MSG("NuePrint",Msg::kWarning) << "Event with no class" << endl;
00601 cl="5";
00602 }
00603 }
00604
00605 return cl;
00606
00607 }
00608 const Registry& NuePrint::DefaultConfig() const
00609 {
00610
00611
00612
00613 MSG("NuePrint",Msg::kDebug)<<"In NuePrint::DefaultConfig"<<endl;
00614
00615 static Registry r;
00616
00617
00618 std::string name = this->GetName();
00619 name += ".config.default";
00620 r.SetName(name.c_str());
00621
00622
00623 r.UnLockValues();
00624 r.Set("excludeVars","templates.root");
00625 r.Set("outFilename","training.arff");
00626 r.Set("outFormat","WEKA");
00627 r.Set("includeFile","");
00628
00629
00630 r.Set("HiPlaneTrackCut",25);
00631 r.Set("printAll","0");
00632 r.Set("training","0");
00633 r.Set("recalcOsc",0);
00634 r.Set("defaultTrkVal",0);
00635
00636 r.Set("LoPlaneEventCut",-1);
00637 r.Set("HiTrackLikeCut",-1);
00638 r.Set("LoPhNStripCut",-1);
00639 r.Set("LoPhNPlaneCut",-1);
00640
00641 r.Set("MeuEnergyCut",0.);
00642 r.Set("PhProngCut",0.);
00643
00644 r.Set("HiEnergyCut",-1);
00645 r.Set("LoEnergyCut",-1);
00646 r.Set("HiEnergyShowerCut",-1);
00647 r.Set("LoEnergyShowerCut",-1);
00648
00649 r.Set("SigClass",2);
00650 r.Set("BgNCClass",0);
00651 r.Set("BgNumuClass",1);
00652 r.Set("BgNutauClass",3);
00653 r.Set("BgBnueClass",4);
00654 r.Set("SigResCode",1004);
00655 r.Set("EmFrac",-1);
00656
00657
00658 r.Set("DM2", 0.0025);
00659 r.Set("Theta23", TMath::Pi()/4.0);
00660 r.Set("UE32", 0.01);
00661
00662 r.LockValues();
00663
00664 return r;
00665
00666 }
00667 void NuePrint::Config(const Registry& r)
00668 {
00669
00670
00671
00672 MSG("NuePrint",Msg::kDebug)<<"In NuePrint::Config"<<endl;
00673
00674 const char* tmps;
00675
00676
00677 if(r.Get("excludeVars",tmps)) { excludeVars = tmps;}
00678 if(r.Get("outFilename",tmps)) { outFilename = tmps;}
00679 if(r.Get("outFormat",tmps)) { outFormat = tmps;}
00680 if(r.Get("includeFile",tmps)) {incFile = tmps;}
00681
00682
00683
00684 int imps;
00685 if(r.Get("HiPlaneTrackCut",imps)) { kHiPlaneTrackCut=imps;}
00686 if(r.Get("printAll",imps)) { outAll = imps;}
00687 if(r.Get("training",imps)) { training = imps;}
00688 if(r.Get("recalcOsc",imps)) { recalc = imps;}
00689 if(r.Get("defaultTrkVal",imps)) {deftrk = imps;}
00690
00691 if(r.Get("LoPlaneEventCut",imps)) { kLoPlaneEventCut=imps;}
00692 if(r.Get("HiTrackLikeCut",imps)) { kHiTrackLikeCut=imps;}
00693 if(r.Get("LoPhNStripCut",imps)) { kLoPhNStripCut=imps;}
00694 if(r.Get("LoPhNPlaneCut",imps)) { kLoPhNPlaneCut=imps;}
00695
00696 if(r.Get("SigClass",imps)){kSigClass=imps;}
00697 if(r.Get("BgNCClass",imps)){kBgNCClass=imps;}
00698 if(r.Get("BgNumuClass",imps)){kBgNumuClass=imps;}
00699 if(r.Get("BgNutauClass",imps)){kBgNutauClass=imps;}
00700 if(r.Get("BgBnueClass",imps)){kBgBnueClass=imps;}
00701 if(r.Get("SigResCode",imps)){kSigResCode=imps;}
00702
00703 double fmps;
00704 if(r.Get("MeuEnergyCut",fmps)){ kMeuEnergyCut=fmps; }
00705 if(r.Get("PhProngCut",fmps)){ kPhProngCut=fmps; }
00706
00707 if(r.Get("HiEnergyCut",fmps)) { kHiEnergyCut=fmps;}
00708 if(r.Get("LoEnergyCut",fmps)) { kLoEnergyCut=fmps;}
00709 if(r.Get("HiEnergyShowerCut",fmps)) { kHiEnergyShowerCut=fmps;}
00710 if(r.Get("LoEnergyShowerCut",fmps)) { kLoEnergyShowerCut=fmps;}
00711
00712 if(r.Get("EmFrac",fmps)){kEmFrac=fmps;}
00713
00714 if(r.Get("DM2",fmps)) { kDM2 = fmps;}
00715 if(r.Get("Theta23",fmps)) { kTheta23 = fmps;}
00716 if(r.Get("UE32",fmps)) { kUE32 = fmps;}
00717
00718 }