CMS 3D CMS Logo

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