CMS 3D CMS Logo

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

Public Member Functions

 TkAlV0sAnalyzer (const edm::ParameterSet &)
 
 ~TkAlV0sAnalyzer () override=default
 
- 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, 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::ESRecordsToProductResolverIndices 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)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
template<typename T , typename... Args>
Tbook (const Args &... args) const
 

Private Attributes

edm::Service< TFileServicefs_
 
TH1F * h_diTrackMass
 
TH1F * h_V0Mass
 
const edm::EDGetTokenT< TrackCollection > tracksToken_
 
const edm::EDGetTokenT< reco::VertexCompositeCandidateCollectionvccToken_
 

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
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 52 of file TkAlV0sAnalyzer.cc.

Constructor & Destructor Documentation

◆ TkAlV0sAnalyzer()

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

Definition at line 79 of file TkAlV0sAnalyzer.cc.

References TFileService::kSharedResource.

80  : tracksToken_(consumes<TrackCollection>(iConfig.getUntrackedParameter<edm::InputTag>("tracks"))),
81  vccToken_(consumes<reco::VertexCompositeCandidateCollection>(
82  iConfig.getParameter<edm::InputTag>("vertexCompositeCandidates"))) {
83  usesResource(TFileService::kSharedResource);
84 }
static const std::string kSharedResource
Definition: TFileService.h:76
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const edm::EDGetTokenT< TrackCollection > tracksToken_
T getUntrackedParameter(std::string const &, T const &) const
const edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > vccToken_

◆ ~TkAlV0sAnalyzer()

TkAlV0sAnalyzer::~TkAlV0sAnalyzer ( )
overridedefault

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 96 of file TkAlV0sAnalyzer.cc.

References h_diTrackMass, h_V0Mass, mps_fire::i, iEvent, edm::Ref< C, T, F >::isNonnull(), EgHLTOffHistBins_cfi::mass, piMass2, edm::Handle< T >::product(), mathSSE::sqrt(), reco::RecoChargedCandidate::track(), HLT_2023v12_cff::track, tracksToken_, V0Monitor_cff::v0, and vccToken_.

96  {
97  using namespace edm;
98 
99  std::vector<const reco::Track*> myTracks;
100 
102  iEvent.getByToken(vccToken_, vccHandle);
103 
104  if (vccHandle->empty())
105  return;
106 
108 
109  for (const auto& track : iEvent.get(tracksToken_)) {
110  myTracks.emplace_back(&track);
111  }
112 
113  // exclude multiple candidates
114  if (myTracks.size() != 2)
115  return;
116 
117  for (const auto& v0 : v0s) {
118  float mass = v0.mass();
119  h_V0Mass->Fill(mass);
120 
121  for (size_t i = 0; i < v0.numberOfDaughters(); ++i) {
122  //LogPrint("AlignmentTrackFromVertexCompositeCandidateSelector") << "daughter: " << i << std::endl;
123  const reco::Candidate* daughter = v0.daughter(i);
124  const reco::RecoChargedCandidate* chargedDaughter = dynamic_cast<const reco::RecoChargedCandidate*>(daughter);
125  if (chargedDaughter) {
126  //LogPrint("AlignmentTrackFromVertexCompositeCandidateSelector") << "charged daughter: " << i << std::endl;
127  const reco::TrackRef trackRef = chargedDaughter->track();
128  if (trackRef.isNonnull()) {
129  // LogPrint("AlignmentTrackFromVertexCompositeCandidateSelector")
130  // << "charged daughter has non-null trackref: " << i << std::endl;
131  }
132  }
133  }
134  }
135 
136  const auto& tplus = myTracks[0]->charge() > 0 ? myTracks[0] : myTracks[1];
137  const auto& tminus = myTracks[0]->charge() < 0 ? myTracks[0] : myTracks[1];
138 
139  TLorentzVector p4_tplus(tplus->px(), tplus->py(), tplus->pz(), sqrt((tplus->p() * tplus->p()) + piMass2));
140  TLorentzVector p4_tminus(tminus->px(), tminus->py(), tminus->pz(), sqrt((tminus->p() * tminus->p()) + piMass2));
141 
142  const auto& V0p4 = p4_tplus + p4_tminus;
143  float track_invMass = V0p4.M();
144  h_diTrackMass->Fill(track_invMass);
145 }
std::vector< VertexCompositeCandidate > VertexCompositeCandidateCollection
collection of Candidate objects
T const * product() const
Definition: Handle.h:70
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
const edm::EDGetTokenT< TrackCollection > tracksToken_
int iEvent
Definition: GenABIO.cc:224
const edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > vccToken_
T sqrt(T t)
Definition: SSEVec.h:19
reco::TrackRef track() const override
reference to a track
static constexpr double piMass2
HLT enums.

◆ beginJob()

void TkAlV0sAnalyzer::beginJob ( )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 147 of file TkAlV0sAnalyzer.cc.

References h_diTrackMass, and h_V0Mass.

147  {
148  h_diTrackMass = book<TH1F>("diTrackMass", "V0 mass from tracks in Event", 100, 0.400, 0.600);
149  h_V0Mass = book<TH1F>("V0kMass", "Reconstructed V0 mass in Event", 100, 0.400, 0.600);
150 }

◆ book()

template<typename T , typename... Args>
T * TkAlV0sAnalyzer::book ( const Args &...  args) const
private

Definition at line 87 of file TkAlV0sAnalyzer.cc.

References writedatasetfile::args, fs_, TFileService::make(), and submitPVValidationJobs::t.

87  {
88  T* t = fs_->make<T>(args...);
89  return t;
90 }
edm::Service< TFileService > fs_
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
long double T

◆ fillDescriptions()

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

Definition at line 153 of file TkAlV0sAnalyzer.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, and ProducerED_cfi::InputTag.

153  {
155  desc.add<edm::InputTag>("vertexCompositeCandidates", edm::InputTag("generalV0Candidates:Kshort"));
156  desc.addUntracked<edm::InputTag>("tracks", edm::InputTag("ALCARECOTkAlKShortTracks"));
157  descriptions.addWithDefaultLabel(desc);
158 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ fs_

edm::Service<TFileService> TkAlV0sAnalyzer::fs_
private

Definition at line 68 of file TkAlV0sAnalyzer.cc.

Referenced by book().

◆ h_diTrackMass

TH1F* TkAlV0sAnalyzer::h_diTrackMass
private

Definition at line 70 of file TkAlV0sAnalyzer.cc.

Referenced by analyze(), and beginJob().

◆ h_V0Mass

TH1F* TkAlV0sAnalyzer::h_V0Mass
private

Definition at line 71 of file TkAlV0sAnalyzer.cc.

Referenced by analyze(), and beginJob().

◆ tracksToken_

const edm::EDGetTokenT<TrackCollection> TkAlV0sAnalyzer::tracksToken_
private

Definition at line 66 of file TkAlV0sAnalyzer.cc.

Referenced by analyze().

◆ vccToken_

const edm::EDGetTokenT<reco::VertexCompositeCandidateCollection> TkAlV0sAnalyzer::vccToken_
private

Definition at line 67 of file TkAlV0sAnalyzer.cc.

Referenced by analyze().