diff --git a/src/THcDC.cxx b/src/THcDC.cxx index fceb35955d27b8391cb2455bcffa2a3ed1786117..02c864687d650ab66af4bb6d9c156b2fb3553bc4 100644 --- a/src/THcDC.cxx +++ b/src/THcDC.cxx @@ -124,6 +124,7 @@ void THcDC::Setup(const char* name, const char* description) } char *desc = new char[strlen(description)+100]; + char *desc1= new char[strlen(description)+100]; fPlanes.clear(); for(Int_t i=0;i<fNPlanes;i++) { @@ -145,12 +146,12 @@ void THcDC::Setup(const char* name, const char* description) fChambers.clear(); for(Int_t i=0;i<fNChambers;i++) { - sprintf(desc,"%s Chamber %d",description, i+1); + sprintf(desc1,"Ch%d",i+1); // Should construct a better chamber name - THcDriftChamber* newchamber = new THcDriftChamber(desc, desc, i+1, this); + THcDriftChamber* newchamber = new THcDriftChamber(desc1, desc, i+1, this); fChambers.push_back(newchamber); - cout << "Created Drift Chamber " << i+1 << ", " << desc << endl; + cout << "Created Drift Chamber " << i+1 << ", " << desc1 << endl; newchamber->SetHMSStyleFlag(fHMSStyleChambers); // Tell the chamber its style } } @@ -339,6 +340,8 @@ Int_t THcDC::DefineVariables( EMode mode ) RVarDef vars[] = { { "nhit", "Number of DC hits", "fNhits" }, + { "tnhit", "Number of good DC hits", "fNthits" }, + { "trawhit", "Number of true raw DC hits", "fN_True_RawHits" }, { "ntrack", "Number of Tracks", "fNDCTracks" }, { "nsp", "Number of Space Points", "fNSp" }, { "x", "X at focal plane", "fDCTracks.THcDCTrack.GetX()"}, @@ -409,6 +412,8 @@ void THcDC::ClearEvent() { // Reset per-event data. fNhits = 0; + fNthits = 0; + fN_True_RawHits=0; for(Int_t i=0;i<fNChambers;i++) { fChambers[i]->Clear(); @@ -435,20 +440,25 @@ Int_t THcDC::Decode( const THaEvData& evdata ) Int_t nexthit = 0; for(Int_t ip=0;ip<fNPlanes;ip++) { nexthit = fPlanes[ip]->ProcessHits(fRawHitList, nexthit); + fN_True_RawHits += fPlanes[ip]->GetNRawhits(); + } // Let each chamber get its hits for(Int_t ic=0;ic<fNChambers;ic++) { fChambers[ic]->ProcessHits(); + fNthits += fChambers[ic]->GetNHits(); } // fRawHitList is TClones array of THcRawDCHit objects + Int_t counter=0; if (fdebugprintrawdc) { cout << " RAW_TOT_HITS = " << fNRawHits << endl; cout << " Hit # " << "Plane " << " Wire " << " Raw TDC " << endl; for(Int_t ihit = 0; ihit < fNRawHits ; ihit++) { THcRawDCHit* hit = (THcRawDCHit *) fRawHitList->At(ihit); - for(Int_t imhit = 0; imhit < hit->fNHits; imhit++) { - cout << ihit+imhit+1 << " " << hit->fPlane << " " << hit->fCounter << " " << hit->fTDC[imhit] << endl; + for(Int_t imhit = 0; imhit < hit->fNHits; imhit++) { + counter++; + cout << counter << " " << hit->fPlane << " " << hit->fCounter << " " << hit->fTDC[imhit] << endl; } } cout << endl; diff --git a/src/THcDC.h b/src/THcDC.h index 703f84dfd2d4034ac95045fefd862b6b296679e5..2aa47cb67bc5432ae7ee567e0a57c5aced089209 100644 --- a/src/THcDC.h +++ b/src/THcDC.h @@ -104,6 +104,8 @@ protected: // Per-event data Int_t fNhits; + Int_t fNthits; + Int_t fN_True_RawHits; Int_t fNSp; // Number of space points Double_t* fResiduals; //[fNPlanes] Array of residuals diff --git a/src/THcDriftChamber.cxx b/src/THcDriftChamber.cxx index c1fc9955046a2ff82e1593b93e271faebca422eb..2dc7b0621a03d9308447a96e4b0f6b880fe38328 100644 --- a/src/THcDriftChamber.cxx +++ b/src/THcDriftChamber.cxx @@ -221,12 +221,13 @@ Int_t THcDriftChamber::DefineVariables( EMode mode ) fIsSetup = ( mode == kDefine ); // Register variables in global list - // RVarDef vars[] = { - // { "nhit", "Number of DC hits", "fNhits" }, - // { 0 } - // }; - // return DefineVarsFromList( vars, mode ); - return kOK; + RVarDef vars[] = { + { "nhit", "Number of DC hits", "fNhits" }, + { "trawhit", "Number of True Raw hits", "fN_True_RawHits" }, + { 0 } + }; + return DefineVarsFromList( vars, mode ); + //return kOK; } void THcDriftChamber::ProcessHits( void) diff --git a/src/THcDriftChamber.h b/src/THcDriftChamber.h index a7884461cb2e337027420deb215fc2692d7c8f77..0fc61167e08ec365f7103a7c9ccd1a3c795f0a49 100644 --- a/src/THcDriftChamber.h +++ b/src/THcDriftChamber.h @@ -63,6 +63,8 @@ protected: // Per-event data Int_t fNhits; + Int_t fNthits; + Int_t fN_True_RawHits; Int_t fNPlanes; // Number of planes in the chamber diff --git a/src/THcDriftChamberPlane.cxx b/src/THcDriftChamberPlane.cxx index a4be7003220835167089c770ef51f5db8e94f7df..ec36cf933c9784485a1d458656b6839888e68cdf 100644 --- a/src/THcDriftChamberPlane.cxx +++ b/src/THcDriftChamberPlane.cxx @@ -290,7 +290,7 @@ Int_t THcDriftChamberPlane::ProcessHits(TClonesArray* rawhits, Int_t nexthit) Int_t nrawhits = rawhits->GetLast()+1; // cout << "THcDriftChamberPlane::ProcessHits " << fPlaneNum << " " << nexthit << "/" << nrawhits << endl; - + fNRawhits=0; Int_t ihit = nexthit; Int_t nextHit = 0; while(ihit < nrawhits) { @@ -302,6 +302,7 @@ Int_t THcDriftChamberPlane::ProcessHits(TClonesArray* rawhits, Int_t nexthit) THcDCWire* wire = GetWire(wireNum); Int_t wire_last = -1; for(Int_t mhit=0; mhit<hit->fNHits; mhit++) { + fNRawhits++; /* Sort into early, late and ontime */ Int_t rawtdc = hit->fTDC[mhit]; if(rawtdc < fTdcWinMin) { diff --git a/src/THcDriftChamberPlane.h b/src/THcDriftChamberPlane.h index b7aac91b7f1b5b9f18b2ca562b8dc91a0cac3cb0..95c793cd6be99252e97756fc68909d927f3696ac 100644 --- a/src/THcDriftChamberPlane.h +++ b/src/THcDriftChamberPlane.h @@ -49,6 +49,7 @@ public: return (THcDCWire*)fWires->UncheckedAt(i-1); } Int_t GetNHits() const { return fHits->GetLast()+1; } + Int_t GetNRawhits() const {return fNRawhits; } TClonesArray* GetHits() const { return fHits; } Int_t GetPlaneNum() const { return fPlaneNum; } @@ -78,6 +79,7 @@ protected: Int_t fPlaneNum; Int_t fPlaneIndex; /* Index of this plane within it's chamber */ Int_t fChamberNum; + Int_t fNRawhits; Int_t fNWires; Int_t fWireOrder; Int_t fTdcWinMin;