1 #ifndef SequentialCombinationGenerator_H 2 #define SequentialCombinationGenerator_H 45 if (newcomb.empty()) {
50 for (
int j=0;j<
the_k;j++)
69 for (
int i=0;
i<
n;cold.push_back(++
i));
73 if (k==1)
return empty;
76 Vecint cold1(cold.begin()+p[0],cold.end());
78 Partition
p1(p.begin()+1,p.end());
81 copy(cnew1.begin(),cnew1.end(),cnew.begin()+p[0]);
84 Vecint cold2(cold.begin(),cold.begin()+p[0]);
86 sort(cold.begin(),cold.end());
87 sort(cold2.begin(),cold2.end());
89 if (cnew2.empty())
return empty;
90 copy(cnew2.begin(),cnew2.begin()+p[0],cnew.begin());
92 set_difference(cold.begin(),cold.end(),
93 cnew2.begin(),cnew2.end(),ss.begin());
95 for (
int i=1;
i<
k;
i++) {
97 copy(ss.begin(),ss.end(),&cnew[ip]);
100 int mincnew2=cnew2[0];
101 if (ss[n1-1]<mincnew2)
return empty;
102 Vecint::iterator j1=find_if(ss.begin(),ss.end(), [&](
auto c) {
return c > mincnew2;});
103 if (ss.end()-j1 < p[
i])
return empty;
104 Vecint sss(j1,ss.end());
105 for (
int j=0;j<p[
i];j++){cnew[ip+j]=cnew2[j]=sss[j];}
106 int n2=ss.size()-cnew2.size();
107 if (n2==0)
return cnew;
109 set_difference(ss.begin(),ss.end(),cnew2.begin(),cnew2.end(),s.begin());
125 typename Vecint::iterator ind;
126 for (
int i=k-1;
i>=0;
i--) {
132 Vecint::iterator
g2 = g.begin();
Vecint next_subset(const Vecint &_g, const Vecint &_c)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
SequentialPartitionGenerator::Partition Partition
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
void vecprint(const Vecint &v) const
Combination next_combination(Collection &coll)
std::vector< Collection > Combination
std::vector< int > Vecint
std::vector< int > Partition
SequentialCombinationGenerator(Partition &part)
Vecint next_combi(Vecint &cold, int n, const Partition &p)
std::vector< T > Collection