#include <NtpStEventGrabber.h>
Public Member Functions | |
| NtpStEventGrabber () | |
| ~NtpStEventGrabber () | |
| void | Gather (string filelist, string runlist, string outfile, int doMRCC=0) |
| void | LoadFileList (string filelist) |
| void | LoadRunList (string runlist) |
| void | DoGather () |
| void | SetFastBranchStatus (TChain *c) |
Public Attributes | |
| TFile * | outfile |
| TTree * | outtree |
| TTree * | outtreeMRCC |
| int | counter |
| NtpStRecord * | ntpst |
| NtpMRRecord * | ntpmr |
| vector< string > | filelist |
| vector< int > | filerunlist |
| vector< int > | runlist |
| vector< int > | snarllist |
| vector< int > | eventlist |
| int | doMRCC |
|
|
Definition at line 25 of file NtpStEventGrabber.cxx. References counter, doMRCC, ntpmr, ntpst, outfile, outtree, and outtreeMRCC. 00026 {
00027 outfile=0;
00028 outtree=0;
00029 outtreeMRCC=0;
00030 counter=0;
00031 doMRCC=0;
00032 ntpst=new NtpStRecord();
00033 ntpmr=new NtpMRRecord();
00034 }
|
|
|
Definition at line 38 of file NtpStEventGrabber.cxx. 00039 {}
|
|
|
Definition at line 69 of file NtpStEventGrabber.cxx. References counter, filelist, filerunlist, RecRecordImp< T >::GetHeader(), RecPhysicsHeader::GetSnarl(), ntpmr, ntpst, outtree, outtreeMRCC, run(), runlist, and snarllist. Referenced by Gather(). 00070 {
00071 for(int i=0;i<(int)runlist.size();i++)
00072 {
00073 int run=runlist[i];
00074
00075 string file="";
00076 for(int j=0;j<(int)filerunlist.size();j++)
00077 {
00078 if(filerunlist[j]==run)
00079 {
00080 file=filelist[j];
00081 break;
00082 }
00083 }
00084
00085 TChain * c = new TChain("NtpSt");
00086 TChain *m=0;
00087 if(doMRCC)m = new TChain("NtpMR");
00088
00089 int a = file.find("/pnfs/minos/");
00090
00091 if(a>-1)file=file.substr(11); //cut out /pnfs/minos/
00092
00093 file="dcap://fndca1.fnal.gov:24125/pnfs/fnal.gov/usr/minos/"+file;
00094 printf("%s\n",file.c_str());
00095 c->Add(file.c_str());
00096
00097 if(doMRCC)
00098 {
00099 m->Add(file.c_str());
00100 m->SetBranchAddress("NtpMRRecord",&ntpmr);
00101 }
00102
00103 //TChain::BuildIndex is broken in this version of root (all run/snarl entries are read as 0)
00104 // so do it manually
00105
00106 c->SetBranchStatus("*",0);
00107 c->SetBranchStatus("fHeader.*",1);
00108
00109 map<std::pair<int,int>, int> index;
00110
00111 for(int j=0;c->GetEntry(j);j++)
00112 {
00113 int r=(int)c->GetLeaf("fHeader.fRun")->GetValue();
00114 int s=(int)c->GetLeaf("fHeader.fSnarl")->GetValue();
00115 index[std::pair<int,int>(r,s)]=j;
00116 }
00117 printf("index built\n");
00118
00119 c->SetBranchStatus("*",1);
00120 c->ResetBranchAddresses();
00121 c->SetBranchAddress("NtpStRecord",&ntpst);
00122
00123 while(1)
00124 {
00125 int found=index[std::pair<int,int>(runlist[i],snarllist[i])];
00126 if(found>0)
00127 {
00128 c->GetEntry(found);
00129 outtree->Fill();
00130
00131 if(doMRCC)
00132 {
00133 m->GetEntry(found);
00134 outtreeMRCC->Fill();
00135 }
00136
00137 counter++;
00138
00139 printf("just got snarl %d (%d of %d)\n",ntpst->GetHeader().GetSnarl(),counter,runlist.size());
00140
00141 //do we have more from this file?
00142 if(runlist[i+1]==runlist[i])
00143 i++;
00144 else
00145 break;
00146
00147
00148 }else break;
00149 }
00150
00151
00152
00153
00154 /* c->BuildIndex("fHeader.fRun","fHeader.fSnarl");
00155
00156 while(1)
00157 {
00158 int found=c->GetEntryWithIndex(runlist[i],snarllist[i]);
00159 if(found>0)
00160 {
00161 outtree->Fill();
00162 counter++;
00163
00164 printf("just got snarl %d (%d of %d)\n",ntpst->GetHeader().GetSnarl(),counter,runlist.size());
00165
00166 //do we have more from this file?
00167 if(runlist[i+1]==runlist[i])
00168 i++;
00169 else
00170 break;
00171
00172
00173 }else break;
00174 }
00175
00176
00177 */
00178 // SetFastBranchStatus(c);
00179 /*
00180 for(int k=0;c->GetEntry(k);k++)
00181 {
00182 if(ntpst->GetHeader().GetSnarl()==snarllist[i])
00183 {
00184 // c->SetBranchStatus("*",1);
00185 // c->ResetBranchAddresses();
00186 // c->SetBranchAddress("NtpSt",&ntpst);
00187 // c->GetEntry(k);
00188 //storeit....
00189 outtree->Fill();
00190 counter++;
00191
00192 printf("just got snarl %d (%d of %d)\n",ntpst->GetHeader().GetSnarl(),counter,runlist.size());
00193 // SetFastBranchStatus(c);
00194
00195 //do we have more from this file?
00196 if(runlist[i+1]==runlist[i])
00197 i++;
00198 else
00199 break;
00200
00201
00202 }
00203 }
00204 */
00205
00206
00207
00208
00209 delete c;
00210
00211 }
00212
00213 }
|
|
||||||||||||||||||||
|
Definition at line 41 of file NtpStEventGrabber.cxx. References counter, DoGather(), LoadFileList(), LoadRunList(), ntpmr, ntpst, outfile, outtree, and outtreeMRCC. 00042 {
00043 counter=0;
00044 LoadFileList(filelist);
00045 LoadRunList(runlist);
00046
00047 this->outfile=new TFile(outfile.c_str(),"RECREATE");
00048 outtree=new TTree("NtpSt","NtpSt");
00049 outtree->Branch("NtpSt",&ntpst);
00050
00051 this->doMRCC=doMRCC;
00052 if(doMRCC)
00053 {
00054 outtreeMRCC=new TTree("NtpMR","NtpMR");
00055 outtreeMRCC->Branch("NtpMR",&ntpmr);
00056 }
00057
00058 DoGather();
00059
00060 this->outfile->cd();
00061 outtree->Write();
00062 if(doMRCC)outtreeMRCC->Write();
00063 this->outfile->Close();
00064
00065 printf("got %d of %d\n",counter, this->runlist.size());
00066
00067 }
|
|
|
Definition at line 247 of file NtpStEventGrabber.cxx. References filelist, filerunlist, and run(). Referenced by Gather(). 00248 {
00249 filelist.clear();
00250 filerunlist.clear();
00251
00252 string f="";
00253
00254 ifstream file(fl.c_str());
00255 if(file.is_open())
00256 {
00257 while(!file.eof())
00258 {
00259 getline(file,f);
00260
00261 if(f.length()<2)continue;
00262 filelist.push_back(f);
00263
00264 //extract run
00265 int run=0;
00266
00267 run = atoi(f.substr(f.find_last_of("/")+2,8).c_str());
00268 filerunlist.push_back(run);
00269
00270 // printf("%d %s\n",run,f.c_str());
00271 //
00272 }
00273 file.close();
00274 }
00275
00276 printf("loaded %d file entries\n",filelist.size());
00277
00278 }
|
|
|
Definition at line 282 of file NtpStEventGrabber.cxx. References eventlist, runlist, and snarllist. Referenced by Gather(). 00283 {
00284
00285 runlist.clear();
00286 snarllist.clear();
00287 eventlist.clear();
00288
00289 string f="";
00290
00291 ifstream file(rl.c_str());
00292 if(file.is_open())
00293 {
00294 while(!file.eof())
00295 {
00296 getline(file,f);
00297
00298 if(f.length()<2)continue;
00299 int p1 = f.find(" ");
00300 int p2 = f.find(" ",p1+1);
00301
00302 runlist.push_back(atoi(f.substr(0,p1).c_str()));
00303 snarllist.push_back(atoi(f.substr(p1,p2).c_str()));
00304 eventlist.push_back(atoi(f.substr(p2).c_str()));
00305 }
00306 file.close();
00307 }
00308
00309 printf("loaded %d request entries\n",runlist.size());
00310
00311
00312 }
|
|
|
Definition at line 215 of file NtpStEventGrabber.cxx. 00216 {
00217 c->SetBranchStatus("*",1);
00218 c->SetBranchStatus("evthdr.*",0);
00219 c->SetBranchStatus("vetohdr.*",0);
00220 c->SetBranchStatus("crhdr.*",0);
00221 c->SetBranchStatus("dmxstatus.*",0);
00222 c->SetBranchStatus("detstatus.*",0);
00223 c->SetBranchStatus("calstatus.*",0);
00224 c->SetBranchStatus("dataquality.*",0);
00225 c->SetBranchStatus("mchdr.*",0);
00226 c->SetBranchStatus("photon.*",0);
00227 c->SetBranchStatus("detsim.*",0);
00228 c->SetBranchStatus("vetostp.*",0);
00229 c->SetBranchStatus("vetoexp.*",0);
00230 c->SetBranchStatus("deadchips.*",0);
00231 c->SetBranchStatus("stp.*",0);
00232 c->SetBranchStatus("slc.*",0);
00233 c->SetBranchStatus("clu.*",0);
00234 c->SetBranchStatus("shw.*",0);
00235 c->SetBranchStatus("trk.*",0);
00236 c->SetBranchStatus("evt.*",0);
00237 c->SetBranchStatus("mc.*",0);
00238 c->SetBranchStatus("stdhep.*",0);
00239 c->SetBranchStatus("digihit.*",0);
00240 c->SetBranchStatus("thstp.*",0);
00241 c->SetBranchStatus("thslc.*",0);
00242 c->SetBranchStatus("thshw.*",0);
00243 c->SetBranchStatus("thtrk.*",0);
00244 c->SetBranchStatus("thevt.*",0);
00245 }
|
|
|
Definition at line 42 of file NtpStEventGrabber.h. Referenced by DoGather(), Gather(), and NtpStEventGrabber(). |
|
|
Definition at line 61 of file NtpStEventGrabber.h. Referenced by NtpStEventGrabber(). |
|
|
Definition at line 53 of file NtpStEventGrabber.h. Referenced by LoadRunList(). |
|
|
Definition at line 48 of file NtpStEventGrabber.h. Referenced by DoGather(), and LoadFileList(). |
|
|
Definition at line 49 of file NtpStEventGrabber.h. Referenced by DoGather(), and LoadFileList(). |
|
|
Definition at line 46 of file NtpStEventGrabber.h. Referenced by DoGather(), Gather(), and NtpStEventGrabber(). |
|
|
Definition at line 45 of file NtpStEventGrabber.h. Referenced by DoGather(), Gather(), and NtpStEventGrabber(). |
|
|
Definition at line 38 of file NtpStEventGrabber.h. Referenced by NtpStEventGrabber(). |
|
|
Definition at line 39 of file NtpStEventGrabber.h. Referenced by DoGather(), Gather(), and NtpStEventGrabber(). |
|
|
Definition at line 40 of file NtpStEventGrabber.h. Referenced by DoGather(), Gather(), and NtpStEventGrabber(). |
|
|
Definition at line 51 of file NtpStEventGrabber.h. Referenced by DoGather(), and LoadRunList(). |
|
|
Definition at line 52 of file NtpStEventGrabber.h. Referenced by DoGather(), and LoadRunList(). |
1.3.9.1