|
Gaudi Framework, version v21r9 |
| Home | Generated: 3 May 2010 |


Public Member Functions | |
| Histogram3D () | |
| Standard Constructor. | |
| Histogram3D (TH3D *rep) | |
| Standard Constructor. | |
| virtual | ~Histogram3D () |
| Destructor. | |
| bool | fill (double x, double y, double z, double weight) |
| Fill bin content. | |
| virtual bool | setBinContents (int i, int j, int k, int entries, double height, double error, double centreX, double centreY, double centreZ) |
| Fast filling method for a given bin. It can be also the over/underflow bin. | |
| virtual bool | setRms (double rmsX, double rmsY, double rmsZ) |
| Sets the rms of the histogram. | |
| virtual bool | reset () |
| void * | cast (const std::string &className) const |
| Introspection method. | |
| void | copyFromAida (const AIDA::IHistogram3D &h) |
| Create new histogram from any AIDA based histogram. | |
| virtual const CLID & | clID () const |
| Retrieve reference to class defininition identifier. | |
Static Public Member Functions | |
| static const CLID & | classID () |
| Retrieve reference to class definition structure (static access). | |
Protected Attributes | |
| double | m_sumwx |
| double | m_sumwy |
| double | m_sumwz |
Definition at line 21 of file H3D.cpp.
| Gaudi::Histogram3D::Histogram3D | ( | ) |
| Gaudi::Histogram3D::Histogram3D | ( | TH3D * | rep | ) |
Standard Constructor.
Definition at line 105 of file H3D.cpp.
00105 { 00106 m_rep = 0; 00107 adoptRepresentation(rep); 00108 m_sumEntries = 0; 00109 m_sumwx = 0; 00110 m_sumwy = 0; 00111 m_sumwz = 0; 00112 m_rep->SetDirectory(0); 00113 }
| virtual Gaudi::Histogram3D::~Histogram3D | ( | ) | [inline, virtual] |
| bool Gaudi::Histogram3D::fill | ( | double | x, | |
| double | y, | |||
| double | z, | |||
| double | weight | |||
| ) |
| bool Gaudi::Histogram3D::setBinContents | ( | int | i, | |
| int | j, | |||
| int | k, | |||
| int | entries, | |||
| double | height, | |||
| double | error, | |||
| double | centreX, | |||
| double | centreY, | |||
| double | centreZ | |||
| ) | [virtual] |
Fast filling method for a given bin. It can be also the over/underflow bin.
Definition at line 116 of file H3D.cpp.
00116 { 00117 m_rep->SetBinContent(rIndexX(i), rIndexY(j), rIndexZ(k), height); 00118 m_rep->SetBinError(rIndexX(i), rIndexY(j), rIndexZ(k), error); 00119 // accumulate sum bin centers 00120 if (i >=0 && j >= 0 && k >= 0) { 00121 m_sumwx += centreX*height; 00122 m_sumwy += centreY*height; 00123 m_sumwz += centreZ*height; 00124 } 00125 m_sumEntries += entries; 00126 return true; 00127 }
| bool Gaudi::Histogram3D::setRms | ( | double | rmsX, | |
| double | rmsY, | |||
| double | rmsZ | |||
| ) | [virtual] |
Sets the rms of the histogram.
Definition at line 159 of file H3D.cpp.
00159 { 00160 m_rep->SetEntries(m_sumEntries); 00161 std::vector<double> stat(11); 00162 // sum weights 00163 stat[0] = sumBinHeights(); 00164 stat[1] = 0; 00165 if (equivalentBinEntries() != 0) 00166 stat[1] = ( sumBinHeights() * sumBinHeights() ) / equivalentBinEntries(); 00167 stat[2] = m_sumwx; 00168 double meanX = 0; 00169 if ( sumBinHeights() != 0 ) meanX = m_sumwx/ sumBinHeights(); 00170 stat[3] = ( meanX*meanX + rmsX*rmsX )* sumBinHeights(); 00171 stat[4] = m_sumwy; 00172 double meanY = 0; 00173 if ( sumBinHeights() != 0 ) meanY = m_sumwy/ sumBinHeights(); 00174 stat[5] = ( meanY*meanY + rmsY*rmsY )* sumBinHeights(); 00175 stat[6] = 0; 00176 stat[7] = m_sumwz; 00177 double meanZ = 0; 00178 if ( sumBinHeights() != 0 ) meanZ = m_sumwz/ sumBinHeights(); 00179 stat[8] = ( meanZ*meanZ + rmsZ*rmsZ )* sumBinHeights(); 00180 // do not need to use sumwxy sumwxz and sumwyz 00181 00182 m_rep->PutStats(&stat.front()); 00183 return true; 00184 }
| bool Gaudi::Histogram3D::reset | ( | ) | [virtual] |
| void * Gaudi::Histogram3D::cast | ( | const std::string & | className | ) | const |
| void Gaudi::Histogram3D::copyFromAida | ( | const AIDA::IHistogram3D & | h | ) |
Create new histogram from any AIDA based histogram.
Definition at line 186 of file H3D.cpp.
00186 { 00187 delete m_rep; 00188 // implement here the copy 00189 const char* tit = h.title().c_str(); 00190 if (h.xAxis().isFixedBinning() && h.yAxis().isFixedBinning() && h.zAxis().isFixedBinning() ) { 00191 m_rep = new TH3D(tit,tit, 00192 h.xAxis().bins(), h.xAxis().lowerEdge(), h.xAxis().upperEdge(), 00193 h.yAxis().bins(), h.yAxis().lowerEdge(), h.yAxis().upperEdge(), 00194 h.zAxis().bins(), h.zAxis().lowerEdge(), h.zAxis().upperEdge() ); 00195 } 00196 else { 00197 Edges eX, eY, eZ; 00198 for (int i =0; i < h.xAxis().bins(); ++i) 00199 eX.push_back(h.xAxis().binLowerEdge(i)); 00200 // add also upperedges at the end 00201 eX.push_back(h.xAxis().upperEdge() ); 00202 for (int i =0; i < h.yAxis().bins(); ++i) 00203 eY.push_back(h.yAxis().binLowerEdge(i)); 00204 // add also upperedges at the end 00205 eY.push_back(h.yAxis().upperEdge() ); 00206 for (int i =0; i < h.zAxis().bins(); ++i) 00207 eZ.push_back(h.zAxis().binLowerEdge(i)); 00208 // add also upperedges at the end 00209 eZ.push_back(h.zAxis().upperEdge() ); 00210 m_rep = new TH3D(tit,tit,eX.size()-1,&eX.front(),eY.size()-1,&eY.front(),eZ.size()-1,&eZ.front()); 00211 } 00212 m_xAxis.initialize(m_rep->GetXaxis(),true); 00213 m_yAxis.initialize(m_rep->GetYaxis(),true); 00214 m_zAxis.initialize(m_rep->GetZaxis(),true); 00215 const TArrayD* a = m_rep->GetSumw2(); 00216 if ( 0 == a || (a && a->GetSize()==0) ) m_rep->Sumw2(); 00217 m_sumEntries = 0; 00218 m_sumwx = 0; 00219 m_sumwy = 0; 00220 m_sumwz = 0; 00221 00222 // statistics 00223 double sumw = h.sumBinHeights(); 00224 double sumw2 = 0; 00225 if (h.equivalentBinEntries() != 0) 00226 sumw2 = ( sumw * sumw ) /h.equivalentBinEntries(); 00227 double sumwx = h.meanX()*h.sumBinHeights(); 00228 double sumwx2 = (h.meanX()*h.meanX() + h.rmsX()*h.rmsX() )*h.sumBinHeights(); 00229 double sumwy = h.meanY()*h.sumBinHeights(); 00230 double sumwy2 = (h.meanY()*h.meanY() + h.rmsY()*h.rmsY() )*h.sumBinHeights(); 00231 double sumwz = h.meanZ()*h.sumBinHeights(); 00232 double sumwz2 = (h.meanZ()*h.meanZ() + h.rmsZ()*h.rmsZ() )*h.sumBinHeights(); 00233 double sumwxy = 0; 00234 double sumwxz = 0; 00235 double sumwyz = 0; 00236 00237 // copy the contents in (AIDA underflow/overflow are -2,-1) 00238 for (int i=-2; i < xAxis().bins(); ++i) { 00239 for (int j=-2; j < yAxis().bins(); ++j) { 00240 for (int k=-2; k < zAxis().bins(); ++k) { 00241 m_rep->SetBinContent(rIndexX(i), rIndexY(j), rIndexZ(k), h.binHeight(i,j,k) ); 00242 m_rep->SetBinError(rIndexX(i), rIndexY(j), rIndexZ(k), h.binError(i,j,k) ); 00243 // calculate statistics 00244 if ( i >= 0 && j >= 0 && k >= 0) { 00245 sumwxy += h.binHeight(i,j,k)*h.binMeanX(i,j,k)*h.binMeanY(i,j,k); 00246 sumwxz += h.binHeight(i,j,k)*h.binMeanX(i,j,k)*h.binMeanZ(i,j,k); 00247 sumwyz += h.binHeight(i,j,k)*h.binMeanY(i,j,k)*h.binMeanZ(i,j,k); 00248 } 00249 } 00250 } 00251 } 00252 // need to do set entries after setting contents otherwise root will recalulate them 00253 // taking into account how many time SetBinContents() has been called 00254 m_rep->SetEntries(h.allEntries()); 00255 00256 // fill stat vector 00257 std::vector<double> stat(11); 00258 stat[0] = sumw; 00259 stat[1] = sumw2; 00260 stat[2] = sumwx; 00261 stat[3] = sumwx2; 00262 stat[4] = sumwy; 00263 stat[5] = sumwy2; 00264 stat[6] = sumwxy; 00265 stat[7] = sumwz; 00266 stat[8] = sumwz2; 00267 stat[9] = sumwxz; 00268 stat[10] = sumwyz; 00269 m_rep->PutStats(&stat.front()); 00270 }
| virtual const CLID& Gaudi::Histogram3D::clID | ( | ) | const [inline, virtual] |
Retrieve reference to class defininition identifier.
Reimplemented from DataObject.
Definition at line 42 of file H3D.cpp.
00042 { return Gaudi::Histogram3D::classID(); }
| static const CLID& Gaudi::Histogram3D::classID | ( | ) | [inline, static] |