All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
KIT.cc
Go to the documentation of this file.
1 #include "KIT.h"
2 
3 using namespace lcio ;
4 using namespace marlin ;
5 using namespace std;
6 using namespace IMPL;
7 using namespace EVENT;
8 using namespace UTIL;
9 
11 KIT::KIT() : Processor("KIT") {
12 
13  // modify processor description
14  _description = "KIT does whatever it does ..." ;
15 
16  registerProcessorParameter( "ECAL_Collection",
17  "Name of the CalorimeterHit Collection for ECAL ",
18  _Ecal_col,
19  std::string("ECAL"));
20 
21  registerProcessorParameter( "Core_Collection",
22  "Name of the Cluster Collection for Cores ",
24  std::string("CORE"));
25 
26  registerProcessorParameter( "Cleaning",
27  "To do the cleaning on hits or not ",
28  _ToClean,
29  std::string("YES"));
30  registerProcessorParameter( "TopologicalCut",
31  "At which number of neighbors to put the threshold, condition is < so you need to put N+1 ",
32  _CleanCut,
33  (int)5);
34 
35  registerProcessorParameter( "NumberOfLevels",
36  "Number of levels for central loop ",
37  _N,
38  (int)10);
39  vector<float> miipstep;
40  miipstep.push_back(0.1);
41  miipstep.push_back(1.5);
42  miipstep.push_back(2.5);
43  miipstep.push_back(4.0);
44  miipstep.push_back(6.0);
45  miipstep.push_back(9.0);
46  miipstep.push_back(16.0);
47  miipstep.push_back(26.0);
48  miipstep.push_back(41.0);
49  miipstep.push_back(65.0);
50 
51  registerProcessorParameter( "Levels",
52  "Levels for central loop in MIP ",
53  _miipstep,
54  miipstep);
55 
56  registerProcessorParameter( "MinHit0",
57  "Minimal Number of hits for ground level cluster ",
58  _MinHit0,
59  (int)4);
60 
61  registerProcessorParameter( "MinHitSplit",
62  "Minimal Number of hits for i-th level cluster ",
64  (int)2);
65 
66  registerProcessorParameter( "Rcut",
67  "Fluctuation suprresion cut",
68  _Rcut,
69  (double)0.4);
70  registerProcessorParameter( "Distcut",
71  "Square of distance cut for merging ",
72  _Distcut,
73  (double)35.0);
74  registerProcessorParameter( "Coscut",
75  "Cosine of the angle for merging ",
76  _Coscut,
77  (double)0.95);
78 
79 }
80 
81 
82 void KIT::init() {
83 
84  printParameters() ;
85  _nRun = 0 ;
86  _nEvt = 0 ;
87 }
88 
89 void KIT::processRunHeader( LCRunHeader* /*run*/) {
90 
91  _nRun++ ;
92 }
93 
94 void KIT::processEvent( LCEvent * evt ) {
95 
96  try{
97  LCCollection* colt = evt->getCollection(_Ecal_col.c_str()) ;
98  CellIDDecoder<CalorimeterHit> CDECAL(colt);
99  LCCollectionVec * clscol = new LCCollectionVec(LCIO::CLUSTER);
100  if( colt!=0)
101  {
102  unsigned int nelem=colt->getNumberOfElements();
103  // MAIN CONTAINER OF SHITS
104  vector<Superhit2*> calo[10];
105 
106  // creating all superhits
107  CreateAllShits2(colt,CDECAL,calo);
108 
109  // precalculation
110  TotalPrecalc2(calo,CDECAL,nelem,_CleanCut);
111 
112  // setting the parameters of the alghorithm
113  vector <PROTSEED2> prs2;
114  CoreCut2 Ccut;
115  Ccut.Rcut=_Rcut;
116  Ccut.Distcut=_Distcut;
117  Ccut.Coscut=_Coscut;
118  Ccut.MinHit0=(unsigned int) _MinHit0;
119  Ccut.MinHitSplit=(unsigned int) _MinHitSplit;
120  const unsigned int N=_N;
121  vector< vector<Tmpcl2*> > bbb(N);
122 
123  // finding cores.
124  if( _ToClean=="YES" || _ToClean=="yes")
125  {
126  // cout << " da koristim cat " << endl;
127  FindCores2(&(calo[4]), bbb , &prs2,_N,_miipstep,Ccut);
128  }else{
129  FindCores2(&(calo[0]), bbb , &prs2,_N,_miipstep,Ccut);
130  }
131 
132 
133  // writting out in LCIO
134 
135  for(unsigned int i=0;i<prs2.size();i++)
136  {
137  if(prs2[i].active==true)
138  {
139 
140  ClusterImpl * cluster = new ClusterImpl();
141 
142  for(unsigned int j=0;j<prs2[i].cl->hits.size();j++)
143  {
144  cluster->addHit( prs2[i].cl->hits[j]->chit,(float)1.0);
145  }
146 
147  cluster->setTypeBit(prs2[i].level);
148 
149  float position[3];
150  position[0]=(float)prs2[i].cl->getCenter()[0];
151  position[1]=(float)prs2[i].cl->getCenter()[1];
152  position[2]=(float)prs2[i].cl->getCenter()[2];
153 
154  float energy=(float)prs2[i].cl->getEnergy();
155 
156  cluster->setPosition(position);
157  cluster->setEnergy(energy);
158  clscol->addElement(cluster);
159  }
160  }
161 
162 
163  // for strong memory and nice dreams ..
164  for(unsigned int i=0;i<N;i++)
165  {
166  if( bbb[i].size()!=0)
167  for(unsigned int im=0;im<bbb[i].size();im++)
168  {
169  delete bbb[i][im];
170  }
171  }
172 
173  for(unsigned int im=0;im<2;im++)
174  {
175  if(calo[im].size()!=0)
176  for( unsigned int iij=0;iij<calo[im].size();iij++)
177  delete (calo[im])[iij];
178  }
179 
180  }
181 
182  evt->addCollection(clscol,_CoreCollection.c_str());
183 
184  }catch(DataNotAvailableException &e) {}
185 
186  _nEvt ++ ;
187 }
188 
189 
190 
191 void KIT::check( LCEvent * /*evt*/ ) {
192  // nothing to check here - could be used to fill checkplots in reconstruction processor
193 }
194 
195 
196 void KIT::end(){}
197 
198 
199 
virtual void check(LCEvent *evt)
Definition: KIT.cc:191
container for keeping the parameters of the core fineder together
Definition: KITutil.h:289
vector< float > _miipstep
Definition: KIT.h:98
virtual void processRunHeader(LCRunHeader *run)
Called for every run.
Definition: KIT.cc:89
int _N
Definition: KIT.h:97
unsigned int MinHitSplit
minimal number of hits in i-th level cluster to be accepted for splitting of the core ...
Definition: KITutil.h:309
Definition: KIT.h:55
KIT()
Definition: KIT.cc:11
std::string _CoreCollection
Definition: KIT.h:92
unsigned int MinHit0
minimal number of hits needed for 0-th level cluster to be accepted as a core candidate ...
Definition: KITutil.h:305
int _MinHit0
Definition: KIT.h:100
string _ToClean
Definition: KIT.h:94
void FindCores2(Shitvec2 *secal1, vector< Tmpclvec2 > &bbb, vector< PROTSEED2 > *prs2, unsigned int N, vector< float > miipstep, CoreCut2 Ccut)
Global EM core finding function , iput is vector of superhits, array of Tmpcl vectors bbb for interna...
Definition: KITutil.cc:286
double Distcut
distance cut for core merging
Definition: KITutil.h:297
double _Distcut
Definition: KIT.h:103
double _Rcut
Definition: KIT.h:102
KIT aKIT
Definition: KIT.cc:10
void TotalPrecalc2(vector< Superhit2 * > *calo, CellIDDecoder< CalorimeterHit > &id, unsigned int nelem, int Ncut)
Global precalculation function , iput is vector of superhits, ECAL decoder, number of hits...
Definition: KITutil.cc:29
virtual void init()
Called at the begin of the job before anything is read.
Definition: KIT.cc:82
double Coscut
angular cut for core merging (value of the cosine is stored not the angle!)
Definition: KITutil.h:301
int _CleanCut
Definition: KIT.h:95
virtual void processEvent(LCEvent *evt)
Called for every event - the working horse.
Definition: KIT.cc:94
static const float e
int _MinHitSplit
Definition: KIT.h:101
std::string _Ecal_col
Definition: KIT.h:91
std::vector< LCCollection * > LCCollectionVec
Definition: SiStripClus.h:55
double Rcut
fluctuation suppresion cut
Definition: KITutil.h:293
double _Coscut
Definition: KIT.h:104
virtual void end()
Called after data processing for clean up.
Definition: KIT.cc:196
int _nRun
Definition: KIT.h:88
int _nEvt
Definition: KIT.h:89
void CreateAllShits2(LCCollection *colt, CellIDDecoder< CalorimeterHit > &id, vector< Superhit2 * > *calo)
Creation of superhits, input is ECAL collection ,it&#39;s decoded and pointer to resulting container for ...
Definition: KITutil.cc:7