24 isMixBarrelwithEndcap = iConfig.
getParameter<
bool>(
"isMixBarrelwithEndcap");
25 RangeofLayersinBarrel = iConfig.
getParameter<std::vector<unsigned int> >(
"RangeofLayersinBarrel");
26 RangeofLayersinEndcap = iConfig.
getParameter<std::vector<unsigned int> >(
"RangeofLayersinEndcap");
27 isSpecialLayers = iConfig.
getParameter<
bool>(
"isSpecialLayers");
28 LayersinBarrel = iConfig.
getParameter<std::vector<unsigned int> >(
"LayersinBarrel");
29 LayersinEndcap = iConfig.
getParameter<std::vector<unsigned int> >(
"LayersinEndcap");
30 constrainedLayersinBarrel = iConfig.
getParameter<std::vector<unsigned int> >(
"constrainedLayersinBarrel");
38 recHitsinLayers[
i] = recHitsRPC[
i].
size();
47 RPCrecHitFinderRef =
Ref;
48 RPCCosmicrecHitFinderRef = CosmicRef;
54 if (isConfigured ==
false || isInputset ==
false || isOutputset ==
false) {
55 cout <<
"RPCSeedLayerFinder needs to be configured and set IO before running RPCSeedLayerFinder::fillLayers()" 64 if (isCosmic ==
true) {
65 if (RPCCosmicrecHitFinderRef !=
nullptr)
68 cout <<
"RPCCosmicrecHitFinderRef not set" << endl;
70 if (RPCrecHitFinderRef !=
nullptr)
73 cout <<
"RPCrecHitFinderRef not set" << endl;
78 if (isSpecialLayers ==
false && isMixBarrelwithEndcap ==
false) {
79 for (std::vector<unsigned int>::iterator NumberofLayersinBarrel = RangeofLayersinBarrel.begin();
80 NumberofLayersinBarrel != RangeofLayersinBarrel.end();
81 NumberofLayersinBarrel++) {
83 unsigned int NumberofLayers = *NumberofLayersinBarrel;
88 SpecialLayers(-1, NumberofLayers, type);
92 for (std::vector<unsigned int>::iterator NumberofLayersinEndcap = RangeofLayersinEndcap.begin();
93 NumberofLayersinEndcap != RangeofLayersinEndcap.end();
94 NumberofLayersinEndcap++) {
95 unsigned int NumberofLayers = *NumberofLayersinEndcap;
105 SpecialLayers(
BarrelLayerNumber + EachEndcapLayerNumber - 1, NumberofLayers, type);
110 if (isSpecialLayers ==
true && isMixBarrelwithEndcap ==
false) {
112 bool EnoughforBarrel =
true;
115 for (std::vector<unsigned int>::iterator it = LayersinBarrel.begin(); it != LayersinBarrel.end(); it++, i++) {
117 if (recHitsinLayers[i] != 0)
118 LayersinRPC.push_back(i);
120 cout <<
"Not recHits in special Barrel layer " << i << endl;
121 EnoughforBarrel =
false;
125 if (EnoughforBarrel && (!LayersinRPC.empty())) {
127 RPCrecHitFinderRef->setLayers(LayersinRPC);
128 RPCrecHitFinderRef->fillrecHits();
133 bool EnoughforEndcap =
true;
137 EnoughforEndcap =
true;
139 for (std::vector<unsigned int>::iterator it = LayersinEndcap.begin(); it != LayersinEndcap.end(); it++, i++) {
141 if (recHitsinLayers[i] != 0)
142 LayersinRPC.push_back(i);
145 EnoughforEndcap =
false;
149 if (EnoughforEndcap && (!LayersinRPC.empty())) {
151 RPCrecHitFinderRef->setLayers(LayersinRPC);
152 RPCrecHitFinderRef->fillrecHits();
158 EnoughforEndcap =
true;
160 for (std::vector<unsigned int>::iterator it = LayersinEndcap.begin(); it != LayersinEndcap.end(); it++, i++) {
163 if (recHitsinLayers[i] != 0)
164 LayersinRPC.push_back(i);
166 cout <<
"Not recHits in special Endcap " << i << endl;
167 EnoughforEndcap =
false;
171 if (EnoughforEndcap && (!LayersinRPC.empty())) {
173 RPCrecHitFinderRef->setLayers(LayersinRPC);
174 RPCrecHitFinderRef->fillrecHits();
179 if (isMixBarrelwithEndcap ==
true) {
180 cout <<
" Mix is not ready for non-cosmic case" << endl;
187 if (isSpecialLayers ==
true && isMixBarrelwithEndcap ==
false) {
191 for (std::vector<unsigned int>::iterator it = LayersinBarrel.begin(); it != LayersinBarrel.end(); it++, i++) {
193 if (recHitsinLayers[i] != 0)
194 LayersinRPC.push_back(i);
196 if (!LayersinRPC.empty()) {
198 RPCCosmicrecHitFinderRef->setLayers(LayersinRPC);
199 RPCCosmicrecHitFinderRef->fillrecHits();
208 for (std::vector<unsigned int>::iterator it = LayersinEndcap.begin(); it != LayersinEndcap.end(); it++, i++) {
210 if (recHitsinLayers[i] != 0)
211 LayersinRPC.push_back(i);
213 if (!LayersinRPC.empty()) {
215 RPCCosmicrecHitFinderRef->setLayers(LayersinRPC);
216 RPCCosmicrecHitFinderRef->fillrecHits();
223 for (std::vector<unsigned int>::iterator it = LayersinEndcap.begin(); it != LayersinEndcap.end(); it++, i++) {
226 if (recHitsinLayers[i] != 0)
227 LayersinRPC.push_back(i);
229 if (!LayersinRPC.empty()) {
231 RPCCosmicrecHitFinderRef->setLayers(LayersinRPC);
232 RPCCosmicrecHitFinderRef->fillrecHits();
237 if (isSpecialLayers ==
true && isMixBarrelwithEndcap ==
true) {
241 for (std::vector<unsigned int>::iterator it = LayersinBarrel.begin(); it != LayersinBarrel.end(); it++, i++) {
243 if (recHitsinLayers[i] != 0)
244 LayersinRPC.push_back(i);
247 for (std::vector<unsigned int>::iterator it = LayersinEndcap.begin(); it != LayersinEndcap.end(); it++, i++) {
249 if (recHitsinLayers[i] != 0)
250 LayersinRPC.push_back(i);
253 if (!LayersinRPC.empty()) {
255 RPCCosmicrecHitFinderRef->setLayers(LayersinRPC);
256 RPCCosmicrecHitFinderRef->fillrecHits();
261 if (isSpecialLayers ==
false) {
262 cout <<
"Not ready for not SpecialLayers for Cosmic case" << endl;
273 cout <<
"NumberofLayers larger than max layers in barrel" << endl;
276 for (
unsigned int i = (last + 1);
i <= (
BarrelLayerNumber - NumberofLayers + LayersinRPC.size());
i++) {
277 if (recHitsinLayers[
i] != 0) {
278 LayersinRPC.push_back(
i);
280 if (LayersinRPC.size() < NumberofLayers)
281 SpecialLayers(last, NumberofLayers, type);
283 if (checkConstrain()) {
284 cout <<
"Find special barrel layers: ";
285 for (
unsigned int k = 0;
k < NumberofLayers;
k++)
286 cout << LayersinRPC[
k] <<
" ";
289 RPCrecHitFinderRef->setLayers(LayersinRPC);
290 RPCrecHitFinderRef->fillrecHits();
292 cout <<
"The layers don't contain all layers in constrain" << endl;
294 LayersinRPC.pop_back();
302 cout <<
"NumberofLayers larger than max layers in endcap" << endl;
308 for (
unsigned int i = (last + 1);
311 if (recHitsinLayers[
i] != 0) {
312 LayersinRPC.push_back(
i);
314 if (LayersinRPC.size() < NumberofLayers)
315 SpecialLayers(last, NumberofLayers, type);
317 cout <<
"Find special -Z endcap layers: ";
318 for (
unsigned int k = 0;
k < NumberofLayers;
k++)
319 cout << LayersinRPC[
k] <<
" ";
322 RPCrecHitFinderRef->setLayers(LayersinRPC);
323 RPCrecHitFinderRef->fillrecHits();
325 LayersinRPC.pop_back();
330 for (
unsigned int i = (last + 1);
333 if (recHitsinLayers[
i] != 0) {
334 LayersinRPC.push_back(
i);
336 if (LayersinRPC.size() < NumberofLayers)
337 SpecialLayers(last, NumberofLayers, type);
339 cout <<
"Find special +Z endcap layers: ";
340 for (
unsigned int k = 0;
k < NumberofLayers;
k++)
341 cout << LayersinRPC[
k] <<
" ";
344 RPCrecHitFinderRef->setLayers(LayersinRPC);
345 RPCrecHitFinderRef->fillrecHits();
347 LayersinRPC.pop_back();
356 std::vector<unsigned int> fitConstrain = constrainedLayersinBarrel;
357 for (
unsigned int i = 0;
i < LayersinRPC.size();
i++)
358 fitConstrain[LayersinRPC[
i]] = 0;
360 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
void SpecialLayers(int last, unsigned int NumberofLayers, int type)