CMS 3D CMS Logo

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

Classes

struct  ArmPlots
 
struct  RPPlots
 

Public Member Functions

 CTPPSTrackDistributionPlotter (const edm::ParameterSet &)
 
 ~CTPPSTrackDistributionPlotter () override
 
- 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 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)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void endJob () override
 

Private Attributes

std::map< unsigned int, ArmPlotsarmPlots
 
std::map< unsigned int, unsigned int > events_per_arm_
 
unsigned int events_total_
 
std::string outputFile_
 
std::map< unsigned int, RPPlotsrpPlots
 
edm::EDGetTokenT< CTPPSLocalTrackLiteCollectiontracksToken_
 
double x_pitch_pixels_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 CTPPSTrackDistributionPlotter.cc.

Constructor & Destructor Documentation

◆ CTPPSTrackDistributionPlotter()

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

Definition at line 179 of file CTPPSTrackDistributionPlotter.cc.

181  : tracksToken_(consumes<CTPPSLocalTrackLiteCollection>(iConfig.getParameter<edm::InputTag>("tagTracks"))),
182  x_pitch_pixels_(iConfig.getUntrackedParameter<double>("x_pitch_pixels", 150E-3)),
183  outputFile_(iConfig.getParameter<std::string>("outputFile")),
184  events_total_(0) {
185  armPlots[0].rpId_N = iConfig.getParameter<unsigned int>("rpId_45_N");
186  armPlots[0].rpId_F = iConfig.getParameter<unsigned int>("rpId_45_F");
187 
188  armPlots[1].rpId_N = iConfig.getParameter<unsigned int>("rpId_56_N");
189  armPlots[1].rpId_F = iConfig.getParameter<unsigned int>("rpId_56_F");

◆ ~CTPPSTrackDistributionPlotter()

CTPPSTrackDistributionPlotter::~CTPPSTrackDistributionPlotter ( )
inlineoverride

Definition at line 42 of file CTPPSTrackDistributionPlotter.cc.

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 193 of file CTPPSTrackDistributionPlotter.cc.

194  {
195  // get input
197  iEvent.getByToken(tracksToken_, tracks);
198 
199  // process tracks
200  std::map<unsigned int, unsigned int> m_mult;
201 
202  for (const auto& trk : *tracks) {
203  CTPPSDetId rpId(trk.rpId());
204  unsigned int rpDecId = rpId.arm() * 100 + rpId.station() * 10 + rpId.rp();
205  bool rpPixel = (rpId.subdetId() == CTPPSDetId::sdTrackingPixel);
206 
207  auto& pl = rpPlots[rpDecId];
208  if (!pl.initialized)
209  pl.init(rpPixel, x_pitch_pixels_);
210 
211  pl.fill(trk.x(), trk.y(), trk.time());
212 
213  m_mult[rpId.arm()]++;
214  }
215 
216  for (unsigned int arm = 0; arm < 2; ++arm) {
217  auto& st = armPlots[arm].m_stat[iEvent.id().run()][iEvent.id().luminosityBlock()];
218  st.s1++;
219  st.sN += m_mult[arm];
220  }
221 
222  for (const auto& t1 : *tracks) {
223  const CTPPSDetId rpId1(t1.rpId());
224 
225  for (const auto& t2 : *tracks) {
226  const CTPPSDetId rpId2(t2.rpId());
227 
228  if (rpId1.arm() != rpId2.arm())
229  continue;
230 
231  auto& ap = armPlots[rpId1.arm()];
232 
233  const unsigned int rpDecId1 = rpId1.arm() * 100 + rpId1.station() * 10 + rpId1.rp();
234  const unsigned int rpDecId2 = rpId2.arm() * 100 + rpId2.station() * 10 + rpId2.rp();
235 
236  if (rpDecId1 == ap.rpId_N && rpDecId2 == ap.rpId_F)
237  ap.fill(t1.x(), t1.y(), t2.x(), t2.y());
238  }
239  }
240 
241  // update counters
242  events_total_++;
243 
244  if (m_mult[0] > 0)
245  events_per_arm_[0]++;
246  if (m_mult[1] > 0)
247  events_per_arm_[1]++;

References protons_cff::arm, armPlots, events_per_arm_, events_total_, iEvent, profile_2016_postTS2_cff::rpId, rpPlots, CTPPSDetId::sdTrackingPixel, RandomServiceHelper::t1, RandomServiceHelper::t2, tracks, tracksToken_, and x_pitch_pixels_.

◆ endJob()

void CTPPSTrackDistributionPlotter::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 251 of file CTPPSTrackDistributionPlotter.cc.

252  {
253  edm::LogInfo("CTPPSTrackDistributionPlotter")
254  << " events processed: " << events_total_ << " (" << std::scientific << double(events_total_) << ")\n"
255  << " events with tracks in sector 45: " << events_per_arm_[0] << " (" << double(events_per_arm_[0]) << ")\n"
256  << " events with tracks in sector 56: " << events_per_arm_[1] << " (" << double(events_per_arm_[1]) << ")";
257 
258  auto f_out = std::make_unique<TFile>(outputFile_.c_str(), "recreate");
259 
260  for (const auto& it : rpPlots) {
261  gDirectory = f_out->mkdir(Form("RP %u", it.first));
262  it.second.write();
263  }
264 
265  for (const auto& it : armPlots) {
266  gDirectory = f_out->mkdir(Form("arm %u", it.first));
267  it.second.write();
268  }

References armPlots, events_per_arm_, events_total_, outputFile_, and rpPlots.

Member Data Documentation

◆ armPlots

std::map<unsigned int, ArmPlots> CTPPSTrackDistributionPlotter::armPlots
private

Definition at line 180 of file CTPPSTrackDistributionPlotter.cc.

Referenced by analyze(), and endJob().

◆ events_per_arm_

std::map<unsigned int, unsigned int> CTPPSTrackDistributionPlotter::events_per_arm_
private

Definition at line 55 of file CTPPSTrackDistributionPlotter.cc.

Referenced by analyze(), and endJob().

◆ events_total_

unsigned int CTPPSTrackDistributionPlotter::events_total_
private

Definition at line 54 of file CTPPSTrackDistributionPlotter.cc.

Referenced by analyze(), and endJob().

◆ outputFile_

std::string CTPPSTrackDistributionPlotter::outputFile_
private

Definition at line 52 of file CTPPSTrackDistributionPlotter.cc.

Referenced by endJob().

◆ rpPlots

std::map<unsigned int, RPPlots> CTPPSTrackDistributionPlotter::rpPlots
private

Definition at line 103 of file CTPPSTrackDistributionPlotter.cc.

Referenced by analyze(), and endJob().

◆ tracksToken_

edm::EDGetTokenT<CTPPSLocalTrackLiteCollection> CTPPSTrackDistributionPlotter::tracksToken_
private

Definition at line 48 of file CTPPSTrackDistributionPlotter.cc.

Referenced by analyze().

◆ x_pitch_pixels_

double CTPPSTrackDistributionPlotter::x_pitch_pixels_
private

Definition at line 50 of file CTPPSTrackDistributionPlotter.cc.

Referenced by analyze().

RandomServiceHelper.t2
t2
Definition: RandomServiceHelper.py:257
CTPPSTrackDistributionPlotter::events_total_
unsigned int events_total_
Definition: CTPPSTrackDistributionPlotter.cc:54
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::Handle
Definition: AssociativeIterator.h:50
RandomServiceHelper.t1
t1
Definition: RandomServiceHelper.py:256
CTPPSTrackDistributionPlotter::armPlots
std::map< unsigned int, ArmPlots > armPlots
Definition: CTPPSTrackDistributionPlotter.cc:180
CTPPSDetId::sdTrackingPixel
Definition: CTPPSDetId.h:44
CTPPSTrackDistributionPlotter::rpPlots
std::map< unsigned int, RPPlots > rpPlots
Definition: CTPPSTrackDistributionPlotter.cc:103
tracks
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
Definition: CAHitNtupletGeneratorKernelsImpl.h:176
CTPPSTrackDistributionPlotter::tracksToken_
edm::EDGetTokenT< CTPPSLocalTrackLiteCollection > tracksToken_
Definition: CTPPSTrackDistributionPlotter.cc:48
CTPPSDetId
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:31
iEvent
int iEvent
Definition: GenABIO.cc:224
CTPPSTrackDistributionPlotter::x_pitch_pixels_
double x_pitch_pixels_
Definition: CTPPSTrackDistributionPlotter.cc:50
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
protons_cff.arm
arm
Definition: protons_cff.py:39
profile_2016_postTS2_cff.rpId
rpId
Definition: profile_2016_postTS2_cff.py:21
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
CTPPSTrackDistributionPlotter::outputFile_
std::string outputFile_
Definition: CTPPSTrackDistributionPlotter.cc:52
CTPPSTrackDistributionPlotter::events_per_arm_
std::map< unsigned int, unsigned int > events_per_arm_
Definition: CTPPSTrackDistributionPlotter.cc:55
edm::InputTag
Definition: InputTag.h:15