Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:47:47

0001 {
0002 
0003 ifstream fpt;
0004 fpt.open("runname.txt");
0005 if (!fpt) { cout << "Error opening file ptranges.txt" << endl; assert(0);  }
0006 
0007 string filename;
0008 //Read in the cache file and store back to array
0009 fpt >> filename;
0010 
0011 TH1F htot("htot","Sum of all timeboxes",1000,0.,5000.);
0012 
0013 TFile f(filename.c_str());
0014 f.cd();
0015 
0016 TH1F *htemp;
0017 
0018 int count = 0;
0019 
0020 for(int wheel=-2;wheel<3;wheel++){
0021   for(int sector=1;sector<13;sector++){
0022     for(int chamber=1;chamber<5;chamber++){
0023       for(int SL=1;SL<4;SL++){
0024 
0025     stringstream swheel; swheel << wheel;    
0026     stringstream sstation; sstation << chamber;
0027     stringstream ssector; ssector << sector; 
0028     stringstream ssuperLayer; ssuperLayer << SL;
0029 
0030     string histoname = "Ch_" + swheel.str() + "_" + sstation.str() + "_" + ssector.str() + "_SL" + ssuperLayer.str() + "_hTimeBox";
0031 
0032     cout << histoname.c_str() << endl;
0033 
0034     htemp = (TH1F*)f.Get(histoname.c_str());
0035 
0036     if(!htemp) continue;
0037 
0038     if(count == 0) htot = *htemp;
0039     else htot.Add(htemp);
0040 
0041       }
0042     }
0043   }
0044 }
0045 
0046 //f.Close();
0047 
0048 TFile fout("htimeboxes.root","RECREATE");
0049 fout.cd();
0050 htot.Write();
0051 fout.Close();
0052 
0053 }