CMS 3D CMS Logo

ShallowClustersProducer.cc
Go to the documentation of this file.
2 
11 
13  : Prefix(iConfig.getParameter<std::string>("Prefix") )
14 {
15  produces <std::vector<unsigned> > ( Prefix + "number" );
16  produces <std::vector<unsigned> > ( Prefix + "width" );
17  produces <std::vector<float> > ( Prefix + "variance" );
18  produces <std::vector<float> > ( Prefix + "barystrip" );
19  produces <std::vector<float> > ( Prefix + "middlestrip" );
20  produces <std::vector<unsigned> > ( Prefix + "charge" );
21  produces <std::vector<float> > ( Prefix + "noise" );
22  produces <std::vector<float> > ( Prefix + "ston" );
23  produces <std::vector<unsigned> > ( Prefix + "seedstrip" );
24  produces <std::vector<unsigned> > ( Prefix + "seedindex" );
25  produces <std::vector<unsigned> > ( Prefix + "seedcharge" );
26  produces <std::vector<float> > ( Prefix + "seednoise" );
27  produces <std::vector<float> > ( Prefix + "seedgain" );
28  produces <std::vector<unsigned> > ( Prefix + "qualityisbad" );
29 
30  produces <std::vector<float> > ( Prefix + "rawchargeC" );
31  produces <std::vector<float> > ( Prefix + "rawchargeL" );
32  produces <std::vector<float> > ( Prefix + "rawchargeR" );
33  produces <std::vector<float> > ( Prefix + "rawchargeLL" );
34  produces <std::vector<float> > ( Prefix + "rawchargeRR" );
35  produces <std::vector<float> > ( Prefix + "eta" );
36  produces <std::vector<float> > ( Prefix + "foldedeta" );
37  produces <std::vector<float> > ( Prefix + "etaX" );
38  produces <std::vector<float> > ( Prefix + "etaasymm" );
39  produces <std::vector<float> > ( Prefix + "outsideasymm");
40  produces <std::vector<float> > ( Prefix + "neweta");
41  produces <std::vector<float> > ( Prefix + "newetaerr");
42 
43  produces <std::vector<unsigned> > ( Prefix + "detid" );
44  produces <std::vector<int> > ( Prefix + "subdetid" );
45  produces <std::vector<int> > ( Prefix + "module" );
46  produces <std::vector<int> > ( Prefix + "side" );
47  produces <std::vector<int> > ( Prefix + "layerwheel" );
48  produces <std::vector<int> > ( Prefix + "stringringrod" );
49  produces <std::vector<int> > ( Prefix + "petal" );
50  produces <std::vector<int> > ( Prefix + "stereo" );
51 
52  theClustersToken_ = consumes<edmNew::DetSetVector<SiStripCluster> > (iConfig.getParameter<edm::InputTag>("Clusters"));
53  theDigisToken_ = consumes<edm::DetSetVector<SiStripProcessedRawDigi> > (edm::InputTag("siStripProcessedRawDigis", ""));
54 }
55 
58  //Retrieve tracker topology from geometry
60  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
61  const TrackerTopology* const tTopo = tTopoHandle.product();
62 
63  auto number = std::make_unique<std::vector<unsigned>>(7,0);
64  auto width = std::make_unique<std::vector<unsigned>>();
65  auto variance = std::make_unique<std::vector<float>>();
66  auto barystrip = std::make_unique<std::vector<float>>();
67  auto middlestrip = std::make_unique<std::vector<float>>();
68  auto charge = std::make_unique<std::vector<unsigned>>();
69  auto noise = std::make_unique<std::vector<float>>();
70  auto ston = std::make_unique<std::vector<float>>();
71  auto seedstrip = std::make_unique<std::vector<unsigned>>();
72  auto seedindex = std::make_unique<std::vector<unsigned>>();
73  auto seedcharge = std::make_unique<std::vector<unsigned>>();
74  auto seednoise = std::make_unique<std::vector<float>>();
75  auto seedgain = std::make_unique<std::vector<float>>();
76  auto qualityisbad = std::make_unique<std::vector<unsigned>>();
77 
78  auto rawchargeC = std::make_unique<std::vector<float>>();
79  auto rawchargeL = std::make_unique<std::vector<float>>();
80  auto rawchargeR = std::make_unique<std::vector<float>>();
81  auto rawchargeLL = std::make_unique<std::vector<float>>();
82  auto rawchargeRR = std::make_unique<std::vector<float>>();
83  auto etaX = std::make_unique<std::vector<float>>();
84  auto eta = std::make_unique<std::vector<float>>();
85  auto foldedeta = std::make_unique<std::vector<float>>();
86  auto etaasymm = std::make_unique<std::vector<float>>();
87  auto outsideasymm = std::make_unique<std::vector<float>>();
88  auto neweta = std::make_unique<std::vector<float>>();
89  auto newetaerr = std::make_unique<std::vector<float>>();
90 
91  auto detid = std::make_unique<std::vector<unsigned>>();
92  auto subdetid = std::make_unique<std::vector<int>>();
93  auto side = std::make_unique<std::vector<int>>();
94  auto module = std::make_unique<std::vector<int>>();
95  auto layerwheel = std::make_unique<std::vector<int>>();
96  auto stringringrod = std::make_unique<std::vector<int>>();
97  auto petal = std::make_unique<std::vector<int>>();
98  auto stereo = std::make_unique<std::vector<int>>();
99 
101  // iEvent.getByLabel(theClustersLabel, clusters);
102  iEvent.getByToken(theClustersToken_, clusters);
103 
105  // iEvent.getByLabel("siStripProcessedRawDigis", "", rawProcessedDigis);
106  iEvent.getByToken(theDigisToken_,rawProcessedDigis);
107 
108  edmNew::DetSetVector<SiStripCluster>::const_iterator itClusters=clusters->begin();
109  for(;itClusters!=clusters->end();++itClusters){
110  uint32_t id = itClusters->id();
111  const moduleVars moduleV(id, tTopo);
112  for(edmNew::DetSet<SiStripCluster>::const_iterator cluster=itClusters->begin(); cluster!=itClusters->end();++cluster){
113 
114  const SiStripClusterInfo info(*cluster, iSetup, id);
115  const NearDigis digis = rawProcessedDigis.isValid() ? NearDigis(info, *rawProcessedDigis) : NearDigis(info);
116 
117  (number->at(0))++;
118  (number->at(moduleV.subdetid))++;
119  width->push_back( cluster->amplitudes().size() );
120  barystrip->push_back( cluster->barycenter() );
121  variance->push_back( info.variance() );
122  middlestrip->push_back( info.firstStrip() + info.width()/2.0 );
123  charge->push_back( info.charge() );
124  noise->push_back( info.noiseRescaledByGain() );
125  ston->push_back( info.signalOverNoise() );
126  seedstrip->push_back( info.maxStrip() );
127  seedindex->push_back( info.maxIndex() );
128  seedcharge->push_back( info.maxCharge() );
129  seednoise->push_back( info.stripNoisesRescaledByGain().at(info.maxIndex()) );
130  seedgain->push_back( info.stripGains().at(info.maxIndex()) );
131  qualityisbad->push_back( info.IsAnythingBad() );
132 
133  rawchargeC->push_back( digis.max );
134  rawchargeL->push_back( digis.left );
135  rawchargeR->push_back( digis.right );
136  rawchargeLL->push_back( digis.Lleft );
137  rawchargeRR->push_back( digis.Rright );
138  etaX->push_back( digis.etaX() );
139  eta->push_back( digis.eta() );
140  etaasymm->push_back( digis.etaasymm() );
141  outsideasymm->push_back( digis.outsideasymm() );
142  neweta->push_back( (digis.last-digis.first)/info.charge() );
143  newetaerr->push_back( (sqrt(digis.last+digis.first))/pow(info.charge(),1.5) );
144 
145  detid->push_back( id );
146  subdetid->push_back( moduleV.subdetid );
147  side->push_back( moduleV.side );
148  module->push_back( moduleV.module );
149  layerwheel->push_back( moduleV.layerwheel );
150  stringringrod->push_back( moduleV.stringringrod );
151  petal->push_back( moduleV.petal );
152  stereo->push_back( moduleV.stereo );
153  }
154  }
155 
156  iEvent.put(std::move(number), Prefix + "number" );
157  iEvent.put(std::move(width), Prefix + "width" );
158  iEvent.put(std::move(variance), Prefix + "variance" );
159  iEvent.put(std::move(barystrip), Prefix + "barystrip" );
160  iEvent.put(std::move(middlestrip), Prefix + "middlestrip" );
161  iEvent.put(std::move(charge), Prefix + "charge" );
162  iEvent.put(std::move(noise), Prefix + "noise" );
163  iEvent.put(std::move(ston), Prefix + "ston" );
164  iEvent.put(std::move(seedstrip), Prefix + "seedstrip" );
165  iEvent.put(std::move(seedindex), Prefix + "seedindex" );
166  iEvent.put(std::move(seedcharge), Prefix + "seedcharge" );
167  iEvent.put(std::move(seednoise), Prefix + "seednoise" );
168  iEvent.put(std::move(seedgain), Prefix + "seedgain" );
169  iEvent.put(std::move(qualityisbad),Prefix + "qualityisbad" );
170 
171  iEvent.put(std::move(rawchargeC), Prefix + "rawchargeC" );
172  iEvent.put(std::move(rawchargeL), Prefix + "rawchargeL" );
173  iEvent.put(std::move(rawchargeR), Prefix + "rawchargeR" );
174  iEvent.put(std::move(rawchargeLL), Prefix + "rawchargeLL" );
175  iEvent.put(std::move(rawchargeRR), Prefix + "rawchargeRR" );
176  iEvent.put(std::move(etaX), Prefix + "etaX" );
177  iEvent.put(std::move(eta), Prefix + "eta" );
178  iEvent.put(std::move(foldedeta), Prefix + "foldedeta" );
179  iEvent.put(std::move(etaasymm), Prefix + "etaasymm" );
180  iEvent.put(std::move(outsideasymm),Prefix + "outsideasymm" );
181  iEvent.put(std::move(neweta), Prefix + "neweta" );
182  iEvent.put(std::move(newetaerr), Prefix + "newetaerr" );
183 
184  iEvent.put(std::move(detid), Prefix + "detid" );
185  iEvent.put(std::move(subdetid), Prefix + "subdetid" );
186  iEvent.put(std::move(module), Prefix + "module" );
187  iEvent.put(std::move(side), Prefix + "side" );
188  iEvent.put(std::move(layerwheel), Prefix + "layerwheel" );
189  iEvent.put(std::move(stringringrod),Prefix + "stringringrod" );
190  iEvent.put(std::move(petal), Prefix + "petal" );
191  iEvent.put(std::move(stereo), Prefix + "stereo" );
192 
193 }
194 
197  max = info.maxCharge();
198  left = info.maxIndex() > uint16_t(0) ? info.stripCharges()[info.maxIndex()-1] : 0 ;
199  Lleft = info.maxIndex() > uint16_t(1) ? info.stripCharges()[info.maxIndex()-2] : 0 ;
200  right= unsigned(info.maxIndex()+1) < info.stripCharges().size() ? info.stripCharges()[info.maxIndex()+1] : 0 ;
201  Rright= unsigned(info.maxIndex()+2) < info.stripCharges().size() ? info.stripCharges()[info.maxIndex()+2] : 0 ;
202  first = info.stripCharges()[0];
203  last = info.stripCharges()[info.width()-1];
204 }
205 
208  edm::DetSetVector<SiStripProcessedRawDigi>::const_iterator digiframe = rawProcessedDigis.find(info.detId());
209  if( digiframe != rawProcessedDigis.end()) {
210  max = digiframe->data.at(info.maxStrip()).adc() ;
211  left = info.maxStrip() > uint16_t(0) ? digiframe->data.at(info.maxStrip()-1).adc() : 0 ;
212  Lleft = info.maxStrip() > uint16_t(1) ? digiframe->data.at(info.maxStrip()-2).adc() : 0 ;
213  right = unsigned(info.maxStrip()+1) < digiframe->data.size() ? digiframe->data.at(info.maxStrip()+1).adc() : 0 ;
214  Rright = unsigned(info.maxStrip()+2) < digiframe->data.size() ? digiframe->data.at(info.maxStrip()+2).adc() : 0 ;
215  first = digiframe->data.at(info.firstStrip()).adc();
216  last = digiframe->data.at(info.firstStrip()+info.width() - 1).adc();
217  } else {
218  *this = NearDigis(info);
219  }
220 }
221 
223 moduleVars(uint32_t detid, const TrackerTopology* tTopo) {
224  SiStripDetId subdet(detid);
225  subdetid = subdet.subDetector();
226  if( SiStripDetId::TIB == subdetid ) {
227 
228  module = tTopo->tibModule(detid);
229  side = tTopo->tibIsZMinusSide(detid)?-1:1;
230  layerwheel = tTopo->tibLayer(detid);
231  stringringrod = tTopo->tibString(detid);
232  stereo = tTopo->tibIsStereo(detid) ? 1 : 0;
233  } else
234  if( SiStripDetId::TID == subdetid ) {
235 
236  module = tTopo->tidModule(detid);
237  side = tTopo->tidIsZMinusSide(detid)?-1:1;
238  layerwheel = tTopo->tidWheel(detid);
239  stringringrod = tTopo->tidRing(detid);
240  stereo = tTopo->tidIsStereo(detid) ? 1 : 0;
241  } else
242  if( SiStripDetId::TOB == subdetid ) {
243 
244  module = tTopo->tobModule(detid);
245  side = tTopo->tobIsZMinusSide(detid)?-1:1;
246  layerwheel = tTopo->tobLayer(detid);
247  stringringrod = tTopo->tobRod(detid);
248  stereo = tTopo->tobIsStereo(detid) ? 1 : 0;
249  } else
250  if( SiStripDetId::TEC == subdetid ) {
251 
252  module = tTopo->tecModule(detid);
253  side = tTopo->tecIsZMinusSide(detid)?-1:1;
254  layerwheel = tTopo->tecWheel(detid);
255  stringringrod = tTopo->tecRing(detid);
256  petal = tTopo->tecPetalNumber(detid);
257  stereo = tTopo->tecIsStereo(detid) ? 1 : 0;
258  } else {
259  module = 0;
260  side = 0;
261  layerwheel=-1;
262  stringringrod = -1;
263  petal=-1;
264  }
265 }
uint8_t maxCharge() const
T getParameter(std::string const &) const
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator end(bool update=false) const
static const TGPicture * info(bool iBackgroundIsBlack)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
uint16_t firstStrip() const
iterator find(det_id_type id)
Definition: DetSetVector.h:290
unsigned int tibLayer(const DetId &id) const
unsigned int tibString(const DetId &id) const
unsigned int tidRing(const DetId &id) const
std::vector< float > stripGains() const
bool IsAnythingBad() const
bool tobIsStereo(const DetId &id) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
float noiseRescaledByGain() const
unsigned int tecRing(const DetId &id) const
ring id
ShallowClustersProducer(const edm::ParameterSet &)
unsigned int tidWheel(const DetId &id) const
float variance() const
data_type const * const_iterator
Definition: DetSetNew.h:30
uint16_t maxIndex() const
auto stripCharges() const -> decltype(cluster() ->amplitudes())
id_type id(size_t cell) const
moduleVars(uint32_t, const TrackerTopology *)
bool tecIsZMinusSide(const DetId &id) const
bool tidIsStereo(const DetId &id) const
bool tidIsZMinusSide(const DetId &id) const
bool tecIsStereo(const DetId &id) const
float signalOverNoise() const
int iEvent
Definition: GenABIO.cc:224
uint16_t charge() const
bool tibIsZMinusSide(const DetId &id) const
T sqrt(T t)
Definition: SSEVec.h:18
unsigned int tidModule(const DetId &id) const
bool tobIsZMinusSide(const DetId &id) const
uint16_t width() const
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
bool isValid() const
Definition: HandleBase.h:74
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:361
size_type size() const
Return the number of contained DetSets.
Definition: DetSetVector.h:283
unsigned int tibModule(const DetId &id) const
unsigned int tecModule(const DetId &id) const
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
SubDetector subDetector() const
Definition: SiStripDetId.h:102
uint16_t maxStrip() const
bool tibIsStereo(const DetId &id) const
void produce(edm::Event &, const edm::EventSetup &) override
unsigned int tobModule(const DetId &id) const
uint32_t detId() const
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > theClustersToken_
edm::EDGetTokenT< edm::DetSetVector< SiStripProcessedRawDigi > > theDigisToken_
T get() const
Definition: EventSetup.h:71
unsigned int tecPetalNumber(const DetId &id) const
unsigned int tobRod(const DetId &id) const
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:104
unsigned int tecWheel(const DetId &id) const
T const * product() const
Definition: ESHandle.h:86
Definition: vlib.h:208
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
def move(src, dest)
Definition: eostools.py:511
const_iterator begin(bool update=false) const
unsigned int tobLayer(const DetId &id) const
std::vector< float > stripNoisesRescaledByGain() const