Using the density matrix


{

    //Creates the matrix object:
    PDensityMatrix *matrix = new PDensityMatrix();
    
    //Open the HSD-file:
    matrix->ReadDensityMatrix("fort.925", 3, kTRUE, 0.49, 0.51);
    //Options:
    // * Filename
    // * Number of dimension-columns (Important!)
    // * Correct integral for the bin width
    // * Lower bound for section selection
    // * Upper bound for section selection
    
    //Create a seed particle:
    PParticle *seed = new PParticle("dilepton", 0., 0., 0.);
    //matrix->AddParticle(seed); //Do not use that when in already taken in PReaction as seed!!!

    //Use matrix 12:
    matrix->SetMatrix(12);
    //(counting from 0, the columns for the dimensions must be substracted)
    
    //Convert _x, _y and _z into physical variables:
    matrix->Do("mt  = sqrt(_z*_z + _x*_x)");
    matrix->Do("p3  = mt * sinh(_y)");
    matrix->Do("phi = sampleFlat() * TMath::Pi() * 2.0");
    matrix->Do("p1  = _z * sin(phi)");
    matrix->Do("p2  = _z * cos(phi)");
    matrix->Do("[dilepton]->SetPx(p1)");
    matrix->Do("[dilepton]->SetPy(p2)");
    matrix->Do("[dilepton]->SetPz(p3)");
    matrix->Do("[dilepton]->SetM(_x)");

    //Optional boost by a TLorentzVector:
    //just dummy! must be replaced by parameters of the fireball c.m.
    //N.b. the sign of pz must be negative to boost in forward direction
    PParticle boost(0, 0, 0, -4.0, 1.0); 
    
    *(makeDynamicData()->GetBatchParticle("boost")) = boost; //copy to script
    //id, Px, Py, Pz (GeV/c), mass (GeV/c**2)
    matrix->Do("foreach(*); [*]->Boost(boost)");

    //Start the reaction:
    PParticle *ep  = new PParticle("e+");
    PParticle *em  = new PParticle("e-");
    PParticle *p[] = {seed, em, ep};
    PChannel dilepton_decay(p, 2);
    dilepton_decay.AddPrologueBulk(matrix);

    PChannel *c[]={&dilepton_decay};
    PReaction my_reaction(c, "output", 1);
    
    //Just for debugging...
    TH1F *histo1 = new TH1F("histo1", "ee mass", 100, 0.01, 1.5);
    my_reaction.Do(histo1, "_x = ([e+]+[e-])->M()");
    TH2F *histo2 = new TH2F("histo2","Y vs. Pt", 100, -4.0, 6.0, 300, 0.,1.);
    my_reaction.Do(histo2, "_x = ([e+]+[e-])->Rapidity(); _y = ([e+]+[e-])->Pt()");

    my_reaction.Loop(1000000);

    histo1->Draw();

}
 use_DensityMatrix.C:1
 use_DensityMatrix.C:2
 use_DensityMatrix.C:3
 use_DensityMatrix.C:4
 use_DensityMatrix.C:5
 use_DensityMatrix.C:6
 use_DensityMatrix.C:7
 use_DensityMatrix.C:8
 use_DensityMatrix.C:9
 use_DensityMatrix.C:10
 use_DensityMatrix.C:11
 use_DensityMatrix.C:12
 use_DensityMatrix.C:13
 use_DensityMatrix.C:14
 use_DensityMatrix.C:15
 use_DensityMatrix.C:16
 use_DensityMatrix.C:17
 use_DensityMatrix.C:18
 use_DensityMatrix.C:19
 use_DensityMatrix.C:20
 use_DensityMatrix.C:21
 use_DensityMatrix.C:22
 use_DensityMatrix.C:23
 use_DensityMatrix.C:24
 use_DensityMatrix.C:25
 use_DensityMatrix.C:26
 use_DensityMatrix.C:27
 use_DensityMatrix.C:28
 use_DensityMatrix.C:29
 use_DensityMatrix.C:30
 use_DensityMatrix.C:31
 use_DensityMatrix.C:32
 use_DensityMatrix.C:33
 use_DensityMatrix.C:34
 use_DensityMatrix.C:35
 use_DensityMatrix.C:36
 use_DensityMatrix.C:37
 use_DensityMatrix.C:38
 use_DensityMatrix.C:39
 use_DensityMatrix.C:40
 use_DensityMatrix.C:41
 use_DensityMatrix.C:42
 use_DensityMatrix.C:43
 use_DensityMatrix.C:44
 use_DensityMatrix.C:45
 use_DensityMatrix.C:46
 use_DensityMatrix.C:47
 use_DensityMatrix.C:48
 use_DensityMatrix.C:49
 use_DensityMatrix.C:50
 use_DensityMatrix.C:51
 use_DensityMatrix.C:52
 use_DensityMatrix.C:53
 use_DensityMatrix.C:54
 use_DensityMatrix.C:55
 use_DensityMatrix.C:56
 use_DensityMatrix.C:57
 use_DensityMatrix.C:58
 use_DensityMatrix.C:59
 use_DensityMatrix.C:60
 use_DensityMatrix.C:61
 use_DensityMatrix.C:62
 use_DensityMatrix.C:63
 use_DensityMatrix.C:64
 use_DensityMatrix.C:65