16 int iphi,
bool includeHO,
bool debug) {
20 std::cout <<
"matrixHCALIds::Add " << ieta <<
" rows and " << iphi
21 <<
" columns of cells for " << dets.size() <<
" cells" 30 for (
unsigned int i1=0; i1<vdetS.size(); i1++) {
31 if (
std::count(vdetN.begin(),vdetN.end(),vdetS[i1]) == 0)
32 vdetN.push_back(vdetS[i1]);
39 std::cout <<
"matrixHCALIds::Total number of cells found is " 40 << vdetS.size() << std::endl;
54 std::vector<DetId> dets, vdetx;
56 int ietaphi = (
int)(dR/15.0)+1;
58 ietaphi, includeHO, debug);
59 for (
unsigned int i=0;
i<vdets.size(); ++
i) {
63 vdetx.push_back(vdets[i]);
69 std::cout <<
"matrixHCALIds::Final List of cells for dR " << dR
70 <<
" is with " << vdetx.size() <<
" from original list of " 71 << vdets.size() <<
" cells" << std::endl;
80 int ietaW,
int iphiN,
int iphiS,
81 bool includeHO,
bool debug) {
85 std::cout <<
"matrixHCALIds::Add " <<ietaE <<
"|" <<ietaW <<
" rows and " 86 << iphiN <<
"|" << iphiS <<
" columns of cells for " 87 << dets.size() <<
" cells" << std::endl;
92 ietaW, iphiN, iphiS, debug);
94 ietaW, iphiN, iphiS, debug);
95 for (
unsigned int i1=0; i1<vdetS.size(); i1++) {
96 if (
std::count(vdetN.begin(),vdetN.end(),vdetS[i1]) == 0)
97 vdetN.push_back(vdetS[i1]);
104 std::cout <<
"matrixHCALIds::Total number of cells found is " 105 << vdetS.size() << std::endl;
114 int ieta,
int iphi,
bool debug) {
118 std::cout <<
"newHCALIdNS::Add " << iphi <<
" columns of cells along " 119 << shiftNorth <<
" for " << (dets.size()-
last) <<
" cells" 124 std::vector<DetId> vdets;
125 vdets.insert(vdets.end(), dets.begin(), dets.end());
126 std::vector<DetId> vdetE, vdetW;
130 for (
unsigned int i1=0; i1<vdetW.size(); i1++) {
131 if (
std::count(vdets.begin(),vdets.end(),vdetW[i1]) == 0)
132 vdets.push_back(vdetW[i1]);
134 for (
unsigned int i1=0; i1<vdetE.size(); i1++) {
135 if (
std::count(vdets.begin(),vdets.end(),vdetE[i1]) == 0)
136 vdets.push_back(vdetE[i1]);
140 std::cout <<
"newHCALIdNS::With Added cells along E/W results a set of " 141 << (vdets.size()-dets.size()) <<
" new cells" << std::endl;
146 unsigned int last0 = vdets.size();
148 std::vector<DetId> vdetnew;
149 for (
unsigned int i1=last; i1<dets.size(); i1++) {
150 std::vector<DetId> vdet;
151 if (shiftNorth) vdet = topology->
north(dets[i1]);
152 else vdet = topology->
south(dets[i1]);
153 for (
unsigned int i2=0; i2<vdet.size(); i2++) {
154 if (
std::count(vdets.begin(),vdets.end(),vdet[i2]) == 0)
155 vdetnew.push_back(vdet[i2]);
161 for (
unsigned int i2=0; i2<vdetW.size(); i2++) {
162 if (
std::count(vdets.begin(),vdets.end(),vdetW[i2]) == 0 &&
163 std::count(vdetnew.begin(),vdetnew.end(),vdetW[i2]) == 0)
164 vdets.push_back(vdetW[i2]);
166 for (
unsigned int i2=0; i2<vdetE.size(); i2++) {
167 if (
std::count(vdets.begin(),vdets.end(),vdetE[i2]) == 0 &&
168 std::count(vdetnew.begin(),vdetnew.end(),vdetE[i2]) == 0)
169 vdets.push_back(vdetE[i2]);
172 vdets.insert(vdets.end(), vdetnew.begin(), vdetnew.end());
175 std::cout <<
"newHCALIdNS::Addition results a set of " 176 << (vdets.size()-last0) <<
" new cells" << std::endl;
189 std::cout <<
"newHCALIdNS::Final list consists of " << vdets.size()
190 <<
" cells" << std::endl;
200 int ietaE,
int ietaW,
int iphiN,
int iphiS,
205 std::cout <<
"newHCALIdNS::Add " << iphiN <<
"|" << iphiS
206 <<
" columns of cells along " << shiftNorth <<
" for " 207 << (dets.size()-
last) <<
" cells" << std::endl;
211 std::vector<DetId> vdets;
212 vdets.insert(vdets.end(), dets.begin(), dets.end());
213 std::vector<DetId> vdetE, vdetW;
217 for (
unsigned int i1=0; i1<vdetW.size(); i1++) {
218 if (
std::count(vdets.begin(),vdets.end(),vdetW[i1]) == 0)
219 vdets.push_back(vdetW[i1]);
221 for (
unsigned int i1=0; i1<vdetE.size(); i1++) {
222 if (
std::count(vdets.begin(),vdets.end(),vdetE[i1]) == 0)
223 vdets.push_back(vdetE[i1]);
227 std::cout <<
"newHCALIdNS::With Added cells along E/W results a set of " 228 << (vdets.size()-dets.size()) <<
" new cells" << std::endl;
233 unsigned int last0 = vdets.size();
235 if (shiftNorth) iphi = iphiN;
237 std::vector<DetId> vdetnew;
238 for (
unsigned int i1=last; i1<dets.size(); i1++) {
239 std::vector<DetId> vdet;
240 if (shiftNorth) vdet = topology->
north(dets[i1]);
241 else vdet = topology->
south(dets[i1]);
242 for (
unsigned int i2=0; i2<vdet.size(); i2++) {
243 if (
std::count(vdets.begin(),vdets.end(),vdet[i2]) == 0)
244 vdetnew.push_back(vdet[i2]);
250 for (
unsigned int i2=0; i2<vdetW.size(); i2++) {
251 if (
std::count(vdets.begin(),vdets.end(),vdetW[i2]) == 0 &&
252 std::count(vdetnew.begin(),vdetnew.end(),vdetW[i2]) == 0)
253 vdets.push_back(vdetW[i2]);
255 for (
unsigned int i2=0; i2<vdetE.size(); i2++) {
256 if (
std::count(vdets.begin(),vdets.end(),vdetE[i2]) == 0 &&
257 std::count(vdetnew.begin(),vdetnew.end(),vdetE[i2]) == 0)
258 vdets.push_back(vdetE[i2]);
261 vdets.insert(vdets.end(), vdetnew.begin(), vdetnew.end());
264 std::cout <<
"newHCALIdNS::Addition results a set of " 265 << (vdets.size()-last0) <<
" new cells" << std::endl;
271 if (shiftNorth) iphiN = iphi;
281 std::cout <<
"newHCALIdNS::Final list consists of " << vdets.size()
282 <<
" cells" << std::endl;
292 int ieta,
bool debug) {
296 std::cout <<
"newHCALIdEW::Add " << ieta <<
" rows of cells along " 297 << shiftEast <<
" for " << (dets.size()-
last) <<
" cells" 302 std::vector<DetId> vdets;
303 vdets.insert(vdets.end(), dets.begin(), dets.end());
305 for (
unsigned int i1=last; i1<dets.size(); i1++) {
306 std::vector<DetId> vdet;
307 if (shiftEast) vdet = topology->
east(dets[i1]);
308 else vdet = topology->
west(dets[i1]);
309 for (
unsigned int i2=0; i2<vdet.size(); i2++) {
310 if (
std::count(vdets.begin(),vdets.end(),vdet[i2]) == 0)
311 vdets.push_back(vdet[i2]);
319 std::cout <<
"newHCALIdEW::Addition results a set of " 320 << (vdets.size()-dets.size()) <<
" new cells" << std::endl;
330 std::cout <<
"newHCALIdEW::Final list (EW) consists of " <<vdets.size()
331 <<
" cells" << std::endl;
341 int ietaE,
int ietaW,
bool debug) {
345 std::cout <<
"newHCALIdEW::Add " << ietaE <<
"|" << ietaW
346 <<
" rows of cells along " << shiftEast <<
" for " 347 << (dets.size()-
last) <<
" cells" << std::endl;
352 if (shiftEast) ieta = ietaE;
353 std::vector<DetId> vdets;
354 vdets.insert(vdets.end(), dets.begin(), dets.end());
356 for (
unsigned int i1=last; i1<dets.size(); i1++) {
357 std::vector<DetId> vdet;
358 if (shiftEast) vdet = topology->
east(dets[i1]);
359 else vdet = topology->
west(dets[i1]);
360 for (
unsigned int i2=0; i2<vdet.size(); i2++) {
361 if (
std::count(vdets.begin(),vdets.end(),vdet[i2]) == 0)
362 vdets.push_back(vdet[i2]);
367 if (shiftEast) ietaE = ieta;
372 std::cout <<
"newHCALIdEW::Addition results a set of " 373 << (vdets.size()-dets.size()) <<
" new cells" << std::endl;
383 std::cout <<
"newHCALIdEW::Final list (EW) consists of " <<vdets.size()
384 <<
" cells" << std::endl;
402 std::cout <<
"matrixHCALIdsDepth::Add cells with higher depths with HO" 403 <<
"Flag set to " << includeHO <<
" to existing " 404 << dets.size() <<
" cells" << std::endl;
408 std::vector<DetId> vdets(dets);
409 for (
unsigned int i1=0; i1<dets.size(); i1++) {
411 for (
int idepth = 0; idepth < 3; idepth++) {
412 std::vector<DetId> vUpDetId = topology->
up(vdet);
413 if (vUpDetId.size() != 0) {
414 if (includeHO || vUpDetId[0].subdetId() != (
int)(
HcalOuter)) {
415 int n =
std::count(vdets.begin(),vdets.end(),vUpDetId[0]);
419 <<
" " << vdet <<
" " 422 vdets.push_back(vUpDetId[0]);
432 std::cout <<
"matrixHCALIdsDepth::Final list contains " << vdets.size()
433 <<
" cells" << std::endl;
std::vector< DetId > newHCALIdNS(std::vector< DetId > &dets, unsigned int last, const HcalTopology *topology, bool shiftNorth, int ieta, int iphi, bool debug=false)
double getDistInPlaneTrackDir(const GlobalPoint &caloPoint, const GlobalVector &caloVector, const GlobalPoint &rechitPoint, bool debug=false)
CaloTopology const * topology(0)
virtual std::vector< DetId > south(const DetId &id) const
void debugHcalDets(unsigned int, std::vector< DetId > &)
virtual std::vector< DetId > west(const DetId &id) const
const GlobalPoint & getPosition(const DetId &id) const
Get the position of a given detector id.
virtual std::vector< DetId > north(const DetId &id) const
virtual std::vector< DetId > up(const DetId &id) const
std::vector< DetId > matrixHCALIdsDepth(std::vector< DetId > &dets, const HcalTopology *topology, bool includeHO=false, bool debug=false)
std::vector< DetId > matrixHCALIds(std::vector< DetId > &dets, const HcalTopology *topology, int ieta, int iphi, bool includeHO=false, bool debug=false)
virtual std::vector< DetId > east(const DetId &id) const
std::vector< DetId > newHCALIdEW(std::vector< DetId > &dets, unsigned int last, const HcalTopology *topology, bool shiftEast, int ieta, bool debug=false)