void SingleAnalysis::FillFromTree(DataType dataType) { DrawAttributeMapping drawAttributeMapping(dataType); GraphMap graphMap; graphMap[EFFICIENCY] = drawAttributeMapping.ConfigureGraph(new TGraphErrors()); graphMap[E_REC] = drawAttributeMapping.ConfigureGraph(new TGraphErrors()); graphMap[E_REC_DEVIATION] = drawAttributeMapping.ConfigureGraph(new TGraphErrors()); graphMap[E_RESOL] = drawAttributeMapping.ConfigureGraph(new TGraphErrors()); graphMap[N_PFOS] = drawAttributeMapping.ConfigureGraph(new TGraphErrors()); graphMap[N_PFOS_20GEV] = drawAttributeMapping.ConfigureGraph(new TGraphErrors()); graphMap[N_PFOS_70GEV] = drawAttributeMapping.ConfigureGraph(new TGraphErrors()); int pointID = 0; for(IntVector::iterator iter = m_energies.begin(), endIter = m_energies.end() ; endIter != iter ; ++iter) { int energy = *iter; std::string completeFileName = m_rootFileDirectory + this->GetDataName(dataType) + "/" + this->GetFileName(energy, dataType); TFile *pFile = TFile::Open(completeFileName.c_str()); if(!pFile) throw std::runtime_error("Wrong file name !"); TTree *pTree = (TTree *) pFile->Get(m_treeName.c_str()); if(!pTree) throw std::runtime_error("Wrong tree name !"); TreeAnalyzer treeAnalyzer(pTree); treeAnalyzer.Loop(pointID, static_cast<double>(energy), graphMap); if(energy == 20) { treeAnalyzer.FillSpecificNPfosGraph(graphMap[N_PFOS_20GEV]); } else if(energy == 70) { treeAnalyzer.FillSpecificNPfosGraph(graphMap[N_PFOS_70GEV]); } // compute systematic errors if required ! if( m_computeSystematics ) this->ComputeSystematics(pointID, energy, dataType, graphMap); pointID++; } // Add graphs in multi graph map for(GraphMap::const_iterator graphIter = graphMap.begin(), graphEndIter = graphMap.end() ; graphEndIter != graphIter ; ++graphIter) m_canvasMultiGraphMap[graphIter->first].second->Add(graphIter->second); }
void OverlayAnalysis::FillGraphs() { std::cout << "Filling graphs" << std::endl; for(DataTypeVector::const_iterator dataIter = m_dataTypeVector.begin(), dataEndIter = m_dataTypeVector.end() ; dataEndIter != dataIter ; ++dataIter) { DataType dataType = *dataIter; DrawAttributeMapping drawAttributeMapping(dataType); GraphMap graphMap; graphMap[N_PFOS] = drawAttributeMapping.ConfigureGraph(new TGraphErrors()); graphMap[NEUTRAL_PURITY] = drawAttributeMapping.ConfigureGraph(new TGraphErrors()); graphMap[NEUTRAL_EFFICIENCY] = drawAttributeMapping.ConfigureGraph(new TGraphErrors()); graphMap[NEUTRAL_RECOVER_PROBA] = drawAttributeMapping.ConfigureGraph(new TGraphErrors()); graphMap[NEUTRAL_ENERGY_DIFFERENCE_EFFICIENT] = drawAttributeMapping.ConfigureGraph(new TGraphErrors()); for(IntVector::iterator nIter = m_neutralEnergies.begin(), nEndIter = m_neutralEnergies.end() ; nEndIter != nIter ; ++nIter) { int neutralEnergy = *nIter; for(IntVector::iterator cIter = m_chargedEnergies.begin(), cEndIter = m_chargedEnergies.end() ; cEndIter != cIter ; ++cIter) { int chargedEnergy = *cIter; int pointID = 0; for(unsigned int distance = m_startDistance ; distance <= m_endDistance ; distance += m_distanceStep) { std::string completeFileName = m_rootFileDirectory + this->GetDataName(dataType) + "/" + this->GetFileName(neutralEnergy, chargedEnergy, distance, dataType); TFile *pFile = TFile::Open(completeFileName.c_str()); if(!pFile) throw std::runtime_error("Wrong file name !"); TTree *pTree = (TTree *) pFile->Get(m_treeName.c_str()); if(!pTree) throw std::runtime_error("Wrong tree name !"); TreeAnalyzer treeAnalyzer(pTree); treeAnalyzer.Loop(pointID, static_cast<double>(distance), graphMap); pointID++; } } } // Add graphs in multi graph map for(GraphMap::const_iterator graphIter = graphMap.begin(), graphEndIter = graphMap.end() ; graphEndIter != graphIter ; ++graphIter) m_canvasMultiGraphMap[graphIter->first].second->Add(graphIter->second); } }
void SingleAnalysis::FillFromFile(DataType dataType) { DrawAttributeMapping drawAttributeMapping(dataType); GraphMap graphMap; graphMap[E_REC] = drawAttributeMapping.ConfigureGraph(new TGraphErrors()); graphMap[E_REC_DEVIATION] = drawAttributeMapping.ConfigureGraph(new TGraphErrors()); graphMap[E_RESOL] = drawAttributeMapping.ConfigureGraph(new TGraphErrors()); int pointID = 0; std::ifstream ifile; std::string completeFileName = m_rootFileDirectory + this->GetDataName(dataType) + "/" + this->GetBasicFileName(dataType); std::cout << "File name is " << completeFileName << std::endl; ifile.open( completeFileName.c_str(), std::ios::in ); if( ! ifile.is_open() || ! ifile.good() ) throw std::runtime_error("Wrong file name !"); unsigned int nEnergies = 0; ifile >> nEnergies; if( 0 == nEnergies ) throw std::runtime_error("Invalid n energy points"); for( unsigned int e=0 ; e<nEnergies ; e++ ) { int energy = 0; ifile >> energy; std::cout << "Energy is " << energy << std::endl; float erec, erecError, eresol, eresolError, erecDev, erecDevError = 0.f; ifile >> erec >> erecError >> eresol >> eresolError; std::cout << "Erec " << erec << " , erecError " << erecError << " , eresol " << eresol << " , eresolError " << eresolError << std::endl; erecDev = (erec - energy) / energy; erecDevError = erecError / energy; graphMap[E_REC]->SetPoint(e, energy, erec); graphMap[E_REC]->SetPointError(e, 0, erecError); graphMap[E_REC_DEVIATION]->SetPoint(e, energy, erecDev); graphMap[E_REC_DEVIATION]->SetPointError(e, 0, erecDevError); graphMap[E_RESOL]->SetPoint(e, energy, eresol); graphMap[E_RESOL]->SetPointError(e, 0, eresolError); } // Add graphs in multi graph map for(GraphMap::const_iterator graphIter = graphMap.begin(), graphEndIter = graphMap.end() ; graphEndIter != graphIter ; ++graphIter) m_canvasMultiGraphMap[graphIter->first].second->Add(graphIter->second); }
Network::NetEdgeIterator::NetEdgeIterator(const GraphMap& m) { _begin = m.begin(); _end = m.end(); reset(); }