9 #include "FairRootManager.h"
10 #include "FairRunAna.h"
11 #include "FairRuntimeDb.h"
12 #include "FairBaseParSet.h"
13 #include "FairTrackParam.h"
14 #include "FairRootManager.h"
19 #include "TClonesArray.h"
20 #include "TGeoManager.h"
21 #include "TMatrixFSym.h"
35 : FairTask(
"GEM Find Hits Ana", 1),
50 : FairTask(
"GEM Find Hits Ana", iVerbose) ,
65 : FairTask(taskName, iVerbose) ,
85 FairRootManager* ioman = FairRootManager::Instance();
87 cout <<
"-E- "<< GetName() <<
"::Init: "
88 <<
"RootManager not instantised!" << endl;
93 FairRunAna* ana = FairRunAna::Instance();
95 cout <<
"-E- "<< GetName() <<
"::Init :"
96 <<
" no FairRunAna object!" << endl;
100 FairRuntimeDb*
rtdb = ana->GetRuntimeDb();
102 cout <<
"-E- "<< GetName() <<
"::Init :"
103 <<
" no runtime database!" << endl;
108 fGemHitArray = (TClonesArray*) ioman->GetObject(
"GEMHit");
110 cout <<
"-E- " << GetName() <<
"::Init: No PndGemHit array!" << endl;
117 cout <<
"-I- " << fName.Data() <<
"::Init(). There are " <<
fDigiPar->
GetNStations() <<
" GEM stations." << endl;
118 cout <<
"-I- " << fName.Data() <<
"::Init(). Initialization succesfull." << endl;
138 FairRunAna*
run = FairRunAna::Instance();
139 if ( ! run ) Fatal(
"SetParContainers",
"No analysis run");
141 FairRuntimeDb* db = run->GetRuntimeDb();
142 if ( ! db ) Fatal(
"SetParContainers",
"No runtime database");
156 cout <<
"IN EVENT GOT " <<
fGemHitArray->GetEntries() <<
" hits." << endl;
157 cout <<
" - - - - - > " <<
fhFrontBackDiff->GetEntries() <<
" histograms" << endl;
165 for ( Int_t igem1 = 0 ; igem1 < nofGemHits ; igem1++ ) {
167 for ( Int_t igem2 = 0 ; igem2 < nofGemHits ; igem2++ ) {
170 if (
TMath::Abs( gemHit2->GetZ() - gemHit1->GetZ() - 2. ) < 2. ) {
172 if ( gemHit1->GetY() < 0. ) quartId += 2;
173 if ( gemHit1->GetX() < 0. ) quartId += 1;
174 Int_t histogramToFill =
181 gemHit2->GetY()-gemHit1->GetY());
184 cout <<
"will compare " << gemHit1->GetX() <<
" " << gemHit1->GetY() <<
" " << gemHit1->GetZ() << endl
185 <<
" with " << gemHit2->GetX() <<
" " << gemHit2->GetY() <<
" " << gemHit2->GetZ() << endl;
186 cout <<
" IN STATION " << gemHit1->
GetStationNr() << endl;
190 cout <<
" 4 : " << (Int_t(gemHit1->GetX()/
fGridSize)) << endl;
191 cout <<
" histogram to fill " << histogramToFill << endl;
192 cout <<
" - - - - - > "
195 cout <<
"====================================================================================" << endl;
219 for ( Int_t istat = 0 ; istat < nofStations ; istat++ ) {
224 cout <<
"sensor @ z = " << sensor->
GetZ0() <<
" has an outer radius of " << sensor->
GetOuterRadius() << endl;
231 cout <<
" --> the grid of " <<
fGridSize <<
"x" <<
fGridSize <<
"cm^2 requires " << 4*gridHalfLen*gridHalfLen <<
" histograms" << endl;
233 for ( Int_t iquart = 0 ; iquart < 4 ; iquart++ ) {
234 for ( Int_t igry = 0 ; igry < gridHalfLen ; igry++ ) {
235 for ( Int_t igrx = 0 ; igrx < gridHalfLen ; igrx++ ) {
236 new ((*fhFrontBackDiff)[nofHists++]) TH2F(Form(
"fhFrontBackCorr_s%d_q%d_x%d_y%d",istat,iquart,igrx,igry),
237 Form(
"front back corr on station %d, x(%s%.1f:%s%.1f), y(%s%.1f:%s%.1f)",istat,
238 (iquart%2?
"-":
""),igrx*
fGridSize,(iquart%2?
"-":
""),(igrx+1.)*fGridSize,
239 (iquart/2?
"-":
""),igry*fGridSize,(iquart/2?
"-":
""),(igry+1.)*fGridSize),
243 cout << nofHists-1 <<
": histogram " <<
fhFrontBackDiff->At(nofHists-1)->GetName() <<
" / " <<
fhFrontBackDiff->At(nofHists-1)->GetTitle() << endl;
248 new ((*fhFrontBackDiff)[nofHists++]) TH2F(Form(
"fhFrontBackDiffX_s%d",istat),
249 Form(
"front back X difference on station %d",istat),
252 new ((*fhFrontBackDiff)[nofHists++]) TH2F(Form(
"fhFrontBackDiffY_s%d",istat),
253 Form(
"front back Y difference on station %d",istat),
259 cout <<
"HM, seems that fhFrontBackDiff is filled with histograms, and there are " << nofHists <<
" of them" << endl;
261 cout <<
"fStatBegHist has " <<
fStatBegHist.size() <<
" entries:" << endl;
262 for (
size_t isbh = 0 ; isbh <
fStatBegHist.size() ; isbh++ )
264 cout <<
"fGridHalfLen has " <<
fGridHalfLen.size() <<
" entries:" << endl;
265 for (
size_t ighl = 0 ; ighl <
fGridHalfLen.size() ; ighl++ )
277 Double_t quartX[4] = {1.,-1., 1.,-1.};
278 Double_t quartY[4] = {1., 1.,-1.,-1.};
279 for ( Int_t istat = 0 ; istat < nofStations ; istat++ ) {
285 for ( Int_t iquart = 0 ; iquart < 4 ; iquart++ ) {
286 for ( Int_t igry = 0 ; igry < fGridHalfLen[istat] ; igry++ ) {
287 for ( Int_t igrx = 0 ; igrx < fGridHalfLen[istat] ; igrx++ ) {
315 cout <<
"-------------------- PndGemFindHitsAna : Summary ------------------" << endl;
316 cout <<
" Events: " << setw(10) <<
fNofEvents << endl;
317 cout <<
"---------------------------------------------------------------------" << endl;
322 FairRootManager* ioman = FairRootManager::Instance();
323 gFile = ioman->GetOutFile();
324 gDirectory = (TDirectory*)gFile;
326 gDirectory->mkdir(
"GemFindHitsAna");
327 gDirectory->cd(
"GemFindHitsAna");
329 for ( Int_t ihist = 0 ; ihist <
fhFrontBackDiff->GetEntries() ; ihist++ ) {
333 gDirectory->cd(
"..");
Int_t fNofEvents
event counter
Digitization Parameter Class for GEM part.
virtual ~PndGemFindHitsAna()
PndGemSensor * GetSensor(Int_t stationNr, Int_t sensorNr)
TClonesArray * fhFrontBackDiff
std::vector< Int_t > fStatBegHist
virtual InitStatus ReInit()
virtual void Exec(Option_t *opt)
Int_t GetStationNr() const
TClonesArray * fGemHitArray
virtual InitStatus Init()
std::vector< Int_t > fGridHalfLen
Double_t GetOuterRadius() const
h1 Fill(hit_theta-point_theta)
virtual void SetParContainers()