CMS 3D CMS Logo

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

Public Member Functions

 HIPTwoBodyDecayAnalyzer (const edm::ParameterSet &)
 
 ~HIPTwoBodyDecayAnalyzer () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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
 
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::vector< ModuleDescription const * > &modules, 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
 
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::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 

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, edm::ESHandle< 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 (edm::ESHandle< 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)
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer 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>
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<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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 50 of file HIPTwoBodyDecayAnalyzer.cc.

Constructor & Destructor Documentation

◆ HIPTwoBodyDecayAnalyzer()

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

Definition at line 88 of file HIPTwoBodyDecayAnalyzer.cc.

88  {
89  alcareco_trackCollToken_ = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("alcarecotracks"));
90  refit1_trackCollToken_ = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("refit1tracks"));
91  ctf_trackCollToken_ = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("refit2tracks"));
92  final_trackCollToken_ = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("finaltracks"));
93 
95 
96  tree = fs->make<TTree>("TestTree", "");
98 }

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

◆ ~HIPTwoBodyDecayAnalyzer()

HIPTwoBodyDecayAnalyzer::~HIPTwoBodyDecayAnalyzer ( )
override

Definition at line 252 of file HIPTwoBodyDecayAnalyzer.cc.

252 { cleanBranches(); }

References cleanBranches().

Member Function Documentation

◆ actuateBranches()

bool HIPTwoBodyDecayAnalyzer::actuateBranches ( )
private

Definition at line 215 of file HIPTwoBodyDecayAnalyzer.cc.

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

References beam_dqm_sourceclient-live_cfg::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::EDAnalyzer.

Definition at line 254 of file HIPTwoBodyDecayAnalyzer.cc.

254  {
255  using namespace edm;
256  using namespace reco;
257  using reco::TrackCollection;
258 
259  edm::Handle<reco::TrackCollection> alcarecotracks;
260  iEvent.getByToken(alcareco_trackCollToken_, alcarecotracks);
262  iEvent.getByToken(refit1_trackCollToken_, refit1tracks);
264  iEvent.getByToken(ctf_trackCollToken_, ctftracks);
266  iEvent.getByToken(final_trackCollToken_, finaltracks);
267 
269  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder", theTTBuilder);
270 
272 
273  analyzeTrackCollection("alcareco", theTTBuilder, alcarecotracks);
274  analyzeTrackCollection("refit1", theTTBuilder, refit1tracks);
275  analyzeTrackCollection("refit2", theTTBuilder, ctftracks);
276  analyzeTrackCollection("final", theTTBuilder, finaltracks);
277 
278  tree->Fill();
279 }

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

◆ analyzeTrackCollection()

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

Definition at line 290 of file HIPTwoBodyDecayAnalyzer.cc.

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

References TransientTrackBuilder::build(), beam_dqm_sourceclient-live_cfg::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_2018_cff::track, verbose, X, PV3DBase< T, PVType, FrameType >::x(), DOFs::Y, PV3DBase< T, PVType, FrameType >::y(), DOFs::Z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by analyze().

◆ beginJob()

void HIPTwoBodyDecayAnalyzer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 281 of file HIPTwoBodyDecayAnalyzer.cc.

281 {}

◆ bookAllBranches()

void HIPTwoBodyDecayAnalyzer::bookAllBranches ( )
private

Definition at line 156 of file HIPTwoBodyDecayAnalyzer.cc.

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

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 201 of file HIPTwoBodyDecayAnalyzer.cc.

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

References BranchType_float_t, BranchType_int_t, BranchType_short_t, CalibrationSummaryClient_cfi::btype, beam_dqm_sourceclient-live_cfg::cerr, floatBranches, intBranches, and shortBranches.

Referenced by bookAllBranches().

◆ cleanBranches()

void HIPTwoBodyDecayAnalyzer::cleanBranches ( )
private

Definition at line 121 of file HIPTwoBodyDecayAnalyzer.cc.

121  {
122  for (unsigned short el = 0; el < shortBranches.size(); el++) {
123  if (shortBranches.at(el).second != nullptr)
124  delete shortBranches.at(el).second;
125  shortBranches.at(el).second = nullptr;
126  }
127  shortBranches.clear();
128  for (unsigned int el = 0; el < intBranches.size(); el++) {
129  if (intBranches.at(el).second != nullptr)
130  delete intBranches.at(el).second;
131  intBranches.at(el).second = nullptr;
132  }
133  intBranches.clear();
134  for (unsigned int el = 0; el < floatBranches.size(); el++) {
135  if (floatBranches.at(el).second != nullptr)
136  delete floatBranches.at(el).second;
137  floatBranches.at(el).second = nullptr;
138  }
139  floatBranches.clear();
140 }

References floatBranches, intBranches, and shortBranches.

Referenced by ~HIPTwoBodyDecayAnalyzer().

◆ endJob()

void HIPTwoBodyDecayAnalyzer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 282 of file HIPTwoBodyDecayAnalyzer.cc.

282 {}

Referenced by o2olib.O2ORunMgr::executeJob().

◆ fillDescriptions()

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

Definition at line 284 of file HIPTwoBodyDecayAnalyzer.cc.

284  {
286  desc.setUnknown();
287  descriptions.addDefault(desc);
288 }

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

◆ fitDimuonVertex()

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

Definition at line 407 of file HIPTwoBodyDecayAnalyzer.cc.

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

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

Referenced by analyzeTrackCollection().

◆ initializeBranches()

void HIPTwoBodyDecayAnalyzer::initializeBranches ( )
private

Definition at line 141 of file HIPTwoBodyDecayAnalyzer.cc.

141  {
142  for (unsigned short el = 0; el < shortBranches.size(); el++) {
143  if (shortBranches.at(el).second != nullptr)
144  *(shortBranches.at(el).second) = 0;
145  }
146  for (unsigned int el = 0; el < intBranches.size(); el++) {
147  if (intBranches.at(el).second != nullptr)
148  *(intBranches.at(el).second) = 0;
149  }
150  for (unsigned int el = 0; el < floatBranches.size(); el++) {
151  if (floatBranches.at(el).second != nullptr)
152  *(floatBranches.at(el).second) = 0;
153  }
154 }

References floatBranches, intBranches, and shortBranches.

Referenced by analyze().

◆ searchArray()

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

Definition at line 100 of file HIPTwoBodyDecayAnalyzer.cc.

100  {
101  for (unsigned short el = 0; el < shortBranches.size(); el++) {
102  if (branchname == shortBranches.at(el).first) {
103  position = el;
104  return BranchType_short_t;
105  }
106  }
107  for (unsigned int el = 0; el < intBranches.size(); el++) {
108  if (branchname == intBranches.at(el).first) {
109  position = el;
110  return BranchType_int_t;
111  }
112  }
113  for (unsigned int el = 0; el < floatBranches.size(); el++) {
114  if (branchname == floatBranches.at(el).first) {
115  position = el;
116  return BranchType_float_t;
117  }
118  }
119  return BranchType_unknown_t;
120 }

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 60 of file HIPTwoBodyDecayAnalyzer.cc.

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

References BranchType_float_t, BranchType_int_t, BranchType_short_t, beam_dqm_sourceclient-live_cfg::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
Vector3DBase
Definition: Vector3DBase.h:8
HIPTwoBodyDecayAnalyzer::BranchType_short_t
Definition: HIPTwoBodyDecayAnalyzer.cc:50
KalmanVertexFitter::vertex
CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &tracks) const override
Definition: KalmanVertexFitter.h:49
HIPTwoBodyDecayAnalyzer::analyzeTrackCollection
void analyzeTrackCollection(std::string strTrackType, edm::ESHandle< TransientTrackBuilder > &theTTBuilder, edm::Handle< reco::TrackCollection > &hTrackColl, bool verbose=false)
Definition: HIPTwoBodyDecayAnalyzer.cc:290
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::fitDimuonVertex
reco::Vertex fitDimuonVertex(edm::ESHandle< TransientTrackBuilder > &theTTBuilder, edm::Handle< reco::TrackCollection > &hTrackColl, bool &fitOk)
Definition: HIPTwoBodyDecayAnalyzer.cc:407
HIPTwoBodyDecayAnalyzer::initializeBranches
void initializeBranches()
Definition: HIPTwoBodyDecayAnalyzer.cc:141
edm
HLT enums.
Definition: AlignableModifier.h:19
tree
Definition: tree.py:1
gather_cfg.cout
cout
Definition: gather_cfg.py:144
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
TransientVertex::position
GlobalPoint position() const
Definition: TransientVertex.h:169
HIPTwoBodyDecayAnalyzer::bookAllBranches
void bookAllBranches()
Definition: HIPTwoBodyDecayAnalyzer.cc:156
GlobalErrorBase::matrix
const AlgebraicSymMatrix33 matrix() const
Definition: GlobalErrorBase.h:121
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
edm::Handle< reco::TrackCollection >
HIPTwoBodyDecayAnalyzer::actuateBranches
bool actuateBranches()
Definition: HIPTwoBodyDecayAnalyzer.cc:215
edm::BranchType
BranchType
Definition: BranchType.h:11
HIPTwoBodyDecayAnalyzer::BranchType_float_t
Definition: HIPTwoBodyDecayAnalyzer.cc:50
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
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
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:201
HIPTwoBodyDecayAnalyzer::cleanBranches
void cleanBranches()
Definition: HIPTwoBodyDecayAnalyzer.cc:121
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
TransientTrackRecord
Definition: TransientTrackRecord.h:11
edm::ESHandle< TransientTrackBuilder >
summarizeEdmComparisonLogfiles.success
success
Definition: summarizeEdmComparisonLogfiles.py:115
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:100
HIPTwoBodyDecayAnalyzer::setVal
void setVal(std::string bname, varType value)
Definition: HIPTwoBodyDecayAnalyzer.cc:60
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
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
beam_dqm_sourceclient-live_cfg.cerr
cerr
Definition: beam_dqm_sourceclient-live_cfg.py:17
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:98
edm::Service< TFileService >
iEvent
int iEvent
Definition: GenABIO.cc:224
value
Definition: value.py:1
DOFs::Z
Definition: AlignPCLThresholdsWriter.cc:37
edm::ParameterSetDescription::setUnknown
void setUnknown()
Definition: ParameterSetDescription.cc:39
TransientVertex
Definition: TransientVertex.h:18
get
#define get
reco::TransientTrack::field
const MagneticField * field() const
Definition: TransientTrack.h:110
HIPTwoBodyDecayAnalyzer::floatBranches
std::vector< std::pair< std::string, float * > > floatBranches
Definition: HIPTwoBodyDecayAnalyzer.cc:45
CalibrationSummaryClient_cfi.btype
btype
Definition: CalibrationSummaryClient_cfi.py:39
PV3DBase::mag
T mag() const
Definition: PV3DBase.h:64
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
reco::Vertex::Point
math::XYZPoint Point
point in the space
Definition: Vertex.h:40
HIPTwoBodyDecayAnalyzer::BranchType_int_t
Definition: HIPTwoBodyDecayAnalyzer.cc:50
reco::TransientTrack
Definition: TransientTrack.h:19
DOFs::Y
Definition: AlignPCLThresholdsWriter.cc:37
HIPTwoBodyDecayAnalyzer::final_trackCollToken_
edm::EDGetTokenT< reco::TrackCollection > final_trackCollToken_
Definition: HIPTwoBodyDecayAnalyzer.cc:40
RecoVertex::convertPos
reco::Vertex::Point convertPos(const GlobalPoint &p)
Definition: ConvertToFromReco.h:7
HIPTwoBodyDecayAnalyzer::BranchType_unknown_t
Definition: HIPTwoBodyDecayAnalyzer.cc:50
TransientTrackBuilder::build
reco::TransientTrack build(const reco::Track *p) const
Definition: TransientTrackBuilder.cc:20
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
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
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
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileService.h:64
TransientVertex::positionError
GlobalError positionError() const
Definition: TransientVertex.h:170
KalmanVertexFitter
Definition: KalmanVertexFitter.h:22