CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Public Attributes | Private Types | Private Member Functions | Private Attributes
HIPTwoBodyDecayAnalyzer Class Reference
Inheritance diagram for HIPTwoBodyDecayAnalyzer:
edm::one::EDAnalyzer< edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 HIPTwoBodyDecayAnalyzer (const edm::ParameterSet &)
 
 ~HIPTwoBodyDecayAnalyzer () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::SharedResources >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Public Attributes

edm::EDGetTokenT< reco::TrackCollectionalcareco_trackCollToken_
 
edm::EDGetTokenT< reco::TrackCollectionctf_trackCollToken_
 
edm::EDGetTokenT< reco::TrackCollectionfinal_trackCollToken_
 
std::vector< std::pair< std::string, float * > > floatBranches
 
std::vector< std::pair< std::string, int * > > intBranches
 
edm::EDGetTokenT< reco::TrackCollectionrefit1_trackCollToken_
 
std::vector< std::pair< std::string, short * > > shortBranches
 
TTree * tree
 

Private Types

enum  BranchType { BranchType_short_t, BranchType_int_t, BranchType_float_t, BranchType_unknown_t }
 

Private Member Functions

bool actuateBranches ()
 
void analyze (const edm::Event &, const edm::EventSetup &) override
 
void analyzeTrackCollection (std::string strTrackType, const TransientTrackBuilder &theTTBuilder, edm::Handle< reco::TrackCollection > &hTrackColl, bool verbose=false)
 
void beginJob () override
 
void bookAllBranches ()
 
bool bookBranch (std::string bname, BranchType btype)
 
void cleanBranches ()
 
void endJob () override
 
reco::Vertex fitDimuonVertex (const TransientTrackBuilder &theTTBuilder, edm::Handle< reco::TrackCollection > &hTrackColl, bool &fitOk)
 
void initializeBranches ()
 
BranchType searchArray (std::string branchname, int &position)
 
template<typename varType >
void setVal (std::string bname, varType value)
 

Private Attributes

const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecordttkbuilderToken_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 32 of file HIPTwoBodyDecayAnalyzer.cc.

Member Enumeration Documentation

◆ BranchType

Enumerator
BranchType_short_t 
BranchType_int_t 
BranchType_float_t 
BranchType_unknown_t 

Definition at line 53 of file HIPTwoBodyDecayAnalyzer.cc.

Constructor & Destructor Documentation

◆ HIPTwoBodyDecayAnalyzer()

HIPTwoBodyDecayAnalyzer::HIPTwoBodyDecayAnalyzer ( const edm::ParameterSet iConfig)
explicit

Definition at line 91 of file HIPTwoBodyDecayAnalyzer.cc.

92  : ttkbuilderToken_(esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))) {
93  usesResource(TFileService::kSharedResource);
94 
95  alcareco_trackCollToken_ = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("alcarecotracks"));
96  refit1_trackCollToken_ = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("refit1tracks"));
97  ctf_trackCollToken_ = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("refit2tracks"));
98  final_trackCollToken_ = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("finaltracks"));
99 
101 
102  tree = fs->make<TTree>("TestTree", "");
103  bookAllBranches();
104 }

References alcareco_trackCollToken_, bookAllBranches(), ctf_trackCollToken_, final_trackCollToken_, edm::ParameterSet::getParameter(), TFileService::kSharedResource, TFileService::make(), and refit1_trackCollToken_.

◆ ~HIPTwoBodyDecayAnalyzer()

HIPTwoBodyDecayAnalyzer::~HIPTwoBodyDecayAnalyzer ( )
override

Definition at line 258 of file HIPTwoBodyDecayAnalyzer.cc.

258 { cleanBranches(); }

References cleanBranches().

Member Function Documentation

◆ actuateBranches()

bool HIPTwoBodyDecayAnalyzer::actuateBranches ( )
private

Definition at line 221 of file HIPTwoBodyDecayAnalyzer.cc.

221  {
222  bool success = true;
223  std::cout << "Begin HIPTwoBodyDecayAnalyzer::actuateBranches" << std::endl;
224  std::cout << "Number of short branches: " << shortBranches.size() << std::endl;
225  std::cout << "Number of int branches: " << intBranches.size() << std::endl;
226  std::cout << "Number of float branches: " << floatBranches.size() << std::endl;
227  if (tree != nullptr) {
228  for (unsigned short el = 0; el < shortBranches.size(); el++) {
229  std::cout << "Actuating branch " << shortBranches.at(el).first << " at address " << shortBranches.at(el).second
230  << std::endl;
231  if (!tree->GetBranchStatus(shortBranches.at(el).first.c_str()))
232  tree->Branch(shortBranches.at(el).first.c_str(), shortBranches.at(el).second);
233  else
234  std::cout << "Failed!" << std::endl;
235  }
236  for (unsigned int el = 0; el < intBranches.size(); el++) {
237  std::cout << "Actuating branch " << intBranches.at(el).first.c_str() << " at address "
238  << intBranches.at(el).second << std::endl;
239  if (!tree->GetBranchStatus(intBranches.at(el).first.c_str()))
240  tree->Branch(intBranches.at(el).first.c_str(), intBranches.at(el).second);
241  else
242  std::cout << "Failed!" << std::endl;
243  }
244  for (unsigned int el = 0; el < floatBranches.size(); el++) {
245  std::cout << "Actuating branch " << floatBranches.at(el).first.c_str() << " at address "
246  << floatBranches.at(el).second << std::endl;
247  if (!tree->GetBranchStatus(floatBranches.at(el).first.c_str()))
248  tree->Branch(floatBranches.at(el).first.c_str(), floatBranches.at(el).second);
249  else
250  std::cout << "Failed!" << std::endl;
251  }
252  } else
253  success = false;
254  if (!success)
255  std::cerr << "HIPTwoBodyDecayAnalyzer::actuateBranch: Failed to actuate the branches!" << std::endl;
256  return success;
257 }

References EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, gather_cfg::cout, floatBranches, intBranches, shortBranches, and summarizeEdmComparisonLogfiles::success.

Referenced by bookAllBranches().

◆ analyze()

void HIPTwoBodyDecayAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 260 of file HIPTwoBodyDecayAnalyzer.cc.

260  {
261  using namespace edm;
262  using namespace reco;
263  using reco::TrackCollection;
264 
265  edm::Handle<reco::TrackCollection> alcarecotracks;
266  iEvent.getByToken(alcareco_trackCollToken_, alcarecotracks);
268  iEvent.getByToken(refit1_trackCollToken_, refit1tracks);
270  iEvent.getByToken(ctf_trackCollToken_, ctftracks);
272  iEvent.getByToken(final_trackCollToken_, finaltracks);
273 
274  const auto& theTTBuilder = iSetup.getData(ttkbuilderToken_);
276 
277  analyzeTrackCollection("alcareco", theTTBuilder, alcarecotracks);
278  analyzeTrackCollection("refit1", theTTBuilder, refit1tracks);
279  analyzeTrackCollection("refit2", theTTBuilder, ctftracks);
280  analyzeTrackCollection("final", theTTBuilder, finaltracks);
281 
282  tree->Fill();
283 }

References alcareco_trackCollToken_, analyzeTrackCollection(), ctf_trackCollToken_, final_trackCollToken_, edm::EventSetup::getData(), iEvent, initializeBranches(), refit1_trackCollToken_, and ttkbuilderToken_.

◆ analyzeTrackCollection()

void HIPTwoBodyDecayAnalyzer::analyzeTrackCollection ( std::string  strTrackType,
const TransientTrackBuilder theTTBuilder,
edm::Handle< reco::TrackCollection > &  hTrackColl,
bool  verbose = false 
)
private

Definition at line 294 of file HIPTwoBodyDecayAnalyzer.cc.

297  {
298  if (verbose)
299  std::cout << "Starting to process the track collection for " << strTrackType << std::endl;
300 
301  using namespace edm;
302  using namespace reco;
303  using reco::TrackCollection;
304 
305  if (!hTrackColl.isValid()) {
306  if (verbose)
307  std::cout << "Track collection is invalid." << std::endl;
308  return;
309  }
310  if (hTrackColl->size() < 2) {
311  if (verbose)
312  std::cout << "Track collection size<2." << std::endl;
313  return;
314  }
315 
316  unsigned int itrk = 0;
317  unsigned int j = 0;
318  int totalcharge = 0;
319  bool isValidPair = true;
320  bool ZVtxOk = false;
321  TLorentzVector trackMom[2];
322  TLorentzVector trackMomAfterZVtxFit[2];
323  TVector3 trackVtx[2];
324 
325  for (unsigned int jtrk = 0; jtrk < 2; jtrk++) {
326  trackMom[jtrk].SetXYZT(0, 0, 0, 0);
327  trackVtx[jtrk].SetXYZ(0, 0, 0);
328  }
329  for (reco::TrackCollection::const_iterator track = hTrackColl->begin(); track != hTrackColl->end(); ++track) {
330  int charge = track->charge();
331  totalcharge += charge;
332  if (j == 0) {
333  itrk = (charge > 0 ? 1 : 0);
334  } else
335  itrk = 1 - itrk;
336  trackMom[itrk].SetPtEtaPhiM(track->pt(), track->eta(), track->phi(), 0.105);
337  trackVtx[itrk].SetXYZ(track->vx(), track->vy(), track->vz());
338  j++;
339  if (j == 2)
340  break;
341  }
342 
343  isValidPair = (totalcharge == 0 && trackMom[0].P() != 0. && trackMom[1].P() != 0.);
344  if (verbose && !isValidPair)
345  std::cout << "Track collection does not contain a valid std::pair." << std::endl;
346  setVal(strTrackType + "_present", (isValidPair ? (short)1 : (short)0));
347  if (isValidPair) {
348  TLorentzVector ZMom = trackMom[0] + trackMom[1];
349  setVal(strTrackType + "_ZPt", (float)ZMom.Pt());
350  setVal(strTrackType + "_ZPz", (float)ZMom.Pz());
351  setVal(strTrackType + "_ZPhi", (float)ZMom.Phi());
352  setVal(strTrackType + "_ZMass", (float)ZMom.M());
353 
354  reco::Vertex ZVtx = fitDimuonVertex(theTTBuilder, hTrackColl, ZVtxOk);
355  if (ZVtxOk) {
356  setVal(strTrackType + "_ZVertex_x", (float)ZVtx.x());
357  setVal(strTrackType + "_ZVertex_y", (float)ZVtx.y());
358  setVal(strTrackType + "_ZVertex_z", (float)ZVtx.z());
359  setVal(strTrackType + "_ZVertex_NormChi2", (float)ZVtx.normalizedChi2());
360 
361  // Recalculate track momenta with this vertex as reference
362  j = 0;
363  for (reco::TrackCollection::const_iterator track = hTrackColl->begin(); track != hTrackColl->end(); ++track) {
364  TransientTrack t_track = theTTBuilder.build(&(*track));
365  AnalyticalImpactPointExtrapolator extrapolator(t_track.field());
366  TrajectoryStateOnSurface closestIn3DSpaceState =
367  extrapolator.extrapolate(t_track.impactPointState(), RecoVertex::convertPos(ZVtx.position()));
368  GlobalVector mom = closestIn3DSpaceState.globalMomentum();
369  int charge = track->charge();
370  totalcharge += charge;
371  if (j == 0) {
372  itrk = (charge > 0 ? 1 : 0);
373  } else
374  itrk = 1 - itrk;
375  trackMomAfterZVtxFit[itrk].SetXYZT(mom.x(), mom.y(), mom.z(), sqrt(pow(0.105, 2) + pow(mom.mag(), 2)));
376  j++;
377  if (j == 2)
378  break;
379  }
380  if (totalcharge != 0)
381  std::cerr
382  << "HIPTwoBodyDecayAnalyzer::analyzeTrackCollection: Something went wrong! The total charge is no longer 0!"
383  << std::endl;
384  for (unsigned int jtrk = 0; jtrk < 2; jtrk++) {
385  std::string strMuCore = (jtrk == 0 ? "MuMinus" : "MuPlus");
386  setVal(strTrackType + "_" + strMuCore + "Pt_AfterZVtxFit", (float)trackMomAfterZVtxFit[jtrk].Pt());
387  setVal(strTrackType + "_" + strMuCore + "Pz_AfterZVtxFit", (float)trackMomAfterZVtxFit[jtrk].Pz());
388  setVal(strTrackType + "_" + strMuCore + "Phi_AfterZVtxFit", (float)trackMomAfterZVtxFit[jtrk].Phi());
389  }
390  TLorentzVector ZMom_AfterZVtxFit = trackMomAfterZVtxFit[0] + trackMomAfterZVtxFit[1];
391  setVal(strTrackType + "_ZPt_AfterZVtxFit", (float)ZMom_AfterZVtxFit.Pt());
392  setVal(strTrackType + "_ZPz_AfterZVtxFit", (float)ZMom_AfterZVtxFit.Pz());
393  setVal(strTrackType + "_ZPhi_AfterZVtxFit", (float)ZMom_AfterZVtxFit.Phi());
394  setVal(strTrackType + "_ZMass_AfterZVtxFit", (float)ZMom_AfterZVtxFit.M());
395  } else
396  std::cerr << "HIPTwoBodyDecayAnalyzer::analyzeTrackCollection: Z vertex fit failed for track collection "
397  << strTrackType << std::endl;
398  }
399  setVal(strTrackType + "_ZVtxFitOk", (ZVtxOk ? (short)1 : (short)0));
400  for (unsigned int jtrk = 0; jtrk < 2; jtrk++) {
401  std::string strMuCore = (jtrk == 0 ? "MuMinus" : "MuPlus");
402  setVal(strTrackType + "_" + strMuCore + "Pt", (float)trackMom[jtrk].Pt());
403  setVal(strTrackType + "_" + strMuCore + "Pz", (float)trackMom[jtrk].Pz());
404  setVal(strTrackType + "_" + strMuCore + "Phi", (float)trackMom[jtrk].Phi());
405  setVal(strTrackType + "_" + strMuCore + "Vertex_x", (float)trackVtx[jtrk].X());
406  setVal(strTrackType + "_" + strMuCore + "Vertex_y", (float)trackVtx[jtrk].Y());
407  setVal(strTrackType + "_" + strMuCore + "Vertex_z", (float)trackVtx[jtrk].Z());
408  }
409 }

References TransientTrackBuilder::build(), EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, ALCARECOTkAlJpsiMuMu_cff::charge, RecoVertex::convertPos(), gather_cfg::cout, reco::TransientTrack::field(), fitDimuonVertex(), reco::TransientTrack::impactPointState(), edm::HandleBase::isValid(), dqmiolumiharvest::j, PV3DBase< T, PVType, FrameType >::mag(), VtxSmearedParameters_cfi::Phi, funct::pow(), setVal(), mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, HLT_FULL_cff::track, verbose, X, PV3DBase< T, PVType, FrameType >::x(), BeamSpotPI::Y, PV3DBase< T, PVType, FrameType >::y(), BeamSpotPI::Z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by analyze().

◆ beginJob()

void HIPTwoBodyDecayAnalyzer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 285 of file HIPTwoBodyDecayAnalyzer.cc.

285 {}

◆ bookAllBranches()

void HIPTwoBodyDecayAnalyzer::bookAllBranches ( )
private

Definition at line 162 of file HIPTwoBodyDecayAnalyzer.cc.

162  {
163  const int nTrackTypes = 4;
164  std::vector<std::string> strTrackTypes;
165  strTrackTypes.reserve(nTrackTypes);
166  strTrackTypes.push_back("alcareco");
167  strTrackTypes.push_back("refit1");
168  strTrackTypes.push_back("refit2");
169  strTrackTypes.push_back("final");
170  for (unsigned int it = 0; it < nTrackTypes; it++) {
171  std::string& strTrackType = strTrackTypes[it];
172  bookBranch(strTrackType + "_present", BranchType_short_t);
173  bookBranch(strTrackType + "_ZVtxFitOk", BranchType_short_t);
174  bookBranch(strTrackType + "_ZMass", BranchType_float_t);
175  bookBranch(strTrackType + "_ZPt", BranchType_float_t);
176  bookBranch(strTrackType + "_ZPz", BranchType_float_t);
177  bookBranch(strTrackType + "_ZPhi", BranchType_float_t);
178  bookBranch(strTrackType + "_ZVertex_x", BranchType_float_t);
179  bookBranch(strTrackType + "_ZVertex_y", BranchType_float_t);
180  bookBranch(strTrackType + "_ZVertex_z", BranchType_float_t);
181  bookBranch(strTrackType + "_ZVertex_NormChi2", BranchType_float_t);
182  bookBranch(strTrackType + "_MuPlusVertex_x", BranchType_float_t);
183  bookBranch(strTrackType + "_MuPlusVertex_y", BranchType_float_t);
184  bookBranch(strTrackType + "_MuPlusVertex_z", BranchType_float_t);
185  bookBranch(strTrackType + "_MuMinusPt_AfterZVtxFit", BranchType_float_t);
186  bookBranch(strTrackType + "_MuMinusPz_AfterZVtxFit", BranchType_float_t);
187  bookBranch(strTrackType + "_MuMinusPhi_AfterZVtxFit", BranchType_float_t);
188  bookBranch(strTrackType + "_MuPlusPt_AfterZVtxFit", BranchType_float_t);
189  bookBranch(strTrackType + "_MuPlusPz_AfterZVtxFit", BranchType_float_t);
190  bookBranch(strTrackType + "_MuPlusPhi_AfterZVtxFit", BranchType_float_t);
191  bookBranch(strTrackType + "_ZMass_AfterZVtxFit", BranchType_float_t);
192  bookBranch(strTrackType + "_ZPt_AfterZVtxFit", BranchType_float_t);
193  bookBranch(strTrackType + "_ZPz_AfterZVtxFit", BranchType_float_t);
194  bookBranch(strTrackType + "_ZPhi_AfterZVtxFit", BranchType_float_t);
195  bookBranch(strTrackType + "_MuMinusPt", BranchType_float_t);
196  bookBranch(strTrackType + "_MuMinusPz", BranchType_float_t);
197  bookBranch(strTrackType + "_MuMinusPhi", BranchType_float_t);
198  bookBranch(strTrackType + "_MuMinusVertex_x", BranchType_float_t);
199  bookBranch(strTrackType + "_MuMinusVertex_y", BranchType_float_t);
200  bookBranch(strTrackType + "_MuMinusVertex_z", BranchType_float_t);
201  bookBranch(strTrackType + "_MuPlusPt", BranchType_float_t);
202  bookBranch(strTrackType + "_MuPlusPz", BranchType_float_t);
203  bookBranch(strTrackType + "_MuPlusPhi", BranchType_float_t);
204  }
205  actuateBranches();
206 }

References actuateBranches(), bookBranch(), BranchType_float_t, BranchType_short_t, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by HIPTwoBodyDecayAnalyzer().

◆ bookBranch()

bool HIPTwoBodyDecayAnalyzer::bookBranch ( std::string  bname,
BranchType  btype 
)
private

Definition at line 207 of file HIPTwoBodyDecayAnalyzer.cc.

207  {
208  if (btype == BranchType_float_t)
209  floatBranches.emplace_back(bname, new float);
210  else if (btype == BranchType_int_t)
211  intBranches.emplace_back(bname, new int);
212  else if (btype == BranchType_short_t)
213  shortBranches.emplace_back(bname, new short);
214  else {
215  std::cerr << "HIPTwoBodyDecayAnalyzer::bookBranch: No support for type " << btype << " for the branch " << bname
216  << " is available." << std::endl;
217  return false;
218  }
219  return true;
220 }

References BranchType_float_t, BranchType_int_t, BranchType_short_t, CalibrationSummaryClient_cfi::btype, EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, floatBranches, intBranches, and shortBranches.

Referenced by bookAllBranches().

◆ cleanBranches()

void HIPTwoBodyDecayAnalyzer::cleanBranches ( )
private

Definition at line 127 of file HIPTwoBodyDecayAnalyzer.cc.

127  {
128  for (unsigned short el = 0; el < shortBranches.size(); el++) {
129  if (shortBranches.at(el).second != nullptr)
130  delete shortBranches.at(el).second;
131  shortBranches.at(el).second = nullptr;
132  }
133  shortBranches.clear();
134  for (unsigned int el = 0; el < intBranches.size(); el++) {
135  if (intBranches.at(el).second != nullptr)
136  delete intBranches.at(el).second;
137  intBranches.at(el).second = nullptr;
138  }
139  intBranches.clear();
140  for (unsigned int el = 0; el < floatBranches.size(); el++) {
141  if (floatBranches.at(el).second != nullptr)
142  delete floatBranches.at(el).second;
143  floatBranches.at(el).second = nullptr;
144  }
145  floatBranches.clear();
146 }

References floatBranches, intBranches, and shortBranches.

Referenced by ~HIPTwoBodyDecayAnalyzer().

◆ endJob()

void HIPTwoBodyDecayAnalyzer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 286 of file HIPTwoBodyDecayAnalyzer.cc.

286 {}

Referenced by o2olib.O2ORunMgr::executeJob().

◆ fillDescriptions()

void HIPTwoBodyDecayAnalyzer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 288 of file HIPTwoBodyDecayAnalyzer.cc.

288  {
290  desc.setUnknown();
291  descriptions.addDefault(desc);
292 }

References edm::ConfigurationDescriptions::addDefault(), and submitPVResolutionJobs::desc.

◆ fitDimuonVertex()

reco::Vertex HIPTwoBodyDecayAnalyzer::fitDimuonVertex ( const TransientTrackBuilder theTTBuilder,
edm::Handle< reco::TrackCollection > &  hTrackColl,
bool &  fitOk 
)
private

Definition at line 411 of file HIPTwoBodyDecayAnalyzer.cc.

413  {
414  using namespace edm;
415  using namespace reco;
416 
417  std::vector<TransientTrack> t_tks;
418  for (TrackCollection::const_iterator track = hTrackColl->begin(); track != hTrackColl->end(); ++track) {
419  TransientTrack tt = theTTBuilder.build(&(*track));
420  t_tks.push_back(tt);
421  }
422 
423  // Kalman vertex fit without constraint
424  KalmanVertexFitter vtxFitter;
425  TransientVertex stdVertex = vtxFitter.vertex(t_tks);
426  fitOk = stdVertex.isValid();
427  if (fitOk) {
428  reco::Vertex stdRecoVertex(Vertex::Point(stdVertex.position()),
429  stdVertex.positionError().matrix(),
430  stdVertex.totalChiSquared(),
431  stdVertex.degreesOfFreedom(),
432  0);
433  return stdRecoVertex;
434  } else {
435  reco::Vertex stdRecoVertex;
436  return stdRecoVertex;
437  }
438 }

References TransientTrackBuilder::build(), TransientVertex::isValid(), GlobalErrorBase< T, ErrorWeightType >::matrix(), TransientVertex::position(), TransientVertex::positionError(), HLT_FULL_cff::track, groupFilesInBlocks::tt, and KalmanVertexFitter::vertex().

Referenced by analyzeTrackCollection().

◆ initializeBranches()

void HIPTwoBodyDecayAnalyzer::initializeBranches ( )
private

Definition at line 147 of file HIPTwoBodyDecayAnalyzer.cc.

147  {
148  for (unsigned short el = 0; el < shortBranches.size(); el++) {
149  if (shortBranches.at(el).second != nullptr)
150  *(shortBranches.at(el).second) = 0;
151  }
152  for (unsigned int el = 0; el < intBranches.size(); el++) {
153  if (intBranches.at(el).second != nullptr)
154  *(intBranches.at(el).second) = 0;
155  }
156  for (unsigned int el = 0; el < floatBranches.size(); el++) {
157  if (floatBranches.at(el).second != nullptr)
158  *(floatBranches.at(el).second) = 0;
159  }
160 }

References floatBranches, intBranches, and shortBranches.

Referenced by analyze().

◆ searchArray()

HIPTwoBodyDecayAnalyzer::BranchType HIPTwoBodyDecayAnalyzer::searchArray ( std::string  branchname,
int &  position 
)
private

Definition at line 106 of file HIPTwoBodyDecayAnalyzer.cc.

106  {
107  for (unsigned short el = 0; el < shortBranches.size(); el++) {
108  if (branchname == shortBranches.at(el).first) {
109  position = el;
110  return BranchType_short_t;
111  }
112  }
113  for (unsigned int el = 0; el < intBranches.size(); el++) {
114  if (branchname == intBranches.at(el).first) {
115  position = el;
116  return BranchType_int_t;
117  }
118  }
119  for (unsigned int el = 0; el < floatBranches.size(); el++) {
120  if (branchname == floatBranches.at(el).first) {
121  position = el;
122  return BranchType_float_t;
123  }
124  }
125  return BranchType_unknown_t;
126 }

References BranchType_float_t, BranchType_int_t, BranchType_short_t, BranchType_unknown_t, floatBranches, intBranches, position, and shortBranches.

Referenced by setVal().

◆ setVal()

template<typename varType >
void HIPTwoBodyDecayAnalyzer::setVal ( std::string  bname,
varType  value 
)
inlineprivate

Definition at line 63 of file HIPTwoBodyDecayAnalyzer.cc.

63  {
64  int varposition = -1;
65  BranchType varbranchtype = searchArray(bname, varposition);
66  if (varposition == -1)
67  std::cerr << "HIPTwoBodyDecayAnalyzer::setVal -> Could not find the branch called " << bname << "!" << std::endl;
68  else if (varbranchtype == BranchType_short_t)
69  *(shortBranches.at(varposition).second) = value;
70  else if (varbranchtype == BranchType_int_t)
71  *(intBranches.at(varposition).second) = value;
72  else if (varbranchtype == BranchType_float_t)
73  *(floatBranches.at(varposition).second) = value;
74  else
75  std::cerr << "HIPTwoBodyDecayAnalyzer::setVal -> Could not find the type " << varbranchtype
76  << " for branch called " << bname << "!" << std::endl;
77  }

References BranchType_float_t, BranchType_int_t, BranchType_short_t, EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, floatBranches, intBranches, searchArray(), and shortBranches.

Referenced by analyzeTrackCollection().

Member Data Documentation

◆ alcareco_trackCollToken_

edm::EDGetTokenT<reco::TrackCollection> HIPTwoBodyDecayAnalyzer::alcareco_trackCollToken_

Definition at line 37 of file HIPTwoBodyDecayAnalyzer.cc.

Referenced by analyze(), and HIPTwoBodyDecayAnalyzer().

◆ ctf_trackCollToken_

edm::EDGetTokenT<reco::TrackCollection> HIPTwoBodyDecayAnalyzer::ctf_trackCollToken_

Definition at line 39 of file HIPTwoBodyDecayAnalyzer.cc.

Referenced by analyze(), and HIPTwoBodyDecayAnalyzer().

◆ final_trackCollToken_

edm::EDGetTokenT<reco::TrackCollection> HIPTwoBodyDecayAnalyzer::final_trackCollToken_

Definition at line 40 of file HIPTwoBodyDecayAnalyzer.cc.

Referenced by analyze(), and HIPTwoBodyDecayAnalyzer().

◆ floatBranches

std::vector<std::pair<std::string, float*> > HIPTwoBodyDecayAnalyzer::floatBranches

◆ intBranches

std::vector<std::pair<std::string, int*> > HIPTwoBodyDecayAnalyzer::intBranches

◆ refit1_trackCollToken_

edm::EDGetTokenT<reco::TrackCollection> HIPTwoBodyDecayAnalyzer::refit1_trackCollToken_

Definition at line 38 of file HIPTwoBodyDecayAnalyzer.cc.

Referenced by analyze(), and HIPTwoBodyDecayAnalyzer().

◆ shortBranches

std::vector<std::pair<std::string, short*> > HIPTwoBodyDecayAnalyzer::shortBranches

◆ tree

TTree* HIPTwoBodyDecayAnalyzer::tree

◆ ttkbuilderToken_

const edm::ESGetToken<TransientTrackBuilder, TransientTrackRecord> HIPTwoBodyDecayAnalyzer::ttkbuilderToken_
private

Definition at line 51 of file HIPTwoBodyDecayAnalyzer.cc.

Referenced by analyze().

Vector3DBase
Definition: Vector3DBase.h:8
HIPTwoBodyDecayAnalyzer::analyzeTrackCollection
void analyzeTrackCollection(std::string strTrackType, const TransientTrackBuilder &theTTBuilder, edm::Handle< reco::TrackCollection > &hTrackColl, bool verbose=false)
Definition: HIPTwoBodyDecayAnalyzer.cc:294
HIPTwoBodyDecayAnalyzer::BranchType_short_t
Definition: HIPTwoBodyDecayAnalyzer.cc:53
KalmanVertexFitter::vertex
CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &tracks) const override
Definition: KalmanVertexFitter.h:49
edm::ESInputTag
Definition: ESInputTag.h:87
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11724
groupFilesInBlocks.tt
int tt
Definition: groupFilesInBlocks.py:144
TransientVertex::isValid
bool isValid() const
Definition: TransientVertex.h:195
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
X
#define X(str)
Definition: MuonsGrabber.cc:38
HIPTwoBodyDecayAnalyzer::initializeBranches
void initializeBranches()
Definition: HIPTwoBodyDecayAnalyzer.cc:147
edm
HLT enums.
Definition: AlignableModifier.h:19
tree
Definition: tree.py:1
gather_cfg.cout
cout
Definition: gather_cfg.py:144
HIPTwoBodyDecayAnalyzer::fitDimuonVertex
reco::Vertex fitDimuonVertex(const TransientTrackBuilder &theTTBuilder, edm::Handle< reco::TrackCollection > &hTrackColl, bool &fitOk)
Definition: HIPTwoBodyDecayAnalyzer.cc:411
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
TransientVertex::position
GlobalPoint position() const
Definition: TransientVertex.h:169
HIPTwoBodyDecayAnalyzer::bookAllBranches
void bookAllBranches()
Definition: HIPTwoBodyDecayAnalyzer.cc:162
GlobalErrorBase::matrix
const AlgebraicSymMatrix33 matrix() const
Definition: GlobalErrorBase.h:121
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:46
HIPTwoBodyDecayAnalyzer::ttkbuilderToken_
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > ttkbuilderToken_
Definition: HIPTwoBodyDecayAnalyzer.cc:51
edm::Handle< reco::TrackCollection >
HIPTwoBodyDecayAnalyzer::actuateBranches
bool actuateBranches()
Definition: HIPTwoBodyDecayAnalyzer.cc:221
edm::BranchType
BranchType
Definition: BranchType.h:11
HIPTwoBodyDecayAnalyzer::BranchType_float_t
Definition: HIPTwoBodyDecayAnalyzer.cc:53
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
HIPTwoBodyDecayAnalyzer::shortBranches
std::vector< std::pair< std::string, short * > > shortBranches
Definition: HIPTwoBodyDecayAnalyzer.cc:47
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
HIPTwoBodyDecayAnalyzer::alcareco_trackCollToken_
edm::EDGetTokenT< reco::TrackCollection > alcareco_trackCollToken_
Definition: HIPTwoBodyDecayAnalyzer.cc:37
HIPTwoBodyDecayAnalyzer::bookBranch
bool bookBranch(std::string bname, BranchType btype)
Definition: HIPTwoBodyDecayAnalyzer.cc:207
HIPTwoBodyDecayAnalyzer::cleanBranches
void cleanBranches()
Definition: HIPTwoBodyDecayAnalyzer.cc:127
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
summarizeEdmComparisonLogfiles.success
success
Definition: summarizeEdmComparisonLogfiles.py:114
verbose
static constexpr int verbose
Definition: HLTExoticaSubAnalysis.cc:25
VtxSmearedParameters_cfi.Phi
Phi
Definition: VtxSmearedParameters_cfi.py:112
HIPTwoBodyDecayAnalyzer::searchArray
BranchType searchArray(std::string branchname, int &position)
Definition: HIPTwoBodyDecayAnalyzer.cc:106
HIPTwoBodyDecayAnalyzer::setVal
void setVal(std::string bname, varType value)
Definition: HIPTwoBodyDecayAnalyzer.cc:63
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
AnalyticalImpactPointExtrapolator
Definition: AnalyticalImpactPointExtrapolator.h:26
HIPTwoBodyDecayAnalyzer::intBranches
std::vector< std::pair< std::string, int * > > intBranches
Definition: HIPTwoBodyDecayAnalyzer.cc:46
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
reco::TransientTrack::impactPointState
TrajectoryStateOnSurface impactPointState() const
Definition: TransientTrack.h:96
edm::Service< TFileService >
iEvent
int iEvent
Definition: GenABIO.cc:224
value
Definition: value.py:1
TransientVertex
Definition: TransientVertex.h:18
reco::TransientTrack::field
const MagneticField * field() const
Definition: TransientTrack.h:108
TFileService::make
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HIPTwoBodyDecayAnalyzer::floatBranches
std::vector< std::pair< std::string, float * > > floatBranches
Definition: HIPTwoBodyDecayAnalyzer.cc:45
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
CalibrationSummaryClient_cfi.btype
btype
Definition: CalibrationSummaryClient_cfi.py:39
PV3DBase::mag
T mag() const
Definition: PV3DBase.h:64
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
reco::Vertex::Point
math::XYZPoint Point
point in the space
Definition: Vertex.h:40
HIPTwoBodyDecayAnalyzer::BranchType_int_t
Definition: HIPTwoBodyDecayAnalyzer.cc:53
reco::TransientTrack
Definition: TransientTrack.h:19
TFileService::kSharedResource
static const std::string kSharedResource
Definition: TFileService.h:76
HIPTwoBodyDecayAnalyzer::final_trackCollToken_
edm::EDGetTokenT< reco::TrackCollection > final_trackCollToken_
Definition: HIPTwoBodyDecayAnalyzer.cc:40
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
BeamSpotPI::Y
Definition: BeamSpotPayloadInspectorHelper.h:32
RecoVertex::convertPos
reco::Vertex::Point convertPos(const GlobalPoint &p)
Definition: ConvertToFromReco.h:7
edm::EDConsumerBase::esConsumes
auto esConsumes()
Definition: EDConsumerBase.h:206
HIPTwoBodyDecayAnalyzer::BranchType_unknown_t
Definition: HIPTwoBodyDecayAnalyzer.cc:53
TransientTrackBuilder::build
reco::TransientTrack build(const reco::Track *p) const
Definition: TransientTrackBuilder.cc:20
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
BeamSpotPI::Z
Definition: BeamSpotPayloadInspectorHelper.h:33
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8
HIPTwoBodyDecayAnalyzer::refit1_trackCollToken_
edm::EDGetTokenT< reco::TrackCollection > refit1_trackCollToken_
Definition: HIPTwoBodyDecayAnalyzer.cc:38
HIPTwoBodyDecayAnalyzer::ctf_trackCollToken_
edm::EDGetTokenT< reco::TrackCollection > ctf_trackCollToken_
Definition: HIPTwoBodyDecayAnalyzer.cc:39
edm::InputTag
Definition: InputTag.h:15
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
reco::Vertex
Definition: Vertex.h:35
TransientVertex::positionError
GlobalError positionError() const
Definition: TransientVertex.h:170
KalmanVertexFitter
Definition: KalmanVertexFitter.h:22