void MDEventWSWrapper::createEmptyEventWS(const Strings &targ_dim_names,const Strings &targ_dim_ID,const Strings &targ_dim_units, const std::vector<double> &dimMin, const std::vector<double> &dimMax,const std::vector<size_t> &numBins) { boost::shared_ptr<MDEvents::MDEventWorkspace<MDEvents::MDEvent<nd>,nd> > ws = boost::shared_ptr<MDEvents::MDEventWorkspace<MDEvents::MDEvent<nd>, nd> >(new MDEvents::MDEventWorkspace<MDEvents::MDEvent<nd>, nd>()); size_t nBins(10); // Give all the dimensions for (size_t d=0; d<nd; d++) { if(!numBins.empty()) nBins=numBins[d]; Geometry::MDHistoDimension * dim = new Geometry::MDHistoDimension(targ_dim_names[d], targ_dim_ID[d], targ_dim_units[d], coord_t(dimMin[d]), coord_t(dimMax[d]), nBins); ws->addDimension(Geometry::MDHistoDimension_sptr(dim)); } ws->initialize(); // Build up the box controller // bc = ws->getBoxController(); // Build up the box controller, using the properties in BoxControllerSettingsAlgorithm // this->setBoxController(bc); // We always want the box to be split (it will reject bad ones) //ws->splitBox(); m_Workspace = ws; }
void MDEventWSWrapper::createEmptyEventWS(const MDWSDescription &description) { boost::shared_ptr<DataObjects::MDEventWorkspace<DataObjects::MDEvent<nd>, nd>> ws = boost::shared_ptr< DataObjects::MDEventWorkspace<DataObjects::MDEvent<nd>, nd>>( new DataObjects::MDEventWorkspace<DataObjects::MDEvent<nd>, nd>()); auto numBins = description.getNBins(); size_t nBins(10); // HACK. this means we have 10 bins artificially. This can't // be right. // Give all the dimensions for (size_t d = 0; d < nd; d++) { if (!numBins.empty()) nBins = numBins[d]; Geometry::MDHistoDimension *dim = NULL; if (d < 3 && description.isQ3DMode()) { // We should have frame and scale information that we can use correctly // for our Q dimensions. auto mdFrame = description.getFrame(d); dim = new Geometry::MDHistoDimension( description.getDimNames()[d], description.getDimIDs()[d], *mdFrame, Mantid::coord_t(description.getDimMin()[d]), Mantid::coord_t(description.getDimMax()[d]), nBins); } else { Mantid::Geometry::GeneralFrame frame(description.getDimNames()[d], description.getDimUnits()[d]); dim = new Geometry::MDHistoDimension( description.getDimNames()[d], description.getDimIDs()[d], frame, Mantid::coord_t(description.getDimMin()[d]), Mantid::coord_t(description.getDimMax()[d]), nBins); } ws->addDimension(Geometry::MDHistoDimension_sptr(dim)); } ws->initialize(); m_Workspace = ws; }
//============================================================================= // Standard constructor, initializes variables //============================================================================= void makeplots(TString runmode = "d", TString drawopt = "norm") { gROOT->SetBatch(kTRUE); cout<<endl<<"If you want to use custom parameters, option 'b' for branch, 'c' for cuts,"; cout<<", 'o' to specify the output, or 'f' to select the files and trees to include."<<endl; cout<<"Option 'C' saves canvases as .C files."<<endl; cout<<"The second parameter is the draw option. 'norm' by default."<<endl<<endl; cout<<"This program handles a specified number of variations and generates plots from the files corresponding to these."; cout<<" E.g., year, decay, and filetype would plot stuff from nYears*nDecays*nFileTypes files, labeled accordingly."; cout<<" This is in addition to however many branches and cuts you would like to perform."<<endl<<endl; TString placeholder;//this is to avoid adding strings in functions; assign right before use TString placeholder2; TString response;//this is for user input; assign right before use //default parameters TString outputlocation="./"; TString filename="plots.pdf"; int nFiles=8; vector<TFile*> f(nFiles); TString tuplelocation = "/afs/cern.ch/work/m/mwilkins/b_b-bar_cross-section/"; placeholder = tuplelocation+"Strp20r1_SL_D0andDp_MD.root"; f[0] = TFile::Open(placeholder);//2011 data B-D0 placeholder = tuplelocation+"Strp20r1_SL_D0andDp_MD.root"; f[1] = TFile::Open(placeholder);//2011 data B0D- placeholder = tuplelocation+"Bu_D0Xmunu_cocktail_12873441_MC2011_S20r1_noPID_Tuples.root"; f[2] = TFile::Open(placeholder);//2011 MC B-D0 placeholder = tuplelocation+"Bd_DpXmunu_cocktail_11874401_MC2011_S20r1_noPID_Tuples.root"; f[3] = TFile::Open(placeholder);//2011 MC B0D- placeholder = tuplelocation+"B2DMuNuX_tuples_05082015.root"; f[4] = TFile::Open(placeholder);//2015 data B-D0 placeholder = tuplelocation+"B2DMuNuX_tuples_05082015.root"; f[5] = TFile::Open(placeholder);//2015 data B0D- placeholder = tuplelocation+"Bu_D0Xmunu_cocktail_12873441_MC2015_S22_noPID_Tuples.root"; f[6] = TFile::Open(placeholder);//2015 MC B-D0 placeholder = tuplelocation+"Bd_DpXmunu_cocktail_11874401_MC2015_S22_noPID_Tuples.root"; f[7] = TFile::Open(placeholder);//2015 MC B0D- vector<TString> tree(nFiles); tree[0] = "tupleb2D0Mu/tupleb2D0Mu"; tree[1] = "tupleb2DpMu/tupleb2DpMu"; tree[2] = "Tuple_b2D0MuX/DecayTree"; tree[3] = "Tuple_b2DpMuX/DecayTree"; tree[4] = "Tuple_b2D0MuX/DecayTree"; tree[5] = "Tuple_b2DpMuX/DecayTree"; tree[6] = "Tuple_b2D0MuX/DecayTree"; tree[7] = "Tuple_b2DpMuX/DecayTree"; int nLayers=5;//year, filetype, decay, branch, cuts vector<TString> Lresponse(nLayers); Lresponse[0]="year"; Lresponse[1]="filetype"; Lresponse[2]="decay"; Lresponse[3]="branch"; Lresponse[4]="cut"; vector<int> nL(nLayers); nL[0]=2; nL[1]=2; nL[2]=2; nL[3]=1; nL[4]=1; vector< vector<TString> > L;//L[layer][layerelement] L.resize(nLayers); for(int i=0; i<nLayers; i++) { L[i].resize(nL[i]); } L[0][0]="2011"; L[0][1]="2015"; L[1][0]="data"; L[1][1]="MC"; L[2][0]="B^{-}->(D^{0}->K^{-} #pi^{+})#mu^{-}"; L[2][1]="B^{0}->(D^{-}->K^{+} #pi^{-} #pi^{-})#mu^{+}"; L[3][0]=""; L[4][0]=""; int bL=3;//index corresponding to branch layer int nBranches=1; int cL=4;//index corresponding to cut layer int nCuts=1; vector< vector<TString> > branch;//branch[file][branches] branch.resize(nFiles);//finished resizing below in loop with cut vector vector<int> nBins(nBranches); nBins[0]=131;//these are for nLongTracks vector<int> loBin(nBranches); loBin[0]=0; vector<int> hiBin(nBranches); hiBin[0]=262; vector< vector< vector<TString> > > cut;//cut[file][branch][cuts] cut.resize(nFiles); for(int i=0; i<nFiles; i++) { //resize and fill branch and cut vectors cut[i].resize(nBranches); branch[i].resize(nBranches); for(int j=0; j<nBranches; j++) { cut[i][j].resize(nCuts); branch[i][j]="nLongTracks";//only one branch; same for all these files for(int k=0; k<nCuts; k++) { if(i%2==0) { //since I've listed the files alternating by decay cut[i][j][k]="(B_M>3500)&&(B_M<5000)&&(D_M>1849.84)&&(D_M<1879.84)"; } else { cut[i][j][k]="(B_M>3500)&&(B_M<5000)&&(D_M>1854.61)&&(D_M<1884.61)"; } } } } int nComparisons=1; vector<TString> comparison(nComparisons); comparison[0]="decay"; int nhpc=1; int nCanvases=1; for(int i=0; i<nLayers; i++) { if(i>=(nLayers-nComparisons)) { nhpc*=nL[i];//now we're in the realm of comparisons } else { nCanvases *= nL[i]; } } vector<TString> list(0);//this holds the combinations of things used to describe the files; // keep empty as the combinations are appended in get custom parameters //-----------------------------get custom parameters-----------------------// if(runmode.Contains("o")) { cout<<"Where should the output be stored? (make sure the directory exists; include / at end)"<<endl; cin>>outputlocation; cout<<"What should the output file be called? (include extension, e.g., 'plots.pdf')"<<endl; cin>>filename; }