File indexing completed on 2024-04-06 12:25:58
0001 {
0002 char *file_name = "cscHists.root";
0003 string nameOfTheHisto= "InefficientALCT_dydz";
0004 bool excludeChamberList[36];
0005 for(int iCh =0;iCh<36;++iCh){
0006 excludeChamberList[iCh] = false;
0007 }
0008
0009
0010
0011 int endcap = 1;
0012 int station = 2;
0013 int ring = 2;
0014 std::cout<<" Adding all "<<nameOfTheHisto<<" histograms from a E/S/R = "<<endcap<<"/"<<station<<"/"<<ring<<" and plotting the result..."<<std::endl;
0015 TFile *f1=
0016 (TFile*)gROOT->GetListOfFiles()->FindObject(file_name);
0017 if (!f1){
0018 TFile *f1 = new TFile(file_name);
0019 }
0020
0021
0022
0023
0024
0025
0026 TH1F *data_p1;
0027 TH1F *sum_histo;
0028
0029 char * charName;
0030 string histo;
0031 int iterations = 0;
0032 for(int iE=1;iE<3;++iE){
0033 if(iE!=endcap) continue;
0034 for(int iS=1;iS<5;++iS){
0035 if(iS!=station) continue;
0036 for(int iR=1;iR<4;++iR){
0037 if(iR != ring) continue;
0038 if(1!=iS && iR>2){
0039 continue;
0040 }
0041 else if(2==iR && 4==iS){
0042 continue;
0043 }
0044 for(int iC=1;iC<37;++iC){
0045 if(excludeChamberList[iC-1]) continue;
0046 if(1!=iS && 1==iR && iC >18){
0047 continue;
0048 }
0049 histo = Form("Chambers__E%d_S%d_R%d_Chamber_%d/%s_Ch%d",iE,iS,iR,iC,nameOfTheHisto,iC);
0050
0051 charName = histo.c_str();
0052 data_p1 =(TH1F*)(f1->Get(charName));
0053 if(!iterations){
0054 sum_histo=(TH1F*)data_p1->Clone();
0055 }
0056 else{
0057 sum_histo->Add(data_p1);
0058 }
0059 ++iterations;
0060 }
0061 }
0062 }
0063 }
0064 sum_histo->Draw();
0065
0066 }