]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Mapping instance copied of when reading from file + Track Clear
authormfloris <michele.floris@cern.ch>
Fri, 14 Mar 2014 16:30:01 +0000 (17:30 +0100)
committerhristov <Peter.Hristov@cern.ch>
Thu, 27 Mar 2014 15:25:03 +0000 (16:25 +0100)
This avoids problems when switching file (the mapping would be deleted).
The AliNanoAODTrack track class now has a Clear method.

PWG/DevNanoAOD/AliNanoAODTrack.cxx
PWG/DevNanoAOD/AliNanoAODTrack.h
PWG/DevNanoAOD/AliNanoAODTrackMapping.cxx
PWG/DevNanoAOD/AliNanoAODTrackMapping.h

index 1b206494badb5ef5de65f9278b50a7c4c8cea3b5..11cd8627e594bea81697b725f858f46e18ed61fa 100644 (file)
@@ -528,3 +528,9 @@ Bool_t AliNanoAODTrack::GetXYZAt(Double_t x, Double_t b, Double_t *r) const
 
 
 //_______________________________________________________
+
+void  AliNanoAODTrack::Clear(Option_t * /*opt*/) {
+  // empty storage
+  fVars.clear();
+  fNVars = 0;
+}
index 7241cac33470ed768f7b8110e868391607b3a28c..66f70879b0edcd73b7e9aa3a0838490775bb0415 100644 (file)
@@ -81,7 +81,8 @@ public:
   AliNanoAODTrack(const AliNanoAODTrack& trk); 
   AliNanoAODTrack& operator=(const AliNanoAODTrack& trk);
 
-  // Storage helper methods
+
+  virtual void Clear(Option_t * opt) ;
   
   // kinematics
   virtual Double_t OneOverPt() const { return (Pt() != 0.) ? 1./Pt() : -999.; }
@@ -361,7 +362,6 @@ void SetChi2perNDF(Double_t chi2perNDF) { fVars[AliNanoAODTrackMapping::GetInsta
 private :
 
 
-  // Remove everything from here on?
 
   // Momentum & position
   // FIXME: the following was replaced by posx, posy, posz. Check if the names make sense
index 81bba1a6ef5c25818e7797e3cfe06239d66bd7f7..d882b9ceac5cbafdaefa11cf40646c08285b31e2 100644 (file)
@@ -297,7 +297,7 @@ void  AliNanoAODTrackMapping::LoadInstance() {
 
       if(tree) {
        tree->GetUserInfo()->Print();
-       fInstance = (AliNanoAODTrackMapping*) tree->GetUserInfo()->FindObject("AliNanoAODTrackMapping");
+       fInstance = new AliNanoAODTrackMapping(*((AliNanoAODTrackMapping*) tree->GetUserInfo()->FindObject("AliNanoAODTrackMapping")));
        // Otherwise try to get it from the current directory
        std::cout << " from tree: " << fInstance << std::endl;
        
index 44fc6411d8197d7b821d33b92b23f7befd5a3d05..256498594f381d86e65ee7dcbee6600263ccdfa5 100644 (file)
@@ -153,7 +153,7 @@ private:
 
   static AliNanoAODTrackMapping * fInstance; //instance, needed for the singleton implementation
   static TString fMappingString; // the string which this class was initialized with
-  std::map<TString,int> fMapCstVar;// Map of indexes of custom variables: CASH THIS TO CONST INTs IN YOUR TASK TO AVOID CONTINUOUS STRING COMPARISONS
+  std::map<TString,int> fMapCstVar;// Map of indexes of custom variables: CACHE THIS TO CONST INTs IN YOUR TASK TO AVOID CONTINUOUS STRING COMPARISONS
   ClassDef(AliNanoAODTrackMapping, 1)
   
 };