30 isMixBarrelwithEndcap = iConfig.
getParameter<
bool>(
"isMixBarrelwithEndcap");
31 RangeofLayersinBarrel = iConfig.
getParameter< std::vector<unsigned int> >(
"RangeofLayersinBarrel");
32 RangeofLayersinEndcap = iConfig.
getParameter< std::vector<unsigned int> >(
"RangeofLayersinEndcap");
33 isSpecialLayers = iConfig.
getParameter<
bool>(
"isSpecialLayers");
34 LayersinBarrel = iConfig.
getParameter< std::vector<unsigned int> >(
"LayersinBarrel");
35 LayersinEndcap = iConfig.
getParameter< std::vector<unsigned int> >(
"LayersinEndcap");
36 constrainedLayersinBarrel = iConfig.
getParameter< std::vector<unsigned int> >(
"constrainedLayersinBarrel");
45 recHitsinLayers[
i] = recHitsRPC[
i].
size();
58 RPCrecHitFinderRef =
Ref;
59 RPCCosmicrecHitFinderRef = CosmicRef;
66 if(isConfigured ==
false || isInputset ==
false || isOutputset ==
false) {
67 cout <<
"RPCSeedLayerFinder needs to be configured and set IO before running RPCSeedLayerFinder::fillLayers()" << endl;
75 if(isCosmic ==
true) {
76 if(RPCCosmicrecHitFinderRef !=
NULL)
79 cout <<
"RPCCosmicrecHitFinderRef not set" << endl;
82 if(RPCrecHitFinderRef !=
NULL)
85 cout <<
"RPCrecHitFinderRef not set" << endl;
91 if(isSpecialLayers ==
false && isMixBarrelwithEndcap ==
false) {
92 for(std::vector<unsigned int>::iterator NumberofLayersinBarrel = RangeofLayersinBarrel.begin(); NumberofLayersinBarrel != RangeofLayersinBarrel.end(); NumberofLayersinBarrel++) {
94 unsigned int NumberofLayers = *NumberofLayersinBarrel;
99 SpecialLayers(-1, NumberofLayers, type);
103 for(std::vector<unsigned int>::iterator NumberofLayersinEndcap = RangeofLayersinEndcap.begin(); NumberofLayersinEndcap != RangeofLayersinEndcap.end(); NumberofLayersinEndcap++) {
104 unsigned int NumberofLayers = *NumberofLayersinEndcap;
119 if(isSpecialLayers ==
true && isMixBarrelwithEndcap ==
false) {
121 bool EnoughforBarrel =
true;
124 for(std::vector<unsigned int>::iterator it = LayersinBarrel.begin(); it != LayersinBarrel.end(); it++, i++) {
126 if(recHitsinLayers[i] != 0)
127 LayersinRPC.push_back(i);
129 cout <<
"Not recHits in special Barrel layer " << i << endl;
130 EnoughforBarrel =
false;
134 if(EnoughforBarrel && (LayersinRPC.size() != 0)) {
136 RPCrecHitFinderRef->setLayers(LayersinRPC);
137 RPCrecHitFinderRef->fillrecHits();
142 bool EnoughforEndcap =
true;
146 EnoughforEndcap =
true;
148 for(std::vector<unsigned int>::iterator it = LayersinEndcap.begin(); it != LayersinEndcap.end(); it++, i++) {
150 if(recHitsinLayers[i] != 0)
151 LayersinRPC.push_back(i);
154 EnoughforEndcap =
false;
158 if(EnoughforEndcap && (LayersinRPC.size() != 0)) {
160 RPCrecHitFinderRef->setLayers(LayersinRPC);
161 RPCrecHitFinderRef->fillrecHits();
167 EnoughforEndcap =
true;
169 for(std::vector<unsigned int>::iterator it = LayersinEndcap.begin(); it != LayersinEndcap.end(); it++, i++) {
171 if(recHitsinLayers[i] != 0)
172 LayersinRPC.push_back(i);
174 cout <<
"Not recHits in special Endcap " << i << endl;
175 EnoughforEndcap =
false;
179 if(EnoughforEndcap && (LayersinRPC.size() != 0)) {
181 RPCrecHitFinderRef->setLayers(LayersinRPC);
182 RPCrecHitFinderRef->fillrecHits();
187 if(isMixBarrelwithEndcap ==
true) {
188 cout <<
" Mix is not ready for non-cosmic case" << endl;
196 if(isSpecialLayers ==
true && isMixBarrelwithEndcap ==
false) {
201 for(std::vector<unsigned int>::iterator it = LayersinBarrel.begin(); it != LayersinBarrel.end(); it++, i++) {
203 if(recHitsinLayers[i] != 0)
204 LayersinRPC.push_back(i);
206 if(LayersinRPC.size() != 0) {
208 RPCCosmicrecHitFinderRef->setLayers(LayersinRPC);
209 RPCCosmicrecHitFinderRef->fillrecHits();
218 for(std::vector<unsigned int>::iterator it = LayersinEndcap.begin(); it != LayersinEndcap.end(); it++, i++) {
220 if(recHitsinLayers[i] != 0)
221 LayersinRPC.push_back(i);
223 if(LayersinRPC.size() != 0) {
225 RPCCosmicrecHitFinderRef->setLayers(LayersinRPC);
226 RPCCosmicrecHitFinderRef->fillrecHits();
233 for(std::vector<unsigned int>::iterator it = LayersinEndcap.begin(); it != LayersinEndcap.end(); it++, i++) {
235 if(recHitsinLayers[i] != 0)
236 LayersinRPC.push_back(i);
238 if(LayersinRPC.size() != 0) {
240 RPCCosmicrecHitFinderRef->setLayers(LayersinRPC);
241 RPCCosmicrecHitFinderRef->fillrecHits();
246 if(isSpecialLayers ==
true && isMixBarrelwithEndcap ==
true) {
251 for(std::vector<unsigned int>::iterator it = LayersinBarrel.begin(); it != LayersinBarrel.end(); it++, i++) {
253 if(recHitsinLayers[i] != 0)
254 LayersinRPC.push_back(i);
257 for(std::vector<unsigned int>::iterator it = LayersinEndcap.begin(); it != LayersinEndcap.end(); it++, i++) {
259 if(recHitsinLayers[i] != 0)
260 LayersinRPC.push_back(i);
263 if(LayersinRPC.size() != 0) {
265 RPCCosmicrecHitFinderRef->setLayers(LayersinRPC);
266 RPCCosmicrecHitFinderRef->fillrecHits();
271 if(isSpecialLayers ==
false) {
272 cout <<
"Not ready for not SpecialLayers for Cosmic case" << endl;
284 cout <<
"NumberofLayers larger than max layers in barrel" << endl;
287 for(
unsigned int i = (last+1);
i <= (
BarrelLayerNumber-NumberofLayers+LayersinRPC.size());
i++) {
288 if(recHitsinLayers[
i] != 0) {
289 LayersinRPC.push_back(
i);
291 if(LayersinRPC.size() < NumberofLayers)
292 SpecialLayers(last, NumberofLayers, type);
294 if(checkConstrain()) {
295 cout <<
"Find special barrel layers: ";
296 for(
unsigned int k = 0;
k < NumberofLayers;
k++)
297 cout << LayersinRPC[
k] <<
" ";
300 RPCrecHitFinderRef->setLayers(LayersinRPC);
301 RPCrecHitFinderRef->fillrecHits();
304 cout <<
"The layers don't contain all layers in constrain" << endl;
306 LayersinRPC.pop_back();
314 cout <<
"NumberofLayers larger than max layers in endcap" << endl;
320 if(recHitsinLayers[
i] != 0) {
321 LayersinRPC.push_back(
i);
323 if(LayersinRPC.size() < NumberofLayers)
324 SpecialLayers(last, NumberofLayers, type);
326 cout <<
"Find special -Z endcap layers: ";
327 for(
unsigned int k = 0;
k < NumberofLayers;
k++)
328 cout << LayersinRPC[
k] <<
" ";
331 RPCrecHitFinderRef->setLayers(LayersinRPC);
332 RPCrecHitFinderRef->fillrecHits();
334 LayersinRPC.pop_back();
342 if(recHitsinLayers[
i] != 0) {
343 LayersinRPC.push_back(
i);
345 if(LayersinRPC.size() < NumberofLayers)
346 SpecialLayers(last, NumberofLayers, type);
348 cout <<
"Find special +Z endcap layers: ";
349 for(
unsigned int k = 0;
k < NumberofLayers;
k++)
350 cout << LayersinRPC[
k] <<
" ";
353 RPCrecHitFinderRef->setLayers(LayersinRPC);
354 RPCrecHitFinderRef->fillrecHits();
356 LayersinRPC.pop_back();
366 std::vector<unsigned int> fitConstrain = constrainedLayersinBarrel;
367 for(
unsigned int i = 0;
i < LayersinRPC.size();
i++)
368 fitConstrain[LayersinRPC[
i]] = 0;
370 if(fitConstrain[
i] != 0)
MuonTransientTrackingRecHit::MuonRecHitContainer MuonRecHitContainer
T getParameter(std::string const &) const
edm::Ref< Container > Ref
void configure(const edm::ParameterSet &iConfig)
void setInput(MuonRecHitContainer(&recHitsRPC)[12])
void setOutput(RPCSeedrecHitFinder *Ref, RPCCosmicSeedrecHitFinder *CosmicRef)
#define EachEndcapLayerNumber
#define BarrelLayerNumber
tuple size
Write out results.
void SpecialLayers(int last, unsigned int NumberofLayers, int type)