10 #include "KVDP2toIDGridConvertor.h"
14 #include "KVIDGridManager.h"
56 if (!fGridClass)
KVError::Error(
this,
"SetGridClass()",
"Unknown grid class %s", cl);
67 if (fGrids) fGrids->Clear();
68 else fGrids =
new TList;
71 else KVError::Error(
this,
"Convert()",
"gIDGridManager=0x0: create an ID grid manager first!");
81 void KVDP2toIDGridConvertor::ReadFile(
const Char_t* filename)
87 "Set class of ID grids to generate first!");
92 datfile.open(filename);
94 if (!datfile.good()) {
96 "Problem reading file %s", filename);
103 while (datfile.good()) {
110 if (!
s.BeginsWith(
'#')) {
111 int ring, modu, frun, lrun, totpoints;
112 if (sscanf(
s.Data(),
"%d %d %d %d", &ring, &modu, &frun, &lrun) !=
114 KVError::Error(
this,
"ReadFile()",
"Problem reading file %s\nLast line read: %s",
133 for (
int i = 0; i < nlines; i++) {
135 datfile >> z >>
a >> npoints;
136 totpoints += 2 * npoints;
143 grid->
Add(
"id", line);
149 grid->
Add(
"ok", line);
152 ReadLineCoords(grid, datfile);
167 void KVDP2toIDGridConvertor::ReadLineCoords(
KVIDGrid* grid, ifstream& datfile)
176 for (
int i = 0; i <
line->GetN(); i++) {
179 line->SetPoint(i, x, y);
185 for (
int i = 0; i <
line->GetN(); i++) {
188 line->SetPoint(i, x, y);
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Converts dp2-format grids to KVIDGrids.
virtual void SetGridClass(const Char_t *cl)
virtual ~KVDP2toIDGridConvertor()
Destructor.
void Convert(const Char_t *filename)
void Add(TString, KVIDentifier *)
const KVList * GetCuts() const
const KVNameValueList * GetParameters() const
const KVList * GetIdentifiers() const
KVSeqCollection * GetGrids()
Abstract base class for 2D identification grids in e.g. (dE,E) maps.
virtual void CalculateLineWidths()
KVIDLine * NewLine(const Char_t *idline_class="")
Base class for lines/cuts used for particle identification in 2D data maps.
Base class for graphical cuts used in particle identification.
void SetValue(const Char_t *name, value_type value)
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
static TClass * GetClass(Bool_t load=kTRUE, Bool_t silent=kFALSE)
virtual void AddAll(const TCollection *col)
void Error(UserClass p, const char *location, const char *va_(fmt),...)