| 14 |
#include <CaloLevel1.h> |
#include <CaloLevel1.h> |
| 15 |
#include <CaloLevel2.h> |
#include <CaloLevel2.h> |
| 16 |
|
|
| 17 |
//#include <ExtTrack.h> |
#include <ExtTrack.h> |
| 18 |
|
|
| 19 |
// ROOT classes |
// ROOT classes |
| 20 |
#include <TClonesArray.h> |
#include <TClonesArray.h> |
| 26 |
#include <iostream> |
#include <iostream> |
| 27 |
#include <iomanip> |
#include <iomanip> |
| 28 |
|
|
| 29 |
|
|
| 30 |
|
#define nCP 22; |
| 31 |
|
#define nCV 2; |
| 32 |
|
#define nCS 9; |
| 33 |
|
|
| 34 |
|
// relative to pamela reference system (convenzione emiliano): |
| 35 |
|
// |
| 36 |
|
// y ^ |
| 37 |
|
// | |
| 38 |
|
// | 6 7 8 sisensor |
| 39 |
|
// | 3 4 5 |
| 40 |
|
// | 0 1 2 |
| 41 |
|
// ------------> x |
| 42 |
|
// |
| 43 |
|
// relative to silicon sensor |
| 44 |
|
// |
| 45 |
|
// S ^ |
| 46 |
|
// | | |
| 47 |
|
// 2 | | <- strip direction |
| 48 |
|
// sensor 1 | | |
| 49 |
|
// 0 |...|... |
| 50 |
|
// ------------> L |
| 51 |
|
// 0 1 2 |
| 52 |
|
// ladder |
| 53 |
|
// |
| 54 |
|
// |
| 55 |
|
|
| 56 |
|
int GetCaloSensor(int view, int sis){ |
| 57 |
|
if(sis<0||sis>8)return -1; |
| 58 |
|
if(view<0||view>1)return -1; |
| 59 |
|
if(!view)return (int)(sis/3); |
| 60 |
|
else return sis%3; |
| 61 |
|
}; |
| 62 |
|
int GetCaloLadder(int view, int sis){ |
| 63 |
|
if(sis<0||sis>8)return -1; |
| 64 |
|
if(view<0||view>1)return -1; |
| 65 |
|
if(!view)return sis%3; |
| 66 |
|
else return (int)(sis/3); |
| 67 |
|
}; |
| 68 |
|
int GetCaloLadder(int strip){ |
| 69 |
|
return (int)(strip/32); |
| 70 |
|
}; |
| 71 |
|
int GetCaloSiSensor(int view, int l, int s){ |
| 72 |
|
if(view<0||view>1)return -1; |
| 73 |
|
if(s<0||s>2)return -1; |
| 74 |
|
if(!view) return 3*s+l; |
| 75 |
|
else return 3*l+s; |
| 76 |
|
}; |
| 77 |
|
|
| 78 |
|
/** |
| 79 |
|
* |
| 80 |
|
* Extended CaloStrip class, to account for rototraslation parameters |
| 81 |
|
* |
| 82 |
|
*/ |
| 83 |
|
class CaloStripRoto { |
| 84 |
|
|
| 85 |
|
private: |
| 86 |
|
|
| 87 |
|
float fPitch; // = 1.; |
| 88 |
|
float shift[3]; //= {0.,0.,0.};//(L,S,Z) |
| 89 |
|
float alpha;// = 0.; |
| 90 |
|
|
| 91 |
|
int siSensor; // 0-8 |
| 92 |
|
int sView;//0-1 |
| 93 |
|
int sPlane;//0-21 |
| 94 |
|
CaloStrip st; |
| 95 |
|
|
| 96 |
|
void Set(int view, int plane, float strip, int sisensor); ///< Set strip giving view [0-1], plane [0-22] and number [0-95] |
| 97 |
|
void SetSiSensor( int si=-1 ){ siSensor = si;}; |
| 98 |
|
void SetView(int view){sView = view;}; |
| 99 |
|
void SetPlane(int plane){sPlane = plane;}; |
| 100 |
|
|
| 101 |
|
public: |
| 102 |
|
|
| 103 |
|
/* CaloStrip st; */ |
| 104 |
|
|
| 105 |
|
|
| 106 |
|
float fXA; //< X position in cm of the strip |
| 107 |
|
float fYA; //< Y position in cm of the strip |
| 108 |
|
float fZA; //< Z position in cm of the strip |
| 109 |
|
|
| 110 |
|
float fXB; //< X position in cm of the strip |
| 111 |
|
float fYB; //< Y position in cm of the strip |
| 112 |
|
float fZB; //< Z position in cm of the strip |
| 113 |
|
|
| 114 |
|
// |
| 115 |
|
CaloStripRoto(int view, int plane, int sisensor, bool usemechanicalalignement = true); ///< Default Constructor. |
| 116 |
|
|
| 117 |
|
|
| 118 |
|
|
| 119 |
|
void ResetAligParams(); |
| 120 |
|
void SetAligParams__fPitch( float f ){ fPitch = f; }; |
| 121 |
|
void SetAligParams__shift( float *s ){ for(int i=0; i<3; i++)shift[i]=s[i]; }; |
| 122 |
|
void SetAligParams__alpha( float a ){ alpha = a; }; |
| 123 |
|
|
| 124 |
|
void SetStrip(float strip){Set(GetView(),GetPlane(),strip,GetSiSensor());}; ///< Set strip giving view [0-1], plane [0-22] and number [0-95] |
| 125 |
|
|
| 126 |
|
|
| 127 |
|
|
| 128 |
|
/* int GetSensor(int view, int sisensor); */ |
| 129 |
|
/* int GetLadder(int view, int sisensor); */ |
| 130 |
|
/* int GetSiSensor(int view, int ladder, int sensor); */ |
| 131 |
|
// CaloStrip GetCaloStrip(){return st;}; |
| 132 |
|
bool SensorContains(float x, float y); |
| 133 |
|
|
| 134 |
|
int GetView(){return sView;}; |
| 135 |
|
int GetPlane(){return sPlane;}; |
| 136 |
|
int GetStrip(){return st.GetStrip();}; |
| 137 |
|
int GetSensor(); |
| 138 |
|
int GetLadder(); |
| 139 |
|
int GetSiSensor(){ return siSensor; }; |
| 140 |
|
|
| 141 |
|
float GetSpatialResolution(float def, float degx=0., float degy=0., float beta=1.); |
| 142 |
|
|
| 143 |
|
float GetDistanceTo(float xP, float yP, float& xM, float &yM); |
| 144 |
|
float GetDistanceTo(float xP, float yP){ float xM,yM; return GetDistanceTo(xP,yP,xM,yM); }; |
| 145 |
|
|
| 146 |
|
}; |
| 147 |
|
|
| 148 |
|
|
| 149 |
|
/** |
| 150 |
|
* |
| 151 |
|
* Extended hit class |
| 152 |
|
* |
| 153 |
|
*/ |
| 154 |
|
|
| 155 |
|
|
| 156 |
|
class ExtHit{ |
| 157 |
|
|
| 158 |
|
private: |
| 159 |
|
|
| 160 |
|
|
| 161 |
|
public: |
| 162 |
|
|
| 163 |
|
|
| 164 |
|
Float_t coordCm; //centimeters |
| 165 |
|
Float_t coordPU; //pitch units |
| 166 |
|
Float_t resCm; |
| 167 |
|
Float_t signal; |
| 168 |
|
Int_t start; |
| 169 |
|
Int_t mult; |
| 170 |
|
Int_t view; |
| 171 |
|
|
| 172 |
|
|
| 173 |
|
void Reset(){ |
| 174 |
|
coordCm = 1000.; |
| 175 |
|
coordPU = 1000.; |
| 176 |
|
resCm = 1000.; |
| 177 |
|
signal = 0.; |
| 178 |
|
start = -1; |
| 179 |
|
mult = 0; |
| 180 |
|
view = -1; |
| 181 |
|
}; |
| 182 |
|
void Set(int s, int v){start=s; view=v;} |
| 183 |
|
/* void Set(int s, int v){coordPU=s; view=v;} */ |
| 184 |
|
|
| 185 |
|
ExtHit(){Reset();}; |
| 186 |
|
ExtHit(int s, int v){Reset(); Set(s,v); }; |
| 187 |
|
~ExtHit(){Reset();}; |
| 188 |
|
|
| 189 |
|
ExtHit( const ExtHit& h ){ |
| 190 |
|
coordCm = h.coordCm; |
| 191 |
|
coordPU = h.coordPU; |
| 192 |
|
resCm = h.resCm; |
| 193 |
|
signal = h.signal; |
| 194 |
|
start = h.start; |
| 195 |
|
mult = h.mult; |
| 196 |
|
view = h.view; |
| 197 |
|
} |
| 198 |
|
|
| 199 |
|
void Add(float cc, float pp, float ss){ |
| 200 |
|
if(ss<0)cout << "void ExtHit(cc="<<cc<<",ss="<<ss<<") -- not valid argument"; |
| 201 |
|
if(ss<0)return; |
| 202 |
|
mult++; |
| 203 |
|
float sumcc = coordCm * signal; |
| 204 |
|
float sumpp = coordPU * signal; |
| 205 |
|
signal+=ss; |
| 206 |
|
sumcc += ss * cc; |
| 207 |
|
sumpp += ss * pp; |
| 208 |
|
coordCm = sumcc/signal; |
| 209 |
|
coordPU = sumpp/signal; |
| 210 |
|
}; |
| 211 |
|
|
| 212 |
|
void Dump(){ |
| 213 |
|
cout << " View "<<view<<endl; |
| 214 |
|
cout << " Coordinate (cm) "<<coordCm<<endl; |
| 215 |
|
cout << " Coordinate (p.u.) "<<coordPU<<endl; |
| 216 |
|
cout << " Resolution (cm) "<<resCm<<endl; |
| 217 |
|
cout << " Multiplicity "<<mult<<endl; |
| 218 |
|
cout << " Signal (MIP) "<<signal<<endl; |
| 219 |
|
}; |
| 220 |
|
|
| 221 |
|
// ClassDef(ExtHit,1); |
| 222 |
|
|
| 223 |
|
}; |
| 224 |
|
|
| 225 |
|
/** |
| 226 |
|
* |
| 227 |
|
* Algorythm class |
| 228 |
|
* |
| 229 |
|
*/ |
| 230 |
|
|
| 231 |
|
|
| 232 |
|
|
| 233 |
class ExtTrkingAlg : public TObject { |
class ExtTrkingAlg : public TObject { |
| 234 |
|
|
| 235 |
private: |
private: |
| 236 |
|
|
| 237 |
Int_t _whichAlg; ///< algorythm id |
Int_t _whichAlg; ///< algorythm id |
| 238 |
|
|
|
|
|
| 239 |
TClonesArray *_trkArray; ///< array of tracks |
TClonesArray *_trkArray; ///< array of tracks |
| 240 |
|
|
| 241 |
TrkLevel1* _trk_l1; |
TrkLevel1* _trk_l1; |
| 243 |
|
|
| 244 |
CaloLevel1* _cal_l1; |
CaloLevel1* _cal_l1; |
| 245 |
CaloLevel2* _cal_l2; |
CaloLevel2* _cal_l2; |
| 246 |
|
vector<ExtHit> _cal_cl;///< calorimeter hits |
| 247 |
|
|
| 248 |
ToFLevel2* _tof_l2; |
ToFLevel2* _tof_l2; |
| 249 |
|
vector<ExtHit> _trk_cl;///< tracker hits |
| 250 |
|
|
| 251 |
|
ExtTrack* _extTrack; |
| 252 |
|
float* _zMech; |
| 253 |
|
|
|
|
|
| 254 |
Int_t _sel_nClstrMAX; ///< selection parameter: maximum number of cluster |
Int_t _sel_nClstrMAX; ///< selection parameter: maximum number of cluster |
| 255 |
Int_t _sel_nPlaneXMIN; ///< selection parameter: minimum number of hit x-views |
Int_t _sel_nPlaneXMIN; ///< selection parameter: minimum number of hit x-views |
| 256 |
Int_t _sel_nPlaneYMIN; ///< selection parameter: minimum number of hit y-views |
Int_t _sel_nPlaneYMIN; ///< selection parameter: minimum number of hit y-views |
| 257 |
|
|
| 258 |
|
|
| 259 |
Int_t _alg_nClFixX; ///< algorythm parameter: n.hits required on X view |
Int_t _alg_nClFixX; ///< algorythm parameter: n.hits required on X view |
| 260 |
Int_t _alg_nClFixY; ///< algorythm parameter:n.hits required on X view |
Int_t _alg_nClFixY; ///< algorythm parameter:n.hits required on Y view |
| 261 |
Int_t _alg_nTrackMAX; ///< algorythm parameter: maximum num. of track candidates |
Int_t _alg_nTrackMAX; ///< algorythm parameter: maximum num. of track candidates |
| 262 |
|
Int_t _alg_nViewCal; ///< algorythm parameter: n. calorimeter planes included |
| 263 |
|
|
| 264 |
|
|
| 265 |
|
|
| 266 |
|
Int_t NEXTVIEWS; |
| 267 |
|
Int_t NEXTPLANES; |
| 268 |
|
|
| 269 |
|
|
| 270 |
|
float _caloCoord[2][22][96]; |
| 271 |
|
float _caloZ[44]; |
| 272 |
|
Trajectory* _caloTj; |
| 273 |
|
Trajectory* _tgf; |
| 274 |
|
|
| 275 |
|
|
| 276 |
|
vector<CaloStripRoto> _caloStripRoto; // rotatore di calorimetri! sapevatelo! |
| 277 |
|
|
| 278 |
Bool_t _debug; |
Bool_t _debug; |
| 279 |
|
|
| 280 |
public: |
public: |
| 281 |
|
|
|
void Reset(); ///< Reset the algorythm |
|
| 282 |
void Clear(Option_t* option = ""); ///< Clear the event |
void Clear(Option_t* option = ""); ///< Clear the event |
| 283 |
void Delete(){ delete _trkArray; }; |
void Delete(); ///< Delete all (deallocate arrays) |
| 284 |
|
|
| 285 |
ExtTrkingAlg(Int_t id=0); |
ExtTrkingAlg(Int_t id=0); |
| 286 |
// ExtTrkingAlg(){ ExtTrkingAlg(0); }; |
// ExtTrkingAlg(){ ExtTrkingAlg(0); }; |
| 294 |
void SetCaloLevel1( CaloLevel1* call1 = NULL ) { _cal_l1 = call1; }; |
void SetCaloLevel1( CaloLevel1* call1 = NULL ) { _cal_l1 = call1; }; |
| 295 |
void SetCaloLevel2( CaloLevel2* call2 = NULL ) { _cal_l2 = call2; }; |
void SetCaloLevel2( CaloLevel2* call2 = NULL ) { _cal_l2 = call2; }; |
| 296 |
|
|
| 297 |
|
|
| 298 |
|
void FillClusterMap(multimap<int,int> &map,TrkLevel1* l1,Int_t vOffset = 0); |
| 299 |
|
void FillClusterMap(multimap<int,int> &map,CaloLevel1* l1,Int_t vOffset = 12); |
| 300 |
|
|
| 301 |
Bool_t CheckEvent(); ///< pre-selection |
Bool_t CheckEvent(); ///< pre-selection |
| 302 |
void ProcessEvent(Bool_t force = false); ///< apply tracking algorythm |
void ProcessEvent0(Bool_t force = false); ///< apply tracking algorythm 0 |
| 303 |
|
void ProcessEvent1(Bool_t force = false); ///< apply tracking algorythm 1 |
| 304 |
|
void ProcessEvent2(Bool_t force = false); ///< apply tracking algorythm 1 |
| 305 |
|
void ProcessEvent(Bool_t force = false); |
| 306 |
|
bool EvaluateClusterPosition_Tracker( int, int, int, int, float*, float*, float*); |
| 307 |
|
bool EvaluateClusterPosition_Calorimeter( int icl, int& sensor, float *xmABar, float *ymABar, float *zmAB, float def=0.); |
| 308 |
|
|
| 309 |
|
|
| 310 |
TClonesArray *GetTrackArray(Bool_t reset = false); |
TClonesArray *GetTrackArray(Bool_t reset = false); |
| 311 |
|
|
| 312 |
void SetSelectionParams(double* par); |
void SetSelectionParams(double* par); |
| 313 |
void SetAlgorythmParams(double* par); |
void SetAlgorythmParams(double* par); |
| 314 |
|
|
| 315 |
|
|
| 316 |
void SetDebug(Bool_t dbg = false){ _debug = dbg; }; |
void SetDebug(Bool_t dbg = false){ _debug = dbg; }; |
| 317 |
|
|
| 318 |
void Dump(); |
void Dump(); |
| 319 |
|
|
| 320 |
TClonesArray** GetPointerToTrackArray(){ return &_trkArray; }; |
TClonesArray** GetPointerToTrackArray(){ return &_trkArray; }; |
| 321 |
|
|
| 322 |
}; |
vector<ExtHit> GetCaloClusters(){ return _cal_cl; }; |
| 323 |
|
vector<ExtHit> GetTrkClusters(){ return _trk_cl; }; |
| 324 |
|
|
| 325 |
|
CaloStripRoto GetCaloStripRoto(int index){ return _caloStripRoto[index]; }; |
| 326 |
|
|
| 327 |
|
|
| 328 |
|
}; |
| 329 |
|
|
| 330 |
|
|
| 331 |
#endif |
#endif |