CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
LhcTrackAnalyzer Class Reference

#include <Alignment/HIPAlignmentAlgorithm/plugins/LhcTrackAnalyzer.cc>

Inheritance diagram for LhcTrackAnalyzer:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 LhcTrackAnalyzer (const edm::ParameterSet &)
 
 ~LhcTrackAnalyzer () override=default
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept 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 noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~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
 
void endJob () override
 
void SetVarToZero ()
 

Private Attributes

std::vector< unsigned int > acceptedBX_
 
int charge_ [nMaxtracks_]
 
double chi2_ [nMaxtracks_]
 
double chi2ndof_ [nMaxtracks_]
 
bool debug_
 
double dxy_ [nMaxtracks_]
 
double dxyError_ [nMaxtracks_]
 
double dxyPV_ [nMaxtracks_]
 
double dxyPVSig_ [nMaxtracks_]
 
double dxySig_ [nMaxtracks_]
 
double dz_ [nMaxtracks_]
 
double dzError_ [nMaxtracks_]
 
double dzPV_ [nMaxtracks_]
 
double dzPVSig_ [nMaxtracks_]
 
double dzSig_ [nMaxtracks_]
 
double eta_ [nMaxtracks_]
 
int event_
 
std::string filename_
 
bool goodbx_
 
bool goodvtx_
 
int isHighPurity_ [nMaxtracks_]
 
int nTracks_
 
double phi_ [nMaxtracks_]
 
double pt_ [nMaxtracks_]
 
edm::InputTag PVtxCollectionTag_
 
double qoverp_ [nMaxtracks_]
 
TFile * rootFile_
 
TTree * rootTree_
 
int run_
 
edm::EDGetTokenT< reco::TrackCollectiontheTrackCollectionToken
 
edm::EDGetTokenT< reco::VertexCollectiontheVertexCollectionToken
 
edm::InputTag TrackCollectionTag_
 
int trkAlgo_ [nMaxtracks_]
 
int trkQuality_ [nMaxtracks_]
 
int validhits_ [nMaxtracks_][7]
 
double xPCA_ [nMaxtracks_]
 
double yPCA_ [nMaxtracks_]
 
double zPCA_ [nMaxtracks_]
 

Static Private Attributes

static constexpr int nMaxtracks_ = 3000
 

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

Originally written by M.Musich Expanded by A. Bonato

Description: Ntuplizer for collision tracks

Definition at line 43 of file LhcTrackAnalyzer.cc.

Constructor & Destructor Documentation

◆ LhcTrackAnalyzer()

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

Definition at line 106 of file LhcTrackAnalyzer.cc.

References PVtxCollectionTag_, theTrackCollectionToken, theVertexCollectionToken, and TrackCollectionTag_.

107  : TrackCollectionTag_(iConfig.getParameter<edm::InputTag>("TrackCollectionTag")),
108  PVtxCollectionTag_(iConfig.getParameter<edm::InputTag>("PVtxCollectionTag")),
109  debug_(iConfig.getParameter<bool>("Debug")),
110  acceptedBX_(iConfig.getParameter<std::vector<unsigned int>>("acceptedBX")),
111  filename_(iConfig.getParameter<std::string>("OutputFileName")) {
112  //now do what ever initialization is needed
113  theTrackCollectionToken = consumes<reco::TrackCollection>(TrackCollectionTag_);
114  theVertexCollectionToken = consumes<reco::VertexCollection>(PVtxCollectionTag_);
115 }
edm::EDGetTokenT< reco::TrackCollection > theTrackCollectionToken
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::InputTag TrackCollectionTag_
std::vector< unsigned int > acceptedBX_
edm::EDGetTokenT< reco::VertexCollection > theVertexCollectionToken
std::string filename_
edm::InputTag PVtxCollectionTag_

◆ ~LhcTrackAnalyzer()

LhcTrackAnalyzer::~LhcTrackAnalyzer ( )
overridedefault

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 122 of file LhcTrackAnalyzer.cc.

References funct::abs(), acceptedBX_, reco::TrackBase::algoName(), reco::TrackBase::algoSize, nano_mu_digi_cff::bx, charge_, chi2_, chi2ndof_, reco::TrackBase::cosmics, reco::TrackBase::ctf, ztail::d, debug_, reco::TrackBase::detachedQuadStep, reco::TrackBase::detachedTripletStep, reco::TrackBase::displacedGeneralStep, reco::TrackBase::displacedRegionalStep, reco::TrackBase::duplicateMerge, dxy_, dxyError_, dxyPV_, dxyPVSig_, dxySig_, PVValHelper::dz, dz_, dzError_, dzPV_, dzPVSig_, dzSig_, eta_, event_, spr::find(), goodbx_, goodvtx_, reco::TrackBase::highPtTripletStep, reco::TrackBase::highPurity, reco::TrackBase::hltIter0, iEvent, reco::TrackBase::initialStep, isHighPurity_, reco::TrackBase::jetCoreRegionalStep, reco::TrackBase::loose, reco::TrackBase::lowPtQuadStep, reco::TrackBase::lowPtTripletStep, SiStripPI::max, pfMETCorrectionType0_cfi::minDz, reco::TrackBase::mixedTripletStep, reco::TrackBase::muonSeededStepInOut, reco::TrackBase::muonSeededStepOutIn, nMaxtracks_, nTracks_, phi_, reco::TrackBase::pixelLessStep, reco::TrackBase::pixelPairStep, reco::Vertex::position(), pt_, qoverp_, rootTree_, run_, SetVarToZero(), theTrackCollectionToken, theVertexCollectionToken, reco::TrackBase::tight, reco::TrackBase::tobTecStep, HLT_2024v14_cff::track, DiMuonV_cfg::tracks, trkAlgo_, trkQuality_, reco::TrackBase::undefAlgorithm, reco::TrackBase::undefQuality, validhits_, bphysicsOniaDQM_cfi::vertex, AlignmentTracksFromVertexSelector_cfi::vertices, L1BJetProducer_cff::vtx, xPCA_, yPCA_, and zPCA_.

124 {
125  using namespace edm;
126  using namespace reco;
127  using namespace std;
128 
129  //=======================================================
130  // Initialize Root-tuple variables
131  //=======================================================
132 
133  SetVarToZero();
134 
135  //=======================================================
136  // Retrieve the Track information
137  //=======================================================
138 
139  // Declare the handle for the vertex collection
140  const auto& vertexHandle = iEvent.getHandle(theVertexCollectionToken);
141 
142  // Check if the handle is valid
143  if (!vertexHandle.isValid()) {
144  edm::LogError("LhcTrackAnalyzer") << "Vertex collection not found or invalid.";
145  return; // Early return if the vertex collection is not valid
146  }
147 
148  // Retrieve the actual product from the handle
149  const reco::VertexCollection& vertices = *vertexHandle;
150 
151  const auto& vtx = vertices.front();
152  if (vtx.isFake()) {
153  goodvtx_ = false;
154  } else {
155  goodvtx_ = true;
156  }
157 
158  int bx = iEvent.bunchCrossing();
159  if (acceptedBX_.empty()) {
160  goodbx_ = true;
161  } else {
162  if (std::find(acceptedBX_.begin(), acceptedBX_.end(), bx) != acceptedBX_.end()) {
163  goodbx_ = true;
164  }
165  }
166 
167  run_ = iEvent.id().run();
168  event_ = iEvent.id().event();
169 
170  const auto& tracksHandle = iEvent.getHandle(theTrackCollectionToken);
171 
172  // Check if the handle is valid
173  if (!tracksHandle.isValid()) {
174  edm::LogError("LhcTrackAnalyzer") << "Tracks collection not found or invalid.";
175  return; // Early return if the vertex collection is not valid
176  }
177 
178  // Retrieve the actual product from the handle
179  const reco::TrackCollection& tracks = *tracksHandle;
180 
181  if (debug_) {
182  edm::LogInfo("LhcTrackAnalyzer") << "LhcTrackAnalyzer::analyze() looping over " << tracks.size() << "tracks."
183  << endl;
184  }
185 
186  for (const auto& track : tracks) {
187  if (nTracks_ >= nMaxtracks_) {
188  edm::LogWarning("LhcTrackAnalyzer")
189  << " LhcTrackAnalyzer::analyze() : Warning - Run " << run_ << " Event " << event_
190  << "\tNumber of tracks: " << tracks.size() << " , greater than " << nMaxtracks_ << std::endl;
191  continue;
192  }
193  pt_[nTracks_] = track.pt();
194  eta_[nTracks_] = track.eta();
195  phi_[nTracks_] = track.phi();
196  chi2_[nTracks_] = track.chi2();
197  chi2ndof_[nTracks_] = track.normalizedChi2();
198  charge_[nTracks_] = track.charge();
199  qoverp_[nTracks_] = track.qoverp();
200  dz_[nTracks_] = track.dz();
201  dxy_[nTracks_] = track.dxy();
202  dzError_[nTracks_] = track.dzError();
203  dxyError_[nTracks_] = track.dxyError();
204  dzSig_[nTracks_] = track.dz() / track.dzError();
205  dxySig_[nTracks_] = track.dxy() / track.dxyError();
206 
207  const reco::Vertex* closestVertex = nullptr;
209 
210  // Loop over vertices to find the closest one in dz
211  for (const auto& vertex : vertices) {
212  float dz = fabs(track.dz(vertex.position()));
213  if (dz < minDz) {
214  minDz = dz;
215  closestVertex = &vertex;
216  }
217  }
218 
219  float dzPV{-999.};
220  float dxyPV{-999.};
221  if (closestVertex) {
222  // Compute dxy and dz with respect to the closest vertex
223  dzPV = track.dz(closestVertex->position());
224  dxyPV = track.dxy(closestVertex->position());
225  }
226 
227  dzPV_[nTracks_] = dzPV;
228  dxyPV_[nTracks_] = dxyPV;
229 
230  dzPVSig_[nTracks_] = dzPV / track.dzError();
231  dxyPVSig_[nTracks_] = dxyPV / track.dxyError();
232 
233  xPCA_[nTracks_] = track.vertex().x();
234  yPCA_[nTracks_] = track.vertex().y();
235  zPCA_[nTracks_] = track.vertex().z();
236  validhits_[nTracks_][0] = track.numberOfValidHits();
237  validhits_[nTracks_][1] = track.hitPattern().numberOfValidPixelBarrelHits();
238  validhits_[nTracks_][2] = track.hitPattern().numberOfValidPixelEndcapHits();
239  validhits_[nTracks_][3] = track.hitPattern().numberOfValidStripTIBHits();
240  validhits_[nTracks_][4] = track.hitPattern().numberOfValidStripTIDHits();
241  validhits_[nTracks_][5] = track.hitPattern().numberOfValidStripTOBHits();
242  validhits_[nTracks_][6] = track.hitPattern().numberOfValidStripTECHits();
243 
244  int myalgo = -88;
245  if (track.algo() == reco::TrackBase::undefAlgorithm) {
246  myalgo = 0;
247  } else if (track.algo() == reco::TrackBase::ctf) {
248  myalgo = 1;
249  } else if (track.algo() == reco::TrackBase::duplicateMerge) {
250  myalgo = 2;
251  } else if (track.algo() == reco::TrackBase::cosmics) {
252  myalgo = 3;
253  } else if (track.algo() == reco::TrackBase::initialStep) {
254  myalgo = 4;
255  } else if (track.algo() == reco::TrackBase::lowPtTripletStep) {
256  myalgo = 5;
257  } else if (track.algo() == reco::TrackBase::pixelPairStep) {
258  myalgo = 6;
259  } else if (track.algo() == reco::TrackBase::detachedTripletStep) {
260  myalgo = 7;
261  } else if (track.algo() == reco::TrackBase::mixedTripletStep) {
262  myalgo = 8;
263  } else if (track.algo() == reco::TrackBase::pixelLessStep) {
264  myalgo = 9;
265  } else if (track.algo() == reco::TrackBase::tobTecStep) {
266  myalgo = 10;
267  } else if (track.algo() == reco::TrackBase::jetCoreRegionalStep) {
268  myalgo = 11;
269  } else if (track.algo() == reco::TrackBase::muonSeededStepInOut) {
270  myalgo = 13;
271  } else if (track.algo() == reco::TrackBase::muonSeededStepOutIn) {
272  myalgo = 14;
273  } else if (track.algo() == reco::TrackBase::highPtTripletStep) {
274  myalgo = 22;
275  } else if (track.algo() == reco::TrackBase::lowPtQuadStep) {
276  myalgo = 23;
277  } else if (track.algo() == reco::TrackBase::detachedQuadStep) {
278  myalgo = 24;
279  } else if (track.algo() == reco::TrackBase::displacedGeneralStep) {
280  myalgo = 25;
281  } else if (track.algo() == reco::TrackBase::displacedRegionalStep) {
282  myalgo = 26;
283  } else if (track.algo() == reco::TrackBase::hltIter0) {
284  myalgo = 31;
285  } else {
286  myalgo = reco::TrackBase::algoSize;
287  edm::LogWarning("LhcTrackAnalyzer")
288  << "LhcTrackAnalyzer does not support all types of tracks, encountered one from algo "
289  << reco::TrackBase::algoName(track.algo());
290  }
291  trkAlgo_[nTracks_] = myalgo;
292 
293  int myquality = -99;
295  myquality = -1;
296  if (track.quality(reco::TrackBase::loose))
297  myquality = 0;
298  if (track.quality(reco::TrackBase::tight))
299  myquality = 1;
300  if (track.quality(reco::TrackBase::highPurity))
301  myquality = 2;
302  trkQuality_[nTracks_] = myquality;
303 
304  if (track.quality(reco::TrackBase::highPurity))
305  isHighPurity_[nTracks_] = 1;
306  else
307  isHighPurity_[nTracks_] = 0;
308  nTracks_++;
309 
310  } //end loop on tracks
311 
312  for (int d = 0; d < nTracks_; ++d) {
313  if (abs(trkQuality_[d]) > 5)
314  edm::LogInfo("LhcTrackAnalyzer") << "MYQUALITY!!! " << trkQuality_[d] << " at track # " << d << "/" << nTracks_
315  << endl;
316  }
317 
318  rootTree_->Fill();
319 }
edm::EDGetTokenT< reco::TrackCollection > theTrackCollectionToken
int validhits_[nMaxtracks_][7]
const Point & position() const
position
Definition: Vertex.h:128
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
int isHighPurity_[nMaxtracks_]
double dz_[nMaxtracks_]
double zPCA_[nMaxtracks_]
Log< level::Error, false > LogError
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
int trkQuality_[nMaxtracks_]
double qoverp_[nMaxtracks_]
std::vector< unsigned int > acceptedBX_
edm::EDGetTokenT< reco::VertexCollection > theVertexCollectionToken
double eta_[nMaxtracks_]
int iEvent
Definition: GenABIO.cc:224
double dzPVSig_[nMaxtracks_]
double phi_[nMaxtracks_]
double dxySig_[nMaxtracks_]
double chi2ndof_[nMaxtracks_]
double yPCA_[nMaxtracks_]
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double dxyPVSig_[nMaxtracks_]
double dxyError_[nMaxtracks_]
static constexpr int nMaxtracks_
double dxy_[nMaxtracks_]
d
Definition: ztail.py:151
std::string algoName() const
Definition: TrackBase.h:550
double dzSig_[nMaxtracks_]
Log< level::Info, false > LogInfo
int trkAlgo_[nMaxtracks_]
double dzError_[nMaxtracks_]
double xPCA_[nMaxtracks_]
fixed size matrix
HLT enums.
double chi2_[nMaxtracks_]
int charge_[nMaxtracks_]
double dzPV_[nMaxtracks_]
Log< level::Warning, false > LogWarning
double pt_[nMaxtracks_]
double dxyPV_[nMaxtracks_]

◆ beginJob()

void LhcTrackAnalyzer::beginJob ( )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 322 of file LhcTrackAnalyzer.cc.

References charge_, chi2_, chi2ndof_, dxy_, dxyError_, dxyPVSig_, dxySig_, dz_, dzError_, dzPV_, dzPVSig_, dzSig_, eta_, event_, filename_, goodbx_, goodvtx_, isHighPurity_, nTracks_, phi_, pt_, qoverp_, rootFile_, rootTree_, run_, trkAlgo_, trkQuality_, validhits_, xPCA_, yPCA_, and zPCA_.

324 {
325  edm::LogInfo("beginJob") << "Begin Job" << std::endl;
326  // Define TTree for output
327  rootFile_ = new TFile(filename_.c_str(), "recreate");
328  rootTree_ = new TTree("tree", "Lhc Track tree");
329 
330  // Track Paramters
331  rootTree_->Branch("run", &run_, "run/I");
332  rootTree_->Branch("event", &event_, "event/I");
333  rootTree_->Branch("goodbx", &goodbx_, "goodbx/O");
334  rootTree_->Branch("goodvtx", &goodvtx_, "goodvtx/O");
335  rootTree_->Branch("nTracks", &nTracks_, "nTracks/I");
336  rootTree_->Branch("pt", &pt_, "pt[nTracks]/D");
337  rootTree_->Branch("eta", &eta_, "eta[nTracks]/D");
338  rootTree_->Branch("phi", &phi_, "phi[nTracks]/D");
339  rootTree_->Branch("chi2", &chi2_, "chi2[nTracks]/D");
340  rootTree_->Branch("chi2ndof", &chi2ndof_, "chi2ndof[nTracks]/D");
341  rootTree_->Branch("charge", &charge_, "charge[nTracks]/I");
342  rootTree_->Branch("qoverp", &qoverp_, "qoverp[nTracks]/D");
343  rootTree_->Branch("dz", &dz_, "dz[nTracks]/D");
344  rootTree_->Branch("dxy", &dxy_, "dxy[nTracks]/D");
345  rootTree_->Branch("dzPV", &dzPV_, "dzPV[nTracks]/D");
346  rootTree_->Branch("dxyPV", &dxy_, "dxyPV[nTracks]/D");
347  rootTree_->Branch("dzError", &dzError_, "dzError[nTracks]/D");
348  rootTree_->Branch("dxyError", &dxyError_, "dxyError[nTracks]/D");
349  rootTree_->Branch("dzSig", &dzSig_, "dzSig[nTracks]/D");
350  rootTree_->Branch("dxySig", &dxySig_, "dxySig[nTracks]/D");
351  rootTree_->Branch("dzPVSig", &dzPVSig_, "dzPVSig[nTracks]/D");
352  rootTree_->Branch("dxyPVSig", &dxyPVSig_, "dxyPVSig[nTracks]/D");
353  rootTree_->Branch("xPCA", &xPCA_, "xPCA[nTracks]/D");
354  rootTree_->Branch("yPCA", &yPCA_, "yPCA[nTracks]/D");
355  rootTree_->Branch("zPCA", &zPCA_, "zPCA[nTracks]/D");
356  rootTree_->Branch("isHighPurity", &isHighPurity_, "isHighPurity[nTracks]/I");
357  rootTree_->Branch("trkQuality", &trkQuality_, "trkQuality[nTracks]/I");
358  rootTree_->Branch("trkAlgo", &trkAlgo_, "trkAlgo[nTracks]/I");
359  rootTree_->Branch("nValidHits", &validhits_, "nValidHits[nTracks][7]/I");
360 }
int validhits_[nMaxtracks_][7]
int isHighPurity_[nMaxtracks_]
double dz_[nMaxtracks_]
double zPCA_[nMaxtracks_]
int trkQuality_[nMaxtracks_]
double qoverp_[nMaxtracks_]
double eta_[nMaxtracks_]
double dzPVSig_[nMaxtracks_]
std::string filename_
double phi_[nMaxtracks_]
double dxySig_[nMaxtracks_]
double chi2ndof_[nMaxtracks_]
double yPCA_[nMaxtracks_]
double dxyPVSig_[nMaxtracks_]
double dxyError_[nMaxtracks_]
double dxy_[nMaxtracks_]
double dzSig_[nMaxtracks_]
Log< level::Info, false > LogInfo
int trkAlgo_[nMaxtracks_]
double dzError_[nMaxtracks_]
double xPCA_[nMaxtracks_]
double chi2_[nMaxtracks_]
int charge_[nMaxtracks_]
double dzPV_[nMaxtracks_]
double pt_[nMaxtracks_]

◆ endJob()

void LhcTrackAnalyzer::endJob ( )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 363 of file LhcTrackAnalyzer.cc.

References rootFile_.

Referenced by o2olib.O2ORunMgr::executeJob().

365 {
366  if (rootFile_) {
367  rootFile_->Write();
368  rootFile_->Close();
369  }
370 }

◆ fillDescriptions()

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

Definition at line 373 of file LhcTrackAnalyzer.cc.

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

375 {
377  desc.setComment("Ntuplizer for LHC tracks");
378  desc.add<edm::InputTag>("TrackCollectionTag", edm::InputTag("ALCARECOTkAlMinBias"));
379  desc.add<edm::InputTag>("PVtxCollectionTag", edm::InputTag("offlinePrimaryVertices"));
380  desc.add<bool>("Debug", false);
381  desc.add<std::vector<unsigned int>>("acceptedBX", {});
382  desc.add<std::string>("OutputFileName", "LhcTrackAnalyzer_Output_default.root");
383  descriptions.addWithDefaultLabel(desc);
384 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ SetVarToZero()

void LhcTrackAnalyzer::SetVarToZero ( )
private

Definition at line 387 of file LhcTrackAnalyzer.cc.

References charge_, chi2_, chi2ndof_, dxy_, dz_, eta_, event_, mps_fire::i, isHighPurity_, dqmiolumiharvest::j, nMaxtracks_, nTracks_, phi_, pt_, qoverp_, run_, trkAlgo_, trkQuality_, validhits_, xPCA_, yPCA_, and zPCA_.

Referenced by analyze().

389 {
390  run_ = -1;
391  event_ = -99;
392  nTracks_ = 0;
393  for (int i = 0; i < nMaxtracks_; ++i) {
394  pt_[i] = 0;
395  eta_[i] = 0;
396  phi_[i] = 0;
397  chi2_[i] = 0;
398  chi2ndof_[i] = 0;
399  charge_[i] = 0;
400  qoverp_[i] = 0;
401  dz_[i] = 0;
402  dxy_[i] = 0;
403  xPCA_[i] = 0;
404  yPCA_[i] = 0;
405  zPCA_[i] = 0;
406  trkQuality_[i] = 0;
407  trkAlgo_[i] = -1;
408  isHighPurity_[i] = -3;
409  for (int j = 0; j < 7; j++) {
410  validhits_[nTracks_][j] = -1 * j;
411  }
412  }
413 }
int validhits_[nMaxtracks_][7]
int isHighPurity_[nMaxtracks_]
double dz_[nMaxtracks_]
double zPCA_[nMaxtracks_]
int trkQuality_[nMaxtracks_]
double qoverp_[nMaxtracks_]
double eta_[nMaxtracks_]
double phi_[nMaxtracks_]
double chi2ndof_[nMaxtracks_]
double yPCA_[nMaxtracks_]
static constexpr int nMaxtracks_
double dxy_[nMaxtracks_]
int trkAlgo_[nMaxtracks_]
double xPCA_[nMaxtracks_]
double chi2_[nMaxtracks_]
int charge_[nMaxtracks_]
double pt_[nMaxtracks_]

Member Data Documentation

◆ acceptedBX_

std::vector<unsigned int> LhcTrackAnalyzer::acceptedBX_
private

Definition at line 58 of file LhcTrackAnalyzer.cc.

Referenced by analyze().

◆ charge_

int LhcTrackAnalyzer::charge_[nMaxtracks_]
private

Definition at line 81 of file LhcTrackAnalyzer.cc.

Referenced by analyze(), beginJob(), and SetVarToZero().

◆ chi2_

double LhcTrackAnalyzer::chi2_[nMaxtracks_]
private

Definition at line 79 of file LhcTrackAnalyzer.cc.

Referenced by analyze(), beginJob(), and SetVarToZero().

◆ chi2ndof_

double LhcTrackAnalyzer::chi2ndof_[nMaxtracks_]
private

Definition at line 80 of file LhcTrackAnalyzer.cc.

Referenced by analyze(), beginJob(), and SetVarToZero().

◆ debug_

bool LhcTrackAnalyzer::debug_
private

Definition at line 57 of file LhcTrackAnalyzer.cc.

Referenced by analyze().

◆ dxy_

double LhcTrackAnalyzer::dxy_[nMaxtracks_]
private

Definition at line 84 of file LhcTrackAnalyzer.cc.

Referenced by analyze(), beginJob(), and SetVarToZero().

◆ dxyError_

double LhcTrackAnalyzer::dxyError_[nMaxtracks_]
private

Definition at line 92 of file LhcTrackAnalyzer.cc.

Referenced by analyze(), and beginJob().

◆ dxyPV_

double LhcTrackAnalyzer::dxyPV_[nMaxtracks_]
private

Definition at line 86 of file LhcTrackAnalyzer.cc.

Referenced by analyze().

◆ dxyPVSig_

double LhcTrackAnalyzer::dxyPVSig_[nMaxtracks_]
private

Definition at line 90 of file LhcTrackAnalyzer.cc.

Referenced by analyze(), and beginJob().

◆ dxySig_

double LhcTrackAnalyzer::dxySig_[nMaxtracks_]
private

Definition at line 88 of file LhcTrackAnalyzer.cc.

Referenced by analyze(), and beginJob().

◆ dz_

double LhcTrackAnalyzer::dz_[nMaxtracks_]
private

Definition at line 83 of file LhcTrackAnalyzer.cc.

Referenced by analyze(), beginJob(), and SetVarToZero().

◆ dzError_

double LhcTrackAnalyzer::dzError_[nMaxtracks_]
private

Definition at line 91 of file LhcTrackAnalyzer.cc.

Referenced by analyze(), and beginJob().

◆ dzPV_

double LhcTrackAnalyzer::dzPV_[nMaxtracks_]
private

Definition at line 85 of file LhcTrackAnalyzer.cc.

Referenced by analyze(), and beginJob().

◆ dzPVSig_

double LhcTrackAnalyzer::dzPVSig_[nMaxtracks_]
private

Definition at line 89 of file LhcTrackAnalyzer.cc.

Referenced by analyze(), and beginJob().

◆ dzSig_

double LhcTrackAnalyzer::dzSig_[nMaxtracks_]
private

Definition at line 87 of file LhcTrackAnalyzer.cc.

Referenced by analyze(), and beginJob().

◆ eta_

double LhcTrackAnalyzer::eta_[nMaxtracks_]
private

Definition at line 77 of file LhcTrackAnalyzer.cc.

Referenced by analyze(), beginJob(), and SetVarToZero().

◆ event_

int LhcTrackAnalyzer::event_
private

Definition at line 75 of file LhcTrackAnalyzer.cc.

Referenced by analyze(), beginJob(), and SetVarToZero().

◆ filename_

std::string LhcTrackAnalyzer::filename_
private

Definition at line 64 of file LhcTrackAnalyzer.cc.

Referenced by beginJob().

◆ goodbx_

bool LhcTrackAnalyzer::goodbx_
private

Definition at line 100 of file LhcTrackAnalyzer.cc.

Referenced by analyze(), and beginJob().

◆ goodvtx_

bool LhcTrackAnalyzer::goodvtx_
private

Definition at line 101 of file LhcTrackAnalyzer.cc.

Referenced by analyze(), and beginJob().

◆ isHighPurity_

int LhcTrackAnalyzer::isHighPurity_[nMaxtracks_]
private

Definition at line 98 of file LhcTrackAnalyzer.cc.

Referenced by analyze(), beginJob(), and SetVarToZero().

◆ nMaxtracks_

constexpr int LhcTrackAnalyzer::nMaxtracks_ = 3000
staticprivate

Definition at line 72 of file LhcTrackAnalyzer.cc.

Referenced by analyze(), and SetVarToZero().

◆ nTracks_

int LhcTrackAnalyzer::nTracks_
private

Definition at line 73 of file LhcTrackAnalyzer.cc.

Referenced by analyze(), beginJob(), and SetVarToZero().

◆ phi_

double LhcTrackAnalyzer::phi_[nMaxtracks_]
private

Definition at line 78 of file LhcTrackAnalyzer.cc.

Referenced by analyze(), beginJob(), and SetVarToZero().

◆ pt_

double LhcTrackAnalyzer::pt_[nMaxtracks_]
private

Definition at line 76 of file LhcTrackAnalyzer.cc.

Referenced by analyze(), beginJob(), and SetVarToZero().

◆ PVtxCollectionTag_

edm::InputTag LhcTrackAnalyzer::PVtxCollectionTag_
private

Definition at line 56 of file LhcTrackAnalyzer.cc.

Referenced by LhcTrackAnalyzer().

◆ qoverp_

double LhcTrackAnalyzer::qoverp_[nMaxtracks_]
private

Definition at line 82 of file LhcTrackAnalyzer.cc.

Referenced by analyze(), beginJob(), and SetVarToZero().

◆ rootFile_

TFile* LhcTrackAnalyzer::rootFile_
private

Definition at line 65 of file LhcTrackAnalyzer.cc.

Referenced by beginJob(), and endJob().

◆ rootTree_

TTree* LhcTrackAnalyzer::rootTree_
private

Definition at line 66 of file LhcTrackAnalyzer.cc.

Referenced by analyze(), and beginJob().

◆ run_

int LhcTrackAnalyzer::run_
private

Definition at line 74 of file LhcTrackAnalyzer.cc.

Referenced by analyze(), beginJob(), and SetVarToZero().

◆ theTrackCollectionToken

edm::EDGetTokenT<reco::TrackCollection> LhcTrackAnalyzer::theTrackCollectionToken
private

Definition at line 60 of file LhcTrackAnalyzer.cc.

Referenced by analyze(), and LhcTrackAnalyzer().

◆ theVertexCollectionToken

edm::EDGetTokenT<reco::VertexCollection> LhcTrackAnalyzer::theVertexCollectionToken
private

Definition at line 61 of file LhcTrackAnalyzer.cc.

Referenced by analyze(), and LhcTrackAnalyzer().

◆ TrackCollectionTag_

edm::InputTag LhcTrackAnalyzer::TrackCollectionTag_
private

Definition at line 55 of file LhcTrackAnalyzer.cc.

Referenced by LhcTrackAnalyzer().

◆ trkAlgo_

int LhcTrackAnalyzer::trkAlgo_[nMaxtracks_]
private

Definition at line 96 of file LhcTrackAnalyzer.cc.

Referenced by analyze(), beginJob(), and SetVarToZero().

◆ trkQuality_

int LhcTrackAnalyzer::trkQuality_[nMaxtracks_]
private

Definition at line 97 of file LhcTrackAnalyzer.cc.

Referenced by analyze(), beginJob(), and SetVarToZero().

◆ validhits_

int LhcTrackAnalyzer::validhits_[nMaxtracks_][7]
private

Definition at line 99 of file LhcTrackAnalyzer.cc.

Referenced by analyze(), beginJob(), and SetVarToZero().

◆ xPCA_

double LhcTrackAnalyzer::xPCA_[nMaxtracks_]
private

Definition at line 93 of file LhcTrackAnalyzer.cc.

Referenced by analyze(), beginJob(), and SetVarToZero().

◆ yPCA_

double LhcTrackAnalyzer::yPCA_[nMaxtracks_]
private

Definition at line 94 of file LhcTrackAnalyzer.cc.

Referenced by analyze(), beginJob(), and SetVarToZero().

◆ zPCA_

double LhcTrackAnalyzer::zPCA_[nMaxtracks_]
private

Definition at line 95 of file LhcTrackAnalyzer.cc.

Referenced by analyze(), beginJob(), and SetVarToZero().