CMS 3D CMS Logo

CSCLayerInfo.h
Go to the documentation of this file.
1 
12 #ifndef CSCTriggerPrimitives_CSCLayerInfo_H
13 #define CSCTriggerPrimitives_CSCLayerInfo_H
14 
15 #include <iomanip>
16 #include <vector>
19 
20 template <class TYPE>
21 class CSCLayerInfo {
22 public:
24  CSCLayerInfo();
25 
27  ~CSCLayerInfo();
28 
30  void clear();
31 
33  void setId(const CSCDetId id) { theLayerId = id; }
34 
36  void addComponent(const TYPE digi) { RecDigis.push_back(digi); }
37 
39  void addComponent(const PSimHit simHit) { SimHits.push_back(simHit); }
40 
42  CSCDetId getId() const { return theLayerId; }
43 
45  std::vector<TYPE> getRecDigis() const { return RecDigis; }
46 
48  std::vector<PSimHit> getSimHits() const { return SimHits; }
49 
50 private:
52  std::vector<TYPE> RecDigis;
53  std::vector<PSimHit> SimHits;
54 };
55 
56 template <class TYPE>
58  CSCDetId tmp; // nullify theLayerId.
59  theLayerId = tmp;
60  RecDigis.reserve(3); // we may have up to three RecDigis per layer.
61  SimHits.reserve(3);
62 }
63 
64 template <class TYPE>
66  clear();
67 }
68 
69 template <class TYPE>
71  CSCDetId tmp; // nullify theLayerId.
72  theLayerId = tmp;
73  // Use the trick from ORCA-days "CommonDet/DetUtilities/interface/reset.h"
74  // to delete the capacity of the vectors.
75  std::vector<TYPE> temp_digis;
76  std::vector<PSimHit> temp_hits;
77  RecDigis.swap(temp_digis);
78  SimHits.swap(temp_hits);
79 }
80 
81 // overloaded << operator
82 template <class TYPE>
83 std::ostream& operator<<(std::ostream& output, const CSCLayerInfo<TYPE>& info) {
84  std::vector<TYPE> thisLayerDigis = info.getRecDigis();
85  // vector<TYPE>::iterator prd; /* upsets pedantic compillation on LINUX */
86  if (thisLayerDigis.size() > 0) {
87  output << "Layer: " << std::setw(1) << info.getId().layer();
88  for (unsigned int i = 0; i < thisLayerDigis.size(); i++) {
89  output << " RecDigi # " << i + 1 << ": " << thisLayerDigis[i] << '\t';
90  }
91  }
92  std::vector<PSimHit> thisLayerHits = info.getSimHits();
93  if (!thisLayerHits.empty()) {
94  output << "Layer: " << std::setw(1) << info.getId().layer();
95  for (unsigned int i = 0; i < thisLayerHits.size(); i++) {
96  output << " SimHit # " << i + 1 << ": " << thisLayerHits[i] << '\t';
97  }
98  output << std::endl;
99  }
100  return output;
101 }
102 #endif // CSCTriggerPrimitives_CSCLayerInfo_H
CSCLayerInfo::getId
CSCDetId getId() const
Definition: CSCLayerInfo.h:42
mps_fire.i
i
Definition: mps_fire.py:428
CSCLayerInfo::clear
void clear()
Definition: CSCLayerInfo.h:70
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
CSCLayerInfo::CSCLayerInfo
CSCLayerInfo()
Definition: CSCLayerInfo.h:57
PSimHitContainer.h
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:153
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
CSCDetId.h
rpcPointValidation_cfi.simHit
simHit
Definition: rpcPointValidation_cfi.py:24
CSCLayerInfo::SimHits
std::vector< PSimHit > SimHits
Definition: CSCLayerInfo.h:53
operator<<
std::ostream & operator<<(std::ostream &output, const CSCLayerInfo< TYPE > &info)
Definition: CSCLayerInfo.h:83
CSCLayerInfo::setId
void setId(const CSCDetId id)
Definition: CSCLayerInfo.h:33
clear
void clear(HadCaloObj &c)
Definition: data.h:124
CSCDetId
Definition: CSCDetId.h:26
CSCLayerInfo::RecDigis
std::vector< TYPE > RecDigis
Definition: CSCLayerInfo.h:52
CSCLayerInfo::theLayerId
CSCDetId theLayerId
Definition: CSCLayerInfo.h:51
CSCLayerInfo::addComponent
void addComponent(const TYPE digi)
Definition: CSCLayerInfo.h:36
CSCLayerInfo::getRecDigis
std::vector< TYPE > getRecDigis() const
Definition: CSCLayerInfo.h:45
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
runonSM.TYPE
TYPE
Definition: runonSM.py:21
CSCLayerInfo::getSimHits
std::vector< PSimHit > getSimHits() const
Definition: CSCLayerInfo.h:48
CSCLayerInfo
Definition: CSCLayerInfo.h:21
CSCLayerInfo::addComponent
void addComponent(const PSimHit simHit)
Definition: CSCLayerInfo.h:39
PSimHit
Definition: PSimHit.h:15
CSCLayerInfo::~CSCLayerInfo
~CSCLayerInfo()
Definition: CSCLayerInfo.h:65