14 int iphi,
bool includeHO,
bool debug) {
17 std::cout <<
"matrixHCALIds::Add " << ieta <<
" rows and " << iphi
18 <<
" columns of cells for " << dets.size() <<
" cells"
27 for (
unsigned int i1=0; i1<vdetS.size(); i1++) {
28 if (
std::count(vdetN.begin(),vdetN.end(),vdetS[i1]) == 0)
29 vdetN.push_back(vdetS[i1]);
35 std::cout <<
"matrixHCALIds::Total number of cells found is "
36 << vdetS.size() << std::endl;
49 std::vector<DetId> dets, vdetx;
51 int ietaphi = (int)(dR/15.0)+1;
53 ietaphi, includeHO, debug);
54 for (
unsigned int i=0;
i<vdets.size(); ++
i) {
58 vdetx.push_back(vdets[i]);
63 std::cout <<
"matrixHCALIds::Final List of cells for dR " << dR
64 <<
" is with " << vdetx.size() <<
" from original list of "
65 << vdets.size() <<
" cells" << std::endl;
73 int ietaW,
int iphiN,
int iphiS,
74 bool includeHO,
bool debug) {
77 std::cout <<
"matrixHCALIds::Add " <<ietaE <<
"|" <<ietaW <<
" rows and "
78 << iphiN <<
"|" << iphiS <<
" columns of cells for "
79 << dets.size() <<
" cells" << std::endl;
84 ietaW, iphiN, iphiS, debug);
86 ietaW, iphiN, iphiS, debug);
87 for (
unsigned int i1=0; i1<vdetS.size(); i1++) {
88 if (
std::count(vdetN.begin(),vdetN.end(),vdetS[i1]) == 0)
89 vdetN.push_back(vdetS[i1]);
95 std::cout <<
"matrixHCALIds::Total number of cells found is "
96 << vdetS.size() << std::endl;
104 int ieta,
int iphi,
bool debug) {
107 std::cout <<
"newHCALIdNS::Add " << iphi <<
" columns of cells along "
108 << shiftNorth <<
" for " << (dets.size()-
last) <<
" cells"
113 std::vector<DetId> vdets;
114 vdets.insert(vdets.end(), dets.begin(), dets.end());
115 std::vector<DetId> vdetE, vdetW;
119 for (
unsigned int i1=0; i1<vdetW.size(); i1++) {
120 if (
std::count(vdets.begin(),vdets.end(),vdetW[i1]) == 0)
121 vdets.push_back(vdetW[i1]);
123 for (
unsigned int i1=0; i1<vdetE.size(); i1++) {
124 if (
std::count(vdets.begin(),vdets.end(),vdetE[i1]) == 0)
125 vdets.push_back(vdetE[i1]);
128 std::cout <<
"newHCALIdNS::With Added cells along E/W results a set of "
129 << (vdets.size()-dets.size()) <<
" new cells" << std::endl;
133 unsigned int last0 = vdets.size();
135 std::vector<DetId> vdetnew;
136 for (
unsigned int i1=last; i1<dets.size(); i1++) {
137 std::vector<DetId> vdet;
138 if (shiftNorth) vdet = topology->
north(dets[i1]);
139 else vdet = topology->
south(dets[i1]);
140 for (
unsigned int i2=0; i2<vdet.size(); i2++) {
141 if (
std::count(vdets.begin(),vdets.end(),vdet[i2]) == 0)
142 vdetnew.push_back(vdet[i2]);
148 for (
unsigned int i2=0; i2<vdetW.size(); i2++) {
149 if (
std::count(vdets.begin(),vdets.end(),vdetW[i2]) == 0 &&
150 std::count(vdetnew.begin(),vdetnew.end(),vdetW[i2]) == 0)
151 vdets.push_back(vdetW[i2]);
153 for (
unsigned int i2=0; i2<vdetE.size(); i2++) {
154 if (
std::count(vdets.begin(),vdets.end(),vdetE[i2]) == 0 &&
155 std::count(vdetnew.begin(),vdetnew.end(),vdetE[i2]) == 0)
156 vdets.push_back(vdetE[i2]);
159 vdets.insert(vdets.end(), vdetnew.begin(), vdetnew.end());
161 std::cout <<
"newHCALIdNS::Addition results a set of "
162 << (vdets.size()-last0) <<
" new cells" << std::endl;
173 std::cout <<
"newHCALIdNS::Final list consists of " << vdets.size()
174 <<
" cells" << std::endl;
183 int ietaE,
int ietaW,
int iphiN,
int iphiS,
187 std::cout <<
"newHCALIdNS::Add " << iphiN <<
"|" << iphiS
188 <<
" columns of cells along " << shiftNorth <<
" for "
189 << (dets.size()-
last) <<
" cells" << std::endl;
193 std::vector<DetId> vdets;
194 vdets.insert(vdets.end(), dets.begin(), dets.end());
195 std::vector<DetId> vdetE, vdetW;
199 for (
unsigned int i1=0; i1<vdetW.size(); i1++) {
200 if (
std::count(vdets.begin(),vdets.end(),vdetW[i1]) == 0)
201 vdets.push_back(vdetW[i1]);
203 for (
unsigned int i1=0; i1<vdetE.size(); i1++) {
204 if (
std::count(vdets.begin(),vdets.end(),vdetE[i1]) == 0)
205 vdets.push_back(vdetE[i1]);
208 std::cout <<
"newHCALIdNS::With Added cells along E/W results a set of "
209 << (vdets.size()-dets.size()) <<
" new cells" << std::endl;
213 unsigned int last0 = vdets.size();
215 if (shiftNorth) iphi = iphiN;
217 std::vector<DetId> vdetnew;
218 for (
unsigned int i1=last; i1<dets.size(); i1++) {
219 std::vector<DetId> vdet;
220 if (shiftNorth) vdet = topology->
north(dets[i1]);
221 else vdet = topology->
south(dets[i1]);
222 for (
unsigned int i2=0; i2<vdet.size(); i2++) {
223 if (
std::count(vdets.begin(),vdets.end(),vdet[i2]) == 0)
224 vdetnew.push_back(vdet[i2]);
230 for (
unsigned int i2=0; i2<vdetW.size(); i2++) {
231 if (
std::count(vdets.begin(),vdets.end(),vdetW[i2]) == 0 &&
232 std::count(vdetnew.begin(),vdetnew.end(),vdetW[i2]) == 0)
233 vdets.push_back(vdetW[i2]);
235 for (
unsigned int i2=0; i2<vdetE.size(); i2++) {
236 if (
std::count(vdets.begin(),vdets.end(),vdetE[i2]) == 0 &&
237 std::count(vdetnew.begin(),vdetnew.end(),vdetE[i2]) == 0)
238 vdets.push_back(vdetE[i2]);
241 vdets.insert(vdets.end(), vdetnew.begin(), vdetnew.end());
243 std::cout <<
"newHCALIdNS::Addition results a set of "
244 << (vdets.size()-last0) <<
" new cells" << std::endl;
249 if (shiftNorth) iphiN = iphi;
258 std::cout <<
"newHCALIdNS::Final list consists of " << vdets.size()
259 <<
" cells" << std::endl;
268 int ieta,
bool debug) {
271 std::cout <<
"newHCALIdEW::Add " << ieta <<
" rows of cells along "
272 << shiftEast <<
" for " << (dets.size()-
last) <<
" cells"
277 std::vector<DetId> vdets;
278 vdets.insert(vdets.end(), dets.begin(), dets.end());
280 for (
unsigned int i1=last; i1<dets.size(); i1++) {
281 std::vector<DetId> vdet;
282 if (shiftEast) vdet = topology->
east(dets[i1]);
283 else vdet = topology->
west(dets[i1]);
284 for (
unsigned int i2=0; i2<vdet.size(); i2++) {
285 if (
std::count(vdets.begin(),vdets.end(),vdet[i2]) == 0)
286 vdets.push_back(vdet[i2]);
293 std::cout <<
"newHCALIdEW::Addition results a set of "
294 << (vdets.size()-dets.size()) <<
" new cells" << std::endl;
303 std::cout <<
"newHCALIdEW::Final list (EW) consists of " <<vdets.size()
304 <<
" cells" << std::endl;
313 int ietaE,
int ietaW,
bool debug) {
316 std::cout <<
"newHCALIdEW::Add " << ietaE <<
"|" << ietaW
317 <<
" rows of cells along " << shiftEast <<
" for "
318 << (dets.size()-
last) <<
" cells" << std::endl;
323 if (shiftEast) ieta = ietaE;
324 std::vector<DetId> vdets;
325 vdets.insert(vdets.end(), dets.begin(), dets.end());
327 for (
unsigned int i1=last; i1<dets.size(); i1++) {
328 std::vector<DetId> vdet;
329 if (shiftEast) vdet = topology->
east(dets[i1]);
330 else vdet = topology->
west(dets[i1]);
331 for (
unsigned int i2=0; i2<vdet.size(); i2++) {
332 if (
std::count(vdets.begin(),vdets.end(),vdet[i2]) == 0)
333 vdets.push_back(vdet[i2]);
338 if (shiftEast) ietaE = ieta;
342 std::cout <<
"newHCALIdEW::Addition results a set of "
343 << (vdets.size()-dets.size()) <<
" new cells" << std::endl;
352 std::cout <<
"newHCALIdEW::Final list (EW) consists of " <<vdets.size()
353 <<
" cells" << std::endl;
362 bool includeHO,
bool debug) {
365 std::cout <<
"matrixHCALIdsDepth::Add cells with higher depths with HO"
366 <<
"Flag set to " << includeHO <<
" to existing "
367 << dets.size() <<
" cells" << std::endl;
371 std::vector<DetId> vdets(dets);
372 for (
unsigned int i1=0; i1<dets.size(); i1++) {
374 for (
int idepth = 0; idepth < 3; idepth++) {
375 std::vector<DetId> vUpDetId = topology->
up(vdet);
376 if (vUpDetId.size() != 0) {
377 if (includeHO || vUpDetId[0].subdetId() != (int)(
HcalOuter)) {
378 int n =
std::count(vdets.begin(),vdets.end(),vUpDetId[0]);
380 if (debug)
std::cout <<
"matrixHCALIdsDepth:: Depth " << idepth
381 <<
" " << vdet <<
" "
383 vdets.push_back(vUpDetId[0]);
392 std::cout <<
"matrixHCALIdsDepth::Final list contains " << vdets.size()
393 <<
" 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)
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)