当前位置: 首页>>代码示例>>C++>>正文


C++ Events::nTauMap方法代码示例

本文整理汇总了C++中Events::nTauMap方法的典型用法代码示例。如果您正苦于以下问题:C++ Events::nTauMap方法的具体用法?C++ Events::nTauMap怎么用?C++ Events::nTauMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Events的用法示例。


在下文中一共展示了Events::nTauMap方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main


//.........这里部分代码省略.........
        printf(" id1: %d id2: %d id3: %d id4: %d id5: %d id6: %d id7: %d id8: %d id9: %d id10: %d id11: %d \n",
              (int)evt->tauId1()->at(i),(int)evt->tauId2()->at(i),(int)evt->tauId3()->at(i),(int)evt->tauId4()->at(i),
              (int)evt->tauId5()->at(i),(int)evt->tauId6()->at(i),(int)evt->tauId7()->at(i),(int)evt->tauId8()->at(i),
              (int)evt->tauId9()->at(i),(int)evt->tauId10()->at(i),(int)evt->tauId11()->at(i));      
        */
        int IdNum=0;

        for(int iPile=0;iPile<(sizeof(tauIdPile)/sizeof(tauIdPile[0]));iPile++){
          for(int iIso=0;iIso<(sizeof(tauIdIso)/sizeof(tauIdIso[0]));iIso++){
            for(int iMu=0;iMu<(sizeof(tauIdMu)/sizeof(tauIdMu[0]));iMu++){
              for(int iElec=0;iElec<(sizeof(tauIdElec)/sizeof(tauIdElec[0]));iElec++){
                IdNum++;
                if(tauIdElec[iElec]==1&&tauIdMu[iMu]==1&&tauIdIso[iIso]==1&&tauIdPile[iPile]==1)NtauVec[IdNum]++;
                  //printf(" iPile: %d => %d iIso: %d => %d iMu: %d => %d iElec: %d => %d \n",iPile,tauIdPile[iPile],iIso,tauIdIso[iIso],iMu,tauIdMu[iMu],iElec,tauIdElec[iElec]);
                  //printf(" id #: %d nTau: %d \n ",IdNum,NtauVec[IdNum]);
              }
            }
          }
        }
      } 

      for(int iId=0; iId<NtauVec.size();iId++){
        //printf(" @ \n iId: %d -> %s \n ",iId,idMap[iId].c_str());
        if(NtauVec[iId]==0){
          TauIDhist->Fill(iId-1,totWeight); 
          //cout << " filled \n ";
          if(sel->PionIsoTrk(evt->nIsoPion()))TauIDhist_trk->Fill(iId-1,totWeight);
        }
      }
    }
    // Build and array that contains the quantities we need a histogram for.
    // Here order is important and must be the same as RA2nocutvec
    double eveinfvec[] = {totWeight,(double) evt->ht(),(double) evt->mht() ,(double) evt->nJets(),(double) evt->nBtags()}; //the last one gives the RA2 defined number of jets.     


    //loop over all the different backgrounds: "allEvents", "Wlv", "Zvv"
    for(map<string, map<string , vector<TH1D> > >::iterator itt=map_map.begin(); itt!=map_map.end();itt++){//this will be terminated after the cuts

      ////determine what type of background should pass
      if(itt->first=="allEvents"){//all the cuts are inside this

        //Cuts//Cuts//Cuts//Cuts//Cuts//Cuts//Cuts//Cuts//Cuts//Cuts//Cuts//Cuts//Cuts//Cuts//Cuts//Cuts//Cuts//Cuts//Cuts//Cuts

        //////loop over cut names and fill the histograms
        for(map<string , vector<TH1D> >::iterator ite=cut_histvec_map.begin(); ite!=cut_histvec_map.end();ite++){

          if(sel->checkcut(ite->first,evt->ht(),evt->mht(),evt->deltaPhi1(),evt->deltaPhi2(),evt->deltaPhi3(),evt->deltaPhi4(),evt->nJets(),evt->nBtags(),evt->nLeptons(),evt->nIsoElec(),evt->nIsoMu(),evt->nIsoPion(),evt->nTauMap()[2233],evt->nTauMap()[2243],evt->nTauMap()[2333],evt->nTauMap()[4333],evt->nTauMap()[1333])==true){
             histobjmap[ite->first].fill(Nhists,&eveinfvec[0] ,&itt->second[ite->first][0]);
           } 
        }//end of loop over cut names

        ////EndOfCuts//EndOfCuts//EndOfCuts//EndOfCuts//EndOfCuts//EndOfCuts//EndOfCuts//EndOfCuts//EndOfCuts//EndOfCuts

      }//end of bg_type determination
    }//end of loop over all the different backgrounds: "allEvents", "Wlv", "Zvv"

    eventN++;
  } // End of loop over events


  //open a file to write the histograms
  sprintf(tempname,"%s/results_%s_%s.root",Outdir.c_str(),subSampleKey.c_str(),inputnumber.c_str());
  TFile *resFile = new TFile(tempname, "RECREATE");
  TDirectory *cdtoitt;
  TDirectory *cdtoit;

  cutflow_preselection->Write();
  TauIDhist->Write();
  TauIDhist_trk->Write();

  // Loop over different event categories (e.g. "All events, Wlnu, Zll, Zvv, etc")
  for(int iet=0;iet<(int)eventType.size();iet++){
    for(map<string, map<string , vector<TH1D> > >::iterator itt=map_map.begin(); itt!=map_map.end();itt++){
      if (eventType[iet]==itt->first){
        //KH
        ////std::cout << (itt->first).c_str() << std::endl;
        cdtoitt = resFile->mkdir((itt->first).c_str());
        cdtoitt->cd();
        for(int i=0; i< (int)sel->cutName().size();i++){
          for(map<string , vector<TH1D> >::iterator it=itt->second.begin(); it!=itt->second.end();it++){
            if (sel->cutName()[i]==it->first){
              cdtoit = cdtoitt->mkdir((it->first).c_str());
              cdtoit->cd();
              int nHist = it->second.size();
              for(int i=0; i<nHist; i++){//since we only have 4 type of histograms
                sprintf(tempname,"%s_%s_%s",it->second[i].GetName(),(it->first).c_str(),(itt->first).c_str());
                it->second[i].Write(tempname);
              }
              cdtoitt->cd();
            }
          }
        }
      }
    }
  }




}
开发者ID:hatakeyamak,项目名称:RA2-RA2b-2015,代码行数:101,代码来源:main.cpp


注:本文中的Events::nTauMap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。