diff --git a/Alignment/MillePedeAlignmentAlgorithm/test/ZMuMuMassConstraintParameterFinder/printParameters.C b/Alignment/MillePedeAlignmentAlgorithm/test/ZMuMuMassConstraintParameterFinder/printParameters.C index c51468c2fcce2..0ea431af0f2ad 100644 --- a/Alignment/MillePedeAlignmentAlgorithm/test/ZMuMuMassConstraintParameterFinder/printParameters.C +++ b/Alignment/MillePedeAlignmentAlgorithm/test/ZMuMuMassConstraintParameterFinder/printParameters.C @@ -13,9 +13,9 @@ bool isValidFile(const TString& fileName) { return true; } -void printParameters(const TString& fileName) { +int printParameters(const TString& fileName) { if (!isValidFile(fileName)) { - exit(EXIT_FAILURE); + return EXIT_FAILURE; } TFile* file = TFile::Open(fileName, "read"); @@ -30,5 +30,5 @@ void printParameters(const TString& fileName) { std::cout << " PrimaryWidth = " << htemp->GetRMS() << "\n"; std::cout << "========================================\n"; - exit(EXIT_SUCCESS); + return EXIT_SUCCESS; } diff --git a/CalibMuon/CSCCalibration/test/CSCValidation.cpp b/CalibMuon/CSCCalibration/test/CSCValidation.cpp index 5aec0ae6b326d..59eb216aab7af 100644 --- a/CalibMuon/CSCCalibration/test/CSCValidation.cpp +++ b/CalibMuon/CSCCalibration/test/CSCValidation.cpp @@ -5,13 +5,12 @@ #include #include -int main() -{ +int main() { //Gains variables - int counter=0; - int dbgains_nrlines=0; - int fakegains_nrlines=0; - + int counter = 0; + int dbgains_nrlines = 0; + int fakegains_nrlines = 0; + int dbgains_index; float db_gainslope; std::vector dbgains_index_id; @@ -22,11 +21,11 @@ int main() std::vector fake_slope; //NoiseMatrix variables - int dbmatrix_nrlines=0; - int fakematrix_nrlines=0; + int dbmatrix_nrlines = 0; + int fakematrix_nrlines = 0; int fakematrix_index; int dbmatrix_index; - float db_elm33,db_elm34, db_elm44, db_elm35, db_elm45, db_elm55; + float db_elm33, db_elm34, db_elm44, db_elm35, db_elm45, db_elm55; float db_elm46, db_elm56, db_elm66, db_elm57, db_elm67, db_elm77; std::vector dbmatrix_index_id; std::vector db_elem33; @@ -41,7 +40,7 @@ int main() std::vector db_elem57; std::vector db_elem67; std::vector db_elem77; - float fake_elm33,fake_elm34, fake_elm44, fake_elm35, fake_elm45, fake_elm55; + float fake_elm33, fake_elm34, fake_elm44, fake_elm35, fake_elm45, fake_elm55; float fake_elm46, fake_elm56, fake_elm66, fake_elm57, fake_elm67, fake_elm77; std::vector fakematrix_index_id; std::vector fake_elem33; @@ -58,26 +57,26 @@ int main() std::vector fake_elem77; //Pedestal variables - int dbpeds_nrlines=0; - int fakepeds_nrlines=0; - int dbpeds_index,fakepeds_index; - float fake_peds,fake_rms; + int dbpeds_nrlines = 0; + int fakepeds_nrlines = 0; + int dbpeds_index, fakepeds_index; + float fake_peds, fake_rms; std::vector fakepeds_index_id; std::vector fake_pedestal; std::vector fake_pedrms; - float db_peds,db_rms; + float db_peds, db_rms; std::vector dbpeds_index_id; std::vector db_pedestal; std::vector db_pedrms; //Crosstalk variables - int dbxtalk_nrlines=0; - int fakextalk_nrlines=0; - int dbxtalk_index,fakextalk_index; - float dbxtalk_slope_right,dbxtalk_slope_left,dbxtalk_intercept_right; - float dbxtalk_intercept_left; - float fakextalk_slope_right,fakextalk_slope_left,fakextalk_intercept_right; - float fakextalk_intercept_left; + int dbxtalk_nrlines = 0; + int fakextalk_nrlines = 0; + int dbxtalk_index, fakextalk_index; + float dbxtalk_slope_right, dbxtalk_slope_left, dbxtalk_intercept_right; + float dbxtalk_intercept_left; + float fakextalk_slope_right, fakextalk_slope_left, fakextalk_intercept_right; + float fakextalk_intercept_left; std::vector fakextalk_index_id; std::vector fakextalk_slope_r; std::vector fakextalk_intercept_r; @@ -91,14 +90,14 @@ int main() ///////////////////////////////////////////////////////////////////////////////////////////// //read fakes-on-the-fly for Gains - std::ifstream fakegainsdata; - fakegainsdata.open("fakegains.dat",std::ios::in); - if(!fakegainsdata) { - std::cerr <<"Error: fakegains.dat -> no such file!"<< std::endl; + std::ifstream fakegainsdata; + fakegainsdata.open("fakegains.dat", std::ios::in); + if (!fakegainsdata) { + std::cerr << "Error: fakegains.dat -> no such file!" << std::endl; exit(1); } - while (!fakegainsdata.eof() ) { - fakegainsdata >> fakegains_index >> fake_gainslope; + while (!fakegainsdata.eof()) { + fakegainsdata >> fakegains_index >> fake_gainslope; fakegains_index_id.push_back(fakegains_index); fake_slope.push_back(fake_gainslope); fakegains_nrlines++; @@ -106,38 +105,38 @@ int main() fakegainsdata.close(); //read database values for Gains - std::ifstream dbgainsdata; - dbgainsdata.open("dbgains.dat",std::ios::in); - if(!dbgainsdata) { - std::cerr <<"Error: dbgains.dat -> no such file!"<< std::endl; - exit(1); + std::ifstream dbgainsdata; + dbgainsdata.open("dbgains.dat", std::ios::in); + if (!dbgainsdata) { + std::cerr << "Error: dbgains.dat -> no such file!" << std::endl; + return 1; } - while (!dbgainsdata.eof() ) { - dbgainsdata >> dbgains_index >> db_gainslope; + while (!dbgainsdata.eof()) { + dbgainsdata >> dbgains_index >> db_gainslope; dbgains_index_id.push_back(dbgains_index); db_slope.push_back(db_gainslope); dbgains_nrlines++; } dbgainsdata.close(); - - for(int i=0; i<217728; i++){ - if(fake_slope[i] != db_slope[i]){ - std::cout<<"ERROR::: CSC Gains object::: Values in DB incompatible with Fakes!"< no such file!"<< std::endl; - exit(1); + std::ifstream fakematrixdata; + fakematrixdata.open("fakematrix.dat", std::ios::in); + if (!fakematrixdata) { + std::cerr << "Error: fakematrix.dat -> no such file!" << std::endl; + return 1; } - - while (!fakematrixdata.eof() ) { - fakematrixdata >> fakematrix_index >> fake_elm33 >> fake_elm34 >> fake_elm44 >> fake_elm35 >> fake_elm45 >> fake_elm55 >> fake_elm46 >> fake_elm56 >> fake_elm66 >> fake_elm57 >> fake_elm67 >> fake_elm77; + + while (!fakematrixdata.eof()) { + fakematrixdata >> fakematrix_index >> fake_elm33 >> fake_elm34 >> fake_elm44 >> fake_elm35 >> fake_elm45 >> + fake_elm55 >> fake_elm46 >> fake_elm56 >> fake_elm66 >> fake_elm57 >> fake_elm67 >> fake_elm77; fakematrix_index_id.push_back(fakematrix_index); fake_elem33.push_back(fake_elm33); fake_elem34.push_back(fake_elm34); @@ -158,14 +157,15 @@ int main() //read database values for NoiseMatrix std::ifstream dbmatrixdata; - dbmatrixdata.open("dbmatrix.dat",std::ios::in); - if(!dbmatrixdata) { - std::cerr <<"Error: dbmatrix.txt -> no such file!"<< std::endl; - exit(1); + dbmatrixdata.open("dbmatrix.dat", std::ios::in); + if (!dbmatrixdata) { + std::cerr << "Error: dbmatrix.txt -> no such file!" << std::endl; + return 1; } - - while (!dbmatrixdata.eof() ) { - dbmatrixdata >> dbmatrix_index >> db_elm33 >> db_elm34 >> db_elm44 >> db_elm35 >> db_elm45 >> db_elm55 >> db_elm46 >> db_elm56 >> db_elm66 >> db_elm57 >> db_elm67 >> db_elm77 ; + + while (!dbmatrixdata.eof()) { + dbmatrixdata >> dbmatrix_index >> db_elm33 >> db_elm34 >> db_elm44 >> db_elm35 >> db_elm45 >> db_elm55 >> + db_elm46 >> db_elm56 >> db_elm66 >> db_elm57 >> db_elm67 >> db_elm77; dbmatrix_index_id.push_back(dbmatrix_index); db_elem33.push_back(db_elm33); db_elem34.push_back(db_elm34); @@ -178,61 +178,60 @@ int main() db_elem66.push_back(db_elm66); db_elem57.push_back(db_elm57); db_elem67.push_back(db_elm67); - db_elem77.push_back(db_elm77); + db_elem77.push_back(db_elm77); dbmatrix_nrlines++; } dbmatrixdata.close(); - - for(int i=0; i<217728; i++){ - if(fake_elem33[i] != db_elem33[i]){ - std::cout<<"ERROR::: CSC NoiseMatrix object:::elem33 Values in DB incompatible with Fakes!"< no such file!"<< std::endl; + std::ifstream fakepedsdata; + fakepedsdata.open("fakepeds.dat", std::ios::in); + if (!fakepedsdata) { + std::cerr << "Error: fakepeds.dat -> no such file!" << std::endl; exit(1); } - while (!fakepedsdata.eof() ) { - fakepedsdata >> fakepeds_index >> fake_peds >> fake_rms; + while (!fakepedsdata.eof()) { + fakepedsdata >> fakepeds_index >> fake_peds >> fake_rms; fakepeds_index_id.push_back(fakepeds_index); fake_pedestal.push_back(fake_peds); fake_pedrms.push_back(fake_rms); @@ -241,14 +240,14 @@ int main() fakepedsdata.close(); //read database values for Pedestals - std::ifstream dbpedsdata; - dbpedsdata.open("dbpeds.dat",std::ios::in); - if(!dbpedsdata) { - std::cerr <<"Error: dbpeds.dat -> no such file!"<< std::endl; + std::ifstream dbpedsdata; + dbpedsdata.open("dbpeds.dat", std::ios::in); + if (!dbpedsdata) { + std::cerr << "Error: dbpeds.dat -> no such file!" << std::endl; exit(1); } - while (!dbpedsdata.eof() ) { - dbpedsdata >> dbpeds_index >> db_peds >> db_rms ; + while (!dbpedsdata.eof()) { + dbpedsdata >> dbpeds_index >> db_peds >> db_rms; dbpeds_index_id.push_back(dbpeds_index); db_pedestal.push_back(db_peds); db_pedrms.push_back(db_rms); @@ -256,24 +255,24 @@ int main() } dbpedsdata.close(); - - for(int i=0; i<217728; i++){ - if(fake_slope[i] != db_slope[i]){ - std::cout<<"ERROR::: CSC Pedestal object::: Values in DB incompatible with Fakes!"< no such file!"<< std::endl; + std::ifstream fakextalkdata; + fakextalkdata.open("fakextalk.dat", std::ios::in); + if (!fakextalkdata) { + std::cerr << "Error: fakextalk.dat -> no such file!" << std::endl; exit(1); } - - while (!fakextalkdata.eof() ) { - fakextalkdata >> fakextalk_index >> fakextalk_slope_right >> fakextalk_intercept_right >> fakextalk_slope_left >> fakextalk_intercept_left; + + while (!fakextalkdata.eof()) { + fakextalkdata >> fakextalk_index >> fakextalk_slope_right >> fakextalk_intercept_right >> fakextalk_slope_left >> + fakextalk_intercept_left; fakextalk_index_id.push_back(fakextalk_index); fakextalk_slope_r.push_back(fakextalk_slope_right); fakextalk_slope_l.push_back(fakextalk_slope_left); @@ -285,14 +284,15 @@ int main() //read database values for Crosstalk std::ifstream dbxtalkdata; - dbxtalkdata.open("dbxtalk.dat",std::ios::in); - if(!dbxtalkdata) { - std::cerr <<"Error: dbxtalk.dat -> no such file!"<< std::endl; + dbxtalkdata.open("dbxtalk.dat", std::ios::in); + if (!dbxtalkdata) { + std::cerr << "Error: dbxtalk.dat -> no such file!" << std::endl; exit(1); } - - while (!dbxtalkdata.eof() ) { - dbxtalkdata >> dbxtalk_index >> dbxtalk_slope_right >> dbxtalk_intercept_right >> dbxtalk_slope_left >> dbxtalk_intercept_left ; + + while (!dbxtalkdata.eof()) { + dbxtalkdata >> dbxtalk_index >> dbxtalk_slope_right >> dbxtalk_intercept_right >> dbxtalk_slope_left >> + dbxtalk_intercept_left; dbxtalk_index_id.push_back(dbxtalk_index); dbxtalk_slope_r.push_back(dbxtalk_slope_right); dbxtalk_slope_l.push_back(dbxtalk_slope_left); @@ -302,19 +302,20 @@ int main() } dbxtalkdata.close(); - for(int i=0; i<217728; i++){ - if(fakextalk_slope_r[i] != dbxtalk_slope_r[i]){ + for (int i = 0; i < 217728; i++) { + if (fakextalk_slope_r[i] != dbxtalk_slope_r[i]) { // std::cout< #include -int main(){ - +int main() { const int MAX_SIZE = 252288; int old_index; @@ -16,28 +15,28 @@ int main(){ std::vector old_chi; int new_index; - float new_slope,new_int, new_chi2; + float new_slope, new_int, new_chi2; std::vector new_index_id; std::vector new_gains; std::vector new_intercept; std::vector new_chi; - + std::vector diff; std::vector myoldgains; - int counter,counter1; - int old_nrlines=0; - int new_nrlines=0; + int counter, counter1; + int old_nrlines = 0; + int new_nrlines = 0; - std::ifstream olddata; - olddata.open("goodGains2008_09_02.dat",std::ios::in); - if(!olddata) { - std::cerr <<"Error: goodGains2008_09_02.dat -> no such file!"<< std::endl; - exit(1); + std::ifstream olddata; + olddata.open("goodGains2008_09_02.dat", std::ios::in); + if (!olddata) { + std::cerr << "Error: goodGains2008_09_02.dat -> no such file!" << std::endl; + return 1; } - - while (!olddata.eof() ) { - olddata >> old_index >> old_slope ; + + while (!olddata.eof()) { + olddata >> old_index >> old_slope; old_index_id.push_back(old_index); old_gains.push_back(old_slope); old_nrlines++; @@ -45,15 +44,15 @@ int main(){ olddata.close(); std::ifstream newdata; - std::ofstream myGainsFile("diffGainsOct_Aug109889.dat",std::ios::out); - newdata.open("goodGains2009_08_07_run109889.dat",std::ios::in); - if(!newdata) { - std::cerr <<"Error: goodGains2009_08_07_run109889.dat -> no such file!"<< std::endl; - exit(1); + std::ofstream myGainsFile("diffGainsOct_Aug109889.dat", std::ios::out); + newdata.open("goodGains2009_08_07_run109889.dat", std::ios::in); + if (!newdata) { + std::cerr << "Error: goodGains2009_08_07_run109889.dat -> no such file!" << std::endl; + return 1; } - - while (!newdata.eof() ) { - newdata >> new_index >> new_slope >> new_int >> new_chi2 ; + + while (!newdata.eof()) { + newdata >> new_index >> new_slope >> new_int >> new_chi2; new_index_id.push_back(new_index); new_gains.push_back(new_slope); new_intercept.push_back(new_int); @@ -63,18 +62,19 @@ int main(){ newdata.close(); diff.resize(MAX_SIZE); myoldgains.resize(MAX_SIZE); - - for(int i=0; i #include -int main(){ - +int main() { const int MAX_SIZE = 252288; int old_index; - float old_elem33, old_elem34,old_elem35,old_elem44,old_elem45,old_elem46,old_elem55,old_elem56; - float old_elem57,old_elem66,old_elem67,old_elem77; + float old_elem33, old_elem34, old_elem35, old_elem44, old_elem45, old_elem46, old_elem55, old_elem56; + float old_elem57, old_elem66, old_elem67, old_elem77; std::vector old_index_id; std::vector old_el33; std::vector old_el34; @@ -26,8 +25,8 @@ int main(){ std::vector old_el77; int new_index; - float new_elem33,new_elem34,new_elem35,new_elem44,new_elem45,new_elem46,new_elem55,new_elem56; - float new_elem57,new_elem66,new_elem67,new_elem77; + float new_elem33, new_elem34, new_elem35, new_elem44, new_elem45, new_elem46, new_elem55, new_elem56; + float new_elem57, new_elem66, new_elem67, new_elem77; std::vector new_index_id; std::vector new_el33; std::vector new_el34; @@ -70,19 +69,20 @@ int main(){ std::vector myoldel67; std::vector myoldel77; - int counter,counter1; - int old_nrlines=0; - int new_nrlines=0; + int counter, counter1; + int old_nrlines = 0; + int new_nrlines = 0; - std::ifstream olddata; - olddata.open("goodMatrix2008_09_02.dat",std::ios::in); - if(!olddata) { - std::cerr <<"Error: goodMatrix2008_09_02.dat -> no such file!"<< std::endl; - exit(1); + std::ifstream olddata; + olddata.open("goodMatrix2008_09_02.dat", std::ios::in); + if (!olddata) { + std::cerr << "Error: goodMatrix2008_09_02.dat -> no such file!" << std::endl; + return 1; } - - while (!olddata.eof() ) { - olddata >> old_index >> old_elem33 >> old_elem34 >> old_elem44 >> old_elem35 >> old_elem45 >> old_elem55 >> old_elem46 >> old_elem56 >>old_elem66 >> old_elem57 >> old_elem67 >> old_elem77 ; + + while (!olddata.eof()) { + olddata >> old_index >> old_elem33 >> old_elem34 >> old_elem44 >> old_elem35 >> old_elem45 >> old_elem55 >> + old_elem46 >> old_elem56 >> old_elem66 >> old_elem57 >> old_elem67 >> old_elem77; old_index_id.push_back(old_index); old_el33.push_back(old_elem33); old_el34.push_back(old_elem34); @@ -101,15 +101,16 @@ int main(){ olddata.close(); std::ifstream newdata; - std::ofstream myXtalkFile("diffMatrixOct_Aug109891.dat",std::ios::out); - newdata.open("goodMatrix2009_08_07_run109891.dat",std::ios::in); - if(!newdata) { - std::cerr <<"Error: goodMatrix2009_08_07_run109891.dat -> no such file!"<< std::endl; - exit(1); + std::ofstream myXtalkFile("diffMatrixOct_Aug109891.dat", std::ios::out); + newdata.open("goodMatrix2009_08_07_run109891.dat", std::ios::in); + if (!newdata) { + std::cerr << "Error: goodMatrix2009_08_07_run109891.dat -> no such file!" << std::endl; + return 1; } - - while (!newdata.eof() ) { - newdata >> new_index >> new_elem33 >> new_elem34 >> new_elem44 >> new_elem35 >> new_elem45 >> new_elem55 >> new_elem46 >> new_elem56 >>new_elem66 >> new_elem57 >> new_elem67 >> new_elem77; + + while (!newdata.eof()) { + newdata >> new_index >> new_elem33 >> new_elem34 >> new_elem44 >> new_elem35 >> new_elem45 >> new_elem55 >> + new_elem46 >> new_elem56 >> new_elem66 >> new_elem57 >> new_elem67 >> new_elem77; new_index_id.push_back(new_index); new_el33.push_back(new_elem33); new_el34.push_back(new_elem34); @@ -154,39 +155,43 @@ int main(){ myoldel67.resize(MAX_SIZE); myoldel77.resize(MAX_SIZE); - for(int i=0; i #include -int main(){ - +int main() { const int MAX_SIZE = 252288; int old_index; @@ -14,26 +13,26 @@ int main(){ std::vector old_peds; std::vector old_pedrms; int new_index; - float new_ped,new_rms; + float new_ped, new_rms; std::vector new_index_id; std::vector new_peds; std::vector new_pedrms; std::vector diff; std::vector myoldpeds; - int counter,counter1; - int old_nrlines=0; - int new_nrlines=0; + int counter, counter1; + int old_nrlines = 0; + int new_nrlines = 0; - std::ifstream olddata; - olddata.open("goodPeds2008_09_02.dat",std::ios::in); - if(!olddata) { - std::cerr <<"Error: goodPeds2008_09_02.dat -> no such file!"<< std::endl; - exit(1); + std::ifstream olddata; + olddata.open("goodPeds2008_09_02.dat", std::ios::in); + if (!olddata) { + std::cerr << "Error: goodPeds2008_09_02.dat -> no such file!" << std::endl; + return 1; } - - while (!olddata.eof() ) { - olddata >> old_index >> old_ped >> old_rms ; + + while (!olddata.eof()) { + olddata >> old_index >> old_ped >> old_rms; old_index_id.push_back(old_index); old_peds.push_back(old_ped); old_pedrms.push_back(old_rms); @@ -42,15 +41,15 @@ int main(){ olddata.close(); std::ifstream newdata; - std::ofstream myPedsFile("diffPedsOct_Feb.dat",std::ios::out); - newdata.open("goodPeds2009_02_16.dat",std::ios::in); - if(!newdata) { - std::cerr <<"Error: goodPeds2009_02_16.dat -> no such file!"<< std::endl; - exit(1); + std::ofstream myPedsFile("diffPedsOct_Feb.dat", std::ios::out); + newdata.open("goodPeds2009_02_16.dat", std::ios::in); + if (!newdata) { + std::cerr << "Error: goodPeds2009_02_16.dat -> no such file!" << std::endl; + return 1; } - - while (!newdata.eof() ) { - newdata >> new_index >> new_ped >> new_rms ; + + while (!newdata.eof()) { + newdata >> new_index >> new_ped >> new_rms; new_index_id.push_back(new_index); new_peds.push_back(new_ped); new_pedrms.push_back(new_rms); @@ -59,18 +58,19 @@ int main(){ newdata.close(); diff.resize(MAX_SIZE); myoldpeds.resize(MAX_SIZE); - - for(int i=0; i #include -int main(){ - +int main() { const int MAX_SIZE = 252288; int old_index; @@ -19,13 +18,13 @@ int main(){ std::vector diffXtalkL; std::vector diffIntR; std::vector diffIntL; - + std::vector myoldxtalkR; std::vector myoldxtalkL; std::vector myoldintR; std::vector myoldintL; - int new_index,extra1,extra2; + int new_index, extra1, extra2; float new_xtalk_left, new_xtalk_right, new_int_left, new_int_right; std::vector new_index_id; std::vector new_Rxtalk; @@ -33,45 +32,45 @@ int main(){ std::vector new_Rint; std::vector new_Lint; - int counter,counter1; - int old_nrlines=0; - int new_nrlines=0; + int counter, counter1; + int old_nrlines = 0; + int new_nrlines = 0; - std::ifstream olddata; - olddata.open("goodXtalk2008_09_02.dat",std::ios::in); - if(!olddata) { - std::cerr <<"Error: goodXtalk2008_09_02.dat -> no such file!"<< std::endl; - exit(1); + std::ifstream olddata; + olddata.open("goodXtalk2008_09_02.dat", std::ios::in); + if (!olddata) { + std::cerr << "Error: goodXtalk2008_09_02.dat -> no such file!" << std::endl; + return 1; } - while (!olddata.eof() ) { - olddata >> old_index >> old_xtalk_left >> old_int_left >> old_xtalk_right >> old_int_right ; + while (!olddata.eof()) { + olddata >> old_index >> old_xtalk_left >> old_int_left >> old_xtalk_right >> old_int_right; old_index_id.push_back(old_index); old_Rxtalk.push_back(old_xtalk_right); - old_Rint.push_back(old_int_right); - old_Lxtalk.push_back(old_xtalk_left); + old_Rint.push_back(old_int_right); + old_Lxtalk.push_back(old_xtalk_left); old_Lint.push_back(old_int_left); } olddata.close(); std::ifstream newdata; - std::ofstream myXtalkFile("diffXtalkOct_Aug3.dat",std::ios::out); + std::ofstream myXtalkFile("diffXtalkOct_Aug3.dat", std::ios::out); - newdata.open("goodXtalk2009_08_07_run109890.dat",std::ios::in); - if(!newdata) { - std::cerr <<"Error:goodXtalk2009_08_07_run109890.dat -> no such file!"<< std::endl; - exit(1); + newdata.open("goodXtalk2009_08_07_run109890.dat", std::ios::in); + if (!newdata) { + std::cerr << "Error:goodXtalk2009_08_07_run109890.dat -> no such file!" << std::endl; + return 1; } - while (!newdata.eof() ) { - newdata >> new_index >> new_xtalk_left >> new_int_left >> new_xtalk_right >> new_int_right ; + while (!newdata.eof()) { + newdata >> new_index >> new_xtalk_left >> new_int_left >> new_xtalk_right >> new_int_right; new_index_id.push_back(new_index); new_Rxtalk.push_back(new_xtalk_right); - new_Rint.push_back(new_int_right); + new_Rint.push_back(new_int_right); new_Lxtalk.push_back(new_xtalk_left); new_Lint.push_back(new_int_left); } - newdata.close(); + newdata.close(); diffXtalkR.resize(MAX_SIZE); diffXtalkL.resize(MAX_SIZE); @@ -82,24 +81,26 @@ int main(){ myoldintR.resize(MAX_SIZE); myoldintR.resize(MAX_SIZE); - for(int i=0; i index_id; + std::vector index_id; std::vector Slope; std::vector Intercept; std::vector gainChi2; - - std::ifstream dbdata; - dbdata.open("FileName",std::ios::in); - if(!dbdata) { - std::cerr <<"Error: FileName -> no such file!"<< std::endl; - exit(1); + + std::ifstream dbdata; + dbdata.open("FileName", std::ios::in); + if (!dbdata) { + std::cerr << "Error: FileName -> no such file!" << std::endl; + return 1; } - while (!dbdata.eof() ) { - dbdata >> index >> gainSlope >> gainIntercept >>chi2 >>flag >>flag1; + while (!dbdata.eof()) { + dbdata >> index >> gainSlope >> gainIntercept >> chi2 >> flag >> flag1; index_id.push_back(index); Slope.push_back(gainSlope); Intercept.push_back(gainIntercept); @@ -32,14 +32,15 @@ int main(){ nrlines++; } dbdata.close(); - std::ofstream myGainsFile("GoodVals_FileName",std::ios::out); - - for(int i=0; i6.0 && Slope[i]<11.0){ - myGainsFile< 6.0 && Slope[i] < 11.0) { + myGainsFile << index_id[i] << " " << Slope[i] << " " << Intercept[i] << " " << gainChi2[i] << std::endl; + if (flag == 1 || flag1 == 1) { + std::cout << "Flag not 0: " << index_id[i] << " " << flag << " " << flag1 << std::endl; } } } + return 0; } diff --git a/CalibMuon/CSCCalibration/test/readMatrix.cpp b/CalibMuon/CSCCalibration/test/readMatrix.cpp index c7edfa54c43c6..082dfffaf80c4 100644 --- a/CalibMuon/CSCCalibration/test/readMatrix.cpp +++ b/CalibMuon/CSCCalibration/test/readMatrix.cpp @@ -6,13 +6,12 @@ using namespace std; -int main() -{ - float elem33,elem34,elem44,elem35,elem45,elem55,elem46,elem56,elem66,elem57,elem67,elem77; - int index,flag,flag1; - int nrlines=0; +int main() { + float elem33, elem34, elem44, elem35, elem45, elem55, elem46, elem56, elem66, elem57, elem67, elem77; + int index, flag, flag1; + int nrlines = 0; - std::vector index_id; + std::vector index_id; std::vector Elem33; std::vector Elem34; std::vector Elem44; @@ -27,16 +26,15 @@ int main() std::vector Elem77; std::ifstream dbdata; - dbdata.open("FileName",std::ios::in); - if(!dbdata) - { - std::cerr <<"Error: FileName -> no such file!"<< std::endl; - exit(1); + dbdata.open("FileName", std::ios::in); + if (!dbdata) { + std::cerr << "Error: FileName -> no such file!" << std::endl; + return 1; } - while (!dbdata.eof() ) - { - dbdata >> index >>elem33>>elem34>>elem44>>elem35>>elem45>>elem55>>elem46>>elem56>>elem66>>elem57>>elem67>>elem77 >>flag >>flag1; + while (!dbdata.eof()) { + dbdata >> index >> elem33 >> elem34 >> elem44 >> elem35 >> elem45 >> elem55 >> elem46 >> elem56 >> elem66 >> + elem57 >> elem67 >> elem77 >> flag >> flag1; index_id.push_back(index); Elem33.push_back(elem33); Elem34.push_back(elem34); @@ -53,48 +51,32 @@ int main() nrlines++; } dbdata.close(); - std::ofstream myMatrixFile("GoodVals_FileName",std::ios::out); + std::ofstream myMatrixFile("GoodVals_FileName", std::ios::out); - for(int i=0; i0) - { - if (Elem34[i]>-5.0 && Elem34[i]<15.0) - { - if (Elem44[i]>0 && Elem44[i]<30.0) - { - if (Elem35[i]<25. && Elem35[i]>-5.0) - { - if (Elem45[i]<30.&& Elem45[i]>-5.0) - { - if (Elem55[i]<30.&& Elem55[i]>0) - { - if (Elem46[i]>-5. && Elem46[i]<30.0) - { - if(Elem56[i]<25.&& Elem56[i]>-5.0) - { - if (Elem66[i]<25.&& Elem66[i]>0) - { - if (Elem57[i]>-5. && Elem57[i]<30.0) - { - if (Elem67[i]<15.0 && Elem67[i]>-5.0) - { - if (Elem77[i]<25. && Elem77[i]>0 ) - { - if(Elem34[i]*Elem34[i] 0) { + if (Elem34[i] > -5.0 && Elem34[i] < 15.0) { + if (Elem44[i] > 0 && Elem44[i] < 30.0) { + if (Elem35[i] < 25. && Elem35[i] > -5.0) { + if (Elem45[i] < 30. && Elem45[i] > -5.0) { + if (Elem55[i] < 30. && Elem55[i] > 0) { + if (Elem46[i] > -5. && Elem46[i] < 30.0) { + if (Elem56[i] < 25. && Elem56[i] > -5.0) { + if (Elem66[i] < 25. && Elem66[i] > 0) { + if (Elem57[i] > -5. && Elem57[i] < 30.0) { + if (Elem67[i] < 15.0 && Elem67[i] > -5.0) { + if (Elem77[i] < 25. && Elem77[i] > 0) { + if (Elem34[i] * Elem34[i] < Elem33[i] && Elem34[i] * Elem34[i] < Elem44[i]) { + if (Elem35[i] * Elem35[i] < Elem33[i] && Elem35[i] * Elem35[i] < Elem55[i]) { + if (Elem45[i] * Elem45[i] < Elem44[i] && Elem45[i] * Elem45[i] < Elem55[i]) { + if (Elem46[i] * Elem46[i] < Elem44[i] && Elem46[i] * Elem46[i] < Elem66[i]) { + if (Elem56[i] * Elem56[i] < Elem55[i] && Elem56[i] * Elem56[i] < Elem66[i]) { + if (Elem57[i] * Elem57[i] < Elem55[i] && Elem57[i] * Elem57[i] < Elem77[i]) { + myMatrixFile << index_id[i] << " " << Elem33[i] << " " << Elem34[i] << " " + << Elem44[i] << " " << Elem35[i] << " " << Elem45[i] << " " + << Elem55[i] << " " << Elem46[i] << " " << Elem56[i] << " " + << Elem66[i] << " " << Elem57[i] << " " << Elem67[i] << " " + << Elem77[i] << std::endl; } } } @@ -113,9 +95,8 @@ int main() } } } - if (flag==1 || flag1!=1) - { - std::cout<<"Flag not 0: "< index_id; + std::vector index_id; std::vector Ped; std::vector pedChi2; - - std::ifstream dbdata; - dbdata.open("FileName",std::ios::in); - if(!dbdata) { - std::cerr <<"Error: FileName -> no such file!"<< std::endl; - exit(1); + + std::ifstream dbdata; + dbdata.open("FileName", std::ios::in); + if (!dbdata) { + std::cerr << "Error: FileName -> no such file!" << std::endl; + return 1; } - while (!dbdata.eof() ) { - dbdata >> index >> peds >>chi2 >>flag >>flag1; + while (!dbdata.eof()) { + dbdata >> index >> peds >> chi2 >> flag >> flag1; index_id.push_back(index); Ped.push_back(peds); pedChi2.push_back(chi2); nrlines++; } dbdata.close(); - std::ofstream myPedsFile("GoodVals_FileName",std::ios::out); - - for(int i=0; i400.0 && Ped[i]<1000.0){ - myPedsFile< 400.0 && Ped[i] < 1000.0) { + myPedsFile << index_id[i] << " " << Ped[i] << " " << pedChi2[i] << std::endl; + if (flag == 1 || flag1 == 1) { + std::cout << "Flag not 0: " << index_id[i] << " " << flag << " " << flag1 << std::endl; } } } + return 0; } diff --git a/CalibMuon/CSCCalibration/test/readXtalk.cpp b/CalibMuon/CSCCalibration/test/readXtalk.cpp index 78620942153a7..337a58991e1da 100644 --- a/CalibMuon/CSCCalibration/test/readXtalk.cpp +++ b/CalibMuon/CSCCalibration/test/readXtalk.cpp @@ -5,13 +5,12 @@ #include #include - using namespace std; -int main(){ - float leftslope,leftint,rightslope,rightint; - int index,extra1,extra2; - int nrlines1=0; +int main() { + float leftslope, leftint, rightslope, rightint; + int index, extra1, extra2; + int nrlines1 = 0; std::vector index_id; std::vector leftSlope; @@ -20,16 +19,16 @@ int main(){ std::vector rightSlope; std::vector rightInt; - std::ifstream newdata; - newdata.open("FileName",std::ios::in); - //newdata.open("dbxtalk.dat",std::ios::in); - if(!newdata) { - std::cerr <<"FileName -> no such file!"<< std::endl; - exit(1); + std::ifstream newdata; + newdata.open("FileName", std::ios::in); + //newdata.open("dbxtalk.dat",std::ios::in); + if (!newdata) { + std::cerr << "FileName -> no such file!" << std::endl; + return 1; } - while (!newdata.eof() ) { - newdata >> index >> leftslope >> leftint >> rightslope >> rightint >> extra1 >> extra2; + while (!newdata.eof()) { + newdata >> index >> leftslope >> leftint >> rightslope >> rightint >> extra1 >> extra2; index_id.push_back(index); leftSlope.push_back(leftslope); leftInt.push_back(leftint); @@ -39,13 +38,15 @@ int main(){ } newdata.close(); - std::ofstream myXtalkFile("GoodVals_FileName",std::ios::out); - for(int i=0; iGetenv("PUB_INPUT_FILE") ; - TString pub_input_folder = gSystem->Getenv("PUB_INPUT_FOLDER") ; - TString pub_output_dir = gSystem->Getenv("PUB_OUTPUT_DIR") ; - TString pub_title = gSystem->Getenv("PUB_TITLE") ; - TString pub_comment = gSystem->Getenv("PUB_COMMENT") ; +int elePublishHistos() { + TString pub_input_file = gSystem->Getenv("PUB_INPUT_FILE"); + TString pub_input_folder = gSystem->Getenv("PUB_INPUT_FOLDER"); + TString pub_output_dir = gSystem->Getenv("PUB_OUTPUT_DIR"); + TString pub_title = gSystem->Getenv("PUB_TITLE"); + TString pub_comment = gSystem->Getenv("PUB_COMMENT"); // prepare unix output directory - pub_output_dir = gSystem->ExpandPathName(pub_output_dir.Data()) ; - if (gSystem->AccessPathName(pub_output_dir.Data())==kFALSE) - { std::cout<<"Output directory is "<mkdir(pub_output_dir,kTRUE)<0) - { std::cerr<<"Failed to create "<ExpandPathName(pub_output_dir.Data()); + if (gSystem->AccessPathName(pub_output_dir.Data()) == kFALSE) { + std::cout << "Output directory is " << pub_output_dir << std::endl; + } else if (gSystem->mkdir(pub_output_dir, kTRUE) < 0) { + std::cerr << "Failed to create " << pub_output_dir << std::endl; + return 1; + } else { + std::cout << "Creating " << pub_output_dir << std::endl; + } // open input file - if (gSystem->CopyFile(pub_input_file.Data(),(pub_output_dir+"/"+pub_input_file).Data(),kTRUE)<0) - { std::cerr<<"Failed to copy "<cd(pub_input_folder)!=kTRUE) - { std::cerr<<"Do not find "<CopyFile(pub_input_file.Data(), (pub_output_dir + "/" + pub_input_file).Data(), kTRUE) < 0) { + std::cerr << "Failed to copy " << pub_input_file << std::endl; + return 2; + } else { + std::cout << "Input file is " << pub_input_file << std::endl; + } + TFile *file = TFile::Open(pub_input_file); + if (file != 0) { + std::cout << "Opening " << pub_input_file << std::endl; + if (file->cd(pub_input_folder) != kTRUE) { + std::cerr << "Do not find " << pub_input_folder << std::endl; + return 4; + } else { + std::cout << "Input folder is " << pub_input_folder << std::endl; + } + } else { + std::cerr << "Failed to open " << pub_input_file << std::endl; + return 3; + } // web page header - std::ofstream web_page((pub_output_dir+"/index.html").Data()) ; - web_page - <<"\n" - <<"\n" - <<"\n" - <<"\n" - <<""<<pub_title<<"\n" - <<"\n" - <<"

"<

\n" ; - web_page<<"

"<" - <<"DQMOffline/EGamma/test/ElectronAnalyzer_cfg.py and " - <<"" - <<"DQMOffline/EGamma/test/ElectronOfflineClient_cfg.py." ; - web_page - <<" One can download the full histograms file." ; - web_page<<"

\n" ; + std::ofstream web_page((pub_output_dir + "/index.html").Data()); + web_page << "\n" + << "\n" + << "\n" + << "\n" + << "" << pub_title << "\n" + << "\n" + << "

" << pub_title << "

\n"; + web_page << "

" << pub_comment; + web_page << " They were made using configurations " + << "" + << "DQMOffline/EGamma/test/ElectronAnalyzer_cfg.py and " + << "" + << "DQMOffline/EGamma/test/ElectronOfflineClient_cfg.py."; + web_page << " One can download the full histograms file."; + web_page << "

\n"; // style - TStyle *eleStyle = new TStyle("eleStyle","Style for electron dqm offline"); + TStyle *eleStyle = new TStyle("eleStyle", "Style for electron dqm offline"); eleStyle->SetCanvasBorderMode(0); eleStyle->SetCanvasColor(kWhite); eleStyle->SetCanvasDefH(600); @@ -95,8 +96,8 @@ int elePublishHistos() eleStyle->SetTitleYOffset(1.0); eleStyle->SetLabelOffset(0.005, "XYZ"); eleStyle->SetTitleSize(0.05, "XYZ"); - eleStyle->SetTitleFont(22,"X"); - eleStyle->SetTitleFont(22,"Y"); + eleStyle->SetTitleFont(22, "X"); + eleStyle->SetTitleFont(22, "Y"); eleStyle->SetHistLineWidth(2); eleStyle->SetPadBottomMargin(0.13); eleStyle->SetPadLeftMargin(0.15); @@ -106,150 +107,145 @@ int elePublishHistos() gROOT->ForceStyle(); // variables for the next loops - int cat_num ; - TList * keys1, * keys2 ; - TKey * key1, * key2 ; - TObject * obj1, * obj2 ; - TDirectory * dir ; - TH1 * histo ; - TString short_histo_name, anchor_name, histo_option ; - file->cd(pub_input_folder) ; - keys1 = gDirectory->GetListOfKeys() ; - TIter * nextKey1, * nextKey2 ; + int cat_num; + TList *keys1, *keys2; + TKey *key1, *key2; + TObject *obj1, *obj2; + TDirectory *dir; + TH1 *histo; + TString short_histo_name, anchor_name, histo_option; + file->cd(pub_input_folder); + keys1 = gDirectory->GetListOfKeys(); + TIter *nextKey1, *nextKey2; // top table - std::cout<<"Writing top table"<" - <<"\n" ; - cat_num = 0 ; - file->cd(pub_input_folder) ; - keys1 = gDirectory->GetListOfKeys() ; - nextKey1 = new TIter(keys1) ; - while (key1 = (TKey *)(*nextKey1)()) - { - obj1 = key1->ReadObj() ; - if (obj1->IsA()->InheritsFrom("TDirectory")==kFALSE) - { std::cout<<"Ignoring object "<GetName()<GetName()<"<GetName()<<"

\n" ; - keys2 = dir->GetListOfKeys() ; - nextKey2 = new TIter(keys2) ; - while (key2 = (TKey *)(*nextKey2)()) - { - obj2 = key2->ReadObj() ; - if (obj2->IsA()->InheritsFrom("TH1")==kFALSE) - { std::cout<<"Ignoring object "<GetName()<GetName() ; + std::cout << "Writing top table" << std::endl; + web_page << "
" + << "\n"; + cat_num = 0; + file->cd(pub_input_folder); + keys1 = gDirectory->GetListOfKeys(); + nextKey1 = new TIter(keys1); + while (key1 = (TKey *)(*nextKey1)()) { + obj1 = key1->ReadObj(); + if (obj1->IsA()->InheritsFrom("TDirectory") == kFALSE) { + std::cout << "Ignoring object " << obj1->GetName() << std::endl; + continue; + } else { + std::cout << "Processing folder " << obj1->GetName() << std::endl; + } + dir = (TDirectory *)obj1; + web_page << "\n" ; - cat_num++ ; - if ((cat_num%5)==0) - { web_page<<"\n" ; } - } - web_page<<"
" << dir->GetName() << "

\n"; + keys2 = dir->GetListOfKeys(); + nextKey2 = new TIter(keys2); + while (key2 = (TKey *)(*nextKey2)()) { + obj2 = key2->ReadObj(); + if (obj2->IsA()->InheritsFrom("TH1") == kFALSE) { + std::cout << "Ignoring object " << obj2->GetName() << std::endl; + continue; + } + short_histo_name = obj2->GetName(); //short_histo_name.Remove(0,3) ; - anchor_name = dir->GetName() ; - anchor_name += "_" ; - anchor_name += short_histo_name ; - web_page<<""<
\n" ; - } - web_page<<"
\n" ; + anchor_name = dir->GetName(); + anchor_name += "_"; + anchor_name += short_histo_name; + web_page << "" << short_histo_name << "
\n"; + } + web_page << "
\n"; + cat_num++; + if ((cat_num % 5) == 0) { + web_page << "\n"; + } + } + web_page << "\n"; // histograms - std::cout<<"Plotting histograms"<
\n
\n" ; - TCanvas * canvas ; - TString left_histo_name, histo_name, gif_name, gif_path, canvas_name ; - cat_num = 0 ; - file->cd(pub_input_folder) ; - keys1 = gDirectory->GetListOfKeys() ; - nextKey1 = new TIter(keys1) ; - while (key1 = (TKey *)(*nextKey1)()) - { - obj1 = key1->ReadObj() ; - if (obj1->IsA()->InheritsFrom("TDirectory")==kFALSE) - { continue ; } - dir = (TDirectory *)obj1 ; - keys2 = dir->GetListOfKeys() ; - nextKey2 = new TIter(keys2) ; - while (key2 = (TKey *)(*nextKey2)()) - { - obj2 = key2->ReadObj() ; - if (obj2->IsA()->InheritsFrom("TH1")==kFALSE) - { std::cout<<"Ignoring object "<GetName()<GetName()<<"/"<GetName()<<";"<GetCycle() - <<" has "<GetEntries()<<" entries" - <<" (~"<GetEffectiveEntries()<<")" - <<" of mean value "<GetMean() - <GetName() ; - if (left_histo_name.IsNull()==kFALSE) - { - if (histo_name.Index(left_histo_name)==0) - { web_page<<"" ; } - else - { - left_histo_name = histo_name ; - web_page<<"
" ; - } - } - else - { left_histo_name = histo_name ; } - - short_histo_name = histo_name ; + std::cout << "Plotting histograms" << std::endl; + gErrorIgnoreLevel = kWarning; + web_page << "

\n
\n"; + TCanvas *canvas; + TString left_histo_name, histo_name, gif_name, gif_path, canvas_name; + cat_num = 0; + file->cd(pub_input_folder); + keys1 = gDirectory->GetListOfKeys(); + nextKey1 = new TIter(keys1); + while (key1 = (TKey *)(*nextKey1)()) { + obj1 = key1->ReadObj(); + if (obj1->IsA()->InheritsFrom("TDirectory") == kFALSE) { + continue; + } + dir = (TDirectory *)obj1; + keys2 = dir->GetListOfKeys(); + nextKey2 = new TIter(keys2); + while (key2 = (TKey *)(*nextKey2)()) { + obj2 = key2->ReadObj(); + if (obj2->IsA()->InheritsFrom("TH1") == kFALSE) { + std::cout << "Ignoring object " << obj2->GetName() << std::endl; + continue; + } + histo = (TH1 *)obj2; + + std::cout << dir->GetName() << "/" << histo->GetName() << ";" << key2->GetCycle() << " has " + << histo->GetEntries() << " entries" + << " (~" << histo->GetEffectiveEntries() << ")" + << " of mean value " << histo->GetMean() << std::endl; + + histo_name = histo->GetName(); + if (left_histo_name.IsNull() == kFALSE) { + if (histo_name.Index(left_histo_name) == 0) { + web_page << ""; + } else { + left_histo_name = histo_name; + web_page << "
"; + } + } else { + left_histo_name = histo_name; + } + + short_histo_name = histo_name; //short_histo_name.Remove(0,3) ; - anchor_name = dir->GetName() ; - anchor_name += "_" ; - anchor_name += short_histo_name ; - gif_name = anchor_name+".gif" ; - gif_path = pub_output_dir+"/"+gif_name ; - canvas_name = "c_" ; - canvas_name += anchor_name ; - canvas = new TCanvas(canvas_name) ; - canvas->SetFillColor(10) ; - - histo->SetLineColor(2) ; - histo->SetMarkerColor(2) ; - histo->SetLineWidth(3) ; - - histo_option = histo->GetOption() ; - if ((histo_option.Contains("ELE_LOGY")==kTRUE)&&(histo->GetEntries()>0)&&(histo->GetMaximum()>0)) - { canvas->SetLogy(1) ; } - - if (histo->IsA()->InheritsFrom("TH2")==kTRUE) - { - gStyle->SetPalette(1) ; - gStyle->SetOptStat(111) ; - histo->Draw(/*"COLZ"*/) ; - } - else if (histo->IsA()->InheritsFrom("TProfile")==kTRUE) - { - gStyle->SetOptStat(111) ; - histo->Draw(/*"E1 P"*/) ; - } - else - { - gStyle->SetOptStat(111111) ; - histo->Draw(/*"E1 P"*/) ; - } - canvas->SaveAs(gif_path.Data()) ; - - web_page - <<"" - <<"
\n" ; - } - } - web_page<<"
\n" ; + anchor_name = dir->GetName(); + anchor_name += "_"; + anchor_name += short_histo_name; + gif_name = anchor_name + ".gif"; + gif_path = pub_output_dir + "/" + gif_name; + canvas_name = "c_"; + canvas_name += anchor_name; + canvas = new TCanvas(canvas_name); + canvas->SetFillColor(10); + + histo->SetLineColor(2); + histo->SetMarkerColor(2); + histo->SetLineWidth(3); + + histo_option = histo->GetOption(); + if ((histo_option.Contains("ELE_LOGY") == kTRUE) && (histo->GetEntries() > 0) && (histo->GetMaximum() > 0)) { + canvas->SetLogy(1); + } + + if (histo->IsA()->InheritsFrom("TH2") == kTRUE) { + gStyle->SetPalette(1); + gStyle->SetOptStat(111); + histo->Draw(/*"COLZ"*/); + } else if (histo->IsA()->InheritsFrom("TProfile") == kTRUE) { + gStyle->SetOptStat(111); + histo->Draw(/*"E1 P"*/); + } else { + gStyle->SetOptStat(111111); + histo->Draw(/*"E1 P"*/); + } + canvas->SaveAs(gif_path.Data()); + + web_page << "" + << "
\n"; + } + } + web_page << "
\n"; // the end - web_page<<"\n"<" << std::endl; + web_page.close(); + std::cout << "Histos written to " << pub_output_dir << std::endl; + return 0; +} diff --git a/DataFormats/FWLite/test/chainevent_looping_cint.C b/DataFormats/FWLite/test/chainevent_looping_cint.C index 9872275da122a..bf8c8896585c4 100644 --- a/DataFormats/FWLite/test/chainevent_looping_cint.C +++ b/DataFormats/FWLite/test/chainevent_looping_cint.C @@ -4,11 +4,11 @@ using namespace std; #if defined(__CINT__) && !defined(__MAKECINT__) class loadFWLite { - public: - loadFWLite() { - gSystem->Load("libFWCoreFWLite"); - FWLiteEnabler::enable(); - } +public: + loadFWLite() { + gSystem->Load("libFWCoreFWLite"); + FWLiteEnabler::enable(); + } }; static loadFWLite lfw; @@ -20,93 +20,93 @@ static loadFWLite lfw; #include "DataFormats/TestObjects/interface/ThingCollection.h" #endif -void chainevent_looping_cint() -{ -vector files; -files.push_back("empty_a.root"); -files.push_back("good_a.root"); -files.push_back("empty_a.root"); -files.push_back("good_b.root"); -files.push_back("empty_a.root"); -fwlite::ChainEvent e(files); +int chainevent_looping_cint() { + vector files; + files.push_back("empty_a.root"); + files.push_back("good_a.root"); + files.push_back("empty_a.root"); + files.push_back("good_b.root"); + files.push_back("empty_a.root"); + fwlite::ChainEvent e(files); + + int i = 0; + int returnValue = 0; + TFile* f = 0; -int i =0; -int returnValue = 0; -TFile* f = 0; + for (; e.isValid(); ++e, ++i) { + if (e.getTFile() != f) { + f = e.getTFile(); + cout << "New file " << f->GetName() << endl; + } -for( ;e.isValid();++e,++i) { - if (e.getTFile() != f) { - f = e.getTFile(); - cout << "New file " << f->GetName() << endl; + fwlite::Handle > pThing; + //pThing.getByLabel(e,"Thing","","TEST"); //WORKS + pThing.getByLabel(e, "Thing"); + + for (i = 0; i != pThing.ref().size(); ++i) { + cout << pThing.ref().at(i).a << " "; + } + cout << endl; } + if (i == 0) { + cout << "First loop failed!" << endl; + returnValue = 1; + } + e.toBegin(); - fwlite::Handle > pThing; - //pThing.getByLabel(e,"Thing","","TEST"); //WORKS - pThing.getByLabel(e,"Thing"); - - for(i=0; i!=pThing.ref().size();++i) { - cout < > pThing; + //pThing.getByLabel(e,"Thing","","TEST"); //WORKS + pThing.getByLabel(e, "Thing"); -i=0; -for(e.toBegin(); !e.atEnd();++e,++i) { - fwlite::Handle > pThing; - //pThing.getByLabel(e,"Thing","","TEST"); //WORKS - pThing.getByLabel(e,"Thing"); - - for(i=0; i!=pThing.ref().size();++i) { - cout <::const_iterator it = pThing.data()->begin(); it != pThing.data()->end();++it) { - // cout <<(*it).a<::const_iterator it = pThing.data()->begin(); it != pThing.data()->end();++it) { + // cout <<(*it).a<Load("libFWCoreFWLite"); - FWLiteEnabler::enable(); - } +public: + loadFWLite() { + gSystem->Load("libFWCoreFWLite"); + FWLiteEnabler::enable(); + } }; static loadFWLite lfw; @@ -20,57 +20,56 @@ static loadFWLite lfw; #include "DataFormats/TestObjects/interface/ThingCollection.h" #endif -void event_looping_cint() -{ -TFile f("good_a.root"); -fwlite::Event e(&f); +int event_looping_cint() { + TFile f("good_a.root"); + fwlite::Event e(&f); + + int i = 0; + int returnValue = 0; + for (; e.isValid(); ++e, ++i) { + fwlite::Handle > pThing; + //pThing.getByLabel(e,"Thing","","TEST"); //WORKS + pThing.getByLabel(e, "Thing"); -int i =0; -int returnValue = 0; -for( ;e.isValid();++e,++i) { - fwlite::Handle > pThing; - //pThing.getByLabel(e,"Thing","","TEST"); //WORKS - pThing.getByLabel(e,"Thing"); - - for(int i=0; i!=pThing.ref().size();++i) { - cout < > pThing; - //pThing.getByLabel(e,"Thing","","TEST"); //WORKS - pThing.getByLabel(e,"Thing"); - - for(int i=0; i!=pThing.ref().size();++i) { - cout < > pThing; + //pThing.getByLabel(e,"Thing","","TEST"); //WORKS + pThing.getByLabel(e, "Thing"); - //DOES NOT WORK - //for(vector::const_iterator it = pThing.data()->begin(); it != pThing.data()->end();++it) { - // cout <<(*it).a<::const_iterator it = pThing.data()->begin(); it != pThing.data()->end();++it) { + // cout <<(*it).a<Load("libFWCoreFWLite"); - FWLiteEnabler::enable(); - } +public: + loadFWLite() { + gSystem->Load("libFWCoreFWLite"); + FWLiteEnabler::enable(); + } }; static loadFWLite lfw; @@ -20,96 +20,94 @@ static loadFWLite lfw; #include "DataFormats/TestObjects/interface/ThingCollection.h" #endif -void runlumi_looping_cint() -{ - TFile f("prodmerge.root"); - fwlite::Run r(&f); - fwlite::LuminosityBlock l(&f); - - int i =0; - int returnValue = 0; - for( ;r.isValid();++r,++i) { - cout << r.run() << endl; - fwlite::Handle > pThing; - pThing.getByLabel(r,"Thing","beginRun"); - - for(int i=0; i!=pThing.ref().size();++i) { - cout < > pThing; + pThing.getByLabel(r, "Thing", "beginRun"); - i =0; - returnValue = 0; - for( ;l.isValid();++l,++i) { - cout << l.id().run() << " " << l.id().luminosityBlock() << endl; - fwlite::Handle > pThing; - pThing.getByLabel(l,"Thing","beginLumi"); - - for(int i=0; i!=pThing.ref().size();++i) { - cout < > pThing; + pThing.getByLabel(l, "Thing", "beginLumi"); - r.toBegin(); - i=0; - for( ;r;++r,++i) { - } - if (i==0) { - cout <<"Second run loop failed!"< > pThing; - pThing.getByLabel(r,"Thing","endRun"); - - for(int i=0; i!=pThing.ref().size();++i) { - cout < > pThing; + pThing.getByLabel(r, "Thing", "endRun"); - i=0; - for(l.toBegin(); !l.atEnd();++l,++i) { - cout << l.id().run() << " " << l.id().luminosityBlock() << endl; - fwlite::Handle > pThing; - pThing.getByLabel(l,"Thing","endLumi"); - - for(int i=0; i!=pThing.ref().size();++i) { - cout < > pThing; + pThing.getByLabel(l, "Thing", "endLumi"); + + for (int i = 0; i != pThing.ref().size(); ++i) { + cout << pThing.ref().at(i).a << " "; } + cout << endl; + } + if (i == 0) { + cout << "Third lumi loop failed!" << endl; + returnValue = 1; + } - exit(returnValue); + return returnValue; } diff --git a/DataFormats/FWLite/test/triggernames_cint.C b/DataFormats/FWLite/test/triggernames_cint.C index c9ad3bc4f88b2..ce09fe38c52a7 100644 --- a/DataFormats/FWLite/test/triggernames_cint.C +++ b/DataFormats/FWLite/test/triggernames_cint.C @@ -1,10 +1,10 @@ #if defined(__CINT__) && !defined(__MAKECINT__) class loadFWLite { - public: - loadFWLite() { - gSystem->Load("libFWCoreFWLite"); - FWLiteEnabler::enable(); - } +public: + loadFWLite() { + gSystem->Load("libFWCoreFWLite"); + FWLiteEnabler::enable(); + } }; static loadFWLite lfw; @@ -16,8 +16,7 @@ static loadFWLite lfw; #include #include -void triggernames_cint() -{ +int triggernames_cint() { // TFile f1("prodmerge.root"); // fwlite::Event ev(&f1); @@ -26,12 +25,12 @@ void triggernames_cint() fwlite::ChainEvent ev(files); fwlite::Handle hTriggerResults; - + int iEvent = 0; - for (ev.toBegin(); ! ev.atEnd(); ++ev) { + for (ev.toBegin(); !ev.atEnd(); ++ev) { ++iEvent; - hTriggerResults.getByLabel(ev,"TriggerResults","","TEST"); - edm::TriggerNames const& triggerNames = ev.triggerNames(*hTriggerResults); + hTriggerResults.getByLabel(ev, "TriggerResults", "", "TEST"); + edm::TriggerNames const& triggerNames = ev.triggerNames(*hTriggerResults); std::vector const& names = triggerNames.triggerNames(); for (unsigned i = 0; i < triggerNames.size(); ++i) { @@ -43,19 +42,13 @@ void triggernames_cint() std::cout << "index for p2 = " << triggerNames.triggerIndex("p2") << std::endl; if (iEvent == 1) { - if (triggerNames.size() != 3U || - names[0] != "p" || - names[1] != "p1" || - names[2] != "p2" || - triggerNames.triggerName(0) != "p" || - triggerNames.triggerName(1) != "p1" || - triggerNames.triggerName(2) != "p2" || - triggerNames.triggerIndex("p") != 0 || - triggerNames.triggerIndex("p1") != 1 || - triggerNames.triggerIndex("p2") != 2) { - std::cout << "Trigger names do match expected values\n"; - std::cout << "In script triggernames_cint.C\n"; - exit(1); + if (triggerNames.size() != 3U || names[0] != "p" || names[1] != "p1" || names[2] != "p2" || + triggerNames.triggerName(0) != "p" || triggerNames.triggerName(1) != "p1" || + triggerNames.triggerName(2) != "p2" || triggerNames.triggerIndex("p") != 0 || + triggerNames.triggerIndex("p1") != 1 || triggerNames.triggerIndex("p2") != 2) { + std::cout << "Trigger names do match expected values\n"; + std::cout << "In script triggernames_cint.C\n"; + return 1; } } @@ -71,4 +64,5 @@ void triggernames_cint() } */ } + return 0; } diff --git a/DataFormats/FWLite/test/triggernames_multi_cint.C b/DataFormats/FWLite/test/triggernames_multi_cint.C index 1e1107cbd96c2..696af4f01a8ec 100644 --- a/DataFormats/FWLite/test/triggernames_multi_cint.C +++ b/DataFormats/FWLite/test/triggernames_multi_cint.C @@ -1,10 +1,10 @@ #if defined(__CINT__) && !defined(__MAKECINT__) class loadFWLite { - public: - loadFWLite() { - gSystem->Load("libFWCoreFWLite"); - FWLiteEnabler::enable(); - } +public: + loadFWLite() { + gSystem->Load("libFWCoreFWLite"); + FWLiteEnabler::enable(); + } }; static loadFWLite lfw; @@ -16,8 +16,7 @@ static loadFWLite lfw; #include #include -void triggernames_multi_cint() -{ +int triggernames_multi_cint() { std::vector files1; files1.push_back(std::string("prodmerge.root")); @@ -27,12 +26,12 @@ void triggernames_multi_cint() fwlite::MultiChainEvent ev(files1, files2); fwlite::Handle hTriggerResults; - + int iEvent = 0; - for (ev.toBegin(); ! ev.atEnd(); ++ev) { + for (ev.toBegin(); !ev.atEnd(); ++ev) { ++iEvent; - hTriggerResults.getByLabel(ev,"TriggerResults","","TEST"); - edm::TriggerNames const& triggerNames = ev.triggerNames(*hTriggerResults); + hTriggerResults.getByLabel(ev, "TriggerResults", "", "TEST"); + edm::TriggerNames const& triggerNames = ev.triggerNames(*hTriggerResults); std::vector const& names = triggerNames.triggerNames(); for (unsigned i = 0; i < triggerNames.size(); ++i) { @@ -44,20 +43,15 @@ void triggernames_multi_cint() std::cout << "index for p2 = " << triggerNames.triggerIndex("p2") << std::endl; if (iEvent == 1) { - if (triggerNames.size() != 3U || - names[0] != "p" || - names[1] != "p1" || - names[2] != "p2" || - triggerNames.triggerName(0) != "p" || - triggerNames.triggerName(1) != "p1" || - triggerNames.triggerName(2) != "p2" || - triggerNames.triggerIndex("p") != 0 || - triggerNames.triggerIndex("p1") != 1 || - triggerNames.triggerIndex("p2") != 2) { - std::cout << "Trigger names do match expected values\n"; - std::cout << "In script triggernames_multi_cint.C\n"; - exit(1); + if (triggerNames.size() != 3U || names[0] != "p" || names[1] != "p1" || names[2] != "p2" || + triggerNames.triggerName(0) != "p" || triggerNames.triggerName(1) != "p1" || + triggerNames.triggerName(2) != "p2" || triggerNames.triggerIndex("p") != 0 || + triggerNames.triggerIndex("p1") != 1 || triggerNames.triggerIndex("p2") != 2) { + std::cout << "Trigger names do match expected values\n"; + std::cout << "In script triggernames_multi_cint.C\n"; + return 1; } } } + return 0; } diff --git a/FWCore/FWLite/test/autoload_with_missing_std.C b/FWCore/FWLite/test/autoload_with_missing_std.C index 94c0168194729..dcc63f2c5c81c 100644 --- a/FWCore/FWLite/test/autoload_with_missing_std.C +++ b/FWCore/FWLite/test/autoload_with_missing_std.C @@ -1,16 +1,16 @@ { -//NOTE: this test causes the macro to abort since -// edmtest is unknown at this point -//if( TClass::GetClass("vector") ) { -// cout <<"class already exists!"<Load("libFWCoreFWLite"); -FWLiteEnabler::enable(); -if( !TClass::GetClass("vector") ) { - exit(1); -} -cout <<"class loaded"<") ) { + // cout <<"class already exists!"<Load("libFWCoreFWLite"); + FWLiteEnabler::enable(); + if (!TClass::GetClass("vector")) { + return 1; + } + cout << "class loaded" << endl; + return 0; } diff --git a/FWCore/FWLite/test/autoload_with_namespace.C b/FWCore/FWLite/test/autoload_with_namespace.C index efc858e2084c2..c0a2c4592b5c7 100644 --- a/FWCore/FWLite/test/autoload_with_namespace.C +++ b/FWCore/FWLite/test/autoload_with_namespace.C @@ -1,16 +1,16 @@ { -if( TClass::GetClass("edmtest::Thing") ) { - cout <<"class already exists!"<Load("libFWCoreFWLite"); -FWLiteEnabler::enable(); -if( !TClass::GetClass("edmtest::Thing") ) { - cout <<"class still missing"<Load("libFWCoreFWLite"); + FWLiteEnabler::enable(); + if (!TClass::GetClass("edmtest::Thing")) { + cout << "class still missing" << endl; + return 1; + } + cout << "class loaded" << endl; + return 0; } diff --git a/FWCore/FWLite/test/autoload_with_std.C b/FWCore/FWLite/test/autoload_with_std.C index 7e4d8d038497e..43d0722ac12e3 100644 --- a/FWCore/FWLite/test/autoload_with_std.C +++ b/FWCore/FWLite/test/autoload_with_std.C @@ -1,17 +1,17 @@ { -//NOTE: this test causes the macro to abort since -// edmtest is unknown at this point -//if( TClass::GetClass("std::vector") ) { -// cout <<"class already exists!"<Load("libFWCoreFWLite"); -FWLiteEnabler::enable(); -if( !TClass::GetClass("std::vector") ) { - cout <<"class still missing"<") ) { + // cout <<"class already exists!"<Load("libFWCoreFWLite"); + FWLiteEnabler::enable(); + if (!TClass::GetClass("std::vector")) { + cout << "class still missing" << endl; + return 1; + } + cout << "class loaded" << endl; + return 0; }