TruthHelp Class Reference

#include <TruthHelp.h>

List of all members.

Public Member Functions

 TruthHelp ()
virtual ~TruthHelp ()
 TruthHelp (const AtmosEvent *event)
void Zero ()
void Fill (const AtmosEvent *event)
void MakeTrkIdToId (const AtmosEvent *event)
void MakeAssociateHits (const AtmosEvent *event)
void ClassHits (const AtmosEvent *event)

Public Attributes

std::set< SetStripAllHits
std::set< SetStripLeptonHits
std::set< SetStripHadronHits
std::set< SetStripNoiseHits
std::set< SetStripDeMuxFailures
std::map< int, int > TrkIdToId
std::vector< std::vector< int > > AssociateHits

Detailed Description

Definition at line 13 of file TruthHelp.h.


Constructor & Destructor Documentation

TruthHelp::TruthHelp (  ) 

Definition at line 40 of file TruthHelp.cxx.

References Zero().

00041 {
00042   this->Zero();
00043 }

virtual TruthHelp::~TruthHelp (  )  [inline, virtual]

Definition at line 16 of file TruthHelp.h.

00016 {;}

TruthHelp::TruthHelp ( const AtmosEvent event  ) 

Definition at line 45 of file TruthHelp.cxx.

References Fill(), and Zero().

00046 {
00047   this->Zero();
00048   this->Fill(event);
00049 }


Member Function Documentation

void TruthHelp::ClassHits ( const AtmosEvent event  ) 

Definition at line 175 of file TruthHelp.cxx.

References AllHits, AssociateHits, HadronHits, UtilMisc::IdIsLepton(), LeptonHits, AtmosStrip::Ndigits, NoiseHits, AtmosStrip::QPE, size, AtmosScintHit::TrkId, and TrkIdToId.

Referenced by Fill().

00175                                                  {
00176   if(!event) return;
00177   AllHits.clear();
00178   LeptonHits.clear();
00179   HadronHits.clear();
00180   NoiseHits.clear();
00181   
00182   for (unsigned int i=0; i<AssociateHits.size(); i++) {
00183     const AtmosStrip* strip =
00184       dynamic_cast<const AtmosStrip*>(event->StripList->At(i));
00185     assert(strip);
00186 
00187     AllHits.insert(SetStrip(i, strip));
00188 
00189     const double stripPE = (strip->QPE[0]+strip->QPE[1]);
00190 
00191     //noise hit
00192     if (AssociateHits[i].size() == 0) {
00193       NoiseHits.insert(SetStrip(i,stripPE,strip->Ndigits-1));
00194       continue;
00195     }
00196 
00197     bool IsLep = false;
00198     bool IsHad = false;
00199     
00200     for (unsigned int j=0; j<AssociateHits[i].size(); j++) {
00201       int ThisIndex = AssociateHits[i][j];
00202       const AtmosScintHit* hit =
00203         dynamic_cast<const AtmosScintHit*>
00204         (event->ScintHitList->At(ThisIndex));
00205       assert(hit);
00206       if(UtilMisc::IdIsLepton(TrkIdToId[TMath::Abs(hit->TrkId)]))
00207         IsLep = true;
00208       else IsHad = true;
00209     }
00210     if(IsLep) LeptonHits.insert(SetStrip(i,stripPE,strip->Ndigits-1));
00211     if(IsHad) HadronHits.insert(SetStrip(i,stripPE,strip->Ndigits-1));
00212   }
00213 }

void TruthHelp::Fill ( const AtmosEvent event  ) 

Definition at line 62 of file TruthHelp.cxx.

References ClassHits(), Msg::kVerbose, MakeAssociateHits(), MakeTrkIdToId(), MSG, and Zero().

Referenced by TruthHelp().

00062                                             {
00063   if(!event) return;
00064   this->Zero();
00065   MSG("FarDetEvent",Msg::kVerbose) << "TruthHelp::Fill" << endl;
00066 
00067   MakeTrkIdToId(event);
00068 
00069   MakeAssociateHits(event);
00070 
00071   ClassHits(event);
00072 }

void TruthHelp::MakeAssociateHits ( const AtmosEvent event  ) 

Definition at line 89 of file TruthHelp.cxx.

References AssociateHits, AtmosScintHit::DE, DeMuxFailures, MuELoss::e, find(), UtilStrip::GangedStrips(), SimpleScintPlane::Hits, Msg::kDebug, Msg::kSynopsis, MSG, AtmosStrip::Plane, AtmosScintHit::Plane, SimpleScintPlane::Plane, AtmosStrip::Qadc, SimpleScintHit::Strip, AtmosStrip::Strip, AtmosScintHit::Strip, SimpleScintHit::TCInd, and SimpleScintPlane::TotalDE.

Referenced by Fill().

00089                                                          {
00090   if(!event) return;
00091   AssociateHits.clear();
00092   DeMuxFailures.clear();
00093 
00094   static SimpleScintPlane ScintPlanes[485];
00095   for(int i=0; i<485; i++) {
00096     ScintPlanes[i].Plane = i+1;
00097     ScintPlanes[i].TotalDE = 0.0;
00098     ScintPlanes[i].Hits.clear();
00099   }
00100 
00101   for (int i=0; i<event->ScintHitList->GetEntries(); i++) {
00102     const AtmosScintHit* hit =
00103       dynamic_cast<const AtmosScintHit*>(event->ScintHitList->At(i));
00104     assert(hit);
00105     ScintPlanes[hit->Plane-1].Hits.push_back(SimpleScintHit(i, hit->Strip));
00106     ScintPlanes[hit->Plane-1].TotalDE += hit->DE;
00107   }
00108 
00109   for (int istrip=0; istrip<event->StripList->GetEntries(); istrip++) {
00110     vector<int> Hit;
00111     const AtmosStrip *strip = 
00112       dynamic_cast<AtmosStrip*>(event->StripList->At(istrip));
00113     SimpleScintPlane &thisScintPlane = ScintPlanes[strip->Plane - 1];
00114 
00115     //Not enough DE in plane noise hit
00116     if (thisScintPlane.TotalDE < 1e-4) {
00117       MSG("FarDetEvent",Msg::kDebug) << "Strip " << strip->Strip << " in plane "
00118              << strip->Plane << " has too little plane DE" << endl;
00119       AssociateHits.push_back(Hit);
00120       continue;
00121     }
00122 
00123     //Check all ganged strips, starting with the bang on strip
00124     vector<int> Gang0 = UtilStrip::GangedStrips(strip->Strip,0);
00125     vector<int> Gang1 = UtilStrip::GangedStrips(strip->Strip,1);
00126 
00127     bool MatchActual = false;//True if the actual strip has a match
00128     for (unsigned int i=0; i<thisScintPlane.Hits.size(); i++) {
00129       SimpleScintHit &thisScintHit = thisScintPlane.Hits[i];
00130       vector<int>::iterator F0 = 
00131         std::find(Gang0.begin(),Gang0.end(),thisScintHit.Strip);
00132       vector<int>::iterator F1 = 
00133         std::find(Gang1.begin(),Gang1.end(),thisScintHit.Strip);
00134 
00135       bool MatchStrip = false;
00136       if(strip->Qadc[0]>0.0 && F0!=Gang0.end() ) MatchStrip = true;
00137       if(strip->Qadc[1]>0.0 && F1!=Gang1.end() ) MatchStrip = true;
00138       if(MatchStrip) Hit.push_back(thisScintHit.TCInd);
00139 
00140       if(strip->Qadc[0]>0.0 && F0==Gang0.begin() ) MatchActual = true;
00141       if(strip->Qadc[1]>0.0 && F1==Gang1.begin() ) MatchActual = true;
00142 
00143       vector<int>::iterator sps;
00144       if (strip->Qadc[0]>0.0 && F0!=Gang0.begin() && F0!=Gang0.end()) {
00145         MSG("FarDetEvent",Msg::kSynopsis) << "East DeMux Failure on Plane = " << strip->Plane
00146                << ", Strip = " << strip->Strip << endl;
00147         MSG("FarDetEvent",Msg::kSynopsis) << "Ganged Strips =";
00148         for(unsigned int i=0; i<Gang0.size(); i++) MSG("FarDetEvent",Msg::kSynopsis) << " " << Gang0[i];
00149         MSG("FarDetEvent",Msg::kSynopsis) << endl;
00150         MSG("FarDetEvent",Msg::kSynopsis) << "ScintHit Strip = " << thisScintHit.Strip << endl;
00151       }
00152 
00153       if (strip->Qadc[1]>0.0 && F1!=Gang1.begin() && F1!=Gang1.end()) {
00154         MSG("FarDetEvent",Msg::kSynopsis) << "West DeMux Failure on Plane = " << strip->Plane
00155                << ", Strip = " << strip->Strip << endl;
00156         MSG("FarDetEvent",Msg::kSynopsis) << "Ganged Strips =";
00157         for(unsigned int i=0; i<Gang1.size(); i++) MSG("FarDetEvent",Msg::kSynopsis) << " " << Gang1[i];
00158         MSG("FarDetEvent",Msg::kSynopsis) << endl;
00159         MSG("FarDetEvent",Msg::kSynopsis) << "ScintHit Strip = " << thisScintHit.Strip << endl;
00160       }
00161     }
00162     if(!MatchActual) DeMuxFailures.insert(SetStrip(istrip,strip));
00163     AssociateHits.push_back(Hit);
00164   }
00165 
00166   /*
00167   set<SetStrip>::iterator sitr;
00168   MSG("FarDetEvent",Msg::kSynopsis) << "DeMuxFailures:" << endl;
00169   for (sitr=DeMuxFailures.begin(); sitr!=DeMuxFailures.end(); sitr++) {
00170     MSG("FarDetEvent",Msg::kSynopsis) << "  TCIndex = " << sitr->TCIndex << endl;
00171   }
00172   */
00173 }

void TruthHelp::MakeTrkIdToId ( const AtmosEvent event  ) 

Definition at line 74 of file TruthHelp.cxx.

References AtmosScintHit::Id, AtmosScintHit::TrkId, and TrkIdToId.

Referenced by Fill().

00074                                                      {
00075   if(!event) return;
00076   TrkIdToId.clear();
00077   
00078   for (int i=0; i<event->ScintHitList->GetEntries(); i++) {
00079     const AtmosScintHit* hit =
00080       dynamic_cast<const AtmosScintHit*>(event->ScintHitList->At(i));
00081     assert(hit);
00082     //The first hit in the TClonesArray decides if Lepton or not
00083     if (TrkIdToId.find(TMath::Abs(hit->TrkId)) == TrkIdToId.end()) {
00084       TrkIdToId[TMath::Abs(hit->TrkId)] = hit->Id;
00085     }
00086   }
00087 }

void TruthHelp::Zero (  ) 

Definition at line 51 of file TruthHelp.cxx.

References AllHits, AssociateHits, DeMuxFailures, HadronHits, LeptonHits, NoiseHits, and TrkIdToId.

Referenced by Fill(), and TruthHelp().

00051                      {
00052   TrkIdToId.clear();
00053   AssociateHits.clear();
00054 
00055   AllHits.clear();
00056   LeptonHits.clear();
00057   HadronHits.clear();
00058   NoiseHits.clear();
00059   DeMuxFailures.clear();
00060 }


Member Data Documentation

Definition at line 23 of file TruthHelp.h.

Referenced by ClassHits(), and Zero().

std::vector< std::vector<int> > TruthHelp::AssociateHits

Definition at line 30 of file TruthHelp.h.

Referenced by ClassHits(), MakeAssociateHits(), and Zero().

Definition at line 26 of file TruthHelp.h.

Referenced by ClassHits(), CamEvd::MakeMCPlot(), and Zero().

std::map<int, int> TruthHelp::TrkIdToId

Definition at line 29 of file TruthHelp.h.

Referenced by ClassHits(), MakeTrkIdToId(), and Zero().


The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1