-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GMT #680
base: main
Are you sure you want to change the base?
GMT #680
Conversation
StRoot/StGmtAligner/EventT.cxx
Outdated
TH2F * dMin = new TH2F("DMin","vumin",100,-0.75,0.75,100,-0.75,0.75); | ||
TH1F * vMin = new TH1F("VMin","vmin", plotDuv.nx, plotDuv.xmin, plotDuv.xmax); | ||
TH1F * uMin = new TH1F("UMin","umin", plotDuv.nx, plotDuv.xmin, plotDuv.xmax); | ||
TH1F * uMinC = new TH1F("UMinC","umC", plotDuv.nx, plotDuv.xmin, plotDuv.xmax); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this histogram used? The compiler complains about the variable not being used
StRoot/StGmtAligner/EventT.h
Outdated
if (tree == 0) { | ||
TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("/star/data09/calib/fisyak/Pass112/TpcSsd/065/Event_6065045_raw_1010001.root"); | ||
if (!f) { | ||
f = new TFile("/star/data09/calib/fisyak/Pass112/TpcSsd/065/Event_6065045_raw_1010001.root"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not a good practice to have hard coded file names in the code. A better option would be to introduce a function argument with a default value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few suggestions indicated. Few changes should be made,... StGmtAligner should be a maker, and prefer c++ native types (e.g. int) over ROOT types (Int_t) when a class is not intended for IO.
@@ -1141,13 +1141,14 @@ void StAnalysisMaker::summarizeEvent(StEvent *event, Int_t mEventCounter) { | |||
if (event->numberOfPsds()) { | |||
LOG_QA << "# PSDs: " << event->numberOfPsds() << endm; | |||
} | |||
#ifdef _ST_GMT_HIT_H_ | |||
//#ifdef _ST_GMT_HIT_H_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest removing rather than commenting ifdefs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed most of those and left only a few that are needed for debug and analysis purpose
/// ADC error in Y | ||
Float_t getErrorAdcY() const { return mdAdcY; } | ||
/// Local X coordinate | ||
Float_t getLocalX() const { return position().x(); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The optimizer probably avoids a copy here... but for consistency with the way you write the setters, I recommend using mPosition.x() rather than position().x(). (same for error and y...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, but that cannot be done here due to the inheritance
return; | ||
} | ||
|
||
mHitLocalX = mHitLocalY = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't lines 35 to 42 be uncommented? If not, what does this constructor do?
StRoot/StEvent/StGmtStrip.h
Outdated
Short_t mMaxAdcTB; | ||
/// Max over the time bins | ||
Short_t mMaxPedSubtractedAdcTB; | ||
// Short_t mClusterSeedType; // See types in StGmtConsts.h |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove commented out references to mClusterSeedType (or uncomment them if they are needed.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
// strip. New strip is created if it does not exist, but only | ||
// using StGmtStrip() constructor. Ownership is retained by the | ||
// collection. | ||
// StGmtStrip* getStrip( int elecId ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cleanup
|
||
// inline functions | ||
|
||
// inline StGmtStripCollection::StGmtStripCollection( short module ) : StObject(), mModule( module ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... cleanup constructors / methods / variables which are commented out.
}; | ||
|
||
// sort by coordinate number | ||
inline void StGmtStripCollection::sortByCoord(){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a comment. You can always sort vectors inside of consumer codes. So... I don't really see a need to sort the in-memory collection, unless there are multiple downstream codes that would prefer a given order.
StRoot/StGmtAligner/StGmtAligner.cxx
Outdated
#include "StTpcDb/StTpcDb.h" | ||
#include "StDetectorDbMaker/StGmtSurveyC.h" | ||
//________________________________________________________________________________ | ||
StGmtAligner::StGmtAligner(const Char_t *name) : StMaker(name),fFile(0), fTree(0), fEvent(0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StGmtAligner is a maker. The "maker" rules should apply here.
- The name of the code should by in the form StTLAMaker. e.g. StGmtAlignmentMaker
- The code should be organized under StRoot/StGmtAlignmentMaker/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
StRoot/StGmtAligner/runGmtTree.C
Outdated
@@ -0,0 +1,23 @@ | |||
void runGmtTree(const Char_t *input, const Char_t *output=0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a "macros" directory to collect analysis macros.
#include "StMessMgr.h" | ||
ClassImp(StGmtClusterMaker); | ||
|
||
Int_t StGmtClusterMaker::gmtStat = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
STAR coding standards prefer using standard c++ types (int, float, char, etc...) over ROOT types (Int_t, Float_t, etc...) when you are implementing a non persistent class... i.e. anything you don't intend save in MuDst, PicoDst, StEvent... or any ttree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before I do another round of comments on this massive PR, I would like to see the compiler errors addressed.
StRoot/StEvent/StGmtHit.h
Outdated
Float_t mChargeUncert; | ||
|
||
private: | ||
ClassDef(StGmtHit,2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StGmtHit is a new data type. Why start with version 2?
#include "StGmtHit.h" | ||
#include "StGmtHitCollection.h" | ||
|
||
ClassImp(StGmtHitCollection) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ClassImp
macro is not needed anywhere. Please remove
StRoot/StEvent/StGmtPoint.cxx
Outdated
if ( !hit1 || !hit2 ) { | ||
LOG_ERROR << "Passed null pointer into StGmtPoint::StGmtPoint( StGmtHit* hit1, StGmtHit* hit2, int key )" << endm; | ||
mKey = -999; | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't return from a constructor. It must create a valid object or throw an exception. Please reconsider the logic. You can make sure the input StGmtHits are valid to construct a StGmtPoint
StRoot/StEvent/StGmtStrip.cxx
Outdated
// StGmtStrip header | ||
#include "StGmtStrip.h" | ||
|
||
ClassImp(StGmtStrip) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
ClassImp(StGmtStrip) |
// if( (h1->isY() && h2->isY()) || ( !(h1->isY()) && !(h2->isY()) ) ) | ||
// { | ||
// // LOG_ERROR << "StGmtStripCollection::hitCoordLessThan sort CASE 1: " << | ||
// // "\n\t h1 " << h1 << | ||
// // "\n\t h1->isY() " << h1->isY() << | ||
// // "\n\t h1->GetCoordNum() " << h1->getCoordNum() << | ||
// // "\n\t h2 " << h2 << | ||
// // "\n\t h2->isY() " << h2->isY() << | ||
// // "\n\t h2->GetCoordNum() " << h2->getCoordNum() << | ||
// // "\n\t will return: " << h1->getCoordNum() << " < " << h2->getCoordNum() << endm; | ||
// return h1->getCoordNum() < h2->getCoordNum(); | ||
// } | ||
// else if( h1->isY() && !(h2->isY()) ) | ||
// { | ||
// // LOG_ERROR << "StGmtStripCollection::hitCoordLessThan sort CASE 2: " << | ||
// // "\n\t h1 " << h1 << | ||
// // "\n\t h1->isY() " << h1->isY() << | ||
// // "\n\t h1->GetCoordNum() " << h1->getCoordNum() << | ||
// // "\n\t h2 " << h2 << | ||
// // "\n\t h2->isY() " << h2->isY() << | ||
// // "\n\t h2->GetCoordNum() " << h2->getCoordNum() << | ||
// // "\n\t will return: " << h1->getCoordNum()+kGmtNumStrips << " < " << h2->getCoordNum() << endm; | ||
// return (h1->getCoordNum()+kGmtNumStrips) < h2->getCoordNum(); // order X first | ||
// } | ||
// else if( !(h1->isY()) && h2->isY() ) | ||
// { | ||
// // LOG_ERROR << "StGmtStripCollection::hitCoordLessThan sort CASE 3: " << | ||
// // "\n\t h1 " << h1 << | ||
// // "\n\t h1->isY() " << h1->isY() << | ||
// // "\n\t h1->GetCoordNum() " << h1->getCoordNum() << | ||
// // "\n\t h2 " << h2 << | ||
// // "\n\t h2->isY() " << h2->isY() << | ||
// // "\n\t h2->GetCoordNum() " << h2->getCoordNum() << | ||
// // "\n\t will return: " << h1->getCoordNum() << " < " << h2->getCoordNum()+kGmtNumStrips << endm; | ||
// return h1->getCoordNum() < (h2->getCoordNum()+kGmtNumStrips); // order X first | ||
// } | ||
// else | ||
// { | ||
// // LOG_ERROR << "StGmtStripCollection::hitCoordLessThan sort FAILED: " << | ||
// // "\n\t h1 " << h1 << | ||
// // "\n\t h1->isY() " << h1->isY() << | ||
// // "\n\t h1->GetCoordNum() " << h1->getCoordNum() << | ||
// // "\n\t h2 " << h2 << | ||
// // "\n\t h2->isY() " << h2->isY() << | ||
// // "\n\t h2->GetCoordNum() " << h2->getCoordNum() << | ||
// // "\n\t will return: " << -1 << endm; | ||
// return -1; | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this "dead" code
Init(tree); | ||
} | ||
|
||
virtual ~TBase() {if (!fChain) return; delete fChain->GetCurrentFile();} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can you be sure that the current file is the one you opened in this maker? What if another maker makes a different file current?
Also, are you sure the file is written and closed when you call it destructor?
#if 0 | ||
void SetValidDerivatives(Bool_t p=kTRUE) {fValidDerivatives = p;} | ||
void SetDerivatives(Double32_t *der) {Double32_t *d = &duPdxV; for (Int_t i = 0; i < 12; i++) d[i] = der[i];} | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the point of disabling these lines with #if 0
?
#include <stdlib.h> | ||
#include "Riostream.h" | ||
#include "TROOT.h" | ||
#include "TSystem.h" | ||
#include "TFile.h" | ||
#include "TKey.h" | ||
#include "TRandom.h" | ||
#include "TTree.h" | ||
#include "TBranch.h" | ||
#include "TStopwatch.h" | ||
#include "StThreeVectorF.hh" | ||
#include "StMatrixF.hh" | ||
#include "TH1.h" | ||
#include "TH2.h" | ||
#include "TProfile.h" | ||
#include "TMath.h" | ||
#include "TVector3.h" | ||
#include "TProcessID.h" | ||
#include "StEvent.h" | ||
#include "StPrimaryVertex.h" | ||
#include "StBFChain.h" | ||
#include "TGeoMatrix.h" | ||
#include "EventT.h" | ||
#include "StTpcDb/StTpcDb.h" | ||
#include "StDetectorDbMaker/StGmtSurveyC.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Include only the header files you really need.
Hi, what is the status of this PR? Have all comments been addressed? If so, can we wrap this one up and prepare this to be merged into the STAR library? |
The error you are getting is valid:
What do you expect to get from star-sw/StRoot/StGmtUtil/geometry/StGmtGeom.cxx Lines 149 to 160 in 79cd54e
|
Good catch. I'll update this part |
Commit GMT-related classes and macroses. Also update StarDb/geometry for GMT with the last alignemnt.