Skip to content
Snippets Groups Projects
Commit d496e1e3 authored by Jonathan Stelzleni's avatar Jonathan Stelzleni
Browse files

Created two new variables for THcDC, fNthits and fN_True_RawHits.

In tree they are called tnhit and trawhit.
Created two new variables for THcDriftChamber, fNthits and fN_True_RawHits.
In tree they are called tnhit and trawhit.
THcDC defined subdetector THcDriftChamber to have name Ch1 and Ch2 to do used in the tree.
THcDriftChamberPlane defined new method GetNRawhits to return fNRawhits for each plane.
Added member fNRawhits to THcDriftChamberPlane
parent 47eeea2f
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
......@@ -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
......
......@@ -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)
......
......@@ -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
......
......@@ -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) {
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment