// $Id$ // // File: DCustomAction_p2pi_hists.cc // Created: Wed Jan 21 16:53:41 EST 2015 // Creator: jrsteven (on Linux ifarm1401 2.6.32-431.el6.x86_64 x86_64) // #include "DCustomAction_p2pi_hists.h" void DCustomAction_p2pi_hists::Initialize(JEventLoop* locEventLoop) { // get PID algos const DParticleID* locParticleID = NULL; locEventLoop->GetSingle(locParticleID); dParticleID = locParticleID; japp->RootWriteLock(); //ACQUIRE ROOT LOCK!! { //Required: Create a folder in the ROOT output file that will contain all of the output ROOT objects (if any) for this action. //If another thread has already created the folder, it just changes to it. CreateAndChangeTo_ActionDirectory(); dM2pi = GetOrCreate_Histogram("M2pi", "#pi^{+} #pi^{-} Mass; Mass (GeV/c^{2})", 200, 0.0, 2.0); dMM_M2pi = GetOrCreate_Histogram("MM_M2pi", "MM off #pi^{+}#pi^{-} vs M_{#pi^{+}#pi^{-}}; M_{#pi^{+}#pi^{-}}; MM", 200, 0.0, 2.0, 200, 0., 4.); dEgamma2pi = GetOrCreate_Histogram("Egamma2pi", "TAGGER photon energy; E_{gamma}", 320, 2., 10.); dMissingDeltaPT_DeltaPhi = GetOrCreate_Histogram("MissingDeltaPT_DeltaPhi", "Unused Track - MM: #Delta p_{T} vs #Delta #phi; #Delta #phi; #Delta p_{T}", 180, -180.0, 180.0, 100, -5., 5.); dMM2_DeltaPhi = GetOrCreate_Histogram("MM2_DeltaPhi", "MM^{2} vs #Delta #phi; #Delta #phi; MM^{2}", 180, -60.0, 60.0, 200, -0.5, 0.5); dMM_M2pi_Emeson = GetOrCreate_Histogram("MM_M2pi_Emeson", "MM off #pi^{+}#pi^{-} vs M_{#pi^{+}#pi^{-}}; M_{#pi^{+}#pi^{-}}; MM", 200, 0.0, 2.0, 200, 0., 4.); // recoil and exclusive dMM_M2pi_Recoil = GetOrCreate_Histogram("MM_M2pi_Recoil", "Recoil MM off #pi^{+}#pi^{-} vs M_{#pi^{+}#pi^{-}}; M_{#pi^{+}#pi^{-}}; MM", 200, 0.0, 2.0, 200, 0., 4.); dMM_M2pi_Exclusive = GetOrCreate_Histogram("MM_M2pi_Exclusive", "Exclusive MM off #pi^{+}#pi^{-} vs M_{#pi^{+}#pi^{-}}; M_{#pi^{+}#pi^{-}}; MM", 200, 0.0, 2.0, 200, 0., 4.); dProton_dEdx_P_Exclusive = GetOrCreate_Histogram("Proton_dEdx_P_Exclusive","Exclusive: dE/dx vs p; p; dE/dx",200,0,2,500,0,5); dProton_P_Theta_Exclusive = GetOrCreate_Histogram("Proton_P_Theta_Exclusive","Exclusive: p vs #theta; #theta; p (GeV/c)",180,0,180,120,0,12); dDeltaE_M2pi_Exclusive = GetOrCreate_Histogram("dDeltaE_M2pi_Exclusive", "Exclusive #Delta E vs M_{#pi^{+}#pi^{-}}; M_{#pi^{+}#pi^{-}}; #Delta E (tagger - tracks)", 200, 0.0, 2.0, 200, -5., 5.); dRecoilPT_M2pi = GetOrCreate_Histogram("dRecoilPT_M2pi", "Recoil P_{T} vs M_{#pi^{+}#pi^{-}}; M_{#pi^{+}#pi^{-}}; Recoil P_{T}", 200, 0.0, 2.0, 200, 0., 2.); dRecoilPT_M2pi_Exclusive = GetOrCreate_Histogram("dRecoilPT_M2pi_Exclusive", "Exclusive Recoil P_{T} vs M_{#pi^{+}#pi^{-}}; M_{#pi^{+}#pi^{-}}; Recoil P_{T}", 200, 0.0, 2.0, 200, 0., 2.); // MC histograms dMM_DeltaM2pi = GetOrCreate_Histogram("MM_DeltaM2pi", "MM off #pi^{+}#pi^{-} vs #Delta M_{#pi^{+}#pi^{-}}; M_{#pi^{+}#pi^{-}}; MM", 200, -0.5, 0.5, 200, -4., 4.); dMM2_DeltaM2pi = GetOrCreate_Histogram("MM2_DeltaM2pi", "MM^{2} off #pi^{+}#pi^{-} vs #Delta M_{#pi^{+}#pi^{-}}; M_{#pi^{+}#pi^{-}}; MM^{2}", 200, -0.5, 0.5, 200, -0.5, 0.5); dCosThetaCM_t = GetOrCreate_Histogram("CosThetaCM_t", "Mandelstam -t vs cos#theta_{CM}^{#rho}; cos#theta_{CM}^{#rho}; -t", 1000, -1., 1., 1000, 0., 5.); } japp->RootUnLock(); //RELEASE ROOT LOCK!! } bool DCustomAction_p2pi_hists::Perform_Action(JEventLoop* locEventLoop, const DParticleCombo* locParticleCombo) { const DDetectorMatches* locDetectorMatches = NULL; locEventLoop->GetSingle(locDetectorMatches); // for unused tracks analysis vector locChargedTracks; locEventLoop->Get(locChargedTracks); //, "PreSelect"); vector locUnusedChargedTracks; // should only have one reaction step const DParticleComboStep* locParticleComboStep = locParticleCombo->Get_ParticleComboStep(0); if(locParticleComboStep->Get_InitialParticleID() != Gamma) return true; // get beam photon time and select energy range const DKinematicData* locBeamPhoton = locParticleCombo->Get_ParticleComboStep(0)->Get_InitialParticle(); double locBeamPhotonEnergy = locBeamPhoton->energy(); if(locBeamPhotonEnergy < 6.8) return true; // cut low energy photons // get final state particles deque locParticles; if(!Get_UseKinFitResultsFlag()) //measured locParticleComboStep->Get_FinalParticles_Measured(locParticles); else locParticleComboStep->Get_FinalParticles(locParticles); // sum 2pi mass DLorentzVector locP4_2pi; for(size_t loc_i = 0; loc_i < locParticles.size(); ++loc_i) { if(locParticleComboStep->Get_FinalParticleID(loc_i) != PiPlus && locParticleComboStep->Get_FinalParticleID(loc_i) != PiMinus) continue; locP4_2pi += locParticles[loc_i]->lorentzMomentum(); } // loop over charged tracks to make list of unused for(size_t loc_j = 0; loc_j < locChargedTracks.size(); ++loc_j) { int nMatched = 0; // eliminate pi+/pi- from unused tracks for(size_t loc_i = 0; loc_i < locParticles.size(); ++loc_i) { // get time based track const DChargedTrack* locChargedTrack = static_cast(locParticleComboStep->Get_FinalParticle_SourceObject(loc_i)); if(locChargedTrack == NULL) continue; // should never happen const DChargedTrackHypothesis* locChargedTrackHypothesis = locChargedTrack->Get_BestFOM(); if(locChargedTracks[loc_j]->Get_BestFOM()->candidateid == locChargedTrackHypothesis->candidateid) nMatched++; } if(nMatched==0) locUnusedChargedTracks.push_back(locChargedTracks[loc_j]); } // calculate missing mass DLorentzVector locMissingP4 = dAnalysisUtilities->Calc_MissingP4(locParticleCombo,Get_UseKinFitResultsFlag()); // get 2pi mass from MC tracks vector locMCThrown; locEventLoop->Get(locMCThrown); DLorentzVector locMCP4_2pi; if(!locMCThrown.empty()){ if(!Get_UseKinFitResultsFlag()) { //cout<<"Found good event "<GetJEvent().GetEventNumber()<<": M_2pi="<