#include <Data.h>
Inheritance diagram for Anp::Plot::Data:

Public Member Functions | |
| Data () | |
| virtual | ~Data () |
| void | Fill (DataIter ibeg, DataIter iend, double weight) |
| void | Set (const std::string &key, unsigned int value) |
| void | Set (TDirectory *dir) |
Private Member Functions | |
| TH1 * | Fill (short key, float data, double weight) |
| TH2 * | Get (Short2Map &smap, TDirectory *dir, short xkey, short ykey) |
| TH1 * | Get (CorrMap &cmap, TDirectory *dir, short xkey, short ykey) |
Private Attributes | |
| bool | fPlot1d |
| bool | fPlot2d |
| bool | fPlotAll |
| unsigned int | fCorrSize |
| unsigned int | fFillFrac |
| unsigned int | fFillNbin |
| unsigned int | fFillSize |
| TDirectory * | fDir1d |
| TDirectory * | fDir2d |
| TDirectory * | fDirCorr |
| Short1Map | fMap1d |
| Short2Map | fMap2d |
| CorrMap | fMapCorr |
| FloatMap | fFloat |
| DataCorr | fCorr |
|
|
Definition at line 23 of file Data.cxx. Referenced by Fill(). 00024 :fPlot1d(true), 00025 fPlot2d(false), 00026 fPlotAll(true), 00027 fCorrSize(0), 00028 fFillFrac(0), 00029 fFillNbin(0), 00030 fFillSize(0), 00031 fDir1d(0), 00032 fDir2d(0), 00033 fDirCorr(0), 00034 fMap1d(), 00035 fMap2d(), 00036 fMapCorr(), 00037 fCorr() 00038 { 00039 }
|
|
|
Definition at line 42 of file Data.cxx. 00043 {
00044 }
|
|
||||||||||||||||
|
Definition at line 168 of file Data.cxx. References Data(), fDir1d, fFillFrac, fFillNbin, fFillSize, fFloat, Fill(), fMap1d, fPlotAll, Anp::Corr::Key, and Anp::SetDir(). 00169 {
00170 //
00171 // Find (create for a first time), fill and return TH1 histogram
00172 //
00173
00174 TH1 *h = 0;
00175
00176 Short1Map::iterator sit = fMap1d.find(key);
00177 if(sit == fMap1d.end())
00178 {
00179 //
00180 // Attempt to read histogram from histman, if it fails then make one here
00181 //
00182
00183 h = HistMan::Instance().CreateTH1(key, ".");
00184 if(h)
00185 {
00186 Anp::SetDir(h, fDir1d);
00187 sit = fMap1d.insert(Short1Map::value_type(key, h)).first;
00188 }
00189 else if(fPlotAll && fFillSize > 9 && fFillNbin > 1)
00190 {
00191 //
00192 // Create TH1 histogram, store first fFillSize events
00193 // and use them to determine histogram range.
00194 //
00195 vector<DataItem<float, double> > &fvec = fFloat[key];
00196
00197 if(fvec.size() < fFillSize)
00198 {
00199 fvec.push_back(Anp::DataItem<float, double>(data, weight));
00200 }
00201 else if(!fvec.empty())
00202 {
00203 stringstream hname;
00204 hname << "put_" << std::setw(5) << std::setfill('0') << key;
00205
00206 //
00207 // Sort vector, then exclude lowest and highest 5% of events
00208 //
00209 unsigned int lpos = (1*fvec.size())/100;
00210 unsigned int hpos = (99*fvec.size())/100;
00211 if(fFillFrac < 100)
00212 {
00213 lpos = (fFillFrac*fvec.size())/100;
00214 hpos = (static_cast<unsigned int>(100 - int(fFillFrac))*fvec.size())/100;
00215 }
00216
00217 assert(lpos < fvec.size() && hpos < fvec.size());
00218
00219 std::sort(fvec.begin(), fvec.end());
00220 const double xmin = fvec[lpos].Key();
00221 const double xmax = fvec[hpos].Key();
00222
00223 //
00224 // Create TH1
00225 //
00226 if(!hname.str().empty())
00227 {
00228 Anp::Lock<Anp::Mutex> lock(Anp::GetROOTMutex());
00229 h = new TH1D(hname.str().c_str(), hname.str().c_str(), fFillNbin, xmin, xmax);
00230 }
00231 Anp::SetDir(h, fDir1d);
00232
00233 //
00234 // Insert TH1 into the map, now we are done with this key
00235 //
00236 sit = fMap1d.insert(Short1Map::value_type(key, h)).first;
00237
00238 for(vector<DataItem<float, double> >::iterator fit = fvec.begin(); fit != fvec.end(); ++fit)
00239 {
00240 h -> Fill(fit -> Key(), fit -> Data());
00241 }
00242
00243 fvec.clear();
00244 }
00245 }
00246 else
00247 {
00248 sit = fMap1d.insert(Short1Map::value_type(key, 0)).first;
00249 }
00250 }
00251 else
00252 {
00253 //
00254 // Histogram might already exists, get TH1 pointer
00255 //
00256 h = sit -> second;
00257 }
00258
00259 //
00260 // For valid TH1 pointer fill histogram
00261 //
00262 if(h)
00263 {
00264 h -> Fill(data, weight);
00265 }
00266
00267 return h;
00268 }
|
|
||||||||||||||||
|
Definition at line 47 of file Data.cxx. References Data(), Anp::DataIter, fCorr, fCorrSize, fDir2d, fDirCorr, Anp::DataCorr::Fill(), fMap2d, fMapCorr, Get(), Anp::DataCorr::GetCorrCoef(), Anp::Corr::Key, Anp::KeyPair< T >::Key1(), Anp::KeyPair< T >::Key2(), and Anp::DataCorr::Reset(). Referenced by Fill(). 00048 {
00049 for(DataIter xit = ibeg; xit != iend; ++xit)
00050 {
00051 const short xkey = xit -> Key();
00052 const float xdata = xit -> Data();
00053
00054 if(fDir1d)
00055 {
00056 Fill(xkey, xdata, weight);
00057 }
00058
00059 if(!fDir2d)
00060 {
00061 continue;
00062 }
00063
00064 for(DataIter yit = xit + 1; yit != iend; ++yit)
00065 {
00066 const short ykey = yit -> Key();
00067 const float ydata = yit -> Data();
00068
00069 TH2 *h2 = Get(fMap2d, fDir2d, xkey, ykey);
00070 if(h2)
00071 {
00072 h2 -> Fill(xdata, ydata, weight);
00073 }
00074 }
00075 }
00076
00077 if(fDirCorr && fCorrSize > 1)
00078 {
00079 if(fCorr.Fill(ibeg, iend) >= fCorrSize)
00080 {
00081 const Corr::CorrMap cmap = fCorr.GetCorrCoef();
00082
00083 for(Corr::CorrMap::const_iterator cit = cmap.begin(); cit != cmap.end(); ++cit)
00084 {
00085 const Corr::Key &key = cit -> first;
00086 const double corr = cit -> second;
00087
00088 TH1 *hc = Get(fMapCorr, fDirCorr, key.Key1(), key.Key2());
00089 if(hc)
00090 {
00091 hc -> Fill(corr);
00092 }
00093 }
00094
00095 fCorr.Reset();
00096 }
00097 }
00098 }
|
|
||||||||||||||||||||
|
Definition at line 294 of file Data.cxx. References Anp::Plot::HistKey, and Anp::SetDir(). 00295 {
00296 const HistKey key(xkey, ykey);
00297
00298 CorrMap::iterator sit = cmap.find(key);
00299 if(sit == cmap.end())
00300 {
00301 stringstream hname, aname;
00302 hname << "key_" << xkey << "_and_key_" << ykey;
00303 aname << xkey << " and " << ykey << " correlation coefficient";
00304
00305 TH1 *h = 0;
00306 if(!hname.str().empty())
00307 {
00308 Anp::Lock<Anp::Mutex> lock(Anp::GetROOTMutex());
00309 TH1 *h = new TH1D(hname.str().c_str(), hname.str().c_str(),
00310 100, -1.00001, 1.00001);
00311 h -> GetXaxis() -> SetTitle(aname.str().c_str());
00312 h -> GetXaxis() -> CenterTitle();
00313 }
00314 Anp::SetDir(h, dir);
00315
00316 sit = cmap.insert(CorrMap::value_type(key, h)).first;
00317 }
00318
00319 return sit -> second;
00320 }
|
|
||||||||||||||||||||
|
Definition at line 271 of file Data.cxx. References Anp::Plot::HistKey, and Anp::SetDir(). Referenced by Fill(). 00272 {
00273 //
00274 // Find (create for a first time) and return TH2 histogram
00275 //
00276 const HistKey key(xkey, ykey);
00277
00278 Short2Map::iterator sit = smap.find(key);
00279 if(sit == smap.end())
00280 {
00281 TH2 *h = HistMan::Instance().GetTH2(xkey, ykey);
00282 if(h)
00283 {
00284 Anp::SetDir(h, dir);
00285 }
00286
00287 sit = smap.insert(Short2Map::value_type(key, h)).first;
00288 }
00289
00290 return sit -> second;
00291 }
|
|
|
Definition at line 142 of file Data.cxx. References fDir1d, fDir2d, fDirCorr, and Anp::GetDir(). 00143 {
00144 //
00145 // Create TDirectory objects for internal use
00146 //
00147
00148 if(!dir)
00149 {
00150 return;
00151 }
00152
00153 if(fPlot1d)
00154 {
00155 fDir1d = dir;
00156 }
00157 if(fPlot2d)
00158 {
00159 fDir2d = Anp::GetDir("plot2d", dir);
00160 }
00161 if(fCorrSize)
00162 {
00163 fDirCorr = Anp::GetDir("corr", dir);
00164 }
00165 }
|
|
||||||||||||
|
Definition at line 101 of file Data.cxx. References fCorrSize, fFillFrac, fFillNbin, fFillSize, fPlot1d, fPlot2d, and fPlotAll. 00102 {
00103 //
00104 // Configure internal parameters
00105 //
00106
00107 if(key == "Plot1d")
00108 {
00109 fPlot1d = static_cast<bool>(value);
00110 }
00111 else if(key == "Plot2d")
00112 {
00113 fPlot2d = static_cast<bool>(value);
00114 }
00115 else if(key == "PlotAll")
00116 {
00117 fPlotAll = static_cast<bool>(value);
00118 }
00119 else if(key == "CorrSize")
00120 {
00121 fCorrSize = value;
00122 }
00123 else if(key == "FillFrac")
00124 {
00125 fFillFrac = value;
00126 }
00127 else if(key == "FillNbin")
00128 {
00129 fFillNbin = value;
00130 }
00131 else if(key == "FillSize")
00132 {
00133 fFillSize = value;
00134 }
00135 else
00136 {
00137 cerr << "Data::Set - unknown key: " << key << endl;
00138 }
00139 }
|
|
|
Definition at line 76 of file Data.h. Referenced by Fill(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 74 of file Data.h. Referenced by Fill(). |
|
|
Definition at line 70 of file Data.h. Referenced by Fill(). |
|
|
Definition at line 71 of file Data.h. Referenced by Fill(). |
|
|
Definition at line 72 of file Data.h. Referenced by Fill(). |
|
|
Definition at line 57 of file Data.h. Referenced by Set(). |
|
|
Definition at line 58 of file Data.h. Referenced by Set(). |
|
|
|
1.3.9.1