58 #include <TCollection.h> 62 #include <genieStyle.C> 66 size_t f = in.find_first_not_of(
' ',0);
67 size_t l = in.find_last_not_of(
' ',0);
69 in = in.substr(f,l-f-1);
92 DataFile(
string dname,
string dtitle);
93 DataFile(
string dtype,
string dir,
string ddname,
string dtitle,
string dcols,
string dcut,
double ddcth,
int dcolor);
109 DataFile::DataFile(
string dtype,
string ddir,
string ddname,
string dtitle,
string dcols,
string dcut,
double ddcth,
int dcolor){
124 stringstream convert;
128 bool success =
false;
132 if(
gType.compare(
"XS")==0){
133 TNtuple newData (
"newData",
"",
cols.c_str() );
134 newData.ReadFile(
name.c_str());
135 cout<<
"TNtuple created"<<endl;
142 if(pos != string::npos){
145 type.assign(
"ginuke");
156 type.assign(
"chain");
169 cout<<
name.c_str()<<
" was not found. Skipping [GENIE] tag."<<endl;
175 TChain chain(
"ginuke");
176 TChain*
dummy = &chain;
179 cout<<
"Making a chain called "<<n<<endl;
180 chain.Add(n.c_str());
181 cout<<
"Chain created."<<endl;
183 cout<<
"dummy cloned"<<endl;
192 if(
gType.compare(
"Energy")==0){
193 if(nCol==3){
dataTree->ReadFile(
name.c_str(),
"E/D:xsec:err1");}
194 else if(nCol==2){
dataTree->ReadFile(
name.c_str(),
"E/D:xsec");}
195 else{
cout<<
"Published data file has an unrecognized format."<<endl;
198 if(
gType.compare(
"Momentum")==0){
199 if(nCol==3){
dataTree->ReadFile(
name.c_str(),
"ph/D:xsec:err1");}
200 else if(nCol==2){
dataTree->ReadFile(
name.c_str(),
"ph/D:xsec");}
201 else{
cout<<
"Published data file has an unrecognized format."<<endl;
204 if(
gType.compare(
"Angle")==0){
205 if(nCol==3){
dataTree->ReadFile(
name.c_str(),
"cth/D:xsec:err1");}
206 else if(nCol==2){
dataTree->ReadFile(
name.c_str(),
"cth/D:xsec");}
207 else{
cout<<
"Published data file has an unrecognized format."<<endl;
224 if(dataStream.is_open()){
225 getline(dataStream,line);
228 getline(dataStream,line);
230 size_t begin = line.find(
" ",0);
231 size_t end = line.find_first_not_of(
" ",begin);
232 size_t again = line.find(
" ",end);
233 if(again!=string::npos){
268 int numOfType(
string type);
278 for(i=0;i<dataSource.size();i++){
279 if(dataSource[i].
compare(type)==0){
302 ifstream formatStream(fFile.c_str(),
ios::in);
304 vector<string> tokens;
306 if(formatStream.is_open()){
310 while(i<record && formatStream.eof()==
false){
311 getline(formatStream,line);
314 size_t open = line.find_first_of(
'[',0);
315 if(open!=string::npos){
316 size_t close = line.find_first_of(
']',0);
318 cout<<
"Malformed Tag on following line"<<endl;
319 cout<<
" "<<line<<endl;
324 string curTag = line.substr(open+1,close-open-1);
325 if(curTag.compare(
"RECORD")==0){
333 cout<<
"Record "<<record<<
" found, processing."<<endl;
340 while(good ==
true && curTag.compare(
"RECORD")!=0 && formatStream.eof()==
false){
341 getline(formatStream,line);
345 size_t open = line.find_first_of(
'[',0);
346 if(open!=string::npos){
347 size_t close = line.find_first_of(
']',0);
348 curTag = line.substr(open+1,close-open-1);
352 if(curTag.compare(
"PROCESS")==0){
355 size_t commaPos = line.find_first_of(
',',0);
356 xl = line.substr(0,commaPos);
357 size_t nextPos = line.find_first_of(
',',commaPos+1);
358 xu = line.substr(commaPos+1,nextPos-commaPos-1);
360 nextPos = line.find_first_of(
',',commaPos+1);
361 yl = line.substr(commaPos+1,nextPos-commaPos-1);
363 nextPos = line.find_first_of(
',',commaPos+1);
364 yu = line.substr(commaPos+1,nextPos-commaPos-1);
366 if(depth==2){
type = line;}
367 if(depth==3){mtitle = line;}
368 if(depth==4){savename = line;}
371 iss.str(line); iss.clear();
375 else if(curTag.compare(
"GENIE")==0){
376 if(depth==0){dataSource.push_back(curTag);}
377 if(depth==1){fileNames.push_back(line);}
378 if(depth==2){
cols.push_back(line);}
379 if(depth==3){cuts.push_back(line);}
382 iss.str(line); iss.clear();
385 dcths.push_back(val);
387 if(depth==5){titles.push_back(line);}
389 else if(curTag.compare(
"EXPERIMENTAL")==0){
390 if(depth==0){dataSource.push_back(curTag);}
391 if(depth==1){fileNames.push_back(line);}
395 if(
type.compare(
"XS")!=0){
399 cols.push_back(line);
401 if(depth==3){titles.push_back(line);}
402 if(depth==4){cuts.push_back(line);}
404 else if(curTag.compare(
"RECORD")!=0){
406 cout<<
"Bad Tag: " <<line<<endl;
412 if(
type.compare(
"Angle")!=0){
413 cout<<
"Nonangular distribution"<<endl;
414 if(yu[0] ==
'-'){logy =
true; yu = yu.substr(1);}
415 if(yl[0] ==
'-'){logy =
true; yl = yl.substr(1);}
416 if(xu[0] ==
'-'){logx =
true; xu = xu.substr(1);}
417 if(xl[0] ==
'-'){logx =
true; xl = xl.substr(1);}
428 while(num <= which && i < dataSource.size()){
429 if(dataSource[i].
compare(source)==0){ num++; }
435 if(this->
type.compare(
"Angle")==0){
438 else if(this->
type.compare(
"Momentum")==0||this->
type.compare(
"XS")==0){
458 int rootgINukeVal(
char* fFile,
char* dataDir =
".",
char* ROOTDir =
".",
char* saveDir=
".")
460 string tFile (fFile);
461 string dDir (dataDir);
468 bool doCurrent =
false;
469 doCurrent = format.
process(curRecord);
470 if(doCurrent ==
false){
473 cout<<
"Format File not found"<<endl;
476 while(doCurrent ==
true){
477 cout<<format.
numOfType(
"GENIE")<<
" root files and "<<format.
numOfType(
"EXPERIMENTAL")<<
" published data files "<<endl;
480 stringstream convert;
494 Double_t xl, yl, xu, yu;
495 convert.str(format.
xl); convert.clear();
497 convert.str(format.
yl); convert.clear();
499 convert.str(format.
xu); convert.clear();
501 convert.str(format.
yu); convert.clear();
506 canName.assign(curRecord,
'*');
507 cans=
new TCanvas(canName.c_str(),format.
fetchGTitle().c_str());
510 if(format.
logx==
true){gPad->SetLogx(1);}
511 if(format.
logy==
true){gPad->SetLogy(1);}
514 y1 = 1.05-(.075*legendSize);
516 TLegend*
leg1 =
new TLegend(.52,y1,1,1,
"");
517 leg1->SetTextSize(TextSize);
521 TH1F* hf1 = (TH1F*) cans->DrawFrame(xl,yl,xu,yu);
522 hf1->SetTitle(format.
mtitle.c_str());
523 if(format.
type.compare(
"Angle")==0){
524 hf1->GetXaxis()->SetTitle(
"cos(#theta)");
525 hf1->GetYaxis()->SetTitle(
"#frac{d#sigma}{d#Omega} [#frac{mb}{sr}]");
527 else if(format.
type.compare(
"Momentum")==0){
528 hf1->GetXaxis()->SetTitle(
"Momentum [Mev]");
529 hf1->GetYaxis()->SetTitle(
"#frac{d#sigma}{dp} [#frac{mb}{MeV}]");
531 else if(format.
type.compare(
"XS")==0){
532 hf1->GetXaxis()->SetTitle(
"Energy [MeV]");
533 hf1->GetYaxis()->SetTitle(
"#sigma (mb)");
536 hf1->GetXaxis()->SetTitle(
"Energy [MeV]");
537 hf1->GetYaxis()->SetTitle(
"#frac{d#sigma}{d#OmegadE} [#frac{mb}{sr#upointMev}]");
540 hf1->GetYaxis()->CenterTitle();
545 int numRoots = format.
numOfType(
"GENIE");
550 for(k=0;k<numRoots;k++){
552 if(format.
type.compare(
"XS")==0){
555 int curCol = simData->
color;
556 simData->
dataTuple->SetMarkerColor(curCol);
557 simData->
dataTuple->SetMarkerStyle(markerStyle);
560 simData->
dataTuple->SetLineColor(curCol);
561 cout<<
"About to draw tuple"<<endl;
563 cout<<simData->
cut.c_str()<<endl;
564 simData->
dataTuple->Draw(simData->
cut.c_str(),
"",
"line psame L");
566 cout<<
"Tuple drawn"<<endl;
569 TCanvas* tempVas =
new TCanvas(
"tempName",
"No title");
572 string newCut = simData->
cut;
573 newCut = newCut +
"&&"+simData->
cols+
"<="+format.
xu;
574 newCut = newCut +
"&&"+simData->
cols+
">"+format.
xl;
575 simData->
dataTree->Draw(simData->
cols.c_str(),newCut.c_str(),
"L");
577 if(simData->
valid()){
580 htemp = (TH1F*) gPad->GetPrimitive(
"htemp");
587 hist1 = (TH1F*) htemp->Clone(
"hist1");
588 size = hist1->GetBinWidth(1);
591 num = simData->
dataTree->GetEntries();
592 simData->
dataTree->SetBranchAddress(
"tgt",&target);
594 A = (target/10) - (target/10000)*1000;
595 factor = TMath::Power(3*1.4*TMath::Power(A,(1.0/3.0)),2)*10.0/(2*num*simData->
dcth);
596 hist1->Scale(factor,
"width");
597 int curCol = simData->
color;
598 hist1->SetMarkerColor(curCol);
599 hist1->SetMarkerStyle(markerStyle);
601 hist1->SetLineStyle(2);
602 hist1->SetLineColor(curCol);
605 cout<<
"Nothing was found in the cut of "<<simData->
filename<<endl;
611 leg1->AddEntry(hist1,simData->
title.c_str());
612 hist1->DrawCopy(
"e1 psame");
613 hist1->Draw(
"hist l same");
616 hist1error = (TH1F*) hist1->Clone(
"hist1error");
617 hist1error->SetLineStyle(1);
618 hist1error->DrawCopy(
"e1 same");
622 cout<<
"Something is wrong with data file "<<simData->
filename<<endl;
633 int numFiles = format.
numOfType(
"EXPERIMENTAL");
658 for(j=0;j<numFiles;j++){
661 if(format.
type.compare(
"XS")==0){
662 experimental->
dataTuple->Draw(experimental->
cut.c_str(),
"",
"goff");
666 experimental->
dataTree->Draw(experimental->
cols.c_str(),
"",
"goff");
667 data1 =
new TGraphErrors(experimental->
dataTree->GetSelectedRows(),experimental->
dataTree->GetV2(), experimental->
dataTree->GetV1(),0,experimental->
dataTree->GetV3());
669 data1->SetLineStyle(3);
670 data1->SetMarkerColor(experimental->
color);
671 data1->SetMarkerStyle(markerStyle);
673 leg1->AddEntry(data1,experimental->
title.c_str(),
"P");
674 data1->Draw(
"p same");
681 leg1->SetLineWidth(2);
687 string saveName(saveDir);
688 saveName = saveName+
"/"+format.
savename+
".png";
689 cans->SaveAs(saveName.c_str());
693 cout<<
"\nLooking for next record:"<<endl;
694 doCurrent = format.
process(curRecord);
696 cout<<
"No more records found, exiting"<<endl;
art art Framework Principal Run temp
int compare(unsigned *r, sha1::digest_t const &d)
the ParameterSet object passed in for the configuration of a destination should be the only source that can affect the behavior of that destination This is to eliminate the dependencies of configuring a destination from multiple mostly from the defaults It suppresses possible glitches about changing the configuration file somewhere outside of a destination segament might still affect the behavior of that destination In the previous configuration for a specific the value of a certain e may come from following source
the ParameterSet object passed in for the configuration of a destination should be the only source that can affect the behavior of that destination This is to eliminate the dependencies of configuring a destination from multiple mostly from the defaults It suppresses possible glitches about changing the configuration file somewhere outside of a destination segament might still affect the behavior of that destination In the previous configuration for a specific the value of a certain e may come from following and have been suppressed It the configuring ParameterSet object for each destination will be required to carry a parameter list as complete as possible If a parameter still cannot be found in the ParameterSet the configuration code will go look for a hardwired default directly The model is a great simplicity comparing with the previous especially when looking for default values Another great advantage is most of the parameters now have very limited places that allows to appear Usually they can only appear at one certain level in a configuration file For in the old configuring model or in a default ParameterSet object inside of a or in a category or in a severity object This layout of multiple sources for a single parameter brings great confusion in both writing a configuration and in processing the configuration file Under the new the only allowed place for the parameter limit to appear is inside of a category which is inside of a destination object Other improvements simplify the meaning of a destination name In the old a destination name has multiple folds of meanings the e cout and cerr have the special meaning of logging messages to standard output or standard error the name also serves as the output filename if the destination is a file these names are also references to look up for detailed configurations in configuring the MessageFacility The multi purpose of the destination name might cause some unwanted behavior in either writing or parsing the configuration file To amend in the new model the destination name is now merely a name for a which might represent the literal purpose of this or just an id All other meanings of the destinations names now go into the destination ParameterSet as individual such as the type parameter and filename parameter Following is the deatiled rule for the new configuring Everything that is related with MessageFacility configuration must be wrapped in a single ParameterSet object with the name MessageFacility The MessageFacility ParameterSet object contains a series of top level parameters These parameters can be chosen a vector of string listing the name of debug enabled models Or use *to enable debug messages in all modules a vector of string a vector of string a vector of string a ParameterSet object containing the list of all destinations The destinations ParameterSet object is a combination of ParameterSet objects for individual destinations There are two types of destinations that you can insert in the destinations ParameterSet ordinary including cout
auto begin(Data< Value > const &data)
these are called *plugin *libraries Plugin libraries are loaded by the *LibraryManager *see above The source file in which a module is implemented must be named< module > _plugin cc It must contain an invocation of the *DEFINE_EDM_PLUGIN *macro The *DEFINE_EDM_PLUGIN *macro is responsible for writing the appropriate *factory **function and that takes a const reference to a *ParameterSet *and that returns a newly created instance of the associated module type
int rootgINukeVal(char *fFile, char *dataDir=".", char *ROOTDir=".", char *saveDir=".")
auto end(Data< Value > const &data)
This add method has three it adds this message xid and id to the appropriate and it updates the dynamic information in counts The sequence is as the static apppropriate and timespan will be in the mapped CountAndLimit and there will be no need to recompute them If this xid is not yet in see if the category is in limits if the appropriate counts struct can be formed by using the precedence rules above to combine the limit and interval found in limits along with the severityLimits and severityIntervals arrays found in the ELlimitsTable Along the way the limits map for this category is filled in
static std::string format(PyObject *obj, unsigned int pos, unsigned int indent, unsigned int maxlen)
cet::LibraryManager dummy("noplugin")