Correcting sources of warnings
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 1 Mar 2005 10:07:43 +0000 (10:07 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 1 Mar 2005 10:07:43 +0000 (10:07 +0000)
TMEVSIM/TMevSim.cxx
TMEVSIM/TMevSim.h
TMEVSIM/TMevSimPartTypeParams.h

index a143c7754b4c322e49e436e8b36a02ae2d3daa30..9c9d807f5fa9ead79bebafe9044926902618f900 100644 (file)
@@ -617,6 +617,49 @@ Int_t TMevSim::ImportParticles(TClonesArray *particles, Option_t */*option*/)
    return totpart;
 }
 //______________________________________________________________________________
+TObjArray * TMevSim::ImportParticles(Option_t */*option*/)
+{
+// Read in particles created by MevSim into the TClonesArray(). The Initialize()
+// and GenrateEvent() functions must be called prior to calling this funtion.
+// The particles are read from the COMMON POUT. Right now the only provided 
+// information is Geant PID, 3 momentum components and the energy of the particle.
+   
+   fParticles->Clear();
+   
+   for (Int_t nrpidtype=0; nrpidtype < (fParticleTypeParameters->GetLast() + 1); nrpidtype++) {
+      Int_t nrpart = 0;
+      Int_t pidcode = ((TMevSimPartTypeParams *) (*fParticleTypeParameters)[nrpidtype])->GetGPid();
+      while ((TRACK.pout[(4*nrpart+3)*NPID+nrpidtype] > 0.0) || (TRACK.pout[(4*nrpart)*NPID+nrpidtype] != 0.0)) {
+        int poffset = 4*nrpart*NPID+nrpidtype;
+        Float_t px = TRACK.pout[poffset];
+        poffset += NPID;
+        Float_t py = TRACK.pout[poffset];
+        poffset += NPID;
+        Float_t pz = TRACK.pout[poffset];
+        poffset += NPID;
+        Float_t mass = TRACK.pout[poffset];
+        TParticle * p = new TParticle(
+                                         PDGFromId(pidcode),  // Get the PDG ID from GEANT ID
+                                         0,
+                                         0,
+                                         0,
+                                         0,
+                                         0,
+                                         px,
+                                         py,
+                                         pz,
+                                         sqrt(mass*mass+px*px+py*py+pz*pz),                               
+                                         0,
+                                         0,
+                                         0,
+                                         0);
+        fParticles->Add(p);
+        nrpart++;
+      }
+   }
+   return fParticles;
+}
+//______________________________________________________________________________
 void        TMevSim::SetNEvents(Int_t nEvents ) { 
 // Sets the number of events to be generated by MevSim.
 // Caution: Setting nEvents > 1 will have no effect, since only the last generated 
index d6b29ae549fcc980dee293229a17fdd96f3c75cd..cafdc29aef8cbff437784a4107290ceb6e3a3fcf 100644 (file)
@@ -38,6 +38,8 @@ class TMevSim : public TGenerator {
 
    virtual void        GenerateEvent();
 
+   TObjArray *         ImportParticles(Option_t * option);
+
    virtual Int_t       ImportParticles(TClonesArray *particles, Option_t *option="");
 
    //Parameters for the generation:
index 68f621cd2ca30cb3b8d9397ec643b73c30008863..23f52b3a8ed4855aa2287b12d91dd0079b63779b 100644 (file)
@@ -36,7 +36,7 @@ class TMevSimPartTypeParams : public TObject {
    // Copy and assignment operators;
    
    TMevSimPartTypeParams (const TMevSimPartTypeParams& pars);                    // copy constructor
-   virtual TMevSimPartTypeParams& operator=(const TMevSimPartTypeParams& pars);  // assignment operator 
+   TMevSimPartTypeParams& operator=(const TMevSimPartTypeParams& pars);  // assignment operator 
    
    // Parameters of the particle type