25 #include <TClonesArray.h>
67 fNHits = fHits->GetEntriesFast();
68 fNTracks = fTracks->GetEntriesFast();
70 LOG(debug) <<
"PixelFitTracks::Exec() EVENT " << fTNofEvents <<
" with " << fNTracks <<
" TRACKS";
72 for (Int_t itrack = 0; itrack < fNTracks; itrack++) {
77 Double_t* hitXPos =
new Double_t[nofHits]();
78 Double_t* hitYPos =
new Double_t[nofHits]();
79 Double_t* hitZPos =
new Double_t[nofHits]();
81 for (Int_t ihit = 0; ihit < nofHits; ihit++) {
86 hitXPos[ihit] = curHit->
GetX();
87 hitYPos[ihit] = curHit->
GetY();
88 hitZPos[ihit] = curHit->
GetZ();
91 Double_t valX0 = 0., errX0 = 0., valAX = 0., errAX = 0.;
92 Double_t valY0 = 0., errY0 = 0., valAY = 0., errAY = 0.;
94 LinearRegression(nofHits, hitZPos, hitXPos, valX0, errX0, valAX, errAX);
95 LinearRegression(nofHits, hitZPos, hitYPos, valY0, errY0, valAY, errAY);
98 new ((*fFitTracks)[fNFitTracks])
PixelTrack(valX0, valAX, valY0, valAY, errX0, errAX, errY0, errAY);
99 for (Int_t ihit = 0; ihit < nofHits; ihit++) {
105 LOG(debug) <<
"Track params: "
106 <<
" AX = " << curTrack->
GetAX() <<
" += " << curTrack->
GetAXErr() <<
" X0 = " << curTrack->
GetX0()
107 <<
" += " << curTrack->
GetX0Err() <<
" "
108 <<
" AY = " << curTrack->
GetAY() <<
" += " << curTrack->
GetAYErr() <<
" Y0 = " << curTrack->
GetY0()
110 LOG(debug) <<
"Fitted params: "
111 <<
" AX = " << valAX <<
" += " << errAX <<
" X0 = " << valX0 <<
" += " << errX0
113 <<
" AY = " << valAY <<
" += " << errAY <<
" Y0 = " << valY0 <<
" += " << errY0;
121 fTNofTracks += fNTracks;
122 fTNofFitTracks += fNFitTracks;
125 Double_t PixelFitTracks::LinearRegression(Int_t nval,
133 Double_t valN =
static_cast<Double_t
>(nval);
139 for (Int_t ival = 0; ival < nval; ival++) {
140 sumXY += xval[ival] * yval[ival];
143 sumXX += xval[ival] * xval[ival];
145 valA1 = (valN * sumXY - sumX * sumY) / (valN * sumXX - sumX * sumX);
146 valA0 = (sumY - valA1 * sumX) / valN;
148 for (Int_t ival = 0; ival < nval; ival++) {
149 sumEE += (yval[ival] - valA0 - valA1 * xval[ival]) * (yval[ival] - valA0 - valA1 * xval[ival]);
151 Double_t valS = TMath::Sqrt(sumEE / (valN - 2.));
152 errA1 = valS * TMath::Sqrt(valN / (valN * sumXX - sumX * sumX));
153 errA0 = valS * TMath::Sqrt(sumXX / (valN * sumXX - sumX * sumX));
159 void PixelFitTracks::SetParContainers()
164 LOG(fatal) <<
"No analysis run";
168 LOG(fatal) <<
"No runtime database";
177 tempList->Add(fDigiPar);
184 LOG(info) <<
"********************************************** PixelFitTracks::InitMQ()";
185 fDigiPar = (
PixelDigiPar*)tempList->FindObject(
"PixelDigiParameters");
187 fFitTracks =
new TClonesArray(
"PixelTrack", 10000);
188 fFitTracks->SetName(
"PixelFitTracks");
198 fHits = (TClonesArray*)inputList->FindObject(
"PixelHits");
199 fTracks = (TClonesArray*)inputList->FindObject(
"PixelTracks");
200 outputList->Add(fFitTracks);
210 LOG(fatal) <<
"No FairRootManager";
212 fHits =
static_cast<TClonesArray*
>(ioman->
GetObject(
"PixelHits"));
214 LOG(warn) <<
"PixelFitTracks::Init() No input PixelHit array!";
215 fTracks =
static_cast<TClonesArray*
>(ioman->
GetObject(
"PixelTracks"));
217 LOG(warn) <<
"PixelFitTracks::Init() No input PixelTrack array!";
220 fFitTracks =
new TClonesArray(
"PixelTrack", 10000);
221 ioman->
Register(
"PixelFitTracks",
"Pixel", fFitTracks, kTRUE);
228 void PixelFitTracks::Reset()
230 fNFitTracks = fNTracks = fNHits = 0;
235 void PixelFitTracks::Finish()
238 fFitTracks->Delete();
240 LOG(info) <<
"-------------------- " << fName.Data() <<
" : Summary ------------------------";
241 LOG(info) <<
" Events: " << fTNofEvents;
242 LOG(info) <<
" Tracks: " << fTNofTracks <<
" ("
243 <<
static_cast<Double_t
>(fTNofTracks) / (static_cast<Double_t>(fTNofEvents)) <<
" per event)";
244 LOG(info) <<
" Fitted Tracks: " << fTNofFitTracks <<
" ("
245 <<
static_cast<Double_t
>(fTNofFitTracks) / (static_cast<Double_t>(fTNofEvents)) <<
" per event)";
246 LOG(info) <<
"---------------------------------------------------------------------";
list of container factories
void AddHitIndex(Int_t hitIndex)
static FairRun * Instance()
static FairRootManager * Instance()
ClassImp(FairEventBuilder)
virtual ~PixelFitTracks()
Digitization Parameter Class for Pixel detector.
TObject * GetObject(const char *BrName)
FairParSet * getContainer(const Text_t *)
Int_t GetHitIndex(Int_t ihit)
virtual void Exec(Option_t *opt)
virtual void ExecMQ(TList *inputList, TList *outputList)
FairRuntimeDb * GetRuntimeDb(void)
void Register(const char *name, const char *Foldername, TNamed *obj, Bool_t toFile)
virtual void InitMQ(TList *tempList)
virtual void GetParList(TList *tempList)