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 
13 #include "boost/foreach.hpp"
14 
16  : theClustersLabel(iConfig.getParameter<edm::InputTag>("Clusters")),
17  Prefix(iConfig.getParameter<std::string>("Prefix") )
18 {
19  produces <std::vector<unsigned> > ( Prefix + "number" );
20  produces <std::vector<unsigned> > ( Prefix + "width" );
21  produces <std::vector<float> > ( Prefix + "variance" );
22  produces <std::vector<float> > ( Prefix + "barystrip" );
23  produces <std::vector<float> > ( Prefix + "middlestrip" );
24  produces <std::vector<unsigned> > ( Prefix + "charge" );
25  produces <std::vector<float> > ( Prefix + "noise" );
26  produces <std::vector<float> > ( Prefix + "ston" );
27  produces <std::vector<unsigned> > ( Prefix + "seedstrip" );
28  produces <std::vector<unsigned> > ( Prefix + "seedindex" );
29  produces <std::vector<unsigned> > ( Prefix + "seedcharge" );
30  produces <std::vector<float> > ( Prefix + "seednoise" );
31  produces <std::vector<float> > ( Prefix + "seedgain" );
32  produces <std::vector<unsigned> > ( Prefix + "qualityisbad" );
33 
34  produces <std::vector<float> > ( Prefix + "rawchargeC" );
35  produces <std::vector<float> > ( Prefix + "rawchargeL" );
36  produces <std::vector<float> > ( Prefix + "rawchargeR" );
37  produces <std::vector<float> > ( Prefix + "rawchargeLL" );
38  produces <std::vector<float> > ( Prefix + "rawchargeRR" );
39  produces <std::vector<float> > ( Prefix + "eta" );
40  produces <std::vector<float> > ( Prefix + "foldedeta" );
41  produces <std::vector<float> > ( Prefix + "etaX" );
42  produces <std::vector<float> > ( Prefix + "etaasymm" );
43  produces <std::vector<float> > ( Prefix + "outsideasymm");
44  produces <std::vector<float> > ( Prefix + "neweta");
45  produces <std::vector<float> > ( Prefix + "newetaerr");
46 
47  produces <std::vector<unsigned> > ( Prefix + "detid" );
48  produces <std::vector<int> > ( Prefix + "subdetid" );
49  produces <std::vector<int> > ( Prefix + "module" );
50  produces <std::vector<int> > ( Prefix + "side" );
51  produces <std::vector<int> > ( Prefix + "layerwheel" );
52  produces <std::vector<int> > ( Prefix + "stringringrod" );
53  produces <std::vector<int> > ( Prefix + "petal" );
54  produces <std::vector<int> > ( Prefix + "stereo" );
55 
56 }
57 
60  std::auto_ptr<std::vector<unsigned> > number ( new std::vector<unsigned>(7,0) );
61  std::auto_ptr<std::vector<unsigned> > width ( new std::vector<unsigned>() );
62  std::auto_ptr<std::vector<float> > variance ( new std::vector<float>() );
63  std::auto_ptr<std::vector<float> > barystrip ( new std::vector<float>() );
64  std::auto_ptr<std::vector<float> > middlestrip ( new std::vector<float>() );
65  std::auto_ptr<std::vector<unsigned> > charge ( new std::vector<unsigned>() );
66  std::auto_ptr<std::vector<float> > noise ( new std::vector<float>() );
67  std::auto_ptr<std::vector<float> > ston ( new std::vector<float>() );
68  std::auto_ptr<std::vector<unsigned> > seedstrip ( new std::vector<unsigned>() );
69  std::auto_ptr<std::vector<unsigned> > seedindex ( new std::vector<unsigned>() );
70  std::auto_ptr<std::vector<unsigned> > seedcharge ( new std::vector<unsigned>() );
71  std::auto_ptr<std::vector<float> > seednoise ( new std::vector<float>() );
72  std::auto_ptr<std::vector<float> > seedgain ( new std::vector<float>() );
73  std::auto_ptr<std::vector<unsigned> > qualityisbad ( new std::vector<unsigned>() );
74 
75  std::auto_ptr<std::vector<float> > rawchargeC ( new std::vector<float>() );
76  std::auto_ptr<std::vector<float> > rawchargeL ( new std::vector<float>() );
77  std::auto_ptr<std::vector<float> > rawchargeR ( new std::vector<float>() );
78  std::auto_ptr<std::vector<float> > rawchargeLL ( new std::vector<float>() );
79  std::auto_ptr<std::vector<float> > rawchargeRR ( new std::vector<float>() );
80  std::auto_ptr<std::vector<float> > etaX ( new std::vector<float>() );
81  std::auto_ptr<std::vector<float> > eta ( new std::vector<float>() );
82  std::auto_ptr<std::vector<float> > foldedeta ( new std::vector<float>() );
83  std::auto_ptr<std::vector<float> > etaasymm ( new std::vector<float>() );
84  std::auto_ptr<std::vector<float> > outsideasymm ( new std::vector<float>() );
85  std::auto_ptr<std::vector<float> > neweta ( new std::vector<float>() );
86  std::auto_ptr<std::vector<float> > newetaerr ( new std::vector<float>() );
87 
88  std::auto_ptr<std::vector<unsigned> > detid ( new std::vector<unsigned>() );
89  std::auto_ptr<std::vector<int> > subdetid ( new std::vector<int>() );
90  std::auto_ptr<std::vector<int> > side ( new std::vector<int>() );
91  std::auto_ptr<std::vector<int> > module ( new std::vector<int>() );
92  std::auto_ptr<std::vector<int> > layerwheel ( new std::vector<int>() );
93  std::auto_ptr<std::vector<int> > stringringrod ( new std::vector<int>() );
94  std::auto_ptr<std::vector<int> > petal ( new std::vector<int>() );
95  std::auto_ptr<std::vector<int> > stereo ( new std::vector<int>());
96 
98  iEvent.getByLabel(theClustersLabel, clusters);
99 
101  iEvent.getByLabel("siStripProcessedRawDigis", "", rawProcessedDigis);
102 
103  edmNew::DetSetVector<SiStripCluster>::const_iterator itClusters=clusters->begin();
104  for(;itClusters!=clusters->end();++itClusters){
105  uint32_t id = itClusters->id();
106  const moduleVars moduleV(id);
107  for(edmNew::DetSet<SiStripCluster>::const_iterator cluster=itClusters->begin(); cluster!=itClusters->end();++cluster){
108 
109  const SiStripClusterInfo info(*cluster, iSetup, id);
110  const NearDigis digis = rawProcessedDigis.isValid() ? NearDigis(info, *rawProcessedDigis) : NearDigis(info);
111 
112  (number->at(0))++;
113  (number->at(moduleV.subdetid))++;
114  width->push_back( cluster->amplitudes().size() );
115  barystrip->push_back( cluster->barycenter() );
116  variance->push_back( info.variance() );
117  middlestrip->push_back( info.firstStrip() + info.width()/2.0 );
118  charge->push_back( info.charge() );
119  noise->push_back( info.noiseRescaledByGain() );
120  ston->push_back( info.signalOverNoise() );
121  seedstrip->push_back( info.maxStrip() );
122  seedindex->push_back( info.maxIndex() );
123  seedcharge->push_back( info.maxCharge() );
124  seednoise->push_back( info.stripNoisesRescaledByGain().at(info.maxIndex()) );
125  seedgain->push_back( info.stripGains().at(info.maxIndex()) );
126  qualityisbad->push_back( info.IsAnythingBad() );
127 
128  rawchargeC->push_back( digis.max );
129  rawchargeL->push_back( digis.left );
130  rawchargeR->push_back( digis.right );
131  rawchargeLL->push_back( digis.Lleft );
132  rawchargeRR->push_back( digis.Rright );
133  etaX->push_back( digis.etaX() );
134  eta->push_back( digis.eta() );
135  etaasymm->push_back( digis.etaasymm() );
136  outsideasymm->push_back( digis.outsideasymm() );
137  neweta->push_back( (digis.last-digis.first)/info.charge() );
138  newetaerr->push_back( (sqrt(digis.last+digis.first))/pow(info.charge(),1.5) );
139 
140  detid->push_back( id );
141  subdetid->push_back( moduleV.subdetid );
142  side->push_back( moduleV.side );
143  module->push_back( moduleV.module );
144  layerwheel->push_back( moduleV.layerwheel );
145  stringringrod->push_back( moduleV.stringringrod );
146  petal->push_back( moduleV.petal );
147  stereo->push_back( moduleV.stereo );
148  }
149  }
150 
151  iEvent.put( number, Prefix + "number" );
152  iEvent.put( width, Prefix + "width" );
153  iEvent.put( variance, Prefix + "variance" );
154  iEvent.put( barystrip, Prefix + "barystrip" );
155  iEvent.put( middlestrip, Prefix + "middlestrip" );
156  iEvent.put( charge, Prefix + "charge" );
157  iEvent.put( noise, Prefix + "noise" );
158  iEvent.put( ston, Prefix + "ston" );
159  iEvent.put( seedstrip, Prefix + "seedstrip" );
160  iEvent.put( seedindex, Prefix + "seedindex" );
161  iEvent.put( seedcharge, Prefix + "seedcharge" );
162  iEvent.put( seednoise, Prefix + "seednoise" );
163  iEvent.put( seedgain, Prefix + "seedgain" );
164  iEvent.put( qualityisbad, Prefix + "qualityisbad" );
165 
166  iEvent.put( rawchargeC, Prefix + "rawchargeC" );
167  iEvent.put( rawchargeL, Prefix + "rawchargeL" );
168  iEvent.put( rawchargeR, Prefix + "rawchargeR" );
169  iEvent.put( rawchargeLL, Prefix + "rawchargeLL" );
170  iEvent.put( rawchargeRR, Prefix + "rawchargeRR" );
171  iEvent.put( etaX, Prefix + "etaX" );
172  iEvent.put( eta, Prefix + "eta" );
173  iEvent.put( foldedeta, Prefix + "foldedeta" );
174  iEvent.put( etaasymm, Prefix + "etaasymm" );
175  iEvent.put( outsideasymm, Prefix + "outsideasymm" );
176  iEvent.put( neweta, Prefix + "neweta" );
177  iEvent.put( newetaerr, Prefix + "newetaerr" );
178 
179  iEvent.put( detid, Prefix + "detid" );
180  iEvent.put( subdetid, Prefix + "subdetid" );
181  iEvent.put( module, Prefix + "module" );
182  iEvent.put( side, Prefix + "side" );
183  iEvent.put( layerwheel, Prefix + "layerwheel" );
184  iEvent.put( stringringrod, Prefix + "stringringrod" );
185  iEvent.put( petal, Prefix + "petal" );
186  iEvent.put( stereo, Prefix + "stereo" );
187 
188 }
189 
192  max = info.maxCharge();
193  left = info.maxIndex() > uint16_t(0) ? info.stripCharges().at(info.maxIndex()-1) : 0 ;
194  Lleft = info.maxIndex() > uint16_t(1) ? info.stripCharges().at(info.maxIndex()-2) : 0 ;
195  right= unsigned(info.maxIndex()+1) < info.stripCharges().size() ? info.stripCharges().at(info.maxIndex()+1) : 0 ;
196  Rright= unsigned(info.maxIndex()+2) < info.stripCharges().size() ? info.stripCharges().at(info.maxIndex()+2) : 0 ;
197  first = info.stripCharges().at(0);
198  last = info.stripCharges().at(info.width()-1);
199 }
200 
203  edm::DetSetVector<SiStripProcessedRawDigi>::const_iterator digiframe = rawProcessedDigis.find(info.detId());
204  if( digiframe != rawProcessedDigis.end()) {
205  max = digiframe->data.at(info.maxStrip()).adc() ;
206  left = info.maxStrip() > uint16_t(0) ? digiframe->data.at(info.maxStrip()-1).adc() : 0 ;
207  Lleft = info.maxStrip() > uint16_t(1) ? digiframe->data.at(info.maxStrip()-2).adc() : 0 ;
208  right = unsigned(info.maxStrip()+1) < digiframe->data.size() ? digiframe->data.at(info.maxStrip()+1).adc() : 0 ;
209  Rright = unsigned(info.maxStrip()+2) < digiframe->data.size() ? digiframe->data.at(info.maxStrip()+2).adc() : 0 ;
210  first = digiframe->data.at(info.firstStrip()).adc();
211  last = digiframe->data.at(info.firstStrip()+info.width() - 1).adc();
212  } else {
213  *this = NearDigis(info);
214  }
215 }
216 
218 moduleVars(uint32_t detid) {
219  SiStripDetId subdet(detid);
220  subdetid = subdet.subDetector();
221  if( SiStripDetId::TIB == subdetid ) {
222  TIBDetId tib(detid);
223  module = tib.module();
224  side = (tib.isZMinusSide())?-1:1;
225  layerwheel = tib.layer();
226  stringringrod = tib.stringNumber();
227  stereo = tib.isStereo() ? 1 : 0;
228  } else
229  if( SiStripDetId::TID == subdetid ) {
230  TIDDetId tid(detid);
231  module = tid.moduleNumber();
232  side = (tid.isZMinusSide())?-1:1;
233  layerwheel = tid.wheel();
234  stringringrod = tid.ringNumber();
235  stereo = tid.isStereo() ? 1 : 0;
236  } else
237  if( SiStripDetId::TOB == subdetid ) {
238  TOBDetId tob(detid);
239  module = tob.module();
240  side = (tob.isZMinusSide())?-1:1;
241  layerwheel = tob.layer();
242  stringringrod = tob.rodNumber();
243  stereo = tob.isStereo() ? 1 : 0;
244  } else
245  if( SiStripDetId::TEC == subdetid ) {
246  TECDetId tec(detid);
247  module = tec.module();
248  side = (tec.isZMinusSide())?-1:1;
249  layerwheel = tec.wheel();
250  stringringrod = tec.ringNumber();
251  petal = tec.petalNumber();
252  stereo = tec.isStereo() ? 1 : 0;
253  } else {
254  module = 0;
255  side = 0;
256  layerwheel=-1;
257  stringringrod = -1;
258  petal=-1;
259  }
260 }
int adc(sample_type sample)
get the ADC sample (12 bits)
uint8_t maxCharge() const
bool isZMinusSide() const
Definition: TIBDetId.h:79
unsigned int rodNumber() const
Definition: TOBDetId.h:77
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator begin() const
unsigned int petalNumber() const
Definition: TECDetId.h:94
uint16_t firstStrip() const
unsigned int stringNumber() const
Definition: TIBDetId.h:87
iterator find(det_id_type id)
Definition: DetSetVector.h:285
unsigned int layer() const
layer id
Definition: TOBDetId.h:39
std::vector< float > stripGains() const
bool IsAnythingBad() const
float noiseRescaledByGain() const
bool isStereo()
Definition: TIDDetId.h:109
ShallowClustersProducer(const edm::ParameterSet &)
unsigned int ringNumber() const
Definition: TIDDetId.h:97
float variance() const
data_type const * const_iterator
Definition: DetSetNew.h:25
T eta() const
uint16_t maxIndex() const
id_type id(size_t cell) const
double charge(const std::vector< uint8_t > &Ampls)
unsigned int module() const
det id
Definition: TECDetId.h:75
float signalOverNoise() const
bool isZMinusSide() const
Definition: TOBDetId.h:69
bool isZMinusSide() const
Definition: TECDetId.h:86
int iEvent
Definition: GenABIO.cc:243
uint16_t charge() 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:85
T sqrt(T t)
Definition: SSEVec.h:46
bool isStereo()
Definition: TECDetId.h:118
uint16_t width() const
const_iterator end() const
bool first
Definition: L1TdeRCT.cc:94
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:356
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
bool isStereo()
Definition: TOBDetId.h:89
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
SubDetector subDetector() const
Definition: SiStripDetId.h:114
bool isZMinusSide() const
Definition: TIDDetId.h:81
uint16_t maxStrip() const
unsigned int module() const
detector id
Definition: TIBDetId.h:61
unsigned int wheel() const
wheel id
Definition: TECDetId.h:52
unsigned int layer() const
layer id
Definition: TIBDetId.h:41
unsigned int ringNumber() const
Definition: TECDetId.h:98
uint32_t detId() const
const std::vector< uint8_t > & stripCharges() const
bool isStereo()
Definition: TIBDetId.h:107
unsigned int module() const
detector id
Definition: TOBDetId.h:58
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:106
unsigned int moduleNumber() const
Definition: TIDDetId.h:101
Definition: vlib.h:209
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
unsigned int wheel() const
wheel id
Definition: TIDDetId.h:50
std::vector< float > stripNoisesRescaledByGain() const