本文整理汇总了C++中TVector3::Eta方法的典型用法代码示例。如果您正苦于以下问题:C++ TVector3::Eta方法的具体用法?C++ TVector3::Eta怎么用?C++ TVector3::Eta使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TVector3
的用法示例。
在下文中一共展示了TVector3::Eta方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute
StatusCode CorrectECalBarrelSliWinCluster::execute() {
// Get the input collection with clusters
const fcc::CaloClusterCollection* inClusters = m_inClusters.get();
fcc::CaloClusterCollection* correctedClusters = m_correctedClusters.createAndPut();
// for single particle events compare with truth particles
TVector3 momentum;
double phiVertex = 0;
double etaVertex = 0;
double thetaVertex = 0;
double zVertex = 0;
const auto particle = m_particle.get();
const auto vertex = m_vertex.get();
if (particle->size() == 1 && vertex->size() == 1) {
for(const auto& part : *particle) {
momentum = TVector3(part.core().p4.px, part.core().p4.py, part.core().p4.pz);
etaVertex = momentum.Eta();
phiVertex = momentum.Phi();
zVertex = vertex->begin()->position().z;
thetaVertex = 2 * atan( exp( - etaVertex ) );
verbose() << " vertex eta " << etaVertex << " phi = " << phiVertex << " theta = " << thetaVertex << " z = " << zVertex << endmsg;
}
}
// TODO change that so all systems can be used
uint systemId = m_systemId[0];
const dd4hep::DDSegmentation::FCCSWGridPhiEta* segmentation = nullptr;
if (m_segmentationPhiEta[systemId] != nullptr) {
segmentation = m_segmentationPhiEta[systemId];
}
std::vector<TLorentzVector> clustersMassInv;
std::vector<TLorentzVector> clustersMassInvScaled;
for (const auto& cluster : *inClusters) {
double oldEnergy = 0;
TVector3 pos(cluster.core().position.x, cluster.core().position.y, cluster.core().position.z);
double oldEta = pos.Eta();
double oldPhi = pos.Phi();
for (auto cell = cluster.hits_begin(); cell != cluster.hits_end(); cell++) {
oldEnergy += cell->core().energy;
}
verbose() << " OLD ENERGY = " << oldEnergy << " from " << cluster.hits_size() << " cells" << endmsg;
verbose() << " OLD CLUSTER ENERGY = " << cluster.core().energy << endmsg;
// Do everything only using the first defined calorimeter (default: Ecal barrel)
double oldEtaId = -1;
double oldPhiId = -1;
if (m_segmentationPhiEta[systemId] != nullptr) {
oldEtaId = int(floor((oldEta + 0.5 * segmentation->gridSizeEta() - segmentation->offsetEta()) / segmentation->gridSizeEta()));
oldPhiId = int(floor((oldPhi + 0.5 * segmentation->gridSizePhi() - segmentation->offsetPhi()) / segmentation->gridSizePhi()));
}
// 0. Create new cluster, copy information from input
fcc::CaloCluster newCluster = correctedClusters->create();
double energy = 0;
newCluster.core().position.x = cluster.core().position.x;
newCluster.core().position.y = cluster.core().position.y;
newCluster.core().position.z = cluster.core().position.z;
for (auto cell = cluster.hits_begin(); cell != cluster.hits_end(); cell++) {
if (m_segmentationMulti[systemId] != nullptr) {
segmentation = dynamic_cast<const dd4hep::DDSegmentation::FCCSWGridPhiEta*>(&m_segmentationMulti[systemId]->subsegmentation(cell->core().cellId));
oldEtaId = int(floor((oldEta + 0.5 * segmentation->gridSizeEta() - segmentation->offsetEta()) / segmentation->gridSizeEta()));
oldPhiId = int(floor((oldPhi + 0.5 * segmentation->gridSizePhi() - segmentation->offsetPhi()) / segmentation->gridSizePhi()));
}
if (m_decoder[systemId]->get(cell->core().cellId, "system") == systemId) {
uint layerId = m_decoder[systemId]->get(cell->core().cellId, "layer");
if(m_nPhiFinal[layerId] > 0 && m_nEtaFinal[layerId] > 0) {
uint etaId = m_decoder[systemId]->get(cell->core().cellId, "eta");
uint phiId = m_decoder[systemId]->get(cell->core().cellId, "phi");
if ( etaId >= (oldEtaId - m_halfEtaFin[layerId]) && etaId <= (oldEtaId + m_halfEtaFin[layerId]) &&
phiId >= phiNeighbour((oldPhiId - m_halfPhiFin[layerId]), segmentation->phiBins()) && phiId <= phiNeighbour((oldPhiId + m_halfPhiFin[layerId]), segmentation->phiBins()) ) {
if (m_ellipseFinalCluster) {
if ( pow( (etaId - oldEtaId) / (m_nEtaFinal[layerId] / 2.), 2) + pow( (phiId - oldPhiId) / (m_nPhiFinal[layerId] / 2.), 2) < 1) {
newCluster.addhits(*cell);
energy += cell->core().energy;
}
} else {
newCluster.addhits(*cell);
energy += cell->core().energy;
}
}
}
}
}
newCluster.core().energy = energy;
// 1. Correct eta position with log-weighting
double sumEnFirstLayer = 0;
// get current pseudorapidity
std::vector<double> sumEnLayer;
std::vector<double> sumEnLayerSorted;
std::vector<double> sumEtaLayer;
std::vector<double> sumWeightLayer;
sumEnLayer.assign(m_numLayers, 0);
sumEnLayerSorted.assign(m_numLayers, 0);
sumEtaLayer.assign(m_numLayers, 0);
sumWeightLayer.assign(m_numLayers, 0);
// first check the energy deposited in each layer
for (auto cell = newCluster.hits_begin(); cell != newCluster.hits_end(); cell++) {
dd4hep::DDSegmentation::CellID cID = cell->core().cellId;
//.........这里部分代码省略.........
示例2: HggTreeWriteLoop
//.........这里部分代码省略.........
else if ( mcIFSR_pho == 0 ) prompt0 = true;
if( prompt1 ) _minitree->mc_wXsec = 1.3*_weight_manager->xSecW();
}
if(mode_==1 || mode_==2 || mode_==3 || mode_==18 || mode_==19){
if(prompt0)isprompt0=1;
else isprompt0=0;
if(prompt1)isprompt1=1;
else isprompt1=0;
}
if( mode_ == 20 && isZgamma() ) continue;
/// wei weight is just temporary and may not contain all info.
float wei = _minitree->mc_wXsec * _minitree->mc_wPU
* _minitree->mc_wNgen * _minitree->mc_wHQT;
if( isData && !PassTriggerSelection() ) continue; nEvts[icutlevel++]++;
if( std::isinf( wei ) || std::isnan( wei ) )continue; nEvts[icutlevel++]++;
//// ********************* define S4 variable **********************////
for( int i=0; i<nPho; ++i){
if( _config->setup() == "ReReco2011" ) phoS4ratio[i] = 1;
else phoS4ratio[i] = phoE2x2[i] / phoE5x5[i];
}
//// ************************************************************* ////
if( !isData ) {
//// ************** MC corrections (mostly MC) ******************* ////
// 1. energy shifting / smearing
for( int i=0; i<nPho; ++i)
if( fabs(phoSCEta[i]) <= 2.5 ) {
float smearing = overSmear.randOverSmearing(phoSCEta[i],phoR9[i],isInGAP_EB(i),overSmearSyst);
phoRegrE[i] *= (1 + smearing);
phoE[i] *= (1 + smearing);
/// from MassFactorized in gglobe: energyCorrectedError[ipho] *=(l.pho_isEB[ipho]) ? 1.07 : 1.045 ;
float smearFactor = 1;
if( _config->setup() == "ReReco2011" ) smearFactor = fabs(phoSCEta[i]) < 1.45 ? 1.07: 1.045;
phoRegrErr[i] *= smearFactor;
}
// 2. reweighting of photon id variables (R9...)
for (int i=0; i<nPho; ++i) ReweightMC_phoIdVar(i);
//// ************************************************************* ////
}
//// ********** Apply regression energy ************* ////
float phoStdE[500];
for( int i=0; i<nPho; ++i)
if( fabs(phoSCEta[i]) <= 2.5 ) {
if( isData ){
float enCorrSkim = 1;//enScaleSkimEOS.energyScale( phoR9[i], phoSCEta[i], run);
float phoEnScale = enScale.energyScale( phoR9[i], phoSCEta[i], run)/enCorrSkim;
phoRegrE[i] *= phoEnScale;
phoE[i] *= phoEnScale;
}
phoStdE[i] = phoE[i];
phoE[i] = phoRegrE[i];
/// transform calo position abd etaVtx, phiVtx with SC position
for( int x = 0 ; x < 3; x++ ) phoCaloPos[i][x] = phoSCPos[i][x];
for( int ivtx = 0 ; ivtx < nVtxBS; ivtx++ ) {
TVector3 xxi = getCorPhotonTVector3(i,ivtx);
示例3: main
int main(int argc, char* argv[])
{
TApplication theApp(srcName.Data(), &argc, argv);
//=============================================================================
if (argc<5) return -1;
TString sPath = argv[1]; if (sPath.IsNull()) return -1;
TString sFile = argv[2]; if (sFile.IsNull()) return -1;
TString sJetR = argv[3]; if (sJetR.IsNull()) return -1;
TString sSjeR = argv[4]; if (sSjeR.IsNull()) return -1;
//=============================================================================
sPath.ReplaceAll("#", "/");
//=============================================================================
double dJetR = -1.;
if (sJetR=="JetR02") dJetR = 0.2;
if (sJetR=="JetR03") dJetR = 0.3;
if (sJetR=="JetR04") dJetR = 0.4;
if (sJetR=="JetR05") dJetR = 0.5;
if (dJetR<0.) return -1;
cout << "Jet R = " << dJetR << endl;
//=============================================================================
double dSjeR = -1.;
if (sSjeR=="SjeR01") dSjeR = 0.1;
if (sSjeR=="SjeR02") dSjeR = 0.2;
if (sSjeR=="SjeR03") dSjeR = 0.3;
if (sSjeR=="SjeR04") dSjeR = 0.4;
if (dSjeR<0.) return -1;
cout << "Sub-jet R = " << dSjeR << endl;
//=============================================================================
const double dJetsPtMin = 0.001;
const double dCutEtaMax = 1.6;
const double dJetEtaMax = 1.;
const double dJetAreaRef = TMath::Pi() * dJetR * dJetR;
fastjet::GhostedAreaSpec areaSpc(dCutEtaMax);
fastjet::JetDefinition jetsDef(fastjet::antikt_algorithm, dJetR, fastjet::BIpt_scheme, fastjet::Best);
//fastjet::AreaDefinition areaDef(fastjet::active_area,areaSpc);
fastjet::AreaDefinition areaDef(fastjet::active_area_explicit_ghosts,areaSpc);
//fastjet::JetDefinition bkgsDef(fastjet::kt_algorithm, 0.2, fastjet::BIpt_scheme, fastjet::Best);
//fastjet::AreaDefinition aBkgDef(fastjet::active_area_explicit_ghosts, areaSpc);
fastjet::Selector selectJet = fastjet::SelectorAbsEtaMax(dJetEtaMax);
//fastjet::Selector selectRho = fastjet::SelectorAbsEtaMax(dCutEtaMax-0.2);
//fastjet::Selector selecHard = fastjet::SelectorNHardest(2);
//fastjet::Selector selectBkg = selectRho * (!(selecHard));
//fastjet::JetMedianBackgroundEstimator bkgsEstimator(selectBkg, bkgsDef, aBkgDef);
//fastjet::Subtractor bkgSubtractor(&bkgsEstimator);
fastjet::JetDefinition subjDef(fastjet::antikt_algorithm, dSjeR, fastjet::BIpt_scheme, fastjet::Best);
//=============================================================================
std::vector<fastjet::PseudoJet> fjInput;
//=============================================================================
TList *list = new TList();
TH1D *hWeightSum = new TH1D("hWeightSum", "", 1, 0., 1.); list->Add(hWeightSum);
TH1D *hJet = new TH1D("hJet", "", 1000, 0., 1000.); hJet->Sumw2(); list->Add(hJet);
TH2D *hJetNsj = new TH2D("hJetNsj", "", 1000, 0., 1000., 101, -0.5, 100.5); hJetNsj->Sumw2(); list->Add(hJetNsj);
TH2D *hJetIsj = new TH2D("hJetIsj", "", 1000, 0., 1000., 1000, 0., 1000.); hJetIsj->Sumw2(); list->Add(hJetIsj);
TH2D *hJet1sj = new TH2D("hJet1sj", "", 1000, 0., 1000., 1000, 0., 1000.); hJet1sj->Sumw2(); list->Add(hJet1sj);
TH2D *hJet2sj = new TH2D("hJet2sj", "", 1000, 0., 1000., 1000, 0., 1000.); hJet2sj->Sumw2(); list->Add(hJet2sj);
TH2D *hJetDsj = new TH2D("hJetDsj", "", 1000, 0., 1000., 1000, 0., 1000.); hJetDsj->Sumw2(); list->Add(hJetDsj);
TH2D *hJetIsz = new TH2D("hJetIsz", "", 1000, 0., 1000., 120, 0., 1.2); hJetIsz->Sumw2(); list->Add(hJetIsz);
TH2D *hJet1sz = new TH2D("hJet1sz", "", 1000, 0., 1000., 120, 0., 1.2); hJet1sz->Sumw2(); list->Add(hJet1sz);
TH2D *hJet2sz = new TH2D("hJet2sz", "", 1000, 0., 1000., 120, 0., 1.2); hJet2sz->Sumw2(); list->Add(hJet2sz);
TH2D *hJetDsz = new TH2D("hJetDsz", "", 1000, 0., 1000., 120, 0., 1.2); hJetDsz->Sumw2(); list->Add(hJetDsz);
//=============================================================================
HepMC::IO_GenEvent ascii_in(Form("%s/%s.hepmc",sPath.Data(),sFile.Data()), std::ios::in);
HepMC::GenEvent *evt = ascii_in.read_next_event();
while (evt) {
fjInput.resize(0);
double dXsect = evt->cross_section()->cross_section() / 1e9;
double dWeight = evt->weights().back();
double dNorm = dWeight * dXsect;
hWeightSum->Fill(0.5, dWeight);
TVector3 vPar;
for (HepMC::GenEvent::particle_const_iterator p=evt->particles_begin(); p!=evt->particles_end(); ++p) if ((*p)->status()==1) {
vPar.SetXYZ((*p)->momentum().px(), (*p)->momentum().py(), (*p)->momentum().pz());
if ((TMath::Abs(vPar.Eta())<dCutEtaMax)) {
fjInput.push_back(fastjet::PseudoJet(vPar.Px(), vPar.Py(), vPar.Pz(), vPar.Mag()));
}
}
//=============================================================================
fastjet::ClusterSequenceArea clustSeq(fjInput, jetsDef, areaDef);
//.........这里部分代码省略.........