void SeperateGoodBadTowers(TString fileName) { ifstream myFile(fileName); ofstream goodFile("goodTowers.txt"); ofstream badFile("badTowers.txt"); goodFile << "cell_ID\t" << "Chi2" << endl; badFile << "cell_ID\t" << "Chi2" << endl; int good, bad; good = bad = 0; if(myFile.is_open()) { string line = ""; std::getline(myFile,line); double a,b,c; a = b = c = 0.5; const Int_t cutoff = 300; while(myFile >> a >> b >> c) { Double_t index, chi1, chi2; index = a; chi1 = b; chi2 = c; if(chi1 < 0) { cout << "Throwing away: " << index << "\t" << chi1 << endl; continue; } if(chi1 < cutoff) { cout << "Good Tower: " << index << "\t" << chi1 << endl; goodFile << index << "\t" << chi1 << endl; good++; continue; } if(chi1 > cutoff) { cout << "Bad Tower: " << index << "\t" << chi1 << endl; badFile << index << "\t" << chi1 << endl; bad++; continue; } } myFile.close(); badFile.close(); goodFile.close(); }
int GetCoefficient(TString txtFile, TString rootFile) { //Extracting the histogram TFile* f = TFile::Open(rootFile); TDirectoryFile* dirFile = (TDirectoryFile*)(f->Get("AliAnalysisTaskCalibEmcal")); TList* list = (TList*)(dirFile->Get("histogram")); TH2D* cellVAmplitude = (TH2D*)(list->FindObject("_histogram_cell_id_amplitude")); //cout << __FILE__ << __LINE__ << endl; //Cell Tower range to analyse const Int_t CVALow = 0; const Int_t CVAHigh = 17670; //cout << __FILE__ << __LINE__ << endl; //Obtaining a histogram of the Good cells. TList* goodHistList = new TList; ifstream goodFile(txtFile); int numCells = 0; if(goodFile.is_open()) { //cout << __FILE__ << __LINE__ << endl; string line = ""; std::getline(goodFile,line); int index = 0; double chi2 = 0.0; //cout << __FILE__ << __LINE__ << endl; //for(index = 0; index < 3; index++) while(goodFile >> index >> chi2) { //cout << Form("cell%d",index) << endl; TH1D* cell = cellVAmplitude->ProjectionY(Form("cell%d",index),index+1,index+1); goodHistList->Add(cell); numCells++; } }
/********************************************************************* * * GatherAppsFromASearchElement() * * Given search path element (host name or path name), construct * the appropriate path for the various desktop subsystems. * * A path is constructed so that each element is appended to * the tail. *********************************************************************/ void AppManagerDirectory::GatherAppsFromASearchElement ( const CString & path ) { if (path.length()) { CString source(path); if (source.contains("/%L")) { if (user_->OS()->LANG() != "C") { source.replace("%L",user_->OS()->LANG()); if (!user_->OS()->isDirectory(source)) return; if (source.contains("/usr/dt/appconfig/appmanager/")) langVersionFound = 1; } else return; } else if (!user_->OS()->isDirectory(source)) return; DirectoryIterator iter (source); struct dirent * direntry; user_->OS()->setUserId(); while (direntry = iter()) { CString dname(direntry->d_name); if (user_->OS()->isDirectory(source + "/" + dname) || user_->OS()->isFile(source + "/" + dname)) if (goodFile(dirname_, dname)) user_->OS()->symbolicLink (source + "/" + dname, dirname_ + "/" + dname); } user_->OS()->setUserId(); } }